hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
11.19k stars 2.17k forks source link

Debug idea/feature: FIFO player like Dolphin? #4784

Closed thedax closed 7 years ago

thedax commented 10 years ago

Not sure how feasible this is for a PSP emulator, but I've noticed that Dolphin has a FIFO player, which seems to allow the emulator to dump almost everything that's going on, graphics wise, into a file, and can then play it back on another computer, even if the developer or person using the file doesn't have the game.

Could such a feature be useful for PPSSPP?

Note that I'm not volunteering to write it, that's way beyond me. It's merely an idea.

hrydgard commented 10 years ago

Feasible but complicated.

For Dolphin's fifo recorder there's even a homebrew Wii app that can play back the stream on a real machine to compare against, which is pretty cool.

thedax commented 10 years ago

Oh yeah, I seem to remember hearing about that. Would a FIFO player be useful for PPSSPP, though?

hrydgard commented 10 years ago

On occasion yes, but it's a huge job to implement it, I'm not gonna do it anytime soon.

unknownbrackets commented 10 years ago

Thanks for volunteering to write it, @thedax. I think it could help with Blade Dancer for example, and also games with depth/etc. issues where we don't know if it's a math or etc. problem or what. Could help reduce to testcases too.

But yeah, seems pretty non-trivial...

-[Unknown]

unknownbrackets commented 7 years ago

An initial stab: https://github.com/hrydgard/ppsspp/compare/master...unknownbrackets:ge-record?expand=1

Technically, it might be best to push the initial VRAM as an INIT command, in case it affects rendering. But this won't capture pokes anyway. Hmm...

Have not tried to write any replay yet, so it may not work at all, possibly...

-[Unknown]

hrydgard commented 7 years ago

That will be great, would be cool to run our own instance of Dolphin's FifoCI for testing graphics. Well, technically maybe should push all of RAM, but mostly should be able to get away with all the memory that's actually referenced (texture, vertex and CLUT data).

I'll take a closer look at your code later.

unknownbrackets commented 7 years ago

It kinda works now (branch updated), but some things draw wrong. The way it's allocating is definitely not optimal, and most vertices, indices, and textures are at the same address, so it may be a caching issue....

Edit: Just as wrong in software, so can't be caching. Must still be reading something wrong...

Some scenes render fine though, so it's progress...

PS: You have to add something like this to test it (haven't added a proper button yet, so many already...)

diff --git a/Windows/GEDebugger/GEDebugger.cpp b/Windows/GEDebugger/GEDebugger.cpp
--- a/Windows/GEDebugger/GEDebugger.cpp
+++ b/Windows/GEDebugger/GEDebugger.cpp
@@ -36,6 +36,7 @@
 #include "GPU/Common/GPUStateUtils.h"
 #include "GPU/GPUState.h"
 #include "GPU/Debugger/Breakpoints.h"
+#include "GPU/Debugger/Record.h"
 #include "GPU/Debugger/Stepping.h"
 #include "Core/Config.h"
 #include <windowsx.h>
@@ -817,6 +818,8 @@ void WindowsHost::GPUNotifyDisplay(u32 framebuf, u32 stride,
 void WindowsHost::GPUNotifyDraw() {
   if (breakNext == BREAK_NEXT_DRAW) {
     PauseWithMessage(WM_GEDBG_BREAK_DRAW);
+    // TODO
+    GPURecord::Activate();
   }
 }

-[Unknown]

unknownbrackets commented 7 years ago

Okay, it works now, I think. A bit messy...

-[Unknown]