feat: default capture history gs to false (#167)

fix: remove wrong logic on frameupload
fix: fix option to enable and disable logs
This commit is contained in:
Ranieri
2026-07-08 22:09:23 -03:00
committed by GitHub
parent ecc86f4b5d
commit cf4a90c4ab
7 changed files with 45 additions and 44 deletions
+1
View File
@@ -373,6 +373,7 @@ endif()
if(PS2X_ENABLE_AGRESSIVE_LOGS)
target_compile_definitions(ps2_runtime PUBLIC
AGRESSIVE_LOGS=1
PS2_FUNCTION_LOG_TRACKER=1
)
endif()
+6 -14
View File
@@ -12,13 +12,11 @@
#include <vector>
#ifndef PS2_RUNTIME_LOGS
#define PS2_RUNTIME_LOGS 1
#define PS2_RUNTIME_LOGS 0
#endif
#if defined(AGRESSIVE_LOGS)
#define PS2_AGRESSIVE_LOGS_ENABLED 1
#else
#define PS2_AGRESSIVE_LOGS_ENABLED 0
#ifndef AGRESSIVE_LOGS
#define AGRESSIVE_LOGS 0
#endif
namespace ps2_log
@@ -106,7 +104,7 @@ inline void clear_runtime_log_entries()
}
}
#if defined(PS2_RUNTIME_LOGS) || defined(AGRESSIVE_LOGS)
#if PS2_RUNTIME_LOGS || AGRESSIVE_LOGS
#define RUNTIME_LOG(x) \
do \
{ \
@@ -127,12 +125,10 @@ inline void clear_runtime_log_entries()
#define RUNTIME_LOG(x) do {} while(0)
#endif
#ifdef AGRESSIVE_LOGS
#if AGRESSIVE_LOGS
namespace ps2_log
{
inline constexpr bool agressive_logs_enabled = PS2_AGRESSIVE_LOGS_ENABLED != 0;
inline std::string log_path()
{
static std::string path;
@@ -181,17 +177,13 @@ inline void print_saved_location()
#define PS2_IF_AGRESSIVE_LOGS(code) \
do \
{ \
if constexpr (ps2_log::agressive_logs_enabled) \
{ \
code; \
} \
code; \
} while (0)
#else
namespace ps2_log
{
inline constexpr bool agressive_logs_enabled = false;
inline std::string log_path()
{
return (std::filesystem::current_path() / "ps2_log.txt").string();
+1 -2
View File
@@ -344,7 +344,6 @@ public:
void setDebugHistoryPaused(bool paused);
bool getPreferredDisplaySource(GSFrameReg &outSource, uint32_t &outDestFbp) const;
void latchHostPresentationFrame();
bool tryLatchHostPresentationFrame();
bool copyLatchedHostPresentationFrame(std::vector<uint8_t> &outPixels,
uint32_t &outWidth,
uint32_t &outHeight,
@@ -456,7 +455,7 @@ private:
uint64_t m_debugNextSeq = 1;
uint32_t m_debugFrameIndex = 0;
uint64_t m_debugLastVsyncTick = UINT64_MAX;
bool m_debugHistoryPaused = false;
bool m_debugHistoryPaused = true;
GSRasterizer m_rasterizer;
+5 -1
View File
@@ -41,7 +41,11 @@ namespace ps2_stubs
{
static std::once_flag s_once;
std::call_once(s_once, [] {
av_log_set_level(ps2_log::agressive_logs_enabled ? AV_LOG_WARNING : AV_LOG_ERROR);
#if AGRESSIVE_LOGS
av_log_set_level(AV_LOG_WARNING);
#else
av_log_set_level(AV_LOG_ERROR);
#endif
});
}
@@ -857,11 +857,9 @@ namespace ps2_syscalls
const FindAddressMatchSample *matches,
uint32_t matchCount)
{
if constexpr (!ps2_log::agressive_logs_enabled)
{
return;
}
#if !AGRESSIVE_LOGS
return;
#else
static std::atomic<uint32_t> s_findAddressHitLogs{0u};
static std::atomic<uint32_t> s_findAddressMissLogs{0u};
constexpr uint32_t kMaxFindAddressHitLogs = 16u;
@@ -942,6 +940,7 @@ namespace ps2_syscalls
std::cerr << std::dec;
}
std::cerr << std::endl;
#endif
}
// 0x83 FindAddress:
+25 -12
View File
@@ -642,6 +642,11 @@ void GS::recordDebugEventUnlocked(GSDebugHistoryEntry entry)
void GS::recordGifTagDebugEventUnlocked(uint32_t sizeBytes, uint32_t nloop, uint8_t flg, uint32_t nreg)
{
if (m_debugHistoryPaused)
{
return;
}
GSDebugHistoryEntry entry = makeDebugEventUnlocked(GSDebugEventKind::GifTag);
entry.gifSizeBytes = sizeBytes;
entry.gifNloop = nloop;
@@ -652,6 +657,11 @@ void GS::recordGifTagDebugEventUnlocked(uint32_t sizeBytes, uint32_t nloop, uint
void GS::recordRegisterDebugEventUnlocked(uint8_t regAddr, uint64_t value)
{
if (m_debugHistoryPaused)
{
return;
}
switch (regAddr)
{
case GS_REG_PRIM:
@@ -690,6 +700,11 @@ void GS::recordRegisterDebugEventUnlocked(uint8_t regAddr, uint64_t value)
void GS::recordDrawDebugEventUnlocked(int vertexCount)
{
if (m_debugHistoryPaused)
{
return;
}
if (vertexCount <= 0)
{
return;
@@ -722,6 +737,11 @@ void GS::recordDrawDebugEventUnlocked(int vertexCount)
void GS::recordTransferDebugEventUnlocked()
{
if (m_debugHistoryPaused)
{
return;
}
GSDebugHistoryEntry entry = makeDebugEventUnlocked(GSDebugEventKind::Transfer);
entry.transferPixels = m_transferState.total_pixels;
recordDebugEventUnlocked(entry);
@@ -729,6 +749,11 @@ void GS::recordTransferDebugEventUnlocked()
void GS::recordPresentDebugEventUnlocked(uint32_t displayFbp, uint32_t sourceFbp, uint32_t width, uint32_t height, bool usedPreferred)
{
if (m_debugHistoryPaused)
{
return;
}
GSDebugHistoryEntry entry = makeDebugEventUnlocked(GSDebugEventKind::Present);
entry.displayFbp = displayFbp;
entry.sourceFbp = sourceFbp;
@@ -918,18 +943,6 @@ void GS::latchHostPresentationFrame()
latchHostPresentationFrameUnlocked();
}
bool GS::tryLatchHostPresentationFrame()
{
if (!m_stateMutex.try_lock())
{
return false;
}
std::lock_guard<std::recursive_mutex> lock(m_stateMutex, std::adopt_lock);
latchHostPresentationFrameUnlocked();
return true;
}
void GS::latchHostPresentationFrameUnlocked()
{
if (!m_privRegs || !m_vram || m_vramSize == 0u)
+3 -10
View File
@@ -371,21 +371,14 @@ static void UploadFrame(Texture2D &tex, PS2Runtime *rt, uint32_t &outWidth, uint
static std::vector<uint8_t> s_uploadBuffer(DEFAULT_FB_SIZE, 0u);
const uint64_t currentTick = ps2_syscalls::GetCurrentVSyncTick();
bool latchedThisCall = false;
if (!s_hasLatchedInitialFrame)
const bool needsLatch = !s_hasLatchedInitialFrame || currentTick != s_lastPresentationTick;
if (needsLatch)
{
rt->gs().latchHostPresentationFrame();
s_lastPresentationTick = currentTick;
s_hasLatchedInitialFrame = true;
latchedThisCall = true;
}
else if (currentTick != s_lastPresentationTick && rt->gs().tryLatchHostPresentationFrame())
{
s_lastPresentationTick = currentTick;
latchedThisCall = true;
}
if (!latchedThisCall && s_hasUploadedFrame)
else if (s_hasUploadedFrame)
{
outWidth = (s_lastWidth != 0u) ? s_lastWidth : FB_WIDTH;
outHeight = (s_lastHeight != 0u) ? s_lastHeight : DEFAULT_DISPLAY_HEIGHT;