From 316597f18ebb4758df25c8de2810d6d130ad00be Mon Sep 17 00:00:00 2001 From: neonloop Date: Sat, 14 Aug 2021 22:39:49 +0000 Subject: Adds auto-frameskip to pcsx_rearmed --- config.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'config.c') diff --git a/config.c b/config.c index e124c81..c33d5cc 100644 --- a/config.c +++ b/config.c @@ -75,24 +75,26 @@ static void parse_num_val(uint32_t *cval, const char *src) *cval = val; } -static char *config_find_value(const char* cfg, const char *key) { - char *tmp; +static const char *config_find_value(const char* cfg, const char *key) { + const char *tmp = cfg; + + while ((tmp = strstr(tmp, key))) { + tmp += strlen(key); + if (strncmp(tmp, " = ", 3) == 0) + break; + }; - tmp = strstr(cfg, key); if (tmp == NULL) return NULL; - tmp += strlen(key); - if (strncmp(tmp, " = ", 3) != 0) - return NULL; - tmp += 3; + tmp += 3; return tmp; } void config_read(const char* cfg) { for (size_t i = 0; i < array_size(config_data); i++) { - char *tmp = config_find_value(cfg, config_data[i].name); + const char *tmp = config_find_value(cfg, config_data[i].name); if (!tmp) continue; @@ -110,7 +112,7 @@ void config_read(const char* cfg) if (entry->blocked) continue; - char *tmp = config_find_value(cfg, entry->key); + const char *tmp = config_find_value(cfg, entry->key); if (!tmp) continue; -- cgit v1.2.3