From 13e8c2dc3443ed5571563f25fe0af72f917d63b7 Mon Sep 17 00:00:00 2001 From: OV2 Date: Fri, 29 Apr 2011 13:01:06 +0200 Subject: [PATCH 1/4] Win32: fix custom rom dialog --- win32/wsnes9x.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/win32/wsnes9x.cpp b/win32/wsnes9x.cpp index 34463255..3330c2a8 100644 --- a/win32/wsnes9x.cpp +++ b/win32/wsnes9x.cpp @@ -5843,7 +5843,7 @@ INT_PTR CALLBACK DlgOpenROMProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara tvi.hItem=hTemp; TreeView_GetItem(dirList, &tvi); - if(_tcsstr(blah, temp) != 0) + if(_tcsicmp(blah, temp) != 0) { do { @@ -5854,7 +5854,7 @@ INT_PTR CALLBACK DlgOpenROMProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara tvi.hItem=hTemp; TreeView_GetItem(dirList, &tvi); } - while((hTemp != NULL) && (_tcsstr(blah, temp) != 0)); + while((hTemp != NULL) && (_tcsicmp(blah, temp) != 0)); if(hTemp!=NULL) { @@ -5888,11 +5888,12 @@ INT_PTR CALLBACK DlgOpenROMProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara { LVFINDINFO lvfi; ZeroMemory(&lvfi, sizeof(LVFINDINFO)); - TCHAR tmp[_MAX_PATH]; - TCHAR *tmp2; - lstrcpy(tmp,_tFromChar(Memory.ROMFilename)); + TCHAR filename[_MAX_PATH]; + TCHAR *tmp, *tmp2; + lstrcpy(filename,_tFromChar(Memory.ROMFilename)); + tmp = filename; while(tmp2=_tcsstr(tmp, TEXT("\\"))) - tmp2=tmp2+1; + tmp=tmp2+sizeof(TCHAR); lvfi.flags=LVFI_STRING; lvfi.psz=tmp2; @@ -6640,8 +6641,7 @@ bool RegisterProgid() { _stprintf_s(szRegKey,PATH_MAX-1,TEXT("Software\\Classes\\%s"),SNES9XWPROGID); REGCREATEKEY(HKEY_CURRENT_USER, szRegKey) - int test = lstrlen(SNES9XWPROGIDDESC) + 1; - REGSETVALUE(hKey,NULL,REG_SZ,SNES9XWPROGIDDESC,22) + REGSETVALUE(hKey,NULL,REG_SZ,SNES9XWPROGIDDESC,(lstrlen(SNES9XWPROGIDDESC) + 1) * sizeof(TCHAR)) RegCloseKey(hKey); _stprintf_s(szRegKey,PATH_MAX-1,TEXT("Software\\Classes\\%s\\DefaultIcon"),SNES9XWPROGID); From 1482cae24d3d7a85944af401739cfe74027d3bba Mon Sep 17 00:00:00 2001 From: OV2 Date: Sat, 30 Apr 2011 01:26:42 +0200 Subject: [PATCH 2/4] Win32: set viewport on device reset, clear image before image size changes --- win32/CDirect3D.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/win32/CDirect3D.cpp b/win32/CDirect3D.cpp index 335a7d08..28a6743e 100644 --- a/win32/CDirect3D.cpp +++ b/win32/CDirect3D.cpp @@ -293,8 +293,6 @@ bool CDirect3D::Initialize(HWND hWnd) init_done = true; - SetViewport(); - ApplyDisplayChanges(); return true; @@ -730,6 +728,9 @@ void CDirect3D::Render(SSurface Src) drawSurface->UnlockRect(0); } + if(!GUI.Stretch||GUI.AspectRatio) + pDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); + //if the output size of the render method changes we need to update the viewport if(afterRenderHeight != dstRect.bottom || afterRenderWidth != dstRect.right) { afterRenderHeight = dstRect.bottom; @@ -737,9 +738,6 @@ void CDirect3D::Render(SSurface Src) SetViewport(); } - if(!GUI.Stretch||GUI.AspectRatio) - pDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); - pDevice->BeginScene(); pDevice->SetTexture(0, drawSurface); @@ -926,7 +924,6 @@ bool CDirect3D::ChangeRenderSize(unsigned int newWidth, unsigned int newHeight) if(!ResetDevice()) return false; - SetViewport(); return true; } @@ -999,6 +996,9 @@ bool CDirect3D::ResetDevice() //recreate the surface CreateDrawSurface(); + + SetViewport(); + return true; } @@ -1041,7 +1041,7 @@ bool CDirect3D::SetFullscreen(bool fullscreen) //present here to get a fullscreen blank even if no rendering is done pDevice->Present(NULL,NULL,NULL,NULL); - SetupVertices(); + return true; } From f342d6b1379913b7c80bb1323b20352a79b5adbb Mon Sep 17 00:00:00 2001 From: OV2 Date: Sun, 1 May 2011 15:33:37 +0200 Subject: [PATCH 3/4] Apply APUAllowTimeOverflow to Porky Pig's Haunted Holiday --- memmap.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/memmap.cpp b/memmap.cpp index bc5feba3..54e422c4 100644 --- a/memmap.cpp +++ b/memmap.cpp @@ -3547,6 +3547,7 @@ void CMemory::ApplyROMFixes (void) match_na ("MSPACMAN") || // Ms Pacman match_na ("THE MASK") || // The Mask match_na ("PRIMAL RAGE") || // Primal Rage + match_na ("PORKY PIGS HAUNTED") || match_na ("DOOM TROOPERS")) // Doom Troopers Timings.APUAllowTimeOverflow = TRUE; } From 3a1aa9ddde848b70e93a4373ddd1981814433927 Mon Sep 17 00:00:00 2001 From: OV2 Date: Sun, 1 May 2011 15:34:20 +0200 Subject: [PATCH 4/4] Win32: fix open rom extension filters --- win32/wsnes9x.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win32/wsnes9x.cpp b/win32/wsnes9x.cpp index 3330c2a8..ed34ef47 100644 --- a/win32/wsnes9x.cpp +++ b/win32/wsnes9x.cpp @@ -1351,7 +1351,7 @@ static bool DoOpenRomDialog(TCHAR filename [_MAX_PATH], bool noCustomDlg = false _tfullpath(szPathName, S9xGetDirectoryT(ROM_DIR), MAX_PATH); // a limited strcat that doesn't mind null characters -#define strcat0(to,from) do{memcpy(to,from,sizeof(from)-1);to+=sizeof(from)-1;}while(false) +#define strcat0(to,from) do{memcpy(to,from,sizeof(from)-1);to+=(sizeof(from)/sizeof(TCHAR))-1;}while(false) // make filter string using entries in valid_ext TCHAR lpfilter [8192] = {0};