Input: Use settings to handle emulation pause
This commit is contained in:
parent
d5ee7de865
commit
4e18341f5f
|
@ -810,10 +810,6 @@ void CN64System::EndEmulation(void)
|
|||
|
||||
void CN64System::Pause()
|
||||
{
|
||||
if (m_Plugins && m_Plugins->Control()->EmulationPaused)
|
||||
{
|
||||
m_Plugins->Control()->EmulationPaused();
|
||||
}
|
||||
if (m_EndEmulation)
|
||||
{
|
||||
return;
|
||||
|
|
|
@ -36,7 +36,6 @@ bool CControl_Plugin::LoadFunctions(void)
|
|||
LoadFunction(WM_KeyUp);
|
||||
LoadFunction(RumbleCommand);
|
||||
LoadFunction(WM_KillFocus);
|
||||
LoadFunction(EmulationPaused);
|
||||
|
||||
// Make sure DLL had all needed functions
|
||||
if (InitiateControllers == nullptr)
|
||||
|
|
|
@ -49,7 +49,6 @@ public:
|
|||
void(CALL * WM_KeyDown)(uint32_t wParam, uint32_t lParam);
|
||||
void(CALL * WM_KeyUp)(uint32_t wParam, uint32_t lParam);
|
||||
void(CALL * WM_KillFocus)(uint32_t wParam, uint32_t lParam);
|
||||
void(CALL * EmulationPaused)();
|
||||
void(CALL * RumbleCommand)(int32_t Control, int32_t bRumble);
|
||||
fnGetKeys GetKeys;
|
||||
void(CALL * ReadController)(int32_t Control, uint8_t * Command);
|
||||
|
|
|
@ -304,7 +304,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
|
|||
|
||||
AddHandler(GameRunning_LoadingInProgress, new CSettingTypeTempBool(false));
|
||||
AddHandler(GameRunning_CPU_Running, new CSettingTypeTempBool(false));
|
||||
AddHandler(GameRunning_CPU_Paused, new CSettingTypeTempBool(false));
|
||||
AddHandler(GameRunning_CPU_Paused, new CSettingTypeTempBool(false, "CPU Paused"));
|
||||
AddHandler(GameRunning_CPU_PausedType, new CSettingTypeTempNumber(PauseType_None));
|
||||
AddHandler(GameRunning_InstantSaveFile, new CSettingTypeTempString(""));
|
||||
AddHandler(GameRunning_LimitFPS, new CSettingTypeTempBool(true, "Limit FPS"));
|
||||
|
|
|
@ -180,22 +180,6 @@ EXPORT void CALL RomOpen(void)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Function: EmulationPaused
|
||||
Purpose: This function is called when the emulation is paused. (from the
|
||||
emulation thread)
|
||||
Input: None
|
||||
Output: None
|
||||
*/
|
||||
|
||||
EXPORT void CALL EmulationPaused(void)
|
||||
{
|
||||
if (g_InputPlugin != nullptr)
|
||||
{
|
||||
g_InputPlugin->UnlockMouse();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Function: WM_KeyDown
|
||||
Purpose: To pass the WM_KeyDown message from the emulator to the
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <Common/StdString.h>
|
||||
#include "InputSettingsID.h"
|
||||
#include "InputSettings.h"
|
||||
#include "CProject64Input.h"
|
||||
|
||||
CInputSettings * g_Settings = nullptr;
|
||||
|
||||
|
@ -48,7 +49,8 @@ static const bool DefaultMouse_RemoveDuplicate = true;
|
|||
/* Default Shortcuts Setup */
|
||||
static char* Shortcuts_LOCKMOUSE_Default = "{6F1D2B61-D5A0-11CF-BFC7-444553540000} 0F 0 5";
|
||||
|
||||
CInputSettings::CInputSettings()
|
||||
CInputSettings::CInputSettings() :
|
||||
Set_CpuPaused(0)
|
||||
{
|
||||
RegisterSettings();
|
||||
}
|
||||
|
@ -543,6 +545,14 @@ std::string CInputSettings::GUIDtoString(const GUID & guid)
|
|||
return stdstr_f("{%08.8lX-%04.4hX-%04.4hX-%02.2X%02.2X-%02.2X%02.2X%02.2X%02.2X%02.2X%02.2X}", guid.Data1, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
|
||||
}
|
||||
|
||||
void CInputSettings::CpuPausedChanged(CInputSettings * _this)
|
||||
{
|
||||
if (GetSystemSetting(_this->Set_CpuPaused) != 0 && g_InputPlugin != nullptr)
|
||||
{
|
||||
g_InputPlugin->UnlockMouse();
|
||||
}
|
||||
}
|
||||
|
||||
void CInputSettings::RegisterSettings(void)
|
||||
{
|
||||
SetModuleName("Input");
|
||||
|
@ -651,6 +661,12 @@ void CInputSettings::RegisterSettings(void)
|
|||
RegisterSetting(Set_Control3_R_ANALOG, Data_String_General, "AnalogRight", "Controller 4", 0, "");
|
||||
|
||||
RegisterSetting(Set_Shortcut_LOCKMOUSE, Data_String_General, "LockMouse", "Shortcuts", 0, Shortcuts_LOCKMOUSE_Default);
|
||||
|
||||
Set_CpuPaused = FindSystemSettingId("CPU Paused");
|
||||
if (Set_CpuPaused != 0)
|
||||
{
|
||||
SettingsRegisterChange(true, Set_CpuPaused, this, (SettingChangedFunc)CpuPausedChanged);
|
||||
}
|
||||
}
|
||||
|
||||
void SetupInputSettings(void)
|
||||
|
|
|
@ -28,7 +28,11 @@ private:
|
|||
static std::string ButtonToStr(const BUTTON & Button);
|
||||
static std::string GUIDtoString(const GUID & guid);
|
||||
|
||||
static void CpuPausedChanged(CInputSettings * _this);
|
||||
|
||||
void RegisterSettings(void);
|
||||
|
||||
uint16_t Set_CpuPaused;
|
||||
};
|
||||
|
||||
extern CInputSettings * g_Settings;
|
||||
|
|
|
@ -126,14 +126,6 @@ data.
|
|||
*/
|
||||
EXPORT void CALL ReadController(int Control, uint8_t * Command);
|
||||
|
||||
/*
|
||||
Function: EmulationPaused
|
||||
Purpose: This function is called when the emulation is paused. (from the
|
||||
emulation thread)
|
||||
Input: None
|
||||
Output: None
|
||||
*/
|
||||
EXPORT void CALL EmulationPaused(void);
|
||||
|
||||
/*
|
||||
Function: WM_KeyDown
|
||||
|
|
Loading…
Reference in New Issue