mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-10 22:49:00 +01:00
Merge pull request #2243 from lioncash/osx-stuff
DolphinWX: Fix a crash that occurs on OSX.
This commit is contained in:
commit
01cb364c7a
@ -117,11 +117,11 @@ const int num_hotkeys = (sizeof(hotkey_labels) / sizeof(hotkey_labels[0]));
|
|||||||
namespace HotkeyManagerEmu
|
namespace HotkeyManagerEmu
|
||||||
{
|
{
|
||||||
|
|
||||||
u32 hotkeyDown[3];
|
static u32 s_hotkeyDown[3];
|
||||||
HotkeyStatus hotkey;
|
static HotkeyStatus s_hotkey;
|
||||||
bool enabled;
|
static bool s_enabled;
|
||||||
|
|
||||||
InputConfig s_config("Hotkeys", _trans("Hotkeys"), "Hotkeys");
|
static InputConfig s_config("Hotkeys", _trans("Hotkeys"), "Hotkeys");
|
||||||
|
|
||||||
InputConfig* GetConfig()
|
InputConfig* GetConfig()
|
||||||
{
|
{
|
||||||
@ -130,36 +130,36 @@ InputConfig* GetConfig()
|
|||||||
|
|
||||||
void GetStatus()
|
void GetStatus()
|
||||||
{
|
{
|
||||||
hotkey.err = PAD_ERR_NONE;
|
s_hotkey.err = PAD_ERR_NONE;
|
||||||
|
|
||||||
// get input
|
// get input
|
||||||
((HotkeyManager*)s_config.controllers[0])->GetInput(&hotkey);
|
((HotkeyManager*)s_config.controllers[0])->GetInput(&s_hotkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsEnabled()
|
bool IsEnabled()
|
||||||
{
|
{
|
||||||
return enabled;
|
return s_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Enable(bool enable_toggle)
|
void Enable(bool enable_toggle)
|
||||||
{
|
{
|
||||||
enabled = enable_toggle;
|
s_enabled = enable_toggle;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsPressed(int Id, bool held)
|
bool IsPressed(int Id, bool held)
|
||||||
{
|
{
|
||||||
unsigned int set = Id / 32;
|
unsigned int set = Id / 32;
|
||||||
unsigned int setKey = Id % 32;
|
unsigned int setKey = Id % 32;
|
||||||
if (hotkey.button[set] & (1 << setKey))
|
if (s_hotkey.button[set] & (1 << setKey))
|
||||||
{
|
{
|
||||||
hotkeyDown[set] |= (1 << setKey);
|
s_hotkeyDown[set] |= (1 << setKey);
|
||||||
if (held)
|
if (held)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool pressed = !!(hotkeyDown[set] & (1 << setKey));
|
bool pressed = !!(s_hotkeyDown[set] & (1 << setKey));
|
||||||
hotkeyDown[set] &= ~(1 << setKey);
|
s_hotkeyDown[set] &= ~(1 << setKey);
|
||||||
if (pressed)
|
if (pressed)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -178,9 +178,9 @@ void Initialize(void* const hwnd)
|
|||||||
s_config.LoadConfig(true);
|
s_config.LoadConfig(true);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < 3; ++i)
|
for (unsigned int i = 0; i < 3; ++i)
|
||||||
hotkeyDown[i] = 0;
|
s_hotkeyDown[i] = 0;
|
||||||
|
|
||||||
enabled = true;
|
s_enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadConfig()
|
void LoadConfig()
|
||||||
|
@ -358,15 +358,15 @@ bool CFrame::InitControllers()
|
|||||||
{
|
{
|
||||||
#if defined(HAVE_X11) && HAVE_X11
|
#if defined(HAVE_X11) && HAVE_X11
|
||||||
Window win = X11Utils::XWindowFromHandle(GetHandle());
|
Window win = X11Utils::XWindowFromHandle(GetHandle());
|
||||||
HotkeyManagerEmu::Initialize(reinterpret_cast<void*>(win));
|
|
||||||
Pad::Initialize(reinterpret_cast<void*>(win));
|
Pad::Initialize(reinterpret_cast<void*>(win));
|
||||||
Keyboard::Initialize(reinterpret_cast<void*>(win));
|
Keyboard::Initialize(reinterpret_cast<void*>(win));
|
||||||
Wiimote::Initialize(reinterpret_cast<void*>(win));
|
Wiimote::Initialize(reinterpret_cast<void*>(win));
|
||||||
|
HotkeyManagerEmu::Initialize(reinterpret_cast<void*>(win));
|
||||||
#else
|
#else
|
||||||
HotkeyManagerEmu::Initialize(reinterpret_cast<void*>(GetHandle()));
|
|
||||||
Pad::Initialize(reinterpret_cast<void*>(GetHandle()));
|
Pad::Initialize(reinterpret_cast<void*>(GetHandle()));
|
||||||
Keyboard::Initialize(reinterpret_cast<void*>(GetHandle()));
|
Keyboard::Initialize(reinterpret_cast<void*>(GetHandle()));
|
||||||
Wiimote::Initialize(reinterpret_cast<void*>(GetHandle()));
|
Wiimote::Initialize(reinterpret_cast<void*>(GetHandle()));
|
||||||
|
HotkeyManagerEmu::Initialize(reinterpret_cast<void*>(GetHandle()));
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user