From 00e8e666cb37f2070e081d84a73b69ad5deb90ff Mon Sep 17 00:00:00 2001 From: luigi__ Date: Thu, 4 Dec 2008 22:04:09 +0000 Subject: [PATCH] Fixed unaligned accesses. Now Rayman DS shows 3 intros. --- desmume/src/arm_instructions.cpp | 16 ++++++++-------- desmume/src/thumb_instructions.cpp | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/desmume/src/arm_instructions.cpp b/desmume/src/arm_instructions.cpp index 8a6d2798c..7e470c0f7 100644 --- a/desmume/src/arm_instructions.cpp +++ b/desmume/src/arm_instructions.cpp @@ -39,17 +39,17 @@ extern volatile BOOL execute; // Use this macros for reading/writing, so the GDB stub isn't broken #ifdef GDB_STUB - #define READ32(a,b) cpu->mem_if->read32(a,b) - #define WRITE32(a,b,c) cpu->mem_if->write32(a,b,c) - #define READ16(a,b) cpu->mem_if->read16(a,b) - #define WRITE16(a,b,c) cpu->mem_if->write16(a,b,c) + #define READ32(a,b) cpu->mem_if->read32(a,b & 0xFFFFFFFC) + #define WRITE32(a,b,c) cpu->mem_if->write32(a,b & 0xFFFFFFFC,c) + #define READ16(a,b) cpu->mem_if->read16(a,b & 0xFFFFFFFE) + #define WRITE16(a,b,c) cpu->mem_if->write16(a,b & 0xFFFFFFFE,c) #define READ8(a,b) cpu->mem_if->read8(a,b) #define WRITE8(a,b,c) cpu->mem_if->write8(a,b,c) #else - #define READ32(a,b) MMU_read32(PROCNUM, b) - #define WRITE32(a,b,c) MMU_write32(PROCNUM,b,c) - #define READ16(a,b) MMU_read16(PROCNUM, b) - #define WRITE16(a,b,c) MMU_write16(PROCNUM,b,c) + #define READ32(a,b) MMU_read32(PROCNUM, b & 0xFFFFFFFC) + #define WRITE32(a,b,c) MMU_write32(PROCNUM,b & 0xFFFFFFFC,c) + #define READ16(a,b) MMU_read16(PROCNUM, b & 0xFFFFFFFE) + #define WRITE16(a,b,c) MMU_write16(PROCNUM,b & 0xFFFFFFFE,c) #define READ8(a,b) MMU_read8(PROCNUM, b) #define WRITE8(a,b,c) MMU_write8(PROCNUM,b,c) #endif diff --git a/desmume/src/thumb_instructions.cpp b/desmume/src/thumb_instructions.cpp index 665975078..6ac5a4ddb 100644 --- a/desmume/src/thumb_instructions.cpp +++ b/desmume/src/thumb_instructions.cpp @@ -42,17 +42,17 @@ extern volatile BOOL execute; // Use this macros for reading/writing, so the GDB stub isn't broken #ifdef GDB_STUB - #define READ32(a,b) cpu->mem_if->read32(a,b) - #define WRITE32(a,b,c) cpu->mem_if->write32(a,b,c) - #define READ16(a,b) cpu->mem_if->read16(a,b) - #define WRITE16(a,b,c) cpu->mem_if->write16(a,b,c) + #define READ32(a,b) cpu->mem_if->read32(a,b & 0xFFFFFFFC) + #define WRITE32(a,b,c) cpu->mem_if->write32(a,b & 0xFFFFFFFC,c) + #define READ16(a,b) cpu->mem_if->read16(a,b & 0xFFFFFFFE) + #define WRITE16(a,b,c) cpu->mem_if->write16(a,b & 0xFFFFFFFE,c) #define READ8(a,b) cpu->mem_if->read8(a,b) #define WRITE8(a,b,c) cpu->mem_if->write8(a,b,c) #else - #define READ32(a,b) MMU_read32(PROCNUM, b) - #define WRITE32(a,b,c) MMU_write32(PROCNUM,b,c) - #define READ16(a,b) MMU_read16(PROCNUM, b) - #define WRITE16(a,b,c) MMU_write16(PROCNUM,b,c) + #define READ32(a,b) MMU_read32(PROCNUM, b & 0xFFFFFFFC) + #define WRITE32(a,b,c) MMU_write32(PROCNUM,b & 0xFFFFFFFC,c) + #define READ16(a,b) MMU_read16(PROCNUM, b & 0xFFFFFFFE) + #define WRITE16(a,b,c) MMU_write16(PROCNUM,b & 0xFFFFFFFE,c) #define READ8(a,b) MMU_read8(PROCNUM, b) #define WRITE8(a,b,c) MMU_write8(PROCNUM,b,c) #endif