special case for sceKernelWrite (stdin,stdout,stderr)

This commit is contained in:
georgemoralis 2024-06-10 18:46:06 +03:00
parent 23f11a3fda
commit e576bc99ba
1 changed files with 8 additions and 0 deletions

View File

@ -90,6 +90,14 @@ int PS4_SYSV_ABI sceKernelClose(int d) {
} }
size_t PS4_SYSV_ABI sceKernelWrite(int d, void* buf, size_t nbytes) { size_t PS4_SYSV_ABI sceKernelWrite(int d, void* buf, size_t nbytes) {
if (d <= 2) { // stdin,stdout,stderr
char* str = strdup((const char*)buf);
if (str[nbytes - 1] == '\n')
str[nbytes - 1] = 0;
LOG_INFO(Tty, "{}", str);
free(str);
return nbytes;
}
if (buf == nullptr) { if (buf == nullptr) {
return SCE_KERNEL_ERROR_EFAULT; return SCE_KERNEL_ERROR_EFAULT;
} }