Run the custom start scripts to after the other optimisations

This ensures the other featues are applied first, and the scripts can react if needed to those settings
This commit is contained in:
Marc Di Luzio 2019-02-21 18:28:54 +00:00
parent 9df1dd857c
commit 024acddf90

View File

@ -170,21 +170,6 @@ static void game_mode_context_enter(GameModeContext *self)
LOG_MSG("Entering Game Mode...\n"); LOG_MSG("Entering Game Mode...\n");
sd_notifyf(0, "STATUS=%sGameMode is now active.%s\n", "\x1B[1;32m", "\x1B[0m"); sd_notifyf(0, "STATUS=%sGameMode is now active.%s\n", "\x1B[1;32m", "\x1B[0m");
char scripts[CONFIG_LIST_MAX][CONFIG_VALUE_MAX];
memset(scripts, 0, sizeof(scripts));
config_get_gamemode_start_scripts(self->config, scripts);
unsigned int i = 0;
while (*scripts[i] != '\0' && i < CONFIG_LIST_MAX) {
LOG_MSG("Executing script [%s]\n", scripts[i]);
int err;
if ((err = system(scripts[i])) != 0) {
/* Log the failure, but this is not fatal */
LOG_ERROR("Script [%s] failed with error %d\n", scripts[i], err);
}
i++;
}
/* Read the initial governor state so we can revert it correctly */ /* Read the initial governor state so we can revert it correctly */
const char *initial_state = get_gov_state(); const char *initial_state = get_gov_state();
if (initial_state) { if (initial_state) {
@ -217,6 +202,23 @@ static void game_mode_context_enter(GameModeContext *self)
/* Apply GPU optimisations */ /* Apply GPU optimisations */
game_mode_apply_gpu(self->gpu_info, true); game_mode_apply_gpu(self->gpu_info, true);
/* Run custom scripts last - ensures the above are applied first and these scripts can react to
* them if needed */
char scripts[CONFIG_LIST_MAX][CONFIG_VALUE_MAX];
memset(scripts, 0, sizeof(scripts));
config_get_gamemode_start_scripts(self->config, scripts);
unsigned int i = 0;
while (*scripts[i] != '\0' && i < CONFIG_LIST_MAX) {
LOG_MSG("Executing script [%s]\n", scripts[i]);
int err;
if ((err = system(scripts[i])) != 0) {
/* Log the failure, but this is not fatal */
LOG_ERROR("Script [%s] failed with error %d\n", scripts[i], err);
}
i++;
}
} }
/** /**