diff --git a/plugins/GSdx/GPUSettingsDlg.cpp b/plugins/GSdx/GPUSettingsDlg.cpp index 815a6d77f8..c0656c6cfb 100644 --- a/plugins/GSdx/GPUSettingsDlg.cpp +++ b/plugins/GSdx/GPUSettingsDlg.cpp @@ -81,7 +81,7 @@ void GPUSettingsDlg::OnInit() memset(&mode, 0, sizeof(mode)); m_modes.push_back(mode); - ComboBoxAppend(IDC_RESOLUTION, "Windowed", (LPARAM)&m_modes.back(), true); + ComboBoxAppend(IDC_RESOLUTION, "Please select...", (LPARAM)&m_modes.back(), true); if(CComPtr d3d = Direct3DCreate9(D3D_SDK_VERSION)) { @@ -124,6 +124,8 @@ void GPUSettingsDlg::OnInit() ComboBoxInit(IDC_ASPECTRATIO, g_aspectratio, countof(g_aspectratio), theApp.GetConfig("AspectRatio", 1)); ComboBoxInit(IDC_SCALE, g_scale, countof(g_scale), theApp.GetConfig("scale_x", 0) | (theApp.GetConfig("scale_y", 0) << 2)); + CheckDlgButton(m_hWnd, IDC_WINDOWED, theApp.GetConfig("windowed", 1)); + 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)); @@ -176,6 +178,7 @@ bool GPUSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code) } theApp.SetConfig("swthreads", (int)SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_GETPOS, 0, 0)); + theApp.SetConfig("windowed", (int)IsDlgButtonChecked(m_hWnd, IDC_WINDOWED)); } return __super::OnCommand(hWnd, id, code); diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp index 6c4beb6f5a..ea784ac4cd 100644 --- a/plugins/GSdx/GS.cpp +++ b/plugins/GSdx/GS.cpp @@ -139,7 +139,10 @@ static INT32 GSopen(void* dsp, char* title, int mt, int renderer) case 13: s_gs = new GSRendererNull(s_basemem, !!mt, s_irq, new GSDeviceNull()); break; } - if(!s_gs->Create(title)) + int w = theApp.GetConfig("ModeWidth", 0); + int h = theApp.GetConfig("ModeHeight", 0); + + if(!s_gs->Create(title, w, h)) { GSclose(); diff --git a/plugins/GSdx/GSClut.cpp b/plugins/GSdx/GSClut.cpp index 533b44e730..9f5239efab 100644 --- a/plugins/GSdx/GSClut.cpp +++ b/plugins/GSdx/GSClut.cpp @@ -394,14 +394,13 @@ __forceinline void GSClut::WriteCLUT_T32_I4_CSM1(const uint32* RESTRICT src, uin GSVector4i v2 = s[2]; GSVector4i v3 = s[3]; - GSVector4i::sw64(v0, v1, v2, v3); GSVector4i::sw16(v0, v1, v2, v3); + GSVector4i::sw32(v0, v1, v2, v3); GSVector4i::sw16(v0, v2, v1, v3); - GSVector4i::sw16(v0, v1, v2, v3); d[0] = v0; - d[1] = v1; - d[32] = v2; + d[1] = v2; + d[32] = v1; d[33] = v3; } diff --git a/plugins/GSdx/GSCrc.cpp b/plugins/GSdx/GSCrc.cpp index bb62f71145..09a7b756cb 100644 --- a/plugins/GSdx/GSCrc.cpp +++ b/plugins/GSdx/GSCrc.cpp @@ -88,7 +88,7 @@ CRC::Game CRC::m_games[] = {0xC19A374E, SoTC, US, 0}, {0x7D8F539A, SoTC, EU, 0}, {0x3122B508, OnePieceGrandAdventure, US, 0}, - {0x8DF14A24, OnePieceGrandAdventure, Unknown, 0}, + {0x8DF14A24, OnePieceGrandAdventure, EU, 0}, {0xB049DD5E, OnePieceGrandBattle, US, 0}, {0x5D02CC5B, OnePieceGrandBattle, Unknown, 0}, {0x6F8545DB, ICO, US, 0}, diff --git a/plugins/GSdx/GSDevice9.cpp b/plugins/GSdx/GSDevice9.cpp index 89d733b51a..5fb5f47483 100644 --- a/plugins/GSdx/GSDevice9.cpp +++ b/plugins/GSdx/GSDevice9.cpp @@ -108,7 +108,7 @@ bool GSDevice9::Create(GSWnd* wnd, bool vsync) m_d3d->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &m_d3dcaps); - if(!Reset(1, 1, theApp.GetConfig("ModeWidth", 0) > 0 ? Fullscreen : Windowed)) return false; + if(!Reset(1, 1, theApp.GetConfig("windowed", 1) ? Windowed : Fullscreen)) return false; m_dev->Clear(0, NULL, D3DCLEAR_TARGET, 0, 1.0f, 0); diff --git a/plugins/GSdx/GSRenderer.cpp b/plugins/GSdx/GSRenderer.cpp index d350579770..3d353fcd12 100644 --- a/plugins/GSdx/GSRenderer.cpp +++ b/plugins/GSdx/GSRenderer.cpp @@ -54,9 +54,9 @@ GSRenderer::~GSRenderer() delete m_dev; } -bool GSRenderer::Create(const string& title) +bool GSRenderer::Create(const string& title, int w, int h) { - if(!m_wnd.Create(title.c_str())) + if(!m_wnd.Create(title.c_str(), w, h)) { return false; } diff --git a/plugins/GSdx/GSRenderer.h b/plugins/GSdx/GSRenderer.h index 0c319456f5..00e3277659 100644 --- a/plugins/GSdx/GSRenderer.h +++ b/plugins/GSdx/GSRenderer.h @@ -73,7 +73,7 @@ public: GSRenderer(uint8* base, bool mt, void (*irq)(), GSDevice* dev); virtual ~GSRenderer(); - virtual bool Create(const string& title); + virtual bool Create(const string& title, int w, int h); virtual void VSync(int field); virtual bool MakeSnapshot(const string& path); virtual void KeyEvent(GSKeyEventData* e); diff --git a/plugins/GSdx/GSRendererDX.h b/plugins/GSdx/GSRendererDX.h index 33e5611814..391acf59a8 100644 --- a/plugins/GSdx/GSRendererDX.h +++ b/plugins/GSdx/GSRendererDX.h @@ -54,9 +54,9 @@ public: delete m_tfx; } - bool Create(const string& title) + bool Create(const string& title, int w, int h) { - if(!__super::Create(title)) + if(!__super::Create(title, w, h)) return false; if(!m_tfx->Create(m_dev)) diff --git a/plugins/GSdx/GSRendererDX10.cpp b/plugins/GSdx/GSRendererDX10.cpp index d4118498f7..7a91b107fc 100644 --- a/plugins/GSdx/GSRendererDX10.cpp +++ b/plugins/GSdx/GSRendererDX10.cpp @@ -30,9 +30,9 @@ GSRendererDX10::GSRendererDX10(uint8* base, bool mt, void (*irq)()) InitVertexKick(); } -bool GSRendererDX10::Create(const string& title) +bool GSRendererDX10::Create(const string& title, int w, int h) { - if(!__super::Create(title)) + if(!__super::Create(title, w, h)) return false; // diff --git a/plugins/GSdx/GSRendererDX10.h b/plugins/GSdx/GSRendererDX10.h index 1465fff56e..9f6e475f4f 100644 --- a/plugins/GSdx/GSRendererDX10.h +++ b/plugins/GSdx/GSRendererDX10.h @@ -41,7 +41,7 @@ protected: public: GSRendererDX10(uint8* base, bool mt, void (*irq)()); - bool Create(const string& title); + bool Create(const string& title, int w, int h); template void VertexKick(bool skip); }; \ No newline at end of file diff --git a/plugins/GSdx/GSRendererDX11.cpp b/plugins/GSdx/GSRendererDX11.cpp index 6f8a5cbf71..3090a8dfa0 100644 --- a/plugins/GSdx/GSRendererDX11.cpp +++ b/plugins/GSdx/GSRendererDX11.cpp @@ -30,9 +30,9 @@ GSRendererDX11::GSRendererDX11(uint8* base, bool mt, void (*irq)()) InitVertexKick(); } -bool GSRendererDX11::Create(const string& title) +bool GSRendererDX11::Create(const string& title, int w, int h) { - if(!__super::Create(title)) + if(!__super::Create(title, w, h)) return false; // diff --git a/plugins/GSdx/GSRendererDX11.h b/plugins/GSdx/GSRendererDX11.h index e30f2e7c07..919aa4b7b0 100644 --- a/plugins/GSdx/GSRendererDX11.h +++ b/plugins/GSdx/GSRendererDX11.h @@ -42,7 +42,7 @@ protected: public: GSRendererDX11(uint8* base, bool mt, void (*irq)()); - bool Create(const string& title); + bool Create(const string& title, int w, int h); template void VertexKick(bool skip); }; \ No newline at end of file diff --git a/plugins/GSdx/GSRendererDX9.cpp b/plugins/GSdx/GSRendererDX9.cpp index 5b664437bc..e64d10be12 100644 --- a/plugins/GSdx/GSRendererDX9.cpp +++ b/plugins/GSdx/GSRendererDX9.cpp @@ -30,9 +30,9 @@ GSRendererDX9::GSRendererDX9(uint8* base, bool mt, void (*irq)()) InitVertexKick(); } -bool GSRendererDX9::Create(const string& title) +bool GSRendererDX9::Create(const string& title, int w, int h) { - if(!__super::Create(title)) + if(!__super::Create(title, w, h)) return false; // diff --git a/plugins/GSdx/GSRendererDX9.h b/plugins/GSdx/GSRendererDX9.h index 1bebe4e490..821896d9e1 100644 --- a/plugins/GSdx/GSRendererDX9.h +++ b/plugins/GSdx/GSRendererDX9.h @@ -48,7 +48,7 @@ protected: public: GSRendererDX9(uint8* base, bool mt, void (*irq)()); - bool Create(const string& title); + bool Create(const string& title, int w, int h); template void VertexKick(bool skip); }; diff --git a/plugins/GSdx/GSRendererOGL.cpp b/plugins/GSdx/GSRendererOGL.cpp index 107eea2bab..d3319f513e 100644 --- a/plugins/GSdx/GSRendererOGL.cpp +++ b/plugins/GSdx/GSRendererOGL.cpp @@ -30,9 +30,9 @@ GSRendererOGL::GSRendererOGL(uint8* base, bool mt, void (*irq)()) InitVertexKick(); } -bool GSRendererOGL::Create(const string& title) +bool GSRendererOGL::Create(const string& title, int w, int h) { - if(!__super::Create(title)) + if(!__super::Create(title, w, h)) return false; // TODO diff --git a/plugins/GSdx/GSRendererOGL.h b/plugins/GSdx/GSRendererOGL.h index 9dc3587b93..9bf632401a 100644 --- a/plugins/GSdx/GSRendererOGL.h +++ b/plugins/GSdx/GSRendererOGL.h @@ -34,7 +34,7 @@ protected: public: GSRendererOGL(uint8* base, bool mt, void (*irq)()); - bool Create(const string& title); + bool Create(const string& title, int w, int h); template void VertexKick(bool skip); }; \ No newline at end of file diff --git a/plugins/GSdx/GSSettingsDlg.cpp b/plugins/GSdx/GSSettingsDlg.cpp index a897211214..2c9945b236 100644 --- a/plugins/GSdx/GSSettingsDlg.cpp +++ b/plugins/GSdx/GSSettingsDlg.cpp @@ -79,7 +79,7 @@ void GSSettingsDlg::OnInit() memset(&mode, 0, sizeof(mode)); m_modes.push_back(mode); - ComboBoxAppend(IDC_RESOLUTION, "Windowed", (LPARAM)&m_modes.back(), true); + ComboBoxAppend(IDC_RESOLUTION, "Please select...", (LPARAM)&m_modes.back(), true); if(CComPtr d3d = Direct3DCreate9(D3D_SDK_VERSION)) { @@ -120,6 +120,7 @@ void GSSettingsDlg::OnInit() ComboBoxInit(IDC_INTERLACE, g_interlace, countof(g_interlace), theApp.GetConfig("Interlace", 0)); ComboBoxInit(IDC_ASPECTRATIO, g_aspectratio, countof(g_aspectratio), theApp.GetConfig("AspectRatio", 1)); + CheckDlgButton(m_hWnd, IDC_WINDOWED, theApp.GetConfig("windowed", 1)); CheckDlgButton(m_hWnd, IDC_FILTER, theApp.GetConfig("filter", 2)); CheckDlgButton(m_hWnd, IDC_PALTEX, theApp.GetConfig("paltex", 1)); CheckDlgButton(m_hWnd, IDC_VSYNC, theApp.GetConfig("vsync", 0)); @@ -179,6 +180,7 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code) theApp.SetConfig("AspectRatio", (int)data); } + theApp.SetConfig("windowed", (int)IsDlgButtonChecked(m_hWnd, IDC_WINDOWED)); theApp.SetConfig("filter", (int)IsDlgButtonChecked(m_hWnd, IDC_FILTER)); theApp.SetConfig("paltex", (int)IsDlgButtonChecked(m_hWnd, IDC_PALTEX)); theApp.SetConfig("vsync", (int)IsDlgButtonChecked(m_hWnd, IDC_VSYNC)); @@ -215,7 +217,7 @@ void GSSettingsDlg::UpdateControls() // TODO: ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO11), dx11 ? SW_SHOW : SW_HIDE); // TODO: ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO_OGL), ogl ? SW_SHOW : SW_HIDE); - EnableWindow(GetDlgItem(m_hWnd, IDC_RESOLUTION), dx9); + EnableWindow(GetDlgItem(m_hWnd, IDC_WINDOWED), dx9); EnableWindow(GetDlgItem(m_hWnd, IDC_RESX), hw && !native); EnableWindow(GetDlgItem(m_hWnd, IDC_RESX_EDIT), hw && !native); EnableWindow(GetDlgItem(m_hWnd, IDC_RESY), hw && !native); diff --git a/plugins/GSdx/GSState.cpp b/plugins/GSdx/GSState.cpp index 65b0b12c0a..f290e264b3 100644 --- a/plugins/GSdx/GSState.cpp +++ b/plugins/GSdx/GSState.cpp @@ -1947,9 +1947,9 @@ bool GSC_OnePieceGrandAdventure(const GSFrameInfo& fi, int& skip) { if(skip == 0) { - if(fi.TME && fi.FBP == 0x02d00 && fi.FPSM == PSM_PSMCT16 && (fi.TBP0 == 0x00000 || fi.TBP0 == 0x00e00) && fi.TPSM == PSM_PSMCT16) + if(fi.TME && fi.FBP == 0x02d00 && fi.FPSM == PSM_PSMCT16 && (fi.TBP0 == 0x00000 || fi.TBP0 == 0x00e00 || fi.TBP0 == 0x00f00) && fi.TPSM == PSM_PSMCT16) { - skip = 3; + skip = 4; } } diff --git a/plugins/GSdx/GSTextureFX10.cpp b/plugins/GSdx/GSTextureFX10.cpp index ae2b6ecde5..6c05d522fe 100644 --- a/plugins/GSdx/GSTextureFX10.cpp +++ b/plugins/GSdx/GSTextureFX10.cpp @@ -327,7 +327,6 @@ void GSTextureFX10::UpdateOM(OMDepthStencilSelector dssel, OMBlendSelector bsel, if(om_dss == NULL) { - D3D10_DEPTH_STENCIL_DESC dsd; memset(&dsd, 0, sizeof(dsd)); diff --git a/plugins/GSdx/GSTextureFX10.h b/plugins/GSdx/GSTextureFX10.h index cbceaff8dc..569668a8f9 100644 --- a/plugins/GSdx/GSTextureFX10.h +++ b/plugins/GSdx/GSTextureFX10.h @@ -36,7 +36,7 @@ class GSTextureFX10 : public GSTextureFX CComPtr m_palette_ss; // hash_map > m_om_dss; CComPtr m_om_dss[32]; - hash_map > m_om_bs; + hash_map > m_om_bs; VSConstantBuffer m_vs_cb_cache; PSConstantBuffer m_ps_cb_cache; diff --git a/plugins/GSdx/GSWnd.cpp b/plugins/GSdx/GSWnd.cpp index 3f148dbc6b..c86edc1408 100644 --- a/plugins/GSdx/GSWnd.cpp +++ b/plugins/GSdx/GSWnd.cpp @@ -75,24 +75,8 @@ LRESULT GSWnd::OnMessage(UINT message, WPARAM wParam, LPARAM lParam) return DefWindowProc(m_hWnd, message, wParam, lParam); } -bool GSWnd::Create(const string& title) +bool GSWnd::Create(const string& title, int w, int h) { - GSVector4i r; - - GetWindowRect(GetDesktopWindow(), r); - - int w = r.width() / 3; - int h = r.width() / 4; - - if(!GetSystemMetrics(SM_REMOTESESSION)) - { - w *= 2; - h *= 2; - } - - int x = (r.left + r.right - w) / 2; - int y = (r.top + r.bottom - h) / 2; - WNDCLASS wc; memset(&wc, 0, sizeof(wc)); @@ -115,7 +99,32 @@ bool GSWnd::Create(const string& title) 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); + GSVector4i r; + + GetWindowRect(GetDesktopWindow(), r); + + bool remote = !!GetSystemMetrics(SM_REMOTESESSION); + + if(w <= 0 || h <= 0 || remote) + { + w = r.width() / 3; + h = r.width() / 4; + + if(!remote) + { + w *= 2; + h *= 2; + } + } + + r.left = (r.left + r.right - w) / 2; + r.top = (r.top + r.bottom - h) / 2; + r.right = r.left + w; + r.bottom = r.top + h; + + AdjustWindowRect(r, style, FALSE); + + m_hWnd = CreateWindow(wc.lpszClassName, title.c_str(), style, r.left, r.top, r.width(), r.height(), NULL, NULL, wc.hInstance, (LPVOID)this); if(!m_hWnd) { diff --git a/plugins/GSdx/GSWnd.h b/plugins/GSdx/GSWnd.h index ce5a0bebcf..8f0a72a0d4 100644 --- a/plugins/GSdx/GSWnd.h +++ b/plugins/GSdx/GSWnd.h @@ -34,7 +34,7 @@ public: GSWnd(); virtual ~GSWnd(); - bool Create(const string& title); + bool Create(const string& title, int w, int h); bool Attach(HWND hWnd); void* GetHandle() {return m_hWnd;} diff --git a/plugins/GSdx/GSdx.rc b/plugins/GSdx/GSdx.rc index 71d99ae1a6..b25ffeab70 100644 --- a/plugins/GSdx/GSdx.rc +++ b/plugins/GSdx/GSdx.rc @@ -110,9 +110,10 @@ BEGIN CONTROL "Logarithmic Z",IDC_LOGZ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,153,58,10 CONTROL "Allow 8-bit textures",IDC_PALTEX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,165,82,10 CONTROL "Alpha correction (FBA)",IDC_FBA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,166,93,10 - CONTROL "Wait vsync",IDC_VSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,177,51,10 - CONTROL "Edge anti-aliasing (AA1, sw-mode only)",IDC_AA1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,190,141,10 - CONTROL "Enable output merger blur effect",IDC_BLUR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,204,121,10 + CONTROL "Wait VSync",IDC_VSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,180,51,10 + CONTROL "Windowed",IDC_WINDOWED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,180,93,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_BLUR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,208,121,10 DEFPUSHBUTTON "OK",IDOK,43,232,50,14 PUSHBUTTON "Cancel",IDCANCEL,96,232,50,14 END @@ -149,14 +150,15 @@ BEGIN COMBOBOX IDC_DITHERING,78,102,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "Aspect Ratio (PgDn):",IDC_STATIC,7,120,68,8 COMBOBOX IDC_ASPECTRATIO,78,117,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Rendering Threads:",IDC_STATIC,7,150,64,8 - EDITTEXT IDC_SWTHREADS_EDIT,78,148,35,13,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,99,154,11,14 + LTEXT "Rendering Threads:",IDC_STATIC,7,157,64,8 + EDITTEXT IDC_SWTHREADS_EDIT,78,155,35,13,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,99,161,11,14 DEFPUSHBUTTON "OK",IDOK,43,178,50,14 PUSHBUTTON "Cancel",IDCANCEL,96,178,50,14 CONTROL 2022,IDC_LOGO10,"Static",SS_BITMAP,7,7,173,42 LTEXT "Internal Resolution:",IDC_STATIC,7,135,64,8 COMBOBOX IDC_SCALE,78,132,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "Windowed",IDC_WINDOWED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,129,157,49,10 END diff --git a/plugins/GSdx/resource.h b/plugins/GSdx/resource.h index a0e99b015b..7d291cdced 100644 --- a/plugins/GSdx/resource.h +++ b/plugins/GSdx/resource.h @@ -40,6 +40,7 @@ #define IDC_WIDTH 2036 #define IDC_HEIGHT 2037 #define IDC_CONFIGURE 2038 +#define IDC_WINDOWED 2039 #define IDR_CONVERT_FX 10000 #define IDR_TFX_FX 10001 #define IDR_MERGE_FX 10002 @@ -51,7 +52,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 10004 #define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 2039 +#define _APS_NEXT_CONTROL_VALUE 2040 #define _APS_NEXT_SYMED_VALUE 5000 #endif #endif