Conversation
Core/HLE/sceKernelInterrupt.cpp
Outdated
| int arg_idx = 0; | ||
| int fmt_len = 0; | ||
|
|
||
| for(const char *c = Memory::GetCharPointerUnchecked(fmt); *c != '\0'; c++){ |
There was a problem hiding this comment.
Please at least roughly follow PPSSPP's general code style throughout. You're close, but we write for( as for (, and ) and { are separated by a space (last part of the line).
Core/HLE/sceKernelInterrupt.cpp
Outdated
| // going by https://cplusplus.com/reference/cstdio/printf/#compatibility | ||
| // no idea what the kernel module really supports as of writing this | ||
|
|
||
| if(*c == '%'){ |
There was a problem hiding this comment.
This if chain would be better written as a switch.
Core/HLE/sceKernelInterrupt.cpp
Outdated
| ERROR_LOG(SCEKERNEL, "Fmt: %s", Memory::GetCharPointerUnchecked(fmt)); | ||
| ERROR_LOG(SCEKERNEL, "PSP arg reg dump: 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x", |
There was a problem hiding this comment.
Really still want to ERROR_LOG these? Doesn't seem like errors to me, more like the normal execution path.
Core/HLE/sceKernelInterrupt.cpp
Outdated
| if (Memory::IsValidAddress(dst) && Memory::IsValidAddress(fmt)) { | ||
| // TODO: Properly use the format string with more parameters. | ||
| return sprintf((char *)Memory::GetPointerUnchecked(dst), "%s", Memory::GetCharPointerUnchecked(fmt)); | ||
|
|
There was a problem hiding this comment.
Would be better to flip the logic of the if and early-out, instead of indenting the entire function.
Core/HLE/sceKernelInterrupt.cpp
Outdated
| for(int i = 0;i < 24; i+=8){ | ||
| u32 base = psp_stack_pointer + i * 4; | ||
| ERROR_LOG(SCEKERNEL, "PSP stack dump: 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x", |
There was a problem hiding this comment.
This stack dumping should surely not occur on every call. Comment out or something.
Core/HLE/sceKernelInterrupt.cpp
Outdated
| read_cnt++; | ||
| } | ||
| /* | ||
| // windows compiler don't like this |
There was a problem hiding this comment.
For good reason, dynamic stack allocation is not a good idea.
There was a problem hiding this comment.
Hm, you're right, I supposed I should not be too trusty with snprintf's return value being always
|
Much, much better! Hm, I think the debug logging should maybe be VERBOSE, but I'll go ahead and merge and possibly adjust after. |
It gets through https://github.com/Kethen/psp-string-test/ with the following result