mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-23 06:10:03 -06:00
pass savefile name to NDS::LoadROM() instead of having the core generate it.
This commit is contained in:
@ -403,12 +403,6 @@ void DoSavestate(Savestate* file)
|
|||||||
file->Var32(&VertexNum);
|
file->Var32(&VertexNum);
|
||||||
file->Var32(&VertexNumInPoly);
|
file->Var32(&VertexNumInPoly);
|
||||||
file->Var32(&NumConsecutivePolygons);
|
file->Var32(&NumConsecutivePolygons);
|
||||||
/*Vertex TempVertexBuffer[4];
|
|
||||||
u32 VertexNum;
|
|
||||||
u32 VertexNumInPoly;
|
|
||||||
u32 NumConsecutivePolygons;
|
|
||||||
Polygon* LastStripPolygon;
|
|
||||||
u32 NumOpaquePolygons;*/
|
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
|
@ -542,9 +542,9 @@ bool DoSavestate(Savestate* file)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LoadROM(const char* path, bool direct)
|
bool LoadROM(const char* path, const char* sram, bool direct)
|
||||||
{
|
{
|
||||||
if (NDSCart::LoadROM(path, direct))
|
if (NDSCart::LoadROM(path, sram, direct))
|
||||||
{
|
{
|
||||||
Running = true;
|
Running = true;
|
||||||
return true;
|
return true;
|
||||||
|
@ -111,7 +111,7 @@ void Stop();
|
|||||||
|
|
||||||
bool DoSavestate(Savestate* file);
|
bool DoSavestate(Savestate* file);
|
||||||
|
|
||||||
bool LoadROM(const char* path, bool direct);
|
bool LoadROM(const char* path, const char* sram, bool direct);
|
||||||
void LoadBIOS();
|
void LoadBIOS();
|
||||||
void SetupDirectBoot();
|
void SetupDirectBoot();
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ void DoSavestate(Savestate* file)
|
|||||||
file->Var32(&Addr);
|
file->Var32(&Addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadSave(char* path)
|
void LoadSave(const char* path)
|
||||||
{
|
{
|
||||||
if (SRAM) delete[] SRAM;
|
if (SRAM) delete[] SRAM;
|
||||||
if (Discover_Buffer) delete[] Discover_Buffer;
|
if (Discover_Buffer) delete[] Discover_Buffer;
|
||||||
@ -1040,7 +1040,7 @@ void ApplyDLDIPatch()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LoadROM(const char* path, bool direct)
|
bool LoadROM(const char* path, const char* sram, bool direct)
|
||||||
{
|
{
|
||||||
// TODO: streaming mode? for really big ROMs or systems with limited RAM
|
// TODO: streaming mode? for really big ROMs or systems with limited RAM
|
||||||
// for now we're lazy
|
// for now we're lazy
|
||||||
@ -1121,12 +1121,8 @@ bool LoadROM(const char* path, bool direct)
|
|||||||
|
|
||||||
|
|
||||||
// save
|
// save
|
||||||
char savepath[256];
|
printf("Save file: %s\n", sram);
|
||||||
strncpy(savepath, path, 255);
|
NDSCart_SRAM::LoadSave(sram);
|
||||||
savepath[255] = '\0';
|
|
||||||
strncpy(savepath + strlen(path) - 3, "sav", 3);
|
|
||||||
printf("Save file: %s\n", savepath);
|
|
||||||
NDSCart_SRAM::LoadSave(savepath);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ void Reset();
|
|||||||
|
|
||||||
void DoSavestate(Savestate* file);
|
void DoSavestate(Savestate* file);
|
||||||
|
|
||||||
bool LoadROM(const char* path, bool direct);
|
bool LoadROM(const char* path, const char* sram, bool direct);
|
||||||
|
|
||||||
void WriteROMCnt(u32 val);
|
void WriteROMCnt(u32 val);
|
||||||
u32 ReadROMData();
|
u32 ReadROMData();
|
||||||
|
@ -73,6 +73,8 @@ volatile int EmuStatus;
|
|||||||
|
|
||||||
bool RunningSomething;
|
bool RunningSomething;
|
||||||
char ROMPath[1024];
|
char ROMPath[1024];
|
||||||
|
char SRAMPath[1024];
|
||||||
|
char PrevSRAMPath[1024]; // for savestate 'undo load'
|
||||||
|
|
||||||
bool ScreenDrawInited = false;
|
bool ScreenDrawInited = false;
|
||||||
uiDrawBitmap* ScreenBitmap = NULL;
|
uiDrawBitmap* ScreenBitmap = NULL;
|
||||||
@ -775,15 +777,26 @@ void Stop(bool internal)
|
|||||||
uiAreaQueueRedrawAll(MainDrawArea);
|
uiAreaQueueRedrawAll(MainDrawArea);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetupSRAMPath()
|
||||||
|
{
|
||||||
|
strncpy(SRAMPath, ROMPath, 1023);
|
||||||
|
SRAMPath[1023] = '\0';
|
||||||
|
strncpy(SRAMPath + strlen(ROMPath) - 3, "sav", 3);
|
||||||
|
}
|
||||||
|
|
||||||
void TryLoadROM(char* file, int prevstatus)
|
void TryLoadROM(char* file, int prevstatus)
|
||||||
{
|
{
|
||||||
char oldpath[1024];
|
char oldpath[1024];
|
||||||
|
char oldsram[1024];
|
||||||
strncpy(oldpath, ROMPath, 1024);
|
strncpy(oldpath, ROMPath, 1024);
|
||||||
|
strncpy(oldsram, SRAMPath, 1024);
|
||||||
|
|
||||||
strncpy(ROMPath, file, 1023);
|
strncpy(ROMPath, file, 1023);
|
||||||
ROMPath[1023] = '\0';
|
ROMPath[1023] = '\0';
|
||||||
|
|
||||||
if (NDS::LoadROM(ROMPath, Config::DirectBoot))
|
SetupSRAMPath();
|
||||||
|
|
||||||
|
if (NDS::LoadROM(ROMPath, SRAMPath, Config::DirectBoot))
|
||||||
Run();
|
Run();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -792,6 +805,7 @@ void TryLoadROM(char* file, int prevstatus)
|
|||||||
"Make sure the file can be accessed and isn't opened in another application.");
|
"Make sure the file can be accessed and isn't opened in another application.");
|
||||||
|
|
||||||
strncpy(ROMPath, oldpath, 1024);
|
strncpy(ROMPath, oldpath, 1024);
|
||||||
|
strncpy(SRAMPath, oldsram, 1024);
|
||||||
EmuRunning = prevstatus;
|
EmuRunning = prevstatus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -841,7 +855,7 @@ void LoadState(int slot)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char* file = uiOpenFile(MainWindow, "melonDS savestate|*.ml1;*.ml2;*.ml3;*.ml4;*.ml5;*.ml6;*.ml7;*.ml8;*.mln", NULL);
|
char* file = uiOpenFile(MainWindow, "melonDS savestate (any)|*.ml1;*.ml2;*.ml3;*.ml4;*.ml5;*.ml6;*.ml7;*.ml8;*.mln", NULL);
|
||||||
if (!file)
|
if (!file)
|
||||||
{
|
{
|
||||||
EmuRunning = prevstatus;
|
EmuRunning = prevstatus;
|
||||||
@ -889,7 +903,7 @@ void SaveState(int slot)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char* file = uiSaveFile(MainWindow, "melonDS savestate|*.ml1;*.ml2;*.ml3;*.ml4;*.ml5;*.ml6;*.ml7;*.ml8;*.mln", NULL);
|
char* file = uiSaveFile(MainWindow, "melonDS savestate (*.mln)|*.mln", NULL);
|
||||||
if (!file)
|
if (!file)
|
||||||
{
|
{
|
||||||
EmuRunning = prevstatus;
|
EmuRunning = prevstatus;
|
||||||
@ -1052,7 +1066,7 @@ void OnReset(uiMenuItem* item, uiWindow* window, void* blarg)
|
|||||||
if (ROMPath[0] == '\0')
|
if (ROMPath[0] == '\0')
|
||||||
NDS::LoadBIOS();
|
NDS::LoadBIOS();
|
||||||
else
|
else
|
||||||
NDS::LoadROM(ROMPath, Config::DirectBoot);
|
NDS::LoadROM(ROMPath, SRAMPath, Config::DirectBoot);
|
||||||
|
|
||||||
Run();
|
Run();
|
||||||
}
|
}
|
||||||
@ -1460,7 +1474,9 @@ int main(int argc, char** argv)
|
|||||||
strncpy(ROMPath, file, 1023);
|
strncpy(ROMPath, file, 1023);
|
||||||
ROMPath[1023] = '\0';
|
ROMPath[1023] = '\0';
|
||||||
|
|
||||||
if (NDS::LoadROM(ROMPath, Config::DirectBoot))
|
SetupSRAMPath();
|
||||||
|
|
||||||
|
if (NDS::LoadROM(ROMPath, SRAMPath, Config::DirectBoot))
|
||||||
Run();
|
Run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user