Emscripten: Disable a few options

Namely broken window frame options and pointless data folder options.
This commit is contained in:
Tamás Bálint Misius 2023-08-19 21:12:58 +02:00
parent 3d4ce09a80
commit 25b15208cf
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
3 changed files with 52 additions and 28 deletions

View File

@ -19,6 +19,8 @@ constexpr bool SECURE_CIPHERS_ONLY = @SECURE_CIPHERS_ONLY@;
constexpr bool FFTW_PLAN_MEASURE = @FFTW_PLAN_MEASURE@;
constexpr bool DEFAULT_VSYNC = @DEFAULT_VSYNC@;
constexpr bool ALLOW_QUIT = @ALLOW_QUIT@;
constexpr bool ALLOW_WINDOW_FRAME_OPS = @ALLOW_WINDOW_FRAME_OPS@;
constexpr bool ALLOW_DATA_FOLDER = @ALLOW_DATA_FOLDER@;
constexpr char PATH_SEP_CHAR = '@PATH_SEP_CHAR@';
constexpr char SERVER[] = "@SERVER@";

View File

@ -252,18 +252,21 @@ OptionsView::OptionsView() : ui::Window(ui::Point(-1, -1), ui::Point(320, 340))
c->SetScale(scale->GetOption().second);
});
}
resizable = addCheckbox(0, "Resizable \bg- allow resizing and maximizing window", "", [this] {
c->SetResizable(resizable->GetChecked());
});
fullscreen = addCheckbox(0, "Fullscreen \bg- fill the entire screen", "", [this] {
c->SetFullscreen(fullscreen->GetChecked());
});
altFullscreen = addCheckbox(1, "Set optimal screen resolution", "", [this] {
c->SetAltFullscreen(altFullscreen->GetChecked());
});
forceIntegerScaling = addCheckbox(1, "Force integer scaling \bg- less blurry", "", [this] {
c->SetForceIntegerScaling(forceIntegerScaling->GetChecked());
});
if (ALLOW_WINDOW_FRAME_OPS)
{
resizable = addCheckbox(0, "Resizable \bg- allow resizing and maximizing window", "", [this] {
c->SetResizable(resizable->GetChecked());
});
fullscreen = addCheckbox(0, "Fullscreen \bg- fill the entire screen", "", [this] {
c->SetFullscreen(fullscreen->GetChecked());
});
altFullscreen = addCheckbox(1, "Set optimal screen resolution", "", [this] {
c->SetAltFullscreen(altFullscreen->GetChecked());
});
forceIntegerScaling = addCheckbox(1, "Force integer scaling \bg- less blurry", "", [this] {
c->SetForceIntegerScaling(forceIntegerScaling->GetChecked());
});
}
addSeparator();
if (ALLOW_QUIT)
{
@ -298,8 +301,9 @@ OptionsView::OptionsView() : ui::Window(ui::Point(-1, -1), ui::Point(320, 340))
c->SetDecoSpace(decoSpace->GetOption().second);
});
currentY += 4;
if (ALLOW_DATA_FOLDER)
{
currentY += 4;
auto *dataFolderButton = new ui::Button(ui::Point(10, currentY), ui::Point(90, 16), "Open data folder");
dataFolderButton->SetActionCallback({ [] {
ByteString cwd = Platform::GetCwd();
@ -424,10 +428,22 @@ void OptionsView::NotifySettingsChanged(OptionsModel * sender)
decoSpace->SetOption(sender->GetDecoSpace());
edgeMode->SetOption(sender->GetEdgeMode());
scale->SetOption(sender->GetScale());
resizable->SetChecked(sender->GetResizable());
fullscreen->SetChecked(sender->GetFullscreen());
altFullscreen->SetChecked(sender->GetAltFullscreen());
forceIntegerScaling->SetChecked(sender->GetForceIntegerScaling());
if (resizable)
{
resizable->SetChecked(sender->GetResizable());
}
if (fullscreen)
{
fullscreen->SetChecked(sender->GetFullscreen());
}
if (altFullscreen)
{
altFullscreen->SetChecked(sender->GetAltFullscreen());
}
if (forceIntegerScaling)
{
forceIntegerScaling->SetChecked(sender->GetForceIntegerScaling());
}
if (fastquit)
{
fastquit->SetChecked(sender->GetFastQuit());

View File

@ -5,35 +5,41 @@ mod_id = get_option('mod_id')
is_snapshot = get_option('snapshot')
is_beta = get_option('beta')
is_mod = mod_id > 0
conf_data.set('X86', is_x86 ? 'true' : 'false')
conf_data.set('BETA', is_beta ? 'true' : 'false')
conf_data.set('X86', is_x86.to_string())
conf_data.set('BETA', is_beta.to_string())
conf_data.set('MOD_ID', mod_id)
conf_data.set('DEBUG', is_debug ? 'true' : 'false')
conf_data.set('MOD', is_mod ? 'true' : 'false')
conf_data.set('SNAPSHOT', is_snapshot ? 'true' : 'false')
conf_data.set('DEBUG', is_debug.to_string())
conf_data.set('MOD', is_mod.to_string())
conf_data.set('SNAPSHOT', is_snapshot.to_string())
conf_data.set('SNAPSHOT_ID', get_option('snapshot_id'))
conf_data.set('ALLOW_FAKE_NEWER_VERSION', (is_snapshot or is_beta or is_debug or is_mod) ? 'true' : 'false')
conf_data.set('ALLOW_FAKE_NEWER_VERSION', (is_snapshot or is_beta or is_debug or is_mod).to_string())
conf_data.set('IDENT_PLATFORM', ident_platform)
conf_data.set('IDENT', '@0@-@1@-@2@'.format(host_arch, host_platform, host_libc).to_upper())
update_server = get_option('update_server')
conf_data.set('UPDATESERVER', update_server)
conf_data.set('USE_UPDATESERVER', update_server != '' ? 'true' : 'false')
conf_data.set('USE_UPDATESERVER', (update_server != '').to_string())
enforce_https = get_option('enforce_https')
allow_quit = true
allow_window_frame_ops = true
allow_data_folder = true
if host_platform == 'emscripten'
allow_quit = false
allow_window_frame_ops = false
allow_data_folder = false
endif
secure_ciphers_only = get_option('secure_ciphers_only')
if not is_debug and not enforce_https
error('refusing to build a release binary without enforcing HTTPS, configure with -Denforce_https=true to fix this error')
endif
conf_data.set('ALLOW_QUIT', allow_quit ? 'true' : 'false')
conf_data.set('ENFORCE_HTTPS', enforce_https ? 'true' : 'false')
conf_data.set('SECURE_CIPHERS_ONLY', secure_ciphers_only ? 'true' : 'false')
conf_data.set('ALLOW_QUIT', allow_quit.to_string())
conf_data.set('ALLOW_WINDOW_FRAME_OPS', allow_window_frame_ops.to_string())
conf_data.set('ALLOW_DATA_FOLDER', allow_data_folder.to_string())
conf_data.set('ENFORCE_HTTPS', enforce_https.to_string())
conf_data.set('SECURE_CIPHERS_ONLY', secure_ciphers_only.to_string())
conf_data.set('IGNORE_UPDATES', get_option('ignore_updates') ? 'true' : 'false')
conf_data.set('IGNORE_UPDATES', get_option('ignore_updates').to_string())
conf_data.set('SERVER', get_option('server'))
conf_data.set('STATICSERVER', get_option('static_server'))
conf_data.set('APPNAME', get_option('app_name'))