[xboxkrnl] Log strings for string formatters.

This commit is contained in:
gibbed 2021-06-28 12:10:22 -05:00 committed by Rick Gibbed
parent 8caf8d1c1d
commit e84ef132ae
1 changed files with 29 additions and 13 deletions

View File

@ -841,8 +841,8 @@ SHIM_CALL _snprintf_shim(PPCContext* ppc_context, KernelState* kernel_state) {
int32_t buffer_count = SHIM_GET_ARG_32(1);
uint32_t format_ptr = SHIM_GET_ARG_32(2);
XELOGD("_snprintf({:08X}, {}, {:08X}, ...)", buffer_ptr, buffer_count,
format_ptr);
XELOGD("_snprintf({:08X}, {}, {:08X}({}), ...)", buffer_ptr, buffer_count,
format_ptr, xe::load_and_swap<std::string>(SHIM_MEM_ADDR(format_ptr)));
if (buffer_ptr == 0 || buffer_count <= 0 || format_ptr == 0) {
SHIM_SET_RETURN_32(-1);
@ -877,7 +877,8 @@ SHIM_CALL sprintf_shim(PPCContext* ppc_context, KernelState* kernel_state) {
uint32_t buffer_ptr = SHIM_GET_ARG_32(0);
uint32_t format_ptr = SHIM_GET_ARG_32(1);
XELOGD("sprintf({:08X}, {:08X}, ...)", buffer_ptr, format_ptr);
XELOGD("sprintf({:08X}, {:08X}({}), ...)", buffer_ptr, format_ptr,
xe::load_and_swap<std::string>(SHIM_MEM_ADDR(format_ptr)));
if (buffer_ptr == 0 || format_ptr == 0) {
SHIM_SET_RETURN_32(-1);
@ -906,8 +907,10 @@ SHIM_CALL _snwprintf_shim(PPCContext* ppc_context, KernelState* kernel_state) {
int32_t buffer_count = SHIM_GET_ARG_32(1);
uint32_t format_ptr = SHIM_GET_ARG_32(2);
XELOGD("_snwprintf({:08X}, {}, {:08X}, ...)", buffer_ptr, buffer_count,
format_ptr);
XELOGD("_snwprintf({:08X}, {}, {:08X}({}), ...)", buffer_ptr, buffer_count,
format_ptr,
xe::to_utf8(
xe::load_and_swap<std::u16string>(SHIM_MEM_ADDR(format_ptr))));
if (buffer_ptr == 0 || buffer_count <= 0 || format_ptr == 0) {
SHIM_SET_RETURN_32(-1);
@ -942,7 +945,9 @@ SHIM_CALL swprintf_shim(PPCContext* ppc_context, KernelState* kernel_state) {
uint32_t buffer_ptr = SHIM_GET_ARG_32(0);
uint32_t format_ptr = SHIM_GET_ARG_32(1);
XELOGD("swprintf({:08X}, {:08X}, ...)", buffer_ptr, format_ptr);
XELOGD("swprintf({:08X}, {:08X}({}), ...)", buffer_ptr, format_ptr,
xe::to_utf8(
xe::load_and_swap<std::u16string>(SHIM_MEM_ADDR(format_ptr))));
if (buffer_ptr == 0 || format_ptr == 0) {
SHIM_SET_RETURN_32(-1);
@ -972,8 +977,9 @@ SHIM_CALL _vsnprintf_shim(PPCContext* ppc_context, KernelState* kernel_state) {
uint32_t format_ptr = SHIM_GET_ARG_32(2);
uint32_t arg_ptr = SHIM_GET_ARG_32(3);
XELOGD("_vsnprintf({:08X}, {}, {:08X}, {:08X})", buffer_ptr, buffer_count,
format_ptr, arg_ptr);
XELOGD("_vsnprintf({:08X}, {}, {:08X}({}), {:08X})", buffer_ptr, buffer_count,
format_ptr, xe::load_and_swap<std::string>(SHIM_MEM_ADDR(format_ptr)),
arg_ptr);
if (buffer_ptr == 0 || buffer_count <= 0 || format_ptr == 0) {
SHIM_SET_RETURN_32(-1);
@ -1012,8 +1018,11 @@ SHIM_CALL _vsnwprintf_shim(PPCContext* ppc_context, KernelState* kernel_state) {
uint32_t format_ptr = SHIM_GET_ARG_32(2);
uint32_t arg_ptr = SHIM_GET_ARG_32(3);
XELOGD("_vsnwprintf({:08X}, {}, {:08X}, {:08X})", buffer_ptr, buffer_count,
format_ptr, arg_ptr);
XELOGD(
"_vsnwprintf({:08X}, {}, {:08X}({}), {:08X})", buffer_ptr, buffer_count,
format_ptr,
xe::to_utf8(xe::load_and_swap<std::u16string>(SHIM_MEM_ADDR(format_ptr))),
arg_ptr);
if (buffer_ptr == 0 || buffer_count <= 0 || format_ptr == 0) {
SHIM_SET_RETURN_32(-1);
@ -1051,7 +1060,8 @@ SHIM_CALL vsprintf_shim(PPCContext* ppc_context, KernelState* kernel_state) {
uint32_t format_ptr = SHIM_GET_ARG_32(1);
uint32_t arg_ptr = SHIM_GET_ARG_32(2);
XELOGD("vsprintf({:08X}, {:08X}, {:08X})", buffer_ptr, format_ptr, arg_ptr);
XELOGD("vsprintf({:08X}, {:08X}({}), {:08X})", buffer_ptr, format_ptr,
xe::load_and_swap<std::string>(SHIM_MEM_ADDR(format_ptr)), arg_ptr);
if (buffer_ptr == 0 || format_ptr == 0) {
SHIM_SET_RETURN_32(-1);
@ -1079,7 +1089,10 @@ SHIM_CALL _vscwprintf_shim(PPCContext* ppc_context, KernelState* kernel_state) {
uint32_t format_ptr = SHIM_GET_ARG_32(0);
uint32_t arg_ptr = SHIM_GET_ARG_32(1);
XELOGD("_vscwprintf({:08X}, {:08X})", format_ptr, arg_ptr);
XELOGD(
"_vscwprintf({:08X}({}), {:08X})", format_ptr,
xe::to_utf8(xe::load_and_swap<std::u16string>(SHIM_MEM_ADDR(format_ptr))),
arg_ptr);
if (format_ptr == 0) {
SHIM_SET_RETURN_32(-1);
@ -1102,7 +1115,10 @@ SHIM_CALL vswprintf_shim(PPCContext* ppc_context, KernelState* kernel_state) {
uint32_t format_ptr = SHIM_GET_ARG_32(1);
uint32_t arg_ptr = SHIM_GET_ARG_32(2);
XELOGD("vswprintf({:08X}, {:08X}, {:08X})", buffer_ptr, format_ptr, arg_ptr);
XELOGD(
"vswprintf({:08X}, {:08X}({}), {:08X})", buffer_ptr, format_ptr,
xe::to_utf8(xe::load_and_swap<std::u16string>(SHIM_MEM_ADDR(format_ptr))),
arg_ptr);
if (buffer_ptr == 0 || format_ptr == 0) {
SHIM_SET_RETURN_32(-1);