mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-23 06:10:03 -06:00
add pause/reset hotkeys
This commit is contained in:
@ -64,7 +64,15 @@ char dskeylabels[12][8] = {"A:", "B:", "Select:", "Start:", "Right:", "Left:", "
|
|||||||
|
|
||||||
int identity[32] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31};
|
int identity[32] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31};
|
||||||
|
|
||||||
char hotkeylabels[HK_MAX][32] = {"Close/open lid:", "Microphone:", "Fast forward:", "Fast forward (toggle):"};
|
char hotkeylabels[HK_MAX][32] =
|
||||||
|
{
|
||||||
|
"Close/open lid:",
|
||||||
|
"Microphone:",
|
||||||
|
"Pause/resume:",
|
||||||
|
"Reset:",
|
||||||
|
"Fast forward:",
|
||||||
|
"Fast forward (toggle):"
|
||||||
|
};
|
||||||
|
|
||||||
int openedmask;
|
int openedmask;
|
||||||
InputDlgData inputdlg[2];
|
InputDlgData inputdlg[2];
|
||||||
@ -319,7 +327,7 @@ Uint32 JoyPoll(Uint32 interval, void* param)
|
|||||||
{
|
{
|
||||||
Sint16 axisval = SDL_JoystickGetAxis(joy, i);
|
Sint16 axisval = SDL_JoystickGetAxis(joy, i);
|
||||||
int diff = abs(axisval - dlg->axes_rest[i]);
|
int diff = abs(axisval - dlg->axes_rest[i]);
|
||||||
printf("axis%d: val=%d, diff=%d\n", i, axisval, diff);
|
|
||||||
if (dlg->axes_rest[i] < -16384 && axisval >= 0)
|
if (dlg->axes_rest[i] < -16384 && axisval >= 0)
|
||||||
{
|
{
|
||||||
dlg->joymap[id] = (oldmap & 0xFFFF) | 0x10000 | (2 << 20) | (i << 24);
|
dlg->joymap[id] = (oldmap & 0xFFFF) | 0x10000 | (2 << 20) | (i << 24);
|
||||||
|
@ -92,11 +92,15 @@ ConfigEntry PlatformConfigFile[] =
|
|||||||
|
|
||||||
{"HKKey_Lid", 0, &HKKeyMapping[HK_Lid], 0x0D, NULL, 0},
|
{"HKKey_Lid", 0, &HKKeyMapping[HK_Lid], 0x0D, NULL, 0},
|
||||||
{"HKKey_Mic", 0, &HKKeyMapping[HK_Mic], 0x35, NULL, 0},
|
{"HKKey_Mic", 0, &HKKeyMapping[HK_Mic], 0x35, NULL, 0},
|
||||||
|
{"HKKey_Pause", 0, &HKKeyMapping[HK_Pause], -1, NULL, 0},
|
||||||
|
{"HKKey_Reset", 0, &HKKeyMapping[HK_Reset], -1, NULL, 0},
|
||||||
{"HKKey_FastForward", 0, &HKKeyMapping[HK_FastForward], 0x0F, NULL, 0},
|
{"HKKey_FastForward", 0, &HKKeyMapping[HK_FastForward], 0x0F, NULL, 0},
|
||||||
{"HKKey_FastForwardToggle", 0, &HKKeyMapping[HK_FastForwardToggle], -1, NULL, 0},
|
{"HKKey_FastForwardToggle", 0, &HKKeyMapping[HK_FastForwardToggle], -1, NULL, 0},
|
||||||
|
|
||||||
{"HKJoy_Lid", 0, &HKJoyMapping[HK_Lid], -1, NULL, 0},
|
{"HKJoy_Lid", 0, &HKJoyMapping[HK_Lid], -1, NULL, 0},
|
||||||
{"HKJoy_Mic", 0, &HKJoyMapping[HK_Mic], -1, NULL, 0},
|
{"HKJoy_Mic", 0, &HKJoyMapping[HK_Mic], -1, NULL, 0},
|
||||||
|
{"HKJoy_Pause", 0, &HKJoyMapping[HK_Pause], -1, NULL, 0},
|
||||||
|
{"HKJoy_Reset", 0, &HKJoyMapping[HK_Reset], -1, NULL, 0},
|
||||||
{"HKJoy_FastForward", 0, &HKJoyMapping[HK_FastForward], -1, NULL, 0},
|
{"HKJoy_FastForward", 0, &HKJoyMapping[HK_FastForward], -1, NULL, 0},
|
||||||
{"HKJoy_FastForwardToggle", 0, &HKJoyMapping[HK_FastForwardToggle], -1, NULL, 0},
|
{"HKJoy_FastForwardToggle", 0, &HKJoyMapping[HK_FastForwardToggle], -1, NULL, 0},
|
||||||
|
|
||||||
|
@ -25,6 +25,8 @@ enum
|
|||||||
{
|
{
|
||||||
HK_Lid = 0,
|
HK_Lid = 0,
|
||||||
HK_Mic,
|
HK_Mic,
|
||||||
|
HK_Pause,
|
||||||
|
HK_Reset,
|
||||||
HK_FastForward,
|
HK_FastForward,
|
||||||
HK_FastForwardToggle,
|
HK_FastForwardToggle,
|
||||||
HK_MAX
|
HK_MAX
|
||||||
|
@ -168,6 +168,11 @@ s16* MicWavBuffer;
|
|||||||
|
|
||||||
void SetupScreenRects(int width, int height);
|
void SetupScreenRects(int width, int height);
|
||||||
|
|
||||||
|
void TogglePause(void* blarg);
|
||||||
|
void Reset(void* blarg);
|
||||||
|
|
||||||
|
void SetupSRAMPath();
|
||||||
|
|
||||||
void SaveState(int slot);
|
void SaveState(int slot);
|
||||||
void LoadState(int slot);
|
void LoadState(int slot);
|
||||||
void UndoStateLoad();
|
void UndoStateLoad();
|
||||||
@ -881,6 +886,9 @@ int EmuThreadFunc(void* burp)
|
|||||||
uiQueueMain(UpdateFPSLimit, NULL);
|
uiQueueMain(UpdateFPSLimit, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (HotkeyPressed(HK_Pause)) uiQueueMain(TogglePause, NULL);
|
||||||
|
if (HotkeyPressed(HK_Reset)) uiQueueMain(Reset, NULL);
|
||||||
|
|
||||||
if (EmuRunning == 1)
|
if (EmuRunning == 1)
|
||||||
{
|
{
|
||||||
EmuStatus = 1;
|
EmuStatus = 1;
|
||||||
@ -1535,6 +1543,29 @@ void TogglePause(void* blarg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Reset(void* blarg)
|
||||||
|
{
|
||||||
|
if (!RunningSomething) return;
|
||||||
|
|
||||||
|
EmuRunning = 2;
|
||||||
|
while (EmuStatus != 2);
|
||||||
|
|
||||||
|
SavestateLoaded = false;
|
||||||
|
uiMenuItemDisable(MenuItem_UndoStateLoad);
|
||||||
|
|
||||||
|
if (ROMPath[0] == '\0')
|
||||||
|
NDS::LoadBIOS();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetupSRAMPath();
|
||||||
|
NDS::LoadROM(ROMPath, SRAMPath, Config::DirectBoot);
|
||||||
|
}
|
||||||
|
|
||||||
|
Run();
|
||||||
|
|
||||||
|
OSD::AddMessage(0, "Reset");
|
||||||
|
}
|
||||||
|
|
||||||
void Stop(bool internal)
|
void Stop(bool internal)
|
||||||
{
|
{
|
||||||
EmuRunning = 2;
|
EmuRunning = 2;
|
||||||
@ -1917,23 +1948,7 @@ void OnPause(uiMenuItem* item, uiWindow* window, void* blarg)
|
|||||||
|
|
||||||
void OnReset(uiMenuItem* item, uiWindow* window, void* blarg)
|
void OnReset(uiMenuItem* item, uiWindow* window, void* blarg)
|
||||||
{
|
{
|
||||||
if (!RunningSomething) return;
|
Reset(NULL);
|
||||||
|
|
||||||
EmuRunning = 2;
|
|
||||||
while (EmuStatus != 2);
|
|
||||||
|
|
||||||
SavestateLoaded = false;
|
|
||||||
uiMenuItemDisable(MenuItem_UndoStateLoad);
|
|
||||||
|
|
||||||
if (ROMPath[0] == '\0')
|
|
||||||
NDS::LoadBIOS();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SetupSRAMPath();
|
|
||||||
NDS::LoadROM(ROMPath, SRAMPath, Config::DirectBoot);
|
|
||||||
}
|
|
||||||
|
|
||||||
Run();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnStop(uiMenuItem* item, uiWindow* window, void* blarg)
|
void OnStop(uiMenuItem* item, uiWindow* window, void* blarg)
|
||||||
|
Reference in New Issue
Block a user