2024-02-03 16:36:25 +00:00
|
|
|
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
2022-12-04 11:03:45 +00:00
|
|
|
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
#pragma once
|
|
|
|
#include "core/types.h"
|
|
|
|
#include "util/cd_image_hasher.h"
|
|
|
|
#include <bitset>
|
|
|
|
#include <map>
|
|
|
|
#include <string>
|
|
|
|
#include <string_view>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
class CDImage;
|
|
|
|
|
|
|
|
struct Settings;
|
|
|
|
|
|
|
|
namespace GameDatabase {
|
2023-08-19 12:00:20 +00:00
|
|
|
enum class CompatibilityRating : u8
|
2022-07-11 13:03:29 +00:00
|
|
|
{
|
|
|
|
Unknown = 0,
|
|
|
|
DoesntBoot = 1,
|
|
|
|
CrashesInIntro = 2,
|
|
|
|
CrashesInGame = 3,
|
|
|
|
GraphicalAudioIssues = 4,
|
|
|
|
NoIssues = 5,
|
|
|
|
Count,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class Trait : u32
|
|
|
|
{
|
|
|
|
ForceInterpreter,
|
|
|
|
ForceSoftwareRenderer,
|
|
|
|
ForceSoftwareRendererForReadbacks,
|
|
|
|
ForceInterlacing,
|
|
|
|
DisableTrueColor,
|
|
|
|
DisableUpscaling,
|
2023-12-01 07:36:37 +00:00
|
|
|
DisableTextureFiltering,
|
2022-07-11 13:03:29 +00:00
|
|
|
DisableScaledDithering,
|
|
|
|
DisableForceNTSCTimings,
|
|
|
|
DisableWidescreen,
|
|
|
|
DisablePGXP,
|
|
|
|
DisablePGXPCulling,
|
|
|
|
DisablePGXPTextureCorrection,
|
2022-10-03 10:03:30 +00:00
|
|
|
DisablePGXPColorCorrection,
|
2022-07-11 13:03:29 +00:00
|
|
|
DisablePGXPDepthBuffer,
|
2024-03-23 04:11:27 +00:00
|
|
|
DisablePGXPPreserveProjFP,
|
2022-07-11 13:03:29 +00:00
|
|
|
ForcePGXPVertexCache,
|
|
|
|
ForcePGXPCPUMode,
|
|
|
|
ForceRecompilerMemoryExceptions,
|
|
|
|
ForceRecompilerICache,
|
|
|
|
ForceRecompilerLUTFastmem,
|
2023-08-19 12:00:20 +00:00
|
|
|
IsLibCryptProtected,
|
2022-07-11 13:03:29 +00:00
|
|
|
|
|
|
|
Count
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Entry
|
|
|
|
{
|
|
|
|
// TODO: Make string_view.
|
|
|
|
std::string serial;
|
|
|
|
std::string title;
|
|
|
|
std::string genre;
|
|
|
|
std::string developer;
|
|
|
|
std::string publisher;
|
|
|
|
u64 release_date;
|
|
|
|
u8 min_players;
|
|
|
|
u8 max_players;
|
|
|
|
u8 min_blocks;
|
|
|
|
u8 max_blocks;
|
2023-08-23 07:32:12 +00:00
|
|
|
u16 supported_controllers;
|
2022-07-11 13:03:29 +00:00
|
|
|
CompatibilityRating compatibility;
|
|
|
|
|
|
|
|
std::bitset<static_cast<int>(Trait::Count)> traits{};
|
|
|
|
std::optional<s16> display_active_start_offset;
|
|
|
|
std::optional<s16> display_active_end_offset;
|
|
|
|
std::optional<s8> display_line_start_offset;
|
|
|
|
std::optional<s8> display_line_end_offset;
|
|
|
|
std::optional<u32> dma_max_slice_ticks;
|
|
|
|
std::optional<u32> dma_halt_ticks;
|
|
|
|
std::optional<u32> gpu_fifo_size;
|
|
|
|
std::optional<u32> gpu_max_run_ahead;
|
|
|
|
std::optional<float> gpu_pgxp_tolerance;
|
|
|
|
std::optional<float> gpu_pgxp_depth_threshold;
|
2024-03-02 05:50:46 +00:00
|
|
|
std::optional<GPULineDetectMode> gpu_line_detect_mode;
|
2022-07-11 13:03:29 +00:00
|
|
|
|
2023-08-23 07:32:12 +00:00
|
|
|
std::string disc_set_name;
|
|
|
|
std::vector<std::string> disc_set_serials;
|
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
ALWAYS_INLINE bool HasTrait(Trait trait) const { return traits[static_cast<int>(trait)]; }
|
|
|
|
|
|
|
|
void ApplySettings(Settings& settings, bool display_osd_messages) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
void EnsureLoaded();
|
|
|
|
void Unload();
|
|
|
|
|
|
|
|
const Entry* GetEntryForDisc(CDImage* image);
|
2023-11-29 13:05:27 +00:00
|
|
|
const Entry* GetEntryForGameDetails(const std::string& id, u64 hash);
|
2022-07-11 13:03:29 +00:00
|
|
|
const Entry* GetEntryForSerial(const std::string_view& serial);
|
|
|
|
std::string GetSerialForDisc(CDImage* image);
|
|
|
|
std::string GetSerialForPath(const char* path);
|
|
|
|
|
|
|
|
const char* GetCompatibilityRatingName(CompatibilityRating rating);
|
|
|
|
const char* GetCompatibilityRatingDisplayName(CompatibilityRating rating);
|
|
|
|
|
|
|
|
/// Map of track hashes for image verification
|
|
|
|
struct TrackData
|
|
|
|
{
|
2024-02-03 16:36:25 +00:00
|
|
|
TrackData(std::string serial_, std::string revision_str_, uint32_t revision_)
|
|
|
|
: serial(std::move(serial_)), revision_str(std::move(revision_str_)), revision(revision_)
|
2022-07-11 13:03:29 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
friend bool operator==(const TrackData& left, const TrackData& right)
|
|
|
|
{
|
|
|
|
// 'revisionString' is deliberately ignored in comparisons as it's redundant with comparing 'revision'! Do not
|
|
|
|
// change!
|
2024-02-03 16:36:25 +00:00
|
|
|
return left.serial == right.serial && left.revision == right.revision;
|
2022-07-11 13:03:29 +00:00
|
|
|
}
|
|
|
|
|
2024-02-03 16:36:25 +00:00
|
|
|
std::string serial;
|
|
|
|
std::string revision_str;
|
|
|
|
u32 revision;
|
2022-07-11 13:03:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
using TrackHashesMap = std::multimap<CDImageHasher::Hash, TrackData>;
|
|
|
|
const TrackHashesMap& GetTrackHashesMap();
|
|
|
|
void EnsureTrackHashesMapLoaded();
|
|
|
|
|
|
|
|
} // namespace GameDatabase
|