diff --git a/rpcs3/Emu/GS/GL/GLGSRender.cpp b/rpcs3/Emu/GS/GL/GLGSRender.cpp index 2a2910ae25..7dbc3e7d68 100644 --- a/rpcs3/Emu/GS/GL/GLGSRender.cpp +++ b/rpcs3/Emu/GS/GL/GLGSRender.cpp @@ -717,7 +717,8 @@ void GLGSRender::ExecCMD() } m_fbo.Bind(); - WriteDepthBuffer(); + if(Ini.GSDumpDepthBuffer.GetValue()) + WriteDepthBuffer(); static const GLenum draw_buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3 }; switch(m_surface_colour_target) @@ -1025,7 +1026,8 @@ void GLGSRender::ExecCMD() m_draw_array_count = 0; } - WriteBuffers(); + if(Ini.GSDumpColorBuffers.GetValue()) + WriteBuffers(); } void GLGSRender::Flip() diff --git a/rpcs3/Emu/GS/RSXThread.cpp b/rpcs3/Emu/GS/RSXThread.cpp index 1ccdf4750d..9f37b89f0a 100644 --- a/rpcs3/Emu/GS/RSXThread.cpp +++ b/rpcs3/Emu/GS/RSXThread.cpp @@ -333,6 +333,13 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 case NV4097_SET_COLOR_MASK_MRT: { + if(args[0]) ConLog.Warning("NV4097_SET_COLOR_MASK_MRT: %x", args[0]); + } + break; + + case NV4097_SET_BLEND_ENABLE_MRT: + { + if(args[0]) ConLog.Warning("NV4097_SET_BLEND_ENABLE_MRT: %x", args[0]); } break; diff --git a/rpcs3/Emu/SysCalls/Modules.cpp b/rpcs3/Emu/SysCalls/Modules.cpp index cbac0e1e82..f50beceadf 100644 --- a/rpcs3/Emu/SysCalls/Modules.cpp +++ b/rpcs3/Emu/SysCalls/Modules.cpp @@ -155,7 +155,7 @@ bool UnloadFunc(u32 id) { if(g_modules_funcs_list[i].id == id) { - g_modules_funcs_list.RemoveAt(i); + g_modules_funcs_list.RemoveFAt(i); return true; } @@ -179,21 +179,14 @@ u32 GetFuncNumById(u32 id) void UnloadModules() { - for(u32 i=0; iSetLoaded(false); - } - - if(g_modules[1][i]) - { - g_modules[1][i]->SetLoaded(false); - } - - if(g_modules[2][i]) - { - g_modules[2][i]->SetLoaded(false); + if(g_modules[i][j]) + { + g_modules[i][j]->UnLoad(); + } } } @@ -292,22 +285,28 @@ Module::Module(u16 id, const char* name) : m_is_loaded(false) , m_name(name) , m_id(id) + , m_load_func(nullptr) + , m_unload_func(nullptr) { SetModule(m_id, this, false); } -Module::Module(const char* name, void (*init)()) +Module::Module(const char* name, void (*init)(), void (*load)(), void (*unload)()) : m_is_loaded(false) , m_name(name) , m_id(-1) + , m_load_func(load) + , m_unload_func(unload) { SetModule(m_id, this, init != nullptr); if(init) init(); } -Module::Module(u16 id, void (*init)()) +Module::Module(u16 id, void (*init)(), void (*load)(), void (*unload)()) : m_is_loaded(false) , m_id(id) + , m_load_func(load) + , m_unload_func(unload) { SetModule(m_id, this, init != nullptr); if(init) init(); @@ -315,20 +314,34 @@ Module::Module(u16 id, void (*init)()) void Module::Load() { + if(IsLoaded()) + return; + + if(m_load_func) m_load_func(); + for(u32 i=0; i m_funcs_list; Module(u16 id, const char* name); - Module(const char* name, void (*init)()); - Module(u16 id, void (*init)()); + Module(const char* name, void (*init)(), void (*load)() = nullptr, void (*unload)() = nullptr); + Module(u16 id, void (*init)(), void (*load)() = nullptr, void (*unload)() = nullptr); void Load(); void UnLoad(); diff --git a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp index de922a3cb2..3c472fd52b 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp @@ -5,7 +5,8 @@ #include "cellResc.h" void cellResc_init(); -Module cellResc(0x001f, cellResc_init); +void cellResc_unload(); +Module cellResc(0x001f, cellResc_init, nullptr, cellResc_unload); // Error Codes enum @@ -551,12 +552,8 @@ int cellRescSetDisplayMode(u32 displayMode) return CELL_OK; } -int cellRescAdjustAspectRatio() +int cellRescAdjustAspectRatio(float horizontal, float vertical) { - declCPU(); - float horizontal = CPU.FPR[1]; - float vertical = CPU.FPR[2]; - cellResc.Warning("cellRescAdjustAspectRatio(horizontal=%f, vertical=%f)", horizontal, vertical); if(!s_rescInternalInstance->m_bInitialized) @@ -578,11 +575,8 @@ int cellRescAdjustAspectRatio() return CELL_OK; } -int cellRescSetPalInterpolateDropFlexRatio() +int cellRescSetPalInterpolateDropFlexRatio(float ratio) { - declCPU(); - float ratio = CPU.FPR[1]; - cellResc.Warning("cellRescSetPalInterpolateDropFlexRatio(ratio=%f)", ratio); if(!s_rescInternalInstance->m_bInitialized) @@ -747,10 +741,13 @@ int cellRescSetBufferAddress(mem32_t colorBuffers, mem32_t vertexArray, mem32_t MemoryAllocator dstOffset; cellGcmAddressToOffset(s_rescInternalInstance->m_colorBuffersEA_addr, dstOffset.GetAddr()); - for(int i=0; im_dstOffsets[i] = dstOffset + i * s_rescInternalInstance->m_dstBufInterval; } - for(int i=0; im_dstOffsets[i], s_rescInternalInstance->m_dstPitch, s_rescInternalInstance->m_dstWidth, s_rescInternalInstance->m_dstHeight); if (ret) return ret; } @@ -767,7 +764,7 @@ int cellRescSetFlipHandler(u32 handler_addr) { cellResc.Warning("cellRescSetFlipHandler(handler_addr=0x%x)", handler_addr); - if(!Memory.IsGoodAddr(handler_addr) && handler_addr != 0) + if(handler_addr != 0 && !Memory.IsGoodAddr(handler_addr)) return CELL_EFAULT; Emu.GetGSManager().GetRender().m_flip_handler.SetAddr(handler_addr); @@ -814,3 +811,8 @@ void cellResc_init() //cellResc.AddFunc(0xd3758645, cellRescSetVBlankHandler); //cellResc.AddFunc(0xe0cef79e, cellRescCreateInterlaceTable); } + +void cellResc_unload() +{ + s_rescInternalInstance->m_bInitialized = false; +} \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp index f06d896fa5..adeaf305fb 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp @@ -102,23 +102,6 @@ enum void cellSysutil_init(); Module cellSysutil(0x0015, cellSysutil_init); -int cellVideoOutGetDeviceInfo(u32 videoOut, u32 deviceIndex, mem_struct_ptr_t info) -{ - cellSysutil.Error("Unimplemented function: cellVideoOutGetDeviceInfo(videoOut=%u, deviceIndex=%u, info_addr=0x%x)", - videoOut, deviceIndex, info.GetAddr()); - - if(deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND; - - //info->portType = CELL_VIDEO_OUT_PORT_HDMI; - info->colorSpace = Emu.GetGSManager().GetColorSpace(); - //info->latency = ; - //info->availableModeCount = ; - //info->state = CELL_VIDEO_OUT_DEVICE_STATE_AVAILABLE; - //info->rgbOutputRange = ; - - return CELL_OK; -} - int cellSysutilGetSystemParamInt(int id, mem32_t value) { cellSysutil.Log("cellSysutilGetSystemParamInt(id=0x%x, value_addr=0x%x)", id, value.GetAddr()); @@ -212,13 +195,233 @@ int cellSysutilGetSystemParamInt(int id, mem32_t value) return CELL_OK; } +int cellVideoOutGetState(u32 videoOut, u32 deviceIndex, u32 state_addr) +{ + cellSysutil.Log("cellVideoOutGetState(videoOut=0x%x, deviceIndex=0x%x, state_addr=0x%x)", videoOut, deviceIndex, state_addr); + + if(deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND; + + CellVideoOutState state; + memset(&state, 0, sizeof(CellVideoOutState)); + + switch(videoOut) + { + case CELL_VIDEO_OUT_PRIMARY: + { + state.colorSpace = Emu.GetGSManager().GetColorSpace(); + state.state = Emu.GetGSManager().GetState(); + state.displayMode.resolutionId = Emu.GetGSManager().GetInfo().mode.resolutionId; + state.displayMode.scanMode = Emu.GetGSManager().GetInfo().mode.scanMode; + state.displayMode.conversion = Emu.GetGSManager().GetInfo().mode.conversion; + state.displayMode.aspect = Emu.GetGSManager().GetInfo().mode.aspect; + state.displayMode.refreshRates = re(Emu.GetGSManager().GetInfo().mode.refreshRates); + + Memory.WriteData(state_addr, state); + } + return CELL_VIDEO_OUT_SUCCEEDED; + + case CELL_VIDEO_OUT_SECONDARY: + { + state.colorSpace = CELL_VIDEO_OUT_COLOR_SPACE_RGB; + state.state = CELL_VIDEO_OUT_OUTPUT_STATE_ENABLED; + + Memory.WriteData(state_addr, state); + } + return CELL_VIDEO_OUT_SUCCEEDED; + } + + return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; +} + +int cellVideoOutGetResolution(u32 resolutionId, u32 resolution_addr) +{ + cellSysutil.Log("cellVideoOutGetResolution(resolutionId=%d, resolution_addr=0x%x)", + resolutionId, resolution_addr); + + if(!Memory.IsGoodAddr(resolution_addr, sizeof(CellVideoOutResolution))) + { + return CELL_EFAULT; + } + + u32 num = ResolutionIdToNum(resolutionId); + + if(!num) + { + return CELL_EINVAL; + } + + CellVideoOutResolution res; + re(res.width, ResolutionTable[num].width); + re(res.height, ResolutionTable[num].height); + + Memory.WriteData(resolution_addr, res); + + return CELL_VIDEO_OUT_SUCCEEDED; +} + +int cellVideoOutConfigure(u32 videoOut, u32 config_addr, u32 option_addr, u32 waitForEvent) +{ + cellSysutil.Warning("cellVideoOutConfigure(videoOut=%d, config_addr=0x%x, option_addr=0x%x, waitForEvent=0x%x)", + videoOut, config_addr, option_addr, waitForEvent); + + if(!Memory.IsGoodAddr(config_addr, sizeof(CellVideoOutConfiguration))) + { + return CELL_EFAULT; + } + + CellVideoOutConfiguration& config = (CellVideoOutConfiguration&)Memory[config_addr]; + + switch(videoOut) + { + case CELL_VIDEO_OUT_PRIMARY: + if(config.resolutionId) + { + Emu.GetGSManager().GetInfo().mode.resolutionId = config.resolutionId; + } + + Emu.GetGSManager().GetInfo().mode.format = config.format; + + if(config.aspect) + { + Emu.GetGSManager().GetInfo().mode.aspect = config.aspect; + } + + if(config.pitch) + { + Emu.GetGSManager().GetInfo().mode.pitch = re(config.pitch); + } + + return CELL_VIDEO_OUT_SUCCEEDED; + + case CELL_VIDEO_OUT_SECONDARY: + return CELL_VIDEO_OUT_SUCCEEDED; + } + + return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; +} + +int cellVideoOutGetConfiguration(u32 videoOut, u32 config_addr, u32 option_addr) +{ + cellSysutil.Warning("cellVideoOutGetConfiguration(videoOut=%d, config_addr=0x%x, option_addr=0x%x)", + videoOut, config_addr, option_addr); + + if(!Memory.IsGoodAddr(config_addr, sizeof(CellVideoOutConfiguration))) return CELL_EFAULT; + + CellVideoOutConfiguration config; + memset(&config, 0, sizeof(CellVideoOutConfiguration)); + + switch(videoOut) + { + case CELL_VIDEO_OUT_PRIMARY: + config.resolutionId = Emu.GetGSManager().GetInfo().mode.resolutionId; + config.format = Emu.GetGSManager().GetInfo().mode.format; + config.aspect = Emu.GetGSManager().GetInfo().mode.aspect; + config.pitch = re(Emu.GetGSManager().GetInfo().mode.pitch); + + Memory.WriteData(config_addr, config); + + return CELL_VIDEO_OUT_SUCCEEDED; + + case CELL_VIDEO_OUT_SECONDARY: + Memory.WriteData(config_addr, config); + + return CELL_VIDEO_OUT_SUCCEEDED; + } + + return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; +} + +int cellVideoOutGetDeviceInfo(u32 videoOut, u32 deviceIndex, mem_struct_ptr_t info) +{ + cellSysutil.Error("Unimplemented function: cellVideoOutGetDeviceInfo(videoOut=%u, deviceIndex=%u, info_addr=0x%x)", + videoOut, deviceIndex, info.GetAddr()); + + if(deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND; + + info->portType = CELL_VIDEO_OUT_PORT_HDMI; + info->colorSpace = Emu.GetGSManager().GetColorSpace(); + //info->latency = ; + //info->availableModeCount = ; + info->state = CELL_VIDEO_OUT_DEVICE_STATE_AVAILABLE; + //info->rgbOutputRange = ; + + return CELL_OK; +} + +int cellVideoOutGetNumberOfDevice(u32 videoOut) +{ + cellSysutil.Warning("cellVideoOutGetNumberOfDevice(videoOut=%d)", videoOut); + + switch(videoOut) + { + case CELL_VIDEO_OUT_PRIMARY: return 1; + case CELL_VIDEO_OUT_SECONDARY: return 0; + } + + return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; +} + +int cellVideoOutGetResolutionAvailability(u32 videoOut, u32 resolutionId, u32 aspect, u32 option) +{ + cellSysutil.Warning("cellVideoOutGetResolutionAvailability(videoOut=%d, resolutionId=0x%x, option_addr=0x%x, aspect=0x%x, option=0x%x)", + videoOut, resolutionId, aspect, option); + + if(!ResolutionIdToNum(resolutionId)) + { + return CELL_EINVAL; + } + + switch(videoOut) + { + case CELL_VIDEO_OUT_PRIMARY: return 1; + case CELL_VIDEO_OUT_SECONDARY: return 0; + } + + return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; +} + +int cellSysutilCheckCallback() +{ + //cellSysutil.Warning("cellSysutilCheckCallback()"); + Emu.GetCallbackManager().m_exit_callback.Check(); + + return CELL_OK; +} + +int cellSysutilRegisterCallback(int slot, u64 func_addr, u64 userdata) +{ + cellSysutil.Warning("cellSysutilRegisterCallback(slot=%d, func_addr=0x%llx, userdata=0x%llx)", slot, func_addr, userdata); + Emu.GetCallbackManager().m_exit_callback.Register(slot, func_addr, userdata); + + wxGetApp().SendDbgCommand(DID_REGISTRED_CALLBACK); + + return CELL_OK; +} + +int cellSysutilUnregisterCallback(int slot) +{ + cellSysutil.Warning("cellSysutilUnregisterCallback(slot=%d)", slot); + Emu.GetCallbackManager().m_exit_callback.Unregister(slot); + + wxGetApp().SendDbgCommand(DID_UNREGISTRED_CALLBACK); + + return CELL_OK; +} + + void cellSysutil_init() { - cellSysutil.AddFunc(0x0bae8772, cellVideoOutConfigure); - cellSysutil.AddFunc(0x189a74da, cellSysutilCheckCallback); - cellSysutil.AddFunc(0x1e930eef, cellVideoOutGetDeviceInfo); cellSysutil.AddFunc(0x40e895d3, cellSysutilGetSystemParamInt); + cellSysutil.AddFunc(0x887572d5, cellVideoOutGetState); - cellSysutil.AddFunc(0x9d98afa0, cellSysutilRegisterCallback); cellSysutil.AddFunc(0xe558748d, cellVideoOutGetResolution); + cellSysutil.AddFunc(0x0bae8772, cellVideoOutConfigure); + cellSysutil.AddFunc(0x15b0b0cd, cellVideoOutGetConfiguration); + cellSysutil.AddFunc(0x1e930eef, cellVideoOutGetDeviceInfo); + cellSysutil.AddFunc(0x75bbb672, cellVideoOutGetNumberOfDevice); + cellSysutil.AddFunc(0xa322db75, cellVideoOutGetResolutionAvailability); + + cellSysutil.AddFunc(0x189a74da, cellSysutilCheckCallback); + cellSysutil.AddFunc(0x9d98afa0, cellSysutilRegisterCallback); + cellSysutil.AddFunc(0x02ff3c1b, cellSysutilUnregisterCallback); } \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/SC_FUNC.h b/rpcs3/Emu/SysCalls/SC_FUNC.h index a91f5c0f25..8f5ccb5bb3 100644 --- a/rpcs3/Emu/SysCalls/SC_FUNC.h +++ b/rpcs3/Emu/SysCalls/SC_FUNC.h @@ -2,6 +2,11 @@ #define RESULT(x) SC_ARGS_1 = (x) +template struct get_arg { static __forceinline T func(PPUThread& CPU, int i) { return (T&)CPU.GPR[i + 2]; } }; +template struct get_arg { static __forceinline T func(PPUThread& CPU, int i) { return CPU.FPR[i]; } }; + +#define ARG(n) get_arg::value, T##n>::func(CPU, n) + template class binder_func_0 : public func_caller { @@ -32,7 +37,7 @@ class binder_func_1 : public func_caller public: binder_func_1(func_t call) : func_caller(), m_call(call) {} - virtual void operator()() { declCPU(); RESULT(m_call((T1&)SC_ARG_0)); } + virtual void operator()() { declCPU(); RESULT(m_call(ARG(1))); } }; template @@ -43,7 +48,7 @@ class binder_func_1 : public func_caller public: binder_func_1(func_t call) : func_caller(), m_call(call) {} - virtual void operator()() { declCPU(); m_call((T1&)SC_ARG_0); } + virtual void operator()() { declCPU(); m_call(ARG(1)); } }; template @@ -54,7 +59,7 @@ class binder_func_2 : public func_caller public: binder_func_2(func_t call) : func_caller(), m_call(call) {} - virtual void operator()() { declCPU(); RESULT(m_call((T1&)SC_ARG_0, (T2&)SC_ARG_1)); } + virtual void operator()() { declCPU(); RESULT(m_call(ARG(1), ARG(2))); } }; template @@ -65,7 +70,7 @@ class binder_func_2 : public func_caller public: binder_func_2(func_t call) : func_caller(), m_call(call) {} - virtual void operator()() { declCPU(); m_call((T1&)SC_ARG_0, (T2&)SC_ARG_1); } + virtual void operator()() { declCPU(); m_call(ARG(1), ARG(2)); } }; template @@ -76,7 +81,7 @@ class binder_func_3 : public func_caller public: binder_func_3(func_t call) : func_caller(), m_call(call) {} - virtual void operator()() { declCPU(); RESULT(m_call((T1&)SC_ARG_0, (T2&)SC_ARG_1, (T3&)SC_ARG_2)); } + virtual void operator()() { declCPU(); RESULT(m_call(ARG(1), ARG(2), ARG(3))); } }; template @@ -87,7 +92,7 @@ class binder_func_3 : public func_caller public: binder_func_3(func_t call) : func_caller(), m_call(call) {} - virtual void operator()() { declCPU(); m_call((T1&)SC_ARG_0, (T2&)SC_ARG_1, (T3&)SC_ARG_2); } + virtual void operator()() { declCPU(); m_call(ARG(1), ARG(2), ARG(3)); } }; template @@ -98,7 +103,7 @@ class binder_func_4 : public func_caller public: binder_func_4(func_t call) : func_caller(), m_call(call) {} - virtual void operator()() { declCPU(); RESULT(m_call((T1&)SC_ARG_0, (T2&)SC_ARG_1, (T3&)SC_ARG_2, (T4&)SC_ARG_3)); } + virtual void operator()() { declCPU(); RESULT(m_call(ARG(1), ARG(2), ARG(3), ARG(4))); } }; template @@ -109,7 +114,7 @@ class binder_func_4 : public func_caller public: binder_func_4(func_t call) : func_caller(), m_call(call) {} - virtual void operator()() { declCPU(); m_call((T1&)SC_ARG_0, (T2&)SC_ARG_1, (T3&)SC_ARG_2, (T4&)SC_ARG_3); } + virtual void operator()() { declCPU(); m_call(ARG(1), ARG(2), ARG(3), ARG(4)); } }; template @@ -120,7 +125,7 @@ class binder_func_5 : public func_caller public: binder_func_5(func_t call) : func_caller(), m_call(call) {} - virtual void operator()() { declCPU(); RESULT(m_call((T1&)SC_ARG_0, (T2&)SC_ARG_1, (T3&)SC_ARG_2, (T4&)SC_ARG_3, (T5&)SC_ARG_4)); } + virtual void operator()() { declCPU(); RESULT(m_call(ARG(1), ARG(2), ARG(3), ARG(4), ARG(5))); } }; template @@ -131,7 +136,7 @@ class binder_func_5 : public func_caller public: binder_func_5(func_t call) : func_caller(), m_call(call) {} - virtual void operator()() { declCPU(); m_call((T1&)SC_ARG_0, (T2&)SC_ARG_1, (T3&)SC_ARG_2, (T4&)SC_ARG_3, (T5&)SC_ARG_4); } + virtual void operator()() { declCPU(); m_call(ARG(1), ARG(2), ARG(3), ARG(4), ARG(5)); } }; template @@ -142,7 +147,7 @@ class binder_func_6 : public func_caller public: binder_func_6(func_t call) : func_caller(), m_call(call) {} - virtual void operator()() { declCPU(); RESULT(m_call((T1&)SC_ARG_0, (T2&)SC_ARG_1, (T3&)SC_ARG_2, (T4&)SC_ARG_3, (T5&)SC_ARG_4, (T6&)SC_ARG_5)); } + virtual void operator()() { declCPU(); RESULT(m_call(ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6))); } }; template @@ -153,7 +158,7 @@ class binder_func_6 : public func_caller public: binder_func_6(func_t call) : func_caller(), m_call(call) {} - virtual void operator()() { declCPU(); m_call((T1&)SC_ARG_0, (T2&)SC_ARG_1, (T3&)SC_ARG_2, (T4&)SC_ARG_3, (T5&)SC_ARG_4, (T6&)SC_ARG_5); } + virtual void operator()() { declCPU(); m_call(ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6)); } }; template @@ -164,7 +169,7 @@ class binder_func_7 : public func_caller public: binder_func_7(func_t call) : func_caller(), m_call(call) {} - virtual void operator()() { declCPU(); RESULT(m_call((T1&)SC_ARG_0, (T2&)SC_ARG_1, (T3&)SC_ARG_2, (T4&)SC_ARG_3, (T5&)SC_ARG_4, (T6&)SC_ARG_5, (T7&)SC_ARG_6)); } + virtual void operator()() { declCPU(); RESULT(m_call(ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7))); } }; template @@ -175,7 +180,7 @@ class binder_func_7 : public func_caller public: binder_func_7(func_t call) : func_caller(), m_call(call) {} - virtual void operator()() { declCPU(); m_call((T1&)SC_ARG_0, (T2&)SC_ARG_1, (T3&)SC_ARG_2, (T4&)SC_ARG_3, (T5&)SC_ARG_4, (T6&)SC_ARG_5, (T7&)SC_ARG_6); } + virtual void operator()() { declCPU(); m_call(ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7)); } }; template @@ -186,7 +191,7 @@ class binder_func_8 : public func_caller public: binder_func_8(func_t call) : func_caller(), m_call(call) {} - virtual void operator()() { declCPU(); RESULT(m_call((T1&)SC_ARG_0, (T2&)SC_ARG_1, (T3&)SC_ARG_2, (T4&)SC_ARG_3, (T5&)SC_ARG_4, (T6&)SC_ARG_5, (T7&)SC_ARG_6, (T8&)SC_ARG_7)); } + virtual void operator()() { declCPU(); RESULT(m_call(ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8))); } }; template @@ -197,7 +202,7 @@ class binder_func_8 : public func_caller public: binder_func_8(func_t call) : func_caller(), m_call(call) {} - virtual void operator()() { declCPU(); m_call((T1&)SC_ARG_0, (T2&)SC_ARG_1, (T3&)SC_ARG_2, (T4&)SC_ARG_3, (T5&)SC_ARG_4, (T6&)SC_ARG_5, (T7&)SC_ARG_6, (T8&)SC_ARG_7); } + virtual void operator()() { declCPU(); m_call(ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8)); } }; template @@ -208,7 +213,7 @@ class binder_func_9 : public func_caller public: binder_func_9(func_t call) : func_caller(), m_call(call) {} - virtual void operator()() { declCPU(); RESULT(m_call((T1&)SC_ARG_0, (T2&)SC_ARG_1, (T3&)SC_ARG_2, (T4&)SC_ARG_3, (T5&)SC_ARG_4, (T6&)SC_ARG_5, (T7&)SC_ARG_6, (T8&)SC_ARG_7, (T9&)SC_ARG_8)); } + virtual void operator()() { declCPU(); RESULT(m_call(ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8), ARG(9))); } }; template @@ -219,7 +224,7 @@ class binder_func_9 : public func_call public: binder_func_9(func_t call) : func_caller(), m_call(call) {} - virtual void operator()() { declCPU(); m_call((T1&)SC_ARG_0, (T2&)SC_ARG_1, (T3&)SC_ARG_2, (T4&)SC_ARG_3, (T5&)SC_ARG_4, (T6&)SC_ARG_5, (T7&)SC_ARG_6, (T8&)SC_ARG_7, (T9&)SC_ARG_8); } + virtual void operator()() { declCPU(); m_call(ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8), ARG(9)); } }; template @@ -230,7 +235,7 @@ class binder_func_10 : public func_caller public: binder_func_10(func_t call) : func_caller(), m_call(call) {} - virtual void operator()() { declCPU(); RESULT(m_call((T1&)SC_ARG_0, (T2&)SC_ARG_1, (T3&)SC_ARG_2, (T4&)SC_ARG_3, (T5&)SC_ARG_4, (T6&)SC_ARG_5, (T7&)SC_ARG_6, (T8&)SC_ARG_7, (T9&)SC_ARG_8, (T10&)SC_ARG_9)); } + virtual void operator()() { declCPU(); RESULT(m_call(ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8), ARG(9), ARG(10))); } }; template @@ -241,7 +246,7 @@ class binder_func_10 : public fun public: binder_func_10(func_t call) : func_caller(), m_call(call) {} - virtual void operator()() { declCPU(); m_call((T1&)SC_ARG_0, (T2&)SC_ARG_1, (T3&)SC_ARG_2, (T4&)SC_ARG_3, (T5&)SC_ARG_4, (T6&)SC_ARG_5, (T7&)SC_ARG_6, (T8&)SC_ARG_7, (T9&)SC_ARG_8, (T10&)SC_ARG_9); } + virtual void operator()() { declCPU(); m_call(ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8), ARG(9), ARG(10), ARG(11)); } }; template @@ -252,7 +257,7 @@ class binder_func_11 : public func_caller public: binder_func_11(func_t call) : func_caller(), m_call(call) {} - virtual void operator()() { declCPU(); RESULT(m_call((T1&)SC_ARG_0, (T2&)SC_ARG_1, (T3&)SC_ARG_2, (T4&)SC_ARG_3, (T5&)SC_ARG_4, (T6&)SC_ARG_5, (T7&)SC_ARG_6, (T8&)SC_ARG_7, (T9&)SC_ARG_8, (T10&)SC_ARG_9, (T11&)SC_ARG_10)); } + virtual void operator()() { declCPU(); RESULT(m_call(ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8), ARG(9), ARG(10), ARG(11))); } }; template @@ -263,7 +268,7 @@ class binder_func_11 : publi public: binder_func_11(func_t call) : func_caller(), m_call(call) {} - virtual void operator()() { declCPU(); m_call((T1&)SC_ARG_0, (T2&)SC_ARG_1, (T3&)SC_ARG_2, (T4&)SC_ARG_3, (T5&)SC_ARG_4, (T6&)SC_ARG_5, (T7&)SC_ARG_6, (T8&)SC_ARG_7, (T9&)SC_ARG_8, (T10&)SC_ARG_9, (T11&)SC_ARG_10); } + virtual void operator()() { declCPU(); m_call(ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8), ARG(9), ARG(10), ARG(11)); } }; template @@ -274,7 +279,7 @@ class binder_func_12 : public func_caller public: binder_func_12(func_t call) : func_caller(), m_call(call) {} - virtual void operator()() { declCPU(); RESULT(m_call((T1&)SC_ARG_0, (T2&)SC_ARG_1, (T3&)SC_ARG_2, (T4&)SC_ARG_3, (T5&)SC_ARG_4, (T6&)SC_ARG_5, (T7&)SC_ARG_6, (T8&)SC_ARG_7, (T9&)SC_ARG_8, (T10&)SC_ARG_9, (T11&)SC_ARG_10, (T12&)SC_ARG_11)); } + virtual void operator()() { declCPU(); RESULT(m_call(ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8), ARG(9), ARG(10), ARG(11), ARG(12))); } }; template @@ -285,7 +290,7 @@ class binder_func_12 : public: binder_func_12(func_t call) : func_caller(), m_call(call) {} - virtual void operator()() { declCPU(); m_call((T1&)SC_ARG_0, (T2&)SC_ARG_1, (T3&)SC_ARG_2, (T4&)SC_ARG_3, (T5&)SC_ARG_4, (T6&)SC_ARG_5, (T7&)SC_ARG_6, (T8&)SC_ARG_7, (T9&)SC_ARG_8, (T10&)SC_ARG_9, (T11&)SC_ARG_10, (T12&)SC_ARG_11); } + virtual void operator()() { declCPU(); m_call(ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8), ARG(9), ARG(10), ARG(11), ARG(12)); } }; template @@ -364,4 +369,6 @@ template(call); -} \ No newline at end of file +} + +#undef ARG(n) \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/SysCalls.h b/rpcs3/Emu/SysCalls/SysCalls.h index f1d326ed2f..7107953d1f 100644 --- a/rpcs3/Emu/SysCalls/SysCalls.h +++ b/rpcs3/Emu/SysCalls/SysCalls.h @@ -208,11 +208,6 @@ extern int cellVideoOutGetConfiguration(u32 videoOut, u32 config_addr, u32 optio extern int cellVideoOutGetNumberOfDevice(u32 videoOut); extern int cellVideoOutGetResolutionAvailability(u32 videoOut, u32 resolutionId, u32 aspect, u32 option); -//cellSysutil -extern int cellSysutilCheckCallback(); -extern int cellSysutilRegisterCallback(int slot, u64 func_addr, u64 userdata); -extern int cellSysutilUnregisterCallback(int slot); - //cellMsgDialog extern int cellMsgDialogOpen2(u32 type, u32 msgString_addr, u32 callback_addr, u32 userData, u32 extParam); diff --git a/rpcs3/Emu/SysCalls/lv2/SC_SysUtil.cpp b/rpcs3/Emu/SysCalls/lv2/SC_SysUtil.cpp deleted file mode 100644 index 4a223aeab0..0000000000 --- a/rpcs3/Emu/SysCalls/lv2/SC_SysUtil.cpp +++ /dev/null @@ -1,204 +0,0 @@ -#include "stdafx.h" -#include "Emu/GS/sysutil_video.h" -#include "Emu/SysCalls/SysCalls.h" - -//cellVideo -SysCallBase sc_v("cellVideo"); - -int cellVideoOutGetState(u32 videoOut, u32 deviceIndex, u32 state_addr) -{ - sc_v.Log("cellVideoOutGetState(videoOut=0x%x, deviceIndex=0x%x, state_addr=0x%x)", videoOut, deviceIndex, state_addr); - - if(deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND; - - CellVideoOutState state; - memset(&state, 0, sizeof(CellVideoOutState)); - - switch(videoOut) - { - case CELL_VIDEO_OUT_PRIMARY: - { - state.colorSpace = Emu.GetGSManager().GetColorSpace(); - state.state = Emu.GetGSManager().GetState(); - state.displayMode.resolutionId = Emu.GetGSManager().GetInfo().mode.resolutionId; - state.displayMode.scanMode = Emu.GetGSManager().GetInfo().mode.scanMode; - state.displayMode.conversion = Emu.GetGSManager().GetInfo().mode.conversion; - state.displayMode.aspect = Emu.GetGSManager().GetInfo().mode.aspect; - state.displayMode.refreshRates = re(Emu.GetGSManager().GetInfo().mode.refreshRates); - - Memory.WriteData(state_addr, state); - } - return CELL_VIDEO_OUT_SUCCEEDED; - - case CELL_VIDEO_OUT_SECONDARY: - { - state.colorSpace = CELL_VIDEO_OUT_COLOR_SPACE_RGB; - state.state = CELL_VIDEO_OUT_OUTPUT_STATE_ENABLED; - - Memory.WriteData(state_addr, state); - } - return CELL_VIDEO_OUT_SUCCEEDED; - } - - return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; -} - -int cellVideoOutGetResolution(u32 resolutionId, u32 resolution_addr) -{ - sc_v.Log("cellVideoOutGetResolution(resolutionId=%d, resolution_addr=0x%x)", - resolutionId, resolution_addr); - - if(!Memory.IsGoodAddr(resolution_addr, sizeof(CellVideoOutResolution))) - { - return CELL_EFAULT; - } - - u32 num = ResolutionIdToNum(resolutionId); - - if(!num) - { - return CELL_EINVAL; - } - - CellVideoOutResolution res; - re(res.width, ResolutionTable[num].width); - re(res.height, ResolutionTable[num].height); - - Memory.WriteData(resolution_addr, res); - - return CELL_VIDEO_OUT_SUCCEEDED; -} - -int cellVideoOutConfigure(u32 videoOut, u32 config_addr, u32 option_addr, u32 waitForEvent) -{ - sc_v.Warning("cellVideoOutConfigure(videoOut=%d, config_addr=0x%x, option_addr=0x%x, waitForEvent=0x%x)", - videoOut, config_addr, option_addr, waitForEvent); - - if(!Memory.IsGoodAddr(config_addr, sizeof(CellVideoOutConfiguration))) - { - return CELL_EFAULT; - } - - CellVideoOutConfiguration& config = (CellVideoOutConfiguration&)Memory[config_addr]; - - switch(videoOut) - { - case CELL_VIDEO_OUT_PRIMARY: - if(config.resolutionId) - { - Emu.GetGSManager().GetInfo().mode.resolutionId = config.resolutionId; - } - - Emu.GetGSManager().GetInfo().mode.format = config.format; - - if(config.aspect) - { - Emu.GetGSManager().GetInfo().mode.aspect = config.aspect; - } - - if(config.pitch) - { - Emu.GetGSManager().GetInfo().mode.pitch = re(config.pitch); - } - - return CELL_VIDEO_OUT_SUCCEEDED; - - case CELL_VIDEO_OUT_SECONDARY: - return CELL_VIDEO_OUT_SUCCEEDED; - } - - return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; -} - -int cellVideoOutGetConfiguration(u32 videoOut, u32 config_addr, u32 option_addr) -{ - sc_v.Warning("cellVideoOutGetConfiguration(videoOut=%d, config_addr=0x%x, option_addr=0x%x)", - videoOut, config_addr, option_addr); - - if(!Memory.IsGoodAddr(config_addr, sizeof(CellVideoOutConfiguration))) return CELL_EFAULT; - - CellVideoOutConfiguration config; - memset(&config, 0, sizeof(CellVideoOutConfiguration)); - - switch(videoOut) - { - case CELL_VIDEO_OUT_PRIMARY: - config.resolutionId = Emu.GetGSManager().GetInfo().mode.resolutionId; - config.format = Emu.GetGSManager().GetInfo().mode.format; - config.aspect = Emu.GetGSManager().GetInfo().mode.aspect; - config.pitch = re(Emu.GetGSManager().GetInfo().mode.pitch); - - Memory.WriteData(config_addr, config); - - return CELL_VIDEO_OUT_SUCCEEDED; - - case CELL_VIDEO_OUT_SECONDARY: - Memory.WriteData(config_addr, config); - - return CELL_VIDEO_OUT_SUCCEEDED; - } - - return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; -} - -int cellVideoOutGetNumberOfDevice(u32 videoOut) -{ - sc_v.Warning("cellVideoOutGetNumberOfDevice(videoOut=%d)", videoOut); - - switch(videoOut) - { - case CELL_VIDEO_OUT_PRIMARY: return 1; - case CELL_VIDEO_OUT_SECONDARY: return 0; - } - - return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; -} - -int cellVideoOutGetResolutionAvailability(u32 videoOut, u32 resolutionId, u32 aspect, u32 option) -{ - sc_v.Warning("cellVideoOutGetResolutionAvailability(videoOut=%d, resolutionId=0x%x, option_addr=0x%x, aspect=0x%x, option=0x%x)", - videoOut, resolutionId, aspect, option); - - if(!ResolutionIdToNum(resolutionId)) - { - return CELL_EINVAL; - } - - switch(videoOut) - { - case CELL_VIDEO_OUT_PRIMARY: return 1; - case CELL_VIDEO_OUT_SECONDARY: return 0; - } - - return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; -} - -SysCallBase sc_sysutil("cellSysutil"); - -int cellSysutilCheckCallback() -{ - //sc_sysutil.Warning("cellSysutilCheckCallback()"); - Emu.GetCallbackManager().m_exit_callback.Check(); - - return CELL_OK; -} - -int cellSysutilRegisterCallback(int slot, u64 func_addr, u64 userdata) -{ - sc_sysutil.Warning("cellSysutilRegisterCallback(slot=%d, func_addr=0x%llx, userdata=0x%llx)", slot, func_addr, userdata); - Emu.GetCallbackManager().m_exit_callback.Register(slot, func_addr, userdata); - - wxGetApp().SendDbgCommand(DID_REGISTRED_CALLBACK); - - return CELL_OK; -} - -int cellSysutilUnregisterCallback(int slot) -{ - sc_sysutil.Warning("cellSysutilUnregisterCallback(slot=%d)", slot); - Emu.GetCallbackManager().m_exit_callback.Unregister(slot); - - wxGetApp().SendDbgCommand(DID_UNREGISTRED_CALLBACK); - - return CELL_OK; -} diff --git a/rpcs3/Gui/MainFrame.cpp b/rpcs3/Gui/MainFrame.cpp index 551501fc3c..3333064fa4 100644 --- a/rpcs3/Gui/MainFrame.cpp +++ b/rpcs3/Gui/MainFrame.cpp @@ -367,6 +367,8 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) wxComboBox* cbox_keyboard_handler = new wxComboBox(&diag, wxID_ANY); wxComboBox* cbox_mouse_handler = new wxComboBox(&diag, wxID_ANY); + wxCheckBox* chbox_gs_dump_depth = new wxCheckBox(&diag, wxID_ANY, "Dump Depth Buffer"); + wxCheckBox* chbox_gs_dump_color = new wxCheckBox(&diag, wxID_ANY, "Dump Color Buffers"); wxCheckBox* chbox_gs_vsync = new wxCheckBox(&diag, wxID_ANY, "VSync"); //cbox_cpu_decoder->Append("DisAsm"); @@ -397,6 +399,8 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) cbox_mouse_handler->Append("Windows"); //cbox_mouse_handler->Append("DirectInput"); + chbox_gs_dump_depth->SetValue(Ini.GSDumpDepthBuffer.GetValue()); + chbox_gs_dump_color->SetValue(Ini.GSDumpColorBuffers.GetValue()); chbox_gs_vsync->SetValue(Ini.GSVSyncEnable.GetValue()); cbox_cpu_decoder->SetSelection(Ini.CPUDecoderMode.GetValue() ? Ini.CPUDecoderMode.GetValue() - 1 : 0); @@ -416,6 +420,8 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) s_round_gs->Add(s_round_gs_render, wxSizerFlags().Border(wxALL, 5).Expand()); s_round_gs->Add(s_round_gs_res, wxSizerFlags().Border(wxALL, 5).Expand()); s_round_gs->Add(s_round_gs_aspect, wxSizerFlags().Border(wxALL, 5).Expand()); + s_round_gs->Add(chbox_gs_dump_depth, wxSizerFlags().Border(wxALL, 5)); + s_round_gs->Add(chbox_gs_dump_color, wxSizerFlags().Border(wxALL, 5)); s_round_gs->Add(chbox_gs_vsync, wxSizerFlags().Border(wxALL, 5)); s_round_pad_handler->Add(cbox_pad_handler, wxSizerFlags().Border(wxALL, 5).Expand()); @@ -450,6 +456,8 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) Ini.GSResolution.SetValue(ResolutionNumToId(cbox_gs_resolution->GetSelection() + 1)); Ini.GSAspectRatio.SetValue(cbox_gs_aspect->GetSelection() + 1); Ini.GSVSyncEnable.SetValue(chbox_gs_vsync->GetValue()); + Ini.GSDumpDepthBuffer.SetValue(chbox_gs_dump_depth->GetValue()); + Ini.GSDumpColorBuffers.SetValue(chbox_gs_dump_color->GetValue()); Ini.PadHandlerMode.SetValue(cbox_pad_handler->GetSelection()); Ini.KeyboardHandlerMode.SetValue(cbox_keyboard_handler->GetSelection()); Ini.MouseHandlerMode.SetValue(cbox_mouse_handler->GetSelection()); diff --git a/rpcs3/Ini.h b/rpcs3/Ini.h index dff605bfeb..8ee138328e 100644 --- a/rpcs3/Ini.h +++ b/rpcs3/Ini.h @@ -97,6 +97,8 @@ public: IniEntry GSResolution; IniEntry GSAspectRatio; IniEntry GSVSyncEnable; + IniEntry GSDumpColorBuffers; + IniEntry GSDumpDepthBuffer; IniEntry PadHandlerMode; IniEntry KeyboardHandlerMode; IniEntry MouseHandlerMode; @@ -114,6 +116,8 @@ public: GSResolution.Init("Resolution", path); GSAspectRatio.Init("AspectRatio", path); GSVSyncEnable.Init("VSyncEnable", path); + GSDumpColorBuffers.Init("DumpColorBuffers", path); + GSDumpDepthBuffer.Init("DumpDepthBuffer", path); path = DefPath + "\\" + "IO"; PadHandlerMode.Init("PadHandlerMode", path); @@ -128,6 +132,8 @@ public: GSResolution.Load(4); GSAspectRatio.Load(1); GSVSyncEnable.Load(false); + GSDumpColorBuffers.Load(true); + GSDumpDepthBuffer.Load(true); PadHandlerMode.Load(0); KeyboardHandlerMode.Load(0); MouseHandlerMode.Load(0); @@ -140,6 +146,8 @@ public: GSResolution.Save(); GSAspectRatio.Save(); GSVSyncEnable.Save(); + GSDumpColorBuffers.Save(); + GSDumpDepthBuffer.Save(); PadHandlerMode.Save(); KeyboardHandlerMode.Save(); MouseHandlerMode.Save(); diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index 0bd782cf31..a2d2b62d57 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -253,7 +253,6 @@ - diff --git a/rpcs3/rpcs3.vcxproj.filters b/rpcs3/rpcs3.vcxproj.filters index c35c7cf068..e79c346fe6 100644 --- a/rpcs3/rpcs3.vcxproj.filters +++ b/rpcs3/rpcs3.vcxproj.filters @@ -142,9 +142,6 @@ Emu\GS - - Emu\SysCalls\lv2 - Emu\SysCalls\lv2