mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-05 18:46:18 +02:00
Merge pull request #8377 from unknownbrackets/minor
Improve some ifdef usage, minor GL error fix
This commit is contained in:
commit
f0e19c993d
10 files changed
+34
-35
No files matched your search
+3
-3
@@ -120,7 +120,9 @@ private:
|
||||
#define __chdir chdir
|
||||
#endif
|
||||
|
||||
#if defined __GNUC__
|
||||
#if !defined(__GNUC__) && (defined(_M_X64) || defined(_M_IX86))
|
||||
# define _M_SSE 0x402
|
||||
#else
|
||||
# if defined __SSE4_2__
|
||||
# define _M_SSE 0x402
|
||||
# elif defined __SSE4_1__
|
||||
@@ -132,8 +134,6 @@ private:
|
||||
# elif defined __SSE2__
|
||||
# define _M_SSE 0x200
|
||||
# endif
|
||||
#elif ((_MSC_VER >= 1500) || __INTEL_COMPILER) && !defined(_XBOX) // Visual Studio 2008
|
||||
# define _M_SSE 0x402
|
||||
#endif
|
||||
|
||||
#include "Swap.h"
|
||||
+15
-15
@@ -33,7 +33,7 @@
|
||||
#include "ConsoleListener.h" // Common
|
||||
#include "Atomics.h"
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#if defined(USING_WIN_UI)
|
||||
const int LOG_PENDING_MAX = 120 * 10000;
|
||||
const int LOG_LATENCY_DELAY_MS = 20;
|
||||
const int LOG_SHUTDOWN_DELAY_MS = 250;
|
||||
@@ -51,7 +51,7 @@ volatile u32 ConsoleListener::logPendingWritePos = 0;
|
||||
|
||||
ConsoleListener::ConsoleListener() : bHidden(true)
|
||||
{
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#if defined(USING_WIN_UI)
|
||||
hConsole = NULL;
|
||||
bUseColor = true;
|
||||
|
||||
@@ -62,7 +62,7 @@ ConsoleListener::ConsoleListener() : bHidden(true)
|
||||
logPending = new char[LOG_PENDING_MAX];
|
||||
}
|
||||
++refCount;
|
||||
#elif defined(_XBOX)
|
||||
#elif defined(_WIN32)
|
||||
bUseColor = false;
|
||||
#else
|
||||
bUseColor = isatty(fileno(stdout));
|
||||
@@ -104,7 +104,7 @@ bool WINAPI ConsoleHandler(DWORD msgType)
|
||||
// Name is the window title
|
||||
void ConsoleListener::Init(bool AutoOpen, int Width, int Height, const char *Title)
|
||||
{
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#if defined(USING_WIN_UI)
|
||||
openWidth_ = Width;
|
||||
openHeight_ = Height;
|
||||
title_ = ConvertUTF8ToWString(Title);
|
||||
@@ -116,7 +116,7 @@ void ConsoleListener::Init(bool AutoOpen, int Width, int Height, const char *Tit
|
||||
|
||||
void ConsoleListener::Open()
|
||||
{
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#if defined(USING_WIN_UI)
|
||||
if (!GetConsoleWindow())
|
||||
{
|
||||
// Open the console window and create the window handle for GetStdHandle()
|
||||
@@ -150,7 +150,7 @@ void ConsoleListener::Open()
|
||||
|
||||
void ConsoleListener::Show(bool bShow)
|
||||
{
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#if defined(USING_WIN_UI)
|
||||
if (bShow && bHidden)
|
||||
{
|
||||
if (!IsOpen())
|
||||
@@ -169,7 +169,7 @@ void ConsoleListener::Show(bool bShow)
|
||||
|
||||
void ConsoleListener::UpdateHandle()
|
||||
{
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#if defined(USING_WIN_UI)
|
||||
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
#endif
|
||||
}
|
||||
@@ -177,7 +177,7 @@ void ConsoleListener::UpdateHandle()
|
||||
// Close the console window and close the eventual file handle
|
||||
void ConsoleListener::Close()
|
||||
{
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#if defined(USING_WIN_UI)
|
||||
if (hConsole == NULL)
|
||||
return;
|
||||
|
||||
@@ -215,7 +215,7 @@ void ConsoleListener::Close()
|
||||
|
||||
bool ConsoleListener::IsOpen()
|
||||
{
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#if defined(USING_WIN_UI)
|
||||
return (hConsole != NULL);
|
||||
#else
|
||||
return true;
|
||||
@@ -229,7 +229,7 @@ bool ConsoleListener::IsOpen()
|
||||
void ConsoleListener::BufferWidthHeight(int BufferWidth, int BufferHeight, int ScreenWidth, int ScreenHeight, bool BufferFirst)
|
||||
{
|
||||
_dbg_assert_msg_(COMMON, IsOpen(), "Don't call this before opening the console.");
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#if defined(USING_WIN_UI)
|
||||
BOOL SB, SW;
|
||||
if (BufferFirst)
|
||||
{
|
||||
@@ -254,7 +254,7 @@ void ConsoleListener::BufferWidthHeight(int BufferWidth, int BufferHeight, int S
|
||||
void ConsoleListener::LetterSpace(int Width, int Height)
|
||||
{
|
||||
_dbg_assert_msg_(COMMON, IsOpen(), "Don't call this before opening the console.");
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#if defined(USING_WIN_UI)
|
||||
// Get console info
|
||||
CONSOLE_SCREEN_BUFFER_INFO ConInfo;
|
||||
GetConsoleScreenBufferInfo(hConsole, &ConInfo);
|
||||
@@ -280,7 +280,7 @@ void ConsoleListener::LetterSpace(int Width, int Height)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#if defined(USING_WIN_UI)
|
||||
COORD ConsoleListener::GetCoordinates(int BytesRead, int BufferWidth)
|
||||
{
|
||||
COORD Ret = {0, 0};
|
||||
@@ -505,7 +505,7 @@ void ConsoleListener::WriteToConsole(LogTypes::LOG_LEVELS Level, const char *Tex
|
||||
void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool Resize)
|
||||
{
|
||||
_dbg_assert_msg_(COMMON, IsOpen(), "Don't call this before opening the console.");
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#if defined(USING_WIN_UI)
|
||||
// Check size
|
||||
if (Width < 8 || Height < 12) return;
|
||||
|
||||
@@ -589,7 +589,7 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool
|
||||
|
||||
void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text)
|
||||
{
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#if defined(USING_WIN_UI)
|
||||
if (hThread == NULL && IsOpen())
|
||||
WriteToConsole(Level, Text, strlen(Text));
|
||||
else
|
||||
@@ -623,7 +623,7 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text)
|
||||
void ConsoleListener::ClearScreen(bool Cursor)
|
||||
{
|
||||
_dbg_assert_msg_(COMMON, IsOpen(), "Don't call this before opening the console.");
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#if defined(USING_WIN_UI)
|
||||
COORD coordScreen = { 0, 0 };
|
||||
DWORD cCharsWritten;
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
void LetterSpace(int Width, int Height);
|
||||
void BufferWidthHeight(int BufferWidth, int BufferHeight, int ScreenWidth, int ScreenHeight, bool BufferFirst);
|
||||
void PixelSpace(int Left, int Top, int Width, int Height, bool);
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#if defined(USING_WIN_UI)
|
||||
COORD GetCoordinates(int BytesRead, int BufferWidth);
|
||||
#endif
|
||||
void Log(LogTypes::LOG_LEVELS, const char *Text);
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
void Show(bool bShow);
|
||||
bool Hidden() const { return bHidden; }
|
||||
private:
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#if defined(USING_WIN_UI)
|
||||
HWND hWnd;
|
||||
HANDLE hConsole;
|
||||
|
||||
|
||||
+3
-3
@@ -17,8 +17,8 @@
|
||||
|
||||
#if defined(SDL)
|
||||
#include <SDL_keyboard.h>
|
||||
#elif defined(_WIN32) && !defined(_XBOX)
|
||||
#include <windows.h>
|
||||
#elif defined(USING_WIN_UI)
|
||||
#include "CommonWindows.h"
|
||||
#endif
|
||||
#include <set>
|
||||
|
||||
@@ -374,7 +374,7 @@ void SetDefaultKeyMap(DefaultMaps dmap, bool replace) {
|
||||
azerty = true;
|
||||
else if (q == 'q' && w == 'w' && y == 'z')
|
||||
qwertz = true;
|
||||
#elif defined(_WIN32) && !defined(_XBOX)
|
||||
#elif defined(USING_WIN_UI)
|
||||
HKL localeId = GetKeyboardLayout(0);
|
||||
// TODO: Is this list complete enough?
|
||||
switch ((int)(intptr_t)localeId & 0xFFFF) {
|
||||
|
||||
@@ -118,7 +118,7 @@ LogManager::LogManager() {
|
||||
#if !(defined(MOBILE_DEVICE) || defined(_XBOX)) || defined(_DEBUG)
|
||||
log_[i]->AddListener(fileLog_);
|
||||
log_[i]->AddListener(consoleLog_);
|
||||
#if defined(_MSC_VER) && !defined(_XBOX)
|
||||
#if defined(_MSC_VER) && defined(USING_WIN_UI)
|
||||
if (IsDebuggerPresent() && debuggerLog_ != NULL && LOG_MSC_OUTPUTDEBUG)
|
||||
log_[i]->AddListener(debuggerLog_);
|
||||
#endif
|
||||
@@ -133,7 +133,7 @@ LogManager::~LogManager() {
|
||||
if (fileLog_ != NULL)
|
||||
logManager_->RemoveListener((LogTypes::LOG_TYPE)i, fileLog_);
|
||||
logManager_->RemoveListener((LogTypes::LOG_TYPE)i, consoleLog_);
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) && defined(USING_WIN_UI)
|
||||
logManager_->RemoveListener((LogTypes::LOG_TYPE)i, debuggerLog_);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -67,7 +67,7 @@ bool MsgAlert(bool yes_no, int Style, const char* format, ...)
|
||||
// Default non library dependent panic alert
|
||||
bool MsgHandler(const char* caption, const char* text, bool yes_no, int Style)
|
||||
{
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#if defined(USING_WIN_UI)
|
||||
int STYLE = MB_ICONINFORMATION;
|
||||
if (Style == QUESTION) STYLE = MB_ICONQUESTION;
|
||||
if (Style == WARNING) STYLE = MB_ICONWARNING;
|
||||
|
||||
+2
-2
@@ -153,14 +153,14 @@ std::string Timer::GetTimeElapsedFormatted() const
|
||||
// Get current time
|
||||
void Timer::IncreaseResolution()
|
||||
{
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#if defined(USING_WIN_UI)
|
||||
timeBeginPeriod(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Timer::RestoreResolution()
|
||||
{
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
#if defined(USING_WIN_UI)
|
||||
timeEndPeriod(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ void CenterDisplayOutputRect(float *x, float *y, float *w, float *h, float origW
|
||||
float offsetX = (g_Config.fSmallDisplayOffsetX - 0.5f) * 2.0f * frameW;
|
||||
float offsetY = (g_Config.fSmallDisplayOffsetY - 0.5f) * 2.0f * frameH;
|
||||
// Have to invert Y for GL
|
||||
#if defined(USING_WIN_UI)
|
||||
#ifdef _WIN32
|
||||
if (g_Config.iGPUBackend == GPU_BACKEND_OPENGL) { offsetY = offsetY * -1.0f; }
|
||||
#else
|
||||
offsetY = offsetY * -1.0f;
|
||||
|
||||
@@ -1173,18 +1173,16 @@ VertexDecoderJitCache::VertexDecoderJitCache()
|
||||
AllocCodeSpace(1024 * 64 * 4);
|
||||
|
||||
// Add some random code to "help" MSVC's buggy disassembler :(
|
||||
#if defined(_WIN32)
|
||||
#if defined(_WIN32) && (defined(_M_IX86) || defined(_M_X64))
|
||||
using namespace Gen;
|
||||
for (int i = 0; i < 100; i++) {
|
||||
MOV(32, R(EAX), R(EBX));
|
||||
RET();
|
||||
}
|
||||
#else
|
||||
#ifdef ARM
|
||||
#elif defined(ARM)
|
||||
BKPT(0);
|
||||
BKPT(0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void VertexDecoderJitCache::Clear() {
|
||||
|
||||
@@ -2086,7 +2086,7 @@ bool FramebufferManager::GetDepthbuffer(u32 fb_address, int fb_stride, u32 z_add
|
||||
if (vfb->fbo)
|
||||
fbo_bind_for_read(vfb->fbo);
|
||||
if (gl_extensions.GLES3 || !gl_extensions.IsGLES)
|
||||
glReadBuffer(GL_DEPTH_ATTACHMENT);
|
||||
glReadBuffer(GL_COLOR_ATTACHMENT0);
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 4);
|
||||
SafeGLReadPixels(0, 0, vfb->renderWidth, vfb->renderHeight, GL_DEPTH_COMPONENT, GL_FLOAT, buffer.GetData());
|
||||
|
||||
@@ -2110,7 +2110,8 @@ bool FramebufferManager::GetStencilbuffer(u32 fb_address, int fb_stride, GPUDebu
|
||||
buffer.Allocate(vfb->renderWidth, vfb->renderHeight, GPU_DBG_FORMAT_8BIT, false);
|
||||
if (vfb->fbo)
|
||||
fbo_bind_for_read(vfb->fbo);
|
||||
glReadBuffer(GL_STENCIL_ATTACHMENT);
|
||||
if (gl_extensions.GLES3 || !gl_extensions.IsGLES)
|
||||
glReadBuffer(GL_COLOR_ATTACHMENT0);
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 2);
|
||||
SafeGLReadPixels(0, 0, vfb->renderWidth, vfb->renderHeight, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, buffer.GetData());
|
||||
|
||||
|
||||
Reference in new issue
Block a user