This commit is contained in:
zilmar 2016-11-22 05:16:28 +11:00
commit de7bfcac28
2 changed files with 28 additions and 23 deletions

View File

@ -1518,11 +1518,6 @@ bool CN64System::SaveState()
SaveFile.DirectoryCreate();
}
//delete any old save
ExtraInfo.Delete();
SaveFile.Delete();
ZipFile.Delete();
//Open the file
if (g_Settings->LoadDword(Game_FuncLookupMode) == FuncFind_ChangeMemory)
{
@ -1538,6 +1533,7 @@ bool CN64System::SaveState()
uint32_t NextViTimer = m_SystemTimer.GetTimer(CSystemTimer::ViTimer);
if (g_Settings->LoadDword(Setting_AutoZipInstantSave))
{
ZipFile.Delete();
zipFile file = zipOpen(ZipFile, 0);
zipOpenNewFileInZip(file, SaveFile.GetNameExtension().c_str(), NULL, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION);
zipWriteInFileInZip(file, &SaveID_0, sizeof(SaveID_0));
@ -1579,6 +1575,8 @@ bool CN64System::SaveState()
}
else
{
ExtraInfo.Delete();
SaveFile.Delete();
CFile hSaveFile(SaveFile, CFileBase::modeWrite | CFileBase::modeCreate);
if (!hSaveFile.IsOpen())
{
@ -1627,7 +1625,10 @@ bool CN64System::SaveState()
m_Reg.MI_INTR_REG = MiInterReg;
g_Settings->SaveString(GameRunning_InstantSaveFile, "");
g_Settings->SaveDword(Game_LastSaveTime, (uint32_t)time(NULL));
if (g_Settings->LoadDword(Setting_AutoZipInstantSave))
{
SaveFile=ZipFile;
}
g_Notify->DisplayMessage(5, stdstr_f("%s %s", g_Lang->GetString(MSG_SAVED_STATE).c_str(), stdstr(SaveFile.GetNameExtension()).c_str()).c_str());
WriteTrace(TraceN64System, TraceDebug, "Done");
return true;
@ -1662,6 +1663,10 @@ bool CN64System::LoadState()
CPath ZipFileName;
ZipFileName = (const std::string &)FileName + ".zip";
if (g_Settings->LoadDword(Setting_AutoZipInstantSave))
{
FileName=ZipFileName;
}
if ((g_Settings->LoadDword(Setting_AutoZipInstantSave) && ZipFileName.Exists()) || FileName.Exists())
{
if (LoadState(FileName))
@ -1845,7 +1850,7 @@ bool CN64System::LoadState(const char * FileName)
CPath ExtraInfo(SaveFile);
ExtraInfo.SetExtension(".dat");
CFile hExtraInfo(ExtraInfo, CFileBase::modeWrite | CFileBase::modeCreate);
CFile hExtraInfo(ExtraInfo, CFileBase::modeRead);
if (hExtraInfo.IsOpen())
{
m_SystemTimer.LoadData(hExtraInfo);
@ -2183,4 +2188,4 @@ void CN64System::TLB_Changed()
{
g_Debugger->TLBChanged();
}
}
}

View File

@ -836,38 +836,38 @@ BEGIN
LTEXT "XInput Controller (X360 Controllers) configuration",IDC_XINPUT_TITLE,7,7,160,8
CTEXT "N64",IDC_STATIC,56,27,39,8
CTEXT "A",IDC_STATIC,14,41,36,12,SS_CENTERIMAGE,WS_EX_CLIENTEDGE
COMBOBOX IDC_XC_A,56,41,39,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_XC_A,56,41,39,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CTEXT "B",IDC_STATIC,14,59,36,12,SS_CENTERIMAGE,WS_EX_CLIENTEDGE
COMBOBOX IDC_XC_B,56,59,39,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_XC_B,56,59,39,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CTEXT "X",IDC_STATIC,14,77,36,11,SS_CENTERIMAGE,WS_EX_CLIENTEDGE
COMBOBOX IDC_XC_X,56,77,39,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_XC_X,56,77,39,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CTEXT "Y",IDC_STATIC,14,95,36,12,SS_CENTERIMAGE,WS_EX_CLIENTEDGE
COMBOBOX IDC_XC_Y,56,95,39,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_XC_Y,56,95,39,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CTEXT "Back",IDC_STATIC,14,112,36,12,SS_CENTERIMAGE,WS_EX_CLIENTEDGE
COMBOBOX IDC_XC_BACK,56,112,39,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_XC_BACK,56,112,39,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CTEXT "Start",IDC_STATIC,14,130,36,12,SS_CENTERIMAGE,WS_EX_CLIENTEDGE
COMBOBOX IDC_XC_START,56,130,39,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_XC_START,56,130,39,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CTEXT "LB",IDC_STATIC,101,41,36,12,SS_CENTERIMAGE,WS_EX_CLIENTEDGE
COMBOBOX IDC_XC_LB,143,41,39,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_XC_LB,143,41,39,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CTEXT "RB",IDC_STATIC,101,59,36,12,SS_CENTERIMAGE,WS_EX_CLIENTEDGE
COMBOBOX IDC_XC_RB,143,59,39,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_XC_RB,143,59,39,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CTEXT "XControl",IDC_STATIC,101,27,36,8
CTEXT "N64",IDC_STATIC,143,27,39,8
CTEXT "LThSB",IDC_STATIC,101,76,36,12,SS_CENTERIMAGE,WS_EX_CLIENTEDGE
COMBOBOX IDC_XC_LTSB,143,77,39,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_XC_LTSB,143,77,39,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CTEXT "RThSB",IDC_STATIC,101,94,36,12,SS_CENTERIMAGE,WS_EX_CLIENTEDGE
COMBOBOX IDC_XC_RTSB,143,95,39,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_XC_RTSB,143,95,39,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CTEXT "LT",IDC_STATIC,101,112,36,12,SS_CENTERIMAGE,WS_EX_CLIENTEDGE
COMBOBOX IDC_XC_LT,143,112,39,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_XC_LT,143,112,39,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CTEXT "RT",IDC_STATIC,101,130,36,12,SS_CENTERIMAGE,WS_EX_CLIENTEDGE
COMBOBOX IDC_XC_RT,143,130,39,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_XC_RT,143,130,39,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
GROUPBOX "D-Pad and Thumbsticks configuration",IDC_STATIC,188,27,175,115
CTEXT "Left Thumbstick",IDC_STATIC,194,65,62,12,SS_CENTERIMAGE,WS_EX_CLIENTEDGE
CTEXT "Right Thumbstick",IDC_STATIC,194,89,62,12,SS_CENTERIMAGE,WS_EX_CLIENTEDGE
CTEXT "D-Pad",IDC_STATIC,194,112,62,12,SS_CENTERIMAGE,WS_EX_CLIENTEDGE
COMBOBOX IDC_XC_LTS,262,65,94,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_XC_RTS,262,88,94,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_XC_DPAD,262,112,94,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_XC_LTS,262,65,94,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_XC_RTS,262,88,94,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_XC_DPAD,262,112,94,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CTEXT "XControl",IDC_STATIC,194,45,62,8
CTEXT "N64",IDC_STATIC,262,45,94,8
LTEXT "NOTE: LThSB and RThSB stands for Left/Right Thumbstick button respectively.",IDC_STATIC,14,155,349,18