From 6f93428f9609c2210a07ab08bf6cbaa1d3a87c6a Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sun, 12 Feb 2023 05:07:13 +1100 Subject: -osd/windows/winutil.cpp: Better way to get module handle. * This was leftover support for Windows 2000 and earlier that hadn't been cleaned up. -atari: Don't forget your #include guards! --- src/mame/atari/skydiver_a.h | 6 ++++++ src/mame/atari/skyraid_a.h | 6 ++++++ src/mame/atari/sprint2_a.h | 6 ++++++ src/mame/atari/sprint8_a.h | 6 ++++++ src/mame/atari/starshp1.cpp | 18 +++++++++--------- src/mame/atari/starshp1_a.h | 6 ++++++ src/mame/atari/subs_a.h | 6 ++++++ src/mame/atari/tank8_a.h | 6 ++++++ src/mame/atari/triplhnt_a.cpp | 2 -- src/mame/atari/triplhnt_a.h | 6 ++++++ src/mame/atari/videopin_a.h | 6 ++++++ src/osd/modules/input/input_dinput.h | 2 +- src/osd/windows/winutil.cpp | 9 ++++++--- 13 files changed, 70 insertions(+), 15 deletions(-) diff --git a/src/mame/atari/skydiver_a.h b/src/mame/atari/skydiver_a.h index 9617d1e4d51..bf4a9669fb3 100644 --- a/src/mame/atari/skydiver_a.h +++ b/src/mame/atari/skydiver_a.h @@ -6,6 +6,10 @@ Sky Diver Audio ***************************************************************************/ +#ifndef MAME_ATARI_SKYDIVER_A_H +#define MAME_ATARI_SKYDIVER_A_H + +#pragma once #include "sound/discrete.h" @@ -24,3 +28,5 @@ Sky Diver Audio DISCRETE_SOUND_EXTERN( skydiver_discrete ); + +#endif // MAME_ATARI_SKYDIVER_A_H diff --git a/src/mame/atari/skyraid_a.h b/src/mame/atari/skyraid_a.h index 587bf2d0176..df710c928b2 100644 --- a/src/mame/atari/skyraid_a.h +++ b/src/mame/atari/skyraid_a.h @@ -6,6 +6,10 @@ Sky Raider Audio ***************************************************************************/ +#ifndef MAME_ATARI_SKYRAID_A_H +#define MAME_ATARI_SKYRAID_A_H + +#pragma once #include "sound/discrete.h" @@ -20,3 +24,5 @@ Sky Raider Audio DISCRETE_SOUND_EXTERN( skyraid_discrete ); + +#endif // MAME_ATARI_SKYRAID_A_H diff --git a/src/mame/atari/sprint2_a.h b/src/mame/atari/sprint2_a.h index fe3de798aa5..16c22f68fee 100644 --- a/src/mame/atari/sprint2_a.h +++ b/src/mame/atari/sprint2_a.h @@ -6,6 +6,10 @@ Sprint 2 / Sprint 1 / Dominos Audio ***************************************************************************/ +#ifndef MAME_ATARI_SPRINT2_A_H +#define MAME_ATARI_SPRINT2_A_H + +#pragma once #include "sound/discrete.h" @@ -28,3 +32,5 @@ Sprint 2 / Sprint 1 / Dominos Audio DISCRETE_SOUND_EXTERN( sprint2_discrete ); DISCRETE_SOUND_EXTERN( sprint1_discrete ); DISCRETE_SOUND_EXTERN( dominos_discrete ); + +#endif // MAME_ATARI_SPRINT2_A_H diff --git a/src/mame/atari/sprint8_a.h b/src/mame/atari/sprint8_a.h index 8faf5cacc0a..e3b7e8158dd 100644 --- a/src/mame/atari/sprint8_a.h +++ b/src/mame/atari/sprint8_a.h @@ -6,6 +6,10 @@ Sprint 8 Audio ***************************************************************************/ +#ifndef MAME_ATARI_SPRINT8_A_H +#define MAME_ATARI_SPRINT8_A_H + +#pragma once #include "sound/discrete.h" @@ -25,3 +29,5 @@ Sprint 8 Audio DISCRETE_SOUND_EXTERN( sprint8_discrete ); + +#endif // MAME_ATARI_SPRINT8_A_H diff --git a/src/mame/atari/starshp1.cpp b/src/mame/atari/starshp1.cpp index d1fee954e49..6dd7d529edb 100644 --- a/src/mame/atari/starshp1.cpp +++ b/src/mame/atari/starshp1.cpp @@ -821,9 +821,9 @@ GFXDECODE_END void starshp1_state::starshp1(machine_config &config) { - static constexpr XTAL MASTER_CLOCK = 12.096_MHz_XTAL; - static constexpr XTAL CPU_CLOCK = MASTER_CLOCK / 16; - static constexpr XTAL PIXEL_CLOCK = MASTER_CLOCK; + constexpr XTAL MASTER_CLOCK = 12.096_MHz_XTAL; + constexpr XTAL CPU_CLOCK = MASTER_CLOCK / 16; + constexpr XTAL PIXEL_CLOCK = MASTER_CLOCK; // basic machine hardware @@ -843,12 +843,12 @@ void starshp1_state::starshp1(machine_config &config) // video hardware - static constexpr int HTOTAL = 0x300; - static constexpr int HBEND = 0x000; - static constexpr int HBSTART = 0x200; - static constexpr int VTOTAL = 0x106; - static constexpr int VBEND = 0x000; - static constexpr int VBSTART = 0x0f0; + constexpr int HTOTAL = 0x300; + constexpr int HBEND = 0x000; + constexpr int HBSTART = 0x200; + constexpr int VTOTAL = 0x106; + constexpr int VBEND = 0x000; + constexpr int VBSTART = 0x0f0; SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_raw(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART); diff --git a/src/mame/atari/starshp1_a.h b/src/mame/atari/starshp1_a.h index 1a9adcce8e4..85e42e7595a 100644 --- a/src/mame/atari/starshp1_a.h +++ b/src/mame/atari/starshp1_a.h @@ -6,6 +6,10 @@ Starship 1 Audio ***************************************************************************/ +#ifndef MAME_ATARI_STARSHP1_A_H +#define MAME_ATARI_STARSHP1_A_H + +#pragma once #include "sound/discrete.h" @@ -24,3 +28,5 @@ Starship 1 Audio DISCRETE_SOUND_EXTERN( starshp1_discrete ); + +#endif // MAME_ATARI_STARSHP1_A_H diff --git a/src/mame/atari/subs_a.h b/src/mame/atari/subs_a.h index 711b1d90efa..9950155d50e 100644 --- a/src/mame/atari/subs_a.h +++ b/src/mame/atari/subs_a.h @@ -6,6 +6,10 @@ Subs Audio ***************************************************************************/ +#ifndef MAME_ATARI_SUBS_A_H +#define MAME_ATARI_SUBS_A_H + +#pragma once #include "sound/discrete.h" @@ -21,3 +25,5 @@ Subs Audio DISCRETE_SOUND_EXTERN( subs_discrete ); + +#endif // MAME_ATARI_SUBS_A_H diff --git a/src/mame/atari/tank8_a.h b/src/mame/atari/tank8_a.h index 6192e98150d..3fcee2e60ff 100644 --- a/src/mame/atari/tank8_a.h +++ b/src/mame/atari/tank8_a.h @@ -6,6 +6,10 @@ Tank 8 Audio ***************************************************************************/ +#ifndef MAME_ATARI_TANK8_A_H +#define MAME_ATARI_TANK8_A_H + +#pragma once #include "sound/discrete.h" @@ -28,3 +32,5 @@ Tank 8 Audio DISCRETE_SOUND_EXTERN( tank8_discrete ); + +#endif // MAME_ATARI_TANK8_A_H diff --git a/src/mame/atari/triplhnt_a.cpp b/src/mame/atari/triplhnt_a.cpp index e92707ac56a..50096281fe6 100644 --- a/src/mame/atari/triplhnt_a.cpp +++ b/src/mame/atari/triplhnt_a.cpp @@ -10,8 +10,6 @@ #include "triplhnt_a.h" -#include "sound/discrete.h" - const char *const triplhnt_sample_names[] = { diff --git a/src/mame/atari/triplhnt_a.h b/src/mame/atari/triplhnt_a.h index a720ac00092..c848147ec33 100644 --- a/src/mame/atari/triplhnt_a.h +++ b/src/mame/atari/triplhnt_a.h @@ -6,6 +6,10 @@ Triple Hunt Audio ***************************************************************************/ +#ifndef MAME_ATARI_TRIPLHNT_A_H +#define MAME_ATARI_TRIPLHNT_A_H + +#pragma once #include "sound/discrete.h" @@ -20,3 +24,5 @@ Triple Hunt Audio DISCRETE_SOUND_EXTERN( triplhnt_discrete ); extern const char *const triplhnt_sample_names[]; + +#endif // MAME_ATARI_TRIPLHNT_A_H diff --git a/src/mame/atari/videopin_a.h b/src/mame/atari/videopin_a.h index 12eb7998f03..4ded5d0862c 100644 --- a/src/mame/atari/videopin_a.h +++ b/src/mame/atari/videopin_a.h @@ -6,6 +6,10 @@ Video Pinball Audio ***************************************************************************/ +#ifndef MAME_ATARI_VIDEOPIN_A_H +#define MAME_ATARI_VIDEOPIN_A_H + +#pragma once #include "sound/discrete.h" @@ -20,3 +24,5 @@ Video Pinball Audio DISCRETE_SOUND_EXTERN( videopin_discrete ); + +#endif // MAME_ATARI_VIDEOPIN_A_H diff --git a/src/osd/modules/input/input_dinput.h b/src/osd/modules/input/input_dinput.h index 48973187c97..75fc873d049 100644 --- a/src/osd/modules/input/input_dinput.h +++ b/src/osd/modules/input/input_dinput.h @@ -25,8 +25,8 @@ #include #include -#include #include +#include #include diff --git a/src/osd/windows/winutil.cpp b/src/osd/windows/winutil.cpp index 3ee4ffde376..55b11f27522 100644 --- a/src/osd/windows/winutil.cpp +++ b/src/osd/windows/winutil.cpp @@ -125,9 +125,12 @@ std::string osd_subst_env(std::string_view src) HMODULE WINAPI GetModuleHandleUni() { - MEMORY_BASIC_INFORMATION mbi; - VirtualQuery((LPCVOID)GetModuleHandleUni, &mbi, sizeof(mbi)); - return (HMODULE)mbi.AllocationBase; + HMODULE result = nullptr; + BOOL const succeeded = GetModuleHandleEx( + GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT | GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, + LPCWSTR(uintptr_t(&GetModuleHandleUni)), + &result); + return succeeded ? result : nullptr; } -- cgit v1.2.3