From 07df6a630a57412ffe2cbebb80845090ecf807b3 Mon Sep 17 00:00:00 2001 From: p989 Date: Wed, 24 Jun 2009 21:10:10 +0000 Subject: [PATCH] reset recording --- desmume/src/NDSSystem.cpp | 16 +++++-------- desmume/src/movie.cpp | 48 +++++++++++++++++++++++---------------- desmume/src/movie.h | 5 +++- 3 files changed, 38 insertions(+), 31 deletions(-) diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index ececa8b76..03314873e 100644 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -877,17 +877,10 @@ void NDS_Reset() FILE* inf = 0; NDS_header * header = NDS_getROMHeader(); - if(!_HACK_DONT_STOPMOVIE) - FCEUI_StopMovie(); - if (!header) return ; - lagframecounter=0; - LagFrameFlag=0; - lastLag=0; - TotalLagFrames=0; - - currFrameCounter=0; + if(movieMode != MOVIEMODE_INACTIVE && !_HACK_DONT_STOPMOVIE) + movie_reset_command = true; MMU_clearMem(); MMU_new.backupDevice.reset(); @@ -2502,9 +2495,10 @@ void NDS_setPadFromMovie(u16 pad) FIX(pad,2), FIX(pad,1), FIX(pad,0), - FIX(pad,13) + movie_lid ); #undef FIX + } turbo Turbo; @@ -2650,6 +2644,8 @@ void NDS_setPad(bool R,bool L,bool D,bool U,bool T,bool S,bool B,bool A,bool Y,b g = FIX(G); f = FIX(F); + if(f) movie_lid=true; + else movie_lid=false; nds.pad = (FIX(r)<<12)| diff --git a/desmume/src/movie.cpp b/desmume/src/movie.cpp index fd5c8b6f3..72f41d1d6 100644 --- a/desmume/src/movie.cpp +++ b/desmume/src/movie.cpp @@ -58,7 +58,8 @@ char curMovieFilename[512] = {0}; MovieData currMovieData; int currRerecordCount; bool ShowInputDisplay = false; - +bool movie_reset_command = false; +bool movie_lid = false; //-------------- @@ -441,16 +442,18 @@ void _CDECL_ FCEUI_LoadMovie(const char *fname, bool _read_only, bool tasedit, i //fully reload the game to reinitialize everything before playing any movie //poweron(true); - extern bool _HACK_DONT_STOPMOVIE; - _HACK_DONT_STOPMOVIE = true; NDS_Reset(); - _HACK_DONT_STOPMOVIE = false; + ////WE NEED TO LOAD A SAVESTATE //if(currMovieData.savestate.size() != 0) //{ // bool success = MovieData::loadSavestateFrom(&currMovieData.savestate); // if(!success) return; //} + lagframecounter=0; + LagFrameFlag=0; + lastLag=0; + TotalLagFrames=0; currFrameCounter = 0; pauseframe = _pauseframe; @@ -552,10 +555,7 @@ void _CDECL_ FCEUI_SaveMovie(const char *fname, std::wstring author, int flag, s currMovieData.romSerial = gameInfo.ROMserial; currMovieData.romFilename = GetRomName(); - extern bool _HACK_DONT_STOPMOVIE; - _HACK_DONT_STOPMOVIE = true; NDS_Reset(); - _HACK_DONT_STOPMOVIE = false; //todo ? //poweron(true); @@ -568,6 +568,12 @@ void _CDECL_ FCEUI_SaveMovie(const char *fname, std::wstring author, int flag, s //we are going to go ahead and dump the header. from now on we will only be appending frames currMovieData.dump(osRecordingMovie, false); + currFrameCounter=0; + lagframecounter=0; + LagFrameFlag=0; + lastLag=0; + TotalLagFrames=0; + movieMode = MOVIEMODE_RECORD; movie_readonly = false; currRerecordCount = 0; @@ -622,19 +628,13 @@ void _CDECL_ FCEUI_SaveMovie(const char *fname, std::wstring author, int flag, s { MovieRecord* mr = &currMovieData.records[currFrameCounter]; - //reset if necessary - if(mr->command_reset()) - {} - //ResetNES(); - if(mr->command_microphone()) - MicButtonPressed=1; - else - MicButtonPressed=0; + if(mr->command_microphone()) MicButtonPressed=1; + else MicButtonPressed=0; - if(mr->command_lid()) - mr->pad |= (1 << 0); - else - mr->pad |= (0 << 0); + if(mr->command_reset()) NDS_Reset(); + + if(mr->command_lid()) movie_lid = true; + else movie_lid = false; NDS_setPadFromMovie(mr->pad); NDS_setTouchFromMovie(); @@ -666,10 +666,18 @@ void _CDECL_ FCEUI_SaveMovie(const char *fname, std::wstring author, int flag, s if(MicButtonPressed == 1) mr.commands=1; + mr.pad = nds.pad; - if((nds.pad & (1<<0)) == 1) + if(movie_lid) { mr.commands=4; + movie_lid = false; + } + + if(movie_reset_command) { + mr.commands=2; + movie_reset_command = false; + } if(nds.isTouch) { mr.touch.x = nds.touchX >> 4; diff --git a/desmume/src/movie.h b/desmume/src/movie.h index cb79d6ff3..432a6226b 100644 --- a/desmume/src/movie.h +++ b/desmume/src/movie.h @@ -34,7 +34,7 @@ enum EMOVIEMODE enum EMOVIECMD { - MOVIECMD_RESET = 1, + MOVIECMD_RESET = 2, }; //RLDUTSBAYXWEG @@ -188,6 +188,9 @@ extern int currFrameCounter; extern EMOVIEMODE movieMode; //adelikat: main needs this for frame counter display extern MovieData currMovieData; //adelikat: main needs this for frame counter display +extern bool movie_reset_command; +extern bool movie_lid; + bool FCEUI_MovieGetInfo(std::istream* fp, MOVIE_INFO& info, bool skipFrameCount); void _CDECL_ FCEUI_SaveMovie(const char *fname, std::wstring author, int flag, std::string sramfname); void _CDECL_ FCEUI_LoadMovie(const char *fname, bool _read_only, bool tasedit, int _pauseframe);