From 909e4b9bd8123ff4b7c4eb5a8230c926fbecc2fa Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 28 Jun 2015 10:42:19 -0700 Subject: [PATCH] Switch lo and hi so that low comes first. This way we can treat it as a single 64-bit value. --- Core/HLE/sceKernelThread.cpp | 4 +++- Core/HLE/sceKernelThread.h | 2 +- Core/MIPS/MIPS.cpp | 1 + Core/MIPS/MIPS.h | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index 7fd5953315..44085b581d 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -523,7 +523,7 @@ public: void DoState(PointerWrap &p) override { - auto s = p.Section("Thread", 1, 4); + auto s = p.Section("Thread", 1, 5); if (!s) return; @@ -553,6 +553,8 @@ public: context.other[4] = context.other[5]; context.other[3] = context.other[4]; } + if (s <= 4) + std::swap(context.hi, context.lo); p.Do(callbacks); diff --git a/Core/HLE/sceKernelThread.h b/Core/HLE/sceKernelThread.h index 3fb082a837..74ec6cd19e 100644 --- a/Core/HLE/sceKernelThread.h +++ b/Core/HLE/sceKernelThread.h @@ -138,8 +138,8 @@ struct ThreadContext struct { u32 pc; - u32 hi; u32 lo; + u32 hi; u32 fcr31; u32 fpcond; diff --git a/Core/MIPS/MIPS.cpp b/Core/MIPS/MIPS.cpp index dc12919eb1..dba64a7b53 100644 --- a/Core/MIPS/MIPS.cpp +++ b/Core/MIPS/MIPS.cpp @@ -289,6 +289,7 @@ void MIPSState::DoState(PointerWrap &p) { p.Do(pc); p.Do(nextPC); p.Do(downcount); + // Reversed, but we can just leave it that way. p.Do(hi); p.Do(lo); p.Do(fpcond); diff --git a/Core/MIPS/MIPS.h b/Core/MIPS/MIPS.h index c4298555e5..f8ec7e25a9 100644 --- a/Core/MIPS/MIPS.h +++ b/Core/MIPS/MIPS.h @@ -174,8 +174,8 @@ public: struct { u32 pc; - u32 hi; u32 lo; + u32 hi; u32 fcr31; //fpu control register u32 fpcond; // cache the cond flag of fcr31 (& 1 << 23)