mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 06:51:26 +12:00
rsx:🧵 initialize flip_status
Fixed clear_surface (OpenGL) Enabled some RSXDebugger features (disasm and textures/buffers view) Minor improvements
This commit is contained in:
parent
3721941ffb
commit
86720f90cd
7 changed files with 99 additions and 63 deletions
|
@ -567,6 +567,7 @@ extern CellGcmContextData current_context;
|
||||||
void GLGSRender::begin()
|
void GLGSRender::begin()
|
||||||
{
|
{
|
||||||
rsx::thread::begin();
|
rsx::thread::begin();
|
||||||
|
|
||||||
if (!load_program())
|
if (!load_program())
|
||||||
{
|
{
|
||||||
//no program - no drawing
|
//no program - no drawing
|
||||||
|
@ -575,13 +576,11 @@ void GLGSRender::begin()
|
||||||
|
|
||||||
init_buffers();
|
init_buffers();
|
||||||
|
|
||||||
draw_fbo.bind();
|
|
||||||
|
|
||||||
u32 color_mask = rsx::method_registers[NV4097_SET_COLOR_MASK];
|
u32 color_mask = rsx::method_registers[NV4097_SET_COLOR_MASK];
|
||||||
bool color_mask_b = rsx::method_registers[NV4097_SET_COLOR_MASK] & 0xff;
|
bool color_mask_b = color_mask & 0xff;
|
||||||
bool color_mask_g = (rsx::method_registers[NV4097_SET_COLOR_MASK]) >> 8;
|
bool color_mask_g = color_mask >> 8;
|
||||||
bool color_mask_r = (rsx::method_registers[NV4097_SET_COLOR_MASK]) >> 16;
|
bool color_mask_r = color_mask >> 16;
|
||||||
bool color_mask_a = rsx::method_registers[NV4097_SET_COLOR_MASK] >> 24;
|
bool color_mask_a = color_mask >> 24;
|
||||||
|
|
||||||
__glcheck glColorMask(color_mask_r, color_mask_g, color_mask_b, color_mask_a);
|
__glcheck glColorMask(color_mask_r, color_mask_g, color_mask_b, color_mask_a);
|
||||||
__glcheck glDepthMask(rsx::method_registers[NV4097_SET_DEPTH_MASK]);
|
__glcheck glDepthMask(rsx::method_registers[NV4097_SET_DEPTH_MASK]);
|
||||||
|
@ -840,6 +839,8 @@ void GLGSRender::end()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG_NOTICE(Log::RSX, "draw()");
|
||||||
|
|
||||||
draw_fbo.bind();
|
draw_fbo.bind();
|
||||||
m_program.use();
|
m_program.use();
|
||||||
|
|
||||||
|
@ -1090,12 +1091,15 @@ void GLGSRender::onexit_thread()
|
||||||
|
|
||||||
void nv4097_clear_surface(u32 arg, GLGSRender* renderer)
|
void nv4097_clear_surface(u32 arg, GLGSRender* renderer)
|
||||||
{
|
{
|
||||||
|
LOG_NOTICE(Log::RSX, "nv4097_clear_surface(0x%x)", arg);
|
||||||
|
|
||||||
if ((arg & 0xf3) == 0)
|
if ((arg & 0xf3) == 0)
|
||||||
{
|
{
|
||||||
//do nothing
|
//do nothing
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderer->draw_fbo.bind();
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1153,9 +1157,12 @@ void nv4097_clear_surface(u32 arg, GLGSRender* renderer)
|
||||||
mask |= GLenum(gl::buffers::color);
|
mask |= GLenum(gl::buffers::color);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer->init_buffers();
|
renderer->clear_surface_buffers = (gl::buffers)mask;
|
||||||
renderer->draw_fbo.clear(gl::buffers(mask));
|
//renderer->init_buffers();
|
||||||
renderer->write_buffers();
|
//renderer->draw_fbo.draw_buffer(renderer->draw_fbo.color[0]);
|
||||||
|
//renderer->draw_fbo.clear(gl::buffers(mask));
|
||||||
|
//renderer->draw_fbo.draw_arrays(gl::draw_mode::lines, 0);
|
||||||
|
//renderer->write_buffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
using rsx_method_impl_t = void(*)(u32, GLGSRender*);
|
using rsx_method_impl_t = void(*)(u32, GLGSRender*);
|
||||||
|
@ -1444,7 +1451,10 @@ void GLGSRender::init_buffers()
|
||||||
__glcheck m_draw_tex_depth_stencil.pixel_unpack_settings().aligment(1);
|
__glcheck m_draw_tex_depth_stencil.pixel_unpack_settings().aligment(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
read_buffers();
|
if (clear_surface_buffers == gl::buffers::none)
|
||||||
|
{
|
||||||
|
read_buffers();
|
||||||
|
}
|
||||||
|
|
||||||
switch (rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])
|
switch (rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])
|
||||||
{
|
{
|
||||||
|
@ -1474,6 +1484,13 @@ void GLGSRender::init_buffers()
|
||||||
LOG_ERROR(RSX, "Bad surface color target: %d", rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET]);
|
LOG_ERROR(RSX, "Bad surface color target: %d", rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (clear_surface_buffers != gl::buffers::none)
|
||||||
|
{
|
||||||
|
draw_fbo.clear(clear_surface_buffers);
|
||||||
|
|
||||||
|
clear_surface_buffers = gl::buffers::none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const u32 mr_color_offset[rsx::limits::color_buffers_count] =
|
static const u32 mr_color_offset[rsx::limits::color_buffers_count] =
|
||||||
|
@ -1497,6 +1514,8 @@ void GLGSRender::read_buffers()
|
||||||
if (!draw_fbo)
|
if (!draw_fbo)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
glDisable(GL_STENCIL_TEST);
|
||||||
|
|
||||||
if (Ini.GSReadColorBuffers.GetValue())
|
if (Ini.GSReadColorBuffers.GetValue())
|
||||||
{
|
{
|
||||||
auto color_format = surface_color_format_to_gl(m_surface.color_format);
|
auto color_format = surface_color_format_to_gl(m_surface.color_format);
|
||||||
|
@ -1581,6 +1600,9 @@ void GLGSRender::write_buffers()
|
||||||
|
|
||||||
if (Ini.GSDumpColorBuffers.GetValue())
|
if (Ini.GSDumpColorBuffers.GetValue())
|
||||||
{
|
{
|
||||||
|
//gl::buffer pbo_color;
|
||||||
|
//__glcheck pbo_color.create(m_draw_tex_color[0].width() * m_draw_tex_color[0].height() * 4);
|
||||||
|
|
||||||
auto color_format = surface_color_format_to_gl(m_surface.color_format);
|
auto color_format = surface_color_format_to_gl(m_surface.color_format);
|
||||||
|
|
||||||
auto write_color_buffers = [&](int index, int count)
|
auto write_color_buffers = [&](int index, int count)
|
||||||
|
@ -1588,6 +1610,22 @@ void GLGSRender::write_buffers()
|
||||||
for (int i = index; i < index + count; ++i)
|
for (int i = index; i < index + count; ++i)
|
||||||
{
|
{
|
||||||
//TODO: swizzle
|
//TODO: swizzle
|
||||||
|
//__glcheck m_draw_tex_color[i].copy_to(pbo_color, color_format.format, color_format.type);
|
||||||
|
|
||||||
|
//pbo_color.map([&](GLubyte* pixels)
|
||||||
|
//{
|
||||||
|
// u32 color_address = rsx::get_address(rsx::method_registers[mr_color_offset[i]], rsx::method_registers[mr_color_dma[i]]);
|
||||||
|
// //u32 depth_address = rsx::get_address(rsx::method_registers[NV4097_SET_SURFACE_ZETA_OFFSET], rsx::method_registers[NV4097_SET_CONTEXT_DMA_ZETA]);
|
||||||
|
|
||||||
|
// const u32 *src = (const u32*)pixels;
|
||||||
|
// be_t<u32>* dst = vm::get_ptr<be_t<u32>>(color_address);
|
||||||
|
// for (int i = 0, end = m_draw_tex_color[i].width() * m_draw_tex_color[i].height(); i < end; ++i)
|
||||||
|
// {
|
||||||
|
// dst[i] = src[i];
|
||||||
|
// }
|
||||||
|
|
||||||
|
//}, gl::buffer::access::read);
|
||||||
|
|
||||||
u32 color_address = rsx::get_address(rsx::method_registers[mr_color_offset[i]], rsx::method_registers[mr_color_dma[i]]);
|
u32 color_address = rsx::get_address(rsx::method_registers[mr_color_offset[i]], rsx::method_registers[mr_color_dma[i]]);
|
||||||
__glcheck m_draw_tex_color[i].copy_to(vm::get_ptr(color_address), color_format.format, color_format.type);
|
__glcheck m_draw_tex_color[i].copy_to(vm::get_ptr(color_address), color_format.format, color_format.type);
|
||||||
}
|
}
|
||||||
|
@ -1660,6 +1698,7 @@ void GLGSRender::write_buffers()
|
||||||
|
|
||||||
void GLGSRender::flip(int buffer)
|
void GLGSRender::flip(int buffer)
|
||||||
{
|
{
|
||||||
|
LOG_NOTICE(Log::RSX, "flip(%d)", buffer);
|
||||||
u32 buffer_width = gcm_buffers[buffer].width;
|
u32 buffer_width = gcm_buffers[buffer].width;
|
||||||
u32 buffer_height = gcm_buffers[buffer].height;
|
u32 buffer_height = gcm_buffers[buffer].height;
|
||||||
u32 buffer_pitch = gcm_buffers[buffer].pitch;
|
u32 buffer_pitch = gcm_buffers[buffer].pitch;
|
||||||
|
@ -1683,8 +1722,6 @@ void GLGSRender::flip(int buffer)
|
||||||
|
|
||||||
if (!skip_read)
|
if (!skip_read)
|
||||||
{
|
{
|
||||||
gl::screen.clear(gl::buffers::color_depth_stencil);
|
|
||||||
|
|
||||||
if (!m_flip_tex_color || m_flip_tex_color.size() != sizei{ (int)buffer_width, (int)buffer_height })
|
if (!m_flip_tex_color || m_flip_tex_color.size() != sizei{ (int)buffer_width, (int)buffer_height })
|
||||||
{
|
{
|
||||||
m_flip_tex_color.recreate(gl::texture::target::texture2D);
|
m_flip_tex_color.recreate(gl::texture::target::texture2D);
|
||||||
|
@ -1746,6 +1783,8 @@ void GLGSRender::flip(int buffer)
|
||||||
aspect_ratio.size = m_frame->client_size();
|
aspect_ratio.size = m_frame->client_size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gl::screen.clear(gl::buffers::color_depth_stencil);
|
||||||
|
|
||||||
if (!skip_read)
|
if (!skip_read)
|
||||||
{
|
{
|
||||||
__glcheck m_flip_fbo.blit(gl::screen, screen_area, areai(aspect_ratio).flipped_vertical());
|
__glcheck m_flip_fbo.blit(gl::screen, screen_area, areai(aspect_ratio).flipped_vertical());
|
||||||
|
|
|
@ -64,6 +64,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
gl::fbo draw_fbo;
|
gl::fbo draw_fbo;
|
||||||
|
gl::buffers clear_surface_buffers = gl::buffers::none;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GLProgramBuffer m_prog_buffer;
|
GLProgramBuffer m_prog_buffer;
|
||||||
|
|
|
@ -104,6 +104,7 @@ namespace gl
|
||||||
|
|
||||||
enum class buffers
|
enum class buffers
|
||||||
{
|
{
|
||||||
|
none = 0,
|
||||||
color = GL_COLOR_BUFFER_BIT,
|
color = GL_COLOR_BUFFER_BIT,
|
||||||
depth = GL_DEPTH_BUFFER_BIT,
|
depth = GL_DEPTH_BUFFER_BIT,
|
||||||
stencil = GL_STENCIL_BUFFER_BIT,
|
stencil = GL_STENCIL_BUFFER_BIT,
|
||||||
|
|
|
@ -1150,6 +1150,7 @@ namespace rsx
|
||||||
this->ioAddress = ioAddress;
|
this->ioAddress = ioAddress;
|
||||||
this->ioSize = ioSize;
|
this->ioSize = ioSize;
|
||||||
local_mem_addr = localAddress;
|
local_mem_addr = localAddress;
|
||||||
|
flip_status = 0;
|
||||||
|
|
||||||
m_used_gcm_commands.clear();
|
m_used_gcm_commands.clear();
|
||||||
|
|
||||||
|
|
|
@ -438,9 +438,7 @@ void MainFrame::OpenMemoryViewer(wxCommandEvent& WXUNUSED(event))
|
||||||
|
|
||||||
void MainFrame::OpenRSXDebugger(wxCommandEvent& WXUNUSED(event))
|
void MainFrame::OpenRSXDebugger(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
#if _USE_RSX_DEBUGGER
|
|
||||||
(new RSXDebugger(this))->Show();
|
(new RSXDebugger(this))->Show();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainFrame::OpenStringSearch(wxCommandEvent& WXUNUSED(event))
|
void MainFrame::OpenStringSearch(wxCommandEvent& WXUNUSED(event))
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#include "RSXDebugger.h"
|
#include "RSXDebugger.h"
|
||||||
|
|
||||||
#if _USE_RSX_DEBUGGER
|
|
||||||
#include "rpcs3/Ini.h"
|
#include "rpcs3/Ini.h"
|
||||||
#include "Utilities/rPlatform.h"
|
#include "Utilities/rPlatform.h"
|
||||||
#include "Utilities/Log.h"
|
#include "Utilities/Log.h"
|
||||||
|
@ -272,7 +271,7 @@ void RSXDebugger::OnScrollMemory(wxMouseEvent& event)
|
||||||
u32 offset;
|
u32 offset;
|
||||||
if(vm::check_addr(m_addr))
|
if(vm::check_addr(m_addr))
|
||||||
{
|
{
|
||||||
u32 cmd = vm::read32(m_addr);
|
u32 cmd = vm::ps3::read32(m_addr);
|
||||||
u32 count = (cmd & (CELL_GCM_METHOD_FLAG_JUMP | CELL_GCM_METHOD_FLAG_CALL))
|
u32 count = (cmd & (CELL_GCM_METHOD_FLAG_JUMP | CELL_GCM_METHOD_FLAG_CALL))
|
||||||
|| cmd == CELL_GCM_METHOD_FLAG_RETURN ? 0 : (cmd >> 18) & 0x7ff;
|
|| cmd == CELL_GCM_METHOD_FLAG_RETURN ? 0 : (cmd >> 18) & 0x7ff;
|
||||||
|
|
||||||
|
@ -299,7 +298,7 @@ void RSXDebugger::OnClickBuffer(wxMouseEvent& event)
|
||||||
{
|
{
|
||||||
if (!RSXReady()) return;
|
if (!RSXReady()) return;
|
||||||
const GSRender& render = Emu.GetGSManager().GetRender();
|
const GSRender& render = Emu.GetGSManager().GetRender();
|
||||||
const auto buffers = vm::ptr<CellGcmDisplayInfo>::make(render.m_gcm_buffers_addr);
|
const auto buffers = render.gcm_buffers;
|
||||||
|
|
||||||
if(!buffers)
|
if(!buffers)
|
||||||
return;
|
return;
|
||||||
|
@ -307,7 +306,7 @@ void RSXDebugger::OnClickBuffer(wxMouseEvent& event)
|
||||||
// TODO: Is there any better way to choose the color buffers
|
// TODO: Is there any better way to choose the color buffers
|
||||||
#define SHOW_BUFFER(id) \
|
#define SHOW_BUFFER(id) \
|
||||||
{ \
|
{ \
|
||||||
u32 addr = render.m_local_mem_addr + buffers[id].offset; \
|
u32 addr = render.local_mem_addr + buffers[id].offset; \
|
||||||
if (vm::check_addr(addr) && buffers[id].width && buffers[id].height) \
|
if (vm::check_addr(addr) && buffers[id].width && buffers[id].height) \
|
||||||
MemoryViewerPanel::ShowImage(this, addr, 3, buffers[id].width, buffers[id].height, true); \
|
MemoryViewerPanel::ShowImage(this, addr, 3, buffers[id].width, buffers[id].height, true); \
|
||||||
return; \
|
return; \
|
||||||
|
@ -319,13 +318,13 @@ void RSXDebugger::OnClickBuffer(wxMouseEvent& event)
|
||||||
if (event.GetId() == p_buffer_colorD->GetId()) SHOW_BUFFER(3);
|
if (event.GetId() == p_buffer_colorD->GetId()) SHOW_BUFFER(3);
|
||||||
if (event.GetId() == p_buffer_tex->GetId())
|
if (event.GetId() == p_buffer_tex->GetId())
|
||||||
{
|
{
|
||||||
u8 location = render.m_textures[m_cur_texture].GetLocation();
|
u8 location = render.textures[m_cur_texture].location();
|
||||||
if(location <= 1 && vm::check_addr(GetAddress(render.m_textures[m_cur_texture].GetOffset(), location))
|
if(location <= 1 && vm::check_addr(rsx::get_address(render.textures[m_cur_texture].offset(), location))
|
||||||
&& render.m_textures[m_cur_texture].GetWidth() && render.m_textures[m_cur_texture].GetHeight())
|
&& render.textures[m_cur_texture].width() && render.textures[m_cur_texture].height())
|
||||||
MemoryViewerPanel::ShowImage(this,
|
MemoryViewerPanel::ShowImage(this,
|
||||||
GetAddress(render.m_textures[m_cur_texture].GetOffset(), location), 1,
|
rsx::get_address(render.textures[m_cur_texture].offset(), location), 1,
|
||||||
render.m_textures[m_cur_texture].GetWidth(),
|
render.textures[m_cur_texture].width(),
|
||||||
render.m_textures[m_cur_texture].GetHeight(), false);
|
render.textures[m_cur_texture].height(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef SHOW_BUFFER
|
#undef SHOW_BUFFER
|
||||||
|
@ -334,9 +333,9 @@ void RSXDebugger::OnClickBuffer(wxMouseEvent& event)
|
||||||
void RSXDebugger::GoToGet(wxCommandEvent& event)
|
void RSXDebugger::GoToGet(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
if (!RSXReady()) return;
|
if (!RSXReady()) return;
|
||||||
auto ctrl = vm::get_ptr<CellGcmControl>(Emu.GetGSManager().GetRender().m_ctrlAddress);
|
//auto ctrl = vm::get_ptr<CellGcmControl>(Emu.GetGSManager().GetRender().ctrlAddress);
|
||||||
u32 realAddr;
|
u32 realAddr;
|
||||||
if (RSXIOMem.getRealAddr(ctrl->get.load(), realAddr)) {
|
if (RSXIOMem.getRealAddr(0, realAddr)) {
|
||||||
m_addr = realAddr;
|
m_addr = realAddr;
|
||||||
t_addr->SetValue(wxString::Format("%08x", m_addr));
|
t_addr->SetValue(wxString::Format("%08x", m_addr));
|
||||||
UpdateInformation();
|
UpdateInformation();
|
||||||
|
@ -348,7 +347,7 @@ void RSXDebugger::GoToGet(wxCommandEvent& event)
|
||||||
void RSXDebugger::GoToPut(wxCommandEvent& event)
|
void RSXDebugger::GoToPut(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
if (!RSXReady()) return;
|
if (!RSXReady()) return;
|
||||||
auto ctrl = vm::get_ptr<CellGcmControl>(Emu.GetGSManager().GetRender().m_ctrlAddress);
|
auto ctrl = Emu.GetGSManager().GetRender().ctrl;
|
||||||
u32 realAddr;
|
u32 realAddr;
|
||||||
if (RSXIOMem.getRealAddr(ctrl->put.load(), realAddr)) {
|
if (RSXIOMem.getRealAddr(ctrl->put.load(), realAddr)) {
|
||||||
m_addr = realAddr;
|
m_addr = realAddr;
|
||||||
|
@ -386,7 +385,7 @@ void RSXDebugger::GetMemory()
|
||||||
|
|
||||||
if (isReady && vm::check_addr(addr))
|
if (isReady && vm::check_addr(addr))
|
||||||
{
|
{
|
||||||
u32 cmd = vm::read32(addr);
|
u32 cmd = vm::ps3::read32(addr);
|
||||||
u32 count = (cmd >> 18) & 0x7ff;
|
u32 count = (cmd >> 18) & 0x7ff;
|
||||||
m_list_commands->SetItem(i, 1, wxString::Format("%08x", cmd));
|
m_list_commands->SetItem(i, 1, wxString::Format("%08x", cmd));
|
||||||
m_list_commands->SetItem(i, 3, wxString::Format("%d", count));
|
m_list_commands->SetItem(i, 3, wxString::Format("%d", count));
|
||||||
|
@ -411,13 +410,13 @@ void RSXDebugger::GetBuffers()
|
||||||
|
|
||||||
// Draw Buffers
|
// Draw Buffers
|
||||||
// TODO: Currently it only supports color buffers
|
// TODO: Currently it only supports color buffers
|
||||||
for (u32 bufferId=0; bufferId < render.m_gcm_buffers_count; bufferId++)
|
for (u32 bufferId=0; bufferId < render.gcm_buffers_count; bufferId++)
|
||||||
{
|
{
|
||||||
if(!vm::check_addr(render.m_gcm_buffers_addr))
|
if(!vm::check_addr(render.gcm_buffers.addr()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto buffers = vm::get_ptr<CellGcmDisplayInfo>(render.m_gcm_buffers_addr);
|
auto buffers = render.gcm_buffers;
|
||||||
u32 RSXbuffer_addr = render.m_local_mem_addr + buffers[bufferId].offset;
|
u32 RSXbuffer_addr = render.local_mem_addr + buffers[bufferId].offset;
|
||||||
|
|
||||||
if(!vm::check_addr(RSXbuffer_addr))
|
if(!vm::check_addr(RSXbuffer_addr))
|
||||||
continue;
|
continue;
|
||||||
|
@ -456,28 +455,28 @@ void RSXDebugger::GetBuffers()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw Texture
|
// Draw Texture
|
||||||
if(!render.m_textures[m_cur_texture].IsEnabled())
|
if(!render.textures[m_cur_texture].enabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
u32 offset = render.m_textures[m_cur_texture].GetOffset();
|
u32 offset = render.textures[m_cur_texture].offset();
|
||||||
|
|
||||||
if(!offset)
|
if(!offset)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
u8 location = render.m_textures[m_cur_texture].GetLocation();
|
u8 location = render.textures[m_cur_texture].location();
|
||||||
|
|
||||||
if(location > 1)
|
if(location > 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
u32 TexBuffer_addr = GetAddress(offset, location);
|
u32 TexBuffer_addr = rsx::get_address(offset, location);
|
||||||
|
|
||||||
if(!vm::check_addr(TexBuffer_addr))
|
if(!vm::check_addr(TexBuffer_addr))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned char* TexBuffer = vm::get_ptr<unsigned char>(TexBuffer_addr);
|
unsigned char* TexBuffer = vm::get_ptr<unsigned char>(TexBuffer_addr);
|
||||||
|
|
||||||
u32 width = render.m_textures[m_cur_texture].GetWidth();
|
u32 width = render.textures[m_cur_texture].width();
|
||||||
u32 height = render.m_textures[m_cur_texture].GetHeight();
|
u32 height = render.textures[m_cur_texture].height();
|
||||||
unsigned char* buffer = (unsigned char*)malloc(width * height * 3);
|
unsigned char* buffer = (unsigned char*)malloc(width * height * 3);
|
||||||
memcpy(buffer, TexBuffer, width * height * 3);
|
memcpy(buffer, TexBuffer, width * height * 3);
|
||||||
|
|
||||||
|
@ -495,7 +494,7 @@ void RSXDebugger::GetFlags()
|
||||||
|
|
||||||
#define LIST_FLAGS_ADD(name, value) \
|
#define LIST_FLAGS_ADD(name, value) \
|
||||||
m_list_flags->InsertItem(i, name); m_list_flags->SetItem(i, 1, value ? "Enabled" : "Disabled"); i++;
|
m_list_flags->InsertItem(i, name); m_list_flags->SetItem(i, 1, value ? "Enabled" : "Disabled"); i++;
|
||||||
|
/*
|
||||||
LIST_FLAGS_ADD("Alpha test", render.m_set_alpha_test);
|
LIST_FLAGS_ADD("Alpha test", render.m_set_alpha_test);
|
||||||
LIST_FLAGS_ADD("Blend", render.m_set_blend);
|
LIST_FLAGS_ADD("Blend", render.m_set_blend);
|
||||||
LIST_FLAGS_ADD("Scissor", render.m_set_scissor_horizontal && render.m_set_scissor_vertical);
|
LIST_FLAGS_ADD("Scissor", render.m_set_scissor_horizontal && render.m_set_scissor_vertical);
|
||||||
|
@ -514,6 +513,7 @@ void RSXDebugger::GetFlags()
|
||||||
LIST_FLAGS_ADD("Two sided lighting", render.m_set_two_side_light_enable);
|
LIST_FLAGS_ADD("Two sided lighting", render.m_set_two_side_light_enable);
|
||||||
LIST_FLAGS_ADD("Point Sprite", render.m_set_point_sprite_control);
|
LIST_FLAGS_ADD("Point Sprite", render.m_set_point_sprite_control);
|
||||||
LIST_FLAGS_ADD("Lighting ", render.m_set_specular);
|
LIST_FLAGS_ADD("Lighting ", render.m_set_specular);
|
||||||
|
*/
|
||||||
|
|
||||||
#undef LIST_FLAGS_ADD
|
#undef LIST_FLAGS_ADD
|
||||||
}
|
}
|
||||||
|
@ -543,7 +543,7 @@ void RSXDebugger::GetLightning()
|
||||||
#define LIST_LIGHTNING_ADD(name, value) \
|
#define LIST_LIGHTNING_ADD(name, value) \
|
||||||
m_list_lightning->InsertItem(i, name); m_list_lightning->SetItem(i, 1, value); i++;
|
m_list_lightning->InsertItem(i, name); m_list_lightning->SetItem(i, 1, value); i++;
|
||||||
|
|
||||||
LIST_LIGHTNING_ADD("Shade model", (render.m_shade_mode == 0x1D00) ? "Flat" : "Smooth");
|
//LIST_LIGHTNING_ADD("Shade model", (render.m_shade_mode == 0x1D00) ? "Flat" : "Smooth");
|
||||||
|
|
||||||
#undef LIST_LIGHTNING_ADD
|
#undef LIST_LIGHTNING_ADD
|
||||||
}
|
}
|
||||||
|
@ -554,31 +554,31 @@ void RSXDebugger::GetTexture()
|
||||||
const GSRender& render = Emu.GetGSManager().GetRender();
|
const GSRender& render = Emu.GetGSManager().GetRender();
|
||||||
m_list_texture->DeleteAllItems();
|
m_list_texture->DeleteAllItems();
|
||||||
|
|
||||||
for(uint i=0; i<RSXThread::m_textures_count; ++i)
|
for(uint i=0; i<rsx::limits::textures_count; ++i)
|
||||||
{
|
{
|
||||||
if(render.m_textures[i].IsEnabled())
|
if(render.textures[i].enabled())
|
||||||
{
|
{
|
||||||
m_list_texture->InsertItem(i, wxString::Format("%d", i));
|
m_list_texture->InsertItem(i, wxString::Format("%d", i));
|
||||||
u8 location = render.m_textures[i].GetLocation();
|
u8 location = render.textures[i].location();
|
||||||
if(location > 1)
|
if(location > 1)
|
||||||
{
|
{
|
||||||
m_list_texture->SetItem(i, 1,
|
m_list_texture->SetItem(i, 1,
|
||||||
wxString::Format("Bad address (offset=0x%x, location=%d)", render.m_textures[i].GetOffset(), location));
|
wxString::Format("Bad address (offset=0x%x, location=%d)", render.textures[i].offset(), location));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_list_texture->SetItem(i, 1, wxString::Format("0x%x", GetAddress(render.m_textures[i].GetOffset(), location)));
|
m_list_texture->SetItem(i, 1, wxString::Format("0x%x", rsx::get_address(render.textures[i].offset(), location)));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_list_texture->SetItem(i, 2, render.m_textures[i].isCubemap() ? "True" : "False");
|
m_list_texture->SetItem(i, 2, render.textures[i].cubemap() ? "True" : "False");
|
||||||
m_list_texture->SetItem(i, 3, wxString::Format("%dD", render.m_textures[i].GetDimension()));
|
m_list_texture->SetItem(i, 3, wxString::Format("%dD", render.textures[i].dimension()));
|
||||||
m_list_texture->SetItem(i, 4, render.m_textures[i].IsEnabled() ? "True" : "False");
|
m_list_texture->SetItem(i, 4, render.textures[i].enabled() ? "True" : "False");
|
||||||
m_list_texture->SetItem(i, 5, wxString::Format("0x%x", render.m_textures[i].GetFormat()));
|
m_list_texture->SetItem(i, 5, wxString::Format("0x%x", render.textures[i].format()));
|
||||||
m_list_texture->SetItem(i, 6, wxString::Format("0x%x", render.m_textures[i].GetMipmap()));
|
m_list_texture->SetItem(i, 6, wxString::Format("0x%x", render.textures[i].mipmap()));
|
||||||
m_list_texture->SetItem(i, 7, wxString::Format("0x%x", render.m_textures[i].m_pitch));
|
m_list_texture->SetItem(i, 7, wxString::Format("0x%x", render.textures[i].pitch()));
|
||||||
m_list_texture->SetItem(i, 8, wxString::Format("%dx%d",
|
m_list_texture->SetItem(i, 8, wxString::Format("%dx%d",
|
||||||
render.m_textures[i].GetWidth(),
|
render.textures[i].width(),
|
||||||
render.m_textures[i].GetHeight()));
|
render.textures[i].height()));
|
||||||
|
|
||||||
m_list_texture->SetItemBackgroundColour(i, wxColour(m_cur_texture == i ? "Wheat" : "White"));
|
m_list_texture->SetItemBackgroundColour(i, wxColour(m_cur_texture == i ? "Wheat" : "White"));
|
||||||
}
|
}
|
||||||
|
@ -594,7 +594,7 @@ void RSXDebugger::GetSettings()
|
||||||
|
|
||||||
#define LIST_SETTINGS_ADD(name, value) \
|
#define LIST_SETTINGS_ADD(name, value) \
|
||||||
m_list_settings->InsertItem(i, name); m_list_settings->SetItem(i, 1, value); i++;
|
m_list_settings->InsertItem(i, name); m_list_settings->SetItem(i, 1, value); i++;
|
||||||
|
/*
|
||||||
LIST_SETTINGS_ADD("Alpha func", !(render.m_set_alpha_func) ? "(none)" : wxString::Format("0x%x (%s)",
|
LIST_SETTINGS_ADD("Alpha func", !(render.m_set_alpha_func) ? "(none)" : wxString::Format("0x%x (%s)",
|
||||||
render.m_alpha_func,
|
render.m_alpha_func,
|
||||||
ParseGCMEnum(render.m_alpha_func, CELL_GCM_ENUM)));
|
ParseGCMEnum(render.m_alpha_func, CELL_GCM_ENUM)));
|
||||||
|
@ -644,12 +644,13 @@ void RSXDebugger::GetSettings()
|
||||||
render.m_viewport_y,
|
render.m_viewport_y,
|
||||||
render.m_viewport_w,
|
render.m_viewport_w,
|
||||||
render.m_viewport_h));
|
render.m_viewport_h));
|
||||||
|
*/
|
||||||
#undef LIST_SETTINGS_ADD
|
#undef LIST_SETTINGS_ADD
|
||||||
}
|
}
|
||||||
|
|
||||||
void RSXDebugger::SetFlags(wxListEvent& event)
|
void RSXDebugger::SetFlags(wxListEvent& event)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if (!RSXReady()) return;
|
if (!RSXReady()) return;
|
||||||
GSRender& render = Emu.GetGSManager().GetRender();
|
GSRender& render = Emu.GetGSManager().GetRender();
|
||||||
switch(event.m_itemIndex)
|
switch(event.m_itemIndex)
|
||||||
|
@ -673,6 +674,7 @@ void RSXDebugger::SetFlags(wxListEvent& event)
|
||||||
case 16: render.m_set_scissor_horizontal ^= true; break;
|
case 16: render.m_set_scissor_horizontal ^= true; break;
|
||||||
case 17: render.m_set_scissor_vertical ^= true; break;
|
case 17: render.m_set_scissor_vertical ^= true; break;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
UpdateInformation();
|
UpdateInformation();
|
||||||
}
|
}
|
||||||
|
@ -835,7 +837,7 @@ wxString RSXDebugger::DisAsmCommand(u32 cmd, u32 count, u32 currentAddr, u32 ioA
|
||||||
}
|
}
|
||||||
else if(!(cmd & (CELL_GCM_METHOD_FLAG_JUMP | CELL_GCM_METHOD_FLAG_CALL)) && cmd != CELL_GCM_METHOD_FLAG_RETURN)
|
else if(!(cmd & (CELL_GCM_METHOD_FLAG_JUMP | CELL_GCM_METHOD_FLAG_CALL)) && cmd != CELL_GCM_METHOD_FLAG_RETURN)
|
||||||
{
|
{
|
||||||
auto args = vm::ptr<u32>::make(currentAddr + 4);
|
auto args = vm::ps3::ptr<u32>::make(currentAddr + 4);
|
||||||
|
|
||||||
u32 index = 0;
|
u32 index = 0;
|
||||||
switch(cmd & 0x3ffff)
|
switch(cmd & 0x3ffff)
|
||||||
|
@ -1210,4 +1212,3 @@ bool RSXDebugger::RSXReady()
|
||||||
{
|
{
|
||||||
return Emu.GetGSManager().IsInited();
|
return Emu.GetGSManager().IsInited();
|
||||||
}
|
}
|
||||||
#endif
|
|
|
@ -1,8 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define _USE_RSX_DEBUGGER 0
|
|
||||||
|
|
||||||
#if _USE_RSX_DEBUGGER
|
|
||||||
#include <wx/listctrl.h>
|
#include <wx/listctrl.h>
|
||||||
|
|
||||||
class RSXDebugger : public wxFrame
|
class RSXDebugger : public wxFrame
|
||||||
|
@ -70,5 +67,3 @@ public:
|
||||||
bool RSXReady();
|
bool RSXReady();
|
||||||
void SetPC(const uint pc) { m_addr = pc; }
|
void SetPC(const uint pc) { m_addr = pc; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
|
Loading…
Add table
Add a link
Reference in a new issue