mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-06 09:39:55 +00:00
rsx-capture: Save initial method registers state
This commit is contained in:
parent
5b0ed1e2eb
commit
f056ef7a80
@ -230,10 +230,15 @@ namespace rsx
|
|||||||
|
|
||||||
while (!Emu.IsStopped())
|
while (!Emu.IsStopped())
|
||||||
{
|
{
|
||||||
|
// Load registers while the RSX is still idle
|
||||||
|
method_registers = frame->reg_state;
|
||||||
|
_mm_mfence();
|
||||||
|
|
||||||
// start up fifo buffer by dumping the put ptr to first stop
|
// start up fifo buffer by dumping the put ptr to first stop
|
||||||
sys_rsx_context_attribute(context_id, 0x001, 0x20000000, fifo_stops[0], 0, 0);
|
sys_rsx_context_attribute(context_id, 0x001, 0x20000000, fifo_stops[0], 0, 0);
|
||||||
|
|
||||||
auto renderer = rsx::get_current_renderer();
|
auto render = get_current_renderer();
|
||||||
|
|
||||||
size_t stopIdx = 0;
|
size_t stopIdx = 0;
|
||||||
for (const auto& replay_cmd : frame->replay_commands)
|
for (const auto& replay_cmd : frame->replay_commands)
|
||||||
{
|
{
|
||||||
@ -248,7 +253,7 @@ namespace rsx
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// wait until rsx idle and at our first 'stop' to apply state
|
// wait until rsx idle and at our first 'stop' to apply state
|
||||||
while (!Emu.IsStopped() && (renderer->ctrl->get != renderer->ctrl->put) && (renderer->ctrl->get != fifo_stops[stopIdx]))
|
while (!Emu.IsStopped() && (render->ctrl->get != render->ctrl->put) && (render->ctrl->get != fifo_stops[stopIdx]))
|
||||||
{
|
{
|
||||||
while (Emu.IsPaused())
|
while (Emu.IsPaused())
|
||||||
std::this_thread::sleep_for(10ms);
|
std::this_thread::sleep_for(10ms);
|
||||||
@ -263,14 +268,14 @@ namespace rsx
|
|||||||
if (stopIdx >= fifo_stops.size())
|
if (stopIdx >= fifo_stops.size())
|
||||||
fmt::throw_exception("Capture Replay: StopIdx greater than size of fifo_stops");
|
fmt::throw_exception("Capture Replay: StopIdx greater than size of fifo_stops");
|
||||||
|
|
||||||
renderer->ctrl->put = fifo_stops[stopIdx];
|
render->ctrl->put = fifo_stops[stopIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
// dump put to end of stops, which should have actual end
|
// dump put to end of stops, which should have actual end
|
||||||
u32 end = fifo_stops.back();
|
u32 end = fifo_stops.back();
|
||||||
renderer->ctrl->put = end;
|
render->ctrl->put = end;
|
||||||
|
|
||||||
while (renderer->ctrl->get != end && !Emu.IsStopped())
|
while (render->ctrl->get != end && !Emu.IsStopped())
|
||||||
{
|
{
|
||||||
while (Emu.IsPaused())
|
while (Emu.IsPaused())
|
||||||
std::this_thread::sleep_for(10ms);
|
std::this_thread::sleep_for(10ms);
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "Emu/Cell/PPUModule.h"
|
#include "Emu/Cell/PPUModule.h"
|
||||||
#include "Emu/Cell/lv2/sys_sync.h"
|
#include "Emu/Cell/lv2/sys_sync.h"
|
||||||
#include "Emu/Cell/lv2/sys_ppu_thread.h"
|
#include "Emu/Cell/lv2/sys_ppu_thread.h"
|
||||||
|
#include "Emu/RSX/rsx_methods.h"
|
||||||
#include "Emu/RSX/gcm_enums.h"
|
#include "Emu/RSX/gcm_enums.h"
|
||||||
|
|
||||||
#include <cereal/types/vector.hpp>
|
#include <cereal/types/vector.hpp>
|
||||||
@ -16,7 +17,7 @@
|
|||||||
namespace rsx
|
namespace rsx
|
||||||
{
|
{
|
||||||
constexpr u32 FRAME_CAPTURE_MAGIC = 0x52524300; // ascii 'RRC/0'
|
constexpr u32 FRAME_CAPTURE_MAGIC = 0x52524300; // ascii 'RRC/0'
|
||||||
constexpr u32 FRAME_CAPTURE_VERSION = 0x2;
|
constexpr u32 FRAME_CAPTURE_VERSION = 0x3;
|
||||||
struct frame_capture_data
|
struct frame_capture_data
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -181,6 +182,8 @@ namespace rsx
|
|||||||
std::unordered_map<u64, display_buffers_state> display_buffers_map;
|
std::unordered_map<u64, display_buffers_state> display_buffers_map;
|
||||||
// actual command queue to hold everything above
|
// actual command queue to hold everything above
|
||||||
std::vector<replay_command> replay_commands;
|
std::vector<replay_command> replay_commands;
|
||||||
|
// Initial registers state at the beginning of the capture
|
||||||
|
rsx::rsx_state reg_state;
|
||||||
|
|
||||||
template<typename Archive>
|
template<typename Archive>
|
||||||
void serialize(Archive & ar)
|
void serialize(Archive & ar)
|
||||||
@ -192,6 +195,7 @@ namespace rsx
|
|||||||
ar(memory_data_map);
|
ar(memory_data_map);
|
||||||
ar(display_buffers_map);
|
ar(display_buffers_map);
|
||||||
ar(replay_commands);
|
ar(replay_commands);
|
||||||
|
ar(reg_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset()
|
void reset()
|
||||||
@ -201,6 +205,7 @@ namespace rsx
|
|||||||
tile_map.clear();
|
tile_map.clear();
|
||||||
memory_map.clear();
|
memory_map.clear();
|
||||||
replay_commands.clear();
|
replay_commands.clear();
|
||||||
|
reg_state = method_registers;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user