From 7b4b78b215ca1bfcb4d04793e4bf26cc8fbb6dbf Mon Sep 17 00:00:00 2001 From: zeromus Date: Tue, 29 Jun 2010 21:47:30 +0000 Subject: [PATCH] win32: fix huge executable size. now maybe certain people will pay attention to less useless things --- desmume/src/driver.cpp | 20 ++++++++++---------- desmume/src/gfx3d.cpp | 14 ++++++++------ desmume/src/gfx3d.h | 2 +- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/desmume/src/driver.cpp b/desmume/src/driver.cpp index 03ef27e32..f39772bd4 100644 --- a/desmume/src/driver.cpp +++ b/desmume/src/driver.cpp @@ -55,14 +55,14 @@ public: void NewFrame() { - listPolys->SetItemCount(viewer3d_state.polylist.count); - labelFrameCounter->SetLabel(wxString::Format(wxT("Frame: %d"),viewer3d_state.frameNumber)); - labelUserPolycount->SetLabel(wxString::Format(wxT("User Polys: %d"),viewer3d_state.polylist.count)); - labelFinalPolycount->SetLabel(wxString::Format(wxT("Final Polys: %d"),viewer3d_state.polylist.count)); + listPolys->SetItemCount(viewer3d_state->polylist.count); + labelFrameCounter->SetLabel(wxString::Format(wxT("Frame: %d"),viewer3d_state->frameNumber)); + labelUserPolycount->SetLabel(wxString::Format(wxT("User Polys: %d"),viewer3d_state->polylist.count)); + labelFinalPolycount->SetLabel(wxString::Format(wxT("Final Polys: %d"),viewer3d_state->polylist.count)); //tree->DeleteAllItems(); //tree->Freeze(); //wxTreeItemId root = tree->AddRoot(""); - //for(int i=0;ipolylist.count;i++) //{ // tree->AppendItem(root,"hai kirin"); //} @@ -84,9 +84,9 @@ public: { //------------ //do the 3d work.. - engine.polylist = &viewer3d_state.polylist; - engine.vertlist = &viewer3d_state.vertlist; - engine.indexlist = &viewer3d_state.indexlist; + engine.polylist = &viewer3d_state->polylist; + engine.vertlist = &viewer3d_state->vertlist; + engine.indexlist = &viewer3d_state->indexlist; engine.screen = _screen; engine.screenColor = _screenColor; engine.width = kViewportWidth; @@ -137,9 +137,9 @@ public: int selection = GetSelectedListviewItem(listPolys); if(selection < 0) return; - if(selection>=viewer3d_state.polylist.count) return; + if(selection>=viewer3d_state->polylist.count) return; - POLY& poly = viewer3d_state.polylist.list[selection]; + POLY& poly = viewer3d_state->polylist.list[selection]; TexCacheItem* texkey = TexCache_SetTexture(TexFormat_32bpp,poly.texParam,poly.texPalette); const u32 w = texkey->sizeX; diff --git a/desmume/src/gfx3d.cpp b/desmume/src/gfx3d.cpp index e85254ad0..06dd8c3eb 100644 --- a/desmume/src/gfx3d.cpp +++ b/desmume/src/gfx3d.cpp @@ -267,7 +267,7 @@ using std::max; using std::min; GFX3D gfx3d; -Viewer3d_State viewer3d_state; +Viewer3d_State* viewer3d_state = NULL; static GFX3D_Clipper boxtestClipper; //tables that are provided to anyone @@ -509,6 +509,8 @@ void gfx3d_reset() { //if this doesn't work on the xbox, we need to find out why. reconstruct(&gfx3d); + delete viewer3d_state; + viewer3d_state = new Viewer3d_State(); gxf_hardware.reset(); @@ -2090,11 +2092,11 @@ static void gfx3d_doFlush() if(driver->view3d->IsRunning()) { - viewer3d_state.frameNumber = currFrameCounter; - viewer3d_state.state = gfx3d.state; - viewer3d_state.polylist = *gfx3d.polylist; - viewer3d_state.vertlist = *gfx3d.vertlist; - viewer3d_state.indexlist = gfx3d.indexlist; + viewer3d_state->frameNumber = currFrameCounter; + viewer3d_state->state = gfx3d.state; + viewer3d_state->polylist = *gfx3d.polylist; + viewer3d_state->vertlist = *gfx3d.vertlist; + viewer3d_state->indexlist = gfx3d.indexlist; driver->view3d->NewFrame(); } diff --git a/desmume/src/gfx3d.h b/desmume/src/gfx3d.h index 8b7c65c9f..52768d038 100644 --- a/desmume/src/gfx3d.h +++ b/desmume/src/gfx3d.h @@ -362,7 +362,7 @@ struct Viewer3d_State INDEXLIST indexlist; }; -extern Viewer3d_State viewer3d_state; +extern Viewer3d_State* viewer3d_state; struct GFX3D {