From 8c7c89f0368ab8905d2d9835ed760333d3f784d4 Mon Sep 17 00:00:00 2001 From: zeromus Date: Thu, 2 Apr 2009 17:01:17 +0000 Subject: [PATCH] oops i failed to checkin everything --- desmume/src/NDSSystem.cpp | 24 ++++++++++++++++++++++++ desmume/src/NDSSystem.h | 3 +++ 2 files changed, 27 insertions(+) diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index 06210096c..3d5b04bb1 100644 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -49,6 +49,7 @@ TCommonSettings CommonSettings; static Driver _stub_driver; Driver* driver = &_stub_driver; +std::string InputDisplayString; static BOOL LidClosed = FALSE; static u8 countLid = 0; @@ -2210,6 +2211,27 @@ u32 NDS_exec(s32 nb) return nds.cycles; } +std::string MakeInputDisplayString(u16 pad, const std::string* Buttons, int count) { + std::string s; + for (int x = 0; x < count; x++) { + if (pad & (1 << x)) + s.append(Buttons[x].size(), ' '); + else + s += Buttons[x]; + } + return s; +} + +std::string MakeInputDisplayString(u16 pad, u16 padExt) { + const std::string Buttons[] = {"A", "B", "Sl", "St", "R", "L", "U", "D", "Rs", "Ls"}; + const std::string Ext[] = {"X", "Y"}; + + std::string s = MakeInputDisplayString(pad, Ext, ARRAYSIZE(Ext)); + s += MakeInputDisplayString(padExt, Buttons, ARRAYSIZE(Buttons)); + + return s; +} + void NDS_setPadFromMovie(u16 pad) { #define FIX(b,n) (((pad>>n)&1)!=0) @@ -2296,6 +2318,8 @@ void NDS_setPad(bool R,bool L,bool D,bool U,bool T,bool S,bool B,bool A,bool Y,b ((u16 *)MMU.ARM7_REG)[0x136>>1] = (u16)padExt; + InputDisplayString=MakeInputDisplayString(padExt, pad); + //put into the format we want for the movie system //RLDUTSBAYXWEGF #undef FIX diff --git a/desmume/src/NDSSystem.h b/desmume/src/NDSSystem.h index fccb4cc07..4230b3a41 100644 --- a/desmume/src/NDSSystem.h +++ b/desmume/src/NDSSystem.h @@ -32,6 +32,8 @@ #include "mem.h" #include "wifi.h" +#include + extern volatile BOOL execute; extern BOOL click; extern char pathToROM[MAX_PATH]; @@ -326,6 +328,7 @@ public: }; extern Driver* driver; +extern std::string InputDisplayString; #endif