Skip to content

Commit

Permalink
Merge pull request #18102 from hrydgard/kernel-printf
Browse files Browse the repository at this point in the history
New logging channel "PRINTF" for SceKernelPrintf
  • Loading branch information
hrydgard committed Sep 8, 2023
2 parents d8f4f50 + 254f19d commit c43cbe4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions Common/Log.h
Expand Up @@ -46,6 +46,7 @@ enum class LogType {
IO,
ACHIEVEMENTS,
HTTP,
PRINTF,

SCEAUDIO,
SCECTRL,
Expand Down
1 change: 1 addition & 0 deletions Common/LogManager.cpp
Expand Up @@ -97,6 +97,7 @@ static const char *g_logTypeNames[] = {
"IO",
"ACHIEVEMENTS",
"HTTP",
"PRINTF",

"SCEAUDIO",
"SCECTRL",
Expand Down
4 changes: 2 additions & 2 deletions Core/HLE/sceIo.cpp
Expand Up @@ -1179,7 +1179,7 @@ static bool __IoWrite(int &result, int id, u32 data_addr, int size, int &us) {
if (id == PSP_STDOUT || id == PSP_STDERR) {
const char *str = (const char *) data_ptr;
const int str_size = size <= 0 ? 0 : (str[validSize - 1] == '\n' ? validSize - 1 : validSize);
INFO_LOG(SCEIO, "%s: %.*s", id == 1 ? "stdout" : "stderr", str_size, str);
INFO_LOG(PRINTF, "%s: %.*s", id == 1 ? "stdout" : "stderr", str_size, str);
result = validSize;
return true;
}
Expand All @@ -1205,7 +1205,7 @@ static bool __IoWrite(int &result, int id, u32 data_addr, int size, int &us) {
if (f->isTTY) {
const char *str = (const char *)data_ptr;
const int str_size = size <= 0 ? 0 : (str[validSize - 1] == '\n' ? validSize - 1 : validSize);
INFO_LOG(SCEIO, "%s: %.*s", "tty", str_size, str);
INFO_LOG(PRINTF, "%s: %.*s", "tty", str_size, str);
result = validSize;
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions Core/HLE/sceKernelMemory.cpp
Expand Up @@ -1211,9 +1211,9 @@ static int sceKernelPrintf(const char *formatString)
result.resize(result.size() - 1);

if (supported)
INFO_LOG(SCEKERNEL, "sceKernelPrintf: %s", result.c_str());
INFO_LOG(PRINTF, "sceKernelPrintf: %s", result.c_str());
else
ERROR_LOG(SCEKERNEL, "UNIMPL sceKernelPrintf(%s, %08x, %08x, %08x)", format.c_str(), PARAM(1), PARAM(2), PARAM(3));
ERROR_LOG(PRINTF, "UNIMPL sceKernelPrintf(%s, %08x, %08x, %08x)", format.c_str(), PARAM(1), PARAM(2), PARAM(3));
return 0;
}

Expand Down

0 comments on commit c43cbe4

Please sign in to comment.