Files
ARMSX2/pcsx2/GameDatabase.h
T
Brian Degenhardt 3e077eff9b Merge yaps2: arm64 JIT transplant + test/perf/libretro infrastructure
Merges yaps2/main (github.com/yaps2/yaps2, c16b88cb7) into ARMSX2,
replacing the arm64 recompiler family with the yaps2 JITs and importing
the yaps2 testing, perf, and libretro infrastructure. Common ancestor is
upstream PCSX2 342db5152 (2026-06-19); git auto-merged all but 38 files.

Replaced (deleted in this merge, recoverable from history):
- arm64/aR5900*, aR3000A*, aVU* -> arm64/iR5900*/iR3000A*/microVU*-arm64:
  EE static-pin register file with lazy dirty tracking, dual-residence
  allocator, IOP block linking, native COP2 macro ops, inline unaligned
  fastmem, persisted VU program cache, call-ret shadow ring, VU0 spin
  fast-forward.
- MVU_DIFF shadow-run hooks in shared VU interpreter TUs (superseded by
  the offline vurunner JIT-vs-interp oracle).

Imported from yaps2:
- tests/ctest/core/recompilers: ~80 gtest suites (EE/IOP/VU differential
  harnesses, fuzzers, ABI digest tripwire, capture format pins) plus the
  gs_vertex_tests kernel oracle.
- pcsx2-vurunner / pcsx2-eerunner headless capture-replay runners.
- tools/perf counter-based A/B rigs, perf jitdump productionization,
  PmuCounters, clang-perf/clang-handheld presets.
- pcsx2-libretro core (ENABLE_LIBRETRO, default OFF; rename pending).
- GS vertex-kick fast path (GV series): TBL-based packed parse,
  register-resident kick, scalar-outcode cull, fused draw-rect/FindMinMax.
- Null renderer, VK_KHR_display direct WSI, swapchain PresentStats.
- SPU2 NEON mixer vectorization, EE timer read clamp (NFL 2K5 hang),
  IOP ioman signed-compare fix, assorted UB fixes.

Kept from ARMSX2 in the both-touched files:
- iOS dual-map W^X and fastmem-unavailable resilience (Memory, HostSys,
  vtlb). The split data/code area model is retained; both areas now take
  fixed VA hints so cached VU JIT code stays deterministic on Linux.
- Android thread-affinity model, VMState shutdown early-outs, all
  platform frontends, branding, CI, RetroAchievements identity/policy.
- GSDeviceVK: ARMSX2's push-descriptor decision logic (Mali crash gate,
  proprietary-vs-turnip Adreno split) merged with yaps2's descriptor-pool
  exhaustion recovery (flush + render-pass restart instead of dropped
  binds). Vendor feature policy is the union: Mali fbfetch policy with
  MediaTek/G57/Xclipse gates from ARMSX2; Adreno stencil/ROV/
  test-and-sample-depth hang avoidance and no_ps2_z_quantization from
  yaps2.

Build-system notes:
- The Qt debugger is now gated behind ENABLE_QT_DEBUGGER (default off on
  arm64) so handheld builds drop the KDDockWidgets dependency.
- GSDeviceNone and remaining yaps2 GS code were ported to the newer
  upstream GSTexture Usage-flags API.

The replaced backend's interpreter-fallback glue (intExecuteOneInst,
AndroidEEOpHist) and the EEDiffVerify runtime differ are retained for
now; dead pieces will be removed in a follow-up commit.
2026-07-19 10:24:29 -07:00

169 lines
3.9 KiB
C++

// SPDX-FileCopyrightText: 2002-2026 PCSX2 Dev Team
// SPDX-License-Identifier: GPL-3.0+
#pragma once
#include "Config.h"
#include "Patch.h"
#include "common/FPControl.h"
#include <cstring>
#include <optional>
#include <string>
#include <string_view>
#include <unordered_map>
#include <utility>
#include <vector>
enum GamefixId;
namespace GameDatabaseSchema
{
enum class Compatibility
{
Unknown = 0,
Nothing,
Intro,
Menu,
InGame,
Playable,
Perfect
};
enum class ClampMode
{
Undefined = -1,
Disabled = 0,
Normal,
Extra,
Full,
Count
};
enum class GSHWFixId : u32
{
// boolean settings
AutoFlush,
CPUFramebufferConversion,
FlushTCOnClose,
DisableDepthSupport,
PreloadFrameData,
DisablePartialInvalidation,
TextureInsideRT,
Limit24BitDepth,
AlignSprite,
MergeSprite,
Mipmap,
AccurateAlphaTest,
ForceEvenSpritePosition,
BilinearUpscale,
NativePaletteDraw,
EstimateTextureRegion,
DrawBuffering,
PCRTCOffsets,
PCRTCOverscan,
// integer settings
TrilinearFiltering,
SkipDrawStart,
SkipDrawEnd,
HalfPixelOffset,
RoundSprite,
NativeScaling,
TexturePreloading,
Deinterlace,
CPUSpriteRenderBW,
CPUSpriteRenderLevel,
CPUCLUTRender,
GPUTargetCLUT,
GPUPaletteConversion,
MinimumBlendingLevel,
MaximumBlendingLevel,
RecommendedBlendingLevel,
RecommendedAccurateAlphaTest,
RecommendedHWAA1,
GetSkipCount,
BeforeDraw,
MoveHandler,
Count
};
struct GameEntry
{
std::string name;
std::string name_sort;
std::string name_en;
std::string region;
Compatibility compat = Compatibility::Unknown;
FPRoundMode eeRoundMode = FPRoundMode::MaxCount;
FPRoundMode eeDivRoundMode = FPRoundMode::MaxCount;
FPRoundMode vu0RoundMode = FPRoundMode::MaxCount;
FPRoundMode vu1RoundMode = FPRoundMode::MaxCount;
ClampMode eeClampMode = ClampMode::Undefined;
ClampMode vu0ClampMode = ClampMode::Undefined;
ClampMode vu1ClampMode = ClampMode::Undefined;
std::optional<bool> guardedAddSub; // EE FPU add/sub guard-bit emulation override (unset = leave global default).
std::vector<GamefixId> gameFixes;
std::vector<std::pair<SpeedHack, int>> speedHacks;
std::vector<std::pair<GSHWFixId, s32>> gsHWFixes;
std::vector<std::string> memcardFilters;
std::unordered_map<u32, std::string> patches;
std::vector<Patch::DynamicPatch> dynaPatches;
// Returns the list of memory card serials as a `/` delimited string
std::string memcardFiltersAsString() const;
const std::string* findPatch(u32 crc) const;
const char* compatAsString() const;
/// Applies Core game fixes to an existing config.
void applyGameFixes(Pcsx2Config& config, bool applyAuto) const;
/// Applies GS hardware fixes to an existing config.
void applyGSHardwareFixes(Pcsx2Config::GSOptions& config) const;
/// Returns true if the current config value for the specified hw fix id matches the value.
static bool configMatchesHWFix(const Pcsx2Config::GSOptions& config, GSHWFixId id, int value);
};
}; // namespace GameDatabaseSchema
namespace GameDatabase
{
void ensureLoaded();
const GameDatabaseSchema::GameEntry* findGame(const std::string_view serial);
struct TrackHash
{
static constexpr u32 SIZE = 16;
bool parseHash(const std::string_view str);
std::string toString() const;
#define MAKE_OPERATOR(op) \
bool operator op(const TrackHash& hash) const { return (std::memcmp(data, hash.data, sizeof(data)) op 0); }
MAKE_OPERATOR(==);
MAKE_OPERATOR(!=);
MAKE_OPERATOR(<);
MAKE_OPERATOR(<=);
MAKE_OPERATOR(>);
MAKE_OPERATOR(>=);
#undef MAKE_OPERATOR
u8 data[SIZE];
u64 size;
};
struct HashDatabaseEntry
{
std::string serial;
std::string name;
std::string version;
std::vector<TrackHash> tracks;
};
bool loadHashDatabase();
void unloadHashDatabase();
const HashDatabaseEntry* lookupHash(const TrackHash* tracks, size_t num_tracks, bool* tracks_matched, std::string* match_error);
}; // namespace GameDatabase