sync with FCEUX

This commit is contained in:
dborth 2009-12-23 00:15:33 +00:00
parent a2ca3ac04a
commit 4b26e157e6
4 changed files with 77 additions and 7 deletions

View File

@ -975,8 +975,10 @@ static void ToggleFullscreen(void)
UpdateCheckedMenuItems(); UpdateCheckedMenuItems();
changerecursive=1; changerecursive=1;
if(!SetVideoMode(fullscreen^1))
SetVideoMode(fullscreen); int oldmode = fullscreen;
if(!SetVideoMode(oldmode ^1))
SetVideoMode(oldmode);
changerecursive=0; changerecursive=0;
#endif #endif
} }

View File

@ -403,6 +403,10 @@ void MovieData::installValue(std::string& key, std::string& val)
StringToBytes(val,&savestate[0],len); // decodes either base64 or hex StringToBytes(val,&savestate[0],len); // decodes either base64 or hex
} }
} }
else if (key == "length")
{
installInt(val, loadFrameCount);
}
#endif #endif
} }
@ -427,12 +431,16 @@ int MovieData::dump(std::ostream *os, bool binary)
for(uint32 i=0;i<subtitles.size();i++) for(uint32 i=0;i<subtitles.size();i++)
*os << "subtitle " << subtitles[i] << endl; *os << "subtitle " << subtitles[i] << endl;
if(binary) if(binary)
*os << "binary 1" << endl; *os << "binary 1" << endl;
if(savestate.size() != 0) if(savestate.size() != 0)
*os << "savestate " << BytesToString(&savestate[0],savestate.size()) << endl; *os << "savestate " << BytesToString(&savestate[0],savestate.size()) << endl;
if(FCEUMOV_Mode(MOVIEMODE_TASEDIT))
*os << "length " << this->records.size() << endl;
if(binary) if(binary)
{ {
//put one | to start the binary dump //put one | to start the binary dump
@ -451,6 +459,54 @@ int MovieData::dump(std::ostream *os, bool binary)
#endif #endif
} }
int MovieData::dumpGreenzone(std::ostream *os, bool binary)
{
#ifdef GEKKO
return 0;
#endif
int start = os->tellp();
int frame, size;
for (int i=0; i<(int)records.size(); ++i)
{
if (records[i].savestate.empty())
continue;
frame=i;
size=records[i].savestate.size();
write32le(frame, os);
write32le(size, os);
os->write(&records[i].savestate[0], size);
}
frame=-1;
size=currMovieData.greenZoneCount;
write32le(frame, os);
write32le(size, os);
int end= os->tellp();
return end-start;
}
int MovieData::loadGreenzone(std::istream *is, bool binary)
{
#ifdef GEKKO
return 0;
#endif
int frame, size;
while(1)
{
if (!read32le((uint32 *)&frame, is)) {size=0; break;}
if (!read32le((uint32 *)&size, is)) {size=0; break;}
if (frame==-1) break;
int pos = is->tellg();
FCEUSS_LoadFP(is, SSLOADPARAM_NOBACKUP);
is->seekg(pos+size);
}
greenZoneCount=size;
return 1;
}
int FCEUMOV_GetFrame(void) int FCEUMOV_GetFrame(void)
{ {
return currFrameCounter; return currFrameCounter;
@ -524,6 +580,9 @@ static void LoadFM2_binarychunk(MovieData& movieData, std::istream* fp, int size
int todo = std::min(size, flen); int todo = std::min(size, flen);
int numRecords = todo/recordsize; int numRecords = todo/recordsize;
if (movieData.loadFrameCount!=-1 && movieData.loadFrameCount<numRecords)
numRecords=movieData.loadFrameCount;
movieData.records.resize(numRecords); movieData.records.resize(numRecords);
for(int i=0;i<numRecords;i++) for(int i=0;i<numRecords;i++)
{ {
@ -536,6 +595,10 @@ static void LoadFM2_binarychunk(MovieData& movieData, std::istream* fp, int size
bool LoadFM2(MovieData& movieData, std::istream* fp, int size, bool stopAfterHeader) bool LoadFM2(MovieData& movieData, std::istream* fp, int size, bool stopAfterHeader)
{ {
#ifndef GEKKO #ifndef GEKKO
std::string a("length"), b("-1");
// Non-TAS projects consume until EOF
movieData.installValue(a, b);
//first, look for an fcm signature //first, look for an fcm signature
char fcmbuf[3]; char fcmbuf[3];
std::ios::pos_type curr = fp->tellg(); std::ios::pos_type curr = fp->tellg();

View File

@ -186,6 +186,7 @@ public:
//----TasEdit stuff--- //----TasEdit stuff---
int greenZoneCount; int greenZoneCount;
int loadFrameCount;
//---- //----
int getNumRecords() { return records.size(); } int getNumRecords() { return records.size(); }
@ -221,6 +222,9 @@ public:
void truncateAt(int frame); void truncateAt(int frame);
void installValue(std::string& key, std::string& val); void installValue(std::string& key, std::string& val);
int dump(std::ostream* os, bool binary); int dump(std::ostream* os, bool binary);
int dumpGreenzone(std::ostream *os, bool binary);
int loadGreenzone(std::istream *is, bool binary);
void clearRecordRange(int start, int len); void clearRecordRange(int start, int len);
void insertEmpty(int at, int frames); void insertEmpty(int at, int frames);

View File

@ -2338,9 +2338,10 @@ int FCEUX_PPU_Loop(int skip) {
if(yp >= spr[0] && yp < spr[0]+spriteHeight) { if(yp >= spr[0] && yp < spr[0]+spriteHeight) {
//if we already have maxsprites, then this new one causes an overflow, //if we already have maxsprites, then this new one causes an overflow,
//set the flag and bail out. //set the flag and bail out.
if(oamcount == maxsprites) { if(oamcount >= 8 && PPUON) {
PPU_status |= 0x20; PPU_status |= 0x20;
break; if (maxsprites == 8)
break;
} }
//just copy some bytes into the internal sprite buffer //just copy some bytes into the internal sprite buffer