Changed Gamemode setting to be dynamic, added callbacks for Gamemode in system.h. Need to implement fully

This commit is contained in:
adas20 2025-06-24 12:35:33 -04:00
parent 29e7f59eaa
commit 3488a31210
6 changed files with 21 additions and 11 deletions

View file

@ -112,6 +112,8 @@ struct EmuCallbacks
std::function<void(bool)> enable_display_sleep; std::function<void(bool)> enable_display_sleep;
std::function<void()> check_microphone_permissions; std::function<void()> check_microphone_permissions;
std::function<std::unique_ptr<class video_source>()> make_video_source; std::function<std::unique_ptr<class video_source>()> make_video_source;
std::function<bool()> gamemode_supported;
std::function<void(bool)> enable_gamemode;
}; };
namespace utils namespace utils

View file

@ -358,7 +358,7 @@ struct cfg_root : cfg::node
cfg::_bool silence_all_logs{ this, "Silence All Logs", false, true }; cfg::_bool silence_all_logs{ this, "Silence All Logs", false, true };
cfg::string title_format{ this, "Window Title Format", "FPS: %F | %R | %V | %T [%t]", true }; cfg::string title_format{ this, "Window Title Format", "FPS: %F | %R | %V | %T [%t]", true };
cfg::_bool pause_during_home_menu{this, "Pause Emulation During Home Menu", false, false }; cfg::_bool pause_during_home_menu{this, "Pause Emulation During Home Menu", false, false };
cfg::_bool enable_gamemode{ this, "Enable GameMode", false, false }; cfg::_bool enable_gamemode{ this, "Enable GameMode", false, true };
} misc{ this }; } misc{ this };

View file

@ -17,18 +17,23 @@ bool gamemode_supported()
#endif #endif
} }
// Enables GameMode // TODO: Might add later
// Returns -2 if Gamemode isn't supported. /*
// Returns the value of gamemode_request_start() otherwise. static int gamemode_status() {
// This is either 0 or -1 depending on whether gamemode was successfully enabled or not respectively. return gamemode_query_status();
int enable_gamemode(bool enabled) { }
*/
// Enables and Disables GameMode based on user settings and system
void enable_gamemode(bool enabled) {
if (!gamemode_supported()) { if (!gamemode_supported()) {
return -2; return;
} }
// Enable Gamemode // Enable and Disable Gamemode
if (enabled) { if (enabled) {
u8 s_gamemode_start = gamemode_request_start(); gamemode_request_start();
return s_gamemode_start; } else {
gamemode_request_end();
} }
} }

View file

@ -1,4 +1,5 @@
#pragma once #pragma once
bool gamemode_supported(); bool gamemode_supported();
int enable_gamemode(bool enabled); void enable_gamemode(bool enabled);
//static int gamemode_status(); // Might add later TODO

View file

@ -1,6 +1,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "main_application.h" #include "main_application.h"
#include "display_sleep_control.h" #include "display_sleep_control.h"
#include "gamemode_control.h"
#include "util/types.hpp" #include "util/types.hpp"
#include "util/logs.hpp" #include "util/logs.hpp"

View file

@ -15,6 +15,7 @@
#include "qt_music_handler.h" #include "qt_music_handler.h"
#include "rpcs3_version.h" #include "rpcs3_version.h"
#include "display_sleep_control.h" #include "display_sleep_control.h"
#include "gamemode_control.h"
#ifdef WITH_DISCORD_RPC #ifdef WITH_DISCORD_RPC
#include "_discord_utils.h" #include "_discord_utils.h"