Merge pull request #8317 from unknownbrackets/minor

Minor fixes to SDL + resolution display
This commit is contained in:
Henrik Rydgård 2015-12-28 19:46:18 +01:00
commit b117896b63
10 changed files with 57 additions and 48 deletions

View File

@ -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),

View File

@ -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;

View File

@ -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 {

View File

@ -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 <typename T>
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 <typename T>
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)

View File

@ -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;

View File

@ -273,6 +273,9 @@ protected:
bool useBufferedRendering_;
bool updateVRAM_;
bool usePostShader_;
bool postShaderAtOutputResolution_;
bool postShaderIsUpscalingFilter_;
std::vector<VirtualFramebuffer *> vfbs_;
std::set<std::pair<u32, u32>> knownFramebufferRAMCopies_;

View File

@ -290,9 +290,6 @@ FramebufferManager::FramebufferManager() :
pixelDeltaLoc_(-1),
textureCache_(nullptr),
shaderManager_(nullptr),
usePostShader_(false),
postShaderAtOutputResolution_(false),
postShaderIsUpscalingFilter_(false),
resized_(false),
gameUsesSequentialCopies_(false),
pixelBufObj_(nullptr),

View File

@ -166,9 +166,6 @@ private:
TextureCache *textureCache_;
ShaderManager *shaderManager_;
TransformDrawEngine *transformDraw_;
bool usePostShader_;
bool postShaderAtOutputResolution_;
bool postShaderIsUpscalingFilter_;
// Used by post-processing shader
std::vector<FBO *> extraFBOs_;

View File

@ -31,7 +31,6 @@
#include "Core/SaveState.h"
#include "Core/Core.h"
extern std::map<int, int> windowsTransTable;
extern bool g_TakeScreenshot;
namespace MainWindow {

View File

@ -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++) {