diff --git a/desmume/src/frontend/windows/importSave.cpp b/desmume/src/frontend/windows/importSave.cpp index 9a8d64f60..739d91473 100644 --- a/desmume/src/frontend/windows/importSave.cpp +++ b/desmume/src/frontend/windows/importSave.cpp @@ -32,6 +32,8 @@ u32 fileSaveType = 0xFF; BOOL CALLBACK ImportSizeSelect_Proc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { + BackupDeviceFileInfo fileInfo = MMU_new.backupDevice.GetFileInfo(); + switch (msg) { case WM_INITDIALOG: @@ -62,7 +64,7 @@ BOOL CALLBACK ImportSizeSelect_Proc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l EnableWindow(GetDlgItem(hDlg, IDC_IMP_AUTO_ADVANSCENE), false); { - u8 type = MMU_new.backupDevice.searchFileSaveType(MMU_new.backupDevice.info.size); + u8 type = MMU_new.backupDevice.searchFileSaveType(fileInfo.size); if (type == 0xFF) SetWindowText(GetDlgItem(hDlg, IDC_IMP_INFO_CURRENT), "NA"); else @@ -75,7 +77,7 @@ BOOL CALLBACK ImportSizeSelect_Proc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l { SendDlgItemMessage(hDlg, IDC_IMP_MANUAL_SIZE, CB_ADDSTRING, 0, (LPARAM)save_types[i].descr); } - SendDlgItemMessage(hDlg, IDC_IMP_MANUAL_SIZE, CB_SETCURSEL, MMU_new.backupDevice.info.type, 0); + SendDlgItemMessage(hDlg, IDC_IMP_MANUAL_SIZE, CB_SETCURSEL, fileInfo.type, 0); fileSaveSize = MMU_new.backupDevice.importDataSize(ImportSavFName); @@ -130,7 +132,7 @@ BOOL CALLBACK ImportSizeSelect_Proc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l u32 res = 0; if (SendDlgItemMessage(hDlg, IDC_IMP_AUTO_CURRENT, BM_GETCHECK, 0, 0) == BST_CHECKED) - res = MMU_new.backupDevice.searchFileSaveType(MMU_new.backupDevice.info.size); + res = MMU_new.backupDevice.searchFileSaveType(fileInfo.size); else if (SendDlgItemMessage(hDlg, IDC_IMP_AUTO_FILE, BM_GETCHECK, 0, 0) == BST_CHECKED) { diff --git a/desmume/src/mc.cpp b/desmume/src/mc.cpp index 8cd4d4b84..0717cbb12 100644 --- a/desmume/src/mc.cpp +++ b/desmume/src/mc.cpp @@ -1702,6 +1702,11 @@ void BackupDevice::forceManualBackupType() state = RUNNING; } +BackupDeviceFileInfo BackupDevice::GetFileInfo() +{ + return this->_info; +} + size_t BackupDevice::GetDSVFooterSize() { return (strlen(DESMUME_BACKUP_FOOTER_TXT) + sizeof(BackupDeviceFileSaveFooter)); diff --git a/desmume/src/mc.h b/desmume/src/mc.h index da38743b9..9e33b310d 100644 --- a/desmume/src/mc.h +++ b/desmume/src/mc.h @@ -149,14 +149,14 @@ public: bool load_movie(EMUFILE &is); - BackupDeviceFileInfo _info; - bool isMovieMode; u32 importDataSize(const char *filename); bool importData(const char *filename, u32 force_size = 0); bool exportData(const char *filename); + BackupDeviceFileInfo GetFileInfo(); + static size_t GetDSVFooterSize(); static bool GetDSVFileInfo(FILE *inFileDSV, BackupDeviceFileSaveFooter *outFooter, size_t *outFileSize); @@ -167,6 +167,7 @@ private: EMUFILE *fpMC; std::string _fileName; u32 fsize; + BackupDeviceFileInfo _info; int readFooter(); bool write(u8 val); u8 read();