Optionalize pause on focus lost

This commit is contained in:
nastys
2019-11-16 05:33:44 +01:00
parent feedab19c5
commit f52e702843
4 changed files with 15 additions and 1 deletions
+3
View File
@@ -21,6 +21,9 @@ xinput_preferred =0
# Rumble (Xinput)
rumble =true
# Pause when focus is lost
autopause =true
# JVS Buttons:
JVS_TEST = F1
JVS_SERVICE = F2
@@ -191,6 +191,9 @@ ConfigOptionBase* optionsArray[] = {
new NumericOption(L"frm.motion.rate", GRAPHICS_SECTION, CONFIG_FILE, L"FRM Motion Rate:", L"Sets the motion rate (fps) for the Frame Rate Manager component.\nLarger values should be smoother, but more CPU intensive and possibly buggier.", 300, 1, INT_MAX),
new OptionMetaSpacer(8),
new BooleanOption(L"autopause", KEYCONFIG_SECTION, KEYCONFIG_FILE, L"Pause automatically", L"Pause when focus is lost.", true, true),
new OptionMetaSpacer(8),
new BooleanOption(L"rumble", KEYCONFIG_SECTION, KEYCONFIG_FILE, L"XInput Rumble", L"Enables rumble during chainslides.", true, true),
new NumericOption(L"xinput_preferred", KEYCONFIG_SECTION, KEYCONFIG_FILE, L"XInput Controller Num:", L"Sets the preferred XInput controller.\nIf unavailable, the next connected controller is used.", 0, 0, 3),
new OptionMetaSpacer(8),
@@ -8,6 +8,8 @@
#include <windows.h>
#include <vector>
#include <chrono>
#include "../FileSystem/ConfigFile.h"
#include "../framework.h"
namespace TLAC::Components
{
@@ -91,6 +93,10 @@ namespace TLAC::Components
panelState = (TouchPanelState*)TASK_TOUCH_ADDRESS;
componentsManager = manager;
TLAC::FileSystem::ConfigFile config(TLAC::framework::GetModuleDirectory(), "keyconfig.ini");
config.OpenRead();
autoPause = config.GetBooleanValue("autopause");
saveOldPatchOps();
DetourTransactionBegin();
@@ -537,7 +543,7 @@ namespace TLAC::Components
void Pause::OnFocusLost()
{
if (isInGame())
if (isInGame() && autoPause)
pause = true;
}
@@ -131,5 +131,7 @@ namespace TLAC::Components
static float getMenuAnimPos();
static TLAC::Utilities::Drawing::Point getMenuItemCoords(menusets set, int pos);
bool autoPause;
};
}