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

View File

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

View File

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

View File

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

View File

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