even more improvements to savetate compatibility

This commit is contained in:
zeromus 2009-05-02 08:02:52 +00:00
parent 6b0d234643
commit 4702c15820
3 changed files with 25 additions and 17 deletions

View File

@ -3228,7 +3228,7 @@ void GPU_ligne(NDS_Screen * screen, u16 l)
void gpu_savestate(std::ostream* os)
{
//version
write32le(0,os);
write32le(1,os);
os->write((char*)GPU_screen,sizeof(GPU_screen));
@ -3246,21 +3246,31 @@ bool gpu_loadstate(std::istream* is, int size)
{
//read version
int version;
if(read32le(&version,is) != 1) return false;
if(version != 0) return false;
//sigh.. shouldve used a new version number
if(size == 256*192*2*2)
version = 0;
else
if(read32le(&version,is) != 1) return false;
if(version<0||version>1) return false;
is->read((char*)GPU_screen,sizeof(GPU_screen));
read32le(&MainScreen.gpu->affineInfo[0].x,is);
read32le(&MainScreen.gpu->affineInfo[0].y,is);
read32le(&MainScreen.gpu->affineInfo[1].x,is);
read32le(&MainScreen.gpu->affineInfo[1].y,is);
read32le(&SubScreen.gpu->affineInfo[0].x,is);
read32le(&SubScreen.gpu->affineInfo[0].y,is);
read32le(&SubScreen.gpu->affineInfo[1].x,is);
read32le(&SubScreen.gpu->affineInfo[1].y,is);
MainScreen.gpu->refreshAffineStartRegs();
SubScreen.gpu->refreshAffineStartRegs();
if(version==1)
{
read32le(&MainScreen.gpu->affineInfo[0].x,is);
read32le(&MainScreen.gpu->affineInfo[0].y,is);
read32le(&MainScreen.gpu->affineInfo[1].x,is);
read32le(&MainScreen.gpu->affineInfo[1].y,is);
read32le(&SubScreen.gpu->affineInfo[0].x,is);
read32le(&SubScreen.gpu->affineInfo[0].y,is);
read32le(&SubScreen.gpu->affineInfo[1].x,is);
read32le(&SubScreen.gpu->affineInfo[1].y,is);
MainScreen.gpu->refreshAffineStartRegs();
SubScreen.gpu->refreshAffineStartRegs();
}
MainScreen.gpu->updateBLDALPHA();
SubScreen.gpu->updateBLDALPHA();
return !is->fail();

View File

@ -63,7 +63,6 @@ template<typename T> T _min(T a, T b, T c, T d) { return min(_min(a,b,d),c); }
template<typename T> T _max(T a, T b, T c, T d) { return max(_max(a,b,d),c); }
static int polynum;
static bool validFramebuffer = false;
static u8 modulate_table[32][32];
static u8 decal_table[32][32][32];
@ -1282,8 +1281,6 @@ static void SoftRastRender()
shape_engine(type,!polyAttr.backfacing);
}
validFramebuffer = false;
// printf("rendered %d of %d polys after backface culling\n",gfx3d.polylist->count-culled,gfx3d.polylist->count);
SoftRastConvertFramebuffer();
}

View File

@ -275,7 +275,8 @@ static bool mmu_loadstate(std::istream* is, int size)
//it would silently fail if there was a size mismatch
SAV_silent_fail_flag = true;
if(read32le(&bupmem_size,is) != 1) return false;
if(bupmem_size != MMU.bupmem.size) return false; //mismatch between current initialized and saved size
//if(bupmem_size != MMU.bupmem.size) return false; //mismatch between current initialized and saved size
mc_realloc(&MMU.bupmem,MC_TYPE_AUTODETECT,bupmem_size);
}
else
{