diff --git a/hash/x1_cass.xml b/hash/x1_cass.xml index 47ecf125bbc..fe8756f5e9c 100644 --- a/hash/x1_cass.xml +++ b/hash/x1_cass.xml @@ -12,6 +12,20 @@ Titles, publishers and release dates taken from: + + El Alamein + 1983 + ポニカ (Pony Canyon) + + + + + + + + + + The Black Onyx 1985 @@ -76,6 +90,18 @@ Titles, publishers and release dates taken from: + + + Cannon Ball + 1983 + ハドソン (Hudson Soft) + + + + + + + Champion ProWres Special @@ -296,6 +322,18 @@ Titles, publishers and release dates taken from: + + + Ginkou Goutou - Machinegun Joe vs. the Mafia + 1983 + ハドソン (Hudson Soft) + + + + + + + Mappy diff --git a/src/emu/sound/c352.c b/src/emu/sound/c352.c index b4172e43aa0..98f8f3a9fed 100644 --- a/src/emu/sound/c352.c +++ b/src/emu/sound/c352.c @@ -13,6 +13,14 @@ Supports 8-bit linear and 8-bit muLaw samples Output: digital, 16 bit, 4 channels Output sample rate is the input clock / (288 * 2). + + superctr: The clock divider appears to be configurable for each system. + Below is a list of the divider values followed by the systems that use it. + + * 228: System 11. + * 288: System 22, Super 22, NB-1/2, ND-1, FL. + * 296: System 23, Super 23. + * 332: System 12. */ #include "emu.h" @@ -468,7 +476,7 @@ void c352_device::write_reg16(unsigned long address, unsigned short val) void c352_device::device_start() { - int i, divider; + int i; double x_max = 32752.0; double y_max = 127.0; double u = 10.0; @@ -476,21 +484,7 @@ void c352_device::device_start() // find our direct access m_direct = &space().direct(); - switch(m_divider) - { - case C352_DIVIDER_228: - divider=228; - break; - case C352_DIVIDER_288: - default: - divider=288; - break; - case C352_DIVIDER_332: - divider=332; - break; - } - - m_sample_rate_base = clock() / divider; + m_sample_rate_base = clock() / m_divider; m_stream = machine().sound().stream_alloc(*this, 0, 4, m_sample_rate_base); diff --git a/src/emu/sound/c352.h b/src/emu/sound/c352.h index 31eceffb366..24a2a1cbe74 100644 --- a/src/emu/sound/c352.h +++ b/src/emu/sound/c352.h @@ -5,17 +5,6 @@ #ifndef __C352_H__ #define __C352_H__ -//************************************************************************** -// CONSTANTS -//************************************************************************** - -enum -{ - C352_DIVIDER_228 = 0, - C352_DIVIDER_288 = 1, - C352_DIVIDER_332 = 2 -}; - //************************************************************************** // INTERFACE CONFIGURATION MACROS //************************************************************************** diff --git a/src/mame/drivers/namcofl.c b/src/mame/drivers/namcofl.c index 2b50acddabd..8bef9d9c7d8 100644 --- a/src/mame/drivers/namcofl.c +++ b/src/mame/drivers/namcofl.c @@ -610,7 +610,7 @@ static MACHINE_CONFIG_START( namcofl, namcofl_state ) MCFG_VIDEO_START_OVERRIDE(namcofl_state,namcofl) MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_C352_ADD("c352", 48384000/2, C352_DIVIDER_288) + MCFG_C352_ADD("c352", 48384000/2, 288) MCFG_SOUND_ROUTE(0, "rspeaker", 1.00) MCFG_SOUND_ROUTE(1, "lspeaker", 1.00) MCFG_SOUND_ROUTE(2, "rspeaker", 1.00) diff --git a/src/mame/drivers/namconb1.c b/src/mame/drivers/namconb1.c index 76e997aa6a7..867ae4418a5 100644 --- a/src/mame/drivers/namconb1.c +++ b/src/mame/drivers/namconb1.c @@ -1126,7 +1126,7 @@ static MACHINE_CONFIG_START( namconb1, namconb1_state ) MCFG_VIDEO_START_OVERRIDE(namconb1_state,namconb1) MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_C352_ADD("c352", MASTER_CLOCK/2, C352_DIVIDER_288) + MCFG_C352_ADD("c352", MASTER_CLOCK/2, 288) MCFG_SOUND_ROUTE(0, "rspeaker", 1.00) MCFG_SOUND_ROUTE(1, "lspeaker", 1.00) MCFG_SOUND_ROUTE(2, "rspeaker", 1.00) @@ -1163,7 +1163,7 @@ static MACHINE_CONFIG_START( namconb2, namconb1_state ) MCFG_VIDEO_START_OVERRIDE(namconb1_state,namconb2) MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_C352_ADD("c352", MASTER_CLOCK/2, C352_DIVIDER_288) + MCFG_C352_ADD("c352", MASTER_CLOCK/2, 288) MCFG_SOUND_ROUTE(0, "rspeaker", 1.00) MCFG_SOUND_ROUTE(1, "lspeaker", 1.00) MCFG_SOUND_ROUTE(2, "rspeaker", 1.00) diff --git a/src/mame/drivers/namcond1.c b/src/mame/drivers/namcond1.c index 974446fae37..5e740e11d4a 100644 --- a/src/mame/drivers/namcond1.c +++ b/src/mame/drivers/namcond1.c @@ -307,7 +307,7 @@ static MACHINE_CONFIG_START( namcond1, namcond1_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_C352_ADD("c352", XTAL_49_152MHz/2, C352_DIVIDER_288) + MCFG_C352_ADD("c352", XTAL_49_152MHz/2, 288) MCFG_SOUND_ROUTE(0, "rspeaker", 1.00) MCFG_SOUND_ROUTE(1, "lspeaker", 1.00) MCFG_SOUND_ROUTE(2, "rspeaker", 1.00) diff --git a/src/mame/drivers/namcos11.c b/src/mame/drivers/namcos11.c index 4262d33740a..91acf77e76e 100644 --- a/src/mame/drivers/namcos11.c +++ b/src/mame/drivers/namcos11.c @@ -571,7 +571,7 @@ static MACHINE_CONFIG_START( coh110, namcos11_state ) MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_C352_ADD("c352", 20013200, C352_DIVIDER_228) + MCFG_C352_ADD("c352", 20013200, 228) MCFG_SOUND_ROUTE(0, "rspeaker", 1.00) MCFG_SOUND_ROUTE(1, "lspeaker", 1.00) MCFG_SOUND_ROUTE(2, "rspeaker", 1.00) diff --git a/src/mame/drivers/namcos12.c b/src/mame/drivers/namcos12.c index 40daecf7dae..6e5bf77ab1f 100644 --- a/src/mame/drivers/namcos12.c +++ b/src/mame/drivers/namcos12.c @@ -1622,7 +1622,7 @@ static MACHINE_CONFIG_START( coh700, namcos12_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_C352_ADD("c352", 29168000, C352_DIVIDER_332) + MCFG_C352_ADD("c352", 29168000, 332) MCFG_SOUND_ROUTE(0, "rspeaker", 1.00) MCFG_SOUND_ROUTE(1, "lspeaker", 1.00) MCFG_SOUND_ROUTE(2, "rspeaker", 1.00) diff --git a/src/mame/drivers/namcos22.c b/src/mame/drivers/namcos22.c index 6c59837bcf7..e1a28cb6272 100644 --- a/src/mame/drivers/namcos22.c +++ b/src/mame/drivers/namcos22.c @@ -3781,7 +3781,7 @@ static MACHINE_CONFIG_START( namcos22, namcos22_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_C352_ADD("c352", SS22_MASTER_CLOCK/2, C352_DIVIDER_288) + MCFG_C352_ADD("c352", SS22_MASTER_CLOCK/2, 288) MCFG_SOUND_ROUTE(0, "rspeaker", 1.00) MCFG_SOUND_ROUTE(1, "lspeaker", 1.00) MCFG_SOUND_ROUTE(2, "rspeaker", 1.00) @@ -3830,7 +3830,7 @@ static MACHINE_CONFIG_START( namcos22s, namcos22_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_C352_ADD("c352", SS22_MASTER_CLOCK/2, C352_DIVIDER_288) + MCFG_C352_ADD("c352", SS22_MASTER_CLOCK/2, 288) MCFG_SOUND_ROUTE(0, "rspeaker", 1.00) MCFG_SOUND_ROUTE(1, "lspeaker", 1.00) MCFG_SOUND_ROUTE(2, "rspeaker", 1.00) diff --git a/src/mame/drivers/namcos23.c b/src/mame/drivers/namcos23.c index b4f6f62e3a7..4d83d42a2b0 100644 --- a/src/mame/drivers/namcos23.c +++ b/src/mame/drivers/namcos23.c @@ -1247,7 +1247,8 @@ Notes: #define JVSCLOCK (XTAL_14_7456MHz) #define H8CLOCK (16737350) /* from 2061 */ #define BUSCLOCK (16737350*2) /* 33MHz CPU bus clock / input */ -#define C352CLOCK (25992000) /* measured at 25.992MHz from 2061 pin 9 (System 12 uses a divider of 332) */ +#define C352CLOCK (25992000) /* measured at 25.992MHz from 2061 pin 9 */ +#define C352DIV (296) #define VSYNC1 (59.8824) #define VSYNC2 (59.915) #define HSYNC (16666150) @@ -3320,7 +3321,7 @@ static MACHINE_CONFIG_START( gorgon, namcos23_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_C352_ADD("c352", C352CLOCK, C352_DIVIDER_332) + MCFG_C352_ADD("c352", C352CLOCK, C352DIV) MCFG_SOUND_ROUTE(0, "rspeaker", 1.00) MCFG_SOUND_ROUTE(1, "lspeaker", 1.00) MCFG_SOUND_ROUTE(2, "rspeaker", 1.00) @@ -3389,7 +3390,7 @@ static MACHINE_CONFIG_START( s23, namcos23_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_C352_ADD("c352", C352CLOCK, C352_DIVIDER_332) + MCFG_C352_ADD("c352", C352CLOCK, C352DIV) MCFG_SOUND_ROUTE(0, "rspeaker", 1.00) MCFG_SOUND_ROUTE(1, "lspeaker", 1.00) MCFG_SOUND_ROUTE(2, "rspeaker", 1.00) @@ -3469,7 +3470,7 @@ static MACHINE_CONFIG_START( ss23, namcos23_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_C352_ADD("c352", C352CLOCK, C352_DIVIDER_332) + MCFG_C352_ADD("c352", C352CLOCK, C352DIV) MCFG_SOUND_ROUTE(0, "rspeaker", 1.00) MCFG_SOUND_ROUTE(1, "lspeaker", 1.00) MCFG_SOUND_ROUTE(2, "rspeaker", 1.00) diff --git a/src/mess/drivers/mc1000.c b/src/mess/drivers/mc1000.c index eeef788546d..defef2a94c0 100644 --- a/src/mess/drivers/mc1000.c +++ b/src/mess/drivers/mc1000.c @@ -378,7 +378,7 @@ void mc1000_state::machine_reset() +---------*---*---o V+ | | | +-+ | | - | |309K | | + | |390K | | | |R17 |8 |4 +-+ +-------+ | 7| |3 @@ -390,23 +390,23 @@ void mc1000_state::machine_reset() | | | | 555 | +-+ | | | | | 6| |5 - *----*?-| |---+ + *----*--| |---+ | | | | ---C30 +-------+ ---C29 - ---103 |1 ---103 + ---10n |1 ---10n _|_ _|_ _|_ /// /// /// Calculated properties: * 99.74489795918367 Duty Cycle Percentage - * 368.1126130105722 Frequency in Hertz + * 367.3469387755102 Frequency in Hertz * 0.00000693 Seconds Low - * 0.0027096299999999998 Seconds High + * 0.00270963 Seconds High */ -#define MC1000_NE555_FREQ (368) /* Hz */ +#define MC1000_NE555_FREQ (367) /* Hz */ #define MC1000_NE555_DUTY_CYCLE (99.745) /* % */ TIMER_DEVICE_CALLBACK_MEMBER(mc1000_state::ne555_tick) diff --git a/src/osd/modules/debugger/win/debugviewinfo.c b/src/osd/modules/debugger/win/debugviewinfo.c index b4868800692..abdddcec931 100644 --- a/src/osd/modules/debugger/win/debugviewinfo.c +++ b/src/osd/modules/debugger/win/debugviewinfo.c @@ -15,6 +15,8 @@ #include "strconv.h" +#include "winutil.h" + // debugger view styles #define DEBUG_VIEW_STYLE WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN @@ -48,15 +50,15 @@ debugview_info::debugview_info(debugger_windows_interface &debugger, debugwin_in // create the child view m_wnd = CreateWindowEx(DEBUG_VIEW_STYLE_EX, TEXT("MAMEDebugView"), NULL, DEBUG_VIEW_STYLE, - 0, 0, 100, 100, parent, NULL, GetModuleHandle(NULL), this); + 0, 0, 100, 100, parent, NULL, GetModuleHandleUni(), this); if (m_wnd == NULL) goto cleanup; // create the scroll bars m_hscroll = CreateWindowEx(HSCROLL_STYLE_EX, TEXT("SCROLLBAR"), NULL, HSCROLL_STYLE, - 0, 0, 100, CW_USEDEFAULT, m_wnd, NULL, GetModuleHandle(NULL), this); + 0, 0, 100, CW_USEDEFAULT, m_wnd, NULL, GetModuleHandleUni(), this); m_vscroll = CreateWindowEx(VSCROLL_STYLE_EX, TEXT("SCROLLBAR"), NULL, VSCROLL_STYLE, - 0, 0, CW_USEDEFAULT, 100, m_wnd, NULL, GetModuleHandle(NULL), this); + 0, 0, CW_USEDEFAULT, 100, m_wnd, NULL, GetModuleHandleUni(), this); if ((m_hscroll == NULL) || (m_vscroll == NULL)) goto cleanup; @@ -254,7 +256,7 @@ HWND debugview_info::create_source_combobox(HWND parent, LONG_PTR userdata) { // create a combo box HWND const result = CreateWindowEx(COMBO_BOX_STYLE_EX, TEXT("COMBOBOX"), NULL, COMBO_BOX_STYLE, - 0, 0, 100, 1000, parent, NULL, GetModuleHandle(NULL), NULL); + 0, 0, 100, 1000, parent, NULL, GetModuleHandleUni(), NULL); SetWindowLongPtr(result, GWLP_USERDATA, userdata); SendMessage(result, WM_SETFONT, (WPARAM)metrics().debug_font(), (LPARAM)FALSE); @@ -789,7 +791,7 @@ void debugview_info::register_window_class() // initialize the description of the window class wc.lpszClassName = TEXT("MAMEDebugView"); - wc.hInstance = GetModuleHandle(NULL); + wc.hInstance = GetModuleHandleUni(); wc.lpfnWndProc = &debugview_info::static_view_proc; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hIcon = LoadIcon(wc.hInstance, MAKEINTRESOURCE(2)); @@ -798,6 +800,8 @@ void debugview_info::register_window_class() wc.style = 0; wc.cbClsExtra = 0; wc.cbWndExtra = 0; + + UnregisterClass(wc.lpszClassName, wc.hInstance); // register the class; fail if we can't if (!RegisterClass(&wc)) diff --git a/src/osd/modules/debugger/win/debugwininfo.c b/src/osd/modules/debugger/win/debugwininfo.c index 1a3258c1cab..4a8223f39fb 100644 --- a/src/osd/modules/debugger/win/debugwininfo.c +++ b/src/osd/modules/debugger/win/debugwininfo.c @@ -17,6 +17,8 @@ #include "window.h" #include "winutf8.h" +#include "winutil.h" + bool debugwin_info::s_window_class_registered = false; @@ -36,7 +38,7 @@ debugwin_info::debugwin_info(debugger_windows_interface &debugger, bool is_main_ register_window_class(); m_wnd = win_create_window_ex_utf8(DEBUG_WINDOW_STYLE_EX, "MAMEDebugWindow", title, DEBUG_WINDOW_STYLE, - 0, 0, 100, 100, win_window_list->m_hwnd, create_standard_menubar(), GetModuleHandle(NULL), this); + 0, 0, 100, 100, win_window_list->m_hwnd, create_standard_menubar(), GetModuleHandleUni(), this); if (m_wnd == NULL) return; @@ -580,7 +582,7 @@ void debugwin_info::register_window_class() // initialize the description of the window class wc.lpszClassName = TEXT("MAMEDebugWindow"); - wc.hInstance = GetModuleHandle(NULL); + wc.hInstance = GetModuleHandleUni(); wc.lpfnWndProc = &debugwin_info::static_window_proc; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hIcon = LoadIcon(wc.hInstance, MAKEINTRESOURCE(2)); @@ -589,6 +591,8 @@ void debugwin_info::register_window_class() wc.style = 0; wc.cbClsExtra = 0; wc.cbWndExtra = 0; + + UnregisterClass(wc.lpszClassName, wc.hInstance); // register the class; fail if we can't if (!RegisterClass(&wc)) diff --git a/src/osd/modules/debugger/win/editwininfo.c b/src/osd/modules/debugger/win/editwininfo.c index 1ccd96ff7aa..279bc68fbe3 100644 --- a/src/osd/modules/debugger/win/editwininfo.c +++ b/src/osd/modules/debugger/win/editwininfo.c @@ -13,6 +13,8 @@ #include "strconv.h" +#include "winutil.h" + // edit box styles #define EDIT_BOX_STYLE WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL @@ -32,7 +34,7 @@ editwin_info::editwin_info(debugger_windows_interface &debugger, bool is_main_co // create an edit box and override its key handling m_editwnd = CreateWindowEx(EDIT_BOX_STYLE_EX, TEXT("EDIT"), NULL, EDIT_BOX_STYLE, - 0, 0, 100, 100, window(), NULL, GetModuleHandle(NULL), NULL); + 0, 0, 100, 100, window(), NULL, GetModuleHandleUni(), NULL); m_original_editproc = (WNDPROC)(FPTR)GetWindowLongPtr(m_editwnd, GWLP_WNDPROC); SetWindowLongPtr(m_editwnd, GWLP_USERDATA, (LONG_PTR)this); SetWindowLongPtr(m_editwnd, GWLP_WNDPROC, (LONG_PTR)&editwin_info::static_edit_proc); diff --git a/src/osd/windows/input.c b/src/osd/windows/input.c index ec08277bcf4..ef2f3108900 100644 --- a/src/osd/windows/input.c +++ b/src/osd/windows/input.c @@ -38,6 +38,8 @@ #include "strconv.h" #include "config.h" +#include "winutil.h" + //============================================================ // PARAMETERS //============================================================ @@ -1117,7 +1119,7 @@ static void dinput_init(running_machine &machine) int didevtype_joystick = DI8DEVCLASS_GAMECTRL; dinput_version = DIRECTINPUT_VERSION; - result = DirectInput8Create(GetModuleHandle(NULL), dinput_version, IID_IDirectInput8, (void **)&dinput, NULL); + result = DirectInput8Create(GetModuleHandleUni(), dinput_version, IID_IDirectInput8, (void **)&dinput, NULL); if (result != DI_OK) { dinput_version = 0; @@ -1130,17 +1132,17 @@ static void dinput_init(running_machine &machine) // first attempt to initialize DirectInput at the current version dinput_version = DIRECTINPUT_VERSION; - result = DirectInputCreate(GetModuleHandle(NULL), dinput_version, &dinput, NULL); + result = DirectInputCreate(GetModuleHandleUni(), dinput_version, &dinput, NULL); if (result != DI_OK) { // if that fails, try version 5 dinput_version = 0x0500; - result = DirectInputCreate(GetModuleHandle(NULL), dinput_version, &dinput, NULL); + result = DirectInputCreate(GetModuleHandleUni(), dinput_version, &dinput, NULL); if (result != DI_OK) { // if that fails, try version 3 dinput_version = 0x0300; - result = DirectInputCreate(GetModuleHandle(NULL), dinput_version, &dinput, NULL); + result = DirectInputCreate(GetModuleHandleUni(), dinput_version, &dinput, NULL); if (result != DI_OK) { dinput_version = 0; diff --git a/src/osd/windows/output.c b/src/osd/windows/output.c index 142488c3c15..7c7dbe35484 100644 --- a/src/osd/windows/output.c +++ b/src/osd/windows/output.c @@ -17,6 +17,8 @@ // MAMEOS headers #include "output.h" +#include "winutil.h" + //============================================================ @@ -101,7 +103,7 @@ bool windows_osd_interface::output_init() 1, 1, NULL, NULL, - GetModuleHandle(NULL), + GetModuleHandleUni(), NULL); assert(output_hwnd != NULL); @@ -167,8 +169,10 @@ static int create_window_class(void) // initialize the description of the window class wc.lpszClassName = OUTPUT_WINDOW_CLASS; - wc.hInstance = GetModuleHandle(NULL); + wc.hInstance = GetModuleHandleUni(); wc.lpfnWndProc = output_window_proc; + + UnregisterClass(wc.lpszClassName, wc.hInstance); // register the class; fail if we can't if (!RegisterClass(&wc)) diff --git a/src/osd/windows/window.c b/src/osd/windows/window.c index 1bb225f3e0b..94a0a69ea94 100644 --- a/src/osd/windows/window.c +++ b/src/osd/windows/window.c @@ -35,6 +35,8 @@ #include "config.h" #include "winutf8.h" +#include "winutil.h" + extern int drawnone_init(running_machine &machine, osd_draw_callbacks *callbacks); extern int drawgdi_init(running_machine &machine, osd_draw_callbacks *callbacks); extern int drawdd_init(running_machine &machine, osd_draw_callbacks *callbacks); @@ -885,10 +887,12 @@ static void create_window_class(void) // initialize the description of the window class wc.lpszClassName = TEXT("MAME"); - wc.hInstance = GetModuleHandle(NULL); + wc.hInstance = GetModuleHandleUni(); wc.lpfnWndProc = winwindow_video_window_proc_ui; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hIcon = LoadIcon(wc.hInstance, MAKEINTRESOURCE(2)); + + UnregisterClass(wc.lpszClassName, wc.hInstance); // register the class; fail if we can't if (!RegisterClass(&wc)) @@ -1191,7 +1195,7 @@ int win_window_info::complete_create() monitorbounds.left() + 100, monitorbounds.top() + 100, NULL,//(win_window_list != NULL) ? win_window_list->m_hwnd : NULL, menu, - GetModuleHandle(NULL), + GetModuleHandleUni(), NULL); if (m_hwnd == NULL) return 1; diff --git a/src/osd/windows/winmain.c b/src/osd/windows/winmain.c index 54afff74298..74317eb30aa 100644 --- a/src/osd/windows/winmain.c +++ b/src/osd/windows/winmain.c @@ -1321,7 +1321,7 @@ FPTR symbol_manager::get_text_section_base() dynamic_bind image_nt_header(TEXT("dbghelp.dll"), "ImageNtHeader"); // start with the image base - PVOID base = reinterpret_cast(GetModuleHandle(NULL)); + PVOID base = reinterpret_cast(GetModuleHandleUni()); assert(base != NULL); // make sure we have the functions we need diff --git a/src/osd/windows/winutil.c b/src/osd/windows/winutil.c index adc78c36c75..c34e358492b 100644 --- a/src/osd/windows/winutil.c +++ b/src/osd/windows/winutil.c @@ -92,7 +92,7 @@ BOOL win_is_gui_application(void) is_first_time = FALSE; // get the current module - module = GetModuleHandle(NULL); + module = GetModuleHandleUni(); if (!module) return FALSE; image_ptr = (BYTE*) module; @@ -122,3 +122,14 @@ BOOL win_is_gui_application(void) } return is_gui_frontend; } + +//------------------------------------------------- +// Universal way to get module handle +//------------------------------------------------- + +HMODULE WINAPI GetModuleHandleUni() +{ + MEMORY_BASIC_INFORMATION mbi; + VirtualQuery((LPCVOID)GetModuleHandleUni, &mbi, sizeof(mbi)); + return (HMODULE)mbi.AllocationBase; +} diff --git a/src/osd/windows/winutil.h b/src/osd/windows/winutil.h index 7a469a2807f..c8d1190b6a8 100644 --- a/src/osd/windows/winutil.h +++ b/src/osd/windows/winutil.h @@ -15,5 +15,6 @@ file_error win_error_to_file_error(DWORD error); osd_dir_entry_type win_attributes_to_entry_type(DWORD attributes); BOOL win_is_gui_application(void); +HMODULE WINAPI GetModuleHandleUni(); #endif // __WINUTIL__