make hud editor actually save position (fixes #572)

This commit is contained in:
zeromus 2022-07-30 16:47:43 -04:00
parent 5ab59eac86
commit 35d7561fd7
4 changed files with 37 additions and 0 deletions

View File

@ -36,6 +36,7 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#include <Windows.h> #include <Windows.h>
#include "winutil.h"
#else #else
#include <sys/time.h> #include <sys/time.h>
#endif #endif
@ -175,6 +176,12 @@ void HudStruct::reset()
SavestateSlots.xsize = 240; SavestateSlots.xsize = 240;
SavestateSlots.ysize = 24; SavestateSlots.ysize = 24;
#ifdef _MSC_VER
#define AGG_OSD_SETTING(which,comp) which.comp = GetPrivateProfileInt("HudEdit", #which "." #comp, which.comp, IniName);
#include "agg_osd_settings.inc"
#undef AGG_OSD_SETTING
#endif
SetHudDummy(&Dummy); SetHudDummy(&Dummy);
clicked = false; clicked = false;
} }
@ -791,3 +798,14 @@ void OSDCLASS::border(bool enabled)
{ {
//render51.setTextBoxBorder(enabled); //render51.setTextBoxBorder(enabled);
} }
void OSDCLASS::SaveHudEditor()
{
#ifdef _MSC_VER
#define AGG_OSD_SETTING(which,comp) WritePrivateProfileInt("HudEdit", #which "." #comp, Hud.which.comp, IniName);
#include "agg_osd_settings.inc"
#undef AGG_OSD_SETTING
#endif
//WritePrivateProfileInt("HudEdit", "FpsDisplay" "." "x", FpsDisplay.x, IniName);
}

View File

@ -125,6 +125,8 @@ public:
void addLine(const char* fmt, va_list args); void addLine(const char* fmt, va_list args);
void addFixed(u16 x, u16 y, const char *fmt, ...); void addFixed(u16 x, u16 y, const char *fmt, ...);
void border(bool enabled); void border(bool enabled);
void SaveHudEditor();
}; };
extern OSDCLASS *osd; extern OSDCLASS *osd;
@ -139,6 +141,7 @@ public:
void clear(); void clear();
void setLineColor(u8 r, u8 b, u8 g); void setLineColor(u8 r, u8 b, u8 g);
void addLine(const char *fmt, ...); void addLine(const char *fmt, ...);
void SaveHudEditor() {}
}; };
extern OSDCLASS *osd; extern OSDCLASS *osd;

View File

@ -0,0 +1,12 @@
#define AGG_OSD_SETTING_ALL(which) AGG_OSD_SETTING(which,x) AGG_OSD_SETTING(which,y) AGG_OSD_SETTING(which,xsize) AGG_OSD_SETTING(which,ysize)
AGG_OSD_SETTING_ALL(FpsDisplay);
AGG_OSD_SETTING_ALL(FrameCounter);
AGG_OSD_SETTING_ALL(InputDisplay);
AGG_OSD_SETTING_ALL(GraphicalInputDisplay);
AGG_OSD_SETTING_ALL(LagFrameCounter);
AGG_OSD_SETTING_ALL(Microphone);
AGG_OSD_SETTING_ALL(RTCDisplay);
AGG_OSD_SETTING_ALL(SavestateSlots);
#undef AGG_OSD_SETTING_ALL

View File

@ -4000,6 +4000,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
NDS_UnPause(); NDS_UnPause();
delete MainWindowToolbar; delete MainWindowToolbar;
KillTimer(hwnd, autoHideCursorTimer); KillTimer(hwnd, autoHideCursorTimer);
if(HudEditorMode)
osd->SaveHudEditor();
return 0; return 0;
} }
case WM_TIMER: case WM_TIMER:
@ -5183,6 +5185,8 @@ DOKEYDOWN:
HudEditorMode ^= true; HudEditorMode ^= true;
osd->clear(); osd->clear();
osd->border(HudEditorMode); osd->border(HudEditorMode);
if(!HudEditorMode)
osd->SaveHudEditor();
return 0; return 0;
case ID_VIEW_DISPLAYMICROPHONE: case ID_VIEW_DISPLAYMICROPHONE: