From 73a39b012c9e3971b5db44a5470d3d6a390d297e Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Fri, 18 Sep 2009 18:45:37 +0000 Subject: [PATCH] GSopen2: Fixed a bug in gsdx where it didn't properly handle changes to the GS base register memory pointer. git-svn-id: http://pcsx2.googlecode.com/svn/branches/GSopen2@1858 96395faa-99c1-11dd-bbfe-3dabce05a288 --- common/include/PS2Edefs.h | 2 +- pcsx2/MTGS.cpp | 2 +- plugins/GSdx/GS.cpp | 79 ++++++++++++++++++++------------- plugins/GSdx/GSDevice.cpp | 4 +- plugins/GSdx/GSDevice.h | 2 +- plugins/GSdx/GSDevice10.cpp | 6 +-- plugins/GSdx/GSDevice10.h | 2 +- plugins/GSdx/GSDevice11.cpp | 6 +-- plugins/GSdx/GSDevice11.h | 2 +- plugins/GSdx/GSDevice7.cpp | 8 ++-- plugins/GSdx/GSDevice7.h | 2 +- plugins/GSdx/GSDevice9.cpp | 7 +-- plugins/GSdx/GSDevice9.h | 2 +- plugins/GSdx/GSDeviceDX.h | 4 +- plugins/GSdx/GSDeviceNull.cpp | 6 +-- plugins/GSdx/GSDeviceNull.h | 2 +- plugins/GSdx/GSDeviceOGL.cpp | 6 +-- plugins/GSdx/GSDeviceOGL.h | 2 +- plugins/GSdx/GSRenderer.cpp | 8 ++-- plugins/GSdx/GSRenderer.h | 6 +-- plugins/GSdx/GSRendererDX.h | 4 +- plugins/GSdx/GSRendererDX10.cpp | 4 +- plugins/GSdx/GSRendererDX10.h | 2 +- plugins/GSdx/GSRendererDX11.cpp | 4 +- plugins/GSdx/GSRendererDX11.h | 2 +- plugins/GSdx/GSRendererDX9.cpp | 4 +- plugins/GSdx/GSRendererDX9.h | 2 +- plugins/GSdx/GSRendererHW.h | 4 +- plugins/GSdx/GSRendererNull.h | 4 +- plugins/GSdx/GSRendererOGL.cpp | 4 +- plugins/GSdx/GSRendererOGL.h | 2 +- plugins/GSdx/GSRendererSW.cpp | 4 +- plugins/GSdx/GSRendererSW.h | 2 +- plugins/GSdx/GSState.cpp | 13 +++--- plugins/GSdx/GSState.h | 3 +- 35 files changed, 119 insertions(+), 97 deletions(-) diff --git a/common/include/PS2Edefs.h b/common/include/PS2Edefs.h index 6dc9e62059..89478d89ec 100644 --- a/common/include/PS2Edefs.h +++ b/common/include/PS2Edefs.h @@ -511,7 +511,7 @@ typedef char*(CALLBACK* _PS2EgetLibName)(void); // NOTE: GSreadFIFOX/GSwriteCSR functions CANNOT use XMM/MMX regs // If you want to use them, need to save and restore current ones typedef s32 (CALLBACK* _GSopen)(void *pDsp, char *Title, int multithread); -typedef s32 (CALLBACK* _GSopen2)( void *pDsp, u32 forceSoftware ); +typedef s32 (CALLBACK* _GSopen2)( void *pDsp, u32 flags ); typedef void (CALLBACK* _GSvsync)(int field); typedef void (CALLBACK* _GSgifTransfer1)(u32 *pMem, u32 addr); typedef void (CALLBACK* _GSgifTransfer2)(u32 *pMem, u32 size); diff --git a/pcsx2/MTGS.cpp b/pcsx2/MTGS.cpp index e91c131a59..21cacc135f 100644 --- a/pcsx2/MTGS.cpp +++ b/pcsx2/MTGS.cpp @@ -592,7 +592,7 @@ sptr mtgsThreadObject::ExecuteTask() Console::WriteLn( "\t\tForced software switch enabled." ); if( GSopen2 != NULL ) - m_returncode = GSopen2( (void*)&pDsp, !!renderswitch ); + m_returncode = GSopen2( (void*)&pDsp, 1 | (renderswitch ? 4 : 0) ); else m_returncode = GSopen( (void*)&pDsp, "PCSX2", renderswitch ? 2 : 1 ); diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp index f7c3686fc2..20cb695473 100644 --- a/plugins/GSdx/GS.cpp +++ b/plugins/GSdx/GS.cpp @@ -68,7 +68,11 @@ EXPORT_C_(uint32) PS2EgetCpuPlatform() EXPORT_C GSsetBaseMem(uint8* mem) { - s_basemem = mem - 0x12000000; + s_basemem = mem; + if( s_gs ) + { + s_gs->SetRegsMem( s_basemem ); + } } EXPORT_C_(INT32) GSinit() @@ -116,9 +120,6 @@ EXPORT_C GSclose() s_gs->ResetDevice(); - if( s_gs->m_dev ) - s_gs->m_dev->Reset(1, 1, GSDevice::Windowed); - delete s_gs->m_dev; s_gs->m_dev = NULL; @@ -131,38 +132,51 @@ static INT32 GSopen(void* dsp, char* title, int mt, int renderer) GSDevice* dev = NULL; - switch(renderer) - { - default: - case 0: case 1: case 2: dev = new GSDevice9(); break; - case 3: case 4: case 5: dev = new GSDevice10(); break; - case 6: case 7: case 8: dev = new GSDevice11(); break; -#if 0 - case 9: case 10: case 11: dev = new GSDeviceOGL(); break; -#endif - case 12: case 13: new GSDeviceNull(); break; - } - - if( !dev ) return -1; - - if( !s_gs ) + try { switch(renderer) { default: - case 0: s_gs = new GSRendererDX9(s_basemem, !!mt, s_irq); break; - case 3: s_gs = new GSRendererDX10(s_basemem, !!mt, s_irq); break; - case 6: s_gs = new GSRendererDX11(s_basemem, !!mt, s_irq); break; -#if 0 - case 9: s_gs = new GSRendererOGL(s_basemem, !!mt, s_irq); break; -#endif - case 2: case 5: case 8: case 11: case 13: - s_gs = new GSRendererNull(s_basemem, !!mt, s_irq); break; + case 0: case 1: case 2: dev = new GSDevice9(); break; + case 3: case 4: case 5: dev = new GSDevice10(); break; + case 6: case 7: case 8: dev = new GSDevice11(); break; + #if 0 + case 9: case 10: case 11: dev = new GSDeviceOGL(); break; + #endif + case 12: case 13: new GSDeviceNull(); break; + } - case 1: case 4: case 7: case 10: case 12: - s_gs = new GSRendererSW(s_basemem, !!mt, s_irq); break; + if( !dev ) return -1; + + if( !s_gs ) + { + switch(renderer) + { + default: + case 0: s_gs = new GSRendererDX9(!!mt, s_irq); break; + case 3: s_gs = new GSRendererDX10(!!mt, s_irq); break; + case 6: s_gs = new GSRendererDX11(!!mt, s_irq); break; + #if 0 + case 9: s_gs = new GSRendererOGL(!!mt, s_irq); break; + #endif + case 2: case 5: case 8: case 11: case 13: + s_gs = new GSRendererNull(!!mt, s_irq); break; + + case 1: case 4: case 7: case 10: case 12: + s_gs = new GSRendererSW(!!mt, s_irq); break; + } } } + catch( std::exception& ex ) + { + // Allowing std exceptions to escape the scope of the plugin callstack could + // be problematic, because of differing typeids between DLL and EXE compilations. + + printf( "GSdx error: Exception caught in GSopen: %s", ex.what() ); + return -1; + } + + s_gs->SetRegsMem( s_basemem ); if( *(HWND*)dsp == NULL ) { @@ -196,10 +210,13 @@ static INT32 GSopen(void* dsp, char* title, int mt, int renderer) return 0; } -EXPORT_C_(INT32) GSopen2(void* dsp, INT32 forceSoftware ) +EXPORT_C_(INT32) GSopen2( void* dsp, INT32 flags ) { + theApp.SetConfig("windowed", flags & 1); + theApp.SetConfig("vsync", flags & 2); + int renderer = theApp.GetConfig("renderer", 0); - if( forceSoftware ) + if( flags & 4 ) { renderer = 1; } diff --git a/plugins/GSdx/GSDevice.cpp b/plugins/GSdx/GSDevice.cpp index 799c07f711..e44a22da14 100644 --- a/plugins/GSdx/GSDevice.cpp +++ b/plugins/GSdx/GSDevice.cpp @@ -59,7 +59,7 @@ bool GSDevice::Create(GSWnd* wnd, bool vsync) return true; } -bool GSDevice::Reset(int w, int h, int mode) +bool GSDevice::Reset(int w, int h) { for_each(m_pool.begin(), m_pool.end(), delete_object()); @@ -91,7 +91,7 @@ void GSDevice::Present(const GSVector4i& r, int shader, bool limit) if(!m_backbuffer || m_backbuffer->GetWidth() != w || m_backbuffer->GetHeight() != h) { - if(!Reset(w, h, DontCare)) + if(!Reset(w, h)) { return; } diff --git a/plugins/GSdx/GSDevice.h b/plugins/GSdx/GSDevice.h index 8fb542ce94..197c63a6ee 100644 --- a/plugins/GSdx/GSDevice.h +++ b/plugins/GSdx/GSDevice.h @@ -81,7 +81,7 @@ public: enum {Windowed, Fullscreen, DontCare}; virtual bool Create(GSWnd* wnd, bool vsync); - virtual bool Reset(int w, int h, int mode); + virtual bool Reset(int w, int h); virtual bool IsLost(bool update = false) {return false;} virtual void Present(const GSVector4i& r, int shader, bool limit); virtual void Flip(bool limit) {} diff --git a/plugins/GSdx/GSDevice10.cpp b/plugins/GSdx/GSDevice10.cpp index 36d766c6ac..e46ead098e 100644 --- a/plugins/GSdx/GSDevice10.cpp +++ b/plugins/GSdx/GSDevice10.cpp @@ -224,7 +224,7 @@ bool GSDevice10::Create(GSWnd* wnd, bool vsync) // - Reset(1, 1, Windowed); + Reset(1, 1); // @@ -233,9 +233,9 @@ bool GSDevice10::Create(GSWnd* wnd, bool vsync) return true; } -bool GSDevice10::Reset(int w, int h, int mode) +bool GSDevice10::Reset(int w, int h) { - if(!__super::Reset(w, h, mode)) + if(!__super::Reset(w, h)) return false; if(m_swapchain) diff --git a/plugins/GSdx/GSDevice10.h b/plugins/GSdx/GSDevice10.h index b743d7ba89..9546786ce4 100644 --- a/plugins/GSdx/GSDevice10.h +++ b/plugins/GSdx/GSDevice10.h @@ -109,7 +109,7 @@ public: bool Create(GSWnd* wnd, bool vsync); bool CreateTextureFX(); - bool Reset(int w, int h, int mode); + bool Reset(int w, int h); void Flip(bool limit); void DrawPrimitive(); diff --git a/plugins/GSdx/GSDevice11.cpp b/plugins/GSdx/GSDevice11.cpp index b8da165fef..866c40c799 100644 --- a/plugins/GSdx/GSDevice11.cpp +++ b/plugins/GSdx/GSDevice11.cpp @@ -223,7 +223,7 @@ bool GSDevice11::Create(GSWnd* wnd, bool vsync) // - Reset(1, 1, Windowed); + Reset(1, 1); // @@ -231,9 +231,9 @@ bool GSDevice11::Create(GSWnd* wnd, bool vsync) return true; } -bool GSDevice11::Reset(int w, int h, int mode) +bool GSDevice11::Reset(int w, int h) { - if(!__super::Reset(w, h, mode)) + if(!__super::Reset(w, h)) return false; if(m_swapchain) diff --git a/plugins/GSdx/GSDevice11.h b/plugins/GSdx/GSDevice11.h index 4ff9cd7d7e..44459556d7 100644 --- a/plugins/GSdx/GSDevice11.h +++ b/plugins/GSdx/GSDevice11.h @@ -111,7 +111,7 @@ public: bool Create(GSWnd* wnd, bool vsync); bool CreateTextureFX(); - bool Reset(int w, int h, int mode); + bool Reset(int w, int h); void Flip(bool limit); void DrawPrimitive(); diff --git a/plugins/GSdx/GSDevice7.cpp b/plugins/GSdx/GSDevice7.cpp index 2bc18d6e96..312e48fda9 100644 --- a/plugins/GSdx/GSDevice7.cpp +++ b/plugins/GSdx/GSDevice7.cpp @@ -76,14 +76,14 @@ bool GSDevice7::Create(GSWnd* wnd, bool vsync) return false; } - Reset(1, 1, Windowed); + Reset(1, 1); return true; } -bool GSDevice7::Reset(int w, int h, int mode) +bool GSDevice7::Reset(int w, int h) { - if(!__super::Reset(w, h, mode)) + if(!__super::Reset(w, h)) return false; DDSURFACEDESC2 desc; @@ -147,7 +147,7 @@ void GSDevice7::Present(const GSVector4i& r, int shader, bool limit) if(!m_backbuffer || m_backbuffer->GetWidth() != w || m_backbuffer->GetHeight() != h) { - if(!Reset(w, h, DontCare)) + if(!Reset(w, h)) { return; } diff --git a/plugins/GSdx/GSDevice7.h b/plugins/GSdx/GSDevice7.h index eb5ed4bbfb..c395839720 100644 --- a/plugins/GSdx/GSDevice7.h +++ b/plugins/GSdx/GSDevice7.h @@ -41,7 +41,7 @@ public: virtual ~GSDevice7(); bool Create(GSWnd* wnd, bool vsync); - bool Reset(int w, int h, int mode); + bool Reset(int w, int h); bool IsLost(bool update) {return m_lost;} void Present(const GSVector4i& r, int shader, bool limit); }; diff --git a/plugins/GSdx/GSDevice9.cpp b/plugins/GSdx/GSDevice9.cpp index 22aa9885fa..6052fe129a 100644 --- a/plugins/GSdx/GSDevice9.cpp +++ b/plugins/GSdx/GSDevice9.cpp @@ -144,7 +144,7 @@ bool GSDevice9::Create(GSWnd* wnd, bool vsync) // - if(!Reset(1, 1, theApp.GetConfig("windowed", 1) ? Windowed : Fullscreen)) + if(!Reset(1, 1)) { return false; } @@ -220,13 +220,14 @@ bool GSDevice9::Create(GSWnd* wnd, bool vsync) return true; } -bool GSDevice9::Reset(int w, int h, int mode) +bool GSDevice9::Reset(int w, int h) { - if(!__super::Reset(w, h, mode)) + if(!__super::Reset(w, h)) return false; HRESULT hr; + int mode = theApp.GetConfig("windowed", 1) ? Windowed : Fullscreen; if(mode == DontCare) { mode = m_pp.Windowed ? Windowed : Fullscreen; diff --git a/plugins/GSdx/GSDevice9.h b/plugins/GSdx/GSDevice9.h index 7fb7b867df..735f914473 100644 --- a/plugins/GSdx/GSDevice9.h +++ b/plugins/GSdx/GSDevice9.h @@ -142,7 +142,7 @@ public: virtual ~GSDevice9(); bool Create(GSWnd* wnd, bool vsync); - bool Reset(int w, int h, int mode); + bool Reset(int w, int h); bool IsLost(bool update); void Flip(bool limit); diff --git a/plugins/GSdx/GSDeviceDX.h b/plugins/GSdx/GSDeviceDX.h index b6a30aac0d..269f2a106e 100644 --- a/plugins/GSdx/GSDeviceDX.h +++ b/plugins/GSdx/GSDeviceDX.h @@ -267,9 +267,9 @@ public: return __super::Create( wnd, vsync ); } - virtual bool Reset(int w, int h, int mode) + virtual bool Reset(int w, int h) { - return __super::Reset( w, h, mode ); + return __super::Reset( w, h ); } //virtual void Present(const GSVector4i& r, int shader, bool limit); diff --git a/plugins/GSdx/GSDeviceNull.cpp b/plugins/GSdx/GSDeviceNull.cpp index 9839643e29..8acda26b25 100644 --- a/plugins/GSdx/GSDeviceNull.cpp +++ b/plugins/GSdx/GSDeviceNull.cpp @@ -29,14 +29,14 @@ bool GSDeviceNull::Create(GSWnd* wnd, bool vsync) return false; } - Reset(1, 1, Windowed); + Reset(1, 1); return true; } -bool GSDeviceNull::Reset(int w, int h, int mode) +bool GSDeviceNull::Reset(int w, int h) { - if(!__super::Reset(w, h, mode)) + if(!__super::Reset(w, h)) return false; return true; diff --git a/plugins/GSdx/GSDeviceNull.h b/plugins/GSdx/GSDeviceNull.h index dbd19feb28..bfe96e77d7 100644 --- a/plugins/GSdx/GSDeviceNull.h +++ b/plugins/GSdx/GSDeviceNull.h @@ -36,5 +36,5 @@ public: GSDeviceNull() {} bool Create(GSWnd* wnd, bool vsync); - bool Reset(int w, int h, int mode); + bool Reset(int w, int h); }; diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index 147809639b..332d4d1b43 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -150,14 +150,14 @@ bool GSDeviceOGL::Create(GSWnd* wnd, bool vsync) */ GSVector4i r = wnd->GetClientRect(); - Reset(r.width(), r.height(), Windowed); + Reset(r.width(), r.height()); return true; } -bool GSDeviceOGL::Reset(int w, int h, int mode) +bool GSDeviceOGL::Reset(int w, int h) { - if(!__super::Reset(w, h, mode)) + if(!__super::Reset(w, h)) return false; glCullFace(GL_FRONT_AND_BACK); CheckError(); diff --git a/plugins/GSdx/GSDeviceOGL.h b/plugins/GSdx/GSDeviceOGL.h index eb0ecf6533..ca847428ea 100644 --- a/plugins/GSdx/GSDeviceOGL.h +++ b/plugins/GSdx/GSDeviceOGL.h @@ -110,7 +110,7 @@ public: virtual ~GSDeviceOGL(); bool Create(GSWnd* wnd, bool vsync); - bool Reset(int w, int h, int mode); + bool Reset(int w, int h); void Present(const GSVector4i& r, int shader, bool limit); void Flip(bool limit); diff --git a/plugins/GSdx/GSRenderer.cpp b/plugins/GSdx/GSRenderer.cpp index b37a1d549d..b6b6c3e53f 100644 --- a/plugins/GSdx/GSRenderer.cpp +++ b/plugins/GSdx/GSRenderer.cpp @@ -22,8 +22,8 @@ #include "StdAfx.h" #include "GSRenderer.h" -GSRenderer::GSRenderer(uint8* base, bool mt, void (*irq)()) - : GSState(base, mt, irq) +GSRenderer::GSRenderer(bool mt, void (*irq)()) + : GSState(mt, irq) , m_dev(NULL) , m_shader(0) , m_vt(this) @@ -47,10 +47,10 @@ GSRenderer::GSRenderer(uint8* base, bool mt, void (*irq)()) GSRenderer::~GSRenderer() { - if(m_dev) + /*if(m_dev) { m_dev->Reset(1, 1, GSDevice::Windowed); - } + }*/ delete m_dev; } diff --git a/plugins/GSdx/GSRenderer.h b/plugins/GSdx/GSRenderer.h index b5f33645e9..420e46c7f0 100644 --- a/plugins/GSdx/GSRenderer.h +++ b/plugins/GSdx/GSRenderer.h @@ -69,7 +69,7 @@ public: int s_saven; public: - GSRenderer(uint8* base, bool mt, void (*irq)()); + GSRenderer(bool mt, void (*irq)()); virtual ~GSRenderer(); virtual bool CreateWnd(const string& title, int w, int h); @@ -217,8 +217,8 @@ protected: virtual void Draw() = 0; public: - GSRendererT(uint8* base, bool mt, void (*irq)()) - : GSRenderer(base, mt, irq) + GSRendererT(bool mt, void (*irq)()) + : GSRenderer(mt, irq) , m_vertices(NULL) , m_count(0) , m_maxcount(0) diff --git a/plugins/GSdx/GSRendererDX.h b/plugins/GSdx/GSRendererDX.h index b8b3e2507d..ef67661cc2 100644 --- a/plugins/GSdx/GSRendererDX.h +++ b/plugins/GSdx/GSRendererDX.h @@ -40,8 +40,8 @@ protected: virtual void UpdateFBA(GSTexture* rt) {} public: - GSRendererDX(uint8* base, bool mt, void (*irq)(), GSTextureCache* tc, const GSVector2& pixelcenter = GSVector2(0, 0)) - : GSRendererHW(base, mt, irq, tc) + GSRendererDX(bool mt, void (*irq)(), GSTextureCache* tc, const GSVector2& pixelcenter = GSVector2(0, 0)) + : GSRendererHW(mt, irq, tc) , m_pixelcenter(pixelcenter) , m_topology(-1) { diff --git a/plugins/GSdx/GSRendererDX10.cpp b/plugins/GSdx/GSRendererDX10.cpp index c78aedee92..61f471d2eb 100644 --- a/plugins/GSdx/GSRendererDX10.cpp +++ b/plugins/GSdx/GSRendererDX10.cpp @@ -24,8 +24,8 @@ #include "GSCrc.h" #include "resource.h" -GSRendererDX10::GSRendererDX10(uint8* base, bool mt, void (*irq)()) - : GSRendererDX(base, mt, irq, new GSTextureCache10(this), GSVector2(-0.5f, -0.5f)) +GSRendererDX10::GSRendererDX10(bool mt, void (*irq)()) + : GSRendererDX(mt, irq, new GSTextureCache10(this), GSVector2(-0.5f, -0.5f)) { InitVertexKick(); } diff --git a/plugins/GSdx/GSRendererDX10.h b/plugins/GSdx/GSRendererDX10.h index 04f5486118..eca99b27c6 100644 --- a/plugins/GSdx/GSRendererDX10.h +++ b/plugins/GSdx/GSRendererDX10.h @@ -38,7 +38,7 @@ protected: void SetupDATE(GSTexture* rt, GSTexture* ds); public: - GSRendererDX10(uint8* base, bool mt, void (*irq)()); + GSRendererDX10(bool mt, void (*irq)()); bool CreateDevice(GSDevice* dev); diff --git a/plugins/GSdx/GSRendererDX11.cpp b/plugins/GSdx/GSRendererDX11.cpp index 9815c3aeff..53912dfce3 100644 --- a/plugins/GSdx/GSRendererDX11.cpp +++ b/plugins/GSdx/GSRendererDX11.cpp @@ -24,8 +24,8 @@ #include "GSCrc.h" #include "resource.h" -GSRendererDX11::GSRendererDX11(uint8* base, bool mt, void (*irq)()) - : GSRendererDX(base, mt, irq, new GSTextureCache11(this), GSVector2(-0.5f, -0.5f)) +GSRendererDX11::GSRendererDX11(bool mt, void (*irq)()) + : GSRendererDX(mt, irq, new GSTextureCache11(this), GSVector2(-0.5f, -0.5f)) { InitVertexKick(); } diff --git a/plugins/GSdx/GSRendererDX11.h b/plugins/GSdx/GSRendererDX11.h index 78f651d90e..a389de7012 100644 --- a/plugins/GSdx/GSRendererDX11.h +++ b/plugins/GSdx/GSRendererDX11.h @@ -39,7 +39,7 @@ protected: void SetupDATE(GSTexture* rt, GSTexture* ds); public: - GSRendererDX11(uint8* base, bool mt, void (*irq)()); + GSRendererDX11(bool mt, void (*irq)()); bool CreateDevice(GSDevice* dev); diff --git a/plugins/GSdx/GSRendererDX9.cpp b/plugins/GSdx/GSRendererDX9.cpp index eab0e10a29..9bc79a3849 100644 --- a/plugins/GSdx/GSRendererDX9.cpp +++ b/plugins/GSdx/GSRendererDX9.cpp @@ -24,8 +24,8 @@ #include "GSCrc.h" #include "resource.h" -GSRendererDX9::GSRendererDX9(uint8* base, bool mt, void (*irq)()) - : GSRendererDX(base, mt, irq, new GSTextureCache9(this)) +GSRendererDX9::GSRendererDX9(bool mt, void (*irq)()) + : GSRendererDX(mt, irq, new GSTextureCache9(this)) { InitVertexKick(); } diff --git a/plugins/GSdx/GSRendererDX9.h b/plugins/GSdx/GSRendererDX9.h index d27097e419..26884ae89d 100644 --- a/plugins/GSdx/GSRendererDX9.h +++ b/plugins/GSdx/GSRendererDX9.h @@ -45,7 +45,7 @@ protected: void UpdateFBA(GSTexture* rt); public: - GSRendererDX9(uint8* base, bool mt, void (*irq)()); + GSRendererDX9(bool mt, void (*irq)()); bool CreateDevice(GSDevice* dev); diff --git a/plugins/GSdx/GSRendererHW.h b/plugins/GSdx/GSRendererHW.h index 80079b1859..597392f858 100644 --- a/plugins/GSdx/GSRendererHW.h +++ b/plugins/GSdx/GSRendererHW.h @@ -704,8 +704,8 @@ protected: } public: - GSRendererHW(uint8* base, bool mt, void (*irq)(), GSTextureCache* tc) - : GSRendererT(base, mt, irq) + GSRendererHW(bool mt, void (*irq)(), GSTextureCache* tc) + : GSRendererT(mt, irq) , m_tc(tc) , m_width(1024) , m_height(1024) diff --git a/plugins/GSdx/GSRendererNull.h b/plugins/GSdx/GSRendererNull.h index 7cceae0562..2fbb488a12 100644 --- a/plugins/GSdx/GSRendererNull.h +++ b/plugins/GSdx/GSRendererNull.h @@ -37,8 +37,8 @@ protected: } public: - GSRendererNull(uint8* base, bool mt, void (*irq)()) - : GSRendererT(base, mt, irq) + GSRendererNull(bool mt, void (*irq)()) + : GSRendererT(mt, irq) { InitVertexKick(); } diff --git a/plugins/GSdx/GSRendererOGL.cpp b/plugins/GSdx/GSRendererOGL.cpp index 08ab965ac5..dba86b4b15 100644 --- a/plugins/GSdx/GSRendererOGL.cpp +++ b/plugins/GSdx/GSRendererOGL.cpp @@ -24,8 +24,8 @@ #include "GSCrc.h" #include "resource.h" -GSRendererOGL::GSRendererOGL(uint8* base, bool mt, void (*irq)()) - : GSRendererHW(base, mt, irq, new GSTextureCacheOGL(this)) +GSRendererOGL::GSRendererOGL(bool mt, void (*irq)()) + : GSRendererHW(mt, irq, new GSTextureCacheOGL(this)) { InitVertexKick(); } diff --git a/plugins/GSdx/GSRendererOGL.h b/plugins/GSdx/GSRendererOGL.h index 6541848ec5..a769898c44 100644 --- a/plugins/GSdx/GSRendererOGL.h +++ b/plugins/GSdx/GSRendererOGL.h @@ -31,7 +31,7 @@ protected: void Draw(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* tex); public: - GSRendererOGL(uint8* base, bool mt, void (*irq)()); + GSRendererOGL(bool mt, void (*irq)()); bool CreateDevice(GSDevice* dev); diff --git a/plugins/GSdx/GSRendererSW.cpp b/plugins/GSdx/GSRendererSW.cpp index 7eeb636b33..00171e2e33 100644 --- a/plugins/GSdx/GSRendererSW.cpp +++ b/plugins/GSdx/GSRendererSW.cpp @@ -24,8 +24,8 @@ const GSVector4 g_pos_scale(1.0f / 16, 1.0f / 16, 1.0f, 128.0f); -GSRendererSW::GSRendererSW(uint8* base, bool mt, void (*irq)()) - : GSRendererT(base, mt, irq) +GSRendererSW::GSRendererSW(bool mt, void (*irq)()) + : GSRendererT(mt, irq) { m_tc = new GSTextureCacheSW(this); diff --git a/plugins/GSdx/GSRendererSW.h b/plugins/GSdx/GSRendererSW.h index 652735efff..b14462f004 100644 --- a/plugins/GSdx/GSRendererSW.h +++ b/plugins/GSdx/GSRendererSW.h @@ -44,7 +44,7 @@ protected: void GetScanlineParam(GSScanlineParam& p, GS_PRIM_CLASS primclass); public: - GSRendererSW(uint8* base, bool mt, void (*irq)()); + GSRendererSW(bool mt, void (*irq)()); virtual ~GSRendererSW(); template diff --git a/plugins/GSdx/GSState.cpp b/plugins/GSdx/GSState.cpp index 4327a994cb..d41a92c5c2 100644 --- a/plugins/GSdx/GSState.cpp +++ b/plugins/GSdx/GSState.cpp @@ -22,7 +22,7 @@ #include "stdafx.h" #include "GSState.h" -GSState::GSState(uint8* base, bool mt, void (*irq)()) +GSState::GSState(bool mt, void (*irq)()) : m_mt(mt) , m_irq(irq) , m_crc(0) @@ -84,10 +84,6 @@ GSState::GSState(uint8* base, bool mt, void (*irq)()) m_sssize += (sizeof(m_path[0].tag) + sizeof(m_path[0].reg)) * 3; m_sssize += sizeof(m_q); - ASSERT(base); - - m_regs = (GSPrivRegSet*)(base + 0x12000000); - PRIM = &m_env.PRIM; // CSR->rREV = 0x20; m_env.PRMODECONT.AC = 1; @@ -101,6 +97,13 @@ GSState::~GSState() { } +void GSState::SetRegsMem( uint8* basemem ) +{ + ASSERT(basemem); + m_regs = (GSPrivRegSet*)basemem; +} + + void GSState::Reset() { memset(&m_path[0], 0, sizeof(m_path[0]) * 3); diff --git a/plugins/GSdx/GSState.h b/plugins/GSdx/GSState.h index 071bb5bc5c..01ca087d8e 100644 --- a/plugins/GSdx/GSState.h +++ b/plugins/GSdx/GSState.h @@ -215,7 +215,7 @@ public: GSDump m_dump; public: - GSState(uint8* base, bool mt, void (*irq)()); + GSState(bool mt, void (*irq)()); virtual ~GSState(); void ResetHandlers(); @@ -250,5 +250,6 @@ public: virtual void SetGameCRC(uint32 crc, int options); void SetFrameSkip(int skip); void SetFrameLimit(bool limit); + void SetRegsMem( uint8* basemem ); };