Fix: a issue with loading e-Reader dot code (#608)
Fix issues with {sav,load}ing e-Reader `Dot Code`. If `Dot Code` file is not specified, it tries to continually read it and does not accept input. In Japanese (very likely other languages as well), the path of `Dot Code` file is garbled internally due to failing conversion to UTF-8.
This commit is contained in:
parent
951e8e0ebe
commit
a320377040
File diff suppressed because it is too large
Load Diff
|
@ -1712,11 +1712,31 @@ const char* GetSaveDotCodeFile()
|
||||||
return saveDotCodeFile;
|
return saveDotCodeFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ResetLoadDotCodeFile()
|
||||||
|
{
|
||||||
|
if(loadDotCodeFile)
|
||||||
|
{
|
||||||
|
free((char*)loadDotCodeFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
loadDotCodeFile = strdup("");
|
||||||
|
}
|
||||||
|
|
||||||
void SetLoadDotCodeFile(const char* szFile)
|
void SetLoadDotCodeFile(const char* szFile)
|
||||||
{
|
{
|
||||||
loadDotCodeFile = strdup(szFile);
|
loadDotCodeFile = strdup(szFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ResetSaveDotCodeFile()
|
||||||
|
{
|
||||||
|
if (saveDotCodeFile)
|
||||||
|
{
|
||||||
|
free((char*)saveDotCodeFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
saveDotCodeFile = strdup("");
|
||||||
|
}
|
||||||
|
|
||||||
void SetSaveDotCodeFile(const char* szFile)
|
void SetSaveDotCodeFile(const char* szFile)
|
||||||
{
|
{
|
||||||
saveDotCodeFile = strdup(szFile);
|
saveDotCodeFile = strdup(szFile);
|
||||||
|
|
|
@ -162,7 +162,9 @@ extern void cpuEnableProfiling(int hz);
|
||||||
|
|
||||||
const char* GetLoadDotCodeFile();
|
const char* GetLoadDotCodeFile();
|
||||||
const char* GetSaveDotCodeFile();
|
const char* GetSaveDotCodeFile();
|
||||||
|
void ResetLoadDotCodeFile();
|
||||||
void SetLoadDotCodeFile(const char* szFile);
|
void SetLoadDotCodeFile(const char* szFile);
|
||||||
|
void ResetSaveDotCodeFile();
|
||||||
void SetSaveDotCodeFile(const char* szFile);
|
void SetSaveDotCodeFile(const char* szFile);
|
||||||
|
|
||||||
// Updates romSize and realloc rom pointer if needed after soft-patching
|
// Updates romSize and realloc rom pointer if needed after soft-patching
|
||||||
|
|
|
@ -232,7 +232,7 @@ void BIOS_EReader_ScanCard(int swi_num)
|
||||||
|
|
||||||
const char* loadDotCodeFile = GetLoadDotCodeFile();
|
const char* loadDotCodeFile = GetLoadDotCodeFile();
|
||||||
|
|
||||||
if (loadDotCodeFile == 0) {
|
if (!*loadDotCodeFile) {
|
||||||
reg[0].I = 0x301;
|
reg[0].I = 0x301;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -837,11 +837,14 @@ EVT_HANDLER_MASK(RomInformation, "ROM information...", CMDEN_GB | CMDEN_GBA)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static wxString loaddotcodefile_path;
|
EVT_HANDLER_MASK(ResetLoadingDotCodeFile, "Reset Loading e-Reader Dot Code", CMDEN_GBA)
|
||||||
static wxString savedotcodefile_path;
|
|
||||||
|
|
||||||
EVT_HANDLER_MASK(LoadDotCodeFile, "Load e-Reader Dot Code...", CMDEN_GBA)
|
|
||||||
{
|
{
|
||||||
|
ResetLoadDotCodeFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
EVT_HANDLER_MASK(SetLoadingDotCodeFile, "Load e-Reader Dot Code...", CMDEN_GBA)
|
||||||
|
{
|
||||||
|
static wxString loaddotcodefile_path;
|
||||||
wxFileDialog dlg(this, _("Select Dot Code file"), loaddotcodefile_path, wxEmptyString,
|
wxFileDialog dlg(this, _("Select Dot Code file"), loaddotcodefile_path, wxEmptyString,
|
||||||
_(
|
_(
|
||||||
"e-Reader Dot Code (*.bin;*.raw)|"
|
"e-Reader Dot Code (*.bin;*.raw)|"
|
||||||
|
@ -853,11 +856,17 @@ EVT_HANDLER_MASK(LoadDotCodeFile, "Load e-Reader Dot Code...", CMDEN_GBA)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
loaddotcodefile_path = dlg.GetPath();
|
loaddotcodefile_path = dlg.GetPath();
|
||||||
SetLoadDotCodeFile(loaddotcodefile_path.mb_str(wxConvUTF8));
|
SetLoadDotCodeFile(loaddotcodefile_path.mb_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
EVT_HANDLER_MASK(SaveDotCodeFile, "Save e-Reader Dot Code...", CMDEN_GBA)
|
EVT_HANDLER_MASK(ResetSavingDotCodeFile, "Reset Saving e-Reader Dot Code", CMDEN_GBA)
|
||||||
{
|
{
|
||||||
|
ResetLoadDotCodeFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
EVT_HANDLER_MASK(SetSavingDotCodeFile, "Save e-Reader Dot Code...", CMDEN_GBA)
|
||||||
|
{
|
||||||
|
static wxString savedotcodefile_path;
|
||||||
wxFileDialog dlg(this, _("Select Dot Code file"), savedotcodefile_path, wxEmptyString,
|
wxFileDialog dlg(this, _("Select Dot Code file"), savedotcodefile_path, wxEmptyString,
|
||||||
_(
|
_(
|
||||||
"e-Reader Dot Code (*.bin;*.raw)|"
|
"e-Reader Dot Code (*.bin;*.raw)|"
|
||||||
|
@ -869,7 +878,7 @@ EVT_HANDLER_MASK(SaveDotCodeFile, "Save e-Reader Dot Code...", CMDEN_GBA)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
savedotcodefile_path = dlg.GetPath();
|
savedotcodefile_path = dlg.GetPath();
|
||||||
SetSaveDotCodeFile(savedotcodefile_path.mb_str(wxConvUTF8));
|
SetSaveDotCodeFile(savedotcodefile_path.mb_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
static wxString batimp_path;
|
static wxString batimp_path;
|
||||||
|
|
|
@ -28,10 +28,16 @@
|
||||||
<object class="separator"/>
|
<object class="separator"/>
|
||||||
<object class="wxMenu">
|
<object class="wxMenu">
|
||||||
<label>_e-Reader</label>
|
<label>_e-Reader</label>
|
||||||
<object class="wxMenuItem" name="LoadDotCodeFile">
|
<object class="wxMenuItem" name="ResetLoadingDotCodeFile">
|
||||||
|
<label>_Reset Loading Dot Code</label>
|
||||||
|
</object>
|
||||||
|
<object class="wxMenuItem" name="SetLoadingDotCodeFile">
|
||||||
<label>_Load Dot Code...</label>
|
<label>_Load Dot Code...</label>
|
||||||
</object>
|
</object>
|
||||||
<object class="wxMenuItem" name="SaveDotCodeFile">
|
<object class="wxMenuItem" name="ResetSavingDotCodeFile">
|
||||||
|
<label>_Reset Saving Dot Code</label>
|
||||||
|
</object>
|
||||||
|
<object class="wxMenuItem" name="SetSavingDotCodeFile">
|
||||||
<label>_Save Dot Code...</label>
|
<label>_Save Dot Code...</label>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
|
|
Loading…
Reference in New Issue