mirror of https://github.com/PCSX2/pcsx2.git
GSopen2: Current status...
* Software mode seems to work fine. Suspend and resume emulation work nicely, without flaws. * Hardware DX9 mode suspends but displays only black after resuming. * Hardware DX10 status is unknown. git-svn-id: http://pcsx2.googlecode.com/svn/branches/GSopen2@1842 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
e6149c7c13
commit
8de579954f
|
@ -78,17 +78,24 @@ EXPORT_C_(INT32) GSinit()
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WINDOWS
|
||||||
|
|
||||||
|
s_hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
||||||
|
|
||||||
|
if(!GSUtil::CheckDirectX())
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C GSshutdown()
|
EXPORT_C GSshutdown()
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
EXPORT_C GSclose()
|
|
||||||
{
|
{
|
||||||
delete s_gs;
|
delete s_gs;
|
||||||
|
|
||||||
s_gs = NULL;
|
s_gs = NULL;
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
|
@ -103,61 +110,103 @@ EXPORT_C GSclose()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EXPORT_C GSclose()
|
||||||
|
{
|
||||||
|
if( !s_gs ) return;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
s_gs->m_wnd.Detach();
|
||||||
|
}
|
||||||
|
|
||||||
static INT32 GSopen(void* dsp, char* title, int mt, int renderer)
|
static INT32 GSopen(void* dsp, char* title, int mt, int renderer)
|
||||||
{
|
{
|
||||||
GSclose();
|
GSclose();
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
GSDevice* dev = NULL;
|
||||||
|
|
||||||
s_hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
|
||||||
|
|
||||||
if(!GSUtil::CheckDirectX())
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch(renderer)
|
switch(renderer)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case 0: s_gs = new GSRendererDX9(s_basemem, !!mt, s_irq); break;
|
case 0: case 1: case 2: dev = new GSDevice9(); break;
|
||||||
case 1: s_gs = new GSRendererSW(s_basemem, !!mt, s_irq, new GSDevice9()); break;
|
case 3: case 4: case 5: dev = new GSDevice10(); break;
|
||||||
case 2: s_gs = new GSRendererNull(s_basemem, !!mt, s_irq, new GSDevice9()); break;
|
case 6: case 7: case 8: dev = new GSDevice11(); break;
|
||||||
case 3: s_gs = new GSRendererDX10(s_basemem, !!mt, s_irq); break;
|
#if 0
|
||||||
case 4: s_gs = new GSRendererSW(s_basemem, !!mt, s_irq, new GSDevice10()); break;
|
case 9: case 10: case 11: dev = new GSDeviceOGL(); break;
|
||||||
case 5: s_gs = new GSRendererNull(s_basemem, !!mt, s_irq, new GSDevice10()); break;
|
#endif
|
||||||
case 6: s_gs = new GSRendererDX11(s_basemem, !!mt, s_irq); break;
|
case 12: case 13: new GSDeviceNull(); break;
|
||||||
case 7: s_gs = new GSRendererSW(s_basemem, !!mt, s_irq, new GSDevice11()); break;
|
|
||||||
case 8: s_gs = new GSRendererNull(s_basemem, !!mt, s_irq, new GSDevice11()); break;
|
|
||||||
#if 0
|
|
||||||
case 9: s_gs = new GSRendererOGL(s_basemem, !!mt, s_irq); break;
|
|
||||||
case 10: s_gs = new GSRendererSW(s_basemem, !!mt, s_irq, new GSDeviceOGL()); break;
|
|
||||||
case 11: s_gs = new GSRendererNull(s_basemem, !!mt, s_irq, new GSDeviceOGL()); break;
|
|
||||||
#endif
|
|
||||||
case 12: s_gs = new GSRendererSW(s_basemem, !!mt, s_irq, new GSDeviceNull()); break;
|
|
||||||
case 13: s_gs = new GSRendererNull(s_basemem, !!mt, s_irq, new GSDeviceNull()); break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int w = theApp.GetConfig("ModeWidth", 0);
|
if( !dev ) return -1;
|
||||||
int h = theApp.GetConfig("ModeHeight", 0);
|
|
||||||
|
|
||||||
if(!s_gs->Create(title, w, h))
|
if( !s_gs )
|
||||||
|
{
|
||||||
|
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 1: case 4: case 7: case 10: case 12:
|
||||||
|
s_gs = new GSRendererSW(s_basemem, !!mt, s_irq); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( *(HWND*)dsp == NULL )
|
||||||
|
{
|
||||||
|
// old-style API expects us to create and manage our own window:
|
||||||
|
|
||||||
|
int w = theApp.GetConfig("ModeWidth", 0);
|
||||||
|
int h = theApp.GetConfig("ModeHeight", 0);
|
||||||
|
|
||||||
|
if(!s_gs->CreateWnd(title, w, h))
|
||||||
|
{
|
||||||
|
GSclose();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
s_gs->m_wnd.Show();
|
||||||
|
*(HWND*)dsp = (HWND)s_gs->m_wnd.GetHandle();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s_gs->m_wnd.Attach( *(HWND*)dsp, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !s_gs->CreateDevice(dev) )
|
||||||
{
|
{
|
||||||
GSclose();
|
GSclose();
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
s_gs->m_wnd.Show();
|
|
||||||
|
|
||||||
*(HWND*)dsp = (HWND)s_gs->m_wnd.GetHandle();
|
|
||||||
|
|
||||||
// if(mt) _mm_setcsr(MXCSR);
|
// if(mt) _mm_setcsr(MXCSR);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EXPORT_C_(INT32) GSopen2(void* dsp, INT32 forceSoftware )
|
||||||
|
{
|
||||||
|
int renderer = theApp.GetConfig("renderer", 0);
|
||||||
|
if( forceSoftware )
|
||||||
|
{
|
||||||
|
renderer = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GSopen( dsp, NULL, true, renderer );
|
||||||
|
}
|
||||||
|
|
||||||
EXPORT_C_(INT32) GSopen(void* dsp, char* title, int mt)
|
EXPORT_C_(INT32) GSopen(void* dsp, char* title, int mt)
|
||||||
{
|
{
|
||||||
int renderer;
|
int renderer;
|
||||||
|
@ -174,6 +223,7 @@ EXPORT_C_(INT32) GSopen(void* dsp, char* title, int mt)
|
||||||
renderer = theApp.GetConfig("renderer", 0);
|
renderer = theApp.GetConfig("renderer", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*(HWND*)dsp = NULL;
|
||||||
return GSopen(dsp, title, mt, renderer);
|
return GSopen(dsp, title, mt, renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ bool GSDevice::Reset(int w, int h, int mode)
|
||||||
|
|
||||||
m_current = NULL; // current is special, points to other textures, no need to delete
|
m_current = NULL; // current is special, points to other textures, no need to delete
|
||||||
|
|
||||||
return true;
|
return m_wnd != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice::Present(const GSVector4i& r, int shader, bool limit)
|
void GSDevice::Present(const GSVector4i& r, int shader, bool limit)
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
#include "StdAfx.h"
|
#include "StdAfx.h"
|
||||||
#include "GSRenderer.h"
|
#include "GSRenderer.h"
|
||||||
|
|
||||||
GSRenderer::GSRenderer(uint8* base, bool mt, void (*irq)(), GSDevice* dev)
|
GSRenderer::GSRenderer(uint8* base, bool mt, void (*irq)())
|
||||||
: GSState(base, mt, irq)
|
: GSState(base, mt, irq)
|
||||||
, m_dev(dev)
|
, m_dev(NULL)
|
||||||
, m_shader(0)
|
, m_shader(0)
|
||||||
, m_vt(this)
|
, m_vt(this)
|
||||||
{
|
{
|
||||||
|
@ -55,21 +55,26 @@ GSRenderer::~GSRenderer()
|
||||||
delete m_dev;
|
delete m_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GSRenderer::Create(const string& title, int w, int h)
|
bool GSRenderer::CreateWnd(const string& title, int w, int h)
|
||||||
{
|
{
|
||||||
if(!m_wnd.Create(title.c_str(), w, h))
|
if(!m_wnd.Create(title.c_str(), w, h))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
ASSERT(m_dev);
|
bool GSRenderer::CreateDevice(GSDevice* dev)
|
||||||
|
{
|
||||||
|
ASSERT(dev);
|
||||||
|
ASSERT(!m_dev);
|
||||||
|
|
||||||
if(!m_dev->Create(&m_wnd, m_vsync))
|
if(!dev->Create(&m_wnd, m_vsync))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Reset();
|
m_dev = dev;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -316,7 +321,11 @@ void GSRenderer::VSync(int field)
|
||||||
s += " | Recording...";
|
s += " | Recording...";
|
||||||
}
|
}
|
||||||
|
|
||||||
m_wnd.SetWindowText(s.c_str());
|
if( !m_wnd.SetWindowText(s.c_str()) )
|
||||||
|
{
|
||||||
|
// We don't have window title rights, or the window has no title,
|
||||||
|
// so let's use actual OSD!
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_frameskip)
|
if(m_frameskip)
|
||||||
|
|
|
@ -46,7 +46,6 @@ protected:
|
||||||
bool m_aa1;
|
bool m_aa1;
|
||||||
bool m_blur;
|
bool m_blur;
|
||||||
|
|
||||||
virtual void ResetDevice() {}
|
|
||||||
virtual GSTexture* GetOutput(int i) = 0;
|
virtual GSTexture* GetOutput(int i) = 0;
|
||||||
|
|
||||||
GSVertexTrace m_vt;
|
GSVertexTrace m_vt;
|
||||||
|
@ -70,10 +69,12 @@ public:
|
||||||
int s_saven;
|
int s_saven;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GSRenderer(uint8* base, bool mt, void (*irq)(), GSDevice* dev);
|
GSRenderer(uint8* base, bool mt, void (*irq)());
|
||||||
virtual ~GSRenderer();
|
virtual ~GSRenderer();
|
||||||
|
|
||||||
virtual bool Create(const string& title, int w, int h);
|
virtual bool CreateWnd(const string& title, int w, int h);
|
||||||
|
virtual bool CreateDevice(GSDevice* dev);
|
||||||
|
virtual void ResetDevice() {}
|
||||||
virtual void VSync(int field);
|
virtual void VSync(int field);
|
||||||
virtual bool MakeSnapshot(const string& path);
|
virtual bool MakeSnapshot(const string& path);
|
||||||
virtual void KeyEvent(GSKeyEventData* e, int param = 0);
|
virtual void KeyEvent(GSKeyEventData* e, int param = 0);
|
||||||
|
@ -212,8 +213,8 @@ protected:
|
||||||
virtual void Draw() = 0;
|
virtual void Draw() = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GSRendererT(uint8* base, bool mt, void (*irq)(), GSDevice* dev)
|
GSRendererT(uint8* base, bool mt, void (*irq)())
|
||||||
: GSRenderer(base, mt, irq, dev)
|
: GSRenderer(base, mt, irq)
|
||||||
, m_vertices(NULL)
|
, m_vertices(NULL)
|
||||||
, m_count(0)
|
, m_count(0)
|
||||||
, m_maxcount(0)
|
, m_maxcount(0)
|
||||||
|
|
|
@ -41,8 +41,8 @@ protected:
|
||||||
virtual void UpdateFBA(GSTexture* rt) {}
|
virtual void UpdateFBA(GSTexture* rt) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GSRendererDX(uint8* base, bool mt, void (*irq)(), GSDevice* dev, GSTextureCache* tc, GSTextureFX* tfx, const GSVector2& pixelcenter = GSVector2(0, 0))
|
GSRendererDX(uint8* base, bool mt, void (*irq)(), GSTextureCache* tc, GSTextureFX* tfx, const GSVector2& pixelcenter = GSVector2(0, 0))
|
||||||
: GSRendererHW<Vertex>(base, mt, irq, dev, tc)
|
: GSRendererHW<Vertex>(base, mt, irq, tc)
|
||||||
, m_tfx(tfx)
|
, m_tfx(tfx)
|
||||||
, m_pixelcenter(pixelcenter)
|
, m_pixelcenter(pixelcenter)
|
||||||
, m_topology(-1)
|
, m_topology(-1)
|
||||||
|
@ -58,9 +58,9 @@ public:
|
||||||
delete m_tfx;
|
delete m_tfx;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Create(const string& title, int w, int h)
|
bool CreateDevice(GSDevice* dev)
|
||||||
{
|
{
|
||||||
if(!__super::Create(title, w, h))
|
if(!__super::CreateDevice(dev))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(!m_tfx->Create(m_dev))
|
if(!m_tfx->Create(m_dev))
|
||||||
|
|
|
@ -25,14 +25,14 @@
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
GSRendererDX10::GSRendererDX10(uint8* base, bool mt, void (*irq)())
|
GSRendererDX10::GSRendererDX10(uint8* base, bool mt, void (*irq)())
|
||||||
: GSRendererDX<GSVertexHW10>(base, mt, irq, new GSDevice10(), new GSTextureCache10(this), new GSTextureFX10(), GSVector2(-0.5f, -0.5f))
|
: GSRendererDX<GSVertexHW10>(base, mt, irq, new GSTextureCache10(this), new GSTextureFX10(), GSVector2(-0.5f, -0.5f))
|
||||||
{
|
{
|
||||||
InitVertexKick<GSRendererDX10>();
|
InitVertexKick<GSRendererDX10>();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GSRendererDX10::Create(const string& title, int w, int h)
|
bool GSRendererDX10::CreateDevice(GSDevice* dev)
|
||||||
{
|
{
|
||||||
if(!__super::Create(title, w, h))
|
if(!__super::CreateDevice(dev))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -41,7 +41,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
GSRendererDX10(uint8* base, bool mt, void (*irq)());
|
GSRendererDX10(uint8* base, bool mt, void (*irq)());
|
||||||
|
|
||||||
bool Create(const string& title, int w, int h);
|
bool CreateDevice(GSDevice* dev);
|
||||||
|
|
||||||
template<uint32 prim, uint32 tme, uint32 fst> void VertexKick(bool skip);
|
template<uint32 prim, uint32 tme, uint32 fst> void VertexKick(bool skip);
|
||||||
};
|
};
|
|
@ -25,14 +25,14 @@
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
GSRendererDX11::GSRendererDX11(uint8* base, bool mt, void (*irq)())
|
GSRendererDX11::GSRendererDX11(uint8* base, bool mt, void (*irq)())
|
||||||
: GSRendererDX<GSVertexHW11>(base, mt, irq, new GSDevice11(), new GSTextureCache11(this), new GSTextureFX11(), GSVector2(-0.5f, -0.5f))
|
: GSRendererDX<GSVertexHW11>(base, mt, irq, new GSTextureCache11(this), new GSTextureFX11(), GSVector2(-0.5f, -0.5f))
|
||||||
{
|
{
|
||||||
InitVertexKick<GSRendererDX11>();
|
InitVertexKick<GSRendererDX11>();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GSRendererDX11::Create(const string& title, int w, int h)
|
bool GSRendererDX11::CreateDevice(GSDevice* dev)
|
||||||
{
|
{
|
||||||
if(!__super::Create(title, w, h))
|
if(!__super::CreateDevice(dev))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -42,7 +42,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
GSRendererDX11(uint8* base, bool mt, void (*irq)());
|
GSRendererDX11(uint8* base, bool mt, void (*irq)());
|
||||||
|
|
||||||
bool Create(const string& title, int w, int h);
|
bool CreateDevice(GSDevice* dev);
|
||||||
|
|
||||||
template<uint32 prim, uint32 tme, uint32 fst> void VertexKick(bool skip);
|
template<uint32 prim, uint32 tme, uint32 fst> void VertexKick(bool skip);
|
||||||
};
|
};
|
|
@ -25,14 +25,14 @@
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
GSRendererDX9::GSRendererDX9(uint8* base, bool mt, void (*irq)())
|
GSRendererDX9::GSRendererDX9(uint8* base, bool mt, void (*irq)())
|
||||||
: GSRendererDX<GSVertexHW9>(base, mt, irq, new GSDevice9(), new GSTextureCache9(this), new GSTextureFX9())
|
: GSRendererDX<GSVertexHW9>(base, mt, irq, new GSTextureCache9(this), new GSTextureFX9())
|
||||||
{
|
{
|
||||||
InitVertexKick<GSRendererDX9>();
|
InitVertexKick<GSRendererDX9>();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GSRendererDX9::Create(const string& title, int w, int h)
|
bool GSRendererDX9::CreateDevice(GSDevice* dev)
|
||||||
{
|
{
|
||||||
if(!__super::Create(title, w, h))
|
if(!__super::CreateDevice(dev))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -48,7 +48,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
GSRendererDX9(uint8* base, bool mt, void (*irq)());
|
GSRendererDX9(uint8* base, bool mt, void (*irq)());
|
||||||
|
|
||||||
bool Create(const string& title, int w, int h);
|
bool CreateDevice(GSDevice* dev);
|
||||||
|
|
||||||
template<uint32 prim, uint32 tme, uint32 fst> void VertexKick(bool skip);
|
template<uint32 prim, uint32 tme, uint32 fst> void VertexKick(bool skip);
|
||||||
};
|
};
|
||||||
|
|
|
@ -703,8 +703,8 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GSRendererHW(uint8* base, bool mt, void (*irq)(), GSDevice* dev, GSTextureCache* tc)
|
GSRendererHW(uint8* base, bool mt, void (*irq)(), GSTextureCache* tc)
|
||||||
: GSRendererT<Vertex>(base, mt, irq, dev)
|
: GSRendererT<Vertex>(base, mt, irq)
|
||||||
, m_tc(tc)
|
, m_tc(tc)
|
||||||
, m_width(1024)
|
, m_width(1024)
|
||||||
, m_height(1024)
|
, m_height(1024)
|
||||||
|
|
|
@ -37,8 +37,8 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GSRendererNull(uint8* base, bool mt, void (*irq)(), GSDevice* dev)
|
GSRendererNull(uint8* base, bool mt, void (*irq)())
|
||||||
: GSRendererT<GSVertexNull>(base, mt, irq, dev)
|
: GSRendererT<GSVertexNull>(base, mt, irq)
|
||||||
{
|
{
|
||||||
InitVertexKick<GSRendererNull>();
|
InitVertexKick<GSRendererNull>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,14 +25,14 @@
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
GSRendererOGL::GSRendererOGL(uint8* base, bool mt, void (*irq)())
|
GSRendererOGL::GSRendererOGL(uint8* base, bool mt, void (*irq)())
|
||||||
: GSRendererHW<GSVertexOGL>(base, mt, irq, new GSDeviceOGL(), new GSTextureCacheOGL(this))
|
: GSRendererHW<GSVertexOGL>(base, mt, irq, new GSTextureCacheOGL(this))
|
||||||
{
|
{
|
||||||
InitVertexKick<GSRendererOGL>();
|
InitVertexKick<GSRendererOGL>();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GSRendererOGL::Create(const string& title, int w, int h)
|
bool GSRendererOGL::CreateDevice(GSDevice* dev)
|
||||||
{
|
{
|
||||||
if(!__super::Create(title, w, h))
|
if(!__super::CreateDevice(dev))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
|
@ -34,7 +34,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
GSRendererOGL(uint8* base, bool mt, void (*irq)());
|
GSRendererOGL(uint8* base, bool mt, void (*irq)());
|
||||||
|
|
||||||
bool Create(const string& title, int w, int h);
|
bool CreateDevice(GSDevice* dev);
|
||||||
|
|
||||||
template<uint32 prim, uint32 tme, uint32 fst> void VertexKick(bool skip);
|
template<uint32 prim, uint32 tme, uint32 fst> void VertexKick(bool skip);
|
||||||
};
|
};
|
|
@ -24,8 +24,8 @@
|
||||||
|
|
||||||
const GSVector4 g_pos_scale(1.0f / 16, 1.0f / 16, 1.0f, 128.0f);
|
const GSVector4 g_pos_scale(1.0f / 16, 1.0f / 16, 1.0f, 128.0f);
|
||||||
|
|
||||||
GSRendererSW::GSRendererSW(uint8* base, bool mt, void (*irq)(), GSDevice* dev)
|
GSRendererSW::GSRendererSW(uint8* base, bool mt, void (*irq)())
|
||||||
: GSRendererT(base, mt, irq, dev)
|
: GSRendererT(base, mt, irq)
|
||||||
{
|
{
|
||||||
m_tc = new GSTextureCacheSW(this);
|
m_tc = new GSTextureCacheSW(this);
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ protected:
|
||||||
void GetScanlineParam(GSScanlineParam& p, GS_PRIM_CLASS primclass);
|
void GetScanlineParam(GSScanlineParam& p, GS_PRIM_CLASS primclass);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GSRendererSW(uint8* base, bool mt, void (*irq)(), GSDevice* dev);
|
GSRendererSW(uint8* base, bool mt, void (*irq)());
|
||||||
virtual ~GSRendererSW();
|
virtual ~GSRendererSW();
|
||||||
|
|
||||||
template<uint32 prim, uint32 tme, uint32 fst>
|
template<uint32 prim, uint32 tme, uint32 fst>
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
GSWnd::GSWnd()
|
GSWnd::GSWnd()
|
||||||
: m_hWnd(NULL)
|
: m_hWnd(NULL)
|
||||||
|
, m_IsManaged(true)
|
||||||
|
, m_HasFrame(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,6 +79,8 @@ LRESULT GSWnd::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
bool GSWnd::Create(const string& title, int w, int h)
|
bool GSWnd::Create(const string& title, int w, int h)
|
||||||
{
|
{
|
||||||
|
if(m_hWnd) return true;
|
||||||
|
|
||||||
WNDCLASS wc;
|
WNDCLASS wc;
|
||||||
|
|
||||||
memset(&wc, 0, sizeof(wc));
|
memset(&wc, 0, sizeof(wc));
|
||||||
|
@ -134,15 +138,22 @@ bool GSWnd::Create(const string& title, int w, int h)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GSWnd::Attach(HWND hWnd)
|
bool GSWnd::Attach(HWND hWnd, bool isManaged)
|
||||||
{
|
{
|
||||||
// TODO: subclass
|
// TODO: subclass
|
||||||
|
|
||||||
m_hWnd = hWnd;
|
m_hWnd = hWnd;
|
||||||
|
m_IsManaged = isManaged;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GSWnd::Detach()
|
||||||
|
{
|
||||||
|
m_hWnd = NULL;
|
||||||
|
m_IsManaged = true;
|
||||||
|
}
|
||||||
|
|
||||||
GSVector4i GSWnd::GetClientRect()
|
GSVector4i GSWnd::GetClientRect()
|
||||||
{
|
{
|
||||||
GSVector4i r;
|
GSVector4i r;
|
||||||
|
@ -152,13 +163,21 @@ GSVector4i GSWnd::GetClientRect()
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSWnd::SetWindowText(const char* title)
|
// Returns FALSE if the window has no title, or if th window title is under the strict
|
||||||
|
// management of the emulator.
|
||||||
|
bool GSWnd::SetWindowText(const char* title)
|
||||||
{
|
{
|
||||||
|
if( !m_IsManaged ) return false;
|
||||||
|
|
||||||
::SetWindowText(m_hWnd, title);
|
::SetWindowText(m_hWnd, title);
|
||||||
|
|
||||||
|
return m_HasFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSWnd::Show()
|
void GSWnd::Show()
|
||||||
{
|
{
|
||||||
|
if( !m_IsManaged ) return;
|
||||||
|
|
||||||
//SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
|
//SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
|
||||||
|
|
||||||
SetForegroundWindow(m_hWnd);
|
SetForegroundWindow(m_hWnd);
|
||||||
|
@ -170,14 +189,20 @@ void GSWnd::Show()
|
||||||
|
|
||||||
void GSWnd::Hide()
|
void GSWnd::Hide()
|
||||||
{
|
{
|
||||||
|
if( !m_IsManaged ) return;
|
||||||
|
|
||||||
ShowWindow(m_hWnd, SW_HIDE);
|
ShowWindow(m_hWnd, SW_HIDE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSWnd::HideFrame()
|
void GSWnd::HideFrame()
|
||||||
{
|
{
|
||||||
|
if( !m_IsManaged ) return;
|
||||||
|
|
||||||
SetWindowLong(m_hWnd, GWL_STYLE, GetWindowLong(m_hWnd, GWL_STYLE) & ~(WS_CAPTION|WS_THICKFRAME));
|
SetWindowLong(m_hWnd, GWL_STYLE, GetWindowLong(m_hWnd, GWL_STYLE) & ~(WS_CAPTION|WS_THICKFRAME));
|
||||||
|
|
||||||
SetWindowPos(m_hWnd, NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
|
SetWindowPos(m_hWnd, NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
|
||||||
|
|
||||||
SetMenu(m_hWnd, NULL);
|
SetMenu(m_hWnd, NULL);
|
||||||
|
|
||||||
|
m_HasFrame = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
class GSWnd
|
class GSWnd
|
||||||
{
|
{
|
||||||
HWND m_hWnd;
|
HWND m_hWnd;
|
||||||
|
bool m_IsManaged; // set true when we're attached to a 3rdparty window that's amanged by the emulator
|
||||||
|
bool m_HasFrame;
|
||||||
|
|
||||||
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
virtual LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
|
virtual LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
|
@ -35,13 +37,14 @@ public:
|
||||||
virtual ~GSWnd();
|
virtual ~GSWnd();
|
||||||
|
|
||||||
bool Create(const string& title, int w, int h);
|
bool Create(const string& title, int w, int h);
|
||||||
bool Attach(HWND hWnd);
|
bool Attach(HWND hWnd, bool isManaged=true);
|
||||||
|
void Detach();
|
||||||
|
|
||||||
void* GetHandle() {return m_hWnd;}
|
void* GetHandle() {return m_hWnd;}
|
||||||
|
|
||||||
GSVector4i GetClientRect();
|
GSVector4i GetClientRect();
|
||||||
|
|
||||||
void SetWindowText(const char* title);
|
bool SetWindowText(const char* title);
|
||||||
|
|
||||||
void Show();
|
void Show();
|
||||||
void Hide();
|
void Hide();
|
||||||
|
|
|
@ -11,7 +11,8 @@ EXPORTS
|
||||||
GSsetBaseMem
|
GSsetBaseMem
|
||||||
GSinit
|
GSinit
|
||||||
GSshutdown
|
GSshutdown
|
||||||
GSopen
|
GSopen
|
||||||
|
GSopen2
|
||||||
GSclose
|
GSclose
|
||||||
GSreset
|
GSreset
|
||||||
GSwriteCSR
|
GSwriteCSR
|
||||||
|
|
|
@ -1197,10 +1197,6 @@
|
||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\GSdx.def"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\GSFunctionMap.cpp"
|
RelativePath=".\GSFunctionMap.cpp"
|
||||||
>
|
>
|
||||||
|
@ -1977,6 +1973,10 @@
|
||||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||||
>
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\GSdx.def"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\GSdx.rc"
|
RelativePath=".\GSdx.rc"
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in New Issue