try to fix backup memory in movie mode which was pretty much completely broken

This commit is contained in:
zeromus 2010-07-25 07:54:19 +00:00
parent 522bbb7cec
commit 5e3b0bb527
4 changed files with 24 additions and 11 deletions

View File

@ -969,8 +969,15 @@ void MMU_Reset()
//HACK!!!
//until we improve all our session tracking stuff, we need to save the backup memory filename
std::string bleh = MMU_new.backupDevice.filename;
new(&MMU_new) MMU_struct_new;
MMU_new.backupDevice.load_rom(bleh.c_str());
BackupDevice tempBackupDevice;
bool bleh2 = MMU_new.backupDevice.isMovieMode;
if(bleh2) tempBackupDevice = MMU_new.backupDevice;
reconstruct(&MMU_new);
if(bleh2) {
MMU_new.backupDevice = tempBackupDevice;
MMU_new.backupDevice.reset_hardware();
}
else MMU_new.backupDevice.load_rom(bleh.c_str());
MMU_timing.arm7codeFetch.Reset();
MMU_timing.arm7dataFetch.Reset();

View File

@ -339,18 +339,23 @@ void BackupDevice::movie_mode()
reset();
}
void BackupDevice::reset()
void BackupDevice::reset_hardware()
{
write_enable = FALSE;
com = 0;
addr = addr_counter = 0;
flushPending = false;
lazyFlushPending = false;
data.resize(0);
write_enable = FALSE;
data_autodetect.resize(0);
motionInitState = MOTION_INIT_STATE_IDLE;
motionFlag = MOTION_FLAG_NONE;
state = DETECTING;
flushPending = false;
lazyFlushPending = false;
}
void BackupDevice::reset()
{
reset_hardware();
data.resize(0);
data_autodetect.resize(0);
addr_size = 0;
loadfile();

View File

@ -82,6 +82,7 @@ public:
void reset();
void close_rom();
void reset_hardware();
bool save_state(EMUFILE* os);
bool load_state(EMUFILE* is);
@ -120,13 +121,13 @@ public:
public: //SHOULD BE PRIVATE!!!!!!!!
std::string filename;
bool isMovieMode;
private:
bool write_enable; //is write enabled?
u32 com; //persistent command actually handled
u32 addr_size, addr_counter;
u32 addr;
bool isMovieMode;
std::vector<u8> data;
std::vector<u8> data_autodetect;

View File

@ -3779,7 +3779,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
DesEnableMenuItem(mainMenu, IDM_FILE_RECORDAVI, romloaded);
DesEnableMenuItem(mainMenu, IDM_FILE_RECORDWAV, romloaded);
DesEnableMenuItem(mainMenu, IDM_EJECTCARD, romloaded && movieMode == MOVIEMODE_INACTIVE);
DesEnableMenuItem(mainMenu, IDM_RESET, romloaded && movieMode != MOVIEMODE_PLAY);
DesEnableMenuItem(mainMenu, IDM_RESET, romloaded && !(movieMode == MOVIEMODE_PLAY && movie_readonly));
DesEnableMenuItem(mainMenu, IDM_CLOSEROM, romloaded);
DesEnableMenuItem(mainMenu, IDM_SHUT_UP, romloaded);
DesEnableMenuItem(mainMenu, IDM_CHEATS_LIST, romloaded);
@ -6059,7 +6059,7 @@ static LRESULT CALLBACK SoundSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam
void ResetGame()
{
if(movieMode != MOVIEMODE_PLAY)
if(!(movieMode == MOVIEMODE_PLAY && movie_readonly))
{
NDS_Reset();
if(movieMode == MOVIEMODE_INACTIVE && !emu_paused)