1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 18:53:28 +01:00
This commit is contained in:
Oil 2014-05-25 01:46:25 +04:00
commit 8a1227eaa2
24 changed files with 457 additions and 111 deletions

4
.gitignore vendored
View File

@ -45,6 +45,10 @@
/bin/*.exp /bin/*.exp
rpcs3/git-version.h rpcs3/git-version.h
# Visual Studio Profiler Files
*.vspx
*.psess
# Copyrighted files # Copyrighted files
/bin/data/ /bin/data/
/bin/dev_flash/data/font /bin/dev_flash/data/font

View File

@ -460,4 +460,7 @@ Global
{74827EBD-93DC-5110-BA95-3F2AB029B6B0} = {5812E712-6213-4372-B095-9EB9BAA1F2DF} {74827EBD-93DC-5110-BA95-3F2AB029B6B0} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
{AC40FF01-426E-4838-A317-66354CEFAE88} = {E2A982F2-4B1A-48B1-8D77-A17A589C58D7} {AC40FF01-426E-4838-A317-66354CEFAE88} = {E2A982F2-4B1A-48B1-8D77-A17A589C58D7}
EndGlobalSection EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
EndGlobal EndGlobal

View File

@ -1788,9 +1788,9 @@ private:
{ {
DisAsm_R2("icbi", ra, rb); DisAsm_R2("icbi", ra, rb);
} }
void DCBZ(u32 ra, u32 rs) void DCBZ(u32 ra, u32 rb)
{ {
DisAsm_R2("dcbz", ra, rs); DisAsm_R2("dcbz", ra, rb);
} }
void LWZ(u32 rd, u32 ra, s32 d) void LWZ(u32 rd, u32 ra, s32 d)
{ {

View File

@ -2084,9 +2084,10 @@ private:
{ {
if (CheckCondition(bo, bi)) if (CheckCondition(bo, bi))
{ {
const u64 nextLR = CPU.PC + 4;
CPU.SetBranch(branchTarget((aa ? 0 : CPU.PC), bd), lk); CPU.SetBranch(branchTarget((aa ? 0 : CPU.PC), bd), lk);
if(lk) CPU.LR = nextLR;
} }
if(lk) CPU.LR = CPU.PC + 4;
} }
void SC(u32 sc_code) void SC(u32 sc_code)
{ {
@ -2108,8 +2109,9 @@ private:
} }
void B(s32 ll, u32 aa, u32 lk) void B(s32 ll, u32 aa, u32 lk)
{ {
const u64 nextLR = CPU.PC + 4;
CPU.SetBranch(branchTarget(aa ? 0 : CPU.PC, ll), lk); CPU.SetBranch(branchTarget(aa ? 0 : CPU.PC, ll), lk);
if(lk) CPU.LR = CPU.PC + 4; if(lk) CPU.LR = nextLR;
} }
void MCRF(u32 crfd, u32 crfs) void MCRF(u32 crfd, u32 crfs)
{ {
@ -2119,9 +2121,10 @@ private:
{ {
if (CheckCondition(bo, bi)) if (CheckCondition(bo, bi))
{ {
const u64 nextLR = CPU.PC + 4;
CPU.SetBranch(branchTarget(0, CPU.LR), true); CPU.SetBranch(branchTarget(0, CPU.LR), true);
if(lk) CPU.LR = nextLR;
} }
if(lk) CPU.LR = CPU.PC + 4;
} }
void CRNOR(u32 crbd, u32 crba, u32 crbb) void CRNOR(u32 crbd, u32 crba, u32 crbb)
{ {
@ -2171,9 +2174,10 @@ private:
{ {
if(bo & 0x10 || CPU.IsCR(bi) == (bo & 0x8)) if(bo & 0x10 || CPU.IsCR(bi) == (bo & 0x8))
{ {
const u64 nextLR = CPU.PC + 4;
CPU.SetBranch(branchTarget(0, CPU.CTR), true); CPU.SetBranch(branchTarget(0, CPU.CTR), true);
if(lk) CPU.LR = nextLR;
} }
if(lk) CPU.LR = CPU.PC + 4;
} }
void RLWIMI(u32 ra, u32 rs, u32 sh, u32 mb, u32 me, bool rc) void RLWIMI(u32 ra, u32 rs, u32 sh, u32 mb, u32 me, bool rc)
{ {
@ -2816,7 +2820,6 @@ private:
const u64 RA = CPU.GPR[ra]; const u64 RA = CPU.GPR[ra];
const u64 RB = CPU.GPR[rb]; const u64 RB = CPU.GPR[rb];
CPU.GPR[rd] = RA + RB; CPU.GPR[rd] = RA + RB;
CPU.XER.CA = CPU.IsCarry(RA, RB);
if(oe) UNK("addo"); if(oe) UNK("addo");
if(rc) CPU.UpdateCR0<s64>(CPU.GPR[rd]); if(rc) CPU.UpdateCR0<s64>(CPU.GPR[rd]);
} }
@ -3288,16 +3291,18 @@ private:
void EXTSW(u32 ra, u32 rs, bool rc) void EXTSW(u32 ra, u32 rs, bool rc)
{ {
CPU.GPR[ra] = (s64)(s32)CPU.GPR[rs]; CPU.GPR[ra] = (s64)(s32)CPU.GPR[rs];
//CPU.XER.CA = ((s64)CPU.GPR[ra] < 0); // ???
if(rc) CPU.UpdateCR0<s32>(CPU.GPR[ra]); if(rc) CPU.UpdateCR0<s32>(CPU.GPR[ra]);
} }
void ICBI(u32 ra, u32 rs) void ICBI(u32 ra, u32 rs)
{ {
// Clear jit for the specified block? Nothing to do in the interpreter. // Clear jit for the specified block? Nothing to do in the interpreter.
} }
void DCBZ(u32 ra, u32 rs) void DCBZ(u32 ra, u32 rb)
{ {
//UNK("dcbz", false); const u64 addr = ra ? CPU.GPR[ra] + CPU.GPR[rb] : CPU.GPR[rb];
u8 *const cache_line = Memory.GetMemFromAddr(addr & ~127);
if (cache_line)
memset(cache_line, 0, 128);
_mm_mfence(); _mm_mfence();
} }
void LWZ(u32 rd, u32 ra, s32 d) void LWZ(u32 rd, u32 ra, s32 d)

View File

@ -581,7 +581,7 @@ void GLGSRender::WriteColourBufferD()
checkForGlError("glReadPixels(GL_RGBA, GL_UNSIGNED_INT_8_8_8_8)"); checkForGlError("glReadPixels(GL_RGBA, GL_UNSIGNED_INT_8_8_8_8)");
} }
void GLGSRender::WriteBuffers() void GLGSRender::WriteColorBuffers()
{ {
glPixelStorei(GL_PACK_ROW_LENGTH, 0); glPixelStorei(GL_PACK_ROW_LENGTH, 0);
glPixelStorei(GL_PACK_ALIGNMENT, 4); glPixelStorei(GL_PACK_ALIGNMENT, 4);
@ -641,7 +641,6 @@ void GLGSRender::OnInitThread()
InitProcTable(); InitProcTable();
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glEnable(GL_SCISSOR_TEST);
#ifdef _WIN32 #ifdef _WIN32
glSwapInterval(Ini.GSVSyncEnable.GetValue() ? 1 : 0); glSwapInterval(Ini.GSVSyncEnable.GetValue() ? 1 : 0);
@ -773,8 +772,10 @@ void GLGSRender::ExecCMD()
} }
m_fbo.Bind(); m_fbo.Bind();
if(Ini.GSDumpDepthBuffer.GetValue()) if(Ini.GSDumpDepthBuffer.GetValue())
WriteDepthBuffer(); WriteDepthBuffer();
static const GLenum draw_buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3 }; static const GLenum draw_buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3 };
switch(m_surface_colour_target) switch(m_surface_colour_target)
@ -813,20 +814,12 @@ void GLGSRender::ExecCMD()
checkForGlError("glColorMask"); checkForGlError("glColorMask");
} }
//glFrontFace(m_front_face);
if(m_set_viewport_horizontal && m_set_viewport_vertical) if(m_set_viewport_horizontal && m_set_viewport_vertical)
{ {
//glViewport(m_viewport_x, m_viewport_y, m_viewport_w, m_viewport_h); //glViewport(m_viewport_x, m_viewport_y, m_viewport_w, m_viewport_h);
//checkForGlError("glViewport"); //checkForGlError("glViewport");
} }
if(m_set_scissor_horizontal && m_set_scissor_vertical)
{
glScissor(m_scissor_x, m_scissor_y, m_scissor_w, m_scissor_h);
checkForGlError("glScissor");
}
if(m_clear_surface_mask) if(m_clear_surface_mask)
{ {
GLbitfield f = 0; GLbitfield f = 0;
@ -859,18 +852,6 @@ void GLGSRender::ExecCMD()
glClear(f); glClear(f);
} }
if(m_set_front_polygon_mode)
{
glPolygonMode(GL_FRONT, m_front_polygon_mode);
checkForGlError("glPolygonMode(Front)");
}
if (m_set_back_polygon_mode)
{
glPolygonMode(GL_BACK, m_back_polygon_mode);
checkForGlError("glPolygonMode(Back)");
}
Enable(m_depth_test_enable, GL_DEPTH_TEST); Enable(m_depth_test_enable, GL_DEPTH_TEST);
Enable(m_set_alpha_test, GL_ALPHA_TEST); Enable(m_set_alpha_test, GL_ALPHA_TEST);
Enable(m_set_depth_bounds_test, GL_DEPTH_BOUNDS_TEST_EXT); Enable(m_set_depth_bounds_test, GL_DEPTH_BOUNDS_TEST_EXT);
@ -879,12 +860,13 @@ void GLGSRender::ExecCMD()
Enable(m_set_cull_face_enable, GL_CULL_FACE); Enable(m_set_cull_face_enable, GL_CULL_FACE);
Enable(m_set_dither, GL_DITHER); Enable(m_set_dither, GL_DITHER);
Enable(m_set_stencil_test, GL_STENCIL_TEST); Enable(m_set_stencil_test, GL_STENCIL_TEST);
Enable(m_set_scissor_horizontal && m_set_scissor_vertical, GL_SCISSOR_TEST);
Enable(m_set_line_smooth, GL_LINE_SMOOTH); Enable(m_set_line_smooth, GL_LINE_SMOOTH);
Enable(m_set_poly_smooth, GL_POLYGON_SMOOTH); Enable(m_set_poly_smooth, GL_POLYGON_SMOOTH);
Enable(m_set_poly_offset_fill, GL_POLYGON_OFFSET_FILL); Enable(m_set_poly_offset_fill, GL_POLYGON_OFFSET_FILL);
Enable(m_set_poly_offset_line, GL_POLYGON_OFFSET_LINE); Enable(m_set_poly_offset_line, GL_POLYGON_OFFSET_LINE);
Enable(m_set_poly_offset_point, GL_POLYGON_OFFSET_POINT); Enable(m_set_poly_offset_point, GL_POLYGON_OFFSET_POINT);
//Enable(m_set_restart_index, GL_PRIMITIVE_RESTART); //Requires OpenGL 3.1+ //Enable(m_set_restart_index, GL_PRIMITIVE_RESTART); // Requires OpenGL 3.1+
if(m_set_clip_plane) if(m_set_clip_plane)
{ {
@ -900,6 +882,37 @@ void GLGSRender::ExecCMD()
checkForGlError("glEnable"); checkForGlError("glEnable");
if (m_set_front_polygon_mode)
{
glPolygonMode(GL_FRONT, m_front_polygon_mode);
checkForGlError("glPolygonMode(Front)");
}
if (m_set_back_polygon_mode)
{
glPolygonMode(GL_BACK, m_back_polygon_mode);
checkForGlError("glPolygonMode(Back)");
}
if (m_set_poly_offset_scale_factor && m_set_poly_offset_bias)
{
glPolygonOffset(m_set_poly_offset_scale_factor, m_set_poly_offset_bias);
checkForGlError("glPolygonOffset");
}
if (m_set_logic_op)
{
glLogicOp(m_logic_op);
checkForGlError("glLogicOp");
}
if (m_set_scissor_horizontal && m_set_scissor_vertical)
{
glScissor(m_scissor_x, m_scissor_y, m_scissor_w, m_scissor_h);
checkForGlError("glScissor");
}
if(m_set_two_sided_stencil_test_enable) if(m_set_two_sided_stencil_test_enable)
{ {
if(m_set_stencil_fail && m_set_stencil_zfail && m_set_stencil_zpass) if(m_set_stencil_fail && m_set_stencil_zfail && m_set_stencil_zpass)
@ -1022,6 +1035,16 @@ void GLGSRender::ExecCMD()
checkForGlError("glCullFace"); checkForGlError("glCullFace");
} }
if (m_set_front_face)
{
// Sanity check . Disgaea 3 return 0x1d0 here and cause openGL 0x0500
if (m_front_face == GL_CW || m_front_face == GL_CCW)
{
glFrontFace(m_front_face);
checkForGlError("glFrontFace");
}
}
if(m_set_alpha_func && m_set_alpha_ref) if(m_set_alpha_func && m_set_alpha_ref)
{ {
glAlphaFunc(m_alpha_func, m_alpha_ref/255.0f); glAlphaFunc(m_alpha_func, m_alpha_ref/255.0f);
@ -1045,7 +1068,7 @@ void GLGSRender::ExecCMD()
if(m_set_restart_index) if(m_set_restart_index)
{ {
ConLog.Warning("m_set_restart_index requires glPrimitiveRestartIndex()"); ConLog.Warning("m_set_restart_index requires glPrimitiveRestartIndex()");
//glPrimitiveRestartIndex(m_restart_index); //Requires OpenGL 3.1+ //glPrimitiveRestartIndex(m_restart_index); // Requires OpenGL 3.1+
//checkForGlError("glPrimitiveRestartIndex"); //checkForGlError("glPrimitiveRestartIndex");
} }
@ -1110,12 +1133,34 @@ void GLGSRender::ExecCMD()
DisableVertexData(); DisableVertexData();
} }
if(Ini.GSDumpColorBuffers.GetValue()) if (Ini.GSDumpColorBuffers.GetValue())
WriteBuffers(); WriteColorBuffers();
} }
void GLGSRender::Flip() void GLGSRender::Flip()
{ {
// Fast path for non-MRT using glBlitFramebuffer
// TODO: check for MRT samples
if (m_fbo.IsCreated() && (m_surface_colour_target == CELL_GCM_SURFACE_TARGET_0 || m_surface_colour_target == CELL_GCM_SURFACE_TARGET_1))
{
GLfbo::Bind(GL_DRAW_FRAMEBUFFER, 0);
// Renderbuffer is upside turn , swapped srcY0 and srcY1
GLfbo::Blit(0, RSXThread::m_height, RSXThread::m_width, 0, 0, 0, RSXThread::m_width, RSXThread::m_height, GL_COLOR_BUFFER_BIT, GL_NEAREST);
m_fbo.Bind();
for (uint i = 0; i<m_post_draw_objs.size(); ++i)
{
m_post_draw_objs[i].Draw();
}
m_frame->Flip(m_context);
m_fbo.Bind();
return;
}
if(m_set_scissor_horizontal && m_set_scissor_vertical) if(m_set_scissor_horizontal && m_set_scissor_vertical)
{ {
glScissor(0, 0, RSXThread::m_width, RSXThread::m_height); glScissor(0, 0, RSXThread::m_width, RSXThread::m_height);
@ -1205,24 +1250,6 @@ void GLGSRender::Flip()
glEnd(); glEnd();
} }
/*GLfbo::Bind(GL_DRAW_FRAMEBUFFER, 0);
GLfbo::Blit(
m_surface_clip_x, m_surface_clip_y, m_surface_clip_x + m_surface_clip_w, m_surface_clip_y + m_surface_clip_h,
m_surface_clip_x, m_surface_clip_y, m_surface_clip_x + m_surface_clip_w, m_surface_clip_y + m_surface_clip_h,
GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, GL_NEAREST);*/
if(m_fbo.IsCreated())
m_fbo.Bind();
for(uint i=0; i<m_post_draw_objs.size(); ++i)
{
m_post_draw_objs[i].Draw();
}
m_frame->Flip(m_context);
if(m_fbo.IsCreated())
m_fbo.Bind();
if(m_set_scissor_horizontal && m_set_scissor_vertical) if(m_set_scissor_horizontal && m_set_scissor_vertical)
{ {
glScissor(m_scissor_x, m_scissor_y, m_scissor_w, m_scissor_h); glScissor(m_scissor_x, m_scissor_y, m_scissor_w, m_scissor_h);

View File

@ -827,11 +827,11 @@ private:
virtual void Close(); virtual void Close();
bool LoadProgram(); bool LoadProgram();
void WriteDepthBuffer(); void WriteDepthBuffer();
void WriteColorBuffers();
void WriteColourBufferA(); void WriteColourBufferA();
void WriteColourBufferB(); void WriteColourBufferB();
void WriteColourBufferC(); void WriteColourBufferC();
void WriteColourBufferD(); void WriteColourBufferD();
void WriteBuffers();
void DrawObjects(); void DrawObjects();

View File

@ -11,7 +11,10 @@ u32 GetAddress(u32 offset, u8 location)
switch(location) switch(location)
{ {
case CELL_GCM_LOCATION_LOCAL: return Memory.RSXFBMem.GetStartAddr() + offset; case CELL_GCM_LOCATION_LOCAL: return Memory.RSXFBMem.GetStartAddr() + offset;
case CELL_GCM_LOCATION_MAIN: return Memory.RSXIOMem.getRealAddr(Memory.RSXIOMem.GetStartAddr() + offset); case CELL_GCM_LOCATION_MAIN:
u64 realAddr;
Memory.RSXIOMem.getRealAddr(Memory.RSXIOMem.GetStartAddr() + offset, realAddr); // TODO: Error Check?
return realAddr;
} }
ConLog.Error("GetAddress(offset=0x%x, location=0x%x)", location); ConLog.Error("GetAddress(offset=0x%x, location=0x%x)", location);
@ -762,6 +765,10 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
m_set_logic_op = ARGS(0) ? true : false; m_set_logic_op = ARGS(0) ? true : false;
break; break;
case NV4097_SET_LOGIC_OP:
m_logic_op = ARGS(0);
break;
case NV4097_SET_CULL_FACE_ENABLE: case NV4097_SET_CULL_FACE_ENABLE:
m_set_cull_face_enable = ARGS(0) ? true : false; m_set_cull_face_enable = ARGS(0) ? true : false;
break; break;

View File

@ -166,7 +166,6 @@ public:
bool m_set_blend; bool m_set_blend;
bool m_set_depth_bounds_test; bool m_set_depth_bounds_test;
bool m_depth_test_enable; bool m_depth_test_enable;
bool m_set_logic_op;
bool m_set_cull_face_enable; bool m_set_cull_face_enable;
bool m_set_dither; bool m_set_dither;
bool m_set_stencil_test; bool m_set_stencil_test;
@ -176,6 +175,11 @@ public:
bool m_set_poly_offset_line; bool m_set_poly_offset_line;
bool m_set_poly_offset_point; bool m_set_poly_offset_point;
bool m_set_poly_offset_scale_factor;
u32 m_poly_offset_scale_factor;
bool m_set_poly_offset_bias;
u32 m_poly_offset_bias;
bool m_set_restart_index; bool m_set_restart_index;
u32 m_restart_index; u32 m_restart_index;
@ -198,6 +202,9 @@ public:
bool m_set_back_polygon_mode; bool m_set_back_polygon_mode;
u32 m_back_polygon_mode; u32 m_back_polygon_mode;
bool m_set_logic_op;
u32 m_logic_op;
u32 m_clear_surface_mask; u32 m_clear_surface_mask;
u32 m_clear_surface_z; u32 m_clear_surface_z;
u8 m_clear_surface_s; u8 m_clear_surface_s;
@ -382,6 +389,7 @@ public:
u32 m_surface_colour_target; u32 m_surface_colour_target;
bool m_set_front_face;
u32 m_front_face; u32 m_front_face;
u8 m_begin_end; u8 m_begin_end;
@ -426,6 +434,9 @@ protected:
m_clear_z = 0xffffff; m_clear_z = 0xffffff;
m_clear_s = 0; m_clear_s = 0;
m_poly_offset_scale_factor = 0;
m_poly_offset_bias = 0;
m_depth_bounds_min = 0.0; m_depth_bounds_min = 0.0;
m_depth_bounds_max = 1.0; m_depth_bounds_max = 1.0;
m_restart_index = 0xffffffff; m_restart_index = 0xffffffff;
@ -498,6 +509,8 @@ protected:
m_set_poly_offset_fill = false; m_set_poly_offset_fill = false;
m_set_poly_offset_line = false; m_set_poly_offset_line = false;
m_set_poly_offset_point = false; m_set_poly_offset_point = false;
m_set_poly_offset_scale_factor = false;
m_set_poly_offset_bias = false;
m_set_restart_index = false; m_set_restart_index = false;
m_clear_surface_mask = 0; m_clear_surface_mask = 0;

View File

@ -232,6 +232,7 @@ static const CellVideoOutResolution ResolutionTable[] =
{1440, 1080}, //11 - 6 {1440, 1080}, //11 - 6
{1280, 1080}, //12 - 7 {1280, 1080}, //12 - 7
{960, 1080}, //13 - 8 {960, 1080}, //13 - 8
{960, 540}, //14 - 9
}; };
inline static u32 ResolutionIdToNum(u32 id) inline static u32 ResolutionIdToNum(u32 id)
@ -252,9 +253,10 @@ inline static u32 ResolutionIdToNum(u32 id)
6, //11 6, //11
7, //12 7, //12
8, //13 8, //13
9, //14
}; };
return id <= 13 ? res[id] : 0; return id <= 14 ? res[id] : 0;
} }
inline static u32 ResolutionNumToId(u32 num) inline static u32 ResolutionNumToId(u32 num)
@ -270,7 +272,8 @@ inline static u32 ResolutionNumToId(u32 num)
11, 11,
12, 12,
13, 13,
14,
}; };
return num <= 8 ? res[num] : 0; return num <= 9 ? res[num] : 0;
} }

View File

@ -2,6 +2,9 @@
#include "Pad.h" #include "Pad.h"
#include "Null/NullPadHandler.h" #include "Null/NullPadHandler.h"
#include "Windows/WindowsPadHandler.h" #include "Windows/WindowsPadHandler.h"
#if defined(_WIN32)
#include "XInput/XInputPadHandler.h"
#endif
PadManager::PadManager() PadManager::PadManager()
: m_pad_handler(nullptr) : m_pad_handler(nullptr)
@ -25,6 +28,12 @@ void PadManager::Init(const u32 max_connect)
m_pad_handler.reset(new WindowsPadHandler()); m_pad_handler.reset(new WindowsPadHandler());
break; break;
#if defined(_WIN32)
case 2:
m_pad_handler.reset(new XInputPadHandler());
break;
#endif
default: default:
case 0: case 0:
m_pad_handler.reset(new NullPadHandler()); m_pad_handler.reset(new NullPadHandler());

View File

@ -220,7 +220,7 @@ public:
virtual ~PadHandlerBase() = default; virtual ~PadHandlerBase() = default;
//Set value to set pressure/axi to certain level, otherwise 0/255 default //Set value to set pressure/axi to certain level, otherwise 0/255 default
void Key(const u32 code, bool pressed, u16 value=256) void Key(const u32 code, bool pressed, u16 value=255)
{ {
for(Pad& pad : m_pads) for(Pad& pad : m_pads)
{ {

View File

@ -0,0 +1,181 @@
#include "stdafx.h"
#if defined (_WIN32)
#include "XInputPadHandler.h"
#include <cstring>
namespace {
const DWORD THREAD_TIMEOUT = 1000;
const DWORD THREAD_SLEEP = 10;
const DWORD THREAD_SLEEP_INACTIVE = 100;
const DWORD MAX_GAMEPADS = 4;
const DWORD XINPUT_GAMEPAD_GUIDE = 0x0400;
const DWORD XINPUT_GAMEPAD_BUTTONS = 16;
const LPCWSTR LIBRARY_FILENAMES[] = {
L"xinput1_4.dll",
L"xinput1_3.dll",
L"xinput1_2.dll",
L"xinput9_1_0.dll"
};
inline u16 ConvertAxis(SHORT value)
{
return static_cast<u16>((value + 32768l) >> 8);
}
}
XInputPadHandler::XInputPadHandler() : active(false), thread(nullptr), library(nullptr), xinputGetState(nullptr), xinputEnable(nullptr)
{
}
XInputPadHandler::~XInputPadHandler()
{
Close();
}
void XInputPadHandler::Init(const u32 max_connect)
{
for (auto it : LIBRARY_FILENAMES)
{
library = LoadLibrary(it);
if (library)
{
xinputEnable = reinterpret_cast<PFN_XINPUTENABLE>(GetProcAddress(library, "XInputEnable"));
xinputGetState = reinterpret_cast<PFN_XINPUTGETSTATE>(GetProcAddress(library, reinterpret_cast<LPCSTR>(100)));
if (!xinputGetState)
{
xinputGetState = reinterpret_cast<PFN_XINPUTGETSTATE>(GetProcAddress(library, "XInputGetState"));
}
if (xinputEnable && xinputGetState)
{
break;
}
FreeLibrary(library);
library = nullptr;
xinputEnable = nullptr;
xinputGetState = nullptr;
}
}
if (library)
{
std::memset(&m_info, 0, sizeof m_info);
m_info.max_connect = max_connect;
for (u32 i = 0, max = std::min(max_connect, u32(MAX_GAMEPADS)); i != max; ++i)
{
m_pads.emplace_back(
CELL_PAD_STATUS_ASSIGN_CHANGES,
CELL_PAD_SETTING_PRESS_OFF | CELL_PAD_SETTING_SENSOR_OFF,
CELL_PAD_CAPABILITY_PS3_CONFORMITY | CELL_PAD_CAPABILITY_PRESS_MODE,
CELL_PAD_DEV_TYPE_STANDARD
);
auto & pad = m_pads.back();
pad.m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL1, XINPUT_GAMEPAD_DPAD_UP, CELL_PAD_CTRL_UP);
pad.m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL1, XINPUT_GAMEPAD_DPAD_DOWN, CELL_PAD_CTRL_DOWN);
pad.m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL1, XINPUT_GAMEPAD_DPAD_LEFT, CELL_PAD_CTRL_LEFT);
pad.m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL1, XINPUT_GAMEPAD_DPAD_RIGHT, CELL_PAD_CTRL_RIGHT);
pad.m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL1, XINPUT_GAMEPAD_START, CELL_PAD_CTRL_START);
pad.m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL1, XINPUT_GAMEPAD_BACK, CELL_PAD_CTRL_SELECT);
pad.m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL1, XINPUT_GAMEPAD_LEFT_THUMB, CELL_PAD_CTRL_L3);
pad.m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL1, XINPUT_GAMEPAD_RIGHT_THUMB, CELL_PAD_CTRL_R3);
pad.m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL2, XINPUT_GAMEPAD_LEFT_SHOULDER, CELL_PAD_CTRL_L1);
pad.m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL2, XINPUT_GAMEPAD_RIGHT_SHOULDER, CELL_PAD_CTRL_R1);
pad.m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL2, XINPUT_GAMEPAD_GUIDE, 0x100/*CELL_PAD_CTRL_PS*/);// TODO: PS button support
pad.m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL2, 0, 0x0); // Reserved
pad.m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL2, XINPUT_GAMEPAD_A, CELL_PAD_CTRL_CROSS);
pad.m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL2, XINPUT_GAMEPAD_B, CELL_PAD_CTRL_CIRCLE);
pad.m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL2, XINPUT_GAMEPAD_X, CELL_PAD_CTRL_SQUARE);
pad.m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL2, XINPUT_GAMEPAD_Y, CELL_PAD_CTRL_TRIANGLE);
pad.m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL2, 0, CELL_PAD_CTRL_L2);
pad.m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL2, 0, CELL_PAD_CTRL_R2);
pad.m_sticks.emplace_back(CELL_PAD_BTN_OFFSET_ANALOG_LEFT_X, 0, 0);
pad.m_sticks.emplace_back(CELL_PAD_BTN_OFFSET_ANALOG_LEFT_Y, 0, 0);
pad.m_sticks.emplace_back(CELL_PAD_BTN_OFFSET_ANALOG_RIGHT_X, 0, 0);
pad.m_sticks.emplace_back(CELL_PAD_BTN_OFFSET_ANALOG_RIGHT_Y, 0, 0);
}
active = true;
thread = CreateThread(NULL, 0, &XInputPadHandler::ThreadProcProxy, this, 0, NULL);
}
}
void XInputPadHandler::Close()
{
if (library)
{
if (thread)
{
active = false;
if (WaitForSingleObject(thread, THREAD_TIMEOUT) != WAIT_OBJECT_0)
ConLog.Error("XInput thread could not stop within %d milliseconds", THREAD_TIMEOUT);
thread = nullptr;
}
FreeLibrary(library);
library = nullptr;
xinputGetState = nullptr;
xinputEnable = nullptr;
}
m_pads.clear();
}
DWORD XInputPadHandler::ThreadProcedure()
{
while (active)
{
XINPUT_STATE state;
DWORD result;
DWORD online = 0;
for (DWORD i = 0; i != m_pads.size(); ++i)
{
auto & pad = m_pads[i];
result = (* xinputGetState)(i, &state);
switch (result)
{
case ERROR_DEVICE_NOT_CONNECTED:
pad.m_port_status &= ~CELL_PAD_STATUS_CONNECTED;
break;
case ERROR_SUCCESS:
++online;
pad.m_port_status |= CELL_PAD_STATUS_CONNECTED;
for (DWORD j = 0; j != XINPUT_GAMEPAD_BUTTONS; ++j)
{
bool pressed = state.Gamepad.wButtons & (1 << j);
pad.m_buttons[j].m_pressed = pressed;
pad.m_buttons[j].m_value = pressed ? 255 : 0;
}
pad.m_buttons[XINPUT_GAMEPAD_BUTTONS].m_pressed = state.Gamepad.bLeftTrigger > 0;
pad.m_buttons[XINPUT_GAMEPAD_BUTTONS].m_value = state.Gamepad.bLeftTrigger;
pad.m_buttons[XINPUT_GAMEPAD_BUTTONS + 1].m_pressed = state.Gamepad.bRightTrigger > 0;
pad.m_buttons[XINPUT_GAMEPAD_BUTTONS + 1].m_value = state.Gamepad.bRightTrigger;
pad.m_sticks[0].m_value = ConvertAxis(state.Gamepad.sThumbLX);
pad.m_sticks[1].m_value = ConvertAxis(state.Gamepad.sThumbLY);
pad.m_sticks[2].m_value = ConvertAxis(state.Gamepad.sThumbRX);
pad.m_sticks[3].m_value = ConvertAxis(state.Gamepad.sThumbRY);
break;
}
}
Sleep((online > 0) ? THREAD_SLEEP : THREAD_SLEEP_INACTIVE);
m_info.now_connect = online;
}
return 0;
}
DWORD WINAPI XInputPadHandler::ThreadProcProxy(LPVOID parameter)
{
return reinterpret_cast<XInputPadHandler *>(parameter)->ThreadProcedure();
}
#endif

View File

@ -0,0 +1,30 @@
#pragma once
#include "Emu/Io/PadHandler.h"
#include <Xinput.h>
class XInputPadHandler : public PadHandlerBase
{
public:
XInputPadHandler();
~XInputPadHandler();
void Init(const u32 max_connect) override;
void Close() override;
private:
typedef void (WINAPI * PFN_XINPUTENABLE)(BOOL);
typedef DWORD (WINAPI * PFN_XINPUTGETSTATE)(DWORD, XINPUT_STATE *);
private:
DWORD ThreadProcedure();
static DWORD WINAPI ThreadProcProxy(LPVOID parameter);
private:
mutable bool active;
HANDLE thread;
HMODULE library;
PFN_XINPUTGETSTATE xinputGetState;
PFN_XINPUTENABLE xinputEnable;
};

View File

@ -614,21 +614,25 @@ u32 VirtualMemoryBlock::UnmapAddress(u64 addr)
bool VirtualMemoryBlock::Read8(const u64 addr, u8* value) bool VirtualMemoryBlock::Read8(const u64 addr, u8* value)
{ {
u64 realAddr; u64 realAddr;
*value = Memory.Read8(realAddr = getRealAddr(addr)); if(!getRealAddr(addr, realAddr))
return realAddr != 0; return false;
*value = Memory.Read8(realAddr);
return true;
} }
bool VirtualMemoryBlock::Read16(const u64 addr, u16* value) bool VirtualMemoryBlock::Read16(const u64 addr, u16* value)
{ {
u64 realAddr; u64 realAddr;
*value = Memory.Read16(realAddr = getRealAddr(addr)); if(!getRealAddr(addr, realAddr))
return realAddr != 0; return false;
*value = Memory.Read16(realAddr);
return true;
} }
bool VirtualMemoryBlock::Read32(const u64 addr, u32* value) bool VirtualMemoryBlock::Read32(const u64 addr, u32* value)
{ {
u64 realAddr = getRealAddr(addr); u64 realAddr;
if (realAddr == 0) if (!getRealAddr(addr, realAddr))
return false; return false;
*value = Memory.Read32(realAddr); *value = Memory.Read32(realAddr);
return true; return true;
@ -637,63 +641,78 @@ bool VirtualMemoryBlock::Read32(const u64 addr, u32* value)
bool VirtualMemoryBlock::Read64(const u64 addr, u64* value) bool VirtualMemoryBlock::Read64(const u64 addr, u64* value)
{ {
u64 realAddr; u64 realAddr;
*value = Memory.Read64(realAddr = getRealAddr(addr)); if(!getRealAddr(addr, realAddr))
return realAddr != 0; return false;
*value = Memory.Read64(realAddr);
return true;
} }
bool VirtualMemoryBlock::Read128(const u64 addr, u128* value) bool VirtualMemoryBlock::Read128(const u64 addr, u128* value)
{ {
u64 realAddr; u64 realAddr;
*value = Memory.Read128(realAddr = getRealAddr(addr)); if(!getRealAddr(addr, realAddr))
return realAddr != 0; return false;
*value = Memory.Read128(realAddr);
return true;
} }
bool VirtualMemoryBlock::Write8(const u64 addr, const u8 value) bool VirtualMemoryBlock::Write8(const u64 addr, const u8 value)
{ {
u64 realAddr; u64 realAddr;
Memory.Write8(realAddr = getRealAddr(addr), value); if(!getRealAddr(addr, realAddr))
return realAddr != 0; return false;
Memory.Write8(realAddr, value);
return true;
} }
bool VirtualMemoryBlock::Write16(const u64 addr, const u16 value) bool VirtualMemoryBlock::Write16(const u64 addr, const u16 value)
{ {
u64 realAddr; u64 realAddr;
Memory.Write16(realAddr = getRealAddr(addr), value); if(!getRealAddr(addr, realAddr))
return realAddr != 0; return false;
Memory.Write16(realAddr, value);
return true;
} }
bool VirtualMemoryBlock::Write32(const u64 addr, const u32 value) bool VirtualMemoryBlock::Write32(const u64 addr, const u32 value)
{ {
u64 realAddr; u64 realAddr;
Memory.Write32(realAddr = getRealAddr(addr), value); if(!getRealAddr(addr, realAddr))
return realAddr != 0; return false;
Memory.Write32(realAddr, value);
return true;
} }
bool VirtualMemoryBlock::Write64(const u64 addr, const u64 value) bool VirtualMemoryBlock::Write64(const u64 addr, const u64 value)
{ {
u64 realAddr; u64 realAddr;
Memory.Write64(realAddr = getRealAddr(addr), value); if(!getRealAddr(addr, realAddr))
return realAddr != 0; return false;
Memory.Write64(realAddr, value);
return true;
} }
bool VirtualMemoryBlock::Write128(const u64 addr, const u128 value) bool VirtualMemoryBlock::Write128(const u64 addr, const u128 value)
{ {
u64 realAddr; u64 realAddr;
Memory.Write128(realAddr = getRealAddr(addr), value); if(!getRealAddr(addr, realAddr))
return realAddr != 0; return false;
Memory.Write128(realAddr, value);
return true;
} }
u64 VirtualMemoryBlock::getRealAddr(u64 addr) bool VirtualMemoryBlock::getRealAddr(u64 addr, u64& result)
{ {
for(u32 i=0; i<m_mapped_memory.size(); ++i) for(u32 i=0; i<m_mapped_memory.size(); ++i)
{ {
if(addr >= m_mapped_memory[i].addr && addr < m_mapped_memory[i].addr + m_mapped_memory[i].size) if(addr >= m_mapped_memory[i].addr && addr < m_mapped_memory[i].addr + m_mapped_memory[i].size)
{ {
return m_mapped_memory[i].realAddress + (addr - m_mapped_memory[i].addr); result = m_mapped_memory[i].realAddress + (addr - m_mapped_memory[i].addr);
return true;
} }
} }
return 0; return false;
} }
u64 VirtualMemoryBlock::getMappedAddress(u64 realAddress) u64 VirtualMemoryBlock::getMappedAddress(u64 realAddress)

View File

@ -333,11 +333,11 @@ public:
return true; return true;
} }
bool CopyFromReal(u32 to, void* real, u32 count) // (4K pages) copy from real to virtual memory bool CopyFromReal(u32 to, const void* real, u32 count) // (4K pages) copy from real to virtual memory
{ {
if (!count) return true; if (!count) return true;
u8* from = (u8*)real; const u8* from = (const u8*)real;
if (u32 frag = to & 4095) if (u32 frag = to & 4095)
{ {
@ -795,6 +795,12 @@ public:
return this->m_addr; return this->m_addr;
} }
u32 AppendRawBytes(const u8 * bytes, size_t count) {
Memory.CopyFromReal(this->m_addr, bytes, count);
this->m_addr += count;
return this->m_addr;
}
u32 Skip(const u32 offset) { return this->m_addr += offset; } u32 Skip(const u32 offset) { return this->m_addr += offset; }
operator be_t<T>*() { return GetPtr(); } operator be_t<T>*() { return GetPtr(); }

View File

@ -281,8 +281,9 @@ public:
virtual bool Write64(const u64 addr, const u64 value); virtual bool Write64(const u64 addr, const u64 value);
virtual bool Write128(const u64 addr, const u128 value); virtual bool Write128(const u64 addr, const u128 value);
// return the real address given a mapped address, if not mapped return 0 // try to get the real address given a mapped address
u64 getRealAddr(u64 addr); // return true for success
bool getRealAddr(u64 addr, u64& result);
// return the mapped address given a real address, if not mapped return 0 // return the mapped address given a real address, if not mapped return 0
u64 getMappedAddress(u64 realAddress); u64 getMappedAddress(u64 realAddress);

View File

@ -339,16 +339,16 @@ int cellGcmSetPrepareFlip(mem_ptr_t<CellGcmContextData> ctxt, u32 id)
{ {
ConLog.Warning("bad flip!"); ConLog.Warning("bad flip!");
//cellGcmCallback(ctxt.GetAddr(), current + 8 - end); //cellGcmCallback(ctxt.GetAddr(), current + 8 - end);
//copied: //copied:
CellGcmControl& ctrl = (CellGcmControl&)Memory[gcm_info.control_addr]; CellGcmControl& ctrl = (CellGcmControl&)Memory[gcm_info.control_addr];
const s32 res = ctxt->current - ctxt->begin - ctrl.put; const s32 res = ctxt->current - ctxt->begin - ctrl.put;
if(res > 0) Memory.Copy(ctxt->begin, ctxt->current - res, res); if(res > 0) Memory.Copy(ctxt->begin, ctxt->current - res, res);
ctxt->current = ctxt->begin + res; ctxt->current = ctxt->begin + res;
ctrl.put = res; ctrl.put = res;
ctrl.get = 0; ctrl.get = 0;
} }
current = ctxt->current; current = ctxt->current;
@ -575,9 +575,7 @@ int32_t cellGcmIoOffsetToAddress(u32 ioOffset, u64 address)
{ {
u64 realAddr; u64 realAddr;
realAddr = Memory.RSXIOMem.getRealAddr(Memory.RSXIOMem.GetStartAddr() + ioOffset); if (!Memory.RSXIOMem.getRealAddr(Memory.RSXIOMem.GetStartAddr() + ioOffset, realAddr))
if (!realAddr)
return CELL_GCM_ERROR_FAILURE; return CELL_GCM_ERROR_FAILURE;
Memory.Write64(address, realAddr); Memory.Write64(address, realAddr);

View File

@ -169,6 +169,10 @@ int cellPamfVerify(mem_ptr_t<PamfHeader> pAddr, u64 fileSize)
int cellPamfReaderInitialize(mem_ptr_t<CellPamfReader> pSelf, mem_ptr_t<PamfHeader> pAddr, u64 fileSize, u32 attribute) int cellPamfReaderInitialize(mem_ptr_t<CellPamfReader> pSelf, mem_ptr_t<PamfHeader> pAddr, u64 fileSize, u32 attribute)
{ {
// Skip PAMF initialization
if (Ini.SkipPamf.GetValue())
return -1;
cellPamf.Warning("cellPamfReaderInitialize(pSelf=0x%x, pAddr=0x%x, fileSize=%d, attribute=0x%x)", cellPamf.Warning("cellPamfReaderInitialize(pSelf=0x%x, pAddr=0x%x, fileSize=%d, attribute=0x%x)",
pSelf.GetAddr(), pAddr.GetAddr(), fileSize, attribute); pSelf.GetAddr(), pAddr.GetAddr(), fileSize, attribute);

View File

@ -201,7 +201,7 @@ int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m
case CELL_PNGDEC_ARGB: case CELL_PNGDEC_ARGB:
{ {
const char nComponents = 4; const int nComponents = 4;
image_size *= nComponents; image_size *= nComponents;
if (bytesPerLine > width * nComponents || flip) //check if we need padding if (bytesPerLine > width * nComponents || flip) //check if we need padding
{ {
@ -225,13 +225,19 @@ int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m
} }
else else
{ {
for (uint i = 0; i < image_size; i += nComponents) uint* dest = (uint*)new char[image_size];
uint* source_current = (uint*)&(image.get()[0]);
uint* dest_current = dest;
for (uint i = 0; i < image_size / nComponents; i++)
{ {
data += image.get()[i + 3]; uint val = *source_current;
data += image.get()[i + 0]; *dest_current = (val >> 24) | (val << 8); // set alpha (A8) as leftmost byte
data += image.get()[i + 1]; source_current++;
data += image.get()[i + 2]; dest_current++;
} }
// NOTE: AppendRawBytes has diff side-effect vs Memory.CopyFromReal
data.AppendRawBytes((u8*)dest, image_size);
delete[] dest;
} }
} }
break; break;

View File

@ -372,6 +372,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event))
wxCheckBox* chbox_gs_log_prog = new wxCheckBox(p_graphics, wxID_ANY, "Log vertex/fragment programs"); wxCheckBox* chbox_gs_log_prog = new wxCheckBox(p_graphics, wxID_ANY, "Log vertex/fragment programs");
wxCheckBox* chbox_gs_dump_depth = new wxCheckBox(p_graphics, wxID_ANY, "Write Depth Buffer"); wxCheckBox* chbox_gs_dump_depth = new wxCheckBox(p_graphics, wxID_ANY, "Write Depth Buffer");
wxCheckBox* chbox_gs_dump_color = new wxCheckBox(p_graphics, wxID_ANY, "Write Color Buffers"); wxCheckBox* chbox_gs_dump_color = new wxCheckBox(p_graphics, wxID_ANY, "Write Color Buffers");
wxCheckBox* chbox_skip_pamf = new wxCheckBox(p_graphics, wxID_ANY, "Skip Pamf");
wxCheckBox* chbox_gs_vsync = new wxCheckBox(p_graphics, wxID_ANY, "VSync"); wxCheckBox* chbox_gs_vsync = new wxCheckBox(p_graphics, wxID_ANY, "VSync");
wxCheckBox* chbox_audio_dump = new wxCheckBox(p_audio, wxID_ANY, "Dump to file"); wxCheckBox* chbox_audio_dump = new wxCheckBox(p_audio, wxID_ANY, "Dump to file");
wxCheckBox* chbox_hle_logging = new wxCheckBox(p_hle, wxID_ANY, "Log all SysCalls"); wxCheckBox* chbox_hle_logging = new wxCheckBox(p_hle, wxID_ANY, "Log all SysCalls");
@ -400,6 +401,9 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event))
cbox_pad_handler->Append("Null"); cbox_pad_handler->Append("Null");
cbox_pad_handler->Append("Windows"); cbox_pad_handler->Append("Windows");
#if defined (_WIN32)
cbox_pad_handler->Append("XInput");
#endif
//cbox_pad_handler->Append("DirectInput"); //cbox_pad_handler->Append("DirectInput");
cbox_keyboard_handler->Append("Null"); cbox_keyboard_handler->Append("Null");
@ -444,6 +448,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event))
chbox_gs_log_prog ->SetValue(Ini.GSLogPrograms.GetValue()); chbox_gs_log_prog ->SetValue(Ini.GSLogPrograms.GetValue());
chbox_gs_dump_depth ->SetValue(Ini.GSDumpDepthBuffer.GetValue()); chbox_gs_dump_depth ->SetValue(Ini.GSDumpDepthBuffer.GetValue());
chbox_gs_dump_color ->SetValue(Ini.GSDumpColorBuffers.GetValue()); chbox_gs_dump_color ->SetValue(Ini.GSDumpColorBuffers.GetValue());
chbox_skip_pamf ->SetValue(Ini.SkipPamf.GetValue());
chbox_gs_vsync ->SetValue(Ini.GSVSyncEnable.GetValue()); chbox_gs_vsync ->SetValue(Ini.GSVSyncEnable.GetValue());
chbox_audio_dump ->SetValue(Ini.AudioDumpToFile.GetValue()); chbox_audio_dump ->SetValue(Ini.AudioDumpToFile.GetValue());
chbox_hle_logging ->SetValue(Ini.HLELogging.GetValue()); chbox_hle_logging ->SetValue(Ini.HLELogging.GetValue());
@ -499,6 +504,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event))
s_subpanel_graphics->Add(chbox_gs_log_prog, wxSizerFlags().Border(wxALL, 5).Expand()); s_subpanel_graphics->Add(chbox_gs_log_prog, wxSizerFlags().Border(wxALL, 5).Expand());
s_subpanel_graphics->Add(chbox_gs_dump_depth, wxSizerFlags().Border(wxALL, 5).Expand()); s_subpanel_graphics->Add(chbox_gs_dump_depth, wxSizerFlags().Border(wxALL, 5).Expand());
s_subpanel_graphics->Add(chbox_gs_dump_color, wxSizerFlags().Border(wxALL, 5).Expand()); s_subpanel_graphics->Add(chbox_gs_dump_color, wxSizerFlags().Border(wxALL, 5).Expand());
s_subpanel_graphics->Add(chbox_skip_pamf, wxSizerFlags().Border(wxALL, 5).Expand());
s_subpanel_graphics->Add(chbox_gs_vsync, wxSizerFlags().Border(wxALL, 5).Expand()); s_subpanel_graphics->Add(chbox_gs_vsync, wxSizerFlags().Border(wxALL, 5).Expand());
// Input - Output // Input - Output
@ -548,6 +554,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event))
Ini.GSLogPrograms.SetValue(chbox_gs_log_prog->GetValue()); Ini.GSLogPrograms.SetValue(chbox_gs_log_prog->GetValue());
Ini.GSDumpDepthBuffer.SetValue(chbox_gs_dump_depth->GetValue()); Ini.GSDumpDepthBuffer.SetValue(chbox_gs_dump_depth->GetValue());
Ini.GSDumpColorBuffers.SetValue(chbox_gs_dump_color->GetValue()); Ini.GSDumpColorBuffers.SetValue(chbox_gs_dump_color->GetValue());
Ini.SkipPamf.SetValue(chbox_skip_pamf->GetValue());
Ini.PadHandlerMode.SetValue(cbox_pad_handler->GetSelection()); Ini.PadHandlerMode.SetValue(cbox_pad_handler->GetSelection());
Ini.KeyboardHandlerMode.SetValue(cbox_keyboard_handler->GetSelection()); Ini.KeyboardHandlerMode.SetValue(cbox_keyboard_handler->GetSelection());
Ini.MouseHandlerMode.SetValue(cbox_mouse_handler->GetSelection()); Ini.MouseHandlerMode.SetValue(cbox_mouse_handler->GetSelection());

View File

@ -322,20 +322,28 @@ void RSXDebugger::GoToGet(wxCommandEvent& event)
{ {
if (!RSXReady()) return; if (!RSXReady()) return;
CellGcmControl* ctrl = (CellGcmControl*)&Memory[Emu.GetGSManager().GetRender().m_ctrlAddress]; CellGcmControl* ctrl = (CellGcmControl*)&Memory[Emu.GetGSManager().GetRender().m_ctrlAddress];
m_addr = Memory.RSXIOMem.getRealAddr(Memory.RSXIOMem.GetStartAddr() + ctrl->get); u64 realAddr;
t_addr->SetValue(wxString::Format("%08x", m_addr)); if (Memory.RSXIOMem.getRealAddr(Memory.RSXIOMem.GetStartAddr() + ctrl->get, realAddr)) {
UpdateInformation(); m_addr = realAddr; // WARNING: Potential Truncation? Cast from u64 to u32
event.Skip(); t_addr->SetValue(wxString::Format("%08x", m_addr));
UpdateInformation();
event.Skip();
}
// TODO: We should probably throw something?
} }
void RSXDebugger::GoToPut(wxCommandEvent& event) void RSXDebugger::GoToPut(wxCommandEvent& event)
{ {
if (!RSXReady()) return; if (!RSXReady()) return;
CellGcmControl* ctrl = (CellGcmControl*)&Memory[Emu.GetGSManager().GetRender().m_ctrlAddress]; CellGcmControl* ctrl = (CellGcmControl*)&Memory[Emu.GetGSManager().GetRender().m_ctrlAddress];
m_addr = Memory.RSXIOMem.getRealAddr(Memory.RSXIOMem.GetStartAddr() + ctrl->put); u64 realAddr;
t_addr->SetValue(wxString::Format("%08x", m_addr)); if (Memory.RSXIOMem.getRealAddr(Memory.RSXIOMem.GetStartAddr() + ctrl->put, realAddr)) {
UpdateInformation(); m_addr = realAddr; // WARNING: Potential Truncation? Cast from u64 to u32
event.Skip(); t_addr->SetValue(wxString::Format("%08x", m_addr));
UpdateInformation();
event.Skip();
}
// TODO: We should probably throw something?
} }
void RSXDebugger::UpdateInformation() void RSXDebugger::UpdateInformation()

View File

@ -117,6 +117,7 @@ public:
IniEntry<bool> HLEExitOnStop; IniEntry<bool> HLEExitOnStop;
IniEntry<u8> HLELogLvl; IniEntry<u8> HLELogLvl;
IniEntry<u8> SysLanguage; IniEntry<u8> SysLanguage;
IniEntry<bool> SkipPamf;
IniEntry<int> PadHandlerLStickLeft; IniEntry<int> PadHandlerLStickLeft;
IniEntry<int> PadHandlerLStickDown; IniEntry<int> PadHandlerLStickDown;
@ -161,6 +162,7 @@ public:
GSLogPrograms.Init("LogPrograms", path); GSLogPrograms.Init("LogPrograms", path);
GSDumpColorBuffers.Init("DumpColorBuffers", path); GSDumpColorBuffers.Init("DumpColorBuffers", path);
GSDumpDepthBuffer.Init("DumpDepthBuffer", path); GSDumpDepthBuffer.Init("DumpDepthBuffer", path);
SkipPamf.Init("SkipPamf", path);
path = DefPath + "/" + "IO"; path = DefPath + "/" + "IO";
PadHandlerMode.Init("PadHandlerMode", path); PadHandlerMode.Init("PadHandlerMode", path);
@ -221,6 +223,7 @@ public:
GSLogPrograms.Load(false); GSLogPrograms.Load(false);
GSDumpColorBuffers.Load(false); GSDumpColorBuffers.Load(false);
GSDumpDepthBuffer.Load(false); GSDumpDepthBuffer.Load(false);
SkipPamf.Load(false);
PadHandlerMode.Load(1); PadHandlerMode.Load(1);
KeyboardHandlerMode.Load(0); KeyboardHandlerMode.Load(0);
MouseHandlerMode.Load(0); MouseHandlerMode.Load(0);
@ -271,6 +274,7 @@ public:
GSLogPrograms.Save(); GSLogPrograms.Save();
GSDumpColorBuffers.Save(); GSDumpColorBuffers.Save();
GSDumpDepthBuffer.Save(); GSDumpDepthBuffer.Save();
SkipPamf.Save();
PadHandlerMode.Save(); PadHandlerMode.Save();
KeyboardHandlerMode.Save(); KeyboardHandlerMode.Save();
MouseHandlerMode.Save(); MouseHandlerMode.Save();

View File

@ -350,6 +350,7 @@
<ClCompile Include="Emu\Io\Keyboard.cpp" /> <ClCompile Include="Emu\Io\Keyboard.cpp" />
<ClCompile Include="Emu\Io\Mouse.cpp" /> <ClCompile Include="Emu\Io\Mouse.cpp" />
<ClCompile Include="Emu\Io\Pad.cpp" /> <ClCompile Include="Emu\Io\Pad.cpp" />
<ClCompile Include="Emu\Io\XInput\XInputPadHandler.cpp" />
<ClCompile Include="Emu\Memory\Memory.cpp" /> <ClCompile Include="Emu\Memory\Memory.cpp" />
<ClCompile Include="Emu\SysCalls\Callback.cpp" /> <ClCompile Include="Emu\SysCalls\Callback.cpp" />
<ClCompile Include="Emu\SysCalls\FuncList.cpp" /> <ClCompile Include="Emu\SysCalls\FuncList.cpp" />
@ -544,6 +545,7 @@
<ClInclude Include="Emu\Io\Windows\WindowsKeyboardHandler.h" /> <ClInclude Include="Emu\Io\Windows\WindowsKeyboardHandler.h" />
<ClInclude Include="Emu\Io\Windows\WindowsMouseHandler.h" /> <ClInclude Include="Emu\Io\Windows\WindowsMouseHandler.h" />
<ClInclude Include="Emu\Io\Windows\WindowsPadHandler.h" /> <ClInclude Include="Emu\Io\Windows\WindowsPadHandler.h" />
<ClInclude Include="Emu\Io\XInput\XInputPadHandler.h" />
<ClInclude Include="Emu\Memory\Memory.h" /> <ClInclude Include="Emu\Memory\Memory.h" />
<ClInclude Include="Emu\Memory\MemoryBlock.h" /> <ClInclude Include="Emu\Memory\MemoryBlock.h" />
<ClInclude Include="Emu\SysCalls\Callback.h" /> <ClInclude Include="Emu\SysCalls\Callback.h" />

View File

@ -71,6 +71,9 @@
<Filter Include="Emu\Io\Windows"> <Filter Include="Emu\Io\Windows">
<UniqueIdentifier>{899523fa-c26a-44ea-b272-73c4585e3821}</UniqueIdentifier> <UniqueIdentifier>{899523fa-c26a-44ea-b272-73c4585e3821}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Emu\Io\XInput">
<UniqueIdentifier>{a77ab520-4399-4c95-a7ee-985c9a5ad694}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="rpcs3.cpp"> <ClCompile Include="rpcs3.cpp">
@ -505,6 +508,9 @@
<ClCompile Include="Crypto\lz.cpp"> <ClCompile Include="Crypto\lz.cpp">
<Filter>Crypto</Filter> <Filter>Crypto</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Emu\Io\XInput\XInputPadHandler.cpp">
<Filter>Emu\Io\XInput</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="rpcs3.rc" /> <ResourceCompile Include="rpcs3.rc" />
@ -990,5 +996,8 @@
<ClInclude Include="Gui\AboutDialog.h"> <ClInclude Include="Gui\AboutDialog.h">
<Filter>Gui</Filter> <Filter>Gui</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Emu\Io\XInput\XInputPadHandler.h">
<Filter>Emu\Io\XInput</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
</Project> </Project>