- Improved sc function binder.

- Improved Module binder.
- Added Dump Depth Buffer & Dump Color Buffers options (values can be changed on the fly).
This commit is contained in:
DH 2013-11-16 23:12:30 +02:00
parent baea02901b
commit 5373747210
13 changed files with 331 additions and 292 deletions

View file

@ -102,23 +102,6 @@ enum
void cellSysutil_init();
Module cellSysutil(0x0015, cellSysutil_init);
int cellVideoOutGetDeviceInfo(u32 videoOut, u32 deviceIndex, mem_struct_ptr_t<CellVideoOutDeviceInfo> 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<CellVideoOutDeviceInfo> 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);
}