From 24ea8597e2d41ea970c4d5c076d02802827c6488 Mon Sep 17 00:00:00 2001 From: thibeaz Date: Sat, 21 Sep 2013 02:16:27 +0000 Subject: [PATCH] fix a goof I made with the last commit, this should fix it git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@1209 a31d4220-a93d-0410-bf67-fe4944624d44 --- src/gb/gbGfx.cpp | 2 +- src/gba/GBAinline.h | 32 ++++++++++++++++++++++---------- src/win32/OpenGL.cpp | 6 +++--- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/gb/gbGfx.cpp b/src/gb/gbGfx.cpp index a197405f..72e65598 100644 --- a/src/gb/gbGfx.cpp +++ b/src/gb/gbGfx.cpp @@ -234,7 +234,7 @@ void gbRenderLine() if(y >= inUseRegister_WY) { - if (gbWindowLine>143) + if ((gbWindowLine == -1) || (gbWindowLine>144)) gbWindowLine = 0; int wx = register_WX; diff --git a/src/gba/GBAinline.h b/src/gba/GBAinline.h index 1de76508..3dadfcfe 100644 --- a/src/gba/GBAinline.h +++ b/src/gba/GBAinline.h @@ -119,9 +119,15 @@ static inline u32 CPUReadMemory(u32 address) return eepromRead(address); goto unreadable; case 14: + case 15: if(cpuFlashEnabled | cpuSramEnabled) - // no need to swap this + { // no need to swap this + #ifdef __libretro__ return flashRead(address); + #else + value = flashRead(address) * 0x01010101; + #endif + break // default default: unreadable: @@ -266,9 +272,16 @@ static inline u32 CPUReadHalfWord(u32 address) return eepromRead(address); goto unreadable; case 14: + case 15: if(cpuFlashEnabled | cpuSramEnabled) // no need to swap this + { + #ifdef __libretro__ return flashRead(address); + #else + value = flashRead(address) * 0x0101; + #endif + } // default default: unreadable: @@ -305,22 +318,17 @@ unreadable: static inline s16 CPUReadHalfWordSigned(u32 address) { - u32 oldAddress = address; - if(address & 1) { - address &= ~0x01; - } - s16 value = (s16)CPUReadHalfWord(address); - if((oldAddress & 1)) + s32 value = (s32)CPUReadHalfWord(address); + if((address & 1)) { - value = (s8)value; #ifdef GBA_LOGGING if(systemVerbose & VERBOSE_UNALIGNED_MEMORY) { - log("Unaligned signed halfword read from: %08x at %08x (%08x)\n", oldAddress, armMode ? + log("Unaligned signed halfword read from: %08x at %08x (%08x)\n", address, armMode ? armNextPC - 4 : armNextPC - 2, value); } #endif } - return value; + return (s16)value; } static inline u8 CPUReadByte(u32 address) @@ -369,6 +377,7 @@ static inline u8 CPUReadByte(u32 address) return eepromRead(address); goto unreadable; case 14: + case 15: if(cpuSramEnabled | cpuFlashEnabled) return flashRead(address); if(cpuEEPROMSensorEnabled) { @@ -486,6 +495,7 @@ static inline void CPUWriteMemory(u32 address, u32 value) } goto unwritable; case 0x0E: + case 0x0F: if((!eepromInUse) | cpuSramEnabled | cpuFlashEnabled) { (*cpuSaveGameFunc)(address, (u8)value); break; @@ -590,6 +600,7 @@ static inline void CPUWriteHalfWord(u32 address, u16 value) } goto unwritable; case 14: + case 15: if((!eepromInUse) | cpuSramEnabled | cpuFlashEnabled) { (*cpuSaveGameFunc)(address, (u8)value); break; @@ -726,6 +737,7 @@ static inline void CPUWriteByte(u32 address, u8 b) } goto unwritable; case 14: + case 15: if ((saveType != 5) && ((!eepromInUse) | cpuSramEnabled | cpuFlashEnabled)) { //if(!cpuEEPROMEnabled && (cpuSramEnabled | cpuFlashEnabled)) { diff --git a/src/win32/OpenGL.cpp b/src/win32/OpenGL.cpp index 4ff19d98..ba6cc546 100644 --- a/src/win32/OpenGL.cpp +++ b/src/win32/OpenGL.cpp @@ -345,9 +345,9 @@ bool OpenGLDisplay::initialize() cpu_mmx = 0; #endif - systemRedShift = 3; + systemRedShift = 19; systemGreenShift = 11; - systemBlueShift = 19; + systemBlueShift = 3; systemColorDepth = 32; theApp.fsColorDepth = 32; @@ -401,7 +401,7 @@ void OpenGLDisplay::render() } else { glPixelStorei( GL_UNPACK_ROW_LENGTH, theApp.sizeX + 1 ); } - glTexSubImage2D(GL_TEXTURE_2D,0,0,0,width,height,GL_RGBA,GL_UNSIGNED_BYTE,data ); + glTexSubImage2D(GL_TEXTURE_2D,0,0,0,width,height,GL_BGRA,GL_UNSIGNED_BYTE,data ); glBegin( GL_QUADS );