From d4d045f9be55fecee63ed2b508f03faab0587c25 Mon Sep 17 00:00:00 2001 From: rogerman Date: Mon, 7 Nov 2011 07:29:53 +0000 Subject: [PATCH] - Allows the NDS input system to work on big-endian processors. --- desmume/src/NDSSystem.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index f4f10e784..df43c8459 100644 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -2652,8 +2652,13 @@ void NDS_setTouchPos(u16 x, u16 y) if(movieMode != MOVIEMODE_INACTIVE && movieMode != MOVIEMODE_FINISHED) { // just in case, since the movie only stores 8 bits per touch coord +#ifdef WORDS_BIGENDIAN + rawUserInput.touch.touchX &= 0xF00F; + rawUserInput.touch.touchY &= 0xF00F; +#else rawUserInput.touch.touchX &= 0x0FF0; rawUserInput.touch.touchY &= 0x0FF0; +#endif } } void NDS_releaseTouch(void) @@ -2717,6 +2722,7 @@ static void NDS_applyFinalInput() ((input.buttons.E ? 0 : 0x80) << 1) | ((input.buttons.W ? 0 : 0x80) << 2)) ; + pad = LOCAL_TO_LE_16(pad); ((u16 *)MMU.ARM9_REG)[0x130>>1] = (u16)pad; ((u16 *)MMU.ARM7_REG)[0x130>>1] = (u16)pad; @@ -2789,13 +2795,15 @@ static void NDS_applyFinalInput() countLid--; } - u16 padExt = (((u16 *)MMU.ARM7_REG)[0x136>>1] & 0x0070) | - ((input.buttons.X ? 0 : 0x80) >> 7) | + u16 padExt = ((input.buttons.X ? 0 : 0x80) >> 7) | ((input.buttons.Y ? 0 : 0x80) >> 6) | ((input.buttons.G ? 0 : 0x80) >> 4) | ((LidClosed) << 7) | 0x0034; + padExt = LOCAL_TO_LE_16(padExt); + padExt |= (((u16 *)MMU.ARM7_REG)[0x136>>1] & 0x0070); + ((u16 *)MMU.ARM7_REG)[0x136>>1] = (u16)padExt; InputDisplayString=MakeInputDisplayString(padExt, pad);