#pragma once #include "core/types.h" #include #include #include #include class ByteStream; namespace GameSettings { enum class Trait : u32 { ForceInterpreter, ForceSoftwareRenderer, ForceInterlacing, DisableTrueColor, DisableUpscaling, DisableScaledDithering, DisableForceNTSCTimings, DisableWidescreen, DisablePGXP, DisablePGXPCulling, ForcePGXPVertexCache, ForcePGXPCPUMode, ForceDigitalController, ForceRecompilerMemoryExceptions, ForceRecompilerICache, Count }; const char* GetTraitName(Trait trait); const char* GetTraitDisplayName(Trait trait); struct Entry { std::bitset(Trait::Count)> traits{}; std::optional display_active_start_offset; std::optional display_active_end_offset; // user settings std::optional display_crop_mode; std::optional display_aspect_ratio; std::optional display_linear_upscaling; std::optional display_integer_upscaling; std::optional gpu_resolution_scale; std::optional gpu_true_color; std::optional gpu_scaled_dithering; std::optional gpu_force_ntsc_timings; std::optional gpu_texture_filter; std::optional gpu_widescreen_hack; std::optional gpu_pgxp; std::optional controller_1_type; std::optional controller_2_type; std::optional memory_card_1_type; std::optional memory_card_2_type; std::string memory_card_1_shared_path; std::string memory_card_2_shared_path; ALWAYS_INLINE bool HasTrait(Trait trait) const { return traits[static_cast(trait)]; } ALWAYS_INLINE void AddTrait(Trait trait) { traits[static_cast(trait)] = true; } ALWAYS_INLINE void RemoveTrait(Trait trait) { traits[static_cast(trait)] = false; } ALWAYS_INLINE void SetTrait(Trait trait, bool enabled) { traits[static_cast(trait)] = enabled; } bool HasAnySettings() const; bool LoadFromStream(ByteStream* stream); bool SaveToStream(ByteStream* stream) const; void ApplySettings(bool display_osd_messages) const; }; class Database { public: Database(); ~Database(); const Entry* GetEntry(const std::string& code) const; void SetEntry(const std::string& code, const std::string& name, const Entry& entry, const char* save_path); bool Load(const char* path); private: std::unordered_map m_entries; }; }; // namespace GameSettings