parent
c151e6983c
commit
f7e0c34ef3
|
@ -965,6 +965,9 @@ int NDS_ImportSave(const char *filename)
|
||||||
|
|
||||||
if (memcmp(filename+strlen(filename)-4, ".duc", 4) == 0)
|
if (memcmp(filename+strlen(filename)-4, ".duc", 4) == 0)
|
||||||
return MMU_new.backupDevice.load_duc(filename);
|
return MMU_new.backupDevice.load_duc(filename);
|
||||||
|
else
|
||||||
|
if (MMU_new.backupDevice.load_no_gba(filename))
|
||||||
|
return 1;
|
||||||
else
|
else
|
||||||
return MMU_new.backupDevice.load_raw(filename);
|
return MMU_new.backupDevice.load_raw(filename);
|
||||||
|
|
||||||
|
@ -976,6 +979,15 @@ bool NDS_ExportSave(const char *filename)
|
||||||
if (strlen(filename) < 4)
|
if (strlen(filename) < 4)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (memcmp(filename+strlen(filename)-5, ".sav*", 5) == 0)
|
||||||
|
{
|
||||||
|
char tmp[MAX_PATH];
|
||||||
|
memset(tmp, 0, MAX_PATH);
|
||||||
|
strcpy(tmp, filename);
|
||||||
|
tmp[strlen(tmp)-1] = 0;
|
||||||
|
return MMU_new.backupDevice.save_no_gba(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
if (memcmp(filename+strlen(filename)-4, ".sav", 4) == 0)
|
if (memcmp(filename+strlen(filename)-4, ".sav", 4) == 0)
|
||||||
return MMU_new.backupDevice.save_raw(filename);
|
return MMU_new.backupDevice.save_raw(filename);
|
||||||
|
|
||||||
|
@ -2425,7 +2437,7 @@ void NDS_Reset()
|
||||||
for (int t = 0; t < 4096; t++)
|
for (int t = 0; t < 4096; t++)
|
||||||
MMU.ARM9_BIOS[t] = 0xFF;
|
MMU.ARM9_BIOS[t] = 0xFF;
|
||||||
|
|
||||||
_MMU_write32<ARMCPU_ARM9>(0xFFFF0018, 0xEA000027);
|
_MMU_write32<ARMCPU_ARM9>(0xFFFF0018, 0xEA000095);
|
||||||
|
|
||||||
for (int t = 0; t < 156; t++) // load logo
|
for (int t = 0; t < 156; t++) // load logo
|
||||||
MMU.ARM9_BIOS[t + 0x20] = logo_data[t];
|
MMU.ARM9_BIOS[t + 0x20] = logo_data[t];
|
||||||
|
|
|
@ -724,6 +724,26 @@ bool BackupDevice::load_no_gba(const char *fname)
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BackupDevice::save_no_gba(const char* fname)
|
||||||
|
{
|
||||||
|
FILE* outf = fopen(fname,"wb");
|
||||||
|
if(!outf) return false;
|
||||||
|
u32 size = data.size();
|
||||||
|
u32 padSize = pad_up_size(size);
|
||||||
|
if(data.size()>0)
|
||||||
|
fwrite(&data[0],1,size,outf);
|
||||||
|
for(u32 i=size;i<padSize;i++)
|
||||||
|
fputc(0xFF,outf);
|
||||||
|
|
||||||
|
if (padSize < 512 * 1024)
|
||||||
|
{
|
||||||
|
for(u32 i=padSize; i<512 * 1024; i++)
|
||||||
|
fputc(0xFF,outf);
|
||||||
|
}
|
||||||
|
fclose(outf);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
//======================================================================= end
|
//======================================================================= end
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//======================================================================= no$GBA
|
//======================================================================= no$GBA
|
||||||
|
|
|
@ -101,6 +101,7 @@ public:
|
||||||
|
|
||||||
bool load_duc(const char* filename);
|
bool load_duc(const char* filename);
|
||||||
bool load_no_gba(const char *fname);
|
bool load_no_gba(const char *fname);
|
||||||
|
bool save_no_gba(const char* fname);
|
||||||
bool load_raw(const char* filename);
|
bool load_raw(const char* filename);
|
||||||
bool save_raw(const char* filename);
|
bool save_raw(const char* filename);
|
||||||
bool load_movie(EMUFILE* is);
|
bool load_movie(EMUFILE* is);
|
||||||
|
|
|
@ -3780,7 +3780,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
ZeroMemory(&ofn, sizeof(ofn));
|
ZeroMemory(&ofn, sizeof(ofn));
|
||||||
ofn.lStructSize = sizeof(ofn);
|
ofn.lStructSize = sizeof(ofn);
|
||||||
ofn.hwndOwner = hwnd;
|
ofn.hwndOwner = hwnd;
|
||||||
ofn.lpstrFilter = "All supported types\0*.duc;*.sav\0Action Replay DS Save (*.duc)\0*.duc\0Raw Save format (*.sav)\0*.sav\0\0";
|
ofn.lpstrFilter = "All supported types\0*.duc;*.sav\0Action Replay DS Save (*.duc)\0*.duc\0Raw/No$GBA Save format (*.sav)\0*.sav\0\0";
|
||||||
ofn.nFilterIndex = 1;
|
ofn.nFilterIndex = 1;
|
||||||
ofn.lpstrFile = ImportSavName;
|
ofn.lpstrFile = ImportSavName;
|
||||||
ofn.nMaxFile = MAX_PATH;
|
ofn.nMaxFile = MAX_PATH;
|
||||||
|
@ -3810,12 +3810,12 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
ZeroMemory(&ofn, sizeof(ofn));
|
ZeroMemory(&ofn, sizeof(ofn));
|
||||||
ofn.lStructSize = sizeof(ofn);
|
ofn.lStructSize = sizeof(ofn);
|
||||||
ofn.hwndOwner = hwnd;
|
ofn.hwndOwner = hwnd;
|
||||||
ofn.lpstrFilter = "Raw Save format (*.sav)\0*.sav\0\0";
|
ofn.lpstrFilter = "Raw Save format (*.sav)\0*.sav\0No$GBA Save format (*.sav)\0*.sav\0\0";
|
||||||
ofn.nFilterIndex = 0;
|
ofn.nFilterIndex = 0;
|
||||||
ofn.lpstrFile = ImportSavName;
|
ofn.lpstrFile = ImportSavName;
|
||||||
ofn.nMaxFile = MAX_PATH;
|
ofn.nMaxFile = MAX_PATH;
|
||||||
ofn.lpstrDefExt = "sav";
|
ofn.lpstrDefExt = "sav";
|
||||||
ofn.Flags = OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST;
|
ofn.Flags = OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT;
|
||||||
|
|
||||||
if(!GetSaveFileName(&ofn))
|
if(!GetSaveFileName(&ofn))
|
||||||
{
|
{
|
||||||
|
@ -3823,6 +3823,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ofn.nFilterIndex == 2) strcat(ImportSavName, "*");
|
||||||
|
|
||||||
if (!NDS_ExportSave(ImportSavName))
|
if (!NDS_ExportSave(ImportSavName))
|
||||||
MessageBox(hwnd,"Save was not successfully exported","Error",MB_OK);
|
MessageBox(hwnd,"Save was not successfully exported","Error",MB_OK);
|
||||||
NDS_UnPause();
|
NDS_UnPause();
|
||||||
|
|
Loading…
Reference in New Issue