mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-05 04:03:49 +01:00
Use USING_WIN_UI for desktop Windows console.
This commit is contained in:
1 parent
d165680ee7
commit
da78ec0b4d
7 files changed
+26
-26
No files matched your search
+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;
|
||||
|
||||
Reference in new issue
Block a user