Permalink
Browse files

dont lose toon table when geometry engine is powered off (fixes #179)

  • Loading branch information...
zeromus committed Aug 24, 2018
1 parent 0aa8dad commit 77e05eb1f81d45595d3d7144ff967f5c5ce74612
Showing with 6 additions and 0 deletions.
  1. +6 −0 desmume/src/MMU.cpp
View
@@ -1820,7 +1820,13 @@ static void writereg_POWCNT1(const int size, const u32 adr, const u32 val)
if(wasGeomEnabled && !isGeomEnabled)
{
//kill the geometry data when the power goes off
//but save these tables, first. they shouldnt be cleared.
//so, so bad. we need to model this with hardware-like operations instead of c++ code
GFX3D_State prior = gfx3d.state;
reconstruct(&gfx3d.state);
memcpy(gfx3d.state.u16ToonTable, prior.u16ToonTable, sizeof(prior.u16ToonTable));
//dont think we should save this one: it's sent with 3d commands, not random bonus immediate register writes like the toon table
//memcpy(gfx3d.state.shininessTable, prior.shininessTable, sizeof(prior.shininessTable));
}
}

0 comments on commit 77e05eb

Please sign in to comment.