mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-08-20 09:57:10 +00:00
Merge pull request #330 from 4jcraft/meson-options-cleanup
refactor: rework meson options, fix ENABLE_VSYNC
This commit is contained in:
commit
eb7bb6e518
|
|
@ -89,8 +89,15 @@ const std::wstring Options::DIFFICULTY_NAMES[] = {
|
||||||
const std::wstring Options::GUI_SCALE[] = {
|
const std::wstring Options::GUI_SCALE[] = {
|
||||||
L"options.guiScale.auto", L"options.guiScale.small",
|
L"options.guiScale.auto", L"options.guiScale.small",
|
||||||
L"options.guiScale.normal", L"options.guiScale.large"};
|
L"options.guiScale.normal", L"options.guiScale.large"};
|
||||||
|
|
||||||
|
#ifdef ENABLE_VSYNC
|
||||||
const std::wstring Options::FRAMERATE_LIMITS[] = {
|
const std::wstring Options::FRAMERATE_LIMITS[] = {
|
||||||
L"performance.max", L"performance.balanced", L"performance.powersaver"};
|
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",
|
const std::wstring Options::PARTICLES[] = {L"options.particles.all",
|
||||||
L"options.particles.decreased",
|
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::RENDER_CLOUDS) renderClouds = !renderClouds;
|
||||||
if (option == Option::ADVANCED_OPENGL) {
|
if (option == Option::ADVANCED_OPENGL) {
|
||||||
advancedOpengl = !advancedOpengl;
|
advancedOpengl = !advancedOpengl;
|
||||||
// 4jcraft: ensure level exists before applying
|
// 4jcraft: ensure level exists before applying
|
||||||
if(minecraft->level) minecraft->levelRenderer->allChanged();
|
if (minecraft->level) minecraft->levelRenderer->allChanged();
|
||||||
}
|
}
|
||||||
if (option == Option::ANAGLYPH) {
|
if (option == Option::ANAGLYPH) {
|
||||||
anaglyph3d = !anaglyph3d;
|
anaglyph3d = !anaglyph3d;
|
||||||
minecraft->textures->reloadAll();
|
minecraft->textures->reloadAll();
|
||||||
}
|
}
|
||||||
if (option == Option::FRAMERATE_LIMIT)
|
if (option == Option::FRAMERATE_LIMIT)
|
||||||
|
#ifdef ENABLE_VSYNC
|
||||||
framerateLimit = (framerateLimit + dir + 3) % 3;
|
framerateLimit = (framerateLimit + dir + 3) % 3;
|
||||||
|
#else
|
||||||
|
framerateLimit = (framerateLimit + dir + 4) % 4;
|
||||||
|
#endif
|
||||||
|
|
||||||
// 4J-PB - Change for Xbox
|
// 4J-PB - Change for Xbox
|
||||||
// if (option == Option::DIFFICULTY) difficulty = (difficulty + dir) & 3;
|
// 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) {
|
if (option == Option::GRAPHICS) {
|
||||||
fancyGraphics = !fancyGraphics;
|
fancyGraphics = !fancyGraphics;
|
||||||
// 4jcraft: ensure level exists before applying
|
// 4jcraft: ensure level exists before applying
|
||||||
if(minecraft->level) minecraft->levelRenderer->allChanged();
|
if (minecraft->level) minecraft->levelRenderer->allChanged();
|
||||||
}
|
}
|
||||||
if (option == Option::AMBIENT_OCCLUSION) {
|
if (option == Option::AMBIENT_OCCLUSION) {
|
||||||
ambientOcclusion = !ambientOcclusion;
|
ambientOcclusion = !ambientOcclusion;
|
||||||
// 4jcraft: ensure level exists before applying
|
// 4jcraft: ensure level exists before applying
|
||||||
if(minecraft->level) minecraft->levelRenderer->allChanged();
|
if (minecraft->level) minecraft->levelRenderer->allChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J-PB - don't do the file save on the xbox
|
// 4J-PB - don't do the file save on the xbox
|
||||||
|
|
|
||||||
|
|
@ -1061,7 +1061,11 @@ void GameRenderer::render(float a, bool bFirst) {
|
||||||
int maxFps = getFpsCap(mc->options->framerateLimit);
|
int maxFps = getFpsCap(mc->options->framerateLimit);
|
||||||
|
|
||||||
if (mc->level != NULL) {
|
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);
|
renderLevel(a, 0);
|
||||||
} else {
|
} else {
|
||||||
renderLevel(a, lastNsTime + 1000000000 / maxFps);
|
renderLevel(a, lastNsTime + 1000000000 / maxFps);
|
||||||
|
|
@ -2133,6 +2137,9 @@ int GameRenderer::getFpsCap(int option) {
|
||||||
int maxFps = 200;
|
int maxFps = 200;
|
||||||
if (option == 1) maxFps = 120;
|
if (option == 1) maxFps = 120;
|
||||||
if (option == 2) maxFps = 35;
|
if (option == 2) maxFps = 35;
|
||||||
|
#ifndef ENABLE_VSYNC
|
||||||
|
if (option == 3) maxFps = std::numeric_limits<int>::max();
|
||||||
|
#endif
|
||||||
return maxFps;
|
return maxFps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ if get_option('enable_vsync')
|
||||||
global_cpp_defs += '-DENABLE_VSYNC'
|
global_cpp_defs += '-DENABLE_VSYNC'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get_option('enable_shiggy')
|
if get_option('ui_backend') == 'shiggy'
|
||||||
shiggy_dep = dependency(
|
shiggy_dep = dependency(
|
||||||
'shiggy',
|
'shiggy',
|
||||||
fallback : ['shiggy', 'shiggy_dep'],
|
fallback : ['shiggy', 'shiggy_dep'],
|
||||||
|
|
@ -85,14 +85,10 @@ if get_option('enable_shiggy')
|
||||||
client_dependencies += shiggy_dep
|
client_dependencies += shiggy_dep
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get_option('enable_java_guis')
|
if get_option('ui_backend') == 'java'
|
||||||
global_cpp_defs += '-DENABLE_JAVA_GUIS'
|
global_cpp_defs += '-DENABLE_JAVA_GUIS'
|
||||||
endif
|
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 = executable('Minecraft.Client',
|
||||||
client_sources + platform_sources + localisation[1],
|
client_sources + platform_sources + localisation[1],
|
||||||
include_directories : [include_directories('Platform', 'Platform/Linux/Iggy/include'),stb],
|
include_directories : [include_directories('Platform', 'Platform/Linux/Iggy/include'),stb],
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,10 @@
|
||||||
option('enable_java_guis',
|
option('ui_backend',
|
||||||
type : 'boolean',
|
type : 'combo',
|
||||||
value : false,
|
choices: ['shiggy', 'java'],
|
||||||
description : 'Re-enable the Java UI remnants in the code (for testing only)')
|
value : 'shiggy',
|
||||||
|
description : 'Specifies a backend implementation for the game UI.')
|
||||||
|
|
||||||
option('enable_vsync',
|
option('enable_vsync',
|
||||||
type : 'boolean',
|
type : 'boolean',
|
||||||
value : true,
|
value : true,
|
||||||
description : 'Toggles V-Sync and adds options to unlock maximum in-game framerate.')
|
description : 'Toggles V-Sync and adds options to unlock maximum in-game framerate.')
|
||||||
|
|
||||||
option('enable_shiggy',
|
|
||||||
type : 'boolean',
|
|
||||||
value : true,
|
|
||||||
description : 'Toggles shimmed PS4 Iggy binaries and UI for x86_64 Linux.')
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue