summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd
diff options
context:
space:
mode:
author ImJezze <jezze@gmx.net>2016-03-12 12:31:13 +0100
committer ImJezze <jezze@gmx.net>2016-03-12 12:31:13 +0100
commita026a582f1a0ea8c1ede3acaddacef506ef3f3b0 (patch)
treee31573822f2359677de519f9f3b600d98e8764cd /src/osd
parent477d2abd43984f076b7e45f5527591fa8fd0d241 (diff)
parentdcab55bf53b94713a6f72e9633f5101c8dd6c08c (diff)
Merge pull request #15 from mamedev/master
Sync to base master
Diffstat (limited to 'src/osd')
-rw-r--r--src/osd/eigccppc.h19
-rw-r--r--src/osd/eigccx86.h36
-rw-r--r--src/osd/eivcx86.h41
-rw-r--r--src/osd/modules/debugger/debugosx.mm98
-rw-r--r--src/osd/modules/debugger/debugqt.cpp2
-rw-r--r--src/osd/modules/debugger/osx/debugview.mm2
-rw-r--r--src/osd/modules/debugger/osx/debugwindowhandler.h1
-rw-r--r--src/osd/modules/debugger/osx/debugwindowhandler.mm15
-rw-r--r--src/osd/modules/font/font_dwrite.cpp23
-rw-r--r--src/osd/modules/input/input_common.cpp12
-rw-r--r--src/osd/modules/input/input_dinput.cpp8
-rw-r--r--src/osd/modules/input/input_rawinput.cpp106
-rw-r--r--src/osd/modules/input/input_sdl.cpp19
-rw-r--r--src/osd/modules/input/input_win32.cpp13
-rw-r--r--src/osd/modules/input/input_xinput.cpp4
-rw-r--r--src/osd/modules/lib/osdlib_macosx.cpp146
-rw-r--r--src/osd/modules/lib/osdlib_unix.cpp67
-rw-r--r--src/osd/modules/lib/osdlib_win32.cpp106
-rw-r--r--src/osd/modules/opengl/shader/glsl_bilinear_idx16_lut.fsh3
-rw-r--r--src/osd/modules/opengl/shader/glsl_bilinear_rgb32_dir.fsh3
-rw-r--r--src/osd/modules/opengl/shader/glsl_bilinear_rgb32_lut.fsh3
-rw-r--r--src/osd/modules/opengl/shader/glsl_plain_idx16_lut.fsh3
-rw-r--r--src/osd/modules/opengl/shader/glsl_plain_rgb32_dir.fsh3
-rw-r--r--src/osd/modules/opengl/shader/glsl_plain_rgb32_lut.fsh3
-rw-r--r--src/osd/modules/render/bgfx/chainmanager.cpp1
-rw-r--r--src/osd/modules/render/bgfx/effectmanager.cpp1
-rw-r--r--src/osd/modules/render/bgfx/shadermanager.cpp1
-rw-r--r--src/osd/modules/render/bgfx/statereader.cpp2
-rw-r--r--src/osd/modules/render/bgfx/statereader.h2
-rw-r--r--src/osd/modules/render/bgfx/writereader.cpp2
-rw-r--r--src/osd/modules/render/bgfx/writereader.h2
-rw-r--r--src/osd/modules/render/binpacker.h2
-rw-r--r--src/osd/modules/render/drawbgfx.h2
-rw-r--r--src/osd/modules/sound/xaudio2_sound.cpp141
-rw-r--r--src/osd/osdcomm.h42
-rw-r--r--src/osd/osdcore.cpp40
-rw-r--r--src/osd/sdl/aueffectutil.mm2
-rw-r--r--src/osd/sdl/keymaps/km-be.txt23
-rw-r--r--src/osd/sdl/keymaps/km-ch.txt14
-rw-r--r--src/osd/sdl/keymaps/km-de.txt26
-rw-r--r--src/osd/sdl/keymaps/km-fr-OSX.txt13
-rw-r--r--src/osd/sdl/keymaps/km-fr.txt23
-rw-r--r--src/osd/sdl/keymaps/km_it.txt12
-rw-r--r--src/osd/sdl/ledutil.sh3
-rw-r--r--src/osd/sdl/man/LICENSE116
-rw-r--r--src/osd/sdl/man/README.md5
-rw-r--r--src/osd/sdl/sdlmain.cpp7
-rw-r--r--src/osd/sdl/taputil.sh3
-rw-r--r--src/osd/sdl/window.cpp6
-rw-r--r--src/osd/windows/window.cpp5
-rw-r--r--src/osd/windows/winfile.cpp13
-rw-r--r--src/osd/windows/winutil.cpp8
-rw-r--r--src/osd/windows/winutil.h22
53 files changed, 511 insertions, 764 deletions
diff --git a/src/osd/eigccppc.h b/src/osd/eigccppc.h
index d9cd2ee1828..7d61ee49752 100644
--- a/src/osd/eigccppc.h
+++ b/src/osd/eigccppc.h
@@ -284,23 +284,4 @@ _count_leading_ones(UINT32 value)
return result;
}
-
-/***************************************************************************
- INLINE TIMING FUNCTIONS
-***************************************************************************/
-
-/*-------------------------------------------------
- get_profile_ticks - return a tick counter
- from the processor that can be used for
- profiling. It does not need to run at any
- particular rate.
--------------------------------------------------*/
-
-#define get_profile_ticks _get_profile_ticks
-static inline INT64 ATTR_UNUSED ATTR_FORCE_INLINE _get_profile_ticks(void)
-{
- // fix me - should use the time base
- return osd_ticks();
-}
-
#endif /* __EIGCCPPC__ */
diff --git a/src/osd/eigccx86.h b/src/osd/eigccx86.h
index 3494e33b5db..1d5c30d151c 100644
--- a/src/osd/eigccx86.h
+++ b/src/osd/eigccx86.h
@@ -521,40 +521,4 @@ _count_leading_ones(UINT32 value)
return result;
}
-/***************************************************************************
- INLINE TIMING FUNCTIONS
-***************************************************************************/
-
-/*-------------------------------------------------
- get_profile_ticks - return a tick counter
- from the processor that can be used for
- profiling. It does not need to run at any
- particular rate.
--------------------------------------------------*/
-
-#define get_profile_ticks _get_profile_ticks
-
-#ifndef __x86_64__
-static inline UINT64 ATTR_UNUSED ATTR_FORCE_INLINE _get_profile_ticks(void)
-{
- UINT64 result;
- __asm__ __volatile__ (
- "rdtsc"
- : "=A" (result)
- );
- return result;
-}
-#else
-static inline UINT64 ATTR_UNUSED ATTR_FORCE_INLINE _get_profile_ticks(void)
-{
- _x86_union r;
- __asm__ __volatile__ (
- "rdtsc"
- : "=a" (r.u32.l), "=d" (r.u32.h)
- );
-
- return (UINT64) r.u64;
-}
-#endif
-
#endif /* __EIGCCX86__ */
diff --git a/src/osd/eivcx86.h b/src/osd/eivcx86.h
index b6139f70c26..503594d3a99 100644
--- a/src/osd/eivcx86.h
+++ b/src/osd/eivcx86.h
@@ -460,45 +460,4 @@ static inline UINT8 _count_leading_ones(UINT32 value)
}
#endif
-
-
-/***************************************************************************
- INLINE TIMING FUNCTIONS
-***************************************************************************/
-
-/*-------------------------------------------------
- get_profile_ticks - return a tick counter
- from the processor that can be used for
- profiling. It does not need to run at any
- particular rate.
--------------------------------------------------*/
-
-#define get_profile_ticks _get_profile_ticks
-
-#ifdef PTR64
-
-static inline osd_ticks_t _get_profile_ticks(void)
-{
- return __rdtsc();
-}
-
-#else
-
-static inline osd_ticks_t _get_profile_ticks(void)
-{
- UINT64 result;
- UINT64 *presult = &result;
-
- __asm {
- __asm _emit 0Fh __asm _emit 031h // rdtsc
- mov ebx, presult
- mov [ebx],eax
- mov [ebx+4],edx
- }
-
- return result;
-}
-
-#endif
-
#endif /* __EIVCX86__ */
diff --git a/src/osd/modules/debugger/debugosx.mm b/src/osd/modules/debugger/debugosx.mm
index 6c52459f719..598a85dd569 100644
--- a/src/osd/modules/debugger/debugosx.mm
+++ b/src/osd/modules/debugger/debugosx.mm
@@ -29,6 +29,8 @@
#import "osx/debugconsole.h"
#import "osx/debugwindowhandler.h"
+#include <atomic>
+
//============================================================
// MODULE SUPPORT
@@ -60,10 +62,14 @@ public:
private:
running_machine *m_machine;
MAMEDebugConsole *m_console;
+
+ static std::atomic_bool s_added_menus;
};
MODULE_DEFINITION(DEBUG_OSX, debugger_osx)
+std::atomic_bool debugger_osx::s_added_menus(false);
+
//============================================================
// debugger_osx::init
//============================================================
@@ -113,7 +119,99 @@ void debugger_osx::wait_for_debugger(device_t &device, bool firststop)
// create a console window
if (m_console == nil)
+ {
+ if (!s_added_menus.exchange(true, std::memory_order_relaxed))
+ {
+ NSMenuItem *item;
+
+ NSMenu *const debugMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:@"Debug"];
+ item = [[NSApp mainMenu] insertItemWithTitle:@"Debug" action:NULL keyEquivalent:@"" atIndex:1];
+ [item setSubmenu:debugMenu];
+ [debugMenu release];
+
+ [debugMenu addItemWithTitle:@"New Memory Window"
+ action:@selector(debugNewMemoryWindow:)
+ keyEquivalent:@"d"];
+ [debugMenu addItemWithTitle:@"New Disassembly Window"
+ action:@selector(debugNewDisassemblyWindow:)
+ keyEquivalent:@"a"];
+ [debugMenu addItemWithTitle:@"New Error Log Window"
+ action:@selector(debugNewErrorLogWindow:)
+ keyEquivalent:@"l"];
+ [debugMenu addItemWithTitle:@"New (Break|Watch)points Window"
+ action:@selector(debugNewPointsWindow:)
+ keyEquivalent:@"b"];
+ [debugMenu addItemWithTitle:@"New Devices Window"
+ action:@selector(debugNewDevicesWindow:)
+ keyEquivalent:@"D"];
+
+ [debugMenu addItem:[NSMenuItem separatorItem]];
+
+ [[debugMenu addItemWithTitle:@"Soft Reset"
+ action:@selector(debugSoftReset:)
+ keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF3FunctionKey]]
+ setKeyEquivalentModifierMask:0];
+ [[debugMenu addItemWithTitle:@"Hard Reset"
+ action:@selector(debugHardReset:)
+ keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF3FunctionKey]]
+ setKeyEquivalentModifierMask:NSShiftKeyMask];
+
+ NSMenu *const runMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:@"Run"];
+ item = [[NSApp mainMenu] insertItemWithTitle:@"Run"
+ action:NULL
+ keyEquivalent:@""
+ atIndex:([[NSApp mainMenu] indexOfItemWithSubmenu:debugMenu] + 1)];
+ [item setSubmenu:runMenu];
+ [runMenu release];
+
+ [runMenu addItemWithTitle:@"Break"
+ action:@selector(debugBreak:)
+ keyEquivalent:@""];
+
+ [runMenu addItem:[NSMenuItem separatorItem]];
+
+ [[runMenu addItemWithTitle:@"Run"
+ action:@selector(debugRun:)
+ keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF5FunctionKey]]
+ setKeyEquivalentModifierMask:0];
+ [[runMenu addItemWithTitle:@"Run and Hide Debugger"
+ action:@selector(debugRunAndHide:)
+ keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF12FunctionKey]]
+ setKeyEquivalentModifierMask:0];
+ [[runMenu addItemWithTitle:@"Run to Next CPU"
+ action:@selector(debugRunToNextCPU:)
+ keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF6FunctionKey]]
+ setKeyEquivalentModifierMask:0];
+ [[runMenu addItemWithTitle:@"Run until Next Interrupt on Current CPU"
+ action:@selector(debugRunToNextInterrupt:)
+ keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF7FunctionKey]]
+ setKeyEquivalentModifierMask:0];
+ [[runMenu addItemWithTitle:@"Run until Next VBLANK"
+ action:@selector(debugRunToNextVBLANK:)
+ keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF8FunctionKey]]
+ setKeyEquivalentModifierMask:0];
+ [[runMenu addItemWithTitle:@"Run to Cursor"
+ action:@selector(debugRunToCursor:)
+ keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF4FunctionKey]]
+ setKeyEquivalentModifierMask:0];
+
+ [runMenu addItem:[NSMenuItem separatorItem]];
+
+ [[runMenu addItemWithTitle:@"Step Into"
+ action:@selector(debugStepInto:)
+ keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF11FunctionKey]]
+ setKeyEquivalentModifierMask:0];
+ [[runMenu addItemWithTitle:@"Step Over"
+ action:@selector(debugStepOver:)
+ keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF10FunctionKey]]
+ setKeyEquivalentModifierMask:0];
+ [[runMenu addItemWithTitle:@"Step Out"
+ action:@selector(debugStepOut:)
+ keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF10FunctionKey]]
+ setKeyEquivalentModifierMask:NSShiftKeyMask];
+ }
m_console = [[MAMEDebugConsole alloc] initWithMachine:*m_machine];
+ }
// make sure the debug windows are visible
if (firststop)
diff --git a/src/osd/modules/debugger/debugqt.cpp b/src/osd/modules/debugger/debugqt.cpp
index e553585f729..ac6c6a9d95c 100644
--- a/src/osd/modules/debugger/debugqt.cpp
+++ b/src/osd/modules/debugger/debugqt.cpp
@@ -317,7 +317,7 @@ void debug_qt::wait_for_debugger(device_t &device, bool firststop)
mainQtWindow->setProcessor(&device);
// Run our own QT event loop
- osd_sleep(50000);
+ osd_sleep(osd_ticks_per_second() / 1000 * 50);
qApp->processEvents(QEventLoop::AllEvents, 1);
// Refresh everyone if requested
diff --git a/src/osd/modules/debugger/osx/debugview.mm b/src/osd/modules/debugger/osx/debugview.mm
index e793c649d9e..05d2e2dfc17 100644
--- a/src/osd/modules/debugger/osx/debugview.mm
+++ b/src/osd/modules/debugger/osx/debugview.mm
@@ -63,7 +63,7 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
InactiveSelectedBackground = [[NSColor colorWithCalibratedWhite:0.875 alpha:1.0] retain];
InactiveSelectedCurrentBackground = [[NSColor colorWithCalibratedRed:0.875 green:0.5 blue:0.625 alpha:1.0] retain];
- NonWhiteCharacters = [[NSCharacterSet whitespaceAndNewlineCharacterSet] invertedSet];
+ NonWhiteCharacters = [[[NSCharacterSet whitespaceAndNewlineCharacterSet] invertedSet] retain];
}
diff --git a/src/osd/modules/debugger/osx/debugwindowhandler.h b/src/osd/modules/debugger/osx/debugwindowhandler.h
index e8d2d6eb08d..0fc40d9eb64 100644
--- a/src/osd/modules/debugger/osx/debugwindowhandler.h
+++ b/src/osd/modules/debugger/osx/debugwindowhandler.h
@@ -38,6 +38,7 @@ extern NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification;
- (void)activate;
+- (IBAction)debugBreak:(id)sender;
- (IBAction)debugRun:(id)sender;
- (IBAction)debugRunAndHide:(id)sender;
- (IBAction)debugRunToNextCPU:(id)sender;
diff --git a/src/osd/modules/debugger/osx/debugwindowhandler.mm b/src/osd/modules/debugger/osx/debugwindowhandler.mm
index d99a9ec9961..fd11fa89152 100644
--- a/src/osd/modules/debugger/osx/debugwindowhandler.mm
+++ b/src/osd/modules/debugger/osx/debugwindowhandler.mm
@@ -29,6 +29,10 @@ NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification = @"MAMEAuxiliaryD
@implementation MAMEDebugWindowHandler
+ (void)addCommonActionItems:(NSMenu *)menu {
+ [menu addItemWithTitle:@"Break"
+ action:@selector(debugBreak:)
+ keyEquivalent:@""];
+
NSMenuItem *runParentItem = [menu addItemWithTitle:@"Run"
action:@selector(debugRun:)
keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF5FunctionKey]];
@@ -181,13 +185,22 @@ NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification = @"MAMEAuxiliaryD
}
+- (IBAction)debugBreak:(id)sender {
+ if (machine->debug_flags & DEBUG_FLAG_ENABLED)
+ debug_cpu_get_visible_cpu(*machine)->debug()->halt_on_next_instruction("User-initiated break\n");
+}
+
+
- (IBAction)debugRun:(id)sender {
debug_cpu_get_visible_cpu(*machine)->debug()->go();
}
- (IBAction)debugRunAndHide:(id)sender {
- [[NSNotificationCenter defaultCenter] postNotificationName:MAMEHideDebuggerNotification object:self];
+ [[NSNotificationCenter defaultCenter] postNotificationName:MAMEHideDebuggerNotification
+ object:self
+ userInfo:[NSDictionary dictionaryWithObject:[NSValue valueWithPointer:machine]
+ forKey:@"MAMEDebugMachine"]];
debug_cpu_get_visible_cpu(*machine)->debug()->go();
}
diff --git a/src/osd/modules/font/font_dwrite.cpp b/src/osd/modules/font/font_dwrite.cpp
index 8f78badda3b..cfcc952ef0d 100644
--- a/src/osd/modules/font/font_dwrite.cpp
+++ b/src/osd/modules/font/font_dwrite.cpp
@@ -661,13 +661,31 @@ public:
{
}
+ virtual bool probe() override
+ {
+ // This module is available if it can load the expected API Functions
+ if (m_pfnD2D1CreateFactory.initialize() != 0
+ || m_pfnDWriteCreateFactory.initialize() != 0)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
virtual int init(const osd_options &options) override
{
HRESULT result;
+ osd_printf_verbose("FontProvider: Initializing DirectWrite\n");
+
// Make sure we can initialize our api functions
- HR_RET1(m_pfnD2D1CreateFactory.initialize());
- HR_RET1(m_pfnDWriteCreateFactory.initialize());
+ if (m_pfnD2D1CreateFactory.initialize()
+ || m_pfnDWriteCreateFactory.initialize())
+ {
+ osd_printf_error("ERROR: FontProvider: Failed to load DirectWrite functions.\n");
+ return -1;
+ }
// Create a Direct2D factory.
HR_RET1(m_pfnD2D1CreateFactory(
@@ -692,6 +710,7 @@ public:
__uuidof(IWICImagingFactory),
(void**)&m_wicFactory));
+ osd_printf_verbose("FontProvider: DirectWrite initialized successfully.\n");
return 0;
}
diff --git a/src/osd/modules/input/input_common.cpp b/src/osd/modules/input/input_common.cpp
index c3d6367da5f..72a0261c99a 100644
--- a/src/osd/modules/input/input_common.cpp
+++ b/src/osd/modules/input/input_common.cpp
@@ -33,13 +33,16 @@
#include <windows.h>
#define KEY_TRANS_ENTRY0(mame, sdlsc, sdlkey, disc, virtual, ascii, UI) { ITEM_ID_##mame, KEY_ ## disc, virtual, ascii, "ITEM_ID_"#mame, (char *) UI }
#define KEY_TRANS_ENTRY1(mame, sdlsc, sdlkey, disc, virtual, ascii) { ITEM_ID_##mame, KEY_ ## disc, virtual, ascii, "ITEM_ID_"#mame, (char*) #mame }
-#else
+#elif defined(OSD_SDL)
// SDL include
#include <sdlinc.h>
#define KEY_TRANS_ENTRY0(mame, sdlsc, sdlkey, disc, virtual, ascii, UI) { ITEM_ID_##mame, SDL_SCANCODE_ ## sdlsc, SDLK_ ## sdlkey, ascii, "ITEM_ID_"#mame, (char *) UI }
#define KEY_TRANS_ENTRY1(mame, sdlsc, sdlkey, disc, virtual, ascii) { ITEM_ID_##mame, SDL_SCANCODE_ ## sdlsc, SDLK_ ## sdlkey, ascii, "ITEM_ID_"#mame, (char*) #mame }
+#else
+// osd mini
#endif
+#if defined(OSD_WINDOWS) || defined(OSD_SDL)
key_trans_entry keyboard_trans_table::s_default_table[] =
{
// MAME key sdl scancode sdl key di scancode virtual key ascii ui
@@ -181,7 +184,14 @@ keyboard_trans_table::keyboard_trans_table()
m_table = s_default_table;
m_table_size = ARRAY_LENGTH(s_default_table);
}
+#else
+keyboard_trans_table::keyboard_trans_table()
+{
+ m_table = nullptr;
+ m_table_size = 0;
+}
+#endif
// public constructor to allow creation of non-default instances
keyboard_trans_table::keyboard_trans_table(std::unique_ptr<key_trans_entry[]> entries, unsigned int size)
{
diff --git a/src/osd/modules/input/input_dinput.cpp b/src/osd/modules/input/input_dinput.cpp
index a80eb4c994d..a56f913854d 100644
--- a/src/osd/modules/input/input_dinput.cpp
+++ b/src/osd/modules/input/input_dinput.cpp
@@ -115,8 +115,6 @@ protected:
class dinput_keyboard_device : public dinput_device
{
private:
- HANDLE m_dataEvent;
- HANDLE m_exitEvent;
std::mutex m_device_lock;
public:
@@ -124,7 +122,7 @@ public:
dinput_keyboard_device(running_machine &machine, const char *name, input_module &module)
: dinput_device(machine, name, DEVICE_CLASS_KEYBOARD, module),
- keyboard({0})
+ keyboard({{0}})
{
}
@@ -152,8 +150,6 @@ class dinput_module : public wininput_module
private:
LPDIRECTINPUT m_dinput;
int m_dinput_version;
- int didevtype_keyboard;
- int didevtype_mouse;
public:
dinput_module(const char* type, const char* name)
@@ -493,7 +489,7 @@ public:
dinput_joystick_device(running_machine &machine, const char *name, input_module &module)
: dinput_device(machine, name, DEVICE_CLASS_JOYSTICK, module),
- joystick({0})
+ joystick({{0}})
{
}
diff --git a/src/osd/modules/input/input_rawinput.cpp b/src/osd/modules/input/input_rawinput.cpp
index 5f930e5d780..cf17742ce58 100644
--- a/src/osd/modules/input/input_rawinput.cpp
+++ b/src/osd/modules/input/input_rawinput.cpp
@@ -27,6 +27,7 @@
#include "strconv.h"
// MAMEOS headers
+#include "winutil.h"
#include "winmain.h"
#include "window.h"
@@ -44,10 +45,10 @@
#endif
// RawInput APIs
-typedef /*WINUSERAPI*/ INT(WINAPI *get_rawinput_device_list_ptr)(OUT PRAWINPUTDEVICELIST pRawInputDeviceList, IN OUT PINT puiNumDevices, IN UINT cbSize);
-typedef /*WINUSERAPI*/ INT(WINAPI *get_rawinput_data_ptr)(IN HRAWINPUT hRawInput, IN UINT uiCommand, OUT LPVOID pData, IN OUT PINT pcbSize, IN UINT cbSizeHeader);
-typedef /*WINUSERAPI*/ INT(WINAPI *get_rawinput_device_info_ptr)(IN HANDLE hDevice, IN UINT uiCommand, OUT LPVOID pData, IN OUT PINT pcbSize);
-typedef /*WINUSERAPI*/ BOOL(WINAPI *register_rawinput_devices_ptr)(IN PCRAWINPUTDEVICE pRawInputDevices, IN UINT uiNumDevices, IN UINT cbSize);
+typedef lazy_loaded_function_p3<INT, PRAWINPUTDEVICELIST, PINT, UINT> get_rawinput_device_list_ptr;
+typedef lazy_loaded_function_p5<INT, HRAWINPUT, UINT, LPVOID, PINT, UINT> get_rawinput_data_ptr;
+typedef lazy_loaded_function_p4<INT, HANDLE, UINT, LPVOID, PINT> get_rawinput_device_info_ptr;
+typedef lazy_loaded_function_p3<BOOL, PCRAWINPUTDEVICE, UINT, UINT> register_rawinput_devices_ptr;
//============================================================
// reg_query_string
@@ -262,7 +263,7 @@ public:
rawinput_keyboard_device(running_machine& machine, const char* name, input_module& module)
: rawinput_device(machine, name, DEVICE_CLASS_KEYBOARD, module),
- keyboard({0})
+ keyboard({{0}})
{
}
@@ -289,19 +290,11 @@ public:
// rawinput_mouse_device
//============================================================
-struct rawinput_mouse_state
-{
- int raw_x;
- int raw_y;
- int raw_z;
-};
-
class rawinput_mouse_device : public rawinput_device
{
private:
std::mutex m_device_lock;
public:
- //rawinput_mouse_state raw_mouse;
mouse_state mouse;
rawinput_mouse_device(running_machine& machine, const char* name, input_module& module)
@@ -317,18 +310,6 @@ public:
mouse.lZ = 0;
rawinput_device::poll();
-
- //std::lock_guard<std::mutex> scope_lock(m_device_lock);
-
- //// copy the accumulated raw state to the actual state
- //mouse.lX = raw_mouse.raw_x;
- //mouse.lY = raw_mouse.raw_y;
- //mouse.lZ = raw_mouse.raw_z;
- //raw_mouse.raw_x = 0;
- //raw_mouse.raw_y = 0;
- //raw_mouse.raw_z = 0;
-
- //osd_printf_verbose("At poll: lX=%d, lY=%d, lZ=%d\n", (int)mouse.lX, (int)mouse.lY, (int)mouse.lZ);
}
void reset() override
@@ -345,13 +326,6 @@ public:
mouse.lX += rawinput.data.mouse.lLastX * INPUT_RELATIVE_PER_PIXEL;
mouse.lY += rawinput.data.mouse.lLastY * INPUT_RELATIVE_PER_PIXEL;
- /*osd_printf_verbose(
- "Mouse Abs : lastX = %d, lastY = %d, rawx = %d, rawy = %d\n",
- (int)rawinput.data.mouse.lLastX,
- (int)rawinput.data.mouse.lLastY,
- (int)raw_mouse.raw_x,
- (int)raw_mouse.raw_y);*/
-
// update zaxis
if (rawinput.data.mouse.usButtonFlags & RI_MOUSE_WHEEL)
mouse.lZ += (INT16)rawinput.data.mouse.usButtonData * INPUT_RELATIVE_PER_PIXEL;
@@ -370,6 +344,13 @@ public:
}
};
+/*
+register_rawinput_devices = (register_rawinput_devices_ptr)GetProcAddress(user32, "RegisterRawInputDevices");
+get_rawinput_device_list = (get_rawinput_device_list_ptr)GetProcAddress(user32, "GetRawInputDeviceList");
+get_rawinput_device_info = (get_rawinput_device_info_ptr)GetProcAddress(user32, "GetRawInputDeviceInfo" UNICODE_SUFFIX);
+get_rawinput_data = (get_rawinput_data_ptr)GetProcAddress(user32, "GetRawInputData");
+*/
+
//============================================================
// rawinput_module - base class for rawinput modules
//============================================================
@@ -387,25 +368,38 @@ private:
public:
rawinput_module(const char *type, const char* name)
: wininput_module(type, name),
- get_rawinput_device_list(nullptr),
- get_rawinput_data(nullptr),
- get_rawinput_device_info(nullptr),
- register_rawinput_devices(nullptr)
+ get_rawinput_device_list("GetRawInputDeviceList", L"user32.dll"),
+ get_rawinput_data("GetRawInputData", L"user32.dll"),
+ get_rawinput_device_info("GetRawInputDeviceInfo", L"user32.dll"),
+ register_rawinput_devices("RegisterRawInputDevices", L"user32.dll")
{
}
+ bool probe() override
+ {
+ int status = get_rawinput_device_list.initialize();
+ status |= get_rawinput_data.initialize();
+ status |= get_rawinput_device_info.initialize();
+ status |= register_rawinput_devices.initialize();
+
+ if (status != 0)
+ return false;
+
+ return true;
+ }
+
void input_init(running_machine &machine) override
{
// get the number of devices, allocate a device list, and fetch it
int device_count = 0;
- if ((*get_rawinput_device_list)(NULL, &device_count, sizeof(RAWINPUTDEVICELIST)) != 0)
+ if (get_rawinput_device_list(NULL, &device_count, sizeof(RAWINPUTDEVICELIST)) != 0)
return;
if (device_count == 0)
return;
auto rawinput_devices = std::make_unique<RAWINPUTDEVICELIST[]>(device_count);
- if ((*get_rawinput_device_list)(rawinput_devices.get(), &device_count, sizeof(RAWINPUTDEVICELIST)) == -1)
+ if (get_rawinput_device_list(rawinput_devices.get(), &device_count, sizeof(RAWINPUTDEVICELIST)) == -1)
return;
// iterate backwards through devices; new devices are added at the head
@@ -433,7 +427,7 @@ public:
registration.hwndTarget = win_window_list->m_hwnd;
// register the device
- (*register_rawinput_devices)(&registration, 1, sizeof(registration));
+ register_rawinput_devices(&registration, 1, sizeof(registration));
}
protected:
@@ -443,23 +437,15 @@ protected:
int init_internal() override
{
- HMODULE user32;
-
- // look in user32 for the raw input APIs
- user32 = LoadLibrary(TEXT("user32.dll"));
- if (user32 == NULL)
- return 1;
-
// look up the entry points
- register_rawinput_devices = (register_rawinput_devices_ptr)GetProcAddress(user32, "RegisterRawInputDevices");
- get_rawinput_device_list = (get_rawinput_device_list_ptr)GetProcAddress(user32, "GetRawInputDeviceList");
- get_rawinput_device_info = (get_rawinput_device_info_ptr)GetProcAddress(user32, "GetRawInputDeviceInfo" UNICODE_SUFFIX);
- get_rawinput_data = (get_rawinput_data_ptr)GetProcAddress(user32, "GetRawInputData");
- if (register_rawinput_devices == NULL || get_rawinput_device_list == NULL || get_rawinput_device_info == NULL || get_rawinput_data == NULL)
+ int status = get_rawinput_device_list.initialize();
+ status |= get_rawinput_data.initialize();
+ status |= get_rawinput_device_info.initialize();
+ status |= register_rawinput_devices.initialize();
+ if (status != 0)
return 1;
osd_printf_verbose("RawInput: APIs detected\n");
-
return 0;
}
@@ -469,11 +455,11 @@ protected:
TDevice* devinfo = nullptr;
INT name_length = 0;
// determine the length of the device name, allocate it, and fetch it if not nameless
- if ((*get_rawinput_device_info)(rawinputdevice->hDevice, RIDI_DEVICENAME, NULL, &name_length) != 0)
+ if (get_rawinput_device_info(rawinputdevice->hDevice, RIDI_DEVICENAME, NULL, &name_length) != 0)
return nullptr;
std::unique_ptr<TCHAR[]> tname = std::make_unique<TCHAR[]>(name_length + 1);
- if (name_length > 1 && (*get_rawinput_device_info)(rawinputdevice->hDevice, RIDI_DEVICENAME, tname.get(), &name_length) == -1)
+ if (name_length > 1 && get_rawinput_device_info(rawinputdevice->hDevice, RIDI_DEVICENAME, tname.get(), &name_length) == -1)
return nullptr;
// if this is an RDP name, skip it
@@ -514,7 +500,7 @@ protected:
return FALSE;
// determine the size of databuffer we need
- if ((*get_rawinput_data)(rawinputdevice, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER)) != 0)
+ if (get_rawinput_data(rawinputdevice, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER)) != 0)
return FALSE;
// if necessary, allocate a temporary buffer and fetch the data
@@ -527,7 +513,7 @@ protected:
}
// fetch the data and process the appropriate message types
- result = (*get_rawinput_data)((HRAWINPUT)rawinputdevice, RID_INPUT, data, &size, sizeof(RAWINPUTHEADER));
+ result = get_rawinput_data((HRAWINPUT)rawinputdevice, RID_INPUT, data, &size, sizeof(RAWINPUTHEADER));
if (result)
{
std::lock_guard<std::mutex> scope_lock(m_module_lock);
@@ -563,8 +549,8 @@ public:
}
protected:
- USHORT usagepage() { return 1; }
- USHORT usage() { return 6; }
+ USHORT usagepage() override { return 1; }
+ USHORT usage() override { return 6; }
void add_rawinput_device(running_machine& machine, RAWINPUTDEVICELIST * device) override
{
// make sure this is a keyboard
@@ -610,8 +596,8 @@ public:
}
protected:
- USHORT usagepage() { return 1; }
- USHORT usage() { return 2; }
+ USHORT usagepage() override { return 1; }
+ USHORT usage() override { return 2; }
void add_rawinput_device(running_machine& machine, RAWINPUTDEVICELIST * device) override
{
// make sure this is a mouse
diff --git a/src/osd/modules/input/input_sdl.cpp b/src/osd/modules/input/input_sdl.cpp
index 3894f25e1b4..43d4cbf6a6c 100644
--- a/src/osd/modules/input/input_sdl.cpp
+++ b/src/osd/modules/input/input_sdl.cpp
@@ -688,11 +688,20 @@ public:
int physical_stick;
for (physical_stick = 0; physical_stick < SDL_NumJoysticks(); physical_stick++)
{
- SDL_Joystick *joy = SDL_JoystickOpen(physical_stick);
- std::string joy_name = remove_spaces(SDL_JoystickName(joy));
- SDL_JoystickClose(joy);
-
- devmap_register(&m_joy_map, physical_stick, joy_name.c_str());
+ if (SDL_IsGameController(physical_stick)) {
+ osd_printf_verbose("Joystick %i is supported by the game controller interface!\n", physical_stick);
+ osd_printf_verbose("Compatible controller, named \'%s\'\n", SDL_GameControllerNameForIndex(physical_stick));
+ SDL_GameController *joy = SDL_GameControllerOpen(physical_stick);
+ osd_printf_verbose("Controller is mapped as \"%s\".\n", SDL_GameControllerMapping(joy));
+ std::string joy_name = remove_spaces(SDL_GameControllerName(joy));
+ SDL_GameControllerClose(joy);
+ devmap_register(&m_joy_map, physical_stick, joy_name.c_str());
+ } else {
+ SDL_Joystick *joy = SDL_JoystickOpen(physical_stick);
+ std::string joy_name = remove_spaces(SDL_JoystickName(joy));
+ SDL_JoystickClose(joy);
+ devmap_register(&m_joy_map, physical_stick, joy_name.c_str());
+ }
}
for (int stick = 0; stick < MAX_DEVMAP_ENTRIES; stick++)
diff --git a/src/osd/modules/input/input_win32.cpp b/src/osd/modules/input/input_win32.cpp
index e1b69c8091c..0fb86095112 100644
--- a/src/osd/modules/input/input_win32.cpp
+++ b/src/osd/modules/input/input_win32.cpp
@@ -45,7 +45,7 @@ public:
win32_keyboard_device(running_machine& machine, const char *name, input_module &module)
: event_based_device(machine, name, DEVICE_CLASS_KEYBOARD, module),
- keyboard({0})
+ keyboard({{0}})
{
}
@@ -68,7 +68,6 @@ protected:
class keyboard_input_win32 : public wininput_module
{
private:
- const osd_options * m_options;
public:
keyboard_input_win32()
@@ -138,7 +137,7 @@ public:
win32_mouse_device(running_machine& machine, const char *name, input_module &module)
: event_based_device(machine, name, DEVICE_CLASS_MOUSE, module),
mouse({0}),
- win32_mouse({0})
+ win32_mouse({{0}})
{
}
@@ -172,10 +171,11 @@ public:
void reset() override
{
memset(&mouse, 0, sizeof(mouse));
+ memset(&win32_mouse, 0, sizeof(win32_mouse));
}
protected:
- void process_event(MouseButtonEventArgs &args)
+ void process_event(MouseButtonEventArgs &args) override
{
// set the button state
mouse.rgbButtons[args.button] = args.keydown ? 0x80 : 0x00;
@@ -192,9 +192,6 @@ protected:
class mouse_input_win32 : public wininput_module
{
-private:
- const osd_options * m_options;
-
public:
mouse_input_win32()
: wininput_module(OSD_MOUSEINPUT_PROVIDER, "win32")
@@ -301,7 +298,7 @@ public:
}
protected:
- void process_event(MouseButtonEventArgs &args)
+ void process_event(MouseButtonEventArgs &args) override
{
// Are we in shared axis mode?
if (m_lightgun_shared_axis_mode)
diff --git a/src/osd/modules/input/input_xinput.cpp b/src/osd/modules/input/input_xinput.cpp
index e256b04b101..b88dbe24c1a 100644
--- a/src/osd/modules/input/input_xinput.cpp
+++ b/src/osd/modules/input/input_xinput.cpp
@@ -16,7 +16,7 @@
#include <windows.h>
// XInput header
-#include <Xinput.h>
+#include <xinput.h>
#undef interface
@@ -187,7 +187,7 @@ private:
public:
xinput_joystick_device(running_machine &machine, const char *name, input_module &module)
: device_info(machine, name, DEVICE_CLASS_JOYSTICK, module),
- gamepad({0}),
+ gamepad({{0}}),
xinput_state({0}),
xinput_api(nullptr)
{
diff --git a/src/osd/modules/lib/osdlib_macosx.cpp b/src/osd/modules/lib/osdlib_macosx.cpp
index 0d89e6c3596..501719c1e3c 100644
--- a/src/osd/modules/lib/osdlib_macosx.cpp
+++ b/src/osd/modules/lib/osdlib_macosx.cpp
@@ -14,11 +14,6 @@
#include <sys/types.h>
#include <signal.h>
-#include <mach/mach.h>
-#include <mach/mach_time.h>
-#include <mach/mach_traps.h>
-#include <Carbon/Carbon.h>
-
// MAME headers
#include "osdcore.h"
#include "osdlib.h"
@@ -55,30 +50,6 @@ void osd_process_kill(void)
}
//============================================================
-// osd_num_processors
-//============================================================
-
-int osd_get_num_processors(void)
-{
- int processors = 1;
-
- struct host_basic_info host_basic_info;
- unsigned int count;
- kern_return_t r;
- mach_port_t my_mach_host_self;
-
- count = HOST_BASIC_INFO_COUNT;
- my_mach_host_self = mach_host_self();
- if ( ( r = host_info(my_mach_host_self, HOST_BASIC_INFO, (host_info_t)(&host_basic_info), &count)) == KERN_SUCCESS )
- {
- processors = host_basic_info.avail_cpus;
- }
- mach_port_deallocate(mach_task_self(), my_mach_host_self);
-
- return processors;
-}
-
-//============================================================
// osd_malloc
//============================================================
@@ -166,120 +137,3 @@ void osd_break_into_debugger(const char *message)
#endif
}
-
-//============================================================
-// PROTOTYPES
-//============================================================
-
-static osd_ticks_t init_cycle_counter(void);
-static osd_ticks_t mach_cycle_counter(void);
-
-//============================================================
-// STATIC VARIABLES
-//============================================================
-
-static osd_ticks_t (*cycle_counter)(void) = init_cycle_counter;
-static osd_ticks_t (*ticks_counter)(void) = init_cycle_counter;
-static osd_ticks_t ticks_per_second;
-
-//============================================================
-// init_cycle_counter
-//
-// to avoid total grossness, this function is split by subarch
-//============================================================
-
-static osd_ticks_t init_cycle_counter(void)
-{
- osd_ticks_t start, end;
- osd_ticks_t a, b;
-
- cycle_counter = mach_cycle_counter;
- ticks_counter = mach_cycle_counter;
-
- // wait for an edge on the timeGetTime call
- a = SDL_GetTicks();
- do
- {
- b = SDL_GetTicks();
- } while (a == b);
-
- // get the starting cycle count
- start = (*cycle_counter)();
-
- // now wait for 1/4 second total
- do
- {
- a = SDL_GetTicks();
- } while (a - b < 250);
-
- // get the ending cycle count
- end = (*cycle_counter)();
-
- // compute ticks_per_sec
- ticks_per_second = (end - start) * 4;
-
- // return the current cycle count
- return (*cycle_counter)();
-}
-
-//============================================================
-// performance_cycle_counter
-//============================================================
-
-//============================================================
-// mach_cycle_counter
-//============================================================
-static osd_ticks_t mach_cycle_counter(void)
-{
- return mach_absolute_time();
-}
-
-//============================================================
-// osd_ticks
-//============================================================
-
-osd_ticks_t osd_ticks(void)
-{
- return (*cycle_counter)();
-}
-
-
-//============================================================
-// osd_ticks_per_second
-//============================================================
-
-osd_ticks_t osd_ticks_per_second(void)
-{
- if (ticks_per_second == 0)
- {
- // if we haven't computed the value yet, there's no time like the present
- init_cycle_counter();
- }
- return ticks_per_second;
-}
-
-
-
-//============================================================
-// osd_sleep
-//============================================================
-
-void osd_sleep(osd_ticks_t duration)
-{
- UINT32 msec;
-
- // make sure we've computed ticks_per_second
- if (ticks_per_second == 0)
- (void)osd_ticks();
-
- // convert to milliseconds, rounding down
- msec = (UINT32)(duration * 1000 / ticks_per_second);
-
- // only sleep if at least 2 full milliseconds
- if (msec >= 2)
- {
- // take a couple of msecs off the top for good measure
- msec -= 2;
- usleep(msec*1000);
- }
-}
diff --git a/src/osd/modules/lib/osdlib_unix.cpp b/src/osd/modules/lib/osdlib_unix.cpp
index a275eb04192..3075ea63769 100644
--- a/src/osd/modules/lib/osdlib_unix.cpp
+++ b/src/osd/modules/lib/osdlib_unix.cpp
@@ -13,8 +13,7 @@
#include <sys/mman.h>
#include <sys/types.h>
#include <signal.h>
-#include <time.h>
-#include <sys/time.h>
+
#ifdef SDLMAME_EMSCRIPTEN
#include <emscripten.h>
#endif
@@ -51,20 +50,6 @@ void osd_process_kill(void)
}
//============================================================
-// osd_num_processors
-//============================================================
-
-int osd_get_num_processors(void)
-{
- int processors = 1;
-
-#if defined(_SC_NPROCESSORS_ONLN)
- processors = sysconf(_SC_NPROCESSORS_ONLN);
-#endif
- return processors;
-}
-
-//============================================================
// osd_malloc
//============================================================
@@ -150,53 +135,3 @@ void osd_break_into_debugger(const char *message)
printf("Ignoring MAME exception: %s\n", message);
#endif
}
-
-
-//============================================================
-// osd_ticks
-//============================================================
-
-osd_ticks_t osd_ticks(void)
-{
-#ifdef SDLMAME_EMSCRIPTEN
- return (osd_ticks_t)(emscripten_get_now() * 1000.0);
-#else
- struct timeval tp;
- static osd_ticks_t start_sec = 0;
-
- gettimeofday(&tp, NULL);
- if (start_sec==0)
- start_sec = tp.tv_sec;
- return (tp.tv_sec - start_sec) * (osd_ticks_t) 1000000 + tp.tv_usec;
-#endif
-}
-
-
-//============================================================
-// osd_ticks_per_second
-//============================================================
-
-osd_ticks_t osd_ticks_per_second(void)
-{
- return (osd_ticks_t) 1000000;
-}
-
-//============================================================
-// osd_sleep
-//============================================================
-
-void osd_sleep(osd_ticks_t duration)
-{
- UINT32 msec;
-
- // convert to milliseconds, rounding down
- msec = (UINT32)(duration * 1000 / osd_ticks_per_second());
-
- // only sleep if at least 2 full milliseconds
- if (msec >= 2)
- {
- // take a couple of msecs off the top for good measure
- msec -= 2;
- usleep(msec*1000);
- }
-}
diff --git a/src/osd/modules/lib/osdlib_win32.cpp b/src/osd/modules/lib/osdlib_win32.cpp
index 75218574aff..bb6f136be90 100644
--- a/src/osd/modules/lib/osdlib_win32.cpp
+++ b/src/osd/modules/lib/osdlib_win32.cpp
@@ -101,21 +101,6 @@ void osd_process_kill(void)
}
//============================================================
-// osd_num_processors
-//============================================================
-
-int osd_get_num_processors(void)
-{
- SYSTEM_INFO info;
-
- // otherwise, fetch the info from the system
- GetSystemInfo(&info);
-
- // max out at 4 for now since scaling above that seems to do poorly
- return MIN(info.dwNumberOfProcessors, 4);
-}
-
-//============================================================
// osd_malloc
//============================================================
@@ -256,94 +241,3 @@ void osd_break_into_debugger(const char *message)
#endif
}
-//============================================================
-// GLOBAL VARIABLES
-//============================================================
-
-static osd_ticks_t ticks_per_second = 0;
-static osd_ticks_t suspend_ticks = 0;
-static BOOL using_qpc = TRUE;
-
-
-
-//============================================================
-// osd_ticks
-//============================================================
-
-osd_ticks_t osd_ticks(void)
-{
- LARGE_INTEGER performance_count;
-
- // if we're suspended, just return that
- if (suspend_ticks != 0)
- return suspend_ticks;
-
- // if we have a per second count, just go for it
- if (ticks_per_second != 0)
- {
- // QueryPerformanceCounter if we can
- if (using_qpc)
- {
- QueryPerformanceCounter(&performance_count);
- return (osd_ticks_t)performance_count.QuadPart - suspend_ticks;
- }
-
- // otherwise, fall back to timeGetTime
- else
- return (osd_ticks_t)timeGetTime() - suspend_ticks;
- }
-
- // if not, we have to determine it
- using_qpc = QueryPerformanceFrequency(&performance_count) && (performance_count.QuadPart != 0);
- if (using_qpc)
- ticks_per_second = (osd_ticks_t)performance_count.QuadPart;
- else
- ticks_per_second = 1000;
-
- // call ourselves to get the first value
- return osd_ticks();
-}
-
-
-//============================================================
-// osd_ticks_per_second
-//============================================================
-
-osd_ticks_t osd_ticks_per_second(void)
-{
- if (ticks_per_second == 0)
- osd_ticks();
- return ticks_per_second;
-}
-
-//============================================================
-// osd_sleep
-//============================================================
-
-void osd_sleep(osd_ticks_t duration)
-{
- DWORD msec;
-
- // make sure we've computed ticks_per_second
- if (ticks_per_second == 0)
- (void)osd_ticks();
-
- // convert to milliseconds, rounding down
- msec = (DWORD)(duration * 1000 / ticks_per_second);
-
- // only sleep if at least 2 full milliseconds
- if (msec >= 2)
- {
- HANDLE current_thread = GetCurrentThread();
- int old_priority = GetThreadPriority(current_thread);
-
- // take a couple of msecs off the top for good measure
- msec -= 2;
-
- // bump our thread priority super high so that we get
- // priority when we need it
- SetThreadPriority(current_thread, THREAD_PRIORITY_TIME_CRITICAL);
- Sleep(msec);
- SetThreadPriority(current_thread, old_priority);
- }
-}
diff --git a/src/osd/modules/opengl/shader/glsl_bilinear_idx16_lut.fsh b/src/osd/modules/opengl/shader/glsl_bilinear_idx16_lut.fsh
index ef0030b7519..c2fba95bdc6 100644
--- a/src/osd/modules/opengl/shader/glsl_bilinear_idx16_lut.fsh
+++ b/src/osd/modules/opengl/shader/glsl_bilinear_idx16_lut.fsh
@@ -1,4 +1,5 @@
-
+// license:BSD-3-Clause
+// copyright-holders:Sven Gothel
#pragma optimize (on)
#pragma debug (off)
diff --git a/src/osd/modules/opengl/shader/glsl_bilinear_rgb32_dir.fsh b/src/osd/modules/opengl/shader/glsl_bilinear_rgb32_dir.fsh
index c739c16934e..97278c65df5 100644
--- a/src/osd/modules/opengl/shader/glsl_bilinear_rgb32_dir.fsh
+++ b/src/osd/modules/opengl/shader/glsl_bilinear_rgb32_dir.fsh
@@ -1,4 +1,5 @@
-
+// license:BSD-3-Clause
+// copyright-holders:Sven Gothel
#pragma optimize (on)
#pragma debug (off)
diff --git a/src/osd/modules/opengl/shader/glsl_bilinear_rgb32_lut.fsh b/src/osd/modules/opengl/shader/glsl_bilinear_rgb32_lut.fsh
index d6c9f5e7f59..93cd172e0b1 100644
--- a/src/osd/modules/opengl/shader/glsl_bilinear_rgb32_lut.fsh
+++ b/src/osd/modules/opengl/shader/glsl_bilinear_rgb32_lut.fsh
@@ -1,4 +1,5 @@
-
+// license:BSD-3-Clause
+// copyright-holders:Sven Gothel
#pragma optimize (on)
#pragma debug (off)
diff --git a/src/osd/modules/opengl/shader/glsl_plain_idx16_lut.fsh b/src/osd/modules/opengl/shader/glsl_plain_idx16_lut.fsh
index 465aa610d59..9c8728d90b9 100644
--- a/src/osd/modules/opengl/shader/glsl_plain_idx16_lut.fsh
+++ b/src/osd/modules/opengl/shader/glsl_plain_idx16_lut.fsh
@@ -1,4 +1,5 @@
-
+// license:BSD-3-Clause
+// copyright-holders:Sven Gothel
#pragma optimize (on)
#pragma debug (off)
diff --git a/src/osd/modules/opengl/shader/glsl_plain_rgb32_dir.fsh b/src/osd/modules/opengl/shader/glsl_plain_rgb32_dir.fsh
index 0e5a4605ac8..eb3f902f93b 100644
--- a/src/osd/modules/opengl/shader/glsl_plain_rgb32_dir.fsh
+++ b/src/osd/modules/opengl/shader/glsl_plain_rgb32_dir.fsh
@@ -1,4 +1,5 @@
-
+// license:BSD-3-Clause
+// copyright-holders:Sven Gothel
#pragma optimize (on)
#pragma debug (off)
diff --git a/src/osd/modules/opengl/shader/glsl_plain_rgb32_lut.fsh b/src/osd/modules/opengl/shader/glsl_plain_rgb32_lut.fsh
index 14c05aaa844..3bc16870166 100644
--- a/src/osd/modules/opengl/shader/glsl_plain_rgb32_lut.fsh
+++ b/src/osd/modules/opengl/shader/glsl_plain_rgb32_lut.fsh
@@ -1,4 +1,5 @@
-
+// license:BSD-3-Clause
+// copyright-holders:Sven Gothel
#pragma optimize (on)
#pragma debug (off)
diff --git a/src/osd/modules/render/bgfx/chainmanager.cpp b/src/osd/modules/render/bgfx/chainmanager.cpp
index 547694bd1f8..4a14bc47b86 100644
--- a/src/osd/modules/render/bgfx/chainmanager.cpp
+++ b/src/osd/modules/render/bgfx/chainmanager.cpp
@@ -16,6 +16,7 @@
#include <bgfx/bgfxplatform.h>
#include <bgfx/bgfx.h>
#include <bx/readerwriter.h>
+#include <bx/crtimpl.h>
#include "chainmanager.h"
#include "chainreader.h"
diff --git a/src/osd/modules/render/bgfx/effectmanager.cpp b/src/osd/modules/render/bgfx/effectmanager.cpp
index dc2550354f2..c7410406f13 100644
--- a/src/osd/modules/render/bgfx/effectmanager.cpp
+++ b/src/osd/modules/render/bgfx/effectmanager.cpp
@@ -16,6 +16,7 @@
#include <bgfx/bgfxplatform.h>
#include <bgfx/bgfx.h>
#include <bx/readerwriter.h>
+#include <bx/crtimpl.h>
#include "effectmanager.h"
#include "effectreader.h"
diff --git a/src/osd/modules/render/bgfx/shadermanager.cpp b/src/osd/modules/render/bgfx/shadermanager.cpp
index f7e7b30e7ec..93a7205b93c 100644
--- a/src/osd/modules/render/bgfx/shadermanager.cpp
+++ b/src/osd/modules/render/bgfx/shadermanager.cpp
@@ -15,6 +15,7 @@
#include <bgfx/bgfx.h>
#include <bx/fpumath.h>
#include <bx/readerwriter.h>
+#include <bx/crtimpl.h>
#include "shadermanager.h"
diff --git a/src/osd/modules/render/bgfx/statereader.cpp b/src/osd/modules/render/bgfx/statereader.cpp
index 93fb021be5c..0a459c60102 100644
--- a/src/osd/modules/render/bgfx/statereader.cpp
+++ b/src/osd/modules/render/bgfx/statereader.cpp
@@ -1,3 +1,5 @@
+// license:BSD-3-Clause
+// copyright-holders:Ryan Holtz
#include "statereader.h"
uint64_t state_reader::get_enum_from_value(const Value& value, std::string name, const uint64_t default_value, const string_to_enum* enums, const int count)
diff --git a/src/osd/modules/render/bgfx/statereader.h b/src/osd/modules/render/bgfx/statereader.h
index d32cf52c817..ce52536ca0a 100644
--- a/src/osd/modules/render/bgfx/statereader.h
+++ b/src/osd/modules/render/bgfx/statereader.h
@@ -1,3 +1,5 @@
+// license:BSD-3-Clause
+// copyright-holders:Ryan Holtz
#pragma once
#ifndef __DRAWBGFX_STATE_READER__
diff --git a/src/osd/modules/render/bgfx/writereader.cpp b/src/osd/modules/render/bgfx/writereader.cpp
index 5d6ca0fcf93..7fd36a03fda 100644
--- a/src/osd/modules/render/bgfx/writereader.cpp
+++ b/src/osd/modules/render/bgfx/writereader.cpp
@@ -1,3 +1,5 @@
+// license:BSD-3-Clause
+// copyright-holders:Ryan Holtz
#include <bgfx/bgfx.h>
#include "writereader.h"
diff --git a/src/osd/modules/render/bgfx/writereader.h b/src/osd/modules/render/bgfx/writereader.h
index 5210a8df286..bd43b5899f5 100644
--- a/src/osd/modules/render/bgfx/writereader.h
+++ b/src/osd/modules/render/bgfx/writereader.h
@@ -1,3 +1,5 @@
+// license:BSD-3-Clause
+// copyright-holders:Ryan Holtz
#pragma once
#ifndef __DRAWBGFX_WRITE_READER__
diff --git a/src/osd/modules/render/binpacker.h b/src/osd/modules/render/binpacker.h
index 696bd18eb7d..33f02dc2642 100644
--- a/src/osd/modules/render/binpacker.h
+++ b/src/osd/modules/render/binpacker.h
@@ -1,3 +1,5 @@
+// license:BSD-3-Clause
+// copyright-holders:Ryan Holtz
#pragma once
#ifndef __RECTPACKER_H__
diff --git a/src/osd/modules/render/drawbgfx.h b/src/osd/modules/render/drawbgfx.h
index 62e00dd7d1d..806bc651344 100644
--- a/src/osd/modules/render/drawbgfx.h
+++ b/src/osd/modules/render/drawbgfx.h
@@ -1,3 +1,5 @@
+// license:BSD-3-Clause
+// copyright-holders:Ryan Holtz
#pragma once
#ifndef __RENDER_BGFX__
diff --git a/src/osd/modules/sound/xaudio2_sound.cpp b/src/osd/modules/sound/xaudio2_sound.cpp
index 9dc3d0461be..e09d87aa6c6 100644
--- a/src/osd/modules/sound/xaudio2_sound.cpp
+++ b/src/osd/modules/sound/xaudio2_sound.cpp
@@ -9,26 +9,17 @@
#include "sound_module.h"
#include "modules/osdmodule.h"
-#if (defined(OSD_WINDOWS) && USE_XAUDIO2)
+#if defined(OSD_WINDOWS)
// standard windows headers
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
-#include <mutex>
-#pragma warning( push )
-#pragma warning( disable: 4068 )
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wattributes"
// XAudio2 include
#include <xaudio2.h>
-#pragma GCC diagnostic pop
-#pragma warning( pop )
-
-
-#include <mmsystem.h>
// stdlib includes
+#include <mutex>
#include <thread>
#include <queue>
@@ -37,7 +28,8 @@
// MAME headers
#include "emu.h"
#include "osdepend.h"
-#include "emuopts.h"
+
+#include "winutil.h"
//============================================================
// Constants
@@ -133,7 +125,7 @@ typedef std::unique_ptr<IXAudio2MasteringVoice, xaudio2_custom_deleter> masterin
typedef std::unique_ptr<IXAudio2SourceVoice, xaudio2_custom_deleter> src_voice_ptr;
// Typedef for pointer to XAudio2Create
-typedef HRESULT(__stdcall* PFN_XAUDIO2CREATE)(IXAudio2**, UINT32, XAUDIO2_PROCESSOR);
+typedef lazy_loaded_function_p3<HRESULT, IXAudio2**, UINT32, XAUDIO2_PROCESSOR> xaudio2_create_ptr;
//============================================================
// Helper classes
@@ -196,6 +188,8 @@ public:
class sound_xaudio2 : public osd_module, public sound_module, public IXAudio2VoiceCallback
{
private:
+ const wchar_t* XAUDIO_DLLS[2] = { L"XAudio2_9.dll", L"XAudio2_8.dll" };
+
xaudio2_ptr m_xAudio2;
mastering_voice_ptr m_masterVoice;
src_voice_ptr m_sourceVoice;
@@ -211,11 +205,10 @@ private:
std::thread m_audioThread;
std::queue<xaudio2_buffer> m_queue;
std::unique_ptr<bufferpool> m_buffer_pool;
- HMODULE m_xaudio2_module;
- PFN_XAUDIO2CREATE m_pfnxaudio2create;
UINT32 m_overflows;
UINT32 m_underflows;
BOOL m_in_underflow;
+ xaudio2_create_ptr XAudio2Create;
public:
sound_xaudio2() :
@@ -229,56 +222,73 @@ public:
m_buffer_size(0),
m_buffer_count(0),
m_writepos(0),
- m_hEventBufferCompleted(NULL),
- m_hEventDataAvailable(NULL),
- m_hEventExiting(NULL),
+ m_hEventBufferCompleted(nullptr),
+ m_hEventDataAvailable(nullptr),
+ m_hEventExiting(nullptr),
m_buffer_pool(nullptr),
- m_xaudio2_module(NULL),
- m_pfnxaudio2create(nullptr),
m_overflows(0),
m_underflows(0),
- m_in_underflow(FALSE)
+ m_in_underflow(FALSE),
+ XAudio2Create("XAudio2Create", XAUDIO_DLLS, ARRAY_LENGTH(XAUDIO_DLLS))
{
}
- virtual int init(osd_options const &options) override;
- virtual void exit() override;
+ bool probe() override;
+ int init(osd_options const &options) override;
+ void exit() override;
// sound_module
- virtual void update_audio_stream(bool is_throttled, INT16 const *buffer, int samples_this_frame) override;
- virtual void set_mastervolume(int attenuation) override;
+ void update_audio_stream(bool is_throttled, INT16 const *buffer, int samples_this_frame) override;
+ void set_mastervolume(int attenuation) override;
// Xaudio callbacks
- void OnVoiceProcessingPassStart(UINT32 bytes_required) override;
- void OnVoiceProcessingPassEnd() override {}
- void OnStreamEnd() override {}
- void OnBufferStart(void* pBufferContext) override {}
- void OnLoopEnd(void* pBufferContext) override {}
- void OnVoiceError(void* pBufferContext, HRESULT error) override {}
- void OnBufferEnd(void *pBufferContext) override;
+ void STDAPICALLTYPE OnVoiceProcessingPassStart(UINT32 bytes_required) override;
+ void STDAPICALLTYPE OnVoiceProcessingPassEnd() override {}
+ void STDAPICALLTYPE OnStreamEnd() override {}
+ void STDAPICALLTYPE OnBufferStart(void* pBufferContext) override {}
+ void STDAPICALLTYPE OnLoopEnd(void* pBufferContext) override {}
+ void STDAPICALLTYPE OnVoiceError(void* pBufferContext, HRESULT error) override {}
+ void STDAPICALLTYPE OnBufferEnd(void *pBufferContext) override;
private:
void create_buffers(const WAVEFORMATEX &format);
HRESULT create_voices(const WAVEFORMATEX &format);
void process_audio();
- void submit_buffer(std::unique_ptr<BYTE[]> audioData, DWORD audioLength);
+ void submit_buffer(std::unique_ptr<BYTE[]> audioData, DWORD audioLength) const;
void submit_needed();
- HRESULT xaudio2_create(IXAudio2 ** xaudio2_interface);
void roll_buffer();
BOOL submit_next_queued();
};
//============================================================
+// probe
+//============================================================
+
+bool sound_xaudio2::probe()
+{
+ int status = XAudio2Create.initialize();
+ return status == 0;
+}
+
+//============================================================
// init
//============================================================
int sound_xaudio2::init(osd_options const &options)
{
- HRESULT result = S_OK;
+ HRESULT result;
+
+ // Make sure our XAudio2Create entrypoint is bound
+ int status = XAudio2Create.initialize();
+ if (status != 0)
+ {
+ osd_printf_error("Could not find XAudio2 library\n");
+ return 1;
+ }
// Create the IXAudio2 object
IXAudio2 *temp_xaudio2 = nullptr;
- HR_RET1(xaudio2_create(&temp_xaudio2));
+ HR_RET1(this->XAudio2Create(&temp_xaudio2, 0, XAUDIO2_DEFAULT_PROCESSOR));
m_xAudio2 = xaudio2_ptr(temp_xaudio2);
// make a format description for what we want
@@ -292,20 +302,13 @@ int sound_xaudio2::init(osd_options const &options)
m_sample_bytes = format.nBlockAlign;
-#if defined(_DEBUG)
- XAUDIO2_DEBUG_CONFIGURATION debugConfig = { 0 };
- debugConfig.TraceMask = XAUDIO2_LOG_WARNINGS | XAUDIO2_LOG_TIMING | XAUDIO2_LOG_STREAMING;
- debugConfig.LogFunctionName = TRUE;
- m_xAudio2->SetDebugConfiguration(&debugConfig);
-#endif
-
// Create the buffers
create_buffers(format);
// Initialize our events
- m_hEventBufferCompleted = CreateEvent(NULL, FALSE, FALSE, NULL);
- m_hEventDataAvailable = CreateEvent(NULL, FALSE, FALSE, NULL);
- m_hEventExiting = CreateEvent(NULL, FALSE, FALSE, NULL);
+ m_hEventBufferCompleted = CreateEvent(nullptr, FALSE, FALSE, nullptr);
+ m_hEventDataAvailable = CreateEvent(nullptr, FALSE, FALSE, nullptr);
+ m_hEventExiting = CreateEvent(nullptr, FALSE, FALSE, nullptr);
// create the voices and start them
HR_RET1(create_voices(format));
@@ -413,7 +416,7 @@ void sound_xaudio2::set_mastervolume(int attenuation)
// The XAudio2 voice callback triggered when a buffer finishes playing
void sound_xaudio2::OnBufferEnd(void *pBufferContext)
{
- BYTE* completed_buffer = (BYTE*)pBufferContext;
+ BYTE* completed_buffer = static_cast<BYTE*>(pBufferContext);
if (completed_buffer != nullptr)
{
std::lock_guard<std::mutex> lock(m_buffer_lock);
@@ -447,40 +450,6 @@ void sound_xaudio2::OnVoiceProcessingPassStart(UINT32 bytes_required)
}
//============================================================
-// xaudio2_create
-//============================================================
-
-// Dynamically loads the XAudio2 DLL and calls the exported XAudio2Create()
-HRESULT sound_xaudio2::xaudio2_create(IXAudio2 ** ppxaudio2_interface)
-{
- HRESULT result;
-
- if (nullptr == m_pfnxaudio2create)
- {
- if (nullptr == m_xaudio2_module)
- {
- m_xaudio2_module = LoadLibrary(XAUDIO2_DLL);
- if (nullptr == m_xaudio2_module)
- {
- osd_printf_error("Failed to load module '%S', error: 0x%X\n", XAUDIO2_DLL, (unsigned int)GetLastError());
- HR_RETHR(E_FAIL);
- }
- }
-
- m_pfnxaudio2create = (PFN_XAUDIO2CREATE)GetProcAddress(m_xaudio2_module, "XAudio2Create");
- if (nullptr == m_pfnxaudio2create)
- {
- osd_printf_error("Failed to get adddress of exported function XAudio2Create, error: 0x%X\n", (unsigned int)GetLastError());
- HR_RETHR(E_FAIL);
- }
- }
-
- HR_RETHR(m_pfnxaudio2create(ppxaudio2_interface, 0, XAUDIO2_DEFAULT_PROCESSOR));
-
- return S_OK;
-}
-
-//============================================================
// create_buffers
//============================================================
@@ -510,9 +479,9 @@ void sound_xaudio2::create_buffers(const WAVEFORMATEX &format)
osd_printf_verbose(
"Sound: XAudio2 created initial buffers. total size: %u, count %u, size each %u\n",
- (unsigned int)total_buffer_size,
- (unsigned int)m_buffer_count,
- (unsigned int)m_buffer_size);
+ static_cast<unsigned int>(total_buffer_size),
+ static_cast<unsigned int>(m_buffer_count),
+ static_cast<unsigned int>(m_buffer_size));
// reset buffer states
m_writepos = 0;
@@ -608,7 +577,7 @@ void sound_xaudio2::submit_needed()
// submit_buffer
//============================================================
-void sound_xaudio2::submit_buffer(std::unique_ptr<BYTE[]> audioData, DWORD audioLength)
+void sound_xaudio2::submit_buffer(std::unique_ptr<BYTE[]> audioData, DWORD audioLength) const
{
assert(audioLength != 0);
@@ -623,7 +592,7 @@ void sound_xaudio2::submit_buffer(std::unique_ptr<BYTE[]> audioData, DWORD audio
HRESULT result;
if (FAILED(result = m_sourceVoice->SubmitSourceBuffer(&buf)))
{
- osd_printf_verbose("Sound: XAudio2 failed to submit source buffer (non-fatal). Error: 0x%X\n", (unsigned int)result);
+ osd_printf_verbose("Sound: XAudio2 failed to submit source buffer (non-fatal). Error: 0x%X\n", static_cast<unsigned int>(result));
m_buffer_pool->return_to_pool(audioData.release());
return;
}
diff --git a/src/osd/osdcomm.h b/src/osd/osdcomm.h
index 0a94ec0c284..ee040498cf0 100644
--- a/src/osd/osdcomm.h
+++ b/src/osd/osdcomm.h
@@ -65,27 +65,20 @@
/* 8-bit values */
-using UINT8 = uint8_t;
-using INT8 = int8_t;
+using UINT8 = std::uint8_t;
+using INT8 = std::int8_t;
/* 16-bit values */
-using UINT16 = uint16_t;
-using INT16 = int16_t;
+using UINT16 = std::uint16_t;
+using INT16 = std::int16_t;
/* 32-bit values */
-using UINT32 = uint32_t;
-using INT32 = int32_t;
+using UINT32 = std::uint32_t;
+using INT32 = std::int32_t;
/* 64-bit values */
-#ifndef _WINDOWS_H
-#ifdef _MSC_VER
-using UINT64 = unsigned __int64;
-using INT64 = signed __int64;
-#else
-using UINT64 = unsigned long long;
-using INT64 = signed long long;
-#endif
-#endif
+using UINT64 = std::uint64_t;
+using INT64 = std::int64_t;
/* pointer-sized values */
using FPTR = uintptr_t;
@@ -135,25 +128,6 @@ using FPTR = uintptr_t;
#define EXTRACT_64HI(val) ((UINT32)((val) >> 32))
#define EXTRACT_64LO(val) ((UINT32)(val))
-
-/* MINGW has adopted the MSVC formatting for 64-bit ints as of gcc 4.4 */
-#if defined(__MINGW32__) || defined(_MSC_VER)
-#define I64FMT "I64"
-#else
-#define I64FMT "ll"
-#endif
-
-#if defined(_MSC_VER) || defined(__MINGW32__)
-#ifdef PTR64
-#define SIZETFMT "I64u"
-#else
-#define SIZETFMT "u"
-#endif
-#else
-#define SIZETFMT "zu"
-#endif
-
-
/* Highly useful macro for compile-time knowledge of an array size */
#define ARRAY_LENGTH(x) (sizeof(x) / sizeof(x[0]))
diff --git a/src/osd/osdcore.cpp b/src/osd/osdcore.cpp
index 632124e2e7c..fef7d0d0f7a 100644
--- a/src/osd/osdcore.cpp
+++ b/src/osd/osdcore.cpp
@@ -2,6 +2,8 @@
// copyright-holders:Aaron Giles
#include "osdcore.h"
+#include <thread>
+#include <chrono>
static const int MAXSTACK = 10;
static osd_output *m_stack[MAXSTACK];
@@ -141,3 +143,41 @@ void CLIB_DECL osd_printf_log(const char *format, ...)
va_end(argptr);
}
#endif
+
+//============================================================
+// osd_ticks
+//============================================================
+
+osd_ticks_t osd_ticks(void)
+{
+ return std::chrono::high_resolution_clock::now().time_since_epoch().count();
+}
+
+
+//============================================================
+// osd_ticks_per_second
+//============================================================
+
+osd_ticks_t osd_ticks_per_second(void)
+{
+ return std::chrono::high_resolution_clock::period::den / std::chrono::high_resolution_clock::period::num;
+}
+
+//============================================================
+// osd_sleep
+//============================================================
+
+void osd_sleep(osd_ticks_t duration)
+{
+ std::this_thread::sleep_for(std::chrono::high_resolution_clock::duration(duration));
+}
+
+//============================================================
+// osd_num_processors
+//============================================================
+
+int osd_get_num_processors(void)
+{
+ // max out at 4 for now since scaling above that seems to do poorly
+ return MIN(std::thread::hardware_concurrency(), 4);
+}
diff --git a/src/osd/sdl/aueffectutil.mm b/src/osd/sdl/aueffectutil.mm
index 45ca18d178e..531d814e987 100644
--- a/src/osd/sdl/aueffectutil.mm
+++ b/src/osd/sdl/aueffectutil.mm
@@ -1,3 +1,5 @@
+// license:BSD-3-Clause
+// copyright-holders:Vas Crabb
#import <AvailabilityMacros.h>
#import <AudioUnit/AudioUnit.h>
#import <AudioUnit/AUCocoaUIView.h>
diff --git a/src/osd/sdl/keymaps/km-be.txt b/src/osd/sdl/keymaps/km-be.txt
deleted file mode 100644
index 014f3f02fac..00000000000
--- a/src/osd/sdl/keymaps/km-be.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-# Keymap for Belgian AZERTY keyboard (Linux)
-ITEM_ID_TILDE SDLK_WORLD_18 0x31 0xb2 ²
-ITEM_ID_1 SDLK_AMPERSAND 0xa 0x26 &
-ITEM_ID_2 SDLK_WORLD_73 0xb 0xe9 é
-ITEM_ID_3 SDLK_QUOTEDBL 0xc 0x22 "
-ITEM_ID_4 SDLK_QUOTE 0xd 0x27 '
-ITEM_ID_5 SDLK_LEFTPAREN 0xe 0x28 (
-ITEM_ID_6 SDLK_WORLD_39 0xf 0xa7 §
-ITEM_ID_7 SDLK_WORLD_72 0x10 0xe8 è
-ITEM_ID_8 SDLK_EXCLAIM 0x11 0x21 !
-ITEM_ID_9 SDLK_WORLD_71 0x12 0xe7 ç
-ITEM_ID_0 SDLK_WORLD_64 0x13 0xe0 à
-ITEM_ID_MINUS SDLK_RIGHTPAREN 0x14 0x29 )
-ITEM_ID_EQUALS SDLK_MINUS 0x15 0x2d -
-ITEM_ID_OPENBRACE SDLK_CARET 0x22 0x5e ^
-ITEM_ID_CLOSEBRACE SDLK_DOLLAR 0x23 0x24 $
-ITEM_ID_COMMA SDLK_COMMA 0x3a 0x2c ,
-ITEM_ID_STOP SDLK_SEMICOLON 0x3b 0x3b ;
-ITEM_ID_SLASH SDLK_COLON 0x3c 0x3a :
-ITEM_ID_COLON SDLK_WORLD_89 0x30 0xf9 ù
-ITEM_ID_QUOTE SDLK_WORLD_53 0x33 0xb5 µ
-ITEM_ID_BACKSLASH SDLK_EQUALS 0x3d 0x3d =
-ITEM_ID_BACKSLASH2 SDLK_LESS 0x5e 0x3c <
diff --git a/src/osd/sdl/keymaps/km-ch.txt b/src/osd/sdl/keymaps/km-ch.txt
deleted file mode 100644
index a23545bf5c8..00000000000
--- a/src/osd/sdl/keymaps/km-ch.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-# Keymap file for a swiss keyboard (Linux)
-#
-#
-ITEM_ID_MINUS SDLK_QUOTE 0x14 0x27 '
-ITEM_ID_EQUALS SDLK_CARET 0x15 0x0 ^
-ITEM_ID_Y SDLK_z 0x1d 0x7a z
-ITEM_ID_OPENBRACE SDLK_WORLD_92 0x22 0xfc ü
-ITEM_ID_CLOSEBRACE SDLK_COMPOSE 0x23 0x0 "
-ITEM_ID_COLON SDLK_WORLD_86 0x2f 0xf6 ö
-ITEM_ID_QUOTE SDLK_WORLD_68 0x30 0xe4 ä
-ITEM_ID_TILDE SDLK_WORLD_7 0x31 0xa7 §
-ITEM_ID_BACKSLASH SDLK_LESS 0x5e 0x3c <
-ITEM_ID_Z SDLK_y 0x34 0x79 y
-ITEM_ID_SLASH SDLK_MINUS 0x3d 0x2d -
diff --git a/src/osd/sdl/keymaps/km-de.txt b/src/osd/sdl/keymaps/km-de.txt
deleted file mode 100644
index 5e5b75fa7e9..00000000000
--- a/src/osd/sdl/keymaps/km-de.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Keymap file for a german keyboard (Linux)
-#
-#
-ITEM_ID_TILDE SDLK_CARET 0x31 0x0 ^
-ITEM_ID_MINUS SDLK_WORLD_63 0x14 0xdf ß
-ITEM_ID_EQUALS SDLK_COMPOSE 0x15 0x0 '
-ITEM_ID_OPENBRACE SDLK_WORLD_92 0x22 0xfc Ü
-ITEM_ID_CLOSEBRACE SDLK_PLUS 0x23 0x2b +
-ITEM_ID_COLON SDLK_WORLD_86 0x2f 0xf6 Ö
-ITEM_ID_QUOTE SDLK_WORLD_68 0x30 0xe4 Ä
-ITEM_ID_BACKSLASH SDLK_LESS 0x5e 0x3c <
-ITEM_ID_SLASH SDLK_MINUS 0x3d 0x2d -
-ITEM_ID_Z SDLK_y 0x34 0x79 Y
-ITEM_ID_Y SDLK_z 0x1d 0x7a Z
-[SDL2]
-ITEM_ID_TILDE SDL_SCANCODE_GRAVE 0x35 0x0 ^
-ITEM_ID_MINUS SDL_SCANCODE_MINUS 0x2d 0x0 ß
-ITEM_ID_EQUALS SDL_SCANCODE_EQUALS 0x2e 0x0 '
-ITEM_ID_OPENBRACE SDL_SCANCODE_LEFTBRACKET 0x2f 0x0 Ü
-ITEM_ID_CLOSEBRACE SDL_SCANCODE_RIGHTBRACKET 0x30 0x0 +
-ITEM_ID_COLON SDL_SCANCODE_SEMICOLON 0x33 0x0 Ö
-ITEM_ID_QUOTE SDL_SCANCODE_APOSTROPHE 0x34 0x0 Ä
-ITEM_ID_BACKSLASH SDL_SCANCODE_BACKSLASH 0x31 0x0 #
-ITEM_ID_SLASH SDL_SCANCODE_SLASH 0x38 0x0 -
-ITEM_ID_Z SDL_SCANCODE_Y 0x34 0x79 Y
-ITEM_ID_Y SDL_SCANCODE_Z 0x1d 0x7a Z
diff --git a/src/osd/sdl/keymaps/km-fr-OSX.txt b/src/osd/sdl/keymaps/km-fr-OSX.txt
deleted file mode 100644
index fc9bbef9f7c..00000000000
--- a/src/osd/sdl/keymaps/km-fr-OSX.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-# Keymap for French AZERTY keyboard (OSX)
-ITEM_ID_1 SDLK_AMPERSAND 0x12 0x26 &
-ITEM_ID_2 SDLK_WORLD_0 0x13 0xe9 é
-ITEM_ID_3 SDLK_QUOTEDBL 0x14 0x22 "
-ITEM_ID_4 SDLK_QUOTE 0x15 0x27 '
-ITEM_ID_5 SDLK_LEFTPAREN 0x17 0x28 (
-ITEM_ID_6 SDLK_WORLD_1 0x16 0xa7 §
-ITEM_ID_7 SDLK_WORLD_3 0x1a 0xe8 è
-ITEM_ID_8 SDLK_EXCLAIM 0x1c 0x21 !
-ITEM_ID_9 SDLK_WORLD_2 0x19 0xe7 ç
-ITEM_ID_0 SDLK_WORLD_4 0x1d 0xe0 à
-ITEM_ID_MINUS SDLK_RIGHTPAREN 0x1b 0x29 )
-ITEM_ID_EQUALS SDLK_MINUS 0x18 0x2d -
diff --git a/src/osd/sdl/keymaps/km-fr.txt b/src/osd/sdl/keymaps/km-fr.txt
deleted file mode 100644
index f68948295da..00000000000
--- a/src/osd/sdl/keymaps/km-fr.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-# Keymap for French AZERTY keyboard (Linux)
-ITEM_ID_TILDE SDLK_WORLD_18 0x31 0xb2 ²
-ITEM_ID_1 SDLK_AMPERSAND 0xa 0x26 &
-ITEM_ID_2 SDLK_WORLD_73 0xb 0xe9 é
-ITEM_ID_3 SDLK_QUOTEDBL 0xc 0x22 "
-ITEM_ID_4 SDLK_QUOTE 0xd 0x27 '
-ITEM_ID_5 SDLK_LEFTPAREN 0xe 0x28 (
-ITEM_ID_6 SDLK_MINUS 0xf 0x2d -
-ITEM_ID_7 SDLK_WORLD_72 0x10 0xe8 è
-ITEM_ID_8 SDLK_UNDERSCORE 0x11 0x5f _
-ITEM_ID_9 SDLK_WORLD_71 0x12 0xe7 ç
-ITEM_ID_0 SDLK_WORLD_64 0x13 0xe0 à
-ITEM_ID_MINUS SDLK_RIGHTPAREN 0x14 0x29 )
-ITEM_ID_EQUALS SDLK_EQUALS 0x15 0x3d =
-ITEM_ID_OPENBRACE SDLK_CARET 0x22 0x0
-ITEM_ID_CLOSEBRACE SDLK_DOLLAR 0x23 0x0
-ITEM_ID_COMMA SDLK_COMMA 0x3a 0x2c ,
-ITEM_ID_STOP SDLK_SEMICOLON 0x3b 0x3b ;
-ITEM_ID_SLASH SDLK_COLON 0x3c 0x3a :
-ITEM_ID_COLON SDLK_WORLD_89 0x30 0xf9 ù
-ITEM_ID_QUOTE SDLK_ASTERISK 0x33 0x2a *
-ITEM_ID_BACKSLASH SDLK_EXCLAIM 0x3d 0x21 !
-ITEM_ID_BACKSLASH2 SDLK_LESS 0x5e 0x3c <
diff --git a/src/osd/sdl/keymaps/km_it.txt b/src/osd/sdl/keymaps/km_it.txt
deleted file mode 100644
index aae0a121356..00000000000
--- a/src/osd/sdl/keymaps/km_it.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-# MAME/MESS keymap for an italian PC 105-keys keyboard
-
-ITEM_ID_TILDE SDLK_BACKSLASH 0x31 0x5c \
-ITEM_ID_MINUS SDLK_QUOTE 0x14 0x27 '
-ITEM_ID_EQUALS SDLK_WORLD_76 0x15 0xec ì
-ITEM_ID_OPENBRACE SDLK_WORLD_72 0x22 0xe8 è
-ITEM_ID_CLOSEBRACE SDLK_PLUS 0x23 0x2b +
-ITEM_ID_COLON SDLK_WORLD_82 0x2f 0xf2 ò
-ITEM_ID_QUOTE SDLK_WORLD_64 0x30 0xe0 à
-ITEM_ID_BACKSLASH SDLK_WORLD_89 0x33 0xf9 ù
-ITEM_ID_BACKSLASH2 SDLK_LESS 0x5e 0x3c <
-ITEM_ID_SLASH SDLK_MINUS 0x3d 0x2d - \ No newline at end of file
diff --git a/src/osd/sdl/ledutil.sh b/src/osd/sdl/ledutil.sh
index ef9ac93d353..e91e44200de 100644
--- a/src/osd/sdl/ledutil.sh
+++ b/src/osd/sdl/ledutil.sh
@@ -1,5 +1,6 @@
#!/bin/sh
-
+# license:BSD-3-Clause
+# copyright-holders:Olivier Galibert, R. Belmont
# ============================================================
#
# ledutil.sh - Example script for output notifiers
diff --git a/src/osd/sdl/man/LICENSE b/src/osd/sdl/man/LICENSE
new file mode 100644
index 00000000000..670154e3538
--- /dev/null
+++ b/src/osd/sdl/man/LICENSE
@@ -0,0 +1,116 @@
+CC0 1.0 Universal
+
+Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically confer
+exclusive Copyright and Related Rights (defined below) upon the creator and
+subsequent owner(s) (each and all, an "owner") of an original work of
+authorship and/or a database (each, a "Work").
+
+Certain owners wish to permanently relinquish those rights to a Work for the
+purpose of contributing to a commons of creative, cultural and scientific
+works ("Commons") that the public can reliably and without fear of later
+claims of infringement build upon, modify, incorporate in other works, reuse
+and redistribute as freely as possible in any form whatsoever and for any
+purposes, including without limitation commercial purposes. These owners may
+contribute to the Commons to promote the ideal of a free culture and the
+further production of creative, cultural and scientific works, or to gain
+reputation or greater distribution for their Work in part through the use and
+efforts of others.
+
+For these and/or other purposes and motivations, and without any expectation
+of additional consideration or compensation, the person associating CC0 with a
+Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
+and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
+and publicly distribute the Work under its terms, with knowledge of his or her
+Copyright and Related Rights in the Work and the meaning and intended legal
+effect of CC0 on those rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may be
+protected by copyright and related or neighboring rights ("Copyright and
+Related Rights"). Copyright and Related Rights include, but are not limited
+to, the following:
+
+ i. the right to reproduce, adapt, distribute, perform, display, communicate,
+ and translate a Work;
+
+ ii. moral rights retained by the original author(s) and/or performer(s);
+
+ iii. publicity and privacy rights pertaining to a person's image or likeness
+ depicted in a Work;
+
+ iv. rights protecting against unfair competition in regards to a Work,
+ subject to the limitations in paragraph 4(a), below;
+
+ v. rights protecting the extraction, dissemination, use and reuse of data in
+ a Work;
+
+ vi. database rights (such as those arising under Directive 96/9/EC of the
+ European Parliament and of the Council of 11 March 1996 on the legal
+ protection of databases, and under any national implementation thereof,
+ including any amended or successor version of such directive); and
+
+ vii. other similar, equivalent or corresponding rights throughout the world
+ based on applicable law or treaty, and any national implementations thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in contravention of,
+applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
+unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
+and Related Rights and associated claims and causes of action, whether now
+known or unknown (including existing as well as future claims and causes of
+action), in the Work (i) in all territories worldwide, (ii) for the maximum
+duration provided by applicable law or treaty (including future time
+extensions), (iii) in any current or future medium and for any number of
+copies, and (iv) for any purpose whatsoever, including without limitation
+commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
+the Waiver for the benefit of each member of the public at large and to the
+detriment of Affirmer's heirs and successors, fully intending that such Waiver
+shall not be subject to revocation, rescission, cancellation, termination, or
+any other legal or equitable action to disrupt the quiet enjoyment of the Work
+by the public as contemplated by Affirmer's express Statement of Purpose.
+
+3. Public License Fallback. Should any part of the Waiver for any reason be
+judged legally invalid or ineffective under applicable law, then the Waiver
+shall be preserved to the maximum extent permitted taking into account
+Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
+is so judged Affirmer hereby grants to each affected person a royalty-free,
+non transferable, non sublicensable, non exclusive, irrevocable and
+unconditional license to exercise Affirmer's Copyright and Related Rights in
+the Work (i) in all territories worldwide, (ii) for the maximum duration
+provided by applicable law or treaty (including future time extensions), (iii)
+in any current or future medium and for any number of copies, and (iv) for any
+purpose whatsoever, including without limitation commercial, advertising or
+promotional purposes (the "License"). The License shall be deemed effective as
+of the date CC0 was applied by Affirmer to the Work. Should any part of the
+License for any reason be judged legally invalid or ineffective under
+applicable law, such partial invalidity or ineffectiveness shall not
+invalidate the remainder of the License, and in such case Affirmer hereby
+affirms that he or she will not (i) exercise any of his or her remaining
+Copyright and Related Rights in the Work or (ii) assert any associated claims
+and causes of action with respect to the Work, in either case contrary to
+Affirmer's express Statement of Purpose.
+
+4. Limitations and Disclaimers.
+
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
+ surrendered, licensed or otherwise affected by this document.
+
+ b. Affirmer offers the Work as-is and makes no representations or warranties
+ of any kind concerning the Work, express, implied, statutory or otherwise,
+ including without limitation warranties of title, merchantability, fitness
+ for a particular purpose, non infringement, or the absence of latent or
+ other defects, accuracy, or the present or absence of errors, whether or not
+ discoverable, all to the greatest extent permissible under applicable law.
+
+ c. Affirmer disclaims responsibility for clearing rights of other persons
+ that may apply to the Work or any use thereof, including without limitation
+ any person's Copyright and Related Rights in the Work. Further, Affirmer
+ disclaims responsibility for obtaining any necessary consents, permissions
+ or other rights required for any use of the Work.
+
+ d. Affirmer understands and acknowledges that Creative Commons is not a
+ party to this document and has no duty or obligation with respect to this
+ CC0 or use of the Work.
+
+For more information, please see
+<http://creativecommons.org/publicdomain/zero/1.0/>
diff --git a/src/osd/sdl/man/README.md b/src/osd/sdl/man/README.md
new file mode 100644
index 00000000000..61036986e6a
--- /dev/null
+++ b/src/osd/sdl/man/README.md
@@ -0,0 +1,5 @@
+# **man pages** #
+
+man pages for MAME and its tools is work of many different contributors, and contain information about usage of MAME and utilities that are comming in package.
+
+Licensed under [CC0 1.0 Universal (CC0 1.0)](https://creativecommons.org/publicdomain/zero/1.0/) \ No newline at end of file
diff --git a/src/osd/sdl/sdlmain.cpp b/src/osd/sdl/sdlmain.cpp
index 1a52a105fd5..66bca69b1cf 100644
--- a/src/osd/sdl/sdlmain.cpp
+++ b/src/osd/sdl/sdlmain.cpp
@@ -270,8 +270,7 @@ void sdl_osd_interface::osd_exit()
if (!SDLMAME_INIT_IN_WORKER_THREAD)
{
- /* FixMe: Bug in SDL2.0, Quitting joystick will cause SIGSEGV */
- SDL_QuitSubSystem(SDL_INIT_TIMER| SDL_INIT_VIDEO /*| SDL_INIT_JOYSTICK */);
+ SDL_QuitSubSystem(SDL_INIT_TIMER| SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER );
}
}
@@ -490,9 +489,9 @@ void sdl_osd_interface::init(running_machine &machine)
{
#ifdef SDLMAME_EMSCRIPTEN
// timer brings in threads which are not supported in Emscripten
- if (SDL_InitSubSystem(SDL_INIT_VIDEO| SDL_INIT_JOYSTICK|SDL_INIT_NOPARACHUTE)) {
+ if (SDL_InitSubSystem(SDL_INIT_VIDEO| SDL_INIT_GAMECONTROLLER|SDL_INIT_NOPARACHUTE)) {
#else
- if (SDL_InitSubSystem(SDL_INIT_TIMER| SDL_INIT_VIDEO| SDL_INIT_JOYSTICK|SDL_INIT_NOPARACHUTE)) {
+ if (SDL_InitSubSystem(SDL_INIT_TIMER| SDL_INIT_VIDEO| SDL_INIT_GAMECONTROLLER|SDL_INIT_NOPARACHUTE)) {
#endif
osd_printf_error("Could not initialize SDL %s\n", SDL_GetError());
exit(-1);
diff --git a/src/osd/sdl/taputil.sh b/src/osd/sdl/taputil.sh
index 669d652436e..1a22048b9ca 100644
--- a/src/osd/sdl/taputil.sh
+++ b/src/osd/sdl/taputil.sh
@@ -1,5 +1,6 @@
#!/bin/sh
-
+# license:BSD-3-Clause
+# copyright-holders:Carl
NAME=$2
OURUID=`id -u $NAME`
HOSTIP=$4
diff --git a/src/osd/sdl/window.cpp b/src/osd/sdl/window.cpp
index 0c5bb7a51ca..1ca6e9605a6 100644
--- a/src/osd/sdl/window.cpp
+++ b/src/osd/sdl/window.cpp
@@ -184,7 +184,7 @@ static OSDWORK_CALLBACK(sdlwindow_thread_id)
if (SDLMAME_INIT_IN_WORKER_THREAD)
{
- if (SDL_InitSubSystem(SDL_INIT_TIMER|SDL_INIT_AUDIO| SDL_INIT_VIDEO| SDL_INIT_JOYSTICK|SDL_INIT_NOPARACHUTE))
+ if (SDL_InitSubSystem(SDL_INIT_TIMER|SDL_INIT_AUDIO| SDL_INIT_VIDEO| SDL_INIT_GAMECONTROLLER|SDL_INIT_NOPARACHUTE))
{
osd_printf_error("Could not initialize SDL: %s.\n", SDL_GetError());
exit(-1);
@@ -203,7 +203,7 @@ bool sdl_osd_interface::window_init()
{
osd_printf_verbose("Enter sdlwindow_init\n");
// determine if we are using multithreading or not
- multithreading_enabled = options().multithreading();
+ multithreading_enabled = false;//options().multithreading();
// get the main thread ID before anything else
main_threadid = SDL_ThreadID();
@@ -310,7 +310,7 @@ static void sdlwindow_sync(void)
while (!osd_work_queue_wait(work_queue, osd_ticks_per_second()*10))
{
osd_printf_warning("sdlwindow_sync: Sleeping...\n");
- osd_sleep(100000);
+ osd_sleep(osd_ticks_per_second() / 1000 * 100);
}
}
}
diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp
index 52d0a898df7..326e8248bab 100644
--- a/src/osd/windows/window.cpp
+++ b/src/osd/windows/window.cpp
@@ -12,7 +12,6 @@
// Needed for RAW Input
#define WM_INPUT 0x00FF
-#include <stdio.h> // must be here otherwise issues with I64FMT in MINGW
// standard C headers
#include <process.h>
@@ -152,7 +151,7 @@ static void mtlog_dump(void)
for (i = 0; i < mtlogindex; i++)
{
osd_ticks_t curr = mtlog[i].timestamp * 1000000 / cps;
- fprintf(f, "%20" I64FMT "d %10" I64FMT "d %s\n", (UINT64)curr, (UINT64)(curr - last), mtlog[i].event);
+ fprintf(f, "%s",string_format("%20I64d %10I64d %s\n", (UINT64)curr, (UINT64)(curr - last), mtlog[i].event).c_str());
last = curr;
}
fclose(f);
@@ -174,7 +173,7 @@ bool windows_osd_interface::window_init()
size_t temp;
// determine if we are using multithreading or not
- multithreading_enabled = downcast<windows_options &>(machine().options()).multithreading();
+ multithreading_enabled = false;//downcast<windows_options &>(machine().options()).multithreading();
// get the main thread ID before anything else
main_threadid = GetCurrentThreadId();
diff --git a/src/osd/windows/winfile.cpp b/src/osd/windows/winfile.cpp
index e8fcc30ab2c..742f97363d6 100644
--- a/src/osd/windows/winfile.cpp
+++ b/src/osd/windows/winfile.cpp
@@ -290,19 +290,6 @@ file_error osd_fflush(osd_file *file)
if (!file || !file->handle)
return FILERR_FAILURE;
- switch (file->type)
- {
- case WINFILE_FILE:
- // attempt to flush file buffers
- if (!FlushFileBuffers(file->handle))
- return win_error_to_mame_file_error(GetLastError());
- break;
- case WINFILE_SOCKET:
- return FILERR_FAILURE;
- case WINFILE_PTTY:
- return FILERR_FAILURE;
-
- }
return FILERR_NONE;
}
diff --git a/src/osd/windows/winutil.cpp b/src/osd/windows/winutil.cpp
index fe835301907..eb63eecacd0 100644
--- a/src/osd/windows/winutil.cpp
+++ b/src/osd/windows/winutil.cpp
@@ -160,7 +160,7 @@ lazy_loaded_function::lazy_loaded_function(const char * name, const wchar_t* dll
}
lazy_loaded_function::lazy_loaded_function(const char * name, const wchar_t** dll_names, int dll_count)
- : m_name(name), m_initialized(false), m_pfn(nullptr)
+ : m_name(name), m_module(NULL), m_initialized(false), m_pfn(nullptr)
{
for (int i = 0; i < dll_count; i++)
m_dll_names.push_back(std::wstring(dll_names[i]));
@@ -187,14 +187,20 @@ int lazy_loaded_function::initialize()
}
if (m_module == NULL)
+ {
+ osd_printf_verbose("Could not find DLL to dynamically link function %s.\n", m_name.c_str());
return ERROR_DLL_NOT_FOUND;
+ }
}
if (m_pfn == nullptr)
{
m_pfn = GetProcAddress(m_module, m_name.c_str());
if (m_pfn == nullptr)
+ {
+ osd_printf_verbose("Could not find function address to dynamically link function %s.\n", m_name.c_str());
return ERROR_NOT_FOUND;
+ }
}
m_initialized = true;
diff --git a/src/osd/windows/winutil.h b/src/osd/windows/winutil.h
index 8f205e5a8ba..530327dcf61 100644
--- a/src/osd/windows/winutil.h
+++ b/src/osd/windows/winutil.h
@@ -153,4 +153,26 @@ public:
}
};
+// Five parameters
+template <class TRet, class P1, class P2, class P3, class P4, class P5>
+class lazy_loaded_function_p5 : public lazy_loaded_function
+{
+public:
+ lazy_loaded_function_p5(const char * name, const wchar_t* dll_name)
+ : lazy_loaded_function(name, &dll_name, 1)
+ {
+ }
+
+ lazy_loaded_function_p5(const char * name, const wchar_t** dll_names, int dll_count)
+ : lazy_loaded_function(name, dll_names, dll_count)
+ {
+ }
+
+ TRet operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
+ {
+ check_init();
+ return ((TRet(__stdcall *) (P1, P2, P3, P4, P5))m_pfn)(p1, p2, p3, p4, p5);
+ }
+};
+
#endif // __WINUTIL__