Remove StdioListener

This commit is contained in:
Henrik Rydgård 2024-12-16 11:40:08 +01:00
parent 8de30235f2
commit e567a58684
13 changed files with 14 additions and 78 deletions

View file

@ -891,8 +891,6 @@ add_library(Common STATIC
Common/Log.cpp Common/Log.cpp
Common/Log/ConsoleListener.cpp Common/Log/ConsoleListener.cpp
Common/Log/ConsoleListener.h Common/Log/ConsoleListener.h
Common/Log/StdioListener.cpp
Common/Log/StdioListener.h
Common/Log/LogManager.cpp Common/Log/LogManager.cpp
Common/Log/LogManager.h Common/Log/LogManager.h
Common/LogReporting.cpp Common/LogReporting.cpp

View file

@ -586,7 +586,6 @@
<ClInclude Include="CommonTypes.h" /> <ClInclude Include="CommonTypes.h" />
<ClInclude Include="CommonWindows.h" /> <ClInclude Include="CommonWindows.h" />
<ClInclude Include="Log\ConsoleListener.h" /> <ClInclude Include="Log\ConsoleListener.h" />
<ClInclude Include="Log\StdioListener.h" />
<ClInclude Include="CPUDetect.h" /> <ClInclude Include="CPUDetect.h" />
<ClInclude Include="Crypto\md5.h" /> <ClInclude Include="Crypto\md5.h" />
<ClInclude Include="Crypto\sha1.h" /> <ClInclude Include="Crypto\sha1.h" />
@ -1060,7 +1059,6 @@
<ClCompile Include="Serialize\Serializer.cpp" /> <ClCompile Include="Serialize\Serializer.cpp" />
<ClCompile Include="Data\Convert\ColorConv.cpp" /> <ClCompile Include="Data\Convert\ColorConv.cpp" />
<ClCompile Include="Log\ConsoleListener.cpp" /> <ClCompile Include="Log\ConsoleListener.cpp" />
<ClCompile Include="Log\StdioListener.cpp" />
<ClCompile Include="CPUDetect.cpp" /> <ClCompile Include="CPUDetect.cpp" />
<ClCompile Include="MipsCPUDetect.cpp"> <ClCompile Include="MipsCPUDetect.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>

View file

@ -559,7 +559,6 @@
<ClInclude Include="Render\Text\draw_text_cocoa.h"> <ClInclude Include="Render\Text\draw_text_cocoa.h">
<Filter>Render\Text</Filter> <Filter>Render\Text</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Log\StdioListener.h" />
<ClInclude Include="Log\ConsoleListener.h"> <ClInclude Include="Log\ConsoleListener.h">
<Filter>Log</Filter> <Filter>Log</Filter>
</ClInclude> </ClInclude>
@ -680,7 +679,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="ABI.cpp" /> <ClCompile Include="ABI.cpp" />
<ClCompile Include="Log\StdioListener.cpp" />
<ClCompile Include="CPUDetect.cpp" /> <ClCompile Include="CPUDetect.cpp" />
<ClCompile Include="FakeCPUDetect.cpp" /> <ClCompile Include="FakeCPUDetect.cpp" />
<ClCompile Include="MipsCPUDetect.cpp" /> <ClCompile Include="MipsCPUDetect.cpp" />

View file

@ -34,7 +34,6 @@
#include "Common/Log/ConsoleListener.h" #include "Common/Log/ConsoleListener.h"
#endif #endif
#include "Common/Log/StdioListener.h"
#include "Common/TimeUtil.h" #include "Common/TimeUtil.h"
#include "Common/Thread/ThreadUtil.h" #include "Common/Thread/ThreadUtil.h"
#include "Common/File/FileUtil.h" #include "Common/File/FileUtil.h"
@ -343,7 +342,7 @@ void LogManager::LogLine(LogLevel level, Log type, const char *file, int line, c
PrintfLog(message); PrintfLog(message);
} }
#if PPSSPP_PLATFORM(WINDOWS) #if PPSSPP_PLATFORM(WINDOWS) && !PPSSPP_PLATFORM(UWP)
if (outputs_ & LogOutput::WinConsole) { if (outputs_ & LogOutput::WinConsole) {
if (consoleLog_) { if (consoleLog_) {
consoleLog_->Log(message); consoleLog_->Log(message);
@ -388,7 +387,7 @@ void OutputDebugStringUTF8(const char *p) {
#endif #endif
void LogManager::StdioLog(const LogMessage &msg) { void LogManager::StdioLog(const LogMessage &message) {
#if PPSSPP_PLATFORM(ANDROID) #if PPSSPP_PLATFORM(ANDROID)
#ifndef LOG_APP_NAME #ifndef LOG_APP_NAME
#define LOG_APP_NAME "PPSSPP" #define LOG_APP_NAME "PPSSPP"
@ -413,25 +412,25 @@ void LogManager::StdioLog(const LogMessage &msg) {
// Log with simplified headers as Android already provides timestamp etc. // Log with simplified headers as Android already provides timestamp etc.
__android_log_print(mode, LOG_APP_NAME, "[%s] %s", message.log, message.msg.c_str()); __android_log_print(mode, LOG_APP_NAME, "[%s] %s", message.log, message.msg.c_str());
} else { } else {
std::string msg = message.msg; std::string_view msg = message.msg;
// Ideally we should split at line breaks, but it's at least fairly usable anyway. // Ideally we should split at line breaks, but it's at least fairly usable anyway.
std::string first_part = msg.substr(0, maxLogLength); std::string_view first_part = msg.substr(0, maxLogLength);
__android_log_print(mode, LOG_APP_NAME, "[%s] %s", message.log, first_part.c_str()); __android_log_print(mode, LOG_APP_NAME, "[%s] %.*s", message.log, (int)first_part.size(), first_part.data());
msg = msg.substr(maxLogLength); msg = msg.substr(maxLogLength);
while (msg.length() > maxLogLength) { while (msg.length() > maxLogLength) {
std::string first_part = msg.substr(0, maxLogLength); std::string_view next_part = msg.substr(0, maxLogLength);
__android_log_print(mode, LOG_APP_NAME, "%s", first_part.c_str()); __android_log_print(mode, LOG_APP_NAME, "%.*s", (int)next_part.size(), next_part.data());
msg = msg.substr(maxLogLength); msg = msg.substr(maxLogLength);
} }
// Print the final part. // Print the final part.
__android_log_print(mode, LOG_APP_NAME, "%s", msg.c_str()); __android_log_print(mode, LOG_APP_NAME, "%.*s", (int)msg.size(), msg.data());
} }
#else #else
std::lock_guard<std::mutex> lock(stdioLock_); std::lock_guard<std::mutex> lock(stdioLock_);
char text[2048]; char text[2048];
snprintf(text, sizeof(text), "%s %s %s", msg.timestamp, msg.header, msg.msg.c_str()); snprintf(text, sizeof(text), "%s %s %s", message.timestamp, message.header, message.msg.c_str());
text[sizeof(text) - 2] = '\n'; text[sizeof(text) - 2] = '\n';
text[sizeof(text) - 1] = '\0'; text[sizeof(text) - 1] = '\0';
@ -440,7 +439,7 @@ void LogManager::StdioLog(const LogMessage &msg) {
if (stdioUseColor_) { if (stdioUseColor_) {
resetAttr = "\033[0m"; resetAttr = "\033[0m";
switch (msg.level) { switch (message.level) {
case LogLevel::LNOTICE: // light green case LogLevel::LNOTICE: // light green
colorAttr = "\033[92m"; colorAttr = "\033[92m";
break; break;

View file

@ -27,7 +27,6 @@
#include "Common/CommonFuncs.h" #include "Common/CommonFuncs.h"
#include "Common/Log.h" #include "Common/Log.h"
#include "Common/File/Path.h" #include "Common/File/Path.h"
#include "Common/Log/StdioListener.h"
#define MAX_MESSAGES 8000 #define MAX_MESSAGES 8000

View file

@ -1,27 +0,0 @@
// Copyright (C) 2014- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0 or later versions.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include <cstring>
#ifndef _MSC_VER
#include <unistd.h>
#endif
#include "ppsspp_config.h"
#include "Common/CommonTypes.h"
#include "Common/Log/LogManager.h"
#include "Common/Log/StdioListener.h"
#include "Common/StringUtils.h"

View file

@ -1,24 +0,0 @@
#pragma once
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0 or later versions.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include <mutex>
struct LogMessage;

View file

@ -166,6 +166,7 @@ bool Core_GetPowerSaving() {
void Core_RunLoopUntil(u64 globalticks) { void Core_RunLoopUntil(u64 globalticks) {
while (true) { while (true) {
switch (coreState) { switch (coreState) {
case CORE_POWERUP:
case CORE_POWERDOWN: case CORE_POWERDOWN:
case CORE_BOOT_ERROR: case CORE_BOOT_ERROR:
case CORE_RUNTIME_ERROR: case CORE_RUNTIME_ERROR:

View file

@ -344,7 +344,7 @@ static int __GeSubIntrBase(int callbackId) {
u32 sceGeListEnQueue(u32 listAddress, u32 stallAddress, int callbackId, u32 optParamAddr) { u32 sceGeListEnQueue(u32 listAddress, u32 stallAddress, int callbackId, u32 optParamAddr) {
DEBUG_LOG(Log::sceGe, DEBUG_LOG(Log::sceGe,
"sceGeListEnQueue(addr=%08x, stall=%08x, cbid=%08x, param=%08x) ticks=%d", "sceGeListEnQueue(addr=%08x, stall=%08x, cbid=%08x, param=%08x) ticks=%d",
listAddress, stallAddress, callbackId, optParamAddr, CoreTiming::GetTicks()); listAddress, stallAddress, callbackId, optParamAddr, (int)CoreTiming::GetTicks());
auto optParam = PSPPointer<PspGeListArgs>::Create(optParamAddr); auto optParam = PSPPointer<PspGeListArgs>::Create(optParamAddr);
bool runList; bool runList;
@ -366,7 +366,7 @@ u32 sceGeListEnQueue(u32 listAddress, u32 stallAddress, int callbackId, u32 optP
u32 sceGeListEnQueueHead(u32 listAddress, u32 stallAddress, int callbackId, u32 optParamAddr) { u32 sceGeListEnQueueHead(u32 listAddress, u32 stallAddress, int callbackId, u32 optParamAddr) {
DEBUG_LOG(Log::sceGe, DEBUG_LOG(Log::sceGe,
"sceGeListEnQueueHead(addr=%08x, stall=%08x, cbid=%08x, param=%08x) ticks=%d", "sceGeListEnQueueHead(addr=%08x, stall=%08x, cbid=%08x, param=%08x) ticks=%d",
listAddress, stallAddress, callbackId, optParamAddr, CoreTiming::GetTicks()); listAddress, stallAddress, callbackId, optParamAddr, (int)CoreTiming::GetTicks());
auto optParam = PSPPointer<PspGeListArgs>::Create(optParamAddr); auto optParam = PSPPointer<PspGeListArgs>::Create(optParamAddr);
bool runList; bool runList;

View file

@ -845,8 +845,7 @@ bool GetPrimPreview(u32 op, GEPrimitiveType &prim, std::vector<GPUDebugVertex> &
count = op & 0xFFFF; count = op & 0xFFFF;
} else { } else {
const GEPrimitiveType primLookup[] = { GE_PRIM_TRIANGLES, GE_PRIM_LINES, GE_PRIM_POINTS, GE_PRIM_POINTS }; const GEPrimitiveType primLookup[] = { GE_PRIM_TRIANGLES, GE_PRIM_LINES, GE_PRIM_POINTS, GE_PRIM_POINTS };
if (gstate.getPatchPrimitiveType() < ARRAY_SIZE(primLookup)) prim_type = primLookup[gstate.getPatchPrimitiveType()];
prim_type = primLookup[gstate.getPatchPrimitiveType()];
count_u = (op & 0x00FF) >> 0; count_u = (op & 0x00FF) >> 0;
count_v = (op & 0xFF00) >> 8; count_v = (op & 0xFF00) >> 8;
count = count_u * count_v; count = count_u * count_v;

View file

@ -190,7 +190,6 @@
<ClInclude Include="..\..\Common\CommonTypes.h" /> <ClInclude Include="..\..\Common\CommonTypes.h" />
<ClInclude Include="..\..\Common\CommonWindows.h" /> <ClInclude Include="..\..\Common\CommonWindows.h" />
<ClInclude Include="..\..\Common\Log\ConsoleListener.h" /> <ClInclude Include="..\..\Common\Log\ConsoleListener.h" />
<ClInclude Include="..\..\Common\Log\StdioListener.h" />
<ClInclude Include="..\..\Common\CPUDetect.h" /> <ClInclude Include="..\..\Common\CPUDetect.h" />
<ClInclude Include="..\..\Common\Crypto\md5.h" /> <ClInclude Include="..\..\Common\Crypto\md5.h" />
<ClInclude Include="..\..\Common\Crypto\sha1.h" /> <ClInclude Include="..\..\Common\Crypto\sha1.h" />
@ -354,7 +353,6 @@
<ClCompile Include="..\..\Common\Serialize\Serializer.cpp" /> <ClCompile Include="..\..\Common\Serialize\Serializer.cpp" />
<ClCompile Include="..\..\Common\Data\Convert\ColorConv.cpp" /> <ClCompile Include="..\..\Common\Data\Convert\ColorConv.cpp" />
<ClCompile Include="..\..\Common\Log\ConsoleListener.cpp" /> <ClCompile Include="..\..\Common\Log\ConsoleListener.cpp" />
<ClCompile Include="..\..\Common\Log\StdioListener.cpp" />
<ClCompile Include="..\..\Common\CPUDetect.cpp" /> <ClCompile Include="..\..\Common\CPUDetect.cpp" />
<ClCompile Include="..\..\Common\FakeCPUDetect.cpp" /> <ClCompile Include="..\..\Common\FakeCPUDetect.cpp" />
<ClCompile Include="..\..\Common\Crypto\md5.cpp" /> <ClCompile Include="..\..\Common\Crypto\md5.cpp" />

View file

@ -114,7 +114,6 @@
<ClCompile Include="..\..\Common\ArmEmitter.cpp" /> <ClCompile Include="..\..\Common\ArmEmitter.cpp" />
<ClCompile Include="..\..\Common\Serialize\Serializer.cpp" /> <ClCompile Include="..\..\Common\Serialize\Serializer.cpp" />
<ClCompile Include="..\..\Common\Data\Convert\ColorConv.cpp" /> <ClCompile Include="..\..\Common\Data\Convert\ColorConv.cpp" />
<ClCompile Include="..\..\Common\Log\StdioListener.cpp" />
<ClCompile Include="..\..\Common\Log\ConsoleListener.cpp" /> <ClCompile Include="..\..\Common\Log\ConsoleListener.cpp" />
<ClCompile Include="..\..\Common\CPUDetect.cpp" /> <ClCompile Include="..\..\Common\CPUDetect.cpp" />
<ClCompile Include="..\..\Common\FakeCPUDetect.cpp" /> <ClCompile Include="..\..\Common\FakeCPUDetect.cpp" />
@ -535,7 +534,6 @@
<ClInclude Include="..\..\Common\CommonTypes.h" /> <ClInclude Include="..\..\Common\CommonTypes.h" />
<ClInclude Include="..\..\Common\CommonWindows.h" /> <ClInclude Include="..\..\Common\CommonWindows.h" />
<ClInclude Include="..\..\Common\Log\ConsoleListener.h" /> <ClInclude Include="..\..\Common\Log\ConsoleListener.h" />
<ClInclude Include="..\..\Common\Log\StdioListener.h" />
<ClInclude Include="..\..\Common\CPUDetect.h" /> <ClInclude Include="..\..\Common\CPUDetect.h" />
<ClInclude Include="..\..\Common\DbgNew.h" /> <ClInclude Include="..\..\Common\DbgNew.h" />
<ClInclude Include="..\..\Common\ExceptionHandlerSetup.h" /> <ClInclude Include="..\..\Common\ExceptionHandlerSetup.h" />

View file

@ -480,7 +480,6 @@ SOURCES_CXX += \
$(COMMONDIR)/CPUDetect.cpp \ $(COMMONDIR)/CPUDetect.cpp \
$(COMMONDIR)/Buffer.cpp \ $(COMMONDIR)/Buffer.cpp \
$(COMMONDIR)/Log/ConsoleListener.cpp \ $(COMMONDIR)/Log/ConsoleListener.cpp \
$(COMMONDIR)/Log/StdioListener.cpp \
$(COMMONDIR)/ExceptionHandlerSetup.cpp \ $(COMMONDIR)/ExceptionHandlerSetup.cpp \
$(COMMONDIR)/FakeCPUDetect.cpp \ $(COMMONDIR)/FakeCPUDetect.cpp \
$(COMMONDIR)/GhidraClient.cpp \ $(COMMONDIR)/GhidraClient.cpp \