Add hotkey to swap screens (#953)

This commit is contained in:
gal20 2021-01-18 23:51:39 +02:00 committed by GitHub
parent d529b650c0
commit cd6859ef6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 4 deletions

View File

@ -57,6 +57,7 @@ const int hk_general[] =
HK_FullscreenToggle,
HK_Lid,
HK_Mic,
HK_SwapScreens
};
const char* hk_general_labels[] =
@ -68,6 +69,7 @@ const char* hk_general_labels[] =
"Toggle Fullscreen",
"Close/open lid",
"Microphone",
"Swap screens"
};
@ -88,7 +90,7 @@ InputConfigDialog::InputConfigDialog(QWidget* parent) : QDialog(parent), ui(new
addonsJoyMap[i] = Config::HKJoyMapping[hk_addons[i]];
}
for (int i = 0; i < 7; i++)
for (int i = 0; i < 8; i++)
{
hkGeneralKeyMap[i] = Config::HKKeyMapping[hk_general[i]];
hkGeneralJoyMap[i] = Config::HKJoyMapping[hk_general[i]];
@ -96,7 +98,7 @@ InputConfigDialog::InputConfigDialog(QWidget* parent) : QDialog(parent), ui(new
populatePage(ui->tabInput, 12, dskeylabels, keypadKeyMap, keypadJoyMap);
populatePage(ui->tabAddons, 2, hk_addons_labels, addonsKeyMap, addonsJoyMap);
populatePage(ui->tabHotkeysGeneral, 7, hk_general_labels, hkGeneralKeyMap, hkGeneralJoyMap);
populatePage(ui->tabHotkeysGeneral, 8, hk_general_labels, hkGeneralKeyMap, hkGeneralJoyMap);
int njoy = SDL_NumJoysticks();
if (njoy > 0)
@ -179,7 +181,7 @@ void InputConfigDialog::on_InputConfigDialog_accepted()
Config::HKJoyMapping[hk_addons[i]] = addonsJoyMap[i];
}
for (int i = 0; i < 7; i++)
for (int i = 0; i < 8; i++)
{
Config::HKKeyMapping[hk_general[i]] = hkGeneralKeyMap[i];
Config::HKJoyMapping[hk_general[i]] = hkGeneralJoyMap[i];

View File

@ -64,7 +64,7 @@ private:
int keypadKeyMap[12], keypadJoyMap[12];
int addonsKeyMap[2], addonsJoyMap[2];
int hkGeneralKeyMap[7], hkGeneralJoyMap[7];
int hkGeneralKeyMap[8], hkGeneralJoyMap[8];
};

View File

@ -114,6 +114,7 @@ ConfigEntry PlatformConfigFile[] =
{"HKKey_FastForward", 0, &HKKeyMapping[HK_FastForward], -1, NULL, 0},
{"HKKey_FastForwardToggle", 0, &HKKeyMapping[HK_FastForwardToggle], -1, NULL, 0},
{"HKKey_FullscreenToggle", 0, &HKKeyMapping[HK_FullscreenToggle], -1, NULL, 0},
{"HKKey_SwapScreens", 0, &HKKeyMapping[HK_SwapScreens], -1, NULL, 0},
{"HKKey_SolarSensorDecrease", 0, &HKKeyMapping[HK_SolarSensorDecrease], -1, NULL, 0},
{"HKKey_SolarSensorIncrease", 0, &HKKeyMapping[HK_SolarSensorIncrease], -1, NULL, 0},
@ -124,6 +125,7 @@ ConfigEntry PlatformConfigFile[] =
{"HKJoy_FastForward", 0, &HKJoyMapping[HK_FastForward], -1, NULL, 0},
{"HKJoy_FastForwardToggle", 0, &HKJoyMapping[HK_FastForwardToggle], -1, NULL, 0},
{"HKJoy_FullscreenToggle", 0, &HKJoyMapping[HK_FullscreenToggle], -1, NULL, 0},
{"HKJoy_SwapScreens", 0, &HKJoyMapping[HK_SwapScreens], -1, NULL, 0},
{"HKJoy_SolarSensorDecrease", 0, &HKJoyMapping[HK_SolarSensorDecrease], -1, NULL, 0},
{"HKJoy_SolarSensorIncrease", 0, &HKJoyMapping[HK_SolarSensorIncrease], -1, NULL, 0},

View File

@ -30,6 +30,7 @@ enum
HK_FastForward,
HK_FastForwardToggle,
HK_FullscreenToggle,
HK_SwapScreens,
HK_SolarSensorDecrease,
HK_SolarSensorIncrease,
HK_MAX

View File

@ -282,6 +282,7 @@ EmuThread::EmuThread(QObject* parent) : QThread(parent)
connect(this, SIGNAL(windowLimitFPSChange()), mainWindow->actLimitFramerate, SLOT(trigger()));
connect(this, SIGNAL(screenLayoutChange()), mainWindow->panel, SLOT(onScreenLayoutChanged()));
connect(this, SIGNAL(windowFullscreenToggle()), mainWindow, SLOT(onFullscreenToggled()));
connect(this, SIGNAL(swapScreensToggle()), mainWindow->actScreenSwap, SLOT(trigger()));
if (mainWindow->hasOGL) initOpenGL();
}
@ -387,6 +388,8 @@ void EmuThread::run()
if (Input::HotkeyPressed(HK_FullscreenToggle)) emit windowFullscreenToggle();
if (Input::HotkeyPressed(HK_SwapScreens)) emit swapScreensToggle();
if (GBACart::CartInserted && GBACart::HasSolarSensor)
{
if (Input::HotkeyPressed(HK_SolarSensorDecrease))

View File

@ -72,6 +72,8 @@ signals:
void windowFullscreenToggle();
void swapScreensToggle();
private:
volatile int EmuStatus;
int PrevEmuStatus;