mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
Add a hotkey for inserting/ejecting the SD card
This commit is contained in:
parent
0a7395bfba
commit
e24789b4fb
@ -20,7 +20,7 @@
|
|||||||
#include "InputCommon/GCPadStatus.h"
|
#include "InputCommon/GCPadStatus.h"
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
constexpr std::array<const char*, 133> s_hotkey_labels{{
|
constexpr std::array<const char*, 134> s_hotkey_labels{{
|
||||||
_trans("Open"),
|
_trans("Open"),
|
||||||
_trans("Change Disc"),
|
_trans("Change Disc"),
|
||||||
_trans("Eject Disc"),
|
_trans("Eject Disc"),
|
||||||
@ -78,6 +78,7 @@ constexpr std::array<const char*, 133> s_hotkey_labels{{
|
|||||||
_trans("Connect Wii Remote 3"),
|
_trans("Connect Wii Remote 3"),
|
||||||
_trans("Connect Wii Remote 4"),
|
_trans("Connect Wii Remote 4"),
|
||||||
_trans("Connect Balance Board"),
|
_trans("Connect Balance Board"),
|
||||||
|
_trans("Toggle SD Card"),
|
||||||
_trans("Toggle USB Keyboard"),
|
_trans("Toggle USB Keyboard"),
|
||||||
|
|
||||||
_trans("Next Profile for Wii Remote 1"),
|
_trans("Next Profile for Wii Remote 1"),
|
||||||
|
@ -68,6 +68,7 @@ enum Hotkey
|
|||||||
HK_WIIMOTE3_CONNECT,
|
HK_WIIMOTE3_CONNECT,
|
||||||
HK_WIIMOTE4_CONNECT,
|
HK_WIIMOTE4_CONNECT,
|
||||||
HK_BALANCEBOARD_CONNECT,
|
HK_BALANCEBOARD_CONNECT,
|
||||||
|
HK_TOGGLE_SD_CARD,
|
||||||
HK_TOGGLE_USB_KEYBOARD,
|
HK_TOGGLE_USB_KEYBOARD,
|
||||||
|
|
||||||
HK_NEXT_WIIMOTE_PROFILE_1,
|
HK_NEXT_WIIMOTE_PROFILE_1,
|
||||||
|
@ -248,6 +248,9 @@ void HotkeyScheduler::Run()
|
|||||||
if (wiimote_id > -1)
|
if (wiimote_id > -1)
|
||||||
emit ConnectWiiRemote(wiimote_id);
|
emit ConnectWiiRemote(wiimote_id);
|
||||||
|
|
||||||
|
if (IsHotkey(HK_TOGGLE_SD_CARD))
|
||||||
|
Settings::Instance().SetSDCardInserted(!Settings::Instance().IsSDCardInserted());
|
||||||
|
|
||||||
if (IsHotkey(HK_TOGGLE_USB_KEYBOARD))
|
if (IsHotkey(HK_TOGGLE_USB_KEYBOARD))
|
||||||
{
|
{
|
||||||
Settings::Instance().SetUSBKeyboardConnected(
|
Settings::Instance().SetUSBKeyboardConnected(
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "Core/Config/MainSettings.h"
|
#include "Core/Config/MainSettings.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
|
#include "Core/IOS/IOS.h"
|
||||||
#include "Core/NetPlayClient.h"
|
#include "Core/NetPlayClient.h"
|
||||||
#include "Core/NetPlayServer.h"
|
#include "Core/NetPlayServer.h"
|
||||||
|
|
||||||
@ -534,6 +535,24 @@ void Settings::SetBatchModeEnabled(bool batch)
|
|||||||
m_batch = batch;
|
m_batch = batch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Settings::IsSDCardInserted() const
|
||||||
|
{
|
||||||
|
return SConfig::GetInstance().m_WiiSDCard;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::SetSDCardInserted(bool inserted)
|
||||||
|
{
|
||||||
|
if (IsSDCardInserted() != inserted)
|
||||||
|
{
|
||||||
|
SConfig::GetInstance().m_WiiSDCard = inserted;
|
||||||
|
emit SDCardInsertionChanged(inserted);
|
||||||
|
|
||||||
|
auto* ios = IOS::HLE::GetIOS();
|
||||||
|
if (ios)
|
||||||
|
ios->SDIO_EventNotify();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Settings::IsUSBKeyboardConnected() const
|
bool Settings::IsUSBKeyboardConnected() const
|
||||||
{
|
{
|
||||||
return SConfig::GetInstance().m_WiiKeyboard;
|
return SConfig::GetInstance().m_WiiKeyboard;
|
||||||
|
@ -87,6 +87,8 @@ public:
|
|||||||
bool IsBatchModeEnabled() const;
|
bool IsBatchModeEnabled() const;
|
||||||
void SetBatchModeEnabled(bool batch);
|
void SetBatchModeEnabled(bool batch);
|
||||||
|
|
||||||
|
bool IsSDCardInserted() const;
|
||||||
|
void SetSDCardInserted(bool inserted);
|
||||||
bool IsUSBKeyboardConnected() const;
|
bool IsUSBKeyboardConnected() const;
|
||||||
void SetUSBKeyboardConnected(bool connected);
|
void SetUSBKeyboardConnected(bool connected);
|
||||||
|
|
||||||
@ -172,6 +174,7 @@ signals:
|
|||||||
void AutoUpdateTrackChanged(const QString& mode);
|
void AutoUpdateTrackChanged(const QString& mode);
|
||||||
void AnalyticsToggled(bool enabled);
|
void AnalyticsToggled(bool enabled);
|
||||||
void DevicesChanged();
|
void DevicesChanged();
|
||||||
|
void SDCardInsertionChanged(bool inserted);
|
||||||
void USBKeyboardConnectionChanged(bool connected);
|
void USBKeyboardConnectionChanged(bool connected);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#include "Core/Config/SYSCONFSettings.h"
|
#include "Core/Config/SYSCONFSettings.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/IOS/IOS.h"
|
|
||||||
|
|
||||||
#include "DolphinQt/Settings.h"
|
#include "DolphinQt/Settings.h"
|
||||||
#include "DolphinQt/Settings/USBDeviceAddToWhitelistDialog.h"
|
#include "DolphinQt/Settings/USBDeviceAddToWhitelistDialog.h"
|
||||||
@ -74,6 +73,8 @@ void WiiPane::ConnectLayout()
|
|||||||
connect(m_pal60_mode_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
|
connect(m_pal60_mode_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
|
||||||
connect(m_sd_card_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
|
connect(m_sd_card_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
|
||||||
connect(m_connect_keyboard_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
|
connect(m_connect_keyboard_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
|
||||||
|
connect(&Settings::Instance(), &Settings::SDCardInsertionChanged, m_sd_card_checkbox,
|
||||||
|
&QCheckBox::setChecked);
|
||||||
connect(&Settings::Instance(), &Settings::USBKeyboardConnectionChanged,
|
connect(&Settings::Instance(), &Settings::USBKeyboardConnectionChanged,
|
||||||
m_connect_keyboard_checkbox, &QCheckBox::setChecked);
|
m_connect_keyboard_checkbox, &QCheckBox::setChecked);
|
||||||
|
|
||||||
@ -205,8 +206,8 @@ void WiiPane::LoadConfig()
|
|||||||
{
|
{
|
||||||
m_screensaver_checkbox->setChecked(Config::Get(Config::SYSCONF_SCREENSAVER));
|
m_screensaver_checkbox->setChecked(Config::Get(Config::SYSCONF_SCREENSAVER));
|
||||||
m_pal60_mode_checkbox->setChecked(Config::Get(Config::SYSCONF_PAL60));
|
m_pal60_mode_checkbox->setChecked(Config::Get(Config::SYSCONF_PAL60));
|
||||||
|
m_sd_card_checkbox->setChecked(Settings::Instance().IsSDCardInserted());
|
||||||
m_connect_keyboard_checkbox->setChecked(Settings::Instance().IsUSBKeyboardConnected());
|
m_connect_keyboard_checkbox->setChecked(Settings::Instance().IsUSBKeyboardConnected());
|
||||||
m_sd_card_checkbox->setChecked(SConfig::GetInstance().m_WiiSDCard);
|
|
||||||
m_aspect_ratio_choice->setCurrentIndex(Config::Get(Config::SYSCONF_WIDESCREEN));
|
m_aspect_ratio_choice->setCurrentIndex(Config::Get(Config::SYSCONF_WIDESCREEN));
|
||||||
m_system_language_choice->setCurrentIndex(Config::Get(Config::SYSCONF_LANGUAGE));
|
m_system_language_choice->setCurrentIndex(Config::Get(Config::SYSCONF_LANGUAGE));
|
||||||
|
|
||||||
@ -225,16 +226,9 @@ void WiiPane::OnSaveConfig()
|
|||||||
|
|
||||||
Config::SetBase(Config::SYSCONF_SCREENSAVER, m_screensaver_checkbox->isChecked());
|
Config::SetBase(Config::SYSCONF_SCREENSAVER, m_screensaver_checkbox->isChecked());
|
||||||
Config::SetBase(Config::SYSCONF_PAL60, m_pal60_mode_checkbox->isChecked());
|
Config::SetBase(Config::SYSCONF_PAL60, m_pal60_mode_checkbox->isChecked());
|
||||||
|
Settings::Instance().SetSDCardInserted(m_sd_card_checkbox->isChecked());
|
||||||
Settings::Instance().SetUSBKeyboardConnected(m_connect_keyboard_checkbox->isChecked());
|
Settings::Instance().SetUSBKeyboardConnected(m_connect_keyboard_checkbox->isChecked());
|
||||||
|
|
||||||
if (SConfig::GetInstance().m_WiiSDCard != m_sd_card_checkbox->isChecked())
|
|
||||||
{
|
|
||||||
SConfig::GetInstance().m_WiiSDCard = m_sd_card_checkbox->isChecked();
|
|
||||||
auto* ios = IOS::HLE::GetIOS();
|
|
||||||
if (ios)
|
|
||||||
ios->SDIO_EventNotify();
|
|
||||||
}
|
|
||||||
|
|
||||||
Config::SetBase<u32>(Config::SYSCONF_SENSOR_BAR_POSITION,
|
Config::SetBase<u32>(Config::SYSCONF_SENSOR_BAR_POSITION,
|
||||||
TranslateSensorBarPosition(m_wiimote_ir_sensor_position->currentIndex()));
|
TranslateSensorBarPosition(m_wiimote_ir_sensor_position->currentIndex()));
|
||||||
Config::SetBase<u32>(Config::SYSCONF_SENSOR_BAR_SENSITIVITY, m_wiimote_ir_sensitivity->value());
|
Config::SetBase<u32>(Config::SYSCONF_SENSOR_BAR_SENSITIVITY, m_wiimote_ir_sensitivity->value());
|
||||||
|
Loading…
Reference in New Issue
Block a user