diff --git a/Source/Core/Core/DolphinAnalytics.cpp b/Source/Core/Core/DolphinAnalytics.cpp index 8e699213f6..07e541af2b 100644 --- a/Source/Core/Core/DolphinAnalytics.cpp +++ b/Source/Core/Core/DolphinAnalytics.cpp @@ -133,7 +133,7 @@ void DolphinAnalytics::ReportGameStart() } // Keep in sync with enum class GameQuirk definition. -constexpr std::array GAME_QUIRKS_NAMES{ +constexpr std::array GAME_QUIRKS_NAMES{ "icache-matters", "directly-reads-wiimote-input", "uses-DVDLowStopLaser", @@ -152,6 +152,7 @@ constexpr std::array GAME_QUIRKS_NAMES{ "uses-unknown-cp-command", "uses-unknown-xf-command", "uses-maybe-invalid-cp-command", + "uses-cp-perf-command", }; static_assert(GAME_QUIRKS_NAMES.size() == static_cast(GameQuirk::COUNT), "Game quirks names and enum definition are out of sync."); diff --git a/Source/Core/Core/DolphinAnalytics.h b/Source/Core/Core/DolphinAnalytics.h index b5abb57b8f..711117ea09 100644 --- a/Source/Core/Core/DolphinAnalytics.h +++ b/Source/Core/Core/DolphinAnalytics.h @@ -69,6 +69,9 @@ enum class GameQuirk USES_UNKNOWN_XF_COMMAND, // YAGCD and Dolphin's implementation disagree about what is valid in some cases USES_MAYBE_INVALID_CP_COMMAND, + // These commands are used by a few games (e.g. bug 12461), and seem to relate to perf queries. + // Track them separately. + USES_CP_PERF_COMMAND, COUNT, }; diff --git a/Source/Core/VideoCommon/CPMemory.h b/Source/Core/VideoCommon/CPMemory.h index 2ede79578b..f54445940f 100644 --- a/Source/Core/VideoCommon/CPMemory.h +++ b/Source/Core/VideoCommon/CPMemory.h @@ -20,6 +20,13 @@ enum // TODO: However, Dolphin's implementation (in LoadCPReg) and YAGCD disagree about what values are // valid for the lower nybble. + // YAGCD mentions 0x20 as "?", and does not mention the others + // Libogc has 0x00 and 0x20, where 0x00 is tied to GX_ClearVCacheMetric and 0x20 related to + // cpPerfMode. 0x10 may be GX_SetVCacheMetric, but that function is empty. In any case, these all + // are probably for perf queries, and no title seems to actually need a full implementation. + UNKNOWN_00 = 0x00, + UNKNOWN_10 = 0x10, + UNKNOWN_20 = 0x20, // YAGCD says 0x30 only; LoadCPReg allows any MATINDEX_A = 0x30, // YAGCD says 0x40 only; LoadCPReg allows any diff --git a/Source/Core/VideoCommon/VertexLoaderManager.cpp b/Source/Core/VideoCommon/VertexLoaderManager.cpp index 33e340cfd3..94a331a0d2 100644 --- a/Source/Core/VideoCommon/VertexLoaderManager.cpp +++ b/Source/Core/VideoCommon/VertexLoaderManager.cpp @@ -323,6 +323,18 @@ void LoadCPReg(u32 sub_cmd, u32 value, bool is_preprocess) CPState* state = is_preprocess ? &g_preprocess_cp_state : &g_main_cp_state; switch (sub_cmd & CP_COMMAND_MASK) { + case UNKNOWN_00: + case UNKNOWN_10: + case UNKNOWN_20: + if (!(sub_cmd == UNKNOWN_20 && value == 0)) + { + // All titles using libogc or the official SDK issue 0x20 with value=0 on startup + DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::USES_CP_PERF_COMMAND); + DEBUG_LOG_FMT(VIDEO, "Unknown CP command possibly relating to perf queries used: {:02x}", + sub_cmd); + } + break; + case MATINDEX_A: if (sub_cmd != MATINDEX_A) {