diff --git a/Common/Net/HTTPHeaders.cpp b/Common/Net/HTTPHeaders.cpp index 16dc16c8e7..18450030eb 100644 --- a/Common/Net/HTTPHeaders.cpp +++ b/Common/Net/HTTPHeaders.cpp @@ -154,7 +154,7 @@ void RequestHeader::ParseHeaders(net::InputSink *sink) { } VERBOSE_LOG(IO, "finished parsing request."); - ok = line_count > 1; + ok = line_count > 1 && resource != nullptr; } } // namespace http diff --git a/GPU/Debugger/Playback.cpp b/GPU/Debugger/Playback.cpp index a05bac1624..8fa93e7d7c 100644 --- a/GPU/Debugger/Playback.cpp +++ b/GPU/Debugger/Playback.cpp @@ -282,8 +282,8 @@ int BufMapping::slabGeneration_ = 0; class DumpExecute { public: - DumpExecute(const std::vector &pushbuf, const std::vector &commands) - : pushbuf_(pushbuf), commands_(commands), mapping_(pushbuf) { + DumpExecute(const std::vector &pushbuf, const std::vector &commands, uint32_t version) + : pushbuf_(pushbuf), commands_(commands), mapping_(pushbuf), version_(version) { } ~DumpExecute(); @@ -320,6 +320,7 @@ private: const std::vector &pushbuf_; const std::vector &commands_; BufMapping mapping_; + uint32_t version_ = 0; }; void DumpExecute::SyncStall() { @@ -564,7 +565,7 @@ void DumpExecute::Framebuf(int level, u32 ptr, u32 sz) { u32 headerSize = (u32)sizeof(FramebufData); u32 pspSize = sz - headerSize; const bool isTarget = (framebuf->flags & 1) != 0; - const bool unchangedVRAM = (framebuf->flags & 2) != 0; + const bool unchangedVRAM = version_ >= 6 && (framebuf->flags & 2) != 0; // TODO: Could use drawnVRAM flag, but it can be wrong. // Could potentially always skip if !isTarget, but playing it safe for offset texture behavior. if (Memory::IsValidRange(framebuf->addr, pspSize) && !unchangedVRAM && (!isTarget || !g_Config.bSoftwareRendering)) { @@ -708,11 +709,14 @@ bool RunMountedReplay(const std::string &filename) { std::lock_guard guard(executeLock); Core_ListenStopRequest(&ReplayStop); + + uint32_t version = 0; if (lastExecFilename != filename) { PROFILE_THIS_SCOPE("ReplayLoad"); u32 fp = pspFileSystem.OpenFile(filename, FILEACCESS_READ); Header header; pspFileSystem.ReadFile(fp, (u8 *)&header, sizeof(header)); + version = header.version; if (memcmp(header.magic, HEADER_MAGIC, sizeof(header.magic)) != 0 || header.version > VERSION || header.version < MIN_VERSION) { ERROR_LOG(SYSTEM, "Invalid GE dump or unsupported version"); @@ -751,7 +755,7 @@ bool RunMountedReplay(const std::string &filename) { lastExecFilename = filename; } - DumpExecute executor(lastExecPushbuf, lastExecCommands); + DumpExecute executor(lastExecPushbuf, lastExecCommands, version); return executor.Run(); } diff --git a/GPU/Debugger/Record.cpp b/GPU/Debugger/Record.cpp index 1d39f6a214..100e0dd3c4 100644 --- a/GPU/Debugger/Record.cpp +++ b/GPU/Debugger/Record.cpp @@ -108,7 +108,7 @@ static void DirtyAllVRAM(DirtyVRAMFlag flag) { static void DirtyVRAM(u32 start, u32 sz, DirtyVRAMFlag flag) { u32 count = (sz + DIRTY_VRAM_ROUND) >> DIRTY_VRAM_SHIFT; - u32 first = (start >> 10) & DIRTY_VRAM_MASK; + u32 first = (start >> DIRTY_VRAM_SHIFT) & DIRTY_VRAM_MASK; if (first + count > DIRTY_VRAM_SIZE) { DirtyAllVRAM(flag); return; @@ -329,10 +329,15 @@ static void EmitTextureData(int level, u32 texaddr) { bool isDirtyVRAM = false; bool isDrawnVRAM = false; + uint32_t start = (texaddr >> DIRTY_VRAM_SHIFT) & DIRTY_VRAM_MASK; for (uint32_t i = 0; i < (sizeInRAM + DIRTY_VRAM_ROUND) >> DIRTY_VRAM_SHIFT; ++i) { - DirtyVRAMFlag flag = dirtyVRAM[(texaddr >> DIRTY_VRAM_SHIFT) + i]; + DirtyVRAMFlag flag = dirtyVRAM[start + i]; isDirtyVRAM = isDirtyVRAM || flag != DirtyVRAMFlag::CLEAN; isDrawnVRAM = isDrawnVRAM || flag == DirtyVRAMFlag::DRAWN; + + // Mark the VRAM clean now that it's been copied to VRAM. + if (flag == DirtyVRAMFlag::DIRTY) + dirtyVRAM[start + i] = DirtyVRAMFlag::CLEAN; } // The isTarget flag is mostly used for replay of dumps on a PSP. diff --git a/GPU/Debugger/RecordFormat.h b/GPU/Debugger/RecordFormat.h index 22395e1594..8079136d0c 100644 --- a/GPU/Debugger/RecordFormat.h +++ b/GPU/Debugger/RecordFormat.h @@ -34,7 +34,8 @@ static const char *HEADER_MAGIC = "PPSSPPGE"; // Version 3: Adds FRAMEBUF0-FRAMEBUF9 // Version 4: Expanded header with game ID // Version 5: Uses zstd -static const int VERSION = 5; +// Version 6: Corrects dirty VRAM flag +static const int VERSION = 6; static const int MIN_VERSION = 2; enum class CommandType : u8 {