From 7c5ea520220d7d52a297c08353f09e65e1633a75 Mon Sep 17 00:00:00 2001 From: gibbed Date: Sat, 30 May 2015 20:53:58 -0500 Subject: [PATCH] Updated functions pulling arguments out of the stack to use the appropriate SHIM_GET_ARG_* macro. --- src/xenia/kernel/xam_content.cc | 3 +-- src/xenia/kernel/xam_ui.cc | 4 +--- src/xenia/kernel/xam_user.cc | 4 +--- src/xenia/kernel/xboxkrnl_io.cc | 3 +-- src/xenia/kernel/xboxkrnl_video.cc | 21 +++++++++------------ 5 files changed, 13 insertions(+), 22 deletions(-) diff --git a/src/xenia/kernel/xam_content.cc b/src/xenia/kernel/xam_content.cc index d29c54ff8..3ffb0cb89 100644 --- a/src/xenia/kernel/xam_content.cc +++ b/src/xenia/kernel/xam_content.cc @@ -350,8 +350,7 @@ SHIM_CALL XamContentCreateEx_shim(PPCContext* ppc_context, uint32_t license_mask_ptr = SHIM_GET_ARG_32(5); uint32_t cache_size = SHIM_GET_ARG_32(6); uint64_t content_size = SHIM_GET_ARG_64(7); - uint32_t sp = (uint32_t)ppc_context->r[1]; - uint32_t overlapped_ptr = SHIM_MEM_32(sp + 0x54); + uint32_t overlapped_ptr = SHIM_GET_ARG_32(8); auto root_name = xe::load_and_swap(SHIM_MEM_ADDR(root_name_ptr)); auto content_data = XCONTENT_DATA(SHIM_MEM_ADDR(content_data_ptr)); diff --git a/src/xenia/kernel/xam_ui.cc b/src/xenia/kernel/xam_ui.cc index 63fd9cf07..6da922b07 100644 --- a/src/xenia/kernel/xam_ui.cc +++ b/src/xenia/kernel/xam_ui.cc @@ -36,9 +36,7 @@ SHIM_CALL XamShowMessageBoxUI_shim(PPCContext* ppc_context, uint32_t active_button = SHIM_GET_ARG_32(5); uint32_t flags = SHIM_GET_ARG_32(6); uint32_t result_ptr = SHIM_GET_ARG_32(7); - // arg8 is in stack! - uint32_t sp = (uint32_t)ppc_context->r[1]; - uint32_t overlapped_ptr = SHIM_MEM_32(sp + 0x54); + uint32_t overlapped_ptr = SHIM_GET_ARG_32(8); auto title = xe::load_and_swap(SHIM_MEM_ADDR(title_ptr)); auto text = xe::load_and_swap(SHIM_MEM_ADDR(text_ptr)); diff --git a/src/xenia/kernel/xam_user.cc b/src/xenia/kernel/xam_user.cc index bf0d4779c..e9b5cb8c2 100644 --- a/src/xenia/kernel/xam_user.cc +++ b/src/xenia/kernel/xam_user.cc @@ -107,9 +107,7 @@ SHIM_CALL XamUserReadProfileSettings_shim(PPCContext* ppc_context, uint32_t setting_ids_ptr = SHIM_GET_ARG_32(5); uint32_t buffer_size_ptr = SHIM_GET_ARG_32(6); uint32_t buffer_ptr = SHIM_GET_ARG_32(7); - // arg8 is in stack! - uint32_t sp = (uint32_t)ppc_context->r[1]; - uint32_t overlapped_ptr = SHIM_MEM_32(sp + 0x54); + uint32_t overlapped_ptr = SHIM_GET_ARG_32(8); uint32_t buffer_size = SHIM_MEM_32(buffer_size_ptr); diff --git a/src/xenia/kernel/xboxkrnl_io.cc b/src/xenia/kernel/xboxkrnl_io.cc index 34da72e1c..67fa560de 100644 --- a/src/xenia/kernel/xboxkrnl_io.cc +++ b/src/xenia/kernel/xboxkrnl_io.cc @@ -673,8 +673,7 @@ SHIM_CALL NtQueryDirectoryFile_shim(PPCContext* ppc_context, uint32_t file_info_ptr = SHIM_GET_ARG_32(5); uint32_t length = SHIM_GET_ARG_32(6); uint32_t file_name_ptr = SHIM_GET_ARG_32(7); - uint32_t sp = (uint32_t)ppc_context->r[1]; - uint32_t restart_scan = SHIM_MEM_32(sp + 0x54); + uint32_t restart_scan = SHIM_GET_ARG_32(8); char* file_name = NULL; if (file_name_ptr != 0) { diff --git a/src/xenia/kernel/xboxkrnl_video.cc b/src/xenia/kernel/xboxkrnl_video.cc index 61139079f..403867d0a 100644 --- a/src/xenia/kernel/xboxkrnl_video.cc +++ b/src/xenia/kernel/xboxkrnl_video.cc @@ -304,18 +304,15 @@ SHIM_CALL VdSetSystemCommandBufferGpuIdentifierAddress_shim( SHIM_CALL VdInitializeScalerCommandBuffer_shim(PPCContext* ppc_context, KernelState* kernel_state) { - uint32_t unk0 = SHIM_GET_ARG_32(0); // 0? - uint32_t unk1 = SHIM_GET_ARG_32(1); // 0x050002d0 size of ? - uint32_t unk2 = SHIM_GET_ARG_32(2); // 0? - uint32_t unk3 = SHIM_GET_ARG_32(3); // 0x050002d0 size of ? - uint32_t unk4 = SHIM_GET_ARG_32(4); // 0x050002d0 size of ? - uint32_t unk5 = SHIM_GET_ARG_32(5); // 7? - uint32_t unk6 = SHIM_GET_ARG_32(6); // 0x2004909c <-- points to zeros? - uint32_t unk7 = SHIM_GET_ARG_32(7); // 7? - // arg8 is in stack! - uint32_t sp = (uint32_t)ppc_context->r[1]; - // Points to the first 80000000h where the memcpy sources from. - uint32_t dest_ptr = SHIM_MEM_32(sp + 0x54); + uint32_t unk0 = SHIM_GET_ARG_32(0); // 0? + uint32_t unk1 = SHIM_GET_ARG_32(1); // 0x050002d0 size of ? + uint32_t unk2 = SHIM_GET_ARG_32(2); // 0? + uint32_t unk3 = SHIM_GET_ARG_32(3); // 0x050002d0 size of ? + uint32_t unk4 = SHIM_GET_ARG_32(4); // 0x050002d0 size of ? + uint32_t unk5 = SHIM_GET_ARG_32(5); // 7? + uint32_t unk6 = SHIM_GET_ARG_32(6); // 0x2004909c <-- points to zeros? + uint32_t unk7 = SHIM_GET_ARG_32(7); // 7? + uint32_t dest_ptr = SHIM_GET_ARG_32(8); // Points to the first 80000000h where the memcpy sources from. XELOGD( "VdInitializeScalerCommandBuffer(%.8X, %.8X, %.8X, %.8X, %.8X, %.8X, "