Added a command line option to load e-Reader dotcode files

git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@1350 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
skidau 2015-04-18 15:35:46 +00:00
parent 3162b3fb25
commit 680768dee9
5 changed files with 39 additions and 26 deletions

View File

@ -61,6 +61,8 @@ enum named_opts
OPT_CAPTURE_FORMAT, OPT_CAPTURE_FORMAT,
OPT_CHEAT, OPT_CHEAT,
OPT_CPU_SAVE_TYPE, OPT_CPU_SAVE_TYPE,
OPT_DOTCODE_FILE_NAME_LOAD,
OPT_DOTCODE_FILE_NAME_SAVE,
OPT_EMULATOR_TYPE, OPT_EMULATOR_TYPE,
OPT_FS_ADAPTER, OPT_FS_ADAPTER,
OPT_FS_COLOR_DEPTH, OPT_FS_COLOR_DEPTH,
@ -124,6 +126,8 @@ char* batteryDir;
char* biosFileNameGB; char* biosFileNameGB;
char* biosFileNameGBA; char* biosFileNameGBA;
char* biosFileNameGBC; char* biosFileNameGBC;
char* loadDotCodeFile;
char* saveDotCodeFile;
char* linkHostAddr; char* linkHostAddr;
char* movieRecordDir; char* movieRecordDir;
char* rewindMemory = NULL; char* rewindMemory = NULL;
@ -282,6 +286,8 @@ struct option argOptions[] = {
{ "disable-mmx", no_argument, &disableMMX, 1 }, { "disable-mmx", no_argument, &disableMMX, 1 },
{ "disable-sfx", no_argument, &cpuDisableSfx, 1 }, { "disable-sfx", no_argument, &cpuDisableSfx, 1 },
{ "disable-status-messages", no_argument, &disableStatusMessages, 1 }, { "disable-status-messages", no_argument, &disableStatusMessages, 1 },
{ "dotcode-file-name-load", required_argument, 0, OPT_DOTCODE_FILE_NAME_LOAD },
{ "dotcode-file-name-save", required_argument, 0, OPT_DOTCODE_FILE_NAME_SAVE },
{ "emulator-type", required_argument, 0, OPT_EMULATOR_TYPE }, { "emulator-type", required_argument, 0, OPT_EMULATOR_TYPE },
{ "filter", required_argument, 0, 'f' }, { "filter", required_argument, 0, 'f' },
{ "filter-enable-multi-threading", no_argument, &filterMT, 1 }, { "filter-enable-multi-threading", no_argument, &filterMT, 1 },
@ -539,6 +545,9 @@ void LoadConfig()
biosFileNameGBA = ReadPrefString("biosFileGBA"); biosFileNameGBA = ReadPrefString("biosFileGBA");
biosFileNameGBC = ReadPrefString("biosFileGBC"); biosFileNameGBC = ReadPrefString("biosFileGBC");
loadDotCodeFile = ReadPrefString("loadDotCodeFile");
saveDotCodeFile = ReadPrefString("saveDotCodeFile");
aviRecordDir = ReadPrefString("aviRecordDir"); aviRecordDir = ReadPrefString("aviRecordDir");
movieRecordDir = ReadPrefString("movieRecordDir"); movieRecordDir = ReadPrefString("movieRecordDir");
soundRecordDir = ReadPrefString("soundRecordDir"); soundRecordDir = ReadPrefString("soundRecordDir");
@ -1264,67 +1273,67 @@ int ReadOpts(int argc, char ** argv)
case OPT_BIOS_FILE_NAME_GB: case OPT_BIOS_FILE_NAME_GB:
// --bios-file-name-gb // --bios-file-name-gb
strcpy(biosFileNameGB, optarg); biosFileNameGB = optarg;
break; break;
case OPT_BIOS_FILE_NAME_GBA: case OPT_BIOS_FILE_NAME_GBA:
// --bios-file-name-gba // --bios-file-name-gba
strcpy(biosFileNameGBA, optarg); biosFileNameGBA = optarg;
break; break;
case OPT_BIOS_FILE_NAME_GBC: case OPT_BIOS_FILE_NAME_GBC:
// --bios-file-name-gbc // --bios-file-name-gbc
strcpy(biosFileNameGBC, optarg); biosFileNameGBC = optarg;
break; break;
case OPT_AVI_RECORD_DIR: case OPT_AVI_RECORD_DIR:
// --avi-record-dir // --avi-record-dir
strcpy(aviRecordDir, optarg); aviRecordDir = optarg;
break; break;
case OPT_MOVIE_RECORD_DIR: case OPT_MOVIE_RECORD_DIR:
// --movie-record-dir // --movie-record-dir
strcpy(movieRecordDir, optarg); movieRecordDir = optarg;
break; break;
case OPT_SOUND_RECORD_DIR: case OPT_SOUND_RECORD_DIR:
// --sound-record-dir // --sound-record-dir
strcpy(soundRecordDir, optarg); soundRecordDir = optarg;
break; break;
case OPT_SCREEN_SHOT_DIR: case OPT_SCREEN_SHOT_DIR:
// --screen-shot-dir // --screen-shot-dir
strcpy(screenShotDir, optarg); screenShotDir = optarg;
break; break;
case OPT_SAVE_DIR: case OPT_SAVE_DIR:
// --save-dir // --save-dir
strcpy(saveDir, optarg); saveDir = optarg;
break; break;
case OPT_BATTERY_DIR: case OPT_BATTERY_DIR:
// --battery-dir // --battery-dir
strcpy(batteryDir, optarg); batteryDir = optarg;
break; break;
case OPT_ROM_DIR_GBC: case OPT_ROM_DIR_GBC:
// --rom-dir-gbc // --rom-dir-gbc
strcpy(romDirGBC, optarg); romDirGBC = optarg;
break; break;
case OPT_ROM_DIR_GB: case OPT_ROM_DIR_GB:
// --rom-dir-gb // --rom-dir-gb
strcpy(romDirGB, optarg); romDirGB = optarg;
break; break;
case OPT_ROM_DIR_GBA: case OPT_ROM_DIR_GBA:
// --rom-dir-gba // --rom-dir-gba
strcpy(romDirGBA, optarg); romDirGBA = optarg;
break; break;
case OPT_LINK_HOST_ADDR: case OPT_LINK_HOST_ADDR:
// --link-host-addr // --link-host-addr
strcpy(linkHostAddr, optarg); linkHostAddr = optarg;
break; break;
case OPT_CPU_SAVE_TYPE: case OPT_CPU_SAVE_TYPE:
@ -1341,6 +1350,15 @@ int ReadOpts(int argc, char ** argv)
} }
break; break;
case OPT_DOTCODE_FILE_NAME_LOAD:
// --dotcode-file-name-load
loadDotCodeFile = optarg;
break;
case OPT_DOTCODE_FILE_NAME_SAVE:
// --dotcode-file-name-save
saveDotCodeFile = optarg;
break;
} }
} }
return op; return op;

View File

@ -24,6 +24,8 @@ extern char* aviRecordDir;
extern char* biosFileNameGB; extern char* biosFileNameGB;
extern char* biosFileNameGBA; extern char* biosFileNameGBA;
extern char* biosFileNameGBC; extern char* biosFileNameGBC;
extern char* loadDotCodeFile;
extern char* saveDotCodeFile;
extern char* linkHostAddr; extern char* linkHostAddr;
extern char* movieRecordDir; extern char* movieRecordDir;
extern char* romDirGB; extern char* romDirGB;

View File

@ -166,9 +166,6 @@ u8 memoryWaitSeq32[16] =
u8 biosProtected[4]; u8 biosProtected[4];
const char *loadDotCodeFile;
const char *saveDotCodeFile;
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
bool cpuBiosSwapped = false; bool cpuBiosSwapped = false;
#endif #endif
@ -1795,12 +1792,12 @@ const char* GetSaveDotCodeFile()
void SetLoadDotCodeFile(const char *szFile) void SetLoadDotCodeFile(const char *szFile)
{ {
loadDotCodeFile = szFile; loadDotCodeFile = strdup(szFile);
} }
void SetSaveDotCodeFile(const char *szFile) void SetSaveDotCodeFile(const char *szFile)
{ {
saveDotCodeFile = szFile; saveDotCodeFile = strdup(szFile);
} }
void CPUUpdateRender() void CPUUpdateRender()

View File

@ -1116,9 +1116,7 @@ void MainWnd::OnFileLoadDotCode()
FALSE); FALSE);
if (file.DoModal() == IDOK) if (file.DoModal() == IDOK)
{ {
const char* filename = file.GetPathName(); loadDotCodeFile = strdup(file.GetPathName());
strcpy(loadDotCodeFile, filename);
SetLoadDotCodeFile(loadDotCodeFile);
} }
} }
@ -1139,9 +1137,7 @@ void MainWnd::OnFileSaveDotCode()
TRUE); TRUE);
if (file.DoModal() == IDOK) if (file.DoModal() == IDOK)
{ {
const char* filename = file.GetPathName(); saveDotCodeFile = strdup(file.GetPathName());
strcpy(saveDotCodeFile, filename);
SetLoadDotCodeFile(saveDotCodeFile);
} }
} }

View File

@ -204,7 +204,7 @@ void GameArea::LoadGame(const wxString &name)
cpuSaveType = gopts.save_type; cpuSaveType = gopts.save_type;
if (cpuSaveType == 0) if (cpuSaveType == 0)
utilGBAFindSave(size); utilGBAFindSave(rom_size);
else else
saveType = cpuSaveType; saveType = cpuSaveType;
@ -216,7 +216,7 @@ void GameArea::LoadGame(const wxString &name)
flashSetSize(0x10000 << gopts.flash_size); flashSetSize(0x10000 << gopts.flash_size);
cpuSaveType = gopts.save_type; cpuSaveType = gopts.save_type;
if (cpuSaveType == 0) if (cpuSaveType == 0)
utilGBAFindSave(size); utilGBAFindSave(rom_size);
else else
saveType = cpuSaveType; saveType = cpuSaveType;
// mirroring short ROMs is such an uncommon thing that any // mirroring short ROMs is such an uncommon thing that any