add pause/reset hotkeys

This commit is contained in:
Arisotura 2019-06-12 01:12:49 +02:00
parent 1cb8f3c8b2
commit 4abf0473c2
4 changed files with 48 additions and 19 deletions

View File

@ -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};
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;
InputDlgData inputdlg[2];
@ -319,7 +327,7 @@ Uint32 JoyPoll(Uint32 interval, void* param)
{
Sint16 axisval = SDL_JoystickGetAxis(joy, 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)
{
dlg->joymap[id] = (oldmap & 0xFFFF) | 0x10000 | (2 << 20) | (i << 24);

View File

@ -92,11 +92,15 @@ ConfigEntry PlatformConfigFile[] =
{"HKKey_Lid", 0, &HKKeyMapping[HK_Lid], 0x0D, 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_FastForwardToggle", 0, &HKKeyMapping[HK_FastForwardToggle], -1, NULL, 0},
{"HKJoy_Lid", 0, &HKJoyMapping[HK_Lid], -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_FastForwardToggle", 0, &HKJoyMapping[HK_FastForwardToggle], -1, NULL, 0},

View File

@ -25,6 +25,8 @@ enum
{
HK_Lid = 0,
HK_Mic,
HK_Pause,
HK_Reset,
HK_FastForward,
HK_FastForwardToggle,
HK_MAX

View File

@ -168,6 +168,11 @@ s16* MicWavBuffer;
void SetupScreenRects(int width, int height);
void TogglePause(void* blarg);
void Reset(void* blarg);
void SetupSRAMPath();
void SaveState(int slot);
void LoadState(int slot);
void UndoStateLoad();
@ -881,6 +886,9 @@ int EmuThreadFunc(void* burp)
uiQueueMain(UpdateFPSLimit, NULL);
}
if (HotkeyPressed(HK_Pause)) uiQueueMain(TogglePause, NULL);
if (HotkeyPressed(HK_Reset)) uiQueueMain(Reset, NULL);
if (EmuRunning == 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)
{
EmuRunning = 2;
@ -1917,23 +1948,7 @@ void OnPause(uiMenuItem* item, uiWindow* window, void* blarg)
void OnReset(uiMenuItem* item, uiWindow* window, 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();
Reset(NULL);
}
void OnStop(uiMenuItem* item, uiWindow* window, void* blarg)