GTK: expose parsed filenames to main program

A lot of file names were stored in private char * pointers in the
CommandLine class when the main application was looking at public
std::string members. Remove the private mempers and store all file names
in the public std::string members.
This commit is contained in:
Ingo Saitz 2021-01-04 13:22:16 +01:00
parent 581155aa30
commit 99126b9063
2 changed files with 13 additions and 19 deletions

View File

@ -39,11 +39,12 @@ int _commandline_linux_nojoy = 0;
CommandLine::CommandLine() CommandLine::CommandLine()
: is_cflash_configured(false) : is_cflash_configured(false)
, _load_to_memory(-1) , _load_to_memory(-1)
, _play_movie_file(0) , nds_file("")
, _record_movie_file(0) , play_movie_file("")
, _cflash_image(0) , record_movie_file("")
, _cflash_path(0) , cflash_image("")
, _gbaslot_rom(0) , cflash_path("")
, gbaslot_rom("")
, _bios_arm9(NULL) , _bios_arm9(NULL)
, _bios_arm7(NULL) , _bios_arm7(NULL)
, _bios_swi(0) , _bios_swi(0)
@ -58,15 +59,15 @@ CommandLine::CommandLine()
, _gamehacks(-1) , _gamehacks(-1)
, _texture_deposterize(-1) , _texture_deposterize(-1)
, _texture_smooth(-1) , _texture_smooth(-1)
, _slot1(NULL) , slot1("")
, _slot1_fat_dir(NULL) , slot1_fat_dir("")
, _slot1_fat_dir_type(false) , _slot1_fat_dir_type(false)
, _slot1_no8000prot(0) , _slot1_no8000prot(0)
#ifdef HAVE_JIT #ifdef HAVE_JIT
, _cpu_mode(-1) , _cpu_mode(-1)
, _jit_size(-1) , _jit_size(-1)
#endif #endif
, _console_type(NULL) , console_type("")
, _advanscene_import(NULL) , _advanscene_import(NULL)
, load_slot(-1) , load_slot(-1)
, arm9_gdb_port(0) , arm9_gdb_port(0)
@ -358,8 +359,8 @@ bool CommandLine::parse(int argc,char **argv)
//slot-2 contents //slot-2 contents
case OPT_SLOT2_CFLASH_IMAGE: cflash_image = optarg; break; case OPT_SLOT2_CFLASH_IMAGE: cflash_image = optarg; break;
case OPT_SLOT2_CFLASH_DIR: _cflash_path = optarg; break; case OPT_SLOT2_CFLASH_DIR: cflash_path = optarg; break;
case OPT_SLOT2_GBAGAME: _gbaslot_rom = optarg; break; case OPT_SLOT2_GBAGAME: gbaslot_rom = optarg; break;
//commands //commands
case OPT_LOAD_SLOT: load_slot = atoi(optarg); break; case OPT_LOAD_SLOT: load_slot = atoi(optarg); break;
@ -518,8 +519,9 @@ bool CommandLine::validate()
printerror("If either firmware boot is used, firmware path must be specified.\n"); printerror("If either firmware boot is used, firmware path must be specified.\n");
} }
if((_cflash_image && _gbaslot_rom) || (_cflash_path && _gbaslot_rom)) { if((cflash_image != "" && gbaslot_rom != "") || (cflash_path != "" && gbaslot_rom != "")) {
printerror("Cannot specify both cflash and gbaslot rom (both occupy SLOT-2)\n"); printerror("Cannot specify both cflash and gbaslot rom (both occupy SLOT-2)\n");
return false;
} }
if (autodetect_method < -1 || autodetect_method > 1) { if (autodetect_method < -1 || autodetect_method > 1) {

View File

@ -86,11 +86,6 @@ public:
int _spu_sync_mode; int _spu_sync_mode;
int _spu_sync_method; int _spu_sync_method;
private: private:
char* _play_movie_file;
char* _record_movie_file;
char* _cflash_image;
char* _cflash_path;
char* _gbaslot_rom;
char* _bios_arm9, *_bios_arm7; char* _bios_arm9, *_bios_arm7;
char* _fw_path; char* _fw_path;
int _fw_boot; int _fw_boot;
@ -107,9 +102,6 @@ private:
int _cpu_mode; int _cpu_mode;
int _jit_size; int _jit_size;
#endif #endif
char* _slot1;
char *_slot1_fat_dir;
char* _console_type;
char* _advanscene_import; char* _advanscene_import;
int _rtc_day; int _rtc_day;
int _rtc_hour; int _rtc_hour;