GSdx: mfc-free

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1310 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gabest11 2009-06-03 12:09:04 +00:00
parent 96f7911d26
commit ffda8ead30
46 changed files with 1234 additions and 1340 deletions

View File

@ -87,8 +87,6 @@ EXPORT_C_(int32) GPUopen(HWND hWnd)
#ifdef _WINDOWS
AFX_MANAGE_STATE(AfxGetStaticModuleState());
s_hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
if(!GSUtil::CheckDirectX())
@ -126,11 +124,6 @@ EXPORT_C_(int32) GPUopen(HWND hWnd)
EXPORT_C_(int32) GPUconfigure()
{
#ifdef _WINDOWS
AFX_MANAGE_STATE(AfxGetStaticModuleState());
GPUSettingsDlg dlg;
if(IDOK == dlg.DoModal())
@ -139,8 +132,6 @@ EXPORT_C_(int32) GPUconfigure()
GPUinit();
}
#endif
return 0;
}

View File

@ -49,23 +49,136 @@ GPURenderer::~GPURenderer()
bool GPURenderer::Create(HWND hWnd)
{
// TODO: move subclassing inside GSWnd::Attach
m_hWnd = hWnd;
m_wndproc = (WNDPROC)GetWindowLongPtr(hWnd, GWLP_WNDPROC);
SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)WndProc);
if(!m_wnd.Attach(m_hWnd))
{
return false;
}
m_wnd2gpu[hWnd] = this;
DWORD style = GetWindowLong(hWnd, GWL_STYLE);
style |= WS_OVERLAPPEDWINDOW;
SetWindowLong(hWnd, GWL_STYLE, style);
UpdateWindow(hWnd);
ShowWindow(hWnd, SW_SHOWNORMAL);
m_wnd.Show();
if(!m_dev->Create(&m_wnd, m_vsync))
{
return false;
}
Reset();
return true;
}
bool GPURenderer::Merge()
{
GSTexture* st[2] = {GetOutput(), NULL};
if(!st[0])
{
return false;
}
GSVector2i s = st[0]->GetSize();
GSVector4 sr[2];
GSVector4 dr[2];
sr[0] = GSVector4(0, 0, 1, 1);
dr[0] = GSVector4(0, 0, s.x, s.y);
m_dev->Merge(st, sr, dr, s, 1, 1, GSVector4(0, 0, 0, 1));
return true;
}
void GPURenderer::VSync()
{
GSPerfMonAutoTimer pmat(m_perfmon);
m_perfmon.Put(GSPerfMon::Frame);
// m_env.STATUS.LCF = ~m_env.STATUS.LCF; // ?
if(!IsWindow(m_hWnd)) return;
Flush();
if(!Merge()) return;
// osd
if((m_perfmon.GetFrame() & 0x1f) == 0)
{
m_perfmon.Update();
double fps = 1000.0f / m_perfmon.Get(GSPerfMon::Frame);
GSVector4i r = m_env.GetDisplayRect();
int w = r.width() << m_scale.x;
int h = r.height() << m_scale.y;
string s = format(
"%I64d | %d x %d | %.2f fps (%d%%) | %d/%d | %d%% CPU | %.2f | %.2f",
m_perfmon.GetFrame(), w, h, fps, (int)(100.0 * fps / m_env.GetFPS()),
(int)m_perfmon.Get(GSPerfMon::Prim),
(int)m_perfmon.Get(GSPerfMon::Draw),
m_perfmon.CPU(),
m_perfmon.Get(GSPerfMon::Swizzle) / 1024,
m_perfmon.Get(GSPerfMon::Unswizzle) / 1024
);
double fillrate = m_perfmon.Get(GSPerfMon::Fillrate);
if(fillrate > 0)
{
s = format("%s | %.2f mpps", s.c_str(), fps * fillrate / (1024 * 1024));
}
SetWindowText(m_hWnd, s.c_str());
}
if(m_dev->IsLost())
{
ResetDevice();
}
GSVector4i r;
GetClientRect(m_hWnd, r);
m_dev->Present(r.fit(m_aspectratio), 0);
}
bool GPURenderer::MakeSnapshot(const string& path)
{
time_t t = time(NULL);
char buff[16];
if(!strftime(buff, sizeof(buff), "%Y%m%d%H%M%S", localtime(&t)))
{
return false;
}
if(GSTexture* t = m_dev->GetCurrent())
{
return t->Save(format("%s_%s.bmp", path.c_str(), buff));
}
return false;
}
LRESULT CALLBACK GPURenderer::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
map<HWND, GPURenderer*>::iterator i = m_wnd2gpu.find(hWnd);

View File

@ -27,31 +27,35 @@
class GPURenderer : public GPUState
{
bool Merge();
protected:
GSDevice* m_dev;
int m_filter;
int m_dither;
int m_aspectratio;
bool m_vsync;
GSVector2i m_scale;
virtual void ResetDevice() {}
virtual GSTexture* GetOutput() = 0;
HWND m_hWnd;
WNDPROC m_wndproc;
static map<HWND, GPURenderer*> m_wnd2gpu;
GSWnd m_wnd;
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
public:
GSDevice* m_dev;
public:
GPURenderer(GSDevice* dev);
virtual ~GPURenderer();
virtual bool Create(HWND hWnd);
virtual void VSync() = 0;
virtual bool MakeSnapshot(const string& path) = 0;
virtual void VSync();
virtual bool MakeSnapshot(const string& path);
};
template<class Vertex>
@ -71,66 +75,6 @@ protected:
__super::Reset();
}
void VertexKick()
{
if(m_vl.GetCount() < (int)m_env.PRIM.VTX)
{
return;
}
if(m_count > m_maxcount)
{
m_maxcount = max(10000, m_maxcount * 3/2);
m_vertices = (Vertex*)_aligned_realloc(m_vertices, sizeof(Vertex) * m_maxcount, 16);
m_maxcount -= 100;
}
Vertex* v = &m_vertices[m_count];
int count = 0;
switch(m_env.PRIM.TYPE)
{
case GPU_POLYGON:
m_vl.GetAt(0, v[0]);
m_vl.GetAt(1, v[1]);
m_vl.GetAt(2, v[2]);
m_vl.RemoveAll();
count = 3;
break;
case GPU_LINE:
m_vl.GetAt(0, v[0]);
m_vl.GetAt(1, v[1]);
m_vl.RemoveAll();
count = 2;
break;
case GPU_SPRITE:
m_vl.GetAt(0, v[0]);
m_vl.GetAt(1, v[1]);
m_vl.RemoveAll();
count = 2;
break;
default:
ASSERT(0);
m_vl.RemoveAll();
count = 0;
break;
}
(this->*m_fpDrawingKickHandlers[m_env.PRIM.TYPE])(v, count);
m_count += count;
}
typedef void (GPURendererT<Vertex>::*DrawingKickHandler)(Vertex* v, int& count);
DrawingKickHandler m_fpDrawingKickHandlers[4];
void DrawingKickNull(Vertex* v, int& count)
{
ASSERT(0);
}
void ResetPrim()
{
m_vl.RemoveAll();
@ -164,149 +108,71 @@ protected:
}
}
virtual void ResetDevice() {}
virtual void Draw() = 0;
virtual GSTexture* GetOutput() = 0;
bool Merge()
void GrowVertexBuffer()
{
GSTexture* st[2] = {GetOutput(), NULL};
m_maxcount = max(10000, m_maxcount * 3/2);
m_vertices = (Vertex*)_aligned_realloc(m_vertices, sizeof(Vertex) * m_maxcount, 16);
m_maxcount -= 100;
}
if(!st[0])
__forceinline Vertex* DrawingKick(int& count)
{
count = (int)m_env.PRIM.VTX;
if(m_vl.GetCount() < count)
{
return false;
return NULL;
}
GSVector2i s = st[0]->GetSize();
if(m_count >= m_maxcount)
{
GrowVertexBuffer();
}
GSVector4 sr[2];
GSVector4 dr[2];
Vertex* v = &m_vertices[m_count];
sr[0] = GSVector4(0, 0, 1, 1);
dr[0] = GSVector4(0, 0, s.x, s.y);
switch(m_env.PRIM.TYPE)
{
case GPU_POLYGON:
m_vl.GetAt(0, v[0]);
m_vl.GetAt(1, v[1]);
m_vl.GetAt(2, v[2]);
m_vl.RemoveAll();
break;
case GPU_LINE:
m_vl.GetAt(0, v[0]);
m_vl.GetAt(1, v[1]);
m_vl.RemoveAll();
break;
case GPU_SPRITE:
m_vl.GetAt(0, v[0]);
m_vl.GetAt(1, v[1]);
m_vl.RemoveAll();
break;
default:
ASSERT(0);
m_vl.RemoveAll();
return NULL;
}
m_dev->Merge(st, sr, dr, s, 1, 1, GSVector4(0, 0, 0, 1));
return true;
return v;
}
virtual void VertexKick() = 0;
virtual void Draw() = 0;
public:
GPURendererT(GSDevice* dev)
: GPURenderer(dev)
, m_count(0)
, m_maxcount(10000)
, m_maxcount(0)
, m_vertices(NULL)
{
m_vertices = (Vertex*)_aligned_malloc(sizeof(Vertex) * m_maxcount, 16);
m_maxcount -= 100;
for(int i = 0; i < countof(m_fpDrawingKickHandlers); i++)
{
m_fpDrawingKickHandlers[i] = &GPURendererT<Vertex>::DrawingKickNull;
}
}
virtual ~GPURendererT()
{
if(m_vertices) _aligned_free(m_vertices);
}
virtual bool Create(HWND hWnd)
{
if(!__super::Create(hWnd))
{
return false;
}
if(!m_dev->Create(hWnd, m_vsync))
{
return false;
}
Reset();
return true;
}
virtual void VSync()
{
GSPerfMonAutoTimer pmat(m_perfmon);
m_perfmon.Put(GSPerfMon::Frame);
// m_env.STATUS.LCF = ~m_env.STATUS.LCF; // ?
if(!IsWindow(m_hWnd)) return;
Flush();
if(!Merge()) return;
// osd
static uint64 s_frame = 0;
static string s_stats;
if(m_perfmon.GetFrame() - s_frame >= 30)
{
m_perfmon.Update();
s_frame = m_perfmon.GetFrame();
double fps = 1000.0f / m_perfmon.Get(GSPerfMon::Frame);
GSVector4i r = m_env.GetDisplayRect();
int w = r.width() << m_scale.x;
int h = r.height() << m_scale.y;
s_stats = format(
"%I64d | %d x %d | %.2f fps (%d%%) | %d/%d | %d%% CPU | %.2f | %.2f",
m_perfmon.GetFrame(), w, h, fps, (int)(100.0 * fps / m_env.GetFPS()),
(int)m_perfmon.Get(GSPerfMon::Prim),
(int)m_perfmon.Get(GSPerfMon::Draw),
m_perfmon.CPU(),
m_perfmon.Get(GSPerfMon::Swizzle) / 1024,
m_perfmon.Get(GSPerfMon::Unswizzle) / 1024
);
double fillrate = m_perfmon.Get(GSPerfMon::Fillrate);
if(fillrate > 0)
{
s_stats = format("%s | %.2f mpps", s_stats.c_str(), fps * fillrate / (1024 * 1024));
}
SetWindowText(m_hWnd, s_stats.c_str());
}
if(m_dev->IsLost())
{
ResetDevice();
}
GSVector4i r;
GetClientRect(m_hWnd, r);
m_dev->Present(r.fit(m_aspectratio), 0);
}
virtual bool MakeSnapshot(const string& path)
{
time_t t = time(NULL);
char buff[16];
if(!strftime(buff, sizeof(buff), "%Y%m%d%H%M%S", localtime(&t)))
{
return false;
}
if(GSTexture* t = m_dev->GetCurrent())
{
return t->Save(format("%s_%s.bmp", path.c_str(), buff));
}
return false;
}
};

View File

@ -28,10 +28,6 @@ GPURendererSW::GPURendererSW(GSDevice* dev)
, m_texture(NULL)
{
m_rl.Create<GPUDrawScanline>(this, theApp.GetConfig("swthreads", 1));
m_fpDrawingKickHandlers[GPU_POLYGON] = (DrawingKickHandler)&GPURendererSW::DrawingKickTriangle;
m_fpDrawingKickHandlers[GPU_LINE] = (DrawingKickHandler)&GPURendererSW::DrawingKickLine;
m_fpDrawingKickHandlers[GPU_SPRITE] = (DrawingKickHandler)&GPURendererSW::DrawingKickSprite;
}
GPURendererSW::~GPURendererSW()
@ -45,52 +41,46 @@ void GPURendererSW::ResetDevice()
m_texture = NULL;
}
GSVector4i GPURendererSW::GetScissor()
GSTexture* GPURendererSW::GetOutput()
{
GSVector4i r;
GSVector4i r = m_env.GetDisplayRect();
r.left = (int)m_env.DRAREATL.X << m_scale.x;
r.top = (int)m_env.DRAREATL.Y << m_scale.y;
r.right = min((int)(m_env.DRAREABR.X + 1) << m_scale.x, m_mem.GetWidth());
r.bottom = min((int)(m_env.DRAREABR.Y + 1) << m_scale.y, m_mem.GetHeight());
r.left <<= m_scale.x;
r.top <<= m_scale.y;
r.right <<= m_scale.x;
r.bottom <<= m_scale.y;
return r;
}
void GPURendererSW::VertexKick()
{
GSVertexSW& v = m_vl.AddTail();
// TODO: x/y + off.x/y should wrap around at +/-1024
int x = (int)(m_v.XY.X + m_env.DROFF.X) << m_scale.x;
int y = (int)(m_v.XY.Y + m_env.DROFF.Y) << m_scale.y;
int s = m_v.UV.X;
int t = m_v.UV.Y;
GSVector4 pt(x, y, s, t);
v.p = pt.xyxy(GSVector4::zero());
v.t = (pt.zwzw(GSVector4::zero()) + GSVector4(0.125f)) * 256.0f;
v.c = GSVector4(m_v.RGB.u32) * 128.0f;
__super::VertexKick();
}
void GPURendererSW::DrawingKickTriangle(GSVertexSW* v, int& count)
{
// TODO
}
static uint32* buff = (uint32*)_aligned_malloc(m_mem.GetWidth() * m_mem.GetHeight() * sizeof(uint32), 16);
void GPURendererSW::DrawingKickLine(GSVertexSW* v, int& count)
{
// TODO
}
m_mem.ReadFrame32(r, buff, !!m_env.STATUS.ISRGB24);
void GPURendererSW::DrawingKickSprite(GSVertexSW* v, int& count)
{
// TODO
int w = r.width();
int h = r.height();
if(m_texture)
{
if(m_texture->GetWidth() != w || m_texture->GetHeight() != h)
{
delete m_texture;
m_texture = NULL;
}
}
if(!m_texture)
{
m_texture = m_dev->CreateTexture(w, h);
if(!m_texture)
{
return NULL;
}
}
m_texture->Update(GSVector4i(0, 0, w, h), buff, m_mem.GetWidth() * sizeof(uint32));
return m_texture;
}
void GPURendererSW::Draw()
@ -137,11 +127,15 @@ void GPURendererSW::Draw()
GSRasterizerData data;
data.scissor = GetScissor();
data.vertices = m_vertices;
data.count = m_count;
data.param = &p;
data.scissor.left = (int)m_env.DRAREATL.X << m_scale.x;
data.scissor.top = (int)m_env.DRAREATL.Y << m_scale.y;
data.scissor.right = min((int)(m_env.DRAREABR.X + 1) << m_scale.x, m_mem.GetWidth());
data.scissor.bottom = min((int)(m_env.DRAREABR.Y + 1) << m_scale.y, m_mem.GetHeight());
switch(env.PRIM.TYPE)
{
case GPU_POLYGON: data.primclass = GS_TRIANGLE_CLASS; break;
@ -185,45 +179,32 @@ void GPURendererSW::Draw()
}
}
GSTexture* GPURendererSW::GetOutput()
void GPURendererSW::VertexKick()
{
GSVector4i r = m_env.GetDisplayRect();
GSVertexSW& dst = m_vl.AddTail();
r.left <<= m_scale.x;
r.top <<= m_scale.y;
r.right <<= m_scale.x;
r.bottom <<= m_scale.y;
// TODO: x/y + off.x/y should wrap around at +/-1024
// TODO
static uint32* buff = (uint32*)_aligned_malloc(m_mem.GetWidth() * m_mem.GetHeight() * sizeof(uint32), 16);
int x = (int)(m_v.XY.X + m_env.DROFF.X) << m_scale.x;
int y = (int)(m_v.XY.Y + m_env.DROFF.Y) << m_scale.y;
m_mem.ReadFrame32(r, buff, !!m_env.STATUS.ISRGB24);
int s = m_v.UV.X;
int t = m_v.UV.Y;
int w = r.width();
int h = r.height();
GSVector4 pt(x, y, s, t);
if(m_texture)
dst.p = pt.xyxy(GSVector4::zero());
dst.t = (pt.zwzw(GSVector4::zero()) + GSVector4(0.125f)) * 256.0f;
// dst.c = GSVector4(m_v.RGB.u32) * 128.0f;
dst.c = GSVector4(GSVector4i::load((int)m_v.RGB.u32).u8to32() << 7);
int count = 0;
if(GSVertexSW* v = DrawingKick(count))
{
if(m_texture->GetWidth() != w || m_texture->GetHeight() != h)
{
delete m_texture;
// TODO
m_texture = NULL;
}
m_count += count;
}
if(!m_texture)
{
m_texture = m_dev->CreateTexture(w, h);
if(!m_texture)
{
return NULL;
}
}
m_texture->Update(GSVector4i(0, 0, w, h), buff, m_mem.GetWidth() * sizeof(uint32));
return m_texture;
}

View File

@ -31,17 +31,9 @@ protected:
GSTexture* m_texture;
void ResetDevice();
GSVector4i GetScissor();
void VertexKick();
void DrawingKickTriangle(GSVertexSW* v, int& count);
void DrawingKickLine(GSVertexSW* v, int& count);
void DrawingKickSprite(GSVertexSW* v, int& count);
void Draw();
GSTexture* GetOutput();
void VertexKick();
void Draw();
public:
GPURendererSW(GSDevice* dev);

View File

@ -23,112 +23,64 @@
#include "GSdx.h"
#include "GSUtil.h"
#include "GPUSettingsDlg.h"
#include <shlobj.h>
#include <afxpriv.h>
#include "resource.h"
GSSetting GPUSettingsDlg::g_renderers[] =
{
{0, _T("Direct3D7 (Software)"), NULL},
{1, _T("Direct3D9 (Software)"), NULL},
{2, _T("Direct3D10 (Software)"), NULL},
// {3, _T("Null (Null)"), NULL},
{0, "Direct3D7 (Software)", NULL},
{1, "Direct3D9 (Software)", NULL},
{2, "Direct3D10 (Software)", NULL},
// {3, "Null (Null)", NULL},
};
GSSetting GPUSettingsDlg::g_psversion[] =
{
{D3DPS_VERSION(3, 0), _T("Pixel Shader 3.0"), NULL},
{D3DPS_VERSION(2, 0), _T("Pixel Shader 2.0"), NULL},
//{D3DPS_VERSION(1, 4), _T("Pixel Shader 1.4"), NULL},
//{D3DPS_VERSION(1, 1), _T("Pixel Shader 1.1"), NULL},
//{D3DPS_VERSION(0, 0), _T("Fixed Pipeline (bogus)"), NULL},
{D3DPS_VERSION(3, 0), "Pixel Shader 3.0", NULL},
{D3DPS_VERSION(2, 0), "Pixel Shader 2.0", NULL},
//{D3DPS_VERSION(1, 4), "Pixel Shader 1.4", NULL},
//{D3DPS_VERSION(1, 1), "Pixel Shader 1.1", NULL},
//{D3DPS_VERSION(0, 0), "Fixed Pipeline (bogus)", NULL},
};
GSSetting GPUSettingsDlg::g_filter[] =
{
{0, _T("Nearest"), NULL},
{1, _T("Bilinear (polygons only)"), NULL},
{2, _T("Bilinear"), NULL},
{0, "Nearest", NULL},
{1, "Bilinear (polygons only)", NULL},
{2, "Bilinear", NULL},
};
GSSetting GPUSettingsDlg::g_dithering[] =
{
{0, _T("Disabled"), NULL},
{1, _T("Auto"), NULL},
{0, "Disabled", NULL},
{1, "Auto", NULL},
};
GSSetting GPUSettingsDlg::g_aspectratio[] =
{
{0, _T("Stretch"), NULL},
{1, _T("4:3"), NULL},
{2, _T("16:9"), NULL},
{0, "Stretch", NULL},
{1, "4:3", NULL},
{2, "16:9", NULL},
};
GSSetting GPUSettingsDlg::g_internalresolution[] =
GSSetting GPUSettingsDlg::g_scale[] =
{
{0 | (0 << 2), _T("H x 1 - V x 1"), NULL},
{1 | (0 << 2), _T("H x 2 - V x 1"), NULL},
{0 | (1 << 2), _T("H x 1 - V x 2"), NULL},
{1 | (1 << 2), _T("H x 2 - V x 2"), NULL},
{2 | (1 << 2), _T("H x 4 - V x 2"), NULL},
{1 | (2 << 2), _T("H x 2 - V x 4"), NULL},
{2 | (2 << 2), _T("H x 4 - V x 4"), NULL},
{0 | (0 << 2), "H x 1 - V x 1", NULL},
{1 | (0 << 2), "H x 2 - V x 1", NULL},
{0 | (1 << 2), "H x 1 - V x 2", NULL},
{1 | (1 << 2), "H x 2 - V x 2", NULL},
{2 | (1 << 2), "H x 4 - V x 2", NULL},
{1 | (2 << 2), "H x 2 - V x 4", NULL},
{2 | (2 << 2), "H x 4 - V x 4", NULL},
};
IMPLEMENT_DYNAMIC(GPUSettingsDlg, CDialog)
GPUSettingsDlg::GPUSettingsDlg(CWnd* pParent /*=NULL*/)
: CDialog(GPUSettingsDlg::IDD, pParent)
{
}
GPUSettingsDlg::~GPUSettingsDlg()
GPUSettingsDlg::GPUSettingsDlg()
: GSDialog(IDD_GPUCONFIG)
{
}
LRESULT GPUSettingsDlg::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
void GPUSettingsDlg::OnInit()
{
LRESULT ret = __super::DefWindowProc(message, wParam, lParam);
if(message == WM_INITDIALOG)
{
SendMessage(WM_KICKIDLE);
}
return ret;
}
void GPUSettingsDlg::DoDataExchange(CDataExchange* pDX)
{
__super::DoDataExchange(pDX);
DDX_Control(pDX, IDC_COMBO3, m_resolution);
DDX_Control(pDX, IDC_COMBO1, m_renderer);
DDX_Control(pDX, IDC_COMBO4, m_psversion);
DDX_Control(pDX, IDC_COMBO2, m_filter);
DDX_Control(pDX, IDC_COMBO5, m_dithering);
DDX_Control(pDX, IDC_COMBO6, m_aspectratio);
DDX_Control(pDX, IDC_COMBO7, m_internalresolution);
DDX_Control(pDX, IDC_SPIN3, m_swthreads);
DDX_Control(pDX, IDC_EDIT3, m_swthreadsedit);
}
BEGIN_MESSAGE_MAP(GPUSettingsDlg, CDialog)
ON_MESSAGE_VOID(WM_KICKIDLE, OnKickIdle)
ON_UPDATE_COMMAND_UI(IDC_COMBO4, OnUpdateD3D9Options)
ON_UPDATE_COMMAND_UI(IDC_COMBO7, OnUpdateSWOptions)
ON_UPDATE_COMMAND_UI(IDC_SPIN3, OnUpdateSWOptions)
ON_UPDATE_COMMAND_UI(IDC_EDIT3, OnUpdateSWOptions)
ON_CBN_SELCHANGE(IDC_COMBO1, &GPUSettingsDlg::OnCbnSelchangeCombo1)
END_MESSAGE_MAP()
void GPUSettingsDlg::OnKickIdle()
{
UpdateDialogControls(this, false);
}
BOOL GPUSettingsDlg::OnInitDialog()
{
__super::OnInitDialog();
__super::OnInit();
D3DCAPS9 caps;
memset(&caps, 0, sizeof(caps));
@ -136,163 +88,128 @@ BOOL GPUSettingsDlg::OnInitDialog()
m_modes.clear();
// windowed
{
D3DDISPLAYMODE mode;
memset(&mode, 0, sizeof(mode));
m_modes.push_back(mode);
int iItem = m_resolution.AddString(_T("Windowed"));
m_resolution.SetItemDataPtr(iItem, &m_modes.back());
m_resolution.SetCurSel(iItem);
}
HWND hWnd = GetDlgItem(m_hWnd, IDC_RESOLUTION);
// fullscreen
ComboBoxAppend(hWnd, "Windowed", (LPARAM)&m_modes.back(), true);
if(CComPtr<IDirect3D9> d3d = Direct3DCreate9(D3D_SDK_VERSION))
{
uint32 ModeWidth = theApp.GetConfig("ModeWidth", 0);
uint32 ModeHeight = theApp.GetConfig("ModeHeight", 0);
uint32 ModeRefreshRate = theApp.GetConfig("ModeRefreshRate", 0);
uint32 nModes = d3d->GetAdapterModeCount(D3DADAPTER_DEFAULT, D3DFMT_X8R8G8B8);
for(uint32 i = 0; i < nModes; i++)
if(CComPtr<IDirect3D9> d3d = Direct3DCreate9(D3D_SDK_VERSION))
{
D3DDISPLAYMODE mode;
uint32 w = theApp.GetConfig("ModeWidth", 0);
uint32 h = theApp.GetConfig("ModeHeight", 0);
uint32 hz = theApp.GetConfig("ModeRefreshRate", 0);
if(S_OK == d3d->EnumAdapterModes(D3DADAPTER_DEFAULT, D3DFMT_X8R8G8B8, i, &mode))
uint32 n = d3d->GetAdapterModeCount(D3DADAPTER_DEFAULT, D3DFMT_X8R8G8B8);
for(uint32 i = 0; i < n; i++)
{
CString str;
str.Format(_T("%dx%d %dHz"), mode.Width, mode.Height, mode.RefreshRate);
int iItem = m_resolution.AddString(str);
m_modes.push_back(mode);
m_resolution.SetItemDataPtr(iItem, &m_modes.back());
if(ModeWidth == mode.Width && ModeHeight == mode.Height && ModeRefreshRate == mode.RefreshRate)
if(S_OK == d3d->EnumAdapterModes(D3DADAPTER_DEFAULT, D3DFMT_X8R8G8B8, i, &mode))
{
m_resolution.SetCurSel(iItem);
m_modes.push_back(mode);
string str = format("%dx%d %dHz", mode.Width, mode.Height, mode.RefreshRate);
ComboBoxAppend(hWnd, str.c_str(), (LPARAM)&m_modes.back(), w == mode.Width && h == mode.Height && hz == mode.RefreshRate);
}
}
d3d->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &caps);
}
}
{
bool isdx10avail = GSUtil::IsDirect3D10Available();
vector<GSSetting> renderers;
for(size_t i = 0; i < countof(g_renderers); i++)
{
if(i >= 3 && i <= 5 && !isdx10avail) continue;
renderers.push_back(g_renderers[i]);
}
d3d->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &caps);
HWND hWnd = GetDlgItem(m_hWnd, IDC_RENDERER);
ComboBoxInit(hWnd, &renderers[0], renderers.size(), theApp.GetConfig("Renderer", 0));
OnCommand(hWnd, IDC_RENDERER, CBN_SELCHANGE);
}
bool isdx10avail = GSUtil::IsDirect3D10Available();
ComboBoxInit(GetDlgItem(m_hWnd, IDC_SHADER), g_psversion, countof(g_psversion), theApp.GetConfig("PixelShaderVersion2", D3DPS_VERSION(2, 0)), caps.PixelShaderVersion);
ComboBoxInit(GetDlgItem(m_hWnd, IDC_FILTER), g_filter, countof(g_filter), theApp.GetConfig("filter", 0));
ComboBoxInit(GetDlgItem(m_hWnd, IDC_DITHERING), g_dithering, countof(g_dithering), theApp.GetConfig("dithering", 1));
ComboBoxInit(GetDlgItem(m_hWnd, IDC_ASPECTRATIO), g_aspectratio, countof(g_aspectratio), theApp.GetConfig("AspectRatio", 1));
ComboBoxInit(GetDlgItem(m_hWnd, IDC_SCALE), g_scale, countof(g_scale), theApp.GetConfig("scale_x", 0) | (theApp.GetConfig("scale_y", 0) << 2));
vector<GSSetting> renderers;
for(size_t i = 0; i < countof(g_renderers); i++)
{
if(i == 2 && !isdx10avail) continue;
renderers.push_back(g_renderers[i]);
}
GSSetting::InitComboBox(&renderers[0], renderers.size(), m_renderer, theApp.GetConfig("Renderer", 1));
GSSetting::InitComboBox(g_psversion, countof(g_psversion), m_psversion, theApp.GetConfig("PixelShaderVersion2", D3DPS_VERSION(2, 0)), caps.PixelShaderVersion);
GSSetting::InitComboBox(g_filter, countof(g_filter), m_filter, theApp.GetConfig("filter", 0));
GSSetting::InitComboBox(g_dithering, countof(g_dithering), m_dithering, theApp.GetConfig("dithering", 1));
GSSetting::InitComboBox(g_aspectratio, countof(g_aspectratio), m_aspectratio, theApp.GetConfig("AspectRatio", 1));
GSSetting::InitComboBox(g_internalresolution, countof(g_internalresolution), m_internalresolution, theApp.GetConfig("scale_x", 0) | (theApp.GetConfig("scale_y", 0) << 2));
OnCbnSelchangeCombo1();
//
m_swthreads.SetRange(1, 16);
m_swthreads.SetPos(theApp.GetConfig("swthreads", 1));
//
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_SETRANGE, 0, MAKELPARAM(16, 1));
SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("swthreads", 1), 0));
}
void GPUSettingsDlg::OnOK()
bool GPUSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code)
{
UpdateData();
if(m_resolution.GetCurSel() >= 0)
if(id == IDC_RENDERER && code == CBN_SELCHANGE)
{
D3DDISPLAYMODE& mode = *(D3DDISPLAYMODE*)m_resolution.GetItemData(m_resolution.GetCurSel());
int item = (int)SendMessage(hWnd, CB_GETCURSEL, 0, 0);
theApp.SetConfig("ModeWidth", (int)mode.Width);
theApp.SetConfig("ModeHeight", (int)mode.Height);
theApp.SetConfig("ModeRefreshRate", (int)mode.RefreshRate);
if(item >= 0)
{
int i = (int)SendMessage(hWnd, CB_GETITEMDATA, item, 0);
ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO9), i == 1 ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO10), i == 2 ? SW_SHOW : SW_HIDE);
}
}
else if(id == IDOK)
{
INT_PTR data;
if(ComboBoxGetSelData(GetDlgItem(m_hWnd, IDC_RESOLUTION), data))
{
const D3DDISPLAYMODE* mode = (D3DDISPLAYMODE*)data;
theApp.SetConfig("ModeWidth", (int)mode->Width);
theApp.SetConfig("ModeHeight", (int)mode->Height);
theApp.SetConfig("ModeRefreshRate", (int)mode->RefreshRate);
}
if(ComboBoxGetSelData(GetDlgItem(m_hWnd, IDC_RENDERER), data))
{
theApp.SetConfig("Renderer", (int)data);
}
if(ComboBoxGetSelData(GetDlgItem(m_hWnd, IDC_SHADER), data))
{
theApp.SetConfig("PixelShaderVersion2", (int)data);
}
if(ComboBoxGetSelData(GetDlgItem(m_hWnd, IDC_FILTER), data))
{
theApp.SetConfig("filter", (int)data);
}
if(ComboBoxGetSelData(GetDlgItem(m_hWnd, IDC_DITHERING), data))
{
theApp.SetConfig("dithering", (int)data);
}
if(ComboBoxGetSelData(GetDlgItem(m_hWnd, IDC_ASPECTRATIO), data))
{
theApp.SetConfig("AspectRatio", (int)data);
}
if(ComboBoxGetSelData(GetDlgItem(m_hWnd, IDC_SCALE), data))
{
theApp.SetConfig("scale_x", data & 3);
theApp.SetConfig("scale_y", (data >> 2) & 3);
}
theApp.SetConfig("swthreads", (int)SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_GETPOS, 0, 0));
}
if(m_renderer.GetCurSel() >= 0)
{
theApp.SetConfig("Renderer", (int)m_renderer.GetItemData(m_renderer.GetCurSel()));
}
if(m_psversion.GetCurSel() >= 0)
{
theApp.SetConfig("PixelShaderVersion2", (int)m_psversion.GetItemData(m_psversion.GetCurSel()));
}
if(m_filter.GetCurSel() >= 0)
{
theApp.SetConfig("filter", (int)m_filter.GetItemData(m_filter.GetCurSel()));
}
if(m_dithering.GetCurSel() >= 0)
{
theApp.SetConfig("dithering", (int)m_dithering.GetItemData(m_dithering.GetCurSel()));
}
if(m_aspectratio.GetCurSel() >= 0)
{
theApp.SetConfig("AspectRatio", (int)m_aspectratio.GetItemData(m_aspectratio.GetCurSel()));
}
if(m_internalresolution.GetCurSel() >= 0)
{
int value = (int)m_internalresolution.GetItemData(m_internalresolution.GetCurSel());
theApp.SetConfig("scale_x", value & 3);
theApp.SetConfig("scale_y", (value >> 2) & 3);
}
theApp.SetConfig("swthreads", m_swthreads.GetPos());
__super::OnOK();
}
void GPUSettingsDlg::OnUpdateResolution(CCmdUI* pCmdUI)
{
UpdateData();
int i = (int)m_renderer.GetItemData(m_renderer.GetCurSel());
pCmdUI->Enable(i == 1);
}
void GPUSettingsDlg::OnUpdateD3D9Options(CCmdUI* pCmdUI)
{
int i = (int)m_renderer.GetItemData(m_renderer.GetCurSel());
pCmdUI->Enable(i == 1);
}
void GPUSettingsDlg::OnUpdateSWOptions(CCmdUI* pCmdUI)
{
int i = (int)m_renderer.GetItemData(m_renderer.GetCurSel());
pCmdUI->Enable(i >= 0 && i <= 2);
}
void GPUSettingsDlg::OnCbnSelchangeCombo1()
{
int i = (int)m_renderer.GetItemData(m_renderer.GetCurSel());
GetDlgItem(IDC_LOGO9)->ShowWindow(i == 1 ? SW_SHOW : SW_HIDE);
GetDlgItem(IDC_LOGO10)->ShowWindow(i == 2 ? SW_SHOW : SW_HIDE);
return __super::OnCommand(hWnd, id, code);
}

View File

@ -21,51 +21,24 @@
#pragma once
#include "GSDialog.h"
#include "GSSetting.h"
#include "resource.h"
class GPUSettingsDlg : public CDialog
class GPUSettingsDlg : public GSDialog
{
DECLARE_DYNAMIC(GPUSettingsDlg)
private:
list<D3DDISPLAYMODE> m_modes;
protected:
void OnInit();
bool OnCommand(HWND hWnd, UINT id, UINT code);
public:
GPUSettingsDlg(CWnd* pParent = NULL); // standard constructor
virtual ~GPUSettingsDlg();
GPUSettingsDlg();
static GSSetting g_renderers[];
static GSSetting g_psversion[];
static GSSetting g_filter[];
static GSSetting g_dithering[];
static GSSetting g_aspectratio[];
static GSSetting g_internalresolution[];
// Dialog Data
enum { IDD = IDD_GPUCONFIG };
CComboBox m_resolution;
CComboBox m_renderer;
CComboBox m_psversion;
CComboBox m_filter;
CComboBox m_dithering;
CComboBox m_aspectratio;
CComboBox m_internalresolution;
CSpinButtonCtrl m_swthreads;
CEdit m_swthreadsedit;
protected:
virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL OnInitDialog();
virtual void OnOK();
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnKickIdle();
afx_msg void OnUpdateResolution(CCmdUI* pCmdUI);
afx_msg void OnUpdateD3D9Options(CCmdUI* pCmdUI);
afx_msg void OnUpdateSWOptions(CCmdUI* pCmdUI);
afx_msg void OnCbnSelchangeCombo1();
static GSSetting g_scale[];
};

View File

@ -175,7 +175,7 @@ void GPUState::ReadData(uint8* mem, uint32 size)
{
// ASSERT(0);
TRACE(_T("WARNING: ReadData\n"));
// printf"WARNING: ReadData\n");
// memset(&mem[remaining], 0, bytes - remaining);

View File

@ -138,7 +138,7 @@ static INT32 GSopen(void* dsp, char* title, int mt, int renderer)
s_gs->m_wnd.Show();
*(HWND*)dsp = s_gs->m_wnd;
*(HWND*)dsp = (HWND)s_gs->m_wnd.GetHandle();
// if(mt) _mm_setcsr(MXCSR);
@ -147,12 +147,6 @@ static INT32 GSopen(void* dsp, char* title, int mt, int renderer)
EXPORT_C_(INT32) GSopen(void* dsp, char* title, int mt)
{
#ifdef _WINDOWS
AFX_MANAGE_STATE(AfxGetStaticModuleState());
#endif
int renderer;
if(mt == 2)
@ -259,10 +253,6 @@ EXPORT_C_(int) GSfreeze(int mode, GSFreezeData* data)
EXPORT_C GSconfigure()
{
#ifdef _WINDOWS
AFX_MANAGE_STATE(AfxGetStaticModuleState());
GSSettingsDlg dlg;
if(IDOK == dlg.DoModal())
@ -270,9 +260,6 @@ EXPORT_C GSconfigure()
GSshutdown();
GSinit();
}
#endif
}
EXPORT_C_(INT32) GStest()

View File

@ -403,8 +403,6 @@ bool GSCapture::BeginCapture(int fps)
EndCapture();
AFX_MANAGE_STATE(AfxGetStaticModuleState());
GSCaptureDlg dlg;
if(IDOK != dlg.DoModal()) return false;
@ -412,6 +410,8 @@ bool GSCapture::BeginCapture(int fps)
m_size.x = (dlg.m_width + 7) & ~7;
m_size.y = (dlg.m_height + 7) & ~7;
wstring fn(dlg.m_filename.begin(), dlg.m_filename.end());
//
HRESULT hr;
@ -422,7 +422,7 @@ bool GSCapture::BeginCapture(int fps)
if(FAILED(hr = m_graph.CoCreateInstance(CLSID_FilterGraph))
|| FAILED(hr = cgb.CoCreateInstance(CLSID_CaptureGraphBuilder2))
|| FAILED(hr = cgb->SetFiltergraph(m_graph))
|| FAILED(hr = cgb->SetOutputFileName(&MEDIASUBTYPE_Avi, CStringW(dlg.m_filename), &mux, NULL)))
|| FAILED(hr = cgb->SetOutputFileName(&MEDIASUBTYPE_Avi, fn.c_str(), &mux, NULL)))
{
return false;
}
@ -445,7 +445,8 @@ bool GSCapture::BeginCapture(int fps)
{
CFilterInfo fi;
pBF->QueryFilterInfo(&fi);
printf("Filter [%p]: %s\n", pBF.p, CStringA(fi.achName));
wstring s(fi.achName);
printf("Filter [%p]: %s\n", pBF.p, string(s.begin(), s.end()).c_str());
BeginEnumPins(pBF, pEP, pPin)
{
@ -454,7 +455,8 @@ bool GSCapture::BeginCapture(int fps)
CPinInfo pi;
pPin->QueryPinInfo(&pi);
printf("- Pin [%p - %p]: %s (%s)\n", pPin.p, pPinTo.p, CStringA(pi.achName), pi.dir ? "out" : "in");
wstring s(pi.achName);
printf("- Pin [%p - %p]: %s (%s)\n", pPin.p, pPinTo.p, string(s.begin(), s.end()).c_str(), pi.dir ? "out" : "in");
BeginEnumMediaTypes(pPin, pEMT, pmt)
{

View File

@ -20,230 +20,182 @@
*/
#include "stdafx.h"
#include <afxpriv.h>
#include "GSdx.h"
#include "GSCaptureDlg.h"
// GSCaptureDlg dialog
IMPLEMENT_DYNAMIC(GSCaptureDlg, CDialog)
GSCaptureDlg::GSCaptureDlg(CWnd* pParent /*=NULL*/)
: CDialog(GSCaptureDlg::IDD, pParent)
GSCaptureDlg::GSCaptureDlg()
: GSDialog(IDD_CAPTURE)
{
m_width = theApp.GetConfig("CaptureWidth", 640);
m_height = theApp.GetConfig("CaptureHeight", 480);
m_filename = theApp.GetConfig("CaptureFileName", "").c_str();
}
GSCaptureDlg::~GSCaptureDlg()
{
m_filename = theApp.GetConfig("CaptureFileName", "");
}
int GSCaptureDlg::GetSelCodec(Codec& c)
{
int iSel = m_codeclist.GetCurSel();
INT_PTR data = 0;
if(iSel < 0) return 0;
Codec* codec = (Codec*)m_codeclist.GetItemDataPtr(iSel);
if(codec == NULL) return 2;
c = *codec;
if(!c.filter)
if(ComboBoxGetSelData(GetDlgItem(m_hWnd, IDC_CODECS), data))
{
c.moniker->BindToObject(NULL, NULL, __uuidof(IBaseFilter), (void**)&c.filter);
if(data == 0) return 2;
if(!c.filter) return 0;
c = *(Codec*)data;
if(!c.filter)
{
c.moniker->BindToObject(NULL, NULL, __uuidof(IBaseFilter), (void**)&c.filter);
if(!c.filter) return 0;
}
return 1;
}
return 1;
return 0;
}
LRESULT GSCaptureDlg::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
void GSCaptureDlg::OnInit()
{
LRESULT ret = __super::DefWindowProc(message, wParam, lParam);
__super::OnInit();
if(message == WM_INITDIALOG) SendMessage(WM_KICKIDLE);
return(ret);
}
void GSCaptureDlg::DoDataExchange(CDataExchange* pDX)
{
__super::DoDataExchange(pDX);
DDX_Text(pDX, IDC_EDIT1, m_filename);
DDX_Control(pDX, IDC_COMBO1, m_codeclist);
DDX_Text(pDX, IDC_EDIT2, m_width);
DDX_Text(pDX, IDC_EDIT4, m_height);
}
BOOL GSCaptureDlg::OnInitDialog()
{
__super::OnInitDialog();
SetTextAsInt(IDC_WIDTH, m_width);
SetTextAsInt(IDC_HEIGHT, m_height);
SetText(IDC_FILENAME, m_filename.c_str());
m_codecs.clear();
m_codeclist.ResetContent();
m_codeclist.SetItemDataPtr(m_codeclist.AddString(_T("Uncompressed")), NULL);
string selected = theApp.GetConfig("CaptureVideoCodecDisplayName", "");
HWND hWnd = GetDlgItem(m_hWnd, IDC_CODECS);
ComboBoxAppend(hWnd, "Uncompressed", 0, true);
BeginEnumSysDev(CLSID_VideoCompressorCategory, moniker)
{
Codec c;
c.moniker = moniker;
LPOLESTR strName = NULL;
if(FAILED(moniker->GetDisplayName(NULL, NULL, &strName)))
wstring prefix;
LPOLESTR str = NULL;
if(FAILED(moniker->GetDisplayName(NULL, NULL, &str)))
continue;
c.DisplayName = strName;
CoTaskMemFree(strName);
if(wcsstr(str, L"@device:dmo:")) prefix = L"(DMO) ";
else if(wcsstr(str, L"@device:sw:")) prefix = L"(DS) ";
else if(wcsstr(str, L"@device:cm:")) prefix = L"(VfW) ";
c.DisplayName = str;
CoTaskMemFree(str);
CComPtr<IPropertyBag> pPB;
moniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB);
if(FAILED(moniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB)))
continue;
CComVariant var;
if(FAILED(pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL)))
continue;
c.FriendlyName = var.bstrVal;
CStringW str = CStringW(c.DisplayName).MakeLower();
CString prefix;
if(str.Find(L"@device:dmo:") == 0) prefix = _T("(DMO) ");
else if(str.Find(L"@device:sw:") == 0) prefix = _T("(DS) ");
else if(str.Find(L"@device:cm:") == 0) prefix = _T("(VfW) ");
c.FriendlyName = prefix + c.FriendlyName;
c.FriendlyName = prefix + var.bstrVal;
m_codecs.push_back(c);
m_codeclist.SetItemDataPtr(m_codeclist.AddString(c.FriendlyName), &m_codecs.back());
string s(c.FriendlyName.begin(), c.FriendlyName.end());
ComboBoxAppend(hWnd, s.c_str(), (LPARAM)&m_codecs.back(), s == selected);
}
EndEnumSysDev
}
//
CString DisplayNameToFind = theApp.GetConfig("CaptureVideoCodecDisplayName", "").c_str();
for(int i = 0; i < m_codeclist.GetCount(); i++)
bool GSCaptureDlg::OnCommand(HWND hWnd, UINT id, UINT code)
{
if(id == IDC_BROWSE && code == BN_CLICKED)
{
CString DisplayName;
char buff[MAX_PATH] = {0};
Codec* codec = (Codec*)m_codeclist.GetItemDataPtr(i);
OPENFILENAME ofn;
if(codec)
memset(&ofn, 0, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = m_hWnd;
ofn.lpstrFile = buff;
ofn.nMaxFile = countof(buff);
ofn.lpstrFilter = "Avi files (*.avi)\0*.avi\0";
ofn.Flags = OFN_EXPLORER | OFN_ENABLESIZING | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST;
strcpy(ofn.lpstrFile, m_filename.c_str());
if(GetSaveFileName(&ofn))
{
DisplayName = codec->DisplayName;
m_filename = ofn.lpstrFile;
SetText(IDC_FILENAME, m_filename.c_str());
}
if(DisplayName == DisplayNameToFind)
{
m_codeclist.SetCurSel(i);
break;
}
return true;
}
//
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BEGIN_MESSAGE_MAP(GSCaptureDlg, CDialog)
ON_MESSAGE_VOID(WM_KICKIDLE, OnKickIdle)
ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2)
ON_UPDATE_COMMAND_UI(IDC_BUTTON2, OnUpdateButton2)
ON_BN_CLICKED(IDOK, OnBnClickedOk)
ON_UPDATE_COMMAND_UI(IDOK, OnUpdateOK)
END_MESSAGE_MAP()
// GSCaptureDlg message handlers
void GSCaptureDlg::OnKickIdle()
{
UpdateDialogControls(this, false);
}
void GSCaptureDlg::OnBnClickedButton1()
{
UpdateData();
DWORD flags = OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST;
CFileDialog fd(FALSE, _T("avi"), m_filename, flags, _T("Avi files (*.avi)|*.avi||"), this, 0);
if(fd.DoModal() == IDOK)
else if(id == IDC_CONFIGURE && code == BN_CLICKED)
{
m_filename = fd.GetPathName();
Codec c;
UpdateData(FALSE);
}
}
void GSCaptureDlg::OnBnClickedButton2()
{
Codec c;
if(GetSelCodec(c) != 1) return;
if(CComQIPtr<ISpecifyPropertyPages> pSPP = c.filter)
{
CAUUID caGUID;
memset(&caGUID, 0, sizeof(caGUID));
if(SUCCEEDED(pSPP->GetPages(&caGUID)))
if(GetSelCodec(c) == 1)
{
IUnknown* lpUnk = NULL;
pSPP.QueryInterface(&lpUnk);
OleCreatePropertyFrame(m_hWnd, 0, 0, CStringW(c.FriendlyName), 1, (IUnknown**)&lpUnk, caGUID.cElems, caGUID.pElems, 0, 0, NULL);
lpUnk->Release();
if(CComQIPtr<ISpecifyPropertyPages> pSPP = c.filter)
{
CAUUID caGUID;
if(caGUID.pElems) CoTaskMemFree(caGUID.pElems);
memset(&caGUID, 0, sizeof(caGUID));
if(SUCCEEDED(pSPP->GetPages(&caGUID)))
{
IUnknown* lpUnk = NULL;
pSPP.QueryInterface(&lpUnk);
OleCreatePropertyFrame(m_hWnd, 0, 0, c.FriendlyName.c_str(), 1, (IUnknown**)&lpUnk, caGUID.cElems, caGUID.pElems, 0, 0, NULL);
lpUnk->Release();
if(caGUID.pElems) CoTaskMemFree(caGUID.pElems);
}
}
else if(CComQIPtr<IAMVfwCompressDialogs> pAMVfWCD = c.filter)
{
if(pAMVfWCD->ShowDialog(VfwCompressDialog_QueryConfig, NULL) == S_OK)
{
pAMVfWCD->ShowDialog(VfwCompressDialog_Config, m_hWnd);
}
}
}
return true;
}
else if(CComQIPtr<IAMVfwCompressDialogs> pAMVfWCD = c.filter)
else if(id == IDOK)
{
if(pAMVfWCD->ShowDialog(VfwCompressDialog_QueryConfig, NULL) == S_OK)
m_width = GetTextAsInt(IDC_WIDTH);
m_height = GetTextAsInt(IDC_HEIGHT);
m_filename = GetText(IDC_FILENAME);
Codec c;
if(GetSelCodec(c) == 0)
{
pAMVfWCD->ShowDialog(VfwCompressDialog_Config, m_hWnd);
return false;
}
m_enc = c.filter;
theApp.SetConfig("CaptureWidth", m_width);
theApp.SetConfig("CaptureHeight", m_height);
theApp.SetConfig("CaptureFileName", m_filename.c_str());
wstring s = wstring(c.DisplayName.m_str);
theApp.SetConfig("CaptureVideoCodecDisplayName", string(s.begin(), s.end()).c_str());
}
}
void GSCaptureDlg::OnUpdateButton2(CCmdUI* pCmdUI)
{
pCmdUI->Enable(m_codeclist.GetCurSel() >= 0 && m_codeclist.GetItemDataPtr(m_codeclist.GetCurSel()) != NULL);
}
void GSCaptureDlg::OnBnClickedOk()
{
UpdateData();
Codec c;
if(GetSelCodec(c) == 0) return;
m_enc = c.filter;
theApp.SetConfig("CaptureWidth", m_width);
theApp.SetConfig("CaptureHeight", m_height);
theApp.SetConfig("CaptureFileName", m_filename);
theApp.SetConfig("CaptureVideoCodecDisplayName", CString(c.DisplayName));
OnOK();
}
void GSCaptureDlg::OnUpdateOK(CCmdUI* pCmdUI)
{
CString str;
GetDlgItem(IDC_EDIT1)->GetWindowText(str);
pCmdUI->Enable(!str.IsEmpty() && m_codeclist.GetCurSel() >= 0);
return __super::OnCommand(hWnd, id, code);
}

View File

@ -21,21 +21,17 @@
#pragma once
#include "GSDialog.h"
#include "resource.h"
#include "baseclasses/streams.h"
// GSCaptureDlg dialog
class GSCaptureDlg : public CDialog
class GSCaptureDlg : public GSDialog
{
DECLARE_DYNAMIC(GSCaptureDlg)
private:
struct Codec
{
CComPtr<IMoniker> moniker;
CComPtr<IBaseFilter> filter;
CString FriendlyName;
wstring FriendlyName;
CComBSTR DisplayName;
};
@ -43,31 +39,15 @@ private:
int GetSelCodec(Codec& c);
public:
GSCaptureDlg(CWnd* pParent = NULL); // standard constructor
virtual ~GSCaptureDlg();
CComPtr<IBaseFilter> m_enc;
// Dialog Data
enum { IDD = IDD_CAPTURE };
CString m_filename;
CComboBox m_codeclist;
protected:
virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL OnInitDialog();
DECLARE_MESSAGE_MAP()
void OnInit();
bool OnCommand(HWND hWnd, UINT id, UINT code);
public:
afx_msg void OnKickIdle();
afx_msg void OnBnClickedButton1();
afx_msg void OnBnClickedButton2();
afx_msg void OnUpdateButton2(CCmdUI* pCmdUI);
afx_msg void OnBnClickedOk();
afx_msg void OnUpdateOK(CCmdUI* pCmdUI);
GSCaptureDlg();
int m_width;
int m_height;
string m_filename;
CComPtr<IBaseFilter> m_enc;
};

View File

@ -131,6 +131,7 @@ CRC::Game CRC::m_games[] =
{0xAA5EC3A3, TalesOfAbyss, JP},
{0xFB236A46, SonicUnleashed, US},
{0x4C7BB3C8, SimpsonsGame, Unknown},
{0x4C94B32C, SimpsonsGame, Unknown},
};
hash_map<uint32, CRC::Game*> CRC::m_map;

View File

@ -23,7 +23,7 @@
#include "GSDevice.h"
GSDevice::GSDevice()
: m_hWnd(NULL)
: m_wnd(NULL)
, m_backbuffer(NULL)
, m_merge(NULL)
, m_weavebob(NULL)
@ -36,9 +36,9 @@ GSDevice::~GSDevice()
{
}
bool GSDevice::Create(HWND hWnd, bool vsync)
bool GSDevice::Create(GSWnd* wnd, bool vsync)
{
m_hWnd = hWnd;
m_wnd = wnd;
m_vsync = vsync;
return true;
@ -72,9 +72,7 @@ bool GSDevice::Reset(int w, int h, bool fs)
void GSDevice::Present(const GSVector4i& r, int shader)
{
GSVector4i cr;
GetClientRect(m_hWnd, cr);
GSVector4i cr = m_wnd->GetClientRect();
if(m_backbuffer->GetWidth() != cr.width() || m_backbuffer->GetHeight() != cr.height())
{
@ -171,7 +169,7 @@ void GSDevice::Merge(GSTexture* st[2], GSVector4* sr, GSVector4* dr, const GSVec
m_current = m_merge;
}
bool GSDevice::Interlace(const GSVector2i& ds, int field, int mode, float yoffset)
void GSDevice::Interlace(const GSVector2i& ds, int field, int mode, float yoffset)
{
if(!m_weavebob || !(m_weavebob->GetSize() == ds))
{
@ -212,6 +210,4 @@ bool GSDevice::Interlace(const GSVector2i& ds, int field, int mode, float yoffse
{
m_current = m_merge;
}
return true;
}

View File

@ -21,6 +21,7 @@
#pragma once
#include "GSWnd.h"
#include "GSTexture.h"
#include "GSVertex.h"
#include "GSAlignedClass.h"
@ -52,7 +53,7 @@ class GSDevice : public GSAlignedClass<16>
GSTexture* Fetch(int type, int w, int h, int format);
protected:
HWND m_hWnd;
GSWnd* m_wnd;
bool m_vsync;
GSTexture* m_backbuffer;
GSTexture* m_merge;
@ -72,7 +73,7 @@ public:
void Recycle(GSTexture* t);
virtual bool Create(HWND hWnd, bool vsync);
virtual bool Create(GSWnd* wnd, bool vsync);
virtual bool Reset(int w, int h, bool fs);
virtual bool IsLost() {return false;}
@ -101,7 +102,7 @@ public:
virtual bool IsCurrentRGBA() {return true;}
void Merge(GSTexture* st[2], GSVector4* sr, GSVector4* dr, const GSVector2i& fs, bool slbg, bool mmod, const GSVector4& c);
bool Interlace(const GSVector2i& ds, int field, int mode, float yoffset);
void Interlace(const GSVector2i& ds, int field, int mode, float yoffset);
virtual void PSSetShaderResources(GSTexture* sr0, GSTexture* sr1) {}
virtual void OMSetRenderTargets(GSTexture* rt, GSTexture* ds) {};

View File

@ -20,6 +20,7 @@
*/
#include "stdafx.h"
#include "GSdx.h"
#include "GSDevice10.h"
#include "resource.h"
@ -55,9 +56,9 @@ GSDevice10::~GSDevice10()
{
}
bool GSDevice10::Create(HWND hWnd, bool vsync)
bool GSDevice10::Create(GSWnd* wnd, bool vsync)
{
if(!__super::Create(hWnd, vsync))
if(!__super::Create(wnd, vsync))
{
return false;
}
@ -80,7 +81,7 @@ bool GSDevice10::Create(HWND hWnd, bool vsync)
//scd.BufferDesc.RefreshRate.Numerator = 60;
//scd.BufferDesc.RefreshRate.Denominator = 1;
scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
scd.OutputWindow = hWnd;
scd.OutputWindow = (HWND)m_wnd->GetHandle();
scd.SampleDesc.Count = 1;
scd.SampleDesc.Quality = 0;
scd.Windowed = TRUE;
@ -748,7 +749,7 @@ HRESULT GSDevice10::CompileShader(uint32 id, const string& entry, D3D10_SHADER_M
CComPtr<ID3D10Blob> shader, error;
hr = D3DX10CompileFromResource(AfxGetInstanceHandle(), MAKEINTRESOURCE(id), NULL, macro, NULL, entry.c_str(), "vs_4_0", 0, 0, NULL, &shader, &error, NULL);
hr = D3DX10CompileFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), NULL, macro, NULL, entry.c_str(), "vs_4_0", 0, 0, NULL, &shader, &error, NULL);
if(error)
{
@ -783,7 +784,7 @@ HRESULT GSDevice10::CompileShader(uint32 id, const string& entry, D3D10_SHADER_M
CComPtr<ID3D10Blob> shader, error;
hr = D3DX10CompileFromResource(AfxGetInstanceHandle(), MAKEINTRESOURCE(id), NULL, macro, NULL, entry.c_str(), "gs_4_0", 0, 0, NULL, &shader, &error, NULL);
hr = D3DX10CompileFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), NULL, macro, NULL, entry.c_str(), "gs_4_0", 0, 0, NULL, &shader, &error, NULL);
if(error)
{
@ -811,7 +812,7 @@ HRESULT GSDevice10::CompileShader(uint32 id, const string& entry, D3D10_SHADER_M
CComPtr<ID3D10Blob> shader, error;
hr = D3DX10CompileFromResource(AfxGetInstanceHandle(), MAKEINTRESOURCE(id), NULL, macro, NULL, entry.c_str(), "ps_4_0", 0, 0, NULL, &shader, &error, NULL);
hr = D3DX10CompileFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), NULL, macro, NULL, entry.c_str(), "ps_4_0", 0, 0, NULL, &shader, &error, NULL);
if(error)
{

View File

@ -96,7 +96,7 @@ public:
GSDevice10();
virtual ~GSDevice10();
bool Create(HWND hWnd, bool vsync);
bool Create(GSWnd* wnd, bool vsync);
bool Reset(int w, int h, bool fs);
void Flip();

View File

@ -32,9 +32,9 @@ GSDevice7::~GSDevice7()
{
}
bool GSDevice7::Create(HWND hWnd, bool vsync)
bool GSDevice7::Create(GSWnd* wnd, bool vsync)
{
if(!__super::Create(hWnd, vsync))
if(!__super::Create(wnd, vsync))
{
return false;
}
@ -44,6 +44,8 @@ bool GSDevice7::Create(HWND hWnd, bool vsync)
return false;
}
HWND hWnd = (HWND)m_wnd->GetHandle();
// TODO: fullscreen
if(FAILED(m_dd->SetCooperativeLevel(hWnd, DDSCL_NORMAL)))
@ -135,9 +137,7 @@ void GSDevice7::Present(const GSVector4i& r, int shader)
{
HRESULT hr;
GSVector4i cr;
GetClientRect(m_hWnd, cr);
GSVector4i cr = m_wnd->GetClientRect();
if(m_backbuffer->GetWidth() != cr.width() || m_backbuffer->GetHeight() != cr.height())
{
@ -163,7 +163,7 @@ void GSDevice7::Present(const GSVector4i& r, int shader)
r2 = cr;
MapWindowPoints(m_hWnd, HWND_DESKTOP, (POINT*)&r2, 2);
MapWindowPoints((HWND)m_wnd->GetHandle(), HWND_DESKTOP, (POINT*)&r2, 2);
if(m_vsync)
{

View File

@ -39,7 +39,7 @@ public:
GSDevice7();
virtual ~GSDevice7();
bool Create(HWND hWnd, bool vsync);
bool Create(GSWnd* wnd, bool vsync);
bool Reset(int w, int h, bool fs);
void Present(const GSVector4i& r, int shader);

View File

@ -61,9 +61,9 @@ GSDevice9::~GSDevice9()
if(m_ps_cb) _aligned_free(m_ps_cb);
}
bool GSDevice9::Create(HWND hWnd, bool vsync)
bool GSDevice9::Create(GSWnd* wnd, bool vsync)
{
if(!__super::Create(hWnd, vsync))
if(!__super::Create(wnd, vsync))
{
return false;
}
@ -118,13 +118,12 @@ bool GSDevice9::Create(HWND hWnd, bool vsync)
if(psver > m_d3dcaps.PixelShaderVersion)
{
CString str;
str.Format(_T("Supported pixel shader version is too low!\n\nSupported: %d.%d\nSelected: %d.%d"),
string s = format(
"Supported pixel shader version is too low!\n\nSupported: %d.%d\nSelected: %d.%d",
D3DSHADER_VERSION_MAJOR(m_d3dcaps.PixelShaderVersion), D3DSHADER_VERSION_MINOR(m_d3dcaps.PixelShaderVersion),
D3DSHADER_VERSION_MAJOR(psver), D3DSHADER_VERSION_MINOR(psver));
AfxMessageBox(str);
MessageBox(NULL, s.c_str(), "GSdx", MB_OK);
return false;
}
@ -251,7 +250,7 @@ bool GSDevice9::Reset(int w, int h, bool fs)
memset(&m_pp, 0, sizeof(m_pp));
m_pp.Windowed = TRUE;
m_pp.hDeviceWindow = m_hWnd;
m_pp.hDeviceWindow = (HWND)m_wnd->GetHandle();
m_pp.SwapEffect = D3DSWAPEFFECT_FLIP;
m_pp.BackBufferFormat = D3DFMT_X8R8G8B8;
m_pp.BackBufferWidth = 1;
@ -276,16 +275,14 @@ bool GSDevice9::Reset(int w, int h, bool fs)
m_pp.BackBufferHeight = mh;
// m_pp.FullScreen_RefreshRateInHz = mrr;
::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);
::SetMenu(m_hWnd, NULL);
m_wnd->HideFrame();
}
if(!m_dev)
{
uint32 flags = D3DCREATE_MULTITHREADED | (m_d3dcaps.VertexProcessingCaps ? D3DCREATE_HARDWARE_VERTEXPROCESSING : D3DCREATE_SOFTWARE_VERTEXPROCESSING);
hr = m_d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, m_hWnd, flags, &m_pp, &m_dev);
hr = m_d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, (HWND)m_wnd->GetHandle(), flags, &m_pp, &m_dev);
if(FAILED(hr)) return false;
}
@ -516,7 +513,8 @@ GSTexture* GSDevice9::CreateRenderTarget(int w, int h, int format)
GSTexture* GSDevice9::CreateDepthStencil(int w, int h, int format)
{
return __super::CreateDepthStencil(w, h, format ? format : D3DFMT_D24S8); // D3DFMT_D32F_LOCKABLE
return __super::CreateDepthStencil(w, h, format ? format : D3DFMT_D24S8);
// return __super::CreateDepthStencil(w, h, format ? format : D3DFMT_D32F_LOCKABLE);
}
GSTexture* GSDevice9::CreateTexture(int w, int h, int format)
@ -946,15 +944,15 @@ static HRESULT LoadShader(uint32 id, LPCSTR& data, uint32& size)
{
CComPtr<ID3DXBuffer> shader, error;
HRSRC hRes = FindResource(AfxGetResourceHandle(), MAKEINTRESOURCE(id), RT_RCDATA);
HRSRC hRes = FindResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), RT_RCDATA);
if(!hRes) return E_FAIL;
size = SizeofResource(AfxGetResourceHandle(), hRes);
size = SizeofResource(theApp.GetModuleHandle(), hRes);
if(size == 0) return E_FAIL;
HGLOBAL hResData = LoadResource(AfxGetResourceHandle(), hRes);
HGLOBAL hResData = LoadResource(theApp.GetModuleHandle(), hRes);
if(!hResData) return E_FAIL;
@ -984,7 +982,7 @@ HRESULT GSDevice9::CompileShader(uint32 id, const string& entry, const D3DXMACRO
CComPtr<ID3DXBuffer> shader, error;
// FIXME: hr = D3DXCompileShaderFromResource(AfxGetResourceHandle(), MAKEINTRESOURCE(id), macro, NULL, entry.c_str(), target, 0, &shader, &error, NULL);
// FIXME: hr = D3DXCompileShaderFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), macro, NULL, entry.c_str(), target, 0, &shader, &error, NULL);
LPCSTR data;
uint32 size;
@ -1044,7 +1042,7 @@ HRESULT GSDevice9::CompileShader(uint32 id, const string& entry, const D3DXMACRO
CComPtr<ID3DXBuffer> shader, error;
// FIXME: hr = D3DXCompileShaderFromResource(AfxGetResourceHandle(), MAKEINTRESOURCE(id), macro, NULL, entry.c_str(), target, flags, &shader, &error, NULL);
// FIXME: hr = D3DXCompileShaderFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), macro, NULL, entry.c_str(), target, flags, &shader, &error, NULL);
LPCSTR data;
uint32 size;

View File

@ -132,7 +132,7 @@ public:
GSDevice9();
virtual ~GSDevice9();
bool Create(HWND hWnd, bool vsync);
bool Create(GSWnd* wnd, bool vsync);
bool Reset(int w, int h, bool fs);
bool IsLost();

View File

@ -22,9 +22,9 @@
#include "stdafx.h"
#include "GSDeviceNull.h"
bool GSDeviceNull::Create(HWND hWnd, bool vsync)
bool GSDeviceNull::Create(GSWnd* wnd, bool vsync)
{
if(!__super::Create(hWnd, vsync))
if(!__super::Create(wnd, vsync))
{
return false;
}

View File

@ -35,6 +35,6 @@ private:
public:
GSDeviceNull() {}
bool Create(HWND hWnd, bool vsync);
bool Create(GSWnd* wnd, bool vsync);
bool Reset(int w, int h, bool fs);
};

170
plugins/GSdx/GSDialog.cpp Normal file
View File

@ -0,0 +1,170 @@
/*
* Copyright (C) 2007-2009 Gabest
* http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#include "StdAfx.h"
#include "GSdx.h"
#include "GSDialog.h"
#include "GSVector.h"
GSDialog::GSDialog(UINT id)
: m_id(id)
, m_hWnd(NULL)
{
}
INT_PTR GSDialog::DoModal()
{
return DialogBoxParam(theApp.GetModuleHandle(), MAKEINTRESOURCE(m_id), NULL, DialogProc, (LPARAM)this);
}
INT_PTR CALLBACK GSDialog::DialogProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
GSDialog* dlg = NULL;
if(message == WM_INITDIALOG)
{
dlg = (GSDialog*)lParam;
SetWindowLongPtr(hWnd, GWL_USERDATA, (LONG_PTR)dlg);
dlg->m_hWnd = hWnd;
MONITORINFO mi;
mi.cbSize = sizeof(mi);
GetMonitorInfo(MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST), &mi);
GSVector4i r;
GetWindowRect(hWnd, r);
int x = (mi.rcWork.left + mi.rcWork.right - r.width()) / 2;
int y = (mi.rcWork.top + mi.rcWork.bottom - r.height()) / 2;
SetWindowPos(hWnd, NULL, x, y, -1, -1, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
dlg->OnInit();
return true;
}
dlg = (GSDialog*)GetWindowLongPtr(hWnd, GWL_USERDATA);
return dlg != NULL ? dlg->OnMessage(message, wParam, lParam) : FALSE;
}
bool GSDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
return message == WM_COMMAND ? OnCommand((HWND)lParam, LOWORD(wParam), HIWORD(wParam)) : false;
}
bool GSDialog::OnCommand(HWND hWnd, UINT id, UINT code)
{
if(id == IDOK || id == IDCANCEL)
{
EndDialog(m_hWnd, id);
return true;
}
return false;
}
string GSDialog::GetText(UINT id)
{
string s;
char* buff = NULL;
for(int size = 256, limit = 65536; size < limit; size <<= 1)
{
buff = new char[size];
if(GetDlgItemText(m_hWnd, id, buff, size))
{
s = buff;
size = limit;
}
delete [] buff;
}
return s;
}
int GSDialog::GetTextAsInt(UINT id)
{
return atoi(GetText(id).c_str());
}
void GSDialog::SetText(UINT id, const char* str)
{
SetDlgItemText(m_hWnd, id, str);
}
void GSDialog::SetTextAsInt(UINT id, int i)
{
char buff[32] = {0};
itoa(i, buff, 10);
SetText(id, buff);
}
void GSDialog::ComboBoxInit(HWND hWnd, const GSSetting* settings, int count, uint32 selid, uint32 maxid)
{
for(int i = 0; i < count; i++)
{
if(settings[i].id <= maxid)
{
string str = settings[i].name;
if(settings[i].note != NULL)
{
str = str + " (" + settings[i].note + ")";
}
ComboBoxAppend(hWnd, str.c_str(), (LPARAM)settings[i].id, settings[i].id == selid);
}
}
}
int GSDialog::ComboBoxAppend(HWND hWnd, const char* str, LPARAM data, bool select)
{
int item = (int)SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)str);
SendMessage(hWnd, CB_SETITEMDATA, item, (LPARAM)data);
if(select)
{
SendMessage(hWnd, CB_SETCURSEL, item, 0);
}
return item;
}
bool GSDialog::ComboBoxGetSelData(HWND hWnd, INT_PTR& data)
{
int item = SendMessage(hWnd, CB_GETCURSEL, 0, 0);
if(item >= 0)
{
data = SendMessage(hWnd, CB_GETITEMDATA, item, 0);
return true;
}
return false;
}

54
plugins/GSdx/GSDialog.h Normal file
View File

@ -0,0 +1,54 @@
/*
* Copyright (C) 2007-2009 Gabest
* http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#pragma once
#include "GSSetting.h"
class GSDialog
{
int m_id;
static INT_PTR CALLBACK DialogProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
protected:
HWND m_hWnd;
virtual void OnInit() {}
virtual bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
virtual bool OnCommand(HWND hWnd, UINT id, UINT code);
public:
GSDialog(UINT id);
virtual ~GSDialog() {}
INT_PTR DoModal();
string GetText(UINT id);
int GetTextAsInt(UINT id);
void SetText(UINT id, const char* str);
void SetTextAsInt(UINT id, int i);
static void ComboBoxInit(HWND hWnd, const GSSetting* settings, int count, uint32 selid, uint32 maxid = ~0);
static int ComboBoxAppend(HWND hWnd, const char* str, LPARAM data = 0, bool select = false);
static bool ComboBoxGetSelData(HWND hWnd, INT_PTR& data);
};

View File

@ -469,10 +469,7 @@ GSLocalMemory::~GSLocalMemory()
{
Offset* o = (*i).second;
for(int i = 0; i < countof(o->col); i++)
{
_aligned_free(o->col);
}
_aligned_free(o->col[0]);
_aligned_free(o);
}

View File

@ -56,7 +56,7 @@ bool GSRenderer::Create(const string& title)
ASSERT(m_dev);
if(!m_dev->Create(m_wnd, m_vsync))
if(!m_dev->Create(&m_wnd, m_vsync))
{
return false;
}
@ -243,10 +243,7 @@ bool GSRenderer::Merge(int field)
int field2 = 1 - ((m_interlace - 1) & 1);
int mode = (m_interlace - 1) >> 1;
if(!m_dev->Interlace(ds, field ^ field2, mode, tex[1]->m_scale.y))
{
return false;
}
m_dev->Interlace(ds, field ^ field2, mode, tex[1]->m_scale.y);
}
}
@ -268,25 +265,20 @@ void GSRenderer::VSync(int field)
// osd
static uint64 s_frame = 0;
static string s_stats;
if(m_perfmon.GetFrame() - s_frame >= 30)
if((m_perfmon.GetFrame() & 0x1f) == 0)
{
m_perfmon.Update();
s_frame = m_perfmon.GetFrame();
double fps = 1000.0f / m_perfmon.Get(GSPerfMon::Frame);
string s = m_regs->SMODE2.INT ? (string("Interlaced ") + (m_regs->SMODE2.FFMD ? "(frame)" : "(field)")) : "Progressive";
string s2 = m_regs->SMODE2.INT ? (string("Interlaced ") + (m_regs->SMODE2.FFMD ? "(frame)" : "(field)")) : "Progressive";
GSVector4i r = GetDisplayRect();
s_stats = format(
string s = format(
"%I64d | %d x %d | %.2f fps (%d%%) | %s - %s | %s | %d/%d/%d | %d%% CPU | %.2f | %.2f",
m_perfmon.GetFrame(), r.width(), r.height(), fps, (int)(100.0 * fps / GetFPS()),
s.c_str(),
s2.c_str(),
GSSettingsDlg::g_interlace[m_interlace].name,
GSSettingsDlg::g_aspectratio[m_aspectratio].name,
(int)m_perfmon.Get(GSPerfMon::Quad),
@ -301,15 +293,15 @@ void GSRenderer::VSync(int field)
if(fillrate > 0)
{
s_stats += format(" | %.2f mpps", fps * fillrate / (1024 * 1024));
s += format(" | %.2f mpps", fps * fillrate / (1024 * 1024));
}
if(m_capture.IsCapturing())
{
s_stats += " | Recording...";
s += " | Recording...";
}
m_wnd.SetWindowText(s_stats.c_str());
m_wnd.SetWindowText(s.c_str());
}
if(m_frameskip)
@ -324,11 +316,7 @@ void GSRenderer::VSync(int field)
ResetDevice();
}
GSVector4i r;
m_wnd.GetClientRect(r);
m_dev->Present(r.fit(m_aspectratio), m_shader);
m_dev->Present(m_wnd.GetClientRect().fit(m_aspectratio), m_shader);
// snapshot
@ -389,6 +377,23 @@ void GSRenderer::VSync(int field)
}
}
bool GSRenderer::MakeSnapshot(const string& path)
{
if(m_snapshot.empty())
{
time_t t = time(NULL);
char buff[16];
if(strftime(buff, sizeof(buff), "%Y%m%d%H%M%S", localtime(&t)))
{
m_snapshot = format("%s_%s", path.c_str(), buff);
}
}
return true;
}
void GSRenderer::KeyEvent(GSKeyEventData* e)
{
if(e->type == KEYPRESS)
@ -422,19 +427,3 @@ void GSRenderer::KeyEvent(GSKeyEventData* e)
}
}
bool GSRenderer::MakeSnapshot(const string& path)
{
if(m_snapshot.empty())
{
time_t t = time(NULL);
char buff[16];
if(strftime(buff, sizeof(buff), "%Y%m%d%H%M%S", localtime(&t)))
{
m_snapshot = format("%s_%s", path.c_str(), buff);
}
}
return true;
}

View File

@ -63,10 +63,9 @@ public:
virtual ~GSRenderer();
virtual bool Create(const string& title);
virtual void VSync(int field);
virtual void KeyEvent(GSKeyEventData* e);
virtual bool MakeSnapshot(const string& path);
virtual void KeyEvent(GSKeyEventData* e);
virtual void MinMaxUV(int w, int h, GSVector4i& r)
{
@ -225,7 +224,7 @@ public:
{
}
~GSRendererT()
virtual ~GSRendererT()
{
if(m_vertices) _aligned_free(m_vertices);
}

View File

@ -271,14 +271,14 @@ protected:
void InvalidateVideoMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r)
{
TRACE(_T("[%d] InvalidateVideoMem %d,%d - %d,%d %05x (%d)\n"), (int)m_perfmon.GetFrame(), r.left, r.top, r.right, r.bottom, (int)BITBLTBUF.DBP, (int)BITBLTBUF.DPSM);
// printf("[%d] InvalidateVideoMem %d,%d - %d,%d %05x (%d)\n", (int)m_perfmon.GetFrame(), r.left, r.top, r.right, r.bottom, (int)BITBLTBUF.DBP, (int)BITBLTBUF.DPSM);
m_tc->InvalidateVideoMem(BITBLTBUF, r);
}
void InvalidateLocalMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r)
{
TRACE(_T("[%d] InvalidateLocalMem %d,%d - %d,%d %05x (%d)\n"), (int)m_perfmon.GetFrame(), r.left, r.top, r.right, r.bottom, (int)BITBLTBUF.SBP, (int)BITBLTBUF.SPSM);
// printf("[%d] InvalidateLocalMem %d,%d - %d,%d %05x (%d)\n", (int)m_perfmon.GetFrame(), r.left, r.top, r.right, r.bottom, (int)BITBLTBUF.SBP, (int)BITBLTBUF.SPSM);
m_tc->InvalidateLocalMem(BITBLTBUF, r);
}

View File

@ -25,8 +25,6 @@
#include "GSTextureCacheSW.h"
#include "GSDrawScanline.h"
extern const GSVector4 g_pos_scale;
class GSRendererSW : public GSRendererT<GSVertexSW>
{
protected:

View File

@ -23,23 +23,7 @@
struct GSSetting
{
DWORD id;
const TCHAR* name;
const TCHAR* note;
static void InitComboBox(const GSSetting* settings, int count, CComboBox& combobox, DWORD sel, DWORD maxid = ~0)
{
for(int i = 0; i < count; i++)
{
if(settings[i].id <= maxid)
{
CString str = settings[i].name;
if(settings[i].note != NULL) str = str + _T(" (") + settings[i].note + _T(")");
int item = combobox.AddString(str);
combobox.SetItemData(item, settings[i].id);
if(settings[i].id == sel) combobox.SetCurSel(item);
}
}
}
uint32 id;
const char* name;
const char* note;
};

View File

@ -23,123 +23,55 @@
#include "GSdx.h"
#include "GSSettingsDlg.h"
#include "GSUtil.h"
#include <shlobj.h>
#include <afxpriv.h>
#include "resource.h"
GSSetting GSSettingsDlg::g_renderers[] =
{
{0, _T("Direct3D9 (Hardware)"), NULL},
{1, _T("Direct3D9 (Software)"), NULL},
{2, _T("Direct3D9 (Null)"), NULL},
{3, _T("Direct3D10 (Hardware)"), NULL},
{4, _T("Direct3D10 (Software)"), NULL},
{5, _T("Direct3D10 (Null)"), NULL},
{6, _T("Null (Software)"), NULL},
{7, _T("Null (Null)"), NULL},
{0, "Direct3D9 (Hardware)", NULL},
{1, "Direct3D9 (Software)", NULL},
{2, "Direct3D9 (Null)", NULL},
{3, "Direct3D10 (Hardware)", NULL},
{4, "Direct3D10 (Software)", NULL},
{5, "Direct3D10 (Null)", NULL},
{6, "Null (Software)", NULL},
{7, "Null (Null)", NULL},
};
GSSetting GSSettingsDlg::g_psversion[] =
{
{D3DPS_VERSION(3, 0), _T("Pixel Shader 3.0"), NULL},
{D3DPS_VERSION(2, 0), _T("Pixel Shader 2.0"), NULL},
//{D3DPS_VERSION(1, 4), _T("Pixel Shader 1.4"), NULL},
//{D3DPS_VERSION(1, 1), _T("Pixel Shader 1.1"), NULL},
//{D3DPS_VERSION(0, 0), _T("Fixed Pipeline (bogus)"), NULL},
{D3DPS_VERSION(3, 0), "Pixel Shader 3.0", NULL},
{D3DPS_VERSION(2, 0), "Pixel Shader 2.0", NULL},
//{D3DPS_VERSION(1, 4), "Pixel Shader 1.4", NULL},
//{D3DPS_VERSION(1, 1), "Pixel Shader 1.1", NULL},
//{D3DPS_VERSION(0, 0), "Fixed Pipeline (bogus)", NULL},
};
GSSetting GSSettingsDlg::g_interlace[] =
{
{0, _T("None"), NULL},
{1, _T("Weave tff"), _T("saw-tooth")},
{2, _T("Weave bff"), _T("saw-tooth")},
{3, _T("Bob tff"), _T("use blend if shaking")},
{4, _T("Bob bff"), _T("use blend if shaking")},
{5, _T("Blend tff"), _T("slight blur, 1/2 fps")},
{6, _T("Blend bff"), _T("slight blur, 1/2 fps")},
{0, "None", NULL},
{1, "Weave tff", "saw-tooth"},
{2, "Weave bff", "saw-tooth"},
{3, "Bob tff", "use blend if shaking"},
{4, "Bob bff", "use blend if shaking"},
{5, "Blend tff", "slight blur, 1/2 fps"},
{6, "Blend bff", "slight blur, 1/2 fps"},
};
GSSetting GSSettingsDlg::g_aspectratio[] =
{
{0, _T("Stretch"), NULL},
{1, _T("4:3"), NULL},
{2, _T("16:9"), NULL},
{0, "Stretch", NULL},
{1, "4:3", NULL},
{2, "16:9", NULL},
};
IMPLEMENT_DYNAMIC(GSSettingsDlg, CDialog)
GSSettingsDlg::GSSettingsDlg(CWnd* pParent /*=NULL*/)
: CDialog(GSSettingsDlg::IDD, pParent)
, m_filter(1)
, m_nativeres(FALSE)
, m_vsync(FALSE)
, m_logz(FALSE)
, m_fba(TRUE)
, m_aa1(FALSE)
, m_blur(FALSE)
GSSettingsDlg::GSSettingsDlg()
: GSDialog(IDD_CONFIG)
{
}
GSSettingsDlg::~GSSettingsDlg()
void GSSettingsDlg::OnInit()
{
}
LRESULT GSSettingsDlg::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
LRESULT ret = __super::DefWindowProc(message, wParam, lParam);
if(message == WM_INITDIALOG)
{
SendMessage(WM_KICKIDLE);
}
return ret;
}
void GSSettingsDlg::DoDataExchange(CDataExchange* pDX)
{
__super::DoDataExchange(pDX);
DDX_Control(pDX, IDC_COMBO3, m_resolution);
DDX_Control(pDX, IDC_COMBO1, m_renderer);
DDX_Control(pDX, IDC_COMBO4, m_psversion);
DDX_Control(pDX, IDC_COMBO2, m_interlace);
DDX_Control(pDX, IDC_COMBO5, m_aspectratio);
DDX_Check(pDX, IDC_CHECK4, m_filter);
DDX_Control(pDX, IDC_SPIN1, m_resx);
DDX_Control(pDX, IDC_SPIN2, m_resy);
DDX_Control(pDX, IDC_SPIN3, m_swthreads);
DDX_Check(pDX, IDC_CHECK1, m_nativeres);
DDX_Control(pDX, IDC_EDIT1, m_resxedit);
DDX_Control(pDX, IDC_EDIT2, m_resyedit);
DDX_Control(pDX, IDC_EDIT3, m_swthreadsedit);
DDX_Check(pDX, IDC_CHECK2, m_vsync);
DDX_Check(pDX, IDC_CHECK5, m_logz);
DDX_Check(pDX, IDC_CHECK7, m_fba);
DDX_Check(pDX, IDC_CHECK8, m_aa1);
DDX_Check(pDX, IDC_CHECK9, m_blur);
}
BEGIN_MESSAGE_MAP(GSSettingsDlg, CDialog)
ON_MESSAGE_VOID(WM_KICKIDLE, OnKickIdle)
ON_UPDATE_COMMAND_UI(IDC_SPIN1, OnUpdateResolution)
ON_UPDATE_COMMAND_UI(IDC_SPIN2, OnUpdateResolution)
ON_UPDATE_COMMAND_UI(IDC_EDIT1, OnUpdateResolution)
ON_UPDATE_COMMAND_UI(IDC_EDIT2, OnUpdateResolution)
ON_UPDATE_COMMAND_UI(IDC_COMBO4, OnUpdateD3D9Options)
ON_UPDATE_COMMAND_UI(IDC_CHECK3, OnUpdateD3D9Options)
ON_UPDATE_COMMAND_UI(IDC_CHECK5, OnUpdateD3D9Options)
ON_UPDATE_COMMAND_UI(IDC_CHECK7, OnUpdateD3D9Options)
ON_UPDATE_COMMAND_UI(IDC_SPIN3, OnUpdateSWOptions)
ON_UPDATE_COMMAND_UI(IDC_EDIT3, OnUpdateSWOptions)
ON_CBN_SELCHANGE(IDC_COMBO1, &GSSettingsDlg::OnCbnSelchangeCombo1)
END_MESSAGE_MAP()
void GSSettingsDlg::OnKickIdle()
{
UpdateDialogControls(this, false);
}
BOOL GSSettingsDlg::OnInitDialog()
{
__super::OnInitDialog();
__super::OnInit();
D3DCAPS9 caps;
memset(&caps, 0, sizeof(caps));
@ -147,174 +79,140 @@ BOOL GSSettingsDlg::OnInitDialog()
m_modes.clear();
// windowed
{
D3DDISPLAYMODE mode;
memset(&mode, 0, sizeof(mode));
m_modes.push_back(mode);
int iItem = m_resolution.AddString(_T("Windowed"));
m_resolution.SetItemDataPtr(iItem, &m_modes.back());
m_resolution.SetCurSel(iItem);
}
HWND hWnd = GetDlgItem(m_hWnd, IDC_RESOLUTION);
// fullscreen
ComboBoxAppend(hWnd, "Windowed", (LPARAM)&m_modes.back(), true);
if(CComPtr<IDirect3D9> d3d = Direct3DCreate9(D3D_SDK_VERSION))
{
uint32 ModeWidth = theApp.GetConfig("ModeWidth", 0);
uint32 ModeHeight = theApp.GetConfig("ModeHeight", 0);
uint32 ModeRefreshRate = theApp.GetConfig("ModeRefreshRate", 0);
uint32 nModes = d3d->GetAdapterModeCount(D3DADAPTER_DEFAULT, D3DFMT_X8R8G8B8);
for(uint32 i = 0; i < nModes; i++)
if(CComPtr<IDirect3D9> d3d = Direct3DCreate9(D3D_SDK_VERSION))
{
D3DDISPLAYMODE mode;
uint32 w = theApp.GetConfig("ModeWidth", 0);
uint32 h = theApp.GetConfig("ModeHeight", 0);
uint32 hz = theApp.GetConfig("ModeRefreshRate", 0);
if(S_OK == d3d->EnumAdapterModes(D3DADAPTER_DEFAULT, D3DFMT_X8R8G8B8, i, &mode))
uint32 n = d3d->GetAdapterModeCount(D3DADAPTER_DEFAULT, D3DFMT_X8R8G8B8);
for(uint32 i = 0; i < n; i++)
{
string str = format("%dx%d %dHz", mode.Width, mode.Height, mode.RefreshRate);
int iItem = m_resolution.AddString(str.c_str());
m_modes.push_back(mode);
m_resolution.SetItemDataPtr(iItem, &m_modes.back());
if(ModeWidth == mode.Width && ModeHeight == mode.Height && ModeRefreshRate == mode.RefreshRate)
if(S_OK == d3d->EnumAdapterModes(D3DADAPTER_DEFAULT, D3DFMT_X8R8G8B8, i, &mode))
{
m_resolution.SetCurSel(iItem);
m_modes.push_back(mode);
string str = format("%dx%d %dHz", mode.Width, mode.Height, mode.RefreshRate);
ComboBoxAppend(hWnd, str.c_str(), (LPARAM)&m_modes.back(), w == mode.Width && h == mode.Height && hz == mode.RefreshRate);
}
}
d3d->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &caps);
}
}
{
bool isdx10avail = GSUtil::IsDirect3D10Available();
vector<GSSetting> renderers;
for(size_t i = 0; i < countof(g_renderers); i++)
{
if(i >= 3 && i <= 5 && !isdx10avail) continue;
renderers.push_back(g_renderers[i]);
}
d3d->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &caps);
HWND hWnd = GetDlgItem(m_hWnd, IDC_RENDERER);
ComboBoxInit(hWnd, &renderers[0], renderers.size(), theApp.GetConfig("Renderer", 0));
OnCommand(hWnd, IDC_RENDERER, CBN_SELCHANGE);
}
bool isdx10avail = GSUtil::IsDirect3D10Available();
ComboBoxInit(GetDlgItem(m_hWnd, IDC_SHADER), g_psversion, countof(g_psversion), theApp.GetConfig("PixelShaderVersion2", D3DPS_VERSION(2, 0)), caps.PixelShaderVersion);
ComboBoxInit(GetDlgItem(m_hWnd, IDC_INTERLACE), g_interlace, countof(g_interlace), theApp.GetConfig("Interlace", 0));
ComboBoxInit(GetDlgItem(m_hWnd, IDC_ASPECTRATIO), g_aspectratio, countof(g_aspectratio), theApp.GetConfig("AspectRatio", 1));
vector<GSSetting> renderers;
CheckDlgButton(m_hWnd, IDC_FILTER, theApp.GetConfig("filter", 1));
CheckDlgButton(m_hWnd, IDC_VSYNC, theApp.GetConfig("vsync", 0));
CheckDlgButton(m_hWnd, IDC_LOGZ, theApp.GetConfig("logz", 0));
CheckDlgButton(m_hWnd, IDC_FBA, theApp.GetConfig("fba", 1));
CheckDlgButton(m_hWnd, IDC_AA1, theApp.GetConfig("aa1", 0));
CheckDlgButton(m_hWnd, IDC_BLUR, theApp.GetConfig("blur", 0));
CheckDlgButton(m_hWnd, IDC_NATIVERES, theApp.GetConfig("nativeres", 0));
for(size_t i = 0; i < countof(g_renderers); i++)
{
if(i >= 3 && i <= 5 && !isdx10avail) continue;
SendMessage(GetDlgItem(m_hWnd, IDC_RESX), UDM_SETRANGE, 0, MAKELPARAM(4096, 512));
SendMessage(GetDlgItem(m_hWnd, IDC_RESX), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("resx", 1024), 0));
renderers.push_back(g_renderers[i]);
}
SendMessage(GetDlgItem(m_hWnd, IDC_RESY), UDM_SETRANGE, 0, MAKELPARAM(4096, 512));
SendMessage(GetDlgItem(m_hWnd, IDC_RESY), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("resy", 1024), 0));
GSSetting::InitComboBox(&renderers[0], renderers.size(), m_renderer, theApp.GetConfig("Renderer", 0));
GSSetting::InitComboBox(g_psversion, countof(g_psversion), m_psversion, theApp.GetConfig("PixelShaderVersion2", D3DPS_VERSION(2, 0)), caps.PixelShaderVersion);
GSSetting::InitComboBox(g_interlace, countof(g_interlace), m_interlace, theApp.GetConfig("Interlace", 0));
GSSetting::InitComboBox(g_aspectratio, countof(g_aspectratio), m_aspectratio, theApp.GetConfig("AspectRatio", 1));
OnCbnSelchangeCombo1();
//
m_filter = theApp.GetConfig("filter", 1);
m_vsync = !!theApp.GetConfig("vsync", 0);
m_logz = !!theApp.GetConfig("logz", 0);
m_fba = !!theApp.GetConfig("fba", 1);
m_aa1 = !!theApp.GetConfig("aa1", 0);
m_blur = !!theApp.GetConfig("blur", 0);
m_resx.SetRange(512, 4096);
m_resy.SetRange(512, 4096);
m_resx.SetPos(theApp.GetConfig("resx", 1024));
m_resy.SetPos(theApp.GetConfig("resy", 1024));
m_nativeres = !!theApp.GetConfig("nativeres", 0);
m_resx.EnableWindow(!m_nativeres);
m_resy.EnableWindow(!m_nativeres);
m_resxedit.EnableWindow(!m_nativeres);
m_resyedit.EnableWindow(!m_nativeres);
m_swthreads.SetRange(1, 16);
m_swthreads.SetPos(theApp.GetConfig("swthreads", 1));
//
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_SETRANGE, 0, MAKELPARAM(16, 1));
SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("swthreads", 1), 0));
}
void GSSettingsDlg::OnOK()
bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code)
{
UpdateData();
if(m_resolution.GetCurSel() >= 0)
if(id == IDC_RENDERER && code == CBN_SELCHANGE)
{
D3DDISPLAYMODE& mode = *(D3DDISPLAYMODE*)m_resolution.GetItemData(m_resolution.GetCurSel());
int item = (int)SendMessage(hWnd, CB_GETCURSEL, 0, 0);
theApp.SetConfig("ModeWidth", (int)mode.Width);
theApp.SetConfig("ModeHeight", (int)mode.Height);
theApp.SetConfig("ModeRefreshRate", (int)mode.RefreshRate);
if(item >= 0)
{
int i = (int)SendMessage(hWnd, CB_GETITEMDATA, item, 0);
ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO9), i >= 0 && i <= 2 ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO10), i >= 3 && i <= 5 ? SW_SHOW : SW_HIDE);
}
}
else if(id == IDOK)
{
INT_PTR data;
if(ComboBoxGetSelData(GetDlgItem(m_hWnd, IDC_RESOLUTION), data))
{
const D3DDISPLAYMODE* mode = (D3DDISPLAYMODE*)data;
theApp.SetConfig("ModeWidth", (int)mode->Width);
theApp.SetConfig("ModeHeight", (int)mode->Height);
theApp.SetConfig("ModeRefreshRate", (int)mode->RefreshRate);
}
if(ComboBoxGetSelData(GetDlgItem(m_hWnd, IDC_RENDERER), data))
{
theApp.SetConfig("Renderer", (int)data);
}
if(ComboBoxGetSelData(GetDlgItem(m_hWnd, IDC_SHADER), data))
{
theApp.SetConfig("PixelShaderVersion2", (int)data);
}
if(ComboBoxGetSelData(GetDlgItem(m_hWnd, IDC_INTERLACE), data))
{
theApp.SetConfig("Interlace", (int)data);
}
if(ComboBoxGetSelData(GetDlgItem(m_hWnd, IDC_ASPECTRATIO), data))
{
theApp.SetConfig("AspectRatio", (int)data);
}
theApp.SetConfig("filter", (int)IsDlgButtonChecked(m_hWnd, IDC_FILTER));
theApp.SetConfig("vsync", (int)IsDlgButtonChecked(m_hWnd, IDC_VSYNC));
theApp.SetConfig("logz", (int)IsDlgButtonChecked(m_hWnd, IDC_LOGZ));
theApp.SetConfig("fba", (int)IsDlgButtonChecked(m_hWnd, IDC_FBA));
theApp.SetConfig("aa1", (int)IsDlgButtonChecked(m_hWnd, IDC_AA1));
theApp.SetConfig("blur", (int)IsDlgButtonChecked(m_hWnd, IDC_BLUR));
theApp.SetConfig("nativeres", (int)IsDlgButtonChecked(m_hWnd, IDC_NATIVERES));
theApp.SetConfig("resx", (int)SendMessage(GetDlgItem(m_hWnd, IDC_RESX), UDM_GETPOS, 0, 0));
theApp.SetConfig("resy", (int)SendMessage(GetDlgItem(m_hWnd, IDC_RESY), UDM_GETPOS, 0, 0));
theApp.SetConfig("swthreads", (int)SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_GETPOS, 0, 0));
}
if(m_renderer.GetCurSel() >= 0)
{
theApp.SetConfig("Renderer", (uint32)m_renderer.GetItemData(m_renderer.GetCurSel()));
}
if(m_psversion.GetCurSel() >= 0)
{
theApp.SetConfig("PixelShaderVersion2", (uint32)m_psversion.GetItemData(m_psversion.GetCurSel()));
}
if(m_interlace.GetCurSel() >= 0)
{
theApp.SetConfig("Interlace", (uint32)m_interlace.GetItemData(m_interlace.GetCurSel()));
}
if(m_aspectratio.GetCurSel() >= 0)
{
theApp.SetConfig("AspectRatio", (uint32)m_aspectratio.GetItemData(m_aspectratio.GetCurSel()));
}
theApp.SetConfig("filter", m_filter);
theApp.SetConfig("vsync", m_vsync);
theApp.SetConfig("logz", m_logz);
theApp.SetConfig("fba", m_fba);
theApp.SetConfig("aa1", m_aa1);
theApp.SetConfig("blur", m_blur);
theApp.SetConfig("resx", m_resx.GetPos());
theApp.SetConfig("resy", m_resy.GetPos());
theApp.SetConfig("swthreads", m_swthreads.GetPos());
theApp.SetConfig("nativeres", m_nativeres);
__super::OnOK();
return __super::OnCommand(hWnd, id, code);
}
void GSSettingsDlg::OnUpdateResolution(CCmdUI* pCmdUI)
{
UpdateData();
int i = (int)m_renderer.GetItemData(m_renderer.GetCurSel());
pCmdUI->Enable(!m_nativeres && (i == 0 || i == 3));
}
void GSSettingsDlg::OnUpdateD3D9Options(CCmdUI* pCmdUI)
{
int i = (int)m_renderer.GetItemData(m_renderer.GetCurSel());
pCmdUI->Enable(i >= 0 && i <= 2);
}
void GSSettingsDlg::OnUpdateSWOptions(CCmdUI* pCmdUI)
{
int i = (int)m_renderer.GetItemData(m_renderer.GetCurSel());
pCmdUI->Enable(i == 1 || i == 4 || i == 6);
}
void GSSettingsDlg::OnCbnSelchangeCombo1()
{
int i = (int)m_renderer.GetItemData(m_renderer.GetCurSel());
GetDlgItem(IDC_LOGO9)->ShowWindow(i >= 0 && i <= 2 ? SW_SHOW : SW_HIDE);
GetDlgItem(IDC_LOGO10)->ShowWindow(i >= 3 && i <= 5 ? SW_SHOW : SW_HIDE);
}

View File

@ -21,59 +21,22 @@
#pragma once
#include "GSDialog.h"
#include "GSSetting.h"
#include "resource.h"
class GSSettingsDlg : public CDialog
class GSSettingsDlg : public GSDialog
{
DECLARE_DYNAMIC(GSSettingsDlg)
private:
list<D3DDISPLAYMODE> m_modes;
protected:
void OnInit();
bool OnCommand(HWND hWnd, UINT id, UINT code);
public:
GSSettingsDlg(CWnd* pParent = NULL); // standard constructor
virtual ~GSSettingsDlg();
GSSettingsDlg();
static GSSetting g_renderers[];
static GSSetting g_psversion[];
static GSSetting g_interlace[];
static GSSetting g_aspectratio[];
// Dialog Data
enum { IDD = IDD_CONFIG };
CComboBox m_resolution;
CComboBox m_renderer;
CComboBox m_psversion;
CComboBox m_interlace;
CComboBox m_aspectratio;
int m_filter;
CSpinButtonCtrl m_resx;
CSpinButtonCtrl m_resy;
CSpinButtonCtrl m_swthreads;
BOOL m_nativeres;
CEdit m_resxedit;
CEdit m_resyedit;
CEdit m_swthreadsedit;
BOOL m_vsync;
BOOL m_logz;
BOOL m_fba;
BOOL m_aa1;
BOOL m_blur;
protected:
virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL OnInitDialog();
virtual void OnOK();
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnKickIdle();
afx_msg void OnUpdateResolution(CCmdUI* pCmdUI);
afx_msg void OnUpdateD3D9Options(CCmdUI* pCmdUI);
afx_msg void OnUpdateSWOptions(CCmdUI* pCmdUI);
afx_msg void OnCbnSelchangeCombo1();
};

View File

@ -596,7 +596,7 @@ void GSState::GIFRegHandlerPRMODECONT(GIFReg* r)
PRIM = m_env.PRMODECONT.AC ? &m_env.PRIM : (GIFRegPRIM*)&m_env.PRMODE;
if(PRIM->PRIM == 7) TRACE(_T("Invalid PRMODECONT/PRIM\n"));
// if(PRIM->PRIM == 7) printf("Invalid PRMODECONT/PRIM\n");
m_context = &m_env.CTXT[PRIM->CTXT];

View File

@ -36,8 +36,9 @@ GSTexture9::GSTexture9(IDirect3DSurface9* surface)
if(m_desc.Type != D3DRTYPE_SURFACE)
{
HRESULT hr = surface->GetContainer(__uuidof(IDirect3DTexture9), (void**)&m_texture);
ASSERT(SUCCEEDED(hr));
surface->GetContainer(__uuidof(IDirect3DTexture9), (void**)&m_texture);
ASSERT(m_texture != NULL);
}
}

View File

@ -90,7 +90,7 @@ void GSTextureCache10::GSRenderTargetHW10::Read(const GSVector4i& r)
return;
}
TRACE(_T("GSRenderTarget::Read %d,%d - %d,%d (%08x)\n"), r.left, r.top, r.right, r.bottom, m_TEX0.TBP0);
// printf("GSRenderTarget::Read %d,%d - %d,%d (%08x)\n", r.left, r.top, r.right, r.bottom, m_TEX0.TBP0);
// m_renderer->m_perfmon.Put(GSPerfMon::ReadRT, 1);
@ -202,7 +202,7 @@ bool GSTextureCache10::GSCachedTextureHW10::Create()
switch(psm)
{
default:
TRACE(_T("Invalid TEX0.PSM/CPSM (%I64d, %I64d)\n"), m_TEX0.PSM, m_TEX0.CPSM);
// printf("Invalid TEX0.PSM/CPSM (%I64d, %I64d)\n", m_TEX0.PSM, m_TEX0.CPSM);
case PSM_PSMCT32:
m_bpp = 32;
m_bpp2 = 0;

View File

@ -91,7 +91,7 @@ void GSTextureCache9::GSRenderTarget9::Read(const GSVector4i& r)
return;
}
TRACE(_T("GSRenderTarget::Read %d,%d - %d,%d (%08x)\n"), r.left, r.top, r.right, r.bottom, m_TEX0.TBP0);
// printf("GSRenderTarget::Read %d,%d - %d,%d (%08x)\n", r.left, r.top, r.right, r.bottom, m_TEX0.TBP0);
// m_renderer->m_perfmon.Put(GSPerfMon::ReadRT, 1);
@ -201,7 +201,7 @@ bool GSTextureCache9::GSCachedTexture9::Create()
switch(psm)
{
default:
TRACE(_T("Invalid TEX0.PSM/CPSM (%I64d, %I64d)\n"), m_TEX0.PSM, m_TEX0.CPSM);
// printf("Invalid TEX0.PSM/CPSM (%I64d, %I64d)\n", m_TEX0.PSM, m_TEX0.CPSM);
case PSM_PSMCT32:
m_bpp = 32;
m_bpp2 = 0;

View File

@ -120,11 +120,11 @@ bool GSUtil::CheckDirectX()
}
else
{
int res = AfxMessageBox(_T("You need to update directx, would you like to do it now?"), MB_YESNO);
if(res == IDYES)
if(MessageBox(NULL, "You need to update directx, would you like to do it now?", "GSdx", MB_YESNO) == IDYES)
{
ShellExecute(NULL, _T("open"), _T("http://www.microsoft.com/downloads/details.aspx?FamilyId=2DA43D38-DB71-4C1B-BC6A-9B6652CD92A3"), NULL, NULL, SW_SHOWNORMAL);
const char* url = "http://www.microsoft.com/downloads/details.aspx?FamilyId=2DA43D38-DB71-4C1B-BC6A-9B6652CD92A3";
ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);
}
return false;
@ -152,7 +152,7 @@ bool GSUtil::CheckSSE()
{
string s = format("This CPU does not support SSE %d.%02d", _M_SSE >> 8, _M_SSE & 0xff);
AfxMessageBox(s.c_str(), MB_OK);
MessageBox(NULL, s.c_str(), "GSdx", MB_OK);
return false;
}

View File

@ -23,55 +23,149 @@
#include "GSdx.h"
#include "GSWnd.h"
BEGIN_MESSAGE_MAP(GSWnd, CWnd)
ON_WM_CLOSE()
END_MESSAGE_MAP()
GSWnd::GSWnd()
: m_hWnd(NULL)
{
}
GSWnd::~GSWnd()
{
DestroyWindow();
}
LRESULT CALLBACK GSWnd::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
GSWnd* wnd = NULL;
if(message == WM_NCCREATE)
{
wnd = (GSWnd*)((LPCREATESTRUCT)lParam)->lpCreateParams;
SetWindowLongPtr(hWnd, GWL_USERDATA, (LONG_PTR)wnd);
wnd->m_hWnd = hWnd;
}
else
{
wnd = (GSWnd*)GetWindowLongPtr(hWnd, GWL_USERDATA);
}
if(wnd == NULL)
{
return DefWindowProc(hWnd, message, wParam, lParam);
}
return wnd->OnMessage(message, wParam, lParam);
}
LRESULT GSWnd::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_CLOSE:
Hide();
// DestroyWindow(m_hWnd);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
break;
}
return DefWindowProc(m_hWnd, message, wParam, lParam);
}
bool GSWnd::Create(const string& title)
{
CRect r;
GSVector4i r;
GetDesktopWindow()->GetWindowRect(r);
GetWindowRect(GetDesktopWindow(), r);
CSize s(r.Width() / 3, r.Width() / 4);
int w = r.width() / 3;
int h = r.width() / 4;
if(!GetSystemMetrics(SM_REMOTESESSION))
{
s.cx *= 2;
s.cy *= 2;
w *= 2;
h *= 2;
}
r = CRect(r.CenterPoint() - CSize(s.cx / 2, s.cy / 2), s);
int x = (r.left + r.right - w) / 2;
int y = (r.top + r.bottom - h) / 2;
LPCTSTR wc = AfxRegisterWndClass(CS_VREDRAW|CS_HREDRAW|CS_DBLCLKS, theApp.LoadStandardCursor(IDC_ARROW), 0, 0);
WNDCLASS wc;
return !!CreateEx(0, wc, title.c_str(), WS_OVERLAPPEDWINDOW, r, NULL, 0);
memset(&wc, 0, sizeof(wc));
wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
wc.lpfnWndProc = WndProc;
wc.hInstance = theApp.GetModuleHandle();
// TODO: wc.hIcon = ;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wc.lpszClassName = "GSWnd";
if(!RegisterClass(&wc))
{
return false;
}
DWORD style = WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_OVERLAPPEDWINDOW | WS_BORDER;
m_hWnd = CreateWindow(wc.lpszClassName, title.c_str(), style, x, y, w, h, NULL, NULL, wc.hInstance, (LPVOID)this);
if(!m_hWnd)
{
return false;
}
return true;
}
bool GSWnd::Attach(HWND hWnd)
{
// TODO: subclass
m_hWnd = hWnd;
return true;
}
GSVector4i GSWnd::GetClientRect()
{
GSVector4i r;
::GetClientRect(m_hWnd, r);
return r;
}
void GSWnd::SetWindowText(const char* title)
{
::SetWindowText(m_hWnd, title);
}
void GSWnd::Show()
{
SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
SetForegroundWindow();
ShowWindow(SW_SHOWNORMAL);
//SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
SetForegroundWindow(m_hWnd);
ShowWindow(m_hWnd, SW_SHOWNORMAL);
UpdateWindow(m_hWnd);
}
void GSWnd::Hide()
{
ShowWindow(SW_HIDE);
ShowWindow(m_hWnd, SW_HIDE);
}
void GSWnd::OnClose()
void GSWnd::HideFrame()
{
Hide();
SetWindowLong(m_hWnd, GWL_STYLE, GetWindowLong(m_hWnd, GWL_STYLE) & ~(WS_CAPTION|WS_THICKFRAME));
PostMessage(WM_QUIT);
SetWindowPos(m_hWnd, NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
SetMenu(m_hWnd, NULL);
}

View File

@ -21,17 +21,30 @@
#pragma once
class GSWnd : public CWnd
#include "GSVector.h"
class GSWnd
{
DECLARE_MESSAGE_MAP()
HWND m_hWnd;
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
virtual LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
public:
GSWnd();
virtual ~GSWnd();
virtual bool Create(const string& title);
bool Create(const string& title);
bool Attach(HWND hWnd);
void* GetHandle() {return m_hWnd;}
GSVector4i GetClientRect();
void SetWindowText(const char* title);
void Show();
void Hide();
void OnClose();
void HideFrame();
};

View File

@ -21,96 +21,58 @@
#include "stdafx.h"
#include "GSdx.h"
#include <atlbase.h>
#include <atlpath.h>
//
// Note!
//
// If this DLL is dynamically linked against the MFC
// DLLs, any functions exported from this DLL which
// call into MFC must have the AFX_MANAGE_STATE macro
// added at the very beginning of the function.
//
// For example:
//
// extern "C" BOOL PASCAL EXPORT ExportedFunction()
// {
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
// // normal function body here
// }
//
// It is very important that this macro appear in each
// function, prior to any calls into MFC. This means that
// it must appear as the first statement within the
// function, even before any object variable declarations
// as their constructors may generate calls into the MFC
// DLL.
//
// Please see MFC Technical Notes 33 and 58 for additional
// details.
//
static HMODULE s_hModule;
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch(ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
s_hModule = hModule;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
GSdxApp theApp;
const char* GSdxApp::m_ini = "inis/GSdx.ini";
const char* GSdxApp::m_section = "Settings";
GSdxApp::GSdxApp()
{
}
BOOL GSdxApp::InitInstance()
HMODULE GSdxApp::GetModuleHandle()
{
__super::InitInstance();
SetRegistryKey(_T("Gabest"));
CString str;
GetModuleFileName(AfxGetInstanceHandle(), str.GetBuffer(MAX_PATH), MAX_PATH);
str.ReleaseBuffer();
CPath path(str);
path.RenameExtension(_T(".ini"));
CPath fn = path;
fn.StripPath();
path.RemoveFileSpec();
path.Append(_T("..\\inis"));
CreateDirectory(path, NULL);
path.Append(fn);
if(m_pszRegistryKey)
{
free((void*)m_pszRegistryKey);
}
m_pszRegistryKey = NULL;
if(m_pszProfileName)
{
free((void*)m_pszProfileName);
}
m_pszProfileName = _tcsdup((LPCTSTR)path);
return TRUE;
return s_hModule;
}
string GSdxApp::GetConfig(const char* entry, const char* value)
{
return string(GetProfileString("Settings", entry, value));
char buff[4096] = {0};
GetPrivateProfileString(m_section, entry, value, buff, countof(buff), m_ini);
return string(buff);
}
void GSdxApp::SetConfig(const char* entry, const char* value)
{
WriteProfileString("Settings", entry, value);
WritePrivateProfileString(m_section, entry, value, m_ini);
}
int GSdxApp::GetConfig(const char* entry, int value)
{
return GetProfileInt("Settings", entry, value);
return GetPrivateProfileInt(m_section, entry, value, m_ini);
}
void GSdxApp::SetConfig(const char* entry, int value)
{
WriteProfileInt("Settings", entry, value);
char buff[32] = {0};
itoa(value, buff, 10);
SetConfig(entry, buff);
}

View File

@ -21,14 +21,16 @@
#pragma once
class GSdxApp : public CWinApp
class GSdxApp
{
protected:
virtual BOOL InitInstance();
static const char* m_ini;
static const char* m_section;
public:
GSdxApp();
HMODULE GetModuleHandle();
string GetConfig(const char* entry, const char* value);
void SetConfig(const char* entry, const char* value);
int GetConfig(const char* entry, int value);

View File

@ -90,31 +90,31 @@ BEGIN
CONTROL 2022,IDC_LOGO10,"Static",SS_BITMAP,7,7,175,44
CONTROL 2021,IDC_LOGO9,"Static",SS_BITMAP,7,7,175,44
LTEXT "Resolution:",IDC_STATIC,7,59,37,8
COMBOBOX IDC_COMBO3,71,57,111,125,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_RESOLUTION,71,57,111,125,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Renderer:",IDC_STATIC,7,74,34,8
COMBOBOX IDC_COMBO1,71,72,111,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_RENDERER,71,72,111,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Shader:",IDC_STATIC,7,89,26,8
COMBOBOX IDC_COMBO4,71,87,111,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_SHADER,71,87,111,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Interlacing (F5):",IDC_STATIC,7,105,53,8
COMBOBOX IDC_COMBO2,71,102,111,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_INTERLACE,71,102,111,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Aspect Ratio (F6):",IDC_STATIC,7,120,60,8
COMBOBOX IDC_COMBO5,71,117,111,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_ASPECTRATIO,71,117,111,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "D3D internal res:",IDC_STATIC,7,135,55,8
EDITTEXT IDC_EDIT1,71,132,35,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,99,135,11,14
CONTROL "",IDC_RESX,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,99,135,11,14
EDITTEXT IDC_EDIT2,109,132,35,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,133,135,11,14
CONTROL "Native",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,149,134,33,10
CONTROL "",IDC_RESY,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,133,135,11,14
CONTROL "Native",IDC_NATIVERES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,149,134,33,10
LTEXT "SW rend. threads:",IDC_STATIC,7,149,60,8
EDITTEXT IDC_EDIT3,71,147,35,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_SPIN3,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,99,150,11,14
CONTROL "Texture filtering",IDC_CHECK4,"Button",BS_AUTO3STATE | WS_TABSTOP,7,167,67,10
CONTROL "Logarithmic Z",IDC_CHECK5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,80,168,58,10
CONTROL "Wait vsync",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,180,51,10
CONTROL "Alpha correction (FBA)",IDC_CHECK7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,80,181,102,10
CONTROL "Edge anti-aliasing (AA1, sw-mode only)",IDC_CHECK8,
CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,99,150,11,14
CONTROL "Texture filtering",IDC_FILTER,"Button",BS_AUTO3STATE | WS_TABSTOP,7,167,67,10
CONTROL "Logarithmic Z",IDC_LOGZ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,80,168,58,10
CONTROL "Wait vsync",IDC_VSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,180,51,10
CONTROL "Alpha correction (FBA)",IDC_FBA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,80,181,102,10
CONTROL "Edge anti-aliasing (AA1, sw-mode only)",IDC_AA1,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,194,141,10
CONTROL "Enable output merger blur effect",IDC_CHECK9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,208,121,10
CONTROL "Enable output merger blur effect",IDC_BLUR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,208,121,10
DEFPUSHBUTTON "OK",IDOK,43,227,50,14
PUSHBUTTON "Cancel",IDCANCEL,96,227,50,14
END
@ -124,13 +124,13 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM
CAPTION "Capture settings"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
EDITTEXT IDC_EDIT1,7,7,207,14,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",IDC_BUTTON1,222,7,50,14
COMBOBOX IDC_COMBO1,7,27,207,122,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Config...",IDC_BUTTON2,222,26,50,14
EDITTEXT IDC_FILENAME,7,7,207,14,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",IDC_BROWSE,222,7,50,14
COMBOBOX IDC_CODECS,7,27,207,122,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Config...",IDC_CONFIGURE,222,26,50,14
LTEXT "Size:",IDC_STATIC,6,50,16,8
EDITTEXT IDC_EDIT2,30,47,31,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
EDITTEXT IDC_EDIT4,64,47,31,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
EDITTEXT IDC_WIDTH,30,47,31,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
EDITTEXT IDC_HEIGHT,64,47,31,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
PUSHBUTTON "Cancel",IDCANCEL,169,47,50,14
DEFPUSHBUTTON "OK",IDOK,221,47,50,14
END
@ -142,25 +142,25 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL 2021,IDC_LOGO9,"Static",SS_BITMAP,7,7,175,44
LTEXT "Resolution:",IDC_STATIC,7,59,37,8
COMBOBOX IDC_COMBO3,78,57,104,125,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_RESOLUTION,78,57,104,125,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Renderer:",IDC_STATIC,7,74,34,8
COMBOBOX IDC_COMBO1,78,72,104,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_RENDERER,78,72,104,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Shader:",IDC_STATIC,7,89,26,8
COMBOBOX IDC_COMBO4,78,87,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_SHADER,78,87,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Texture Filter (Del):",IDC_STATIC,7,105,64,8
COMBOBOX IDC_COMBO2,78,102,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_FILTER,78,102,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Dithering (End):",IDC_STATIC,7,120,52,8
COMBOBOX IDC_COMBO5,78,117,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_DITHERING,78,117,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Aspect Ratio (PgDn):",IDC_STATIC,7,135,68,8
COMBOBOX IDC_COMBO6,78,132,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_ASPECTRATIO,78,132,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Rendering Threads:",IDC_STATIC,7,165,64,8
EDITTEXT IDC_EDIT3,78,163,35,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_SPIN3,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,99,169,11,14
CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,99,169,11,14
DEFPUSHBUTTON "OK",IDOK,43,214,50,14
PUSHBUTTON "Cancel",IDCANCEL,96,214,50,14
CONTROL 2022,IDC_LOGO10,"Static",SS_BITMAP,7,7,175,44
LTEXT "Internal Resolution:",IDC_STATIC,7,150,64,8
COMBOBOX IDC_COMBO7,78,147,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_SCALE,78,147,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END

View File

@ -23,7 +23,7 @@
Name="Debug|Win32"
ConfigurationType="2"
InheritedPropertySheets=".\vsprops\common.vsprops;.\vsprops\ProjectRootDir.vsprops;.\vsprops\debug.vsprops"
UseOfMFC="1"
UseOfMFC="0"
CharacterSet="2"
>
<Tool
@ -150,7 +150,7 @@
Name="Release|Win32"
ConfigurationType="2"
InheritedPropertySheets=".\vsprops\common.vsprops;.\vsprops\ProjectRootDir.vsprops;.\vsprops\release.vsprops"
UseOfMFC="1"
UseOfMFC="0"
CharacterSet="2"
WholeProgramOptimization="1"
>
@ -279,7 +279,7 @@
Name="Debug SSE2|Win32"
ConfigurationType="2"
InheritedPropertySheets=".\vsprops\common.vsprops;.\vsprops\ProjectRootDir.vsprops;.\vsprops\debug.vsprops;.\vsprops\sse2.vsprops"
UseOfMFC="1"
UseOfMFC="0"
CharacterSet="2"
>
<Tool
@ -405,7 +405,7 @@
Name="Release SSE2|Win32"
ConfigurationType="2"
InheritedPropertySheets=".\vsprops\common.vsprops;.\vsprops\ProjectRootDir.vsprops;.\vsprops\release.vsprops;.\vsprops\sse2.vsprops"
UseOfMFC="1"
UseOfMFC="0"
CharacterSet="2"
WholeProgramOptimization="1"
>
@ -532,7 +532,7 @@
Name="Release SSSE3|Win32"
ConfigurationType="2"
InheritedPropertySheets=".\vsprops\common.vsprops;.\vsprops\ProjectRootDir.vsprops;.\vsprops\release.vsprops;.\vsprops\ssse3.vsprops"
UseOfMFC="1"
UseOfMFC="0"
CharacterSet="2"
WholeProgramOptimization="1"
>
@ -659,7 +659,7 @@
Name="Debug SSSE3|Win32"
ConfigurationType="2"
InheritedPropertySheets=".\vsprops\common.vsprops;.\vsprops\ProjectRootDir.vsprops;.\vsprops\debug.vsprops;.\vsprops\ssse3.vsprops"
UseOfMFC="1"
UseOfMFC="0"
CharacterSet="2"
>
<Tool
@ -784,7 +784,7 @@
Name="Debug SSE4|Win32"
ConfigurationType="2"
InheritedPropertySheets=".\vsprops\common.vsprops;.\vsprops\debug.vsprops;.\vsprops\ProjectRootDir.vsprops;.\vsprops\sse4.vsprops"
UseOfMFC="1"
UseOfMFC="0"
CharacterSet="2"
>
<Tool
@ -910,7 +910,7 @@
Name="Release SSE4|Win32"
ConfigurationType="2"
InheritedPropertySheets=".\vsprops\common.vsprops;.\vsprops\release.vsprops;.\vsprops\sse4.vsprops;.\vsprops\ProjectRootDir.vsprops"
UseOfMFC="1"
UseOfMFC="0"
CharacterSet="2"
WholeProgramOptimization="1"
>
@ -1155,6 +1155,10 @@
RelativePath=".\GSDeviceNull.cpp"
>
</File>
<File
RelativePath=".\GSDialog.cpp"
>
</File>
<File
RelativePath=".\GSDirtyRect.cpp"
>
@ -1705,6 +1709,10 @@
RelativePath=".\GSDeviceNull.h"
>
</File>
<File
RelativePath=".\GSDialog.h"
>
</File>
<File
RelativePath=".\GSDirtyRect.h"
>

View File

@ -2,40 +2,44 @@
// Microsoft Visual C++ generated include file.
// Used by GSdx.rc
//
#define IDC_CHECK1 2001
#define IDC_CHECK2 2002
#define IDC_NATIVERES 2001
#define IDC_VSYNC 2002
#define IDC_CHECK3 2003
#define IDC_CHECK5 2004
#define IDC_LOGZ 2004
#define IDC_CHECK6 2005
#define IDC_COMBO1 2006
#define IDC_COMBO3 2007
#define IDC_COMBO4 2008
#define IDC_CODECS 2006
#define IDC_RESOLUTION 2007
#define IDC_SHADER 2008
#define IDC_EDIT1 2009
#define IDC_EDIT2 2010
#define IDC_BUTTON1 2011
#define IDC_CHECK8 2011
#define IDC_BUTTON2 2012
#define IDC_AA1 2011
#define IDC_EDIT3 2012
#define IDC_CUSTOM1 2013
#define IDC_CHECK4 2014
#define IDC_COMBO2 2015
#define IDC_COMBO5 2016
#define IDC_FILTER 2015
#define IDC_DITHERING 2016
#define IDC_RADIO1 2017
#define IDC_COMBO6 2017
#define IDC_SPIN1 2018
#define IDC_COMBO7 2018
#define IDC_SPIN2 2019
#define IDC_RESX 2018
#define IDC_RESY 2019
#define IDD_CONFIG 2020
#define IDC_SPIN3 2020
#define IDB_LOGO9 2021
#define IDB_LOGO10 2022
#define IDC_CHECK7 2023
#define IDC_FBA 2023
#define IDC_LOGO9 2024
#define IDC_LOGO10 2025
#define IDD_CAPTURE 2026
#define IDC_EDIT4 2027
#define IDD_GPUCONFIG 2027
#define IDC_CHECK9 2028
#define IDC_BLUR 2028
#define IDC_RENDERER 2029
#define IDC_INTERLACE 2030
#define IDC_ASPECTRATIO 2031
#define IDC_SWTHREADS 2032
#define IDC_SCALE 2033
#define IDC_BROWSE 2034
#define IDC_FILENAME 2035
#define IDC_WIDTH 2036
#define IDC_HEIGHT 2037
#define IDC_CONFIGURE 2038
#define IDR_CONVERT9_FX 10000
#define IDR_TFX9_FX 10001
#define IDR_MERGE9_FX 10002
@ -51,7 +55,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 10009
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 2029
#define _APS_NEXT_CONTROL_VALUE 2039
#define _APS_NEXT_SYMED_VALUE 5000
#endif
#endif

View File

@ -4,39 +4,41 @@
#pragma once
#pragma warning(disable: 4996 4995 4324 4100 4101)
#pragma warning(disable: 4996 4995 4324 4100 4101 4201)
#ifdef _WINDOWS
#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#endif
// The following macros define the minimum required platform. The minimum required platform
// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
// your application. The macros work by enabling all features available on platform versions up to and
// including the version specified.
// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
#define WINVER 0x0510 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#ifndef WINVER // Specifies that the minimum required platform is Windows Vista.
#define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows.
#endif
#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 2000 or later.
#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
#endif
#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
#ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98.
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
#endif
#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
#ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0.
#define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE.
#endif
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
//#include <afxext.h> // MFC extensions
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <windows.h>
#include <commctrl.h>
#include <commdlg.h>
#include <shellapi.h>
#include <atlbase.h>
#endif
@ -44,6 +46,7 @@
#include <math.h>
#include <time.h>
#include <intrin.h>
#include <string>
#include <vector>
@ -77,21 +80,25 @@ typedef signed long long int64;
#define ALIGN_STACK(n) __declspec(align(n)) int __dummy;
#ifndef RESTRICT
#ifdef __INTEL_COMPILER
#define RESTRICT restrict
#elif _MSC_VER >= 1400 // TODO: gcc
#define RESTRICT __restrict
#else
#define RESTRICT
#ifdef __INTEL_COMPILER
#define RESTRICT restrict
#elif _MSC_VER >= 1400 // TODO: gcc
#define RESTRICT __restrict
#else
#define RESTRICT
#endif
#endif
#if defined(_DEBUG) && defined(_MSC_VER)
#define ASSERT assert
#else
#define ASSERT(exp) ((void)0)
#endif
#ifdef __x86_64__
#define _M_AMD64
#define _M_AMD64
#endif
extern "C" uint64 __rdtsc(); // TODO: gcc
// directx
#include <ddraw.h>