diff --git a/desmume/src/GPU_osd.cpp b/desmume/src/GPU_osd.cpp index b1964dd6e..905bbf878 100644 --- a/desmume/src/GPU_osd.cpp +++ b/desmume/src/GPU_osd.cpp @@ -32,8 +32,179 @@ #include "aggdraw.h" #include "movie.h" #include "NDSSystem.h" +#include "mic.h" OSDCLASS *osd = NULL; +HudStruct Hud; + +void SetHudDummy (HudCoordinates *hud) +{ + hud->x=666; + hud->y=666; +} + +bool IsHudDummy (HudCoordinates *hud) +{ + return (hud->x == 666 && hud->y == 666); +} + +void EditHud(s32 x, s32 y, HudStruct *hudstruct) { + + UINT i = 0; + + while (!IsHudDummy(&hudstruct->hud(i))) { + HudCoordinates &hud = hudstruct->hud(i); + + //reset + if(!hud.clicked) { + hud.storedx=0; + hud.storedy=0; + } + + if((x >= hud.x && x <= hud.x + hud.xsize) && + (y >= hud.y && y <= hud.y + hud.ysize) && !hud.clicked ) { + + hud.clicked=1; + hud.storedx = x - hud.x; + hud.storedy = y - hud.y; + } + + if(hud.clicked) { + hud.x = x - hud.storedx; + hud.y = y - hud.storedy; + } + + //sanity checks + if(hud.x < 0) hud.x = 0; + if(hud.y < 0) hud.y = 0; + if(hud.x > 245)hud.x = 245; //margins + if(hud.y > 180)hud.y = 180; + + if(hud.clicked) + break;//prevent items from grouping together + + i++; + } +} + +void HudClickRelease(HudStruct *hudstruct) { + + UINT i = 0; + + while (!IsHudDummy(&hudstruct->hud(i))) { + HudCoordinates &hud = hudstruct->hud(i); + hud.clicked=0; + i++; + } +} + +void ResetHud(HudStruct *hudstruct) { + + hudstruct->FpsDisplay.x=0; + hudstruct->FpsDisplay.y=5; + hudstruct->FpsDisplay.xsize=120; + hudstruct->FpsDisplay.ysize=10; + + hudstruct->FrameCounter.x=0; + hudstruct->FrameCounter.y=25; + hudstruct->FrameCounter.xsize=60; + hudstruct->FrameCounter.ysize=10; + + hudstruct->InputDisplay.x=0; + hudstruct->InputDisplay.y=45; + hudstruct->InputDisplay.xsize=120; + hudstruct->InputDisplay.ysize=10; + + hudstruct->LagFrameCounter.x=0; + hudstruct->LagFrameCounter.y=65; + hudstruct->LagFrameCounter.xsize=30; + hudstruct->LagFrameCounter.ysize=10; + + hudstruct->Microphone.x=0; + hudstruct->Microphone.y=85; + hudstruct->Microphone.xsize=20; + hudstruct->Microphone.ysize=10; + + SetHudDummy(&hudstruct->Dummy); +} + + +struct TouchInfo{ + u16 X; + u16 Y; +}; +static int touchalpha[8]= {31, 63, 95, 127, 159, 191, 223, 255}; +static TouchInfo temptouch; +bool touchshadow = true; +static std::vector touch (8); + + +static void TouchDisplay() { + aggDraw.hud->lineWidth(1.0); + + temptouch.X = nds.touchX >> 4; + temptouch.Y = nds.touchY >> 4; + touch.push_back(temptouch); + + if(touch.size() > 8) touch.erase(touch.begin()); + + if(touchshadow) { + for (int i = 0; i < 8; i++) { + temptouch = touch[i]; + if(temptouch.X != 0 || temptouch.Y != 0) { + aggDraw.hud->lineColor(0, 255, 0, touchalpha[i]); + aggDraw.hud->line(temptouch.X - 256, temptouch.Y + 192, temptouch.X + 256, temptouch.Y + 192); //horiz + aggDraw.hud->line(temptouch.X, temptouch.Y - 256, temptouch.X, temptouch.Y + 384); //vert + aggDraw.hud->fillColor(0, 0, 0, touchalpha[i]); + aggDraw.hud->rectangle(temptouch.X-1, temptouch.Y-1 + 192, temptouch.X+1, temptouch.Y+1 + 192); + } + } + } + else + if(nds.isTouch) { + aggDraw.hud->line(temptouch.X - 256, temptouch.Y + 192, temptouch.X + 256, temptouch.Y + 192); //horiz + aggDraw.hud->line(temptouch.X, temptouch.Y - 256, temptouch.X, temptouch.Y + 384); //vert + } +} + + + + +void DrawHUD() +{ + if (CommonSettings.hud.ShowInputDisplay) + { + osd->addFixed(Hud.InputDisplay.x, Hud.InputDisplay.y, "%s",InputDisplayString.c_str()); + TouchDisplay(); + } + + if (CommonSettings.hud.FpsDisplay) + { + osd->addFixed(Hud.FpsDisplay.x, Hud.FpsDisplay.y, "Fps:%02d/%02d", Hud.fps, Hud.fps3d); + } + + if (CommonSettings.hud.FrameCounterDisplay) + { + if (movieMode == MOVIEMODE_PLAY) + osd->addFixed(Hud.FrameCounter.x, Hud.FrameCounter.y, "%d/%d",currFrameCounter,currMovieData.records.size()); + else if(movieMode == MOVIEMODE_RECORD) + osd->addFixed(Hud.FrameCounter.x, Hud.FrameCounter.y, "%d",currFrameCounter); + else + osd->addFixed(Hud.FrameCounter.x, Hud.FrameCounter.y, "%d (no movie)",currFrameCounter); + } + + if (CommonSettings.hud.ShowLagFrameCounter) + { + osd->addFixed(Hud.LagFrameCounter.x, Hud.LagFrameCounter.y, "%d",TotalLagFrames); + } + + if (CommonSettings.hud.ShowMicrophone) + { + osd->addFixed(Hud.Microphone.x, Hud.Microphone.y, "%d",MicDisplay); + } +} + + OSDCLASS::OSDCLASS(u8 core) { @@ -208,45 +379,3 @@ void OSDCLASS::border(bool enabled) { //render51.setTextBoxBorder(enabled); } - -struct TouchInfo{ - u16 X; - u16 Y; -}; -static int touchalpha[8]= {31, 63, 95, 127, 159, 191, 223, 255}; -static TouchInfo temptouch; -bool touchshadow = true; -static std::vector touch (8); - -void OSDCLASS::TouchDisplay(){ - - if(!ShowInputDisplay) return; - - aggDraw.hud->lineWidth(1.0); - - temptouch.X = nds.touchX >> 4; - temptouch.Y = nds.touchY >> 4; - touch.push_back(temptouch); - - if(touch.size() > 8) touch.erase(touch.begin()); - - if(touchshadow) { - for (int i = 0; i < 8; i++) { - temptouch = touch[i]; - if(temptouch.X != 0 || temptouch.Y != 0) { - aggDraw.hud->lineColor(0, 255, 0, touchalpha[i]); - aggDraw.hud->line(temptouch.X - 256, temptouch.Y + 192, temptouch.X + 256, temptouch.Y + 192); //horiz - aggDraw.hud->line(temptouch.X, temptouch.Y - 256, temptouch.X, temptouch.Y + 384); //vert - aggDraw.hud->fillColor(0, 0, 0, touchalpha[i]); - aggDraw.hud->rectangle(temptouch.X-1, temptouch.Y-1 + 192, temptouch.X+1, temptouch.Y+1 + 192); - } - } - } - else - if(nds.isTouch) { - aggDraw.hud->line(temptouch.X - 256, temptouch.Y + 192, temptouch.X + 256, temptouch.Y + 192); //horiz - aggDraw.hud->line(temptouch.X, temptouch.Y - 256, temptouch.X, temptouch.Y + 384); //vert - } -} - - diff --git a/desmume/src/GPU_osd.h b/desmume/src/GPU_osd.h index 744e44b1e..fb0dc9cb0 100644 --- a/desmume/src/GPU_osd.h +++ b/desmume/src/GPU_osd.h @@ -33,6 +33,45 @@ #define OSD_MAX_LINES 4 #define OSD_TIMER_SECS 2 + +struct HudCoordinates{ + int x; + int y; + int xsize; + int ysize; + int storedx; + int storedy; + int clicked; +}; + +struct HudStruct +{ +public: + HudStruct() + : fps(0) + , fps3d(0) + {} + + HudCoordinates FpsDisplay; + HudCoordinates FrameCounter; + HudCoordinates InputDisplay; + HudCoordinates LagFrameCounter; + HudCoordinates Microphone; + HudCoordinates Dummy; + + HudCoordinates &hud(int i) { return ((HudCoordinates*)this)[i]; } + + int fps, fps3d; +}; + +void ResetHud(HudStruct *hudstruct); +void EditHud(s32 x, s32 y, HudStruct *hudstruct); +void HudClickRelease(HudStruct *hudstruct); + +void DrawHUD(); + +extern HudStruct Hud; + class OSDCLASS { private: @@ -66,7 +105,6 @@ public: void addLine(const char *fmt, ...); void addFixed(u16 x, u16 y, const char *fmt, ...); void border(bool enabled); - void TouchDisplay(); }; extern OSDCLASS *osd; diff --git a/desmume/src/NDSSystem.h b/desmume/src/NDSSystem.h index 8cceecb2c..9f5cd1e56 100644 --- a/desmume/src/NDSSystem.h +++ b/desmume/src/NDSSystem.h @@ -308,55 +308,57 @@ template void NDS_exec(s32 nb = 560190<<1); extern int lagframecounter; - static INLINE void NDS_ARM9HBlankInt(void) - { - if(T1ReadWord(ARM9Mem.ARM9_REG, 4) & 0x10) - { - //MMU.reg_IF[0] |= 2;// & (MMU.reg_IME[0] << 1);// (MMU.reg_IE[0] & (1<<1)); - setIF(0, 2); - NDS_ARM9.wIRQ = TRUE; - } - } - - static INLINE void NDS_ARM7HBlankInt(void) - { - if(T1ReadWord(MMU.ARM7_REG, 4) & 0x10) - { - // MMU.reg_IF[1] |= 2;// & (MMU.reg_IME[1] << 1);// (MMU.reg_IE[1] & (1<<1)); - setIF(1, 2); - NDS_ARM7.wIRQ = TRUE; - } - } - - static INLINE void NDS_ARM9VBlankInt(void) - { - if(T1ReadWord(ARM9Mem.ARM9_REG, 4) & 0x8) - { - // MMU.reg_IF[0] |= 1;// & (MMU.reg_IME[0]);// (MMU.reg_IE[0] & 1); - setIF(0, 1); - NDS_ARM9.wIRQ = TRUE; - //emu_halt(); - /*logcount++;*/ - } - } - - static INLINE void NDS_ARM7VBlankInt(void) - { - if(T1ReadWord(MMU.ARM7_REG, 4) & 0x8) - // MMU.reg_IF[1] |= 1;// & (MMU.reg_IME[1]);// (MMU.reg_IE[1] & 1); - setIF(1, 1); - NDS_ARM7.wIRQ = TRUE; - //emu_halt(); - } - - static INLINE void NDS_swapScreen(void) - { - u16 tmp = MainScreen.offset; - MainScreen.offset = SubScreen.offset; - SubScreen.offset = tmp; - } +static INLINE void NDS_ARM9HBlankInt(void) +{ + if(T1ReadWord(ARM9Mem.ARM9_REG, 4) & 0x10) + { + //MMU.reg_IF[0] |= 2;// & (MMU.reg_IME[0] << 1);// (MMU.reg_IE[0] & (1<<1)); + setIF(0, 2); + NDS_ARM9.wIRQ = TRUE; + } +} + +static INLINE void NDS_ARM7HBlankInt(void) +{ + if(T1ReadWord(MMU.ARM7_REG, 4) & 0x10) + { + // MMU.reg_IF[1] |= 2;// & (MMU.reg_IME[1] << 1);// (MMU.reg_IE[1] & (1<<1)); + setIF(1, 2); + NDS_ARM7.wIRQ = TRUE; + } +} + +static INLINE void NDS_ARM9VBlankInt(void) +{ + if(T1ReadWord(ARM9Mem.ARM9_REG, 4) & 0x8) + { + // MMU.reg_IF[0] |= 1;// & (MMU.reg_IME[0]);// (MMU.reg_IE[0] & 1); + setIF(0, 1); + NDS_ARM9.wIRQ = TRUE; + //emu_halt(); + /*logcount++;*/ + } +} + +static INLINE void NDS_ARM7VBlankInt(void) +{ + if(T1ReadWord(MMU.ARM7_REG, 4) & 0x8) + // MMU.reg_IF[1] |= 1;// & (MMU.reg_IME[1]);// (MMU.reg_IE[1] & 1); + setIF(1, 1); + NDS_ARM7.wIRQ = TRUE; + //emu_halt(); +} + +static INLINE void NDS_swapScreen(void) +{ + u16 tmp = MainScreen.offset; + MainScreen.offset = SubScreen.offset; + SubScreen.offset = tmp; +} + +int NDS_WriteBMP_32bppBuffer(int width, int height, const void* buf, const char *filename); + - int NDS_WriteBMP_32bppBuffer(int width, int height, const void* buf, const char *filename); extern struct TCommonSettings { TCommonSettings() @@ -412,6 +414,17 @@ extern struct TCommonSettings { }; } showGpu; + struct _Hud { + _Hud() + : ShowInputDisplay(false) + , FpsDisplay(false) + , FrameCounterDisplay(false) + , ShowLagFrameCounter(false) + , ShowMicrophone(false) + {} + bool ShowInputDisplay, FpsDisplay, FrameCounterDisplay, ShowLagFrameCounter, ShowMicrophone; + } hud; + } CommonSettings; diff --git a/desmume/src/common.cpp b/desmume/src/common.cpp index df869f6a3..0ad7bd784 100644 --- a/desmume/src/common.cpp +++ b/desmume/src/common.cpp @@ -66,6 +66,18 @@ void GetINIPath() } } +void WritePrivateProfileBool(char* appname, char* keyname, bool val, char* file) +{ + char temp[256] = ""; + sprintf(temp, "%d", val?1:0); + WritePrivateProfileString(appname, keyname, temp, file); +} + +bool GetPrivateProfileBool(const char* appname, const char* keyname, bool defval, const char* filename) +{ + return GetPrivateProfileInt(appname,keyname,defval?1:0,filename) != 0; +} + void WritePrivateProfileInt(char* appname, char* keyname, int val, char* file) { char temp[256] = ""; diff --git a/desmume/src/common.h b/desmume/src/common.h index 084a39aec..967536ca9 100644 --- a/desmume/src/common.h +++ b/desmume/src/common.h @@ -77,6 +77,9 @@ void SetRomName(const char *filename); extern void GetINIPath(); extern void WritePrivateProfileInt(char* appname, char* keyname, int val, char* file); + bool GetPrivateProfileBool(const char* appname, const char* keyname, bool defval, const char* filename); + void WritePrivateProfileBool(char* appname, char* keyname, bool val, char* file); + #else // non Windows #define sscanf_s sscanf diff --git a/desmume/src/gfx3d.cpp b/desmume/src/gfx3d.cpp index 17cb28688..33fb89dea 100644 --- a/desmume/src/gfx3d.cpp +++ b/desmume/src/gfx3d.cpp @@ -988,7 +988,7 @@ int gfx3d_GetNumVertex() void gfx3d_glPolygonAttrib (u32 val) { if(inBegin) { - PROGINFO("Set polyattr in the middle of a begin/end pair.\n (This won't be activated until the next begin)\n"); + //PROGINFO("Set polyattr in the middle of a begin/end pair.\n (This won't be activated until the next begin)\n"); //TODO - we need some some similar checking for teximageparam etc. } polyAttrPending = val; diff --git a/desmume/src/movie.cpp b/desmume/src/movie.cpp index 41731ddda..5638d3278 100644 --- a/desmume/src/movie.cpp +++ b/desmume/src/movie.cpp @@ -58,7 +58,6 @@ bool movie_readonly = true; char curMovieFilename[512] = {0}; MovieData currMovieData; int currRerecordCount; -bool ShowInputDisplay = false; bool movie_reset_command = false; bool movie_lid = false; //-------------- @@ -697,9 +696,6 @@ void _CDECL_ FCEUI_SaveMovie(const char *fname, std::wstring author, int flag, s /*extern uint8 joy[4]; memcpy(&cur_input_display,joy,4);*/ - - osd->TouchDisplay(); - } diff --git a/desmume/src/wifi.cpp b/desmume/src/wifi.cpp index f4cba091b..b19773327 100644 --- a/desmume/src/wifi.cpp +++ b/desmume/src/wifi.cpp @@ -1498,7 +1498,9 @@ void WIFI_SoftAP_usTrigger(wifimac_t *wifi) { //if(wifi->ioMem[0xD0 >> 1] & 0x0400) { - if((wifi->SoftAP.usecCounter % 100000) == 0) + //zero sez: every 1/10 second? does it have to be precise? this is so costly.. + //if((wifi->SoftAP.usecCounter % 100000) == 0) + if((wifi->SoftAP.usecCounter & 131071) == 0) { WIFI_SoftAP_SendBeacon(wifi); } diff --git a/desmume/src/windows/hotkey.cpp b/desmume/src/windows/hotkey.cpp index 4ed82d0da..3ea1e68ac 100644 --- a/desmume/src/windows/hotkey.cpp +++ b/desmume/src/windows/hotkey.cpp @@ -208,10 +208,10 @@ void HK_Reset(int) {ResetGame();} void HK_RecordAVI(int) { if (AVI_IsRecording()) AviEnd(); else AviRecordTo(); } void HK_RecordWAV(int) { if (WAV_IsRecording()) WavEnd(); else WavRecordTo(); } -void HK_ToggleFrame(int) {frameCounterDisplay ^= true;} -void HK_ToggleFPS(int) {FpsDisplay ^= true;} -void HK_ToggleInput(int) {ShowInputDisplay ^= true;} -void HK_ToggleLag(int) {ShowLagFrameCounter ^= true;} +void HK_ToggleFrame(int) {CommonSettings.hud.FrameCounterDisplay ^= true;} +void HK_ToggleFPS(int) {CommonSettings.hud.FpsDisplay ^= true;} +void HK_ToggleInput(int) {CommonSettings.hud.ShowInputDisplay ^= true;} +void HK_ToggleLag(int) {CommonSettings.hud.ShowLagFrameCounter ^= true;} void HK_ResetLagCounter(int) { lagframecounter=0; LagFrameFlag=0; diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index abb7f936f..82161be72 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -261,129 +261,11 @@ int autoframeskipenab=0; int frameskiprate=0; int emu_paused = 0; bool frameAdvance = false; -bool frameCounterDisplay = false; -bool FpsDisplay = false; -bool ShowLagFrameCounter = false; -bool ShowMicrophone = false; + bool HudEditorMode = false; bool UseMicSample = false; unsigned short windowSize = 0; -struct HudCoordinates{ - int x; - int y; - int xsize; - int ysize; - int storedx; - int storedy; - int clicked; -}; - -struct HudStruct { - - HudCoordinates FpsDisplay; - HudCoordinates FrameCounter; - HudCoordinates InputDisplay; - HudCoordinates LagFrameCounter; - HudCoordinates Microphone; - HudCoordinates Dummy; - - HudCoordinates &hud(int i) { return ((HudCoordinates*)this)[i]; } -}; - -void SetHudDummy (HudCoordinates *hud) -{ - hud->x=666; - hud->y=666; -} - -bool IsHudDummy (HudCoordinates *hud) -{ - return (hud->x == 666 && hud->y == 666); -} - -HudStruct Hud; - -void EditHud(s32 x, s32 y, HudStruct *hudstruct) { - - UINT i = 0; - - while (!IsHudDummy(&hudstruct->hud(i))) { - HudCoordinates &hud = hudstruct->hud(i); - - //reset - if(!hud.clicked) { - hud.storedx=0; - hud.storedy=0; - } - - if((x >= hud.x && x <= hud.x + hud.xsize) && - (y >= hud.y && y <= hud.y + hud.ysize) && !hud.clicked ) { - - hud.clicked=1; - hud.storedx = x - hud.x; - hud.storedy = y - hud.y; - } - - if(hud.clicked) { - hud.x = x - hud.storedx; - hud.y = y - hud.storedy; - } - - //sanity checks - if(hud.x < 0) hud.x = 0; - if(hud.y < 0) hud.y = 0; - if(hud.x > 245)hud.x = 245; //margins - if(hud.y > 180)hud.y = 180; - - if(hud.clicked) - break;//prevent items from grouping together - - i++; - } -} - -void HudClickRelease(HudStruct *hudstruct) { - - UINT i = 0; - - while (!IsHudDummy(&hudstruct->hud(i))) { - HudCoordinates &hud = hudstruct->hud(i); - hud.clicked=0; - i++; - } -} - -void ResetHud(HudStruct *hudstruct) { - - hudstruct->FpsDisplay.x=0; - hudstruct->FpsDisplay.y=5; - hudstruct->FpsDisplay.xsize=120; - hudstruct->FpsDisplay.ysize=10; - - hudstruct->FrameCounter.x=0; - hudstruct->FrameCounter.y=25; - hudstruct->FrameCounter.xsize=60; - hudstruct->FrameCounter.ysize=10; - - hudstruct->InputDisplay.x=0; - hudstruct->InputDisplay.y=45; - hudstruct->InputDisplay.xsize=120; - hudstruct->InputDisplay.ysize=10; - - hudstruct->LagFrameCounter.x=0; - hudstruct->LagFrameCounter.y=65; - hudstruct->LagFrameCounter.xsize=30; - hudstruct->LagFrameCounter.ysize=10; - - hudstruct->Microphone.x=0; - hudstruct->Microphone.y=85; - hudstruct->Microphone.xsize=20; - hudstruct->Microphone.ysize=10; - - SetHudDummy(&hudstruct->Dummy); -} - /* the firmware settings */ struct NDS_fw_config_data win_fw_config; @@ -1024,8 +906,6 @@ DWORD WINAPI run() CallRegisteredLuaFunctions(LUACALL_BEFOREEMULATION); FCEUMOV_AddInputState(); - if (ShowInputDisplay) osd->addFixed(Hud.InputDisplay.x, Hud.InputDisplay.y, "%s",InputDisplayString.c_str()); - { Lock lock; NDS_exec(); @@ -1037,20 +917,11 @@ DWORD WINAPI run() static int fps3d = 0; - if (FpsDisplay) osd->addFixed(Hud.FpsDisplay.x, Hud.FpsDisplay.y, "Fps:%02d/%02d", fps, fps3d); - if (frameCounterDisplay) - { - if (movieMode == MOVIEMODE_PLAY) - osd->addFixed(Hud.FrameCounter.x, Hud.FrameCounter.y, "%d/%d",currFrameCounter,currMovieData.records.size()); - else if(movieMode == MOVIEMODE_RECORD) - osd->addFixed(Hud.FrameCounter.x, Hud.FrameCounter.y, "%d",currFrameCounter); - else - osd->addFixed(Hud.FrameCounter.x, Hud.FrameCounter.y, "%d (no movie)",currFrameCounter); - } - if (ShowLagFrameCounter) osd->addFixed(Hud.LagFrameCounter.x, Hud.LagFrameCounter.y, "%d",TotalLagFrames); - if (ShowMicrophone) osd->addFixed(Hud.Microphone.x, Hud.Microphone.y, "%d",MicDisplay); + Hud.fps = fps; + Hud.fps3d = fps3d; - if(!AVI_IsRecording()) osd->update(); + osd->update(); + DrawHUD(); Display(); osd->clear(); @@ -1540,13 +1411,15 @@ int _main() windowSize = GetPrivateProfileInt("Video","Window Size", 0, IniName); GPU_rotation = GetPrivateProfileInt("Video","Window Rotate", 0, IniName); ForceRatio = GetPrivateProfileInt("Video","Window Force Ratio", 1, IniName); - FpsDisplay = GetPrivateProfileInt("Display","Display Fps", 0, IniName); WndX = GetPrivateProfileInt("Video","WindowPosX", CW_USEDEFAULT, IniName); WndY = GetPrivateProfileInt("Video","WindowPosY", CW_USEDEFAULT, IniName); - frameCounterDisplay = GetPrivateProfileInt("Display","FrameCounter", 0, IniName); - ShowInputDisplay = GetPrivateProfileInt("Display","Display Input", 0, IniName); - ShowLagFrameCounter = GetPrivateProfileInt("Display","Display Lag Counter", 0, IniName); - ShowMicrophone = GetPrivateProfileInt("Display","Display Microphone", 0, IniName); + + CommonSettings.hud.FpsDisplay = GetPrivateProfileBool("Display","Display Fps", 0, IniName); + CommonSettings.hud.FrameCounterDisplay = GetPrivateProfileBool("Display","FrameCounter", 0, IniName); + CommonSettings.hud.ShowInputDisplay = GetPrivateProfileBool("Display","Display Input", 0, IniName); + CommonSettings.hud.ShowLagFrameCounter = GetPrivateProfileBool("Display","Display Lag Counter", 0, IniName); + CommonSettings.hud.ShowMicrophone = GetPrivateProfileBool("Display","Display Microphone", 0, IniName); + ScreenGap = GetPrivateProfileInt("Display", "ScreenGap", 0, IniName); FrameLimit = GetPrivateProfileInt("FrameLimit", "FrameLimit", 1, IniName); CommonSettings.showGpu.main = GetPrivateProfileInt("Display", "MainGpu", 1, IniName) != 0; @@ -2674,11 +2547,11 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM MainWindow->checkMenu(IDM_SCREENSEP_NDSGAP, MF_BYCOMMAND | ((ScreenGap==64)?MF_CHECKED:MF_UNCHECKED)); //Counters / Etc. - MainWindow->checkMenu(ID_VIEW_FRAMECOUNTER, MF_BYCOMMAND | ((frameCounterDisplay)?MF_CHECKED:MF_UNCHECKED)); - MainWindow->checkMenu(ID_VIEW_DISPLAYFPS, MF_BYCOMMAND | ((FpsDisplay) ?MF_CHECKED:MF_UNCHECKED)); - MainWindow->checkMenu(ID_VIEW_DISPLAYINPUT, MF_BYCOMMAND | ((ShowInputDisplay) ?MF_CHECKED:MF_UNCHECKED)); - MainWindow->checkMenu(ID_VIEW_DISPLAYLAG, MF_BYCOMMAND | ((ShowLagFrameCounter)?MF_CHECKED:MF_UNCHECKED)); - MainWindow->checkMenu(ID_VIEW_DISPLAYMICROPHONE, MF_BYCOMMAND | ((ShowMicrophone)?MF_CHECKED:MF_UNCHECKED)); + MainWindow->checkMenu(ID_VIEW_FRAMECOUNTER, MF_BYCOMMAND | ((CommonSettings.hud.FrameCounterDisplay)?MF_CHECKED:MF_UNCHECKED)); + MainWindow->checkMenu(ID_VIEW_DISPLAYFPS, MF_BYCOMMAND | ((CommonSettings.hud.FpsDisplay) ?MF_CHECKED:MF_UNCHECKED)); + MainWindow->checkMenu(ID_VIEW_DISPLAYINPUT, MF_BYCOMMAND | ((CommonSettings.hud.ShowInputDisplay) ?MF_CHECKED:MF_UNCHECKED)); + MainWindow->checkMenu(ID_VIEW_DISPLAYLAG, MF_BYCOMMAND | ((CommonSettings.hud.ShowLagFrameCounter)?MF_CHECKED:MF_UNCHECKED)); + MainWindow->checkMenu(ID_VIEW_DISPLAYMICROPHONE, MF_BYCOMMAND | ((CommonSettings.hud.ShowMicrophone)?MF_CHECKED:MF_UNCHECKED)); MainWindow->checkMenu(ID_VIEW_HUDEDITOR, MF_BYCOMMAND | ((HudEditorMode) ?MF_CHECKED:MF_UNCHECKED)); MainWindow->checkMenu(IDC_FRAMELIMIT, MF_BYCOMMAND | ((FrameLimit) ?MF_CHECKED:MF_UNCHECKED)); @@ -2747,7 +2620,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM WritePrivateProfileInt("Video", "WindowPosY", WndY/*MainWindowRect.top*/, IniName); //Save frame counter status - WritePrivateProfileInt("Display", "FrameCounter", frameCounterDisplay, IniName); + WritePrivateProfileInt("Display", "FrameCounter", CommonSettings.hud.FrameCounterDisplay, IniName); WritePrivateProfileInt("Display", "ScreenGap", ScreenGap, IniName); //Save Ram Watch information @@ -3398,28 +3271,29 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM FCEUI_StopMovie(); return 0; case ID_VIEW_FRAMECOUNTER: - frameCounterDisplay ^= 1; - MainWindow->checkMenu(ID_VIEW_FRAMECOUNTER, frameCounterDisplay ? MF_CHECKED : MF_UNCHECKED); + CommonSettings.hud.FrameCounterDisplay ^= true; + MainWindow->checkMenu(ID_VIEW_FRAMECOUNTER, CommonSettings.hud.FrameCounterDisplay ? MF_CHECKED : MF_UNCHECKED); + WritePrivateProfileBool("Display", "Display Fps", CommonSettings.hud.FpsDisplay, IniName); return 0; case ID_VIEW_DISPLAYFPS: - FpsDisplay ^= 1; - MainWindow->checkMenu(ID_VIEW_DISPLAYFPS, FpsDisplay ? MF_CHECKED : MF_UNCHECKED); - WritePrivateProfileInt("Display", "Display Fps", FpsDisplay, IniName); + CommonSettings.hud.FpsDisplay ^= true; + MainWindow->checkMenu(ID_VIEW_DISPLAYFPS, CommonSettings.hud.FpsDisplay ? MF_CHECKED : MF_UNCHECKED); + WritePrivateProfileBool("Display", "Display Fps", CommonSettings.hud.FpsDisplay, IniName); osd->clear(); return 0; case ID_VIEW_DISPLAYINPUT: - ShowInputDisplay ^= 1; - MainWindow->checkMenu(ID_VIEW_DISPLAYINPUT, ShowInputDisplay ? MF_CHECKED : MF_UNCHECKED); - WritePrivateProfileInt("Display", "Display Input", ShowInputDisplay, IniName); + CommonSettings.hud.ShowInputDisplay ^= true; + MainWindow->checkMenu(ID_VIEW_DISPLAYINPUT, CommonSettings.hud.ShowInputDisplay ? MF_CHECKED : MF_UNCHECKED); + WritePrivateProfileBool("Display", "Display Input", CommonSettings.hud.ShowInputDisplay, IniName); osd->clear(); return 0; case ID_VIEW_DISPLAYLAG: - ShowLagFrameCounter ^= 1; - MainWindow->checkMenu(ID_VIEW_DISPLAYLAG, ShowLagFrameCounter ? MF_CHECKED : MF_UNCHECKED); - WritePrivateProfileInt("Display", "Display Lag Counter", ShowLagFrameCounter, IniName); + CommonSettings.hud.ShowLagFrameCounter ^= true; + MainWindow->checkMenu(ID_VIEW_DISPLAYLAG, CommonSettings.hud.ShowLagFrameCounter ? MF_CHECKED : MF_UNCHECKED); + WritePrivateProfileBool("Display", "Display Lag Counter", CommonSettings.hud.ShowLagFrameCounter, IniName); osd->clear(); return 0; @@ -3431,9 +3305,9 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM return 0; case ID_VIEW_DISPLAYMICROPHONE: - ShowMicrophone ^= 1; - MainWindow->checkMenu(ID_VIEW_DISPLAYMICROPHONE, ShowMicrophone ? MF_CHECKED : MF_UNCHECKED); - WritePrivateProfileInt("Display", "Display Microphone", ShowMicrophone, IniName); + CommonSettings.hud.ShowMicrophone ^= true; + MainWindow->checkMenu(ID_VIEW_DISPLAYMICROPHONE, CommonSettings.hud.ShowMicrophone ? MF_CHECKED : MF_UNCHECKED); + WritePrivateProfileBool("Display", "Display Microphone", CommonSettings.hud.ShowMicrophone, IniName); osd->clear(); return 0;