Commit ae67bfc2 authored by Ignacio Sanchez Gines's avatar Ignacio Sanchez Gines
Browse files

Add portable mode

parent 07b447cd
Pipeline #9867 failed with stages
in 3 minutes and 33 seconds
......@@ -45,6 +45,7 @@ Please, consider [sponsoring]( and followin
- Game Genie and Pro Action Replay cheat support.
- Supported platforms: Windows, Linux, macOS, Raspberry Pi, iOS and RetroArch (libretro).
- Full debugger with disassembler, breakpoints, debug symbols, memory editor, IO inspector and VRAM viewer including tiles, sprites, backgrounds and palettes.
- Portable mode by creating a file named `portable.ini` in the same directory as the application binary.
<img src="" width="687" height="494">
......@@ -25,6 +25,7 @@
#include "config.h"
static bool check_portable(void);
static int read_int(const char* group, const char* key, int default_value);
static void write_int(const char* group, const char* key, int integer);
static float read_float(const char* group, const char* key, float default_value);
......@@ -36,8 +37,11 @@ static void write_string(const char* group, const char* key, std::string value);
void config_init(void)
config_root_path = SDL_GetPrefPath("Geardome", GEARSYSTEM_TITLE);
if (check_portable())
config_root_path = SDL_GetBasePath();
config_root_path = SDL_GetPrefPath("Geardome", GEARSYSTEM_TITLE);
strcpy(config_emu_file_path, config_root_path);
strcat(config_emu_file_path, "config.ini");
......@@ -251,6 +255,27 @@ void config_write(void)
static bool check_portable(void)
char* base_path;
char portable_file_path[260];
base_path = SDL_GetBasePath();
strcpy(portable_file_path, base_path);
strcat(portable_file_path, "portable.ini");
FILE* file = fopen(portable_file_path, "r");
if (IsValidPointer(file))
return true;
return false;
static int read_int(const char* group, const char* key, int default_value)
int ret = 0;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment