static bool s_slot2_loadstate(EMUFILE* is, int size) { u32 version = is->read32le(); //version 0: if(version >= 0) { slot2Type = NDS_SLOT2_AUTO; u8 slotID = is->read32le(); if (version == 0) slot2_getTypeByID(slotID, slot2Type); slot2_Change(slot2Type); EMUFILE_MEMORY temp; is->readMemoryStream(&temp); temp.fseek(0,SEEK_SET); slot2_Loadstate(&temp); } return true; }
bool slot2_ChangeByID(u8 ID) { NDS_SLOT2_TYPE type = NDS_SLOT2_AUTO; slot2_getTypeByID(ID, type); return slot2_Change(type); }
void GBAslotDialog(HWND hwnd) { temp_type = (u8)slot2_GetCurrentType(); last_type = temp_type; strcpy(tmp_cflash_filename, win32_CFlash_cfgFileName.c_str()); strcpy(tmp_cflash_path, win32_CFlash_cfgDirectory.c_str()); strcpy(tmp_gbagame_filename, win32_GBA_cfgRomPath.c_str()); memcpy(&tmp_Guitar, &Guitar, sizeof(Guitar)); memcpy(&tmp_Piano, &Piano, sizeof(Piano)); memcpy(&tmp_Paddle, &Paddle, sizeof(Paddle)); tmp_CFlashMode = CFlash_Mode; _OKbutton = false; u32 res=DialogBoxW(hAppInst, MAKEINTRESOURCEW(IDD_GBASLOT), hwnd, (DLGPROC) GbaSlotBox_Proc); if (res) { switch (temp_type) { case NDS_SLOT2_NONE: break; case NDS_SLOT2_AUTO: break; case NDS_SLOT2_CFLASH: //save current values for win32 configuration win32_CFlash_cfgMode = tmp_CFlashMode; win32_CFlash_cfgDirectory = tmp_cflash_path; win32_CFlash_cfgFileName = tmp_cflash_filename; WritePrivateProfileInt("Slot2.CFlash","fileMode",tmp_CFlashMode,IniName); WritePrivateProfileString("Slot2.CFlash","path",tmp_cflash_path,IniName); WritePrivateProfileString("Slot2.CFlash","filename",tmp_cflash_filename,IniName); WIN_InstallCFlash(); break; case NDS_SLOT2_RUMBLEPAK: break; case NDS_SLOT2_PADDLE: memcpy(&Paddle, &tmp_Paddle, sizeof(tmp_Paddle)); WritePrivateProfileInt("Slot2.Paddle","DEC",Paddle.DEC,IniName); WritePrivateProfileInt("Slot2.Paddle","INC",Paddle.INC,IniName); break; case NDS_SLOT2_GBACART: win32_GBA_cfgRomPath = tmp_gbagame_filename; WritePrivateProfileString("Slot2.GBAgame", "filename", tmp_gbagame_filename, IniName); WIN_InstallGBACartridge(); break; case NDS_SLOT2_GUITARGRIP: memcpy(&Guitar, &tmp_Guitar, sizeof(tmp_Guitar)); WritePrivateProfileInt("Slot2.GuitarGrip","green",Guitar.GREEN,IniName); WritePrivateProfileInt("Slot2.GuitarGrip","red",Guitar.RED,IniName); WritePrivateProfileInt("Slot2.GuitarGrip","yellow",Guitar.YELLOW,IniName); WritePrivateProfileInt("Slot2.GuitarGrip","blue",Guitar.BLUE,IniName); break; case NDS_SLOT2_EASYPIANO: memcpy(&Piano, &tmp_Piano, sizeof(tmp_Piano)); WritePrivateProfileInt("Slot2.Piano","C",Piano.C,IniName); WritePrivateProfileInt("Slot2.Piano","CS",Piano.CS,IniName); WritePrivateProfileInt("Slot2.Piano","D",Piano.D,IniName); WritePrivateProfileInt("Slot2.Piano","DS",Piano.DS,IniName); WritePrivateProfileInt("Slot2.Piano","E",Piano.E,IniName); WritePrivateProfileInt("Slot2.Piano","F",Piano.F,IniName); WritePrivateProfileInt("Slot2.Piano","FS",Piano.FS,IniName); WritePrivateProfileInt("Slot2.Piano","G",Piano.G,IniName); WritePrivateProfileInt("Slot2.Piano","GS",Piano.GS,IniName); WritePrivateProfileInt("Slot2.Piano","A",Piano.A,IniName); WritePrivateProfileInt("Slot2.Piano","AS",Piano.AS,IniName); WritePrivateProfileInt("Slot2.Piano","B",Piano.B,IniName); WritePrivateProfileInt("Slot2.Piano","HIC",Piano.HIC,IniName); break; case NDS_SLOT2_EXPMEMORY: break; case NDS_SLOT2_PASSME: break; default: return; } slot2_Change((NDS_SLOT2_TYPE)temp_type); WritePrivateProfileInt("Slot2", "id", slot2_List[(u8)slot2_GetCurrentType()]->info()->id(), IniName); Guitar.Enabled = (slot2_GetCurrentType() == NDS_SLOT2_GUITARGRIP)?true:false; Piano.Enabled = (slot2_GetCurrentType() == NDS_SLOT2_EASYPIANO)?true:false; Paddle.Enabled = (slot2_GetCurrentType() == NDS_SLOT2_PADDLE)?true:false; } }