diff --git a/Core/Config.cpp b/Core/Config.cpp index 6803d81efd..c909ab7620 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -487,7 +487,6 @@ static ConfigSetting graphicsSettings[] = { // Not really a graphics setting... ReportedConfigSetting("TimerHack", &g_Config.bTimerHack, &DefaultTimerHack, true, true), - ReportedConfigSetting("AlphaMaskHack", &g_Config.bAlphaMaskHack, false, true, true), ReportedConfigSetting("SplineBezierQuality", &g_Config.iSplineBezierQuality, 2, true, true), ReportedConfigSetting("PostShader", &g_Config.sPostShaderName, "Off", true, true), diff --git a/Core/Config.h b/Core/Config.h index af03245310..318fa89d07 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -190,7 +190,6 @@ public: bool bAlwaysDepthWrite; int iBloomHack; //0 = off, 1 = safe, 2 = balanced, 3 = aggressive bool bTimerHack; - bool bAlphaMaskHack; bool bBlockTransferGPU; bool bDisableSlowFramebufEffects; bool bFragmentTestCache; diff --git a/Core/MemMap.h b/Core/MemMap.h index 46d4c713ce..c49a41d119 100644 --- a/Core/MemMap.h +++ b/Core/MemMap.h @@ -282,7 +282,7 @@ inline bool IsValidAddress(const u32 address) { } else if ((address & 0x3F800000) == 0x04000000) { return true; } else if ((address & 0xBFFF0000) == 0x00010000) { - return true; + return (address & 0x0000FFFF) < SCRATCHPAD_SIZE; } else if ((address & 0x3F000000) >= 0x08000000 && (address & 0x3F000000) < 0x08000000 + g_MemorySize) { return true; } else { diff --git a/Core/MemMapFunctions.cpp b/Core/MemMapFunctions.cpp index bb04c3899e..93029d65ff 100644 --- a/Core/MemMapFunctions.cpp +++ b/Core/MemMapFunctions.cpp @@ -38,15 +38,14 @@ namespace Memory // GetPointer must always return an address in the bottom 32 bits of address space, so that 64-bit // programs don't have problems directly addressing any part of memory. -u8 *GetPointer(const u32 address) -{ +u8 *GetPointer(const u32 address) { if ((address & 0x3E000000) == 0x08000000) { // RAM return GetPointerUnchecked(address); } else if ((address & 0x3F800000) == 0x04000000) { // VRAM return GetPointerUnchecked(address); - } else if ((address & 0xBFFF0000) == 0x00010000) { + } else if ((address & 0xBFFF0000) == 0x00010000 && (address & 0x0000FFFF) < SCRATCHPAD_SIZE) { // Scratchpad return GetPointerUnchecked(address); } else if ((address & 0x3F000000) >= 0x08000000 && (address & 0x3F000000) < 0x08000000 + g_MemorySize) { @@ -63,13 +62,12 @@ u8 *GetPointer(const u32 address) Core_EnableStepping(true); host->SetDebugMode(true); } - return 0; + return nullptr; } } template -inline void ReadFromHardware(T &var, const u32 address) -{ +inline void ReadFromHardware(T &var, const u32 address) { // TODO: Figure out the fastest order of tests for both read and write (they are probably different). // TODO: Make sure this represents the mirrors in a correct way. @@ -81,7 +79,7 @@ inline void ReadFromHardware(T &var, const u32 address) } else if ((address & 0x3F800000) == 0x04000000) { // VRAM var = *((const T*)GetPointerUnchecked(address)); - } else if ((address & 0xBFFF0000) == 0x00010000) { + } else if ((address & 0xBFFF0000) == 0x00010000 && (address & 0x0000FFFF) < SCRATCHPAD_SIZE) { // Scratchpad var = *((const T*)GetPointerUnchecked(address)); } else if ((address & 0x3F000000) >= 0x08000000 && (address & 0x3F000000) < 0x08000000 + g_MemorySize) { @@ -108,8 +106,7 @@ inline void ReadFromHardware(T &var, const u32 address) } template -inline void WriteToHardware(u32 address, const T data) -{ +inline void WriteToHardware(u32 address, const T data) { // Could just do a base-relative write, too.... TODO if ((address & 0x3E000000) == 0x08000000) { @@ -118,7 +115,7 @@ inline void WriteToHardware(u32 address, const T data) } else if ((address & 0x3F800000) == 0x04000000) { // VRAM *(T*)GetPointerUnchecked(address) = data; - } else if ((address & 0xBFFF0000) == 0x00010000) { + } else if ((address & 0xBFFF0000) == 0x00010000 && (address & 0x0000FFFF) < SCRATCHPAD_SIZE) { // Scratchpad *(T*)GetPointerUnchecked(address) = data; } else if ((address & 0x3F000000) >= 0x08000000 && (address & 0x3F000000) < 0x08000000 + g_MemorySize) { @@ -160,7 +157,7 @@ bool IsVRAMAddress(const u32 address) { } bool IsScratchpadAddress(const u32 address) { - return (address & 0xBFFF0000) == 0x00010000; + return (address & 0xBFFF0000) == 0x00010000 && (address & 0x0000FFFF) < SCRATCHPAD_SIZE; } u8 Read_U8(const u32 _Address) diff --git a/GPU/Common/FramebufferCommon.cpp b/GPU/Common/FramebufferCommon.cpp index 7ff6b3961a..10a0237476 100644 --- a/GPU/Common/FramebufferCommon.cpp +++ b/GPU/Common/FramebufferCommon.cpp @@ -113,14 +113,17 @@ FramebufferManagerCommon::FramebufferManagerCommon() : displayFramebufPtr_(0), displayStride_(0), displayFormat_(GE_FORMAT_565), - displayFramebuf_(0), - prevDisplayFramebuf_(0), - prevPrevDisplayFramebuf_(0), + displayFramebuf_(nullptr), + prevDisplayFramebuf_(nullptr), + prevPrevDisplayFramebuf_(nullptr), frameLastFramebufUsed_(0), - currentRenderVfb_(0), + currentRenderVfb_(nullptr), framebufRangeEnd_(0), - hackForce04154000Download_(false), - updateVRAM_(false) { + updateVRAM_(false), + usePostShader_(false), + postShaderAtOutputResolution_(false), + postShaderIsUpscalingFilter_(false), + hackForce04154000Download_(false) { UpdateSize(); } @@ -889,6 +892,9 @@ void FramebufferManagerCommon::ShowScreenResolution() { std::ostringstream messageStream; messageStream << gr->T("Internal Resolution") << ": "; messageStream << PSP_CoreParameter().renderWidth << "x" << PSP_CoreParameter().renderHeight << " "; + if (postShaderIsUpscalingFilter_) { + messageStream << gr->T("(upscaling)") << " "; + } messageStream << gr->T("Window Size") << ": "; messageStream << PSP_CoreParameter().pixelWidth << "x" << PSP_CoreParameter().pixelHeight; diff --git a/GPU/Common/FramebufferCommon.h b/GPU/Common/FramebufferCommon.h index 1fc2767c88..badd9f6bef 100644 --- a/GPU/Common/FramebufferCommon.h +++ b/GPU/Common/FramebufferCommon.h @@ -273,6 +273,9 @@ protected: bool useBufferedRendering_; bool updateVRAM_; + bool usePostShader_; + bool postShaderAtOutputResolution_; + bool postShaderIsUpscalingFilter_; std::vector vfbs_; std::set> knownFramebufferRAMCopies_; diff --git a/GPU/GLES/Framebuffer.cpp b/GPU/GLES/Framebuffer.cpp index 5851f59b82..cfb16f7525 100644 --- a/GPU/GLES/Framebuffer.cpp +++ b/GPU/GLES/Framebuffer.cpp @@ -290,9 +290,6 @@ FramebufferManager::FramebufferManager() : pixelDeltaLoc_(-1), textureCache_(nullptr), shaderManager_(nullptr), - usePostShader_(false), - postShaderAtOutputResolution_(false), - postShaderIsUpscalingFilter_(false), resized_(false), gameUsesSequentialCopies_(false), pixelBufObj_(nullptr), diff --git a/GPU/GLES/Framebuffer.h b/GPU/GLES/Framebuffer.h index 0681b5ab00..13363b5a2d 100644 --- a/GPU/GLES/Framebuffer.h +++ b/GPU/GLES/Framebuffer.h @@ -166,9 +166,6 @@ private: TextureCache *textureCache_; ShaderManager *shaderManager_; TransformDrawEngine *transformDraw_; - bool usePostShader_; - bool postShaderAtOutputResolution_; - bool postShaderIsUpscalingFilter_; // Used by post-processing shader std::vector extraFBOs_; diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index efe03d47bf..e7ed9dea07 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -31,7 +31,6 @@ #include "Core/SaveState.h" #include "Core/Core.h" -extern std::map windowsTransTable; extern bool g_TakeScreenshot; namespace MainWindow { diff --git a/ext/native/base/PCMain.cpp b/ext/native/base/PCMain.cpp index 3009521f29..e3f79b92f2 100644 --- a/ext/native/base/PCMain.cpp +++ b/ext/native/base/PCMain.cpp @@ -672,42 +672,50 @@ int main(int argc, char *argv[]) { case SDL_QUIT: g_QuitRequested = 1; break; + #if !defined(MOBILE_DEVICE) case SDL_WINDOWEVENT: - switch (event.window.event) { + switch (event.window.event) { case SDL_WINDOWEVENT_RESIZED: - { - Uint32 window_flags = SDL_GetWindowFlags(g_Screen); - bool fullscreen = (window_flags & SDL_WINDOW_FULLSCREEN); + { + Uint32 window_flags = SDL_GetWindowFlags(g_Screen); + bool fullscreen = (window_flags & SDL_WINDOW_FULLSCREEN); - pixel_xres = event.window.data1; - pixel_yres = event.window.data2; - dp_xres = (float)pixel_xres * dpi_scale; - dp_yres = (float)pixel_yres * dpi_scale; - NativeResized(); + pixel_xres = event.window.data1; + pixel_yres = event.window.data2; + dp_xres = (float)pixel_xres * dpi_scale; + dp_yres = (float)pixel_yres * dpi_scale; + NativeResized(); #if defined(PPSSPP) - // Set variable here in case fullscreen was toggled by hotkey - g_Config.bFullScreen = fullscreen; + // Set variable here in case fullscreen was toggled by hotkey + g_Config.bFullScreen = fullscreen; - // Hide/Show cursor correctly toggling fullscreen - if (lastUIState == UISTATE_INGAME && fullscreen && !g_Config.bShowTouchControls) { - SDL_ShowCursor(SDL_DISABLE); - } else if (lastUIState != UISTATE_INGAME || !fullscreen) { - SDL_ShowCursor(SDL_ENABLE); - } -#endif - break; + // Hide/Show cursor correctly toggling fullscreen + if (lastUIState == UISTATE_INGAME && fullscreen && !g_Config.bShowTouchControls) { + SDL_ShowCursor(SDL_DISABLE); + } else if (lastUIState != UISTATE_INGAME || !fullscreen) { + SDL_ShowCursor(SDL_ENABLE); } + #endif break; } + + default: + break; + } + break; #endif case SDL_KEYDOWN: { int k = event.key.keysym.sym; KeyInput key; key.flags = KEY_DOWN; - key.keyCode = KeyMapRawSDLtoNative.find(k)->second; + auto mapped = KeyMapRawSDLtoNative.find(k); + if (mapped == KeyMapRawSDLtoNative.end() || mapped->second == NKCODE_UNKNOWN) { + break; + } + key.keyCode = mapped->second; key.deviceId = DEVICE_ID_KEYBOARD; NativeKey(key); @@ -722,7 +730,11 @@ int main(int argc, char *argv[]) { int k = event.key.keysym.sym; KeyInput key; key.flags = KEY_UP; - key.keyCode = KeyMapRawSDLtoNative.find(k)->second; + auto mapped = KeyMapRawSDLtoNative.find(k); + if (mapped == KeyMapRawSDLtoNative.end() || mapped->second == NKCODE_UNKNOWN) { + break; + } + key.keyCode = mapped->second; key.deviceId = DEVICE_ID_KEYBOARD; NativeKey(key); for (int i = 0; i < ARRAY_SIZE(legacyKeyMap); i++) {