Merge pull request #330 from 4jcraft/meson-options-cleanup

refactor: rework meson options, fix ENABLE_VSYNC
This commit is contained in:
Tropical
2026-03-28 11:12:24 -05:00
committed by GitHub
4 changed files with 32 additions and 22 deletions
+17 -6
View File
@@ -89,8 +89,15 @@ const std::wstring Options::DIFFICULTY_NAMES[] = {
const std::wstring Options::GUI_SCALE[] = {
L"options.guiScale.auto", L"options.guiScale.small",
L"options.guiScale.normal", L"options.guiScale.large"};
#ifdef ENABLE_VSYNC
const std::wstring Options::FRAMERATE_LIMITS[] = {
L"performance.max", L"performance.balanced", L"performance.powersaver"};
#else
const std::wstring Options::FRAMERATE_LIMITS[] = {
L"performance.max", L"performance.balanced", L"performance.powersaver",
L"performance.unlimited"};
#endif
const std::wstring Options::PARTICLES[] = {L"options.particles.all",
L"options.particles.decreased",
@@ -237,15 +244,19 @@ void Options::toggle(const Options::Option* option, int dir) {
if (option == Option::RENDER_CLOUDS) renderClouds = !renderClouds;
if (option == Option::ADVANCED_OPENGL) {
advancedOpengl = !advancedOpengl;
// 4jcraft: ensure level exists before applying
if(minecraft->level) minecraft->levelRenderer->allChanged();
// 4jcraft: ensure level exists before applying
if (minecraft->level) minecraft->levelRenderer->allChanged();
}
if (option == Option::ANAGLYPH) {
anaglyph3d = !anaglyph3d;
minecraft->textures->reloadAll();
}
if (option == Option::FRAMERATE_LIMIT)
#ifdef ENABLE_VSYNC
framerateLimit = (framerateLimit + dir + 3) % 3;
#else
framerateLimit = (framerateLimit + dir + 4) % 4;
#endif
// 4J-PB - Change for Xbox
// if (option == Option::DIFFICULTY) difficulty = (difficulty + dir) & 3;
@@ -255,13 +266,13 @@ void Options::toggle(const Options::Option* option, int dir) {
if (option == Option::GRAPHICS) {
fancyGraphics = !fancyGraphics;
// 4jcraft: ensure level exists before applying
if(minecraft->level) minecraft->levelRenderer->allChanged();
// 4jcraft: ensure level exists before applying
if (minecraft->level) minecraft->levelRenderer->allChanged();
}
if (option == Option::AMBIENT_OCCLUSION) {
ambientOcclusion = !ambientOcclusion;
// 4jcraft: ensure level exists before applying
if(minecraft->level) minecraft->levelRenderer->allChanged();
// 4jcraft: ensure level exists before applying
if (minecraft->level) minecraft->levelRenderer->allChanged();
}
// 4J-PB - don't do the file save on the xbox
+8 -1
View File
@@ -1061,7 +1061,11 @@ void GameRenderer::render(float a, bool bFirst) {
int maxFps = getFpsCap(mc->options->framerateLimit);
if (mc->level != NULL) {
if (mc->options->framerateLimit == 0) {
if (mc->options->framerateLimit == 0
#ifndef ENABLE_VSYNC
|| mc->options->framerateLimit == 3
#endif
) {
renderLevel(a, 0);
} else {
renderLevel(a, lastNsTime + 1000000000 / maxFps);
@@ -2133,6 +2137,9 @@ int GameRenderer::getFpsCap(int option) {
int maxFps = 200;
if (option == 1) maxFps = 120;
if (option == 2) maxFps = 35;
#ifndef ENABLE_VSYNC
if (option == 3) maxFps = std::numeric_limits<int>::max();
#endif
return maxFps;
}
+2 -6
View File
@@ -75,7 +75,7 @@ if get_option('enable_vsync')
global_cpp_defs += '-DENABLE_VSYNC'
endif
if get_option('enable_shiggy')
if get_option('ui_backend') == 'shiggy'
shiggy_dep = dependency(
'shiggy',
fallback : ['shiggy', 'shiggy_dep'],
@@ -85,14 +85,10 @@ if get_option('enable_shiggy')
client_dependencies += shiggy_dep
endif
if get_option('enable_java_guis')
if get_option('ui_backend') == 'java'
global_cpp_defs += '-DENABLE_JAVA_GUIS'
endif
if get_option('enable_shiggy') and get_option('enable_java_guis')
error('You cannot use the Iggy and Java UI at the same time, please choose one.')
endif
client = executable('Minecraft.Client',
client_sources + platform_sources + localisation[1],
include_directories : [include_directories('Platform', 'Platform/Linux/Iggy/include'),stb],