From 1415fb402cd4b8e39f55c3e714fed8bf68bb9a6e Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 15 May 2010 04:08:16 +0000 Subject: [PATCH] Revert some changes to MovieRecord class. savestate vector is de-pointered & public again as well. --- src/drivers/win/tasedit.cpp | 19 +++++++++---------- src/movie.cpp | 22 +++++++--------------- src/movie.h | 13 +++---------- 3 files changed, 19 insertions(+), 35 deletions(-) diff --git a/src/drivers/win/tasedit.cpp b/src/drivers/win/tasedit.cpp index ef986b06..3dc1bfe3 100644 --- a/src/drivers/win/tasedit.cpp +++ b/src/drivers/win/tasedit.cpp @@ -105,11 +105,11 @@ static LONG CustomDraw(NMLVCUSTOMDRAW* msg) SelectObject(msg->nmcd.hdc,debugSystem->hFixedFont); if((msg->iSubItem-2)/8==0) if((int)msg->nmcd.dwItemSpec < currMovieData.greenZoneCount && - !currMovieData.records[msg->nmcd.dwItemSpec].GetSavestate().empty()) + !currMovieData.records[msg->nmcd.dwItemSpec].savestate.empty()) msg->clrTextBk = RGB(192,255,192); else {} else if((int)msg->nmcd.dwItemSpec < currMovieData.greenZoneCount && - !currMovieData.records[msg->nmcd.dwItemSpec].GetSavestate().empty()) + !currMovieData.records[msg->nmcd.dwItemSpec].savestate.empty()) msg->clrTextBk = RGB(144,192,144); else msg->clrTextBk = RGB(192,192,192); return CDRF_DODEFAULT; @@ -233,7 +233,7 @@ void LockGreenZone(int newstart) { for (int i=1; i(index)0; --i) { - if (!currMovieData.records[i].GetSavestate().empty() && - MovieData::loadSavestateFrom(&currMovieData.records[i].GetSavestate())) + if (!currMovieData.records[i].savestate.empty() && + MovieData::loadSavestateFrom(&currMovieData.records[i].savestate)) { currFrameCounter=i; turbo=i+6060; pauseframe=index+1; } @@ -310,7 +309,7 @@ bool JumpToFrame(int index) { poweron(false); currFrameCounter=0; - MovieData::dumpSavestateTo(&currMovieData.records[0].GetSavestate(),0); + MovieData::dumpSavestateTo(&currMovieData.records[0].savestate,0); return true; } diff --git a/src/movie.cpp b/src/movie.cpp index fec21269..fd561ed4 100644 --- a/src/movie.cpp +++ b/src/movie.cpp @@ -131,7 +131,7 @@ void MovieData::TryDumpIncremental() { if (turbo && pauseframe-256>currFrameCounter && ((currFrameCounter-pauseframe)&0xff)) return; - MovieData::dumpSavestateTo(&currMovieData.records[currFrameCounter].GetSavestate(),Z_DEFAULT_COMPRESSION); + MovieData::dumpSavestateTo(&currMovieData.records[currFrameCounter].savestate,Z_DEFAULT_COMPRESSION); } if(currFrameCounter == currMovieData.greenZoneCount) { @@ -140,15 +140,15 @@ void MovieData::TryDumpIncremental() currMovieData.insertEmpty(-1,1); } - MovieData::dumpSavestateTo(&currMovieData.records[currFrameCounter].GetSavestate(),Z_DEFAULT_COMPRESSION); + MovieData::dumpSavestateTo(&currMovieData.records[currFrameCounter].savestate,Z_DEFAULT_COMPRESSION); currMovieData.greenZoneCount++; } else if (currFrameCounter < currMovieData.greenZoneCount || !movie_readonly) { - MovieData::dumpSavestateTo(&currMovieData.records[currFrameCounter].GetSavestate(),Z_DEFAULT_COMPRESSION); + MovieData::dumpSavestateTo(&currMovieData.records[currFrameCounter].savestate,Z_DEFAULT_COMPRESSION); } else if (currFrameCounter > currMovieData.greenZoneCount && static_cast(currMovieData.greenZoneCount)write(&records[i].GetSavestate()[0], size); + os->write(&records[i].savestate[0], size); } frame=-1; size=currMovieData.greenZoneCount; diff --git a/src/movie.h b/src/movie.h index ecad6c05..4097133f 100644 --- a/src/movie.h +++ b/src/movie.h @@ -97,7 +97,6 @@ class MovieRecord public: MovieRecord(); - ~MovieRecord(); ValueArray joysticks; struct { @@ -143,6 +142,9 @@ public: bool Compare(MovieRecord& compareRec); void clear(); + //a waste of memory in lots of cases.. maybe make it a pointer later? + std::vector savestate; + void parse(MovieData* md, std::istream* is); bool parseBinary(MovieData* md, std::istream* is); void dump(MovieData* md, std::ostream* os, int index); @@ -152,16 +154,7 @@ public: static const char mnemonics[8]; - std::vector& GetSavestate() - { - if (savestate == NULL) - savestate = new std::vector; - return *savestate; - } private: - //a waste of memory in lots of cases.. maybe make it a pointer later? - std::vector *savestate; - int mask(int bit) { return 1<