From e45499646ca6a9d9d27f9d3fe3d2ea7501c67f2f Mon Sep 17 00:00:00 2001 From: gecko_reverse Date: Wed, 24 Dec 2008 02:21:46 +0000 Subject: [PATCH] fixed PPC compilation errors --- desmume/src/mem.h | 8 ++++---- desmume/src/saves.cpp | 20 +++++++++----------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/desmume/src/mem.h b/desmume/src/mem.h index 72060f1f5..62058a5f4 100644 --- a/desmume/src/mem.h +++ b/desmume/src/mem.h @@ -53,10 +53,10 @@ static INLINE u32 T1ReadLong(u8 * mem, u32 addr) static INLINE u64 T1ReadQuad(u8 * mem, u32 addr) { #ifdef WORDS_BIGENDIAN - return (mem[addr + 7] << 56 | mem[addr + 6] << 48 | - mem[addr + 5] << 40 | mem[addr + 4] << 32 | - mem[addr + 3] << 24 | mem[addr + 2] << 16 | - mem[addr + 1] << 8 | mem[addr]); + return (u64(mem[addr + 7]) << 56 | u64(mem[addr + 6]) << 48 | + u64(mem[addr + 5]) << 40 | u64(mem[addr + 4]) << 32 | + u64(mem[addr + 3]) << 24 | u64(mem[addr + 2]) << 16 | + u64(mem[addr + 1]) << 8 | u64(mem[addr ])); #else return *((u64 *) (mem + addr)); #endif diff --git a/desmume/src/saves.cpp b/desmume/src/saves.cpp index 8e8bb97b3..c1711d11a 100644 --- a/desmume/src/saves.cpp +++ b/desmume/src/saves.cpp @@ -188,7 +188,7 @@ SFORMAT SF_MMU[]={ { "MDCY", 4, 8, MMU.DMACycle}, { "MDCR", 4, 8, MMU.DMACrt}, { "MDMA", 4, 8, MMU.DMAing}, - + //begin memory chips //we are skipping the firmware, because we really don't want to save the firmware to the savestate //but, we will need to think about the philosophy of this. @@ -512,7 +512,7 @@ static bool ReadStateChunk(std::istream* is, SFORMAT *sf, int size) while(is->tellg()read(toa,4); if(is->fail()) @@ -532,8 +532,7 @@ static bool ReadStateChunk(std::istream* is, SFORMAT *sf, int size) is->read((char *)tmp->v + i*sz,sz); #ifndef LOCAL_LE - if(rlsb) - FlipByteOrder((u8*)tmp->v + i*sz,sz); + FlipByteOrder((u8*)tmp->v + i*sz,sz); #endif } } @@ -567,8 +566,8 @@ static int SubWrite(std::ostream* os, SFORMAT *sf) int count = sf->count; int size = sf->size; - acc+=12; //Description + size + count - + //add size of current node to the accumulator + acc += sizeof(sf->desc) + sizeof(sf->size) + sizeof(sf->count); acc += count * size; if(os) //Are we writing or calculating the size of this block? @@ -583,16 +582,15 @@ static int SubWrite(std::ostream* os, SFORMAT *sf) } else { for(int i=0;iv,sf->s&(~SS_FLAGS)); + #ifndef LOCAL_LE vv + FlipByteOrder((u8*)sf->v + i*size, size); #endif os->write((char*)sf->v + i*size,size); //Now restore the original byte order. #ifndef LOCAL_LE - if(rlsb) - FlipByteOrder((u8*)sf->v,sf->s&(~SS_FLAGS)); + FlipByteOrder((u8*)sf->v + i*size, size); #endif } } @@ -806,7 +804,7 @@ static bool savestate_load(std::istream* is) //GO!! READ THE SAVESTATE //THERE IS NO GOING BACK NOW //reset the emulator first to clean out the host's state - + //while the series of resets below should work, //we are testing the robustness of the savestate system with this full reset. //the full reset wipes more things, so we can make sure that they are being restored correctly