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; } diff --git a/win32/CDirect3D.cpp b/win32/CDirect3D.cpp index c0f09a9d..ed0d819a 100644 --- a/win32/CDirect3D.cpp +++ b/win32/CDirect3D.cpp @@ -294,8 +294,6 @@ bool CDirect3D::Initialize(HWND hWnd) init_done = true; - SetViewport(); - ApplyDisplayChanges(); return true; @@ -731,6 +729,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; @@ -738,9 +739,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); @@ -927,7 +925,6 @@ bool CDirect3D::ChangeRenderSize(unsigned int newWidth, unsigned int newHeight) if(!ResetDevice()) return false; - SetViewport(); return true; } @@ -1000,6 +997,9 @@ bool CDirect3D::ResetDevice() //recreate the surface CreateDrawSurface(); + + SetViewport(); + return true; } @@ -1042,7 +1042,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; } diff --git a/win32/wsnes9x.cpp b/win32/wsnes9x.cpp index 34463255..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}; @@ -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);