Revert some changes to MovieRecord class. savestate vector is de-pointered & public again as well.
This commit is contained in:
parent
2cd959fd84
commit
1415fb402c
|
@ -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<newstart; ++i)
|
||||
{
|
||||
currMovieData.records[i].GetSavestate().clear();
|
||||
currMovieData.records[i].savestate.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -268,9 +268,8 @@ bool JumpToFrame(int index)
|
|||
}
|
||||
|
||||
if (static_cast<unsigned int>(index)<currMovieData.records.size() &&
|
||||
!currMovieData.records[index].GetSavestate().empty() &&
|
||||
MovieData::loadSavestateFrom(&currMovieData.records[index].GetSavestate()))
|
||||
//MovieData::loadSavestateFrom(&currMovieData.records[index].savestate))
|
||||
!currMovieData.records[index].savestate.empty() &&
|
||||
MovieData::loadSavestateFrom(&currMovieData.records[index].savestate))
|
||||
{
|
||||
currFrameCounter = index;
|
||||
return true;
|
||||
|
@ -288,8 +287,8 @@ bool JumpToFrame(int index)
|
|||
/* Search for an earlier frame, and try warping to the current. */
|
||||
for (; i>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+60<index; // turbo unless close
|
||||
|
@ -300,7 +299,7 @@ bool JumpToFrame(int index)
|
|||
|
||||
poweron(true);
|
||||
currFrameCounter=0;
|
||||
MovieData::dumpSavestateTo(&currMovieData.records[0].GetSavestate(),0);
|
||||
MovieData::dumpSavestateTo(&currMovieData.records[0].savestate,0);
|
||||
turbo = index>60;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<unsigned int>(currMovieData.greenZoneCount)<currMovieData.records.size())
|
||||
{
|
||||
/* May be required in some malformed TAS projects. */
|
||||
MovieData::dumpSavestateTo(&currMovieData.records[currFrameCounter].GetSavestate(),Z_DEFAULT_COMPRESSION);
|
||||
MovieData::dumpSavestateTo(&currMovieData.records[currFrameCounter].savestate,Z_DEFAULT_COMPRESSION);
|
||||
currMovieData.greenZoneCount= currFrameCounter+1;
|
||||
}
|
||||
}
|
||||
|
@ -174,14 +174,6 @@ MovieRecord::MovieRecord()
|
|||
zappers[1].x = 0;
|
||||
zappers[1].y = 0;
|
||||
zappers[1].zaphit = 0;
|
||||
|
||||
savestate = NULL;
|
||||
}
|
||||
|
||||
MovieRecord::~MovieRecord()
|
||||
{
|
||||
if (savestate != NULL)
|
||||
delete savestate;
|
||||
}
|
||||
|
||||
void MovieRecord::clear()
|
||||
|
@ -529,14 +521,14 @@ int MovieData::dumpGreenzone(std::ostream *os, bool binary)
|
|||
int frame, size;
|
||||
for (int i=0; i<(int)records.size(); ++i)
|
||||
{
|
||||
if (records[i].GetSavestate().empty())
|
||||
if (records[i].savestate.empty())
|
||||
continue;
|
||||
frame=i;
|
||||
size=records[i].GetSavestate().size();
|
||||
size=records[i].savestate.size();
|
||||
write32le(frame, os);
|
||||
write32le(size, os);
|
||||
|
||||
os->write(&records[i].GetSavestate()[0], size);
|
||||
os->write(&records[i].savestate[0], size);
|
||||
}
|
||||
frame=-1;
|
||||
size=currMovieData.greenZoneCount;
|
||||
|
|
13
src/movie.h
13
src/movie.h
|
@ -97,7 +97,6 @@ class MovieRecord
|
|||
|
||||
public:
|
||||
MovieRecord();
|
||||
~MovieRecord();
|
||||
ValueArray<uint8,4> 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<char> 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<char>& GetSavestate()
|
||||
{
|
||||
if (savestate == NULL)
|
||||
savestate = new std::vector<char>;
|
||||
return *savestate;
|
||||
}
|
||||
private:
|
||||
//a waste of memory in lots of cases.. maybe make it a pointer later?
|
||||
std::vector<char> *savestate;
|
||||
|
||||
int mask(int bit) { return 1<<bit; }
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue