From 0ad3ed02300044c6a7f9bc87c3c1596fe877905c Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sat, 13 Sep 2014 14:54:47 -0700 Subject: [PATCH] Fixing RtlMultiByteToUnicodeN. --- src/xenia/kernel/xboxkrnl_rtl.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/xenia/kernel/xboxkrnl_rtl.cc b/src/xenia/kernel/xboxkrnl_rtl.cc index 8616c5474..e1e1ea7a2 100644 --- a/src/xenia/kernel/xboxkrnl_rtl.cc +++ b/src/xenia/kernel/xboxkrnl_rtl.cc @@ -285,10 +285,10 @@ SHIM_CALL RtlMultiByteToUnicodeN_shim(PPCContext* ppc_state, // TODO: maybe use MultiByteToUnicode on Win32? would require swapping - auto source = (uint8_t*)SHIM_MEM_ADDR(source_ptr); - auto destination = (uint16_t*)SHIM_MEM_ADDR(destination_ptr); for (uint32_t i = 0; i < copy_len; i++) { - *destination++ = poly::byte_swap(*source++); + poly::store_and_swap( + SHIM_MEM_ADDR(destination_ptr + i * 2), + poly::load(SHIM_MEM_ADDR(source_ptr + i))); } if (written_ptr != 0) {