mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-07 08:15:59 -10:00
* Add command-line option overrides to options system - Extend `OptionsManager` to support storing and displaying reasons for overrides. - Update related code paths to prioritize command-line overrides, ensure correct option resolution, and display override details in the UI. - Add unit tests for override behavior and round-trip validation. - Remove unused legacy functions (`removeVSyncOption`, `removeWindowModeOption`) in favor of the new system. * Add unit tests for `Graphics.Anisotropy` option validation with and without OpenGL * Add support for associating command-line option names to `OptionsManager` overrides - Update HDR, shadow rendering, and graphics API option overrides to include their respective command-line flag names. - Refactor `Graphics.RenderAPI` to use the `GraphicsAPI` enum instead of raw integers for better type safety and clarity. - Ensure Vulkan support logic and fallback behavior function correctly with the updated options system. - Update unit tests to validate override functionality and enum-based API configuration. * Remove unused `removeVSyncOption` function * Apply the PR review feedback for the command-line option overrides Delete the unit-test run artifacts that this branch committed by mistake, and add .gitignore rules for the files that the unittests binary writes. Give an override priority over an in-session edit again. The options UI now shows a disabled control for an overridden option, and setConfigValue() refuses an edit for an overridden key. Before this change, a save wrote the edit to the config file and applied it to the bound global, but getValue() kept returning the override. The game and the options menu then showed different values for the rest of the session. Add a setOverride() overload that takes a JSON value. Every command-line flag now builds its override with json_integer, json_real, json_true, json_false or json_pack, in place of a hand-formatted string. Make Graphics.CockpitFOV and Graphics.CockpitFOVToggle independent of the order in which the options manager loads them, and remove the forced override on the player's toggle preference. The toggle listener also replaces an identical bind_to() call that made the listener dead code. Add 16 to the values of Graphics.MSAASamples. The -msaa flag accepts 16, so an override with that value made printValues() report an invalid value. Keep the render API that the caller gives to gr_init(). Only a Default value now comes from the Graphics.RenderAPI option, so FRED and the unit tests keep the backend that they ask for. Make the default_func of Graphics.Shadows and Graphics.ShadowRenderMethod return their global. A constant discarded the value that -enable_shadows and the mod table set. Set Max_rt_shadow_local_lights to 4, because 3 is not one of the values that the option offers. Also: resolve -lang one time, share the render API name with version.cpp, correct the stale comments, and add unit tests with a fixture that clears the overrides after each test. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UGh4ZM2u4oUGSbrP122Uyr * Fix the order-dependent crash in the MSAA option test The test `MsaaOverrideAcceptsEverySampleCountTheFlagAllows` calls `getValidValues()`. `Option<T>` makes a display string for each value, and the display function of `Graphics.MSAASamples` calls `XSTR()`. `XSTR()` runs `Int3()` if `lcl_xstr_init()` did not run before. Only `FSTestFixture` runs it, and `Xstr_inited` stays set for the remainder of the process. Thus the shuffled test order decided if the test passed or if it stopped the test binary with SIGILL. Move that one test to a new fixture that derives from `FSTestFixture`. The fixture initializes localization, and it also clears the overrides after each test. Refresh the comment that told that the test binary never runs `lcl_init()`. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UGh4ZM2u4oUGSbrP122Uyr --------- Co-authored-by: Claude Opus 5 <[email protected]>
173 lines
5.3 KiB
C++
173 lines
5.3 KiB
C++
/*
|
|
* Copyright (C) Volition, Inc. 1999. All rights reserved.
|
|
*
|
|
* All source code herein is the property of Volition, Inc. You may not sell
|
|
* or otherwise commercially exploit the source or things you created based on the
|
|
* source.
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
#ifndef FS_CMDLINE_HEADER_FILE
|
|
#define FS_CMDLINE_HEADER_FILE
|
|
|
|
#include <optional>
|
|
#include "graphics/2d.h"
|
|
|
|
int parse_cmdline(int argc, char *argv[]);
|
|
|
|
// COMMAND LINE SETTINGS
|
|
// This section is for reference by all the *_init() functions. For example, the multiplayer init function
|
|
// could check to see if (int Cmdline_multi_stream_chat_to_file) has been set by the command line parser.
|
|
//
|
|
// Add any extern definitions here and put the actual variables inside of cmdline.cpp for ease of use
|
|
// Also, check to make sure anything you add doesn't break Fred or TestCode
|
|
|
|
|
|
// RETAIL OPTIONS ----------------------------------------------
|
|
extern char *Cmdline_connect_addr;
|
|
extern char *Cmdline_game_name;
|
|
extern char *Cmdline_game_password;
|
|
extern char *Cmdline_rank_above;
|
|
extern char *Cmdline_rank_below;
|
|
extern int Cmdline_cd_check;
|
|
extern int Cmdline_closed_game;
|
|
extern int Cmdline_freespace_no_music;
|
|
extern int Cmdline_freespace_no_sound;
|
|
extern int Cmdline_mouse_coords;
|
|
extern int Cmdline_multi_log;
|
|
extern int Cmdline_multi_stream_chat_to_file;
|
|
extern int Cmdline_network_port;
|
|
extern int Cmdline_restricted_game;
|
|
extern int Cmdline_spew_pof_info;
|
|
extern int Cmdline_start_netgame;
|
|
extern int Cmdline_timeout;
|
|
extern int Cmdline_use_last_pilot;
|
|
extern bool Cmdline_window;
|
|
extern bool Cmdline_fullscreen_window;
|
|
extern char *Cmdline_res;
|
|
extern std::optional<std::pair<uint16_t, uint16_t>>Cmdline_window_res;
|
|
extern char *Cmdline_center_res;
|
|
|
|
|
|
// FSO OPTIONS -------------------------------------------------
|
|
|
|
// Graphics related
|
|
extern float Cmdline_ambient_power;
|
|
extern float Cmdline_emissive_power;
|
|
extern float Cmdline_light_power;
|
|
extern int Cmdline_env;
|
|
extern int Cmdline_glow;
|
|
extern int Cmdline_noscalevid; // disables fit-to-window for movies - taylor
|
|
extern int Cmdline_spec;
|
|
extern int Cmdline_normal;
|
|
extern int Cmdline_height;
|
|
extern int Cmdline_softparticles;
|
|
extern int Cmdline_no_deferred_lighting;
|
|
extern bool Cmdline_deferred_lighting_cockpit;
|
|
extern int Cmdline_emissive;
|
|
extern int Cmdline_aniso_level;
|
|
extern int Cmdline_msaa_enabled;
|
|
|
|
// Game Speed related
|
|
extern int Cmdline_NoFPSCap;
|
|
extern bool Cmdline_no_vsync;
|
|
|
|
// HUD related
|
|
extern int Cmdline_ballistic_gauge;
|
|
extern int Cmdline_dualscanlines;
|
|
extern int Cmdline_orb_radar;
|
|
extern int Cmdline_rearm_timer;
|
|
|
|
// Gameplay related
|
|
extern int Cmdline_autopilot_interruptable;
|
|
extern bool Cmdline_stretch_menu;
|
|
extern bool Cmdline_capture_mouse;
|
|
extern int Cmdline_deadzone;
|
|
extern bool Cmdline_enable_vr;
|
|
|
|
// Audio related
|
|
extern int Cmdline_voice_recognition;
|
|
extern int Cmdline_no_enhanced_sound;
|
|
|
|
// MOD related
|
|
extern char *Cmdline_mod; // DTP for mod support
|
|
extern char *Cmdline_campaign; // for campaign support
|
|
// Multiplayer/Network related
|
|
extern char *Cmdline_almission; // DTP for autoload mission (for multi only)
|
|
extern int Cmdline_ingamejoin;
|
|
extern int Cmdline_mpnoreturn;
|
|
extern int Cmdline_objupd;
|
|
extern char *Cmdline_gateway_ip;
|
|
|
|
// Launcher related options
|
|
extern bool Cmdline_portable_mode;
|
|
extern SCP_string Cmdline_lang;
|
|
|
|
// Troubleshooting
|
|
extern int Cmdline_load_all_weapons;
|
|
extern int Cmdline_nomovies; // WMC Toggles movie playing support
|
|
extern int Cmdline_no_set_gamma;
|
|
extern bool Cmdline_no_ingame_options;
|
|
extern int Cmdline_no_fbo;
|
|
extern int Cmdline_no_pbo;
|
|
extern int Cmdline_mipmap;
|
|
extern int Cmdline_ati_color_swap;
|
|
extern int Cmdline_no_3d_sound;
|
|
extern int Cmdline_drawelements;
|
|
extern char* Cmdline_keyboard_layout;
|
|
extern bool Cmdline_gl_finish;
|
|
extern bool Cmdline_no_geo_sdr_effects;
|
|
extern bool Cmdline_set_cpu_affinity;
|
|
extern bool Cmdline_nograb;
|
|
extern bool Cmdline_noshadercache;
|
|
extern bool Cmdline_prefer_ipv4;
|
|
extern bool Cmdline_prefer_ipv6;
|
|
extern bool Cmdline_dump_packet_type;
|
|
extern bool Cmdline_no_large_shaders;
|
|
#ifdef WIN32
|
|
extern bool Cmdline_alternate_registry_path;
|
|
#endif
|
|
|
|
// Developer/Testing related
|
|
extern char *Cmdline_start_mission;
|
|
extern int Cmdline_dis_collisions;
|
|
extern int Cmdline_dis_weapons;
|
|
extern bool Cmdline_output_sexp_info;
|
|
extern int Cmdline_noparseerrors;
|
|
extern int Cmdline_extra_warn;
|
|
extern int Cmdline_bmpman_usage;
|
|
extern int Cmdline_show_pos;
|
|
extern int Cmdline_show_stats;
|
|
extern int Cmdline_save_render_targets;
|
|
extern int Cmdline_verify_vps;
|
|
extern int Cmdline_reparse_mainhall;
|
|
extern bool Cmdline_profile_write_file;
|
|
extern bool Cmdline_no_unfocus_pause;
|
|
extern bool Cmdline_retail_time_compression_range;
|
|
extern bool Cmdline_benchmark_mode;
|
|
extern const char *Cmdline_pilot;
|
|
extern bool Cmdline_noninteractive;
|
|
extern bool Cmdline_json_profiling;
|
|
extern bool Cmdline_frame_profile;
|
|
extern bool Cmdline_show_video_info;
|
|
extern bool Cmdline_debug_window;
|
|
extern bool Cmdline_graphics_debug_output;
|
|
extern bool Cmdline_gr_sync_validation;
|
|
extern bool Cmdline_log_to_stdout;
|
|
extern bool Cmdline_slow_frames_ok;
|
|
extern bool Cmdline_lua_devmode;
|
|
extern bool Cmdline_override_data;
|
|
extern bool Cmdline_show_imgui_debug;
|
|
extern GraphicsAPI Cmdline_graphics_api;
|
|
extern int Cmdline_multithreading;
|
|
|
|
enum class WeaponSpewType { NONE = 0, STANDARD, ALL };
|
|
extern WeaponSpewType Cmdline_spew_weapon_stats;
|
|
|
|
extern void removeResolutionOption();
|
|
extern void removeResolutionVROption();
|
|
|
|
#endif
|