here, have code
This commit is contained in:
Arisotura 2019-09-04 15:41:42 +02:00
parent a4f9187b9b
commit 1b40149b0a
3 changed files with 20 additions and 3 deletions

View File

@ -47,6 +47,7 @@ int ScreenVSync;
int ScreenRatio; int ScreenRatio;
int LimitFPS; int LimitFPS;
int AudioSync;
int ShowOSD; int ShowOSD;
int DirectBoot; int DirectBoot;
@ -122,7 +123,8 @@ ConfigEntry PlatformConfigFile[] =
{"ScreenVSync", 0, &ScreenVSync, 0, NULL, 0}, {"ScreenVSync", 0, &ScreenVSync, 0, NULL, 0},
{"ScreenRatio", 0, &ScreenRatio, 0, NULL, 0}, {"ScreenRatio", 0, &ScreenRatio, 0, NULL, 0},
{"LimitFPS", 0, &LimitFPS, 1, NULL, 0}, {"LimitFPS", 0, &LimitFPS, 0, NULL, 0},
{"AudioSync", 0, &AudioSync, 1, NULL, 0},
{"ShowOSD", 0, &ShowOSD, 1, NULL, 0}, {"ShowOSD", 0, &ShowOSD, 1, NULL, 0},
{"DirectBoot", 0, &DirectBoot, 1, NULL, 0}, {"DirectBoot", 0, &DirectBoot, 1, NULL, 0},

View File

@ -58,6 +58,7 @@ extern int ScreenVSync;
extern int ScreenRatio; extern int ScreenRatio;
extern int LimitFPS; extern int LimitFPS;
extern int AudioSync;
extern int ShowOSD; extern int ShowOSD;
extern int DirectBoot; extern int DirectBoot;

View File

@ -93,6 +93,7 @@ uiMenuItem* MenuItem_ScreenSizing[4];
uiMenuItem* MenuItem_ScreenFilter; uiMenuItem* MenuItem_ScreenFilter;
uiMenuItem* MenuItem_LimitFPS; uiMenuItem* MenuItem_LimitFPS;
uiMenuItem* MenuItem_AudioSync;
uiMenuItem* MenuItem_ShowOSD; uiMenuItem* MenuItem_ShowOSD;
SDL_Thread* EmuThread; SDL_Thread* EmuThread;
@ -2198,6 +2199,13 @@ void OnSetLimitFPS(uiMenuItem* item, uiWindow* window, void* blarg)
else Config::LimitFPS = false; else Config::LimitFPS = false;
} }
void OnSetAudioSync(uiMenuItem* item, uiWindow* window, void* blarg)
{
int chk = uiMenuItemChecked(item);
if (chk != 0) Config::AudioSync = true;
else Config::AudioSync = false;
}
void OnSetShowOSD(uiMenuItem* item, uiWindow* window, void* blarg) void OnSetShowOSD(uiMenuItem* item, uiWindow* window, void* blarg)
{ {
int chk = uiMenuItemChecked(item); int chk = uiMenuItemChecked(item);
@ -2442,11 +2450,16 @@ void CreateMainWindowMenu()
MenuItem_ScreenFilter = uiMenuAppendCheckItem(menu, "Screen filtering"); MenuItem_ScreenFilter = uiMenuAppendCheckItem(menu, "Screen filtering");
uiMenuItemOnClicked(MenuItem_ScreenFilter, OnSetScreenFiltering, NULL); uiMenuItemOnClicked(MenuItem_ScreenFilter, OnSetScreenFiltering, NULL);
MenuItem_ShowOSD = uiMenuAppendCheckItem(menu, "Show OSD");
uiMenuItemOnClicked(MenuItem_ShowOSD, OnSetShowOSD, NULL);
uiMenuAppendSeparator(menu);
MenuItem_LimitFPS = uiMenuAppendCheckItem(menu, "Limit framerate"); MenuItem_LimitFPS = uiMenuAppendCheckItem(menu, "Limit framerate");
uiMenuItemOnClicked(MenuItem_LimitFPS, OnSetLimitFPS, NULL); uiMenuItemOnClicked(MenuItem_LimitFPS, OnSetLimitFPS, NULL);
MenuItem_ShowOSD = uiMenuAppendCheckItem(menu, "Show OSD"); MenuItem_AudioSync = uiMenuAppendCheckItem(menu, "Audio sync");
uiMenuItemOnClicked(MenuItem_ShowOSD, OnSetShowOSD, NULL); uiMenuItemOnClicked(MenuItem_AudioSync, OnSetAudioSync, NULL);
} }
void CreateMainWindow(bool opengl) void CreateMainWindow(bool opengl)
@ -2688,6 +2701,7 @@ int main(int argc, char** argv)
uiMenuItemSetChecked(MenuItem_ScreenFilter, Config::ScreenFilter==1); uiMenuItemSetChecked(MenuItem_ScreenFilter, Config::ScreenFilter==1);
uiMenuItemSetChecked(MenuItem_LimitFPS, Config::LimitFPS==1); uiMenuItemSetChecked(MenuItem_LimitFPS, Config::LimitFPS==1);
uiMenuItemSetChecked(MenuItem_AudioSync, Config::AudioSync==1);
uiMenuItemSetChecked(MenuItem_ShowOSD, Config::ShowOSD==1); uiMenuItemSetChecked(MenuItem_ShowOSD, Config::ShowOSD==1);
AudioFreq = 48000; // TODO: make configurable? AudioFreq = 48000; // TODO: make configurable?