populate the menus with the config data

This commit is contained in:
Arisotura 2020-05-20 21:19:04 +02:00
parent 7be662b2dd
commit d761db0056
3 changed files with 34 additions and 5 deletions

View File

@ -40,11 +40,11 @@ int ScreenRotation;
int ScreenGap;
int ScreenLayout;
int ScreenSizing;
int IntegerScaling;
int ScreenFilter;
int ScreenUseGL;
int ScreenVSync;
int ScreenRatio;
int LimitFPS;
int AudioSync;
@ -121,11 +121,11 @@ ConfigEntry PlatformConfigFile[] =
{"ScreenGap", 0, &ScreenGap, 0, NULL, 0},
{"ScreenLayout", 0, &ScreenLayout, 0, NULL, 0},
{"ScreenSizing", 0, &ScreenSizing, 0, NULL, 0},
{"IntegerScaling", 0, &IntegerScaling, 0, NULL, 0},
{"ScreenFilter", 0, &ScreenFilter, 1, NULL, 0},
{"ScreenUseGL", 0, &ScreenUseGL, 1, NULL, 0},
{"ScreenVSync", 0, &ScreenVSync, 0, NULL, 0},
{"ScreenRatio", 0, &ScreenRatio, 0, NULL, 0},
{"LimitFPS", 0, &LimitFPS, 0, NULL, 0},
{"AudioSync", 0, &AudioSync, 1, NULL, 0},

View File

@ -53,11 +53,11 @@ extern int ScreenRotation;
extern int ScreenGap;
extern int ScreenLayout;
extern int ScreenSizing;
extern int IntegerScaling;
extern int ScreenFilter;
extern int ScreenUseGL;
extern int ScreenVSync;
extern int ScreenRatio;
extern int LimitFPS;
extern int AudioSync;

View File

@ -707,6 +707,30 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
panel = new MainWindowPanel(this);
setCentralWidget(panel);
panel->setMinimumSize(256, 384);
actSavestateSRAMReloc->setChecked(Config::SavestateRelocSRAM != 0);
actScreenRotation[Config::ScreenRotation]->setChecked(true);
for (int i = 0; i < 6; i++)
{
if (actScreenGap[i]->data().toInt() == Config::ScreenGap)
{
actScreenGap[i]->setChecked(true);
break;
}
}
actScreenLayout[Config::ScreenLayout]->setChecked(true);
actScreenSizing[Config::ScreenSizing]->setChecked(true);
actIntegerScaling->setChecked(Config::IntegerScaling != 0);
actScreenFiltering->setChecked(Config::ScreenFilter != 0);
actShowOSD->setChecked(Config::ShowOSD != 0);
actLimitFramerate->setChecked(Config::LimitFPS != 0);
actAudioSync->setChecked(Config::AudioSync != 0);
}
MainWindow::~MainWindow()
@ -1183,8 +1207,13 @@ int main(int argc, char** argv)
Config::Load();
if (Config::AudioVolume < 0) Config::AudioVolume = 0;
else if (Config::AudioVolume > 256) Config::AudioVolume = 256;
#define SANITIZE(var, min, max) { if (var < min) var = min; else if (var > max) var = max; }
SANITIZE(Config::AudioVolume, 0, 256);
SANITIZE(Config::ScreenRotation, 0, 3);
SANITIZE(Config::ScreenGap, 0, 500);
SANITIZE(Config::ScreenLayout, 0, 2);
SANITIZE(Config::ScreenSizing, 0, 3);
#undef SANITIZE
// TODO: this should be checked before running anything
#if 0