winport - fix a bunch of sloppy broken stuff related to runtime changing of prescale and filtering

This commit is contained in:
zeromus 2015-09-28 08:34:21 +00:00
parent 15b6e7dbea
commit b0131342d4
2 changed files with 30 additions and 15 deletions

View File

@ -6321,11 +6321,16 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
CommonSettings.GFX3D_TXTHack = IsDlgCheckboxChecked(hw,IDC_TXTHACK); CommonSettings.GFX3D_TXTHack = IsDlgCheckboxChecked(hw,IDC_TXTHACK);
CommonSettings.GFX3D_PrescaleHD = SendDlgItemMessage(hw, IDC_NUD_PRESCALEHD, UDM_GETPOS, 0, 0); CommonSettings.GFX3D_PrescaleHD = SendDlgItemMessage(hw, IDC_NUD_PRESCALEHD, UDM_GETPOS, 0, 0);
Change3DCoreWithFallbackAndSave(ComboBox_GetCurSel(GetDlgItem(hw, IDC_3DCORE))); {
video.SetPrescale(CommonSettings.GFX3D_PrescaleHD,1); Lock lock(win_backbuffer_sync);
GPU->SetCustomFramebufferSize(256*video.prescaleHD,192*video.prescaleHD); if(display_mutex) g_mutex_lock(display_mutex);
ScaleScreen(windowSize, false); Change3DCoreWithFallbackAndSave(ComboBox_GetCurSel(GetDlgItem(hw, IDC_3DCORE)));
UpdateScreenRects(); video.SetPrescale(CommonSettings.GFX3D_PrescaleHD,1);
GPU->SetCustomFramebufferSize(256*video.prescaleHD,192*video.prescaleHD);
ScaleScreen(windowSize, false);
UpdateScreenRects();
if(display_mutex) g_mutex_unlock(display_mutex);
}
WritePrivateProfileBool("3D", "HighResolutionInterpolateColor", CommonSettings.GFX3D_HighResolutionInterpolateColor, IniName); WritePrivateProfileBool("3D", "HighResolutionInterpolateColor", CommonSettings.GFX3D_HighResolutionInterpolateColor, IniName);
WritePrivateProfileBool("3D", "EnableEdgeMark", CommonSettings.GFX3D_EdgeMark, IniName); WritePrivateProfileBool("3D", "EnableEdgeMark", CommonSettings.GFX3D_EdgeMark, IniName);

View File

@ -22,6 +22,12 @@ class VideoInfo
{ {
public: public:
VideoInfo()
: buffer(NULL)
, filteredbuffer(NULL)
{
}
int width; int width;
int height; int height;
@ -40,11 +46,14 @@ public:
int scratchBufferSize; int scratchBufferSize;
u8* srcBuffer; u8* srcBuffer;
int srcBufferSize; int srcBufferSize;
u32 *buffer; u32 *buffer, *buffer_raw;
u32 *filteredbuffer; u32 *filteredbuffer;
void SetPrescale(int prescaleHD, int prescalePost) void SetPrescale(int prescaleHD, int prescalePost)
{ {
free_aligned(buffer_raw);
free_aligned(filteredbuffer);
this->prescaleHD = prescaleHD; this->prescaleHD = prescaleHD;
this->prescalePost = prescalePost; this->prescalePost = prescalePost;
@ -60,7 +69,7 @@ public:
scratchBufferSize = scratchBufferWidth * scratchBufferHeight * 4; scratchBufferSize = scratchBufferWidth * scratchBufferHeight * 4;
//why are these the same size, anyway? //why are these the same size, anyway?
buffer = (u32*)malloc_alignedCacheLine(scratchBufferSize); buffer_raw = buffer = (u32*)malloc_alignedCacheLine(scratchBufferSize);
filteredbuffer = (u32*)malloc_alignedCacheLine(scratchBufferSize); filteredbuffer = (u32*)malloc_alignedCacheLine(scratchBufferSize);
clear(); clear();
@ -100,12 +109,13 @@ public:
void clear() void clear()
{ {
if (srcBuffer) //I dont understand this...
{ //if (srcBuffer)
memset(srcBuffer, 0xFF, size() * 2); //{
} // memset(srcBuffer, 0xFF, size() * 2);
memset(&buffer[0], 0, sizeof(buffer)); //}
memset(&filteredbuffer[0], 0, sizeof(filteredbuffer)); memset(buffer_raw, 0, scratchBufferSize);
memset(filteredbuffer, 0, scratchBufferSize);
} }
void reset() { void reset() {
@ -179,8 +189,8 @@ public:
src.Pitch = src.Width * 2; src.Pitch = src.Width * 2;
src.Surface = (u8*)buffer; src.Surface = (u8*)buffer;
dst.Height = height; dst.Height = height * prescaleHD;
dst.Width = width; dst.Width = width * prescaleHD;
dst.Pitch = width*2; dst.Pitch = width*2;
dst.Surface = (u8*)filteredbuffer; dst.Surface = (u8*)filteredbuffer;