1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-26 04:32:35 +01:00

HLE: more error checks

This commit is contained in:
Megamouse 2022-06-21 22:13:51 +02:00
parent 64399d45c1
commit 661b485b58
6 changed files with 152 additions and 30 deletions

View File

@ -545,15 +545,15 @@ error_code cellAudioOutSetCopyControl(u32 audioOut, u32 control)
return CELL_OK;
}
error_code cellAudioOutRegisterCallback()
error_code cellAudioOutRegisterCallback(u32 slot, vm::ptr<CellAudioOutCallback> function, vm::ptr<void> userData)
{
cellSysutil.todo("cellAudioOutRegisterCallback()");
cellSysutil.todo("cellAudioOutRegisterCallback(slot=%d, function=*0x%x, userData=*0x%x)", slot, function, userData);
return CELL_OK;
}
error_code cellAudioOutUnregisterCallback()
error_code cellAudioOutUnregisterCallback(u32 slot)
{
cellSysutil.todo("cellAudioOutUnregisterCallback()");
cellSysutil.todo("cellAudioOutUnregisterCallback(slot=%d)", slot);
return CELL_OK;
}

View File

@ -1,6 +1,7 @@
#pragma once
#include "Emu/Audio/AudioBackend.h"
#include "Emu/Memory/vm_ptr.h"
// Error codes
enum CellAudioOutError : u32
@ -178,19 +179,22 @@ struct CellAudioOutDeviceInfo2
struct CellAudioOutOption
{
//(Omitted)
be_t<u32> reserved;
};
struct CellAudioOutRegistrationOption
{
//(Omitted)
be_t<u32> reserved;
};
struct CellAudioOutDeviceConfiguration
{
//(Omitted)
u8 volume;
u8 reserved[31];
};
typedef s32(CellAudioOutCallback)(u32 slot, u32 audioOut, u32 deviceIndex, u32 event, vm::ptr<CellAudioOutDeviceInfo> info, vm::ptr<void> userData);
// FXO Object

View File

@ -156,18 +156,36 @@ error_code cellAudioOutUnregisterDevice(u32 deviceNumber)
error_code cellAudioOutGetDeviceInfo2(u32 deviceNumber, u32 deviceIndex, vm::ptr<CellAudioOutDeviceInfo2> info)
{
cellAvconfExt.todo("cellAudioOutGetDeviceInfo2(deviceNumber=0x%x, deviceIndex=0x%x, info=*0x%x)", deviceNumber, deviceIndex, info);
if (deviceIndex != 0 || !info)
{
return CELL_AUDIO_OUT_ERROR_ILLEGAL_PARAMETER;
}
return CELL_OK;
}
error_code cellVideoOutSetXVColor()
error_code cellVideoOutSetXVColor(u32 unk1, u32 unk2, u32 unk3)
{
UNIMPLEMENTED_FUNC(cellAvconfExt);
cellAvconfExt.todo("cellVideoOutSetXVColor(unk1=0x%x, unk2=0x%x, unk3=0x%x)", unk1, unk2, unk3);
if (unk1 != 0)
{
return CELL_VIDEO_OUT_ERROR_NOT_IMPLEMENTED;
}
return CELL_OK;
}
error_code cellVideoOutSetupDisplay()
error_code cellVideoOutSetupDisplay(u32 videoOut)
{
UNIMPLEMENTED_FUNC(cellAvconfExt);
cellAvconfExt.todo("cellVideoOutSetupDisplay(videoOut=%d)", videoOut);
if (videoOut != CELL_VIDEO_OUT_SECONDARY)
{
return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT;
}
return CELL_OK;
}
@ -194,6 +212,33 @@ error_code cellVideoOutConvertCursorColor(u32 videoOut, s32 displaybuffer_format
{
cellAvconfExt.todo("cellVideoOutConvertCursorColor(videoOut=%d, displaybuffer_format=0x%x, gamma=0x%x, source_buffer_format=0x%x, src_addr=*0x%x, dest_addr=*0x%x, num=0x%x)", videoOut,
displaybuffer_format, gamma, source_buffer_format, src_addr, dest_addr, num);
if (!dest_addr || num == 0)
{
return CELL_VIDEO_OUT_ERROR_ILLEGAL_PARAMETER;
}
if (displaybuffer_format > CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_R16G16B16X16_FLOAT || src_addr)
{
return CELL_VIDEO_OUT_ERROR_PARAMETER_OUT_OF_RANGE;
}
if (displaybuffer_format < CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_R16G16B16X16_FLOAT)
{
if (gamma < 0.8f || gamma > 1.2f)
{
return CELL_VIDEO_OUT_ERROR_PARAMETER_OUT_OF_RANGE;
}
}
error_code cellVideoOutGetConvertCursorColorInfo(vm::ptr<u8> rgbOutputRange); // Forward declaration
vm::var<u8> rgbOutputRange;
if (error_code error = cellVideoOutGetConvertCursorColorInfo(rgbOutputRange))
{
return error;
}
return CELL_OK;
}
@ -220,7 +265,7 @@ error_code cellVideoOutGetGamma(u32 videoOut, vm::ptr<f32> gamma)
error_code cellAudioInGetAvailableDeviceInfo(u32 count, vm::ptr<CellAudioInDeviceInfo> device_info)
{
cellAvconfExt.todo("cellAudioInGetAvailableDeviceInfo(count=0x%x, info=*0x%x)", count, device_info);
cellAvconfExt.todo("cellAudioInGetAvailableDeviceInfo(count=%d, info=*0x%x)", count, device_info);
if (count > 16 || !device_info)
{
@ -242,6 +287,12 @@ error_code cellAudioInGetAvailableDeviceInfo(u32 count, vm::ptr<CellAudioInDevic
error_code cellAudioOutGetAvailableDeviceInfo(u32 count, vm::ptr<CellAudioOutDeviceInfo2> info)
{
cellAvconfExt.todo("cellAudioOutGetAvailableDeviceInfo(count=0x%x, info=*0x%x)", count, info);
if (count > 16 || !info)
{
return CELL_AUDIO_OUT_ERROR_ILLEGAL_PARAMETER;
}
return not_an_error(0); // number of available devices
}
@ -249,9 +300,9 @@ error_code cellVideoOutSetGamma(u32 videoOut, f32 gamma)
{
cellAvconfExt.warning("cellVideoOutSetGamma(videoOut=%d, gamma=%f)", videoOut, gamma);
if (!(gamma >= 0.8f && gamma <= 1.2f))
if (gamma < 0.8f || gamma > 1.2f)
{
return CELL_VIDEO_OUT_ERROR_ILLEGAL_PARAMETER;
return CELL_VIDEO_OUT_ERROR_PARAMETER_OUT_OF_RANGE;
}
if (videoOut != CELL_VIDEO_OUT_PRIMARY)
@ -268,18 +319,42 @@ error_code cellVideoOutSetGamma(u32 videoOut, f32 gamma)
error_code cellAudioOutRegisterDevice(u64 deviceType, vm::cptr<char> name, vm::ptr<CellAudioOutRegistrationOption> option, vm::ptr<CellAudioOutDeviceConfiguration> config)
{
cellAvconfExt.todo("cellAudioOutRegisterDevice(deviceType=0x%llx, name=%s, option=*0x%x, config=*0x%x)", deviceType, name, option, config);
if (option || !name)
{
return CELL_AUDIO_IN_ERROR_ILLEGAL_PARAMETER; // Strange choice for an error
}
return not_an_error(0); // device number
}
error_code cellAudioOutSetDeviceMode(u32 deviceMode)
{
cellAvconfExt.todo("cellAudioOutSetDeviceMode(deviceMode=0x%x)", deviceMode);
if (deviceMode > CELL_AUDIO_OUT_MULTI_DEVICE_MODE_2)
{
return CELL_AUDIO_OUT_ERROR_ILLEGAL_PARAMETER;
}
return CELL_OK;
}
error_code cellAudioInSetDeviceMode(u32 deviceMode)
{
cellAvconfExt.todo("cellAudioInSetDeviceMode(deviceMode=0x%x)", deviceMode);
switch (deviceMode)
{
case CELL_AUDIO_IN_SINGLE_DEVICE_MODE:
case CELL_AUDIO_IN_MULTI_DEVICE_MODE:
case CELL_AUDIO_IN_MULTI_DEVICE_MODE_2:
case CELL_AUDIO_IN_MULTI_DEVICE_MODE_10:
break;
default:
return CELL_AUDIO_IN_ERROR_ILLEGAL_PARAMETER;
}
return CELL_OK;
}
@ -339,24 +414,53 @@ error_code cellVideoOutGetScreenSize(u32 videoOut, vm::ptr<f32> screenSize)
error_code cellVideoOutSetCopyControl(u32 videoOut, u32 control)
{
cellAvconfExt.todo("cellVideoOutSetCopyControl(videoOut=%d, control=0x%x)", videoOut, control);
if (control > CELL_VIDEO_OUT_COPY_CONTROL_COPY_NEVER)
{
return CELL_VIDEO_OUT_ERROR_ILLEGAL_PARAMETER;
}
return CELL_OK;
}
error_code cellVideoOutConfigure2()
{
cellAvconfExt.todo("cellVideoOutConfigure2()");
if (false) // TODO
{
return CELL_VIDEO_OUT_ERROR_ILLEGAL_PARAMETER;
}
if (false) // TODO
{
return CELL_VIDEO_OUT_ERROR_PARAMETER_OUT_OF_RANGE;
}
return CELL_OK;
}
error_code cellAudioOutGetConfiguration2()
{
cellAvconfExt.todo("cellAudioOutGetConfiguration2()");
if (false) // TODO
{
return CELL_AUDIO_OUT_ERROR_ILLEGAL_PARAMETER;
}
return CELL_OK;
}
error_code cellAudioOutConfigure2()
{
cellAvconfExt.todo("cellAudioOutConfigure2()");
if (false) // TODO
{
return CELL_AUDIO_OUT_ERROR_ILLEGAL_PARAMETER;
}
return CELL_OK;
}

View File

@ -42,6 +42,12 @@ error_code cellSysconfOpen(u32 type, vm::ptr<CellSysconfCallback> func, vm::ptr<
error_code cellSysconfBtGetDeviceList(vm::ptr<CellSysconfBtDeviceList> deviceList)
{
cellSysconf.todo("cellSysconfBtGetDeviceList(deviceList=*0x%x)", deviceList);
if (!deviceList)
{
return CELL_SYSCONF_ERROR_PARAM;
}
return CELL_OK;
}

View File

@ -374,25 +374,33 @@ error_code cellVideoOutGetResolutionAvailability(u32 videoOut, u32 resolutionId,
error_code cellVideoOutGetConvertCursorColorInfo(vm::ptr<u8> rgbOutputRange)
{
cellSysutil.todo("cellVideoOutGetConvertCursorColorInfo()");
cellSysutil.todo("cellVideoOutGetConvertCursorColorInfo(rgbOutputRange=*0x%x)", rgbOutputRange);
if (!rgbOutputRange)
{
return CELL_VIDEO_OUT_ERROR_ILLEGAL_PARAMETER; // TODO: Speculative
}
*rgbOutputRange = CELL_VIDEO_OUT_RGB_OUTPUT_RANGE_FULL; // Or CELL_VIDEO_OUT_RGB_OUTPUT_RANGE_LIMITED
return CELL_OK;
}
error_code cellVideoOutDebugSetMonitorType(u32 videoOut, u32 monitorType)
{
cellSysutil.todo("cellVideoOutDebugSetMonitorType()");
cellSysutil.todo("cellVideoOutDebugSetMonitorType(videoOut=%d, monitorType=%d)", videoOut, monitorType);
return CELL_OK;
}
error_code cellVideoOutRegisterCallback(u32 slot, vm::ptr<CellVideoOutCallback> function, vm::ptr<void> userData)
{
cellSysutil.todo("cellVideoOutRegisterCallback()");
cellSysutil.todo("cellVideoOutRegisterCallback(slot=%d, function=*0x%x, userData=*0x%x)", slot, function, userData);
return CELL_OK;
}
error_code cellVideoOutUnregisterCallback(u32 slot)
{
cellSysutil.todo("cellVideoOutUnregisterCallback()");
cellSysutil.todo("cellVideoOutUnregisterCallback(slot=%d)", slot);
return CELL_OK;
}

View File

@ -94,9 +94,9 @@ enum CellVideoOutDisplayAspect : s32
enum CellVideoOutBufferColorFormat : s32
{
CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_X8R8G8B8,
CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_X8B8G8R8,
CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_R16G16B16X16_FLOAT,
CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_X8R8G8B8 = 0,
CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_X8B8G8R8 = 1,
CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_R16G16B16X16_FLOAT = 2,
};
enum CellVideoOutOutputState : s32
@ -219,23 +219,23 @@ struct CellVideoOutOption
enum CellVideoOutEvent : s32
{
CELL_VIDEO_OUT_EVENT_DEVICE_CHANGED,
CELL_VIDEO_OUT_EVENT_OUTPUT_DISABLED,
CELL_VIDEO_OUT_EVENT_DEVICE_AUTHENTICATED,
CELL_VIDEO_OUT_EVENT_OUTPUT_ENABLED,
CELL_VIDEO_OUT_EVENT_DEVICE_CHANGED = 0,
CELL_VIDEO_OUT_EVENT_OUTPUT_DISABLED = 1,
CELL_VIDEO_OUT_EVENT_DEVICE_AUTHENTICATED = 2,
CELL_VIDEO_OUT_EVENT_OUTPUT_ENABLED = 3,
};
enum CellVideoOutCopyControl : s32
{
CELL_VIDEO_OUT_COPY_CONTROL_COPY_FREE,
CELL_VIDEO_OUT_COPY_CONTROL_COPY_ONCE,
CELL_VIDEO_OUT_COPY_CONTROL_COPY_NEVER,
CELL_VIDEO_OUT_COPY_CONTROL_COPY_FREE = 0,
CELL_VIDEO_OUT_COPY_CONTROL_COPY_ONCE = 1,
CELL_VIDEO_OUT_COPY_CONTROL_COPY_NEVER = 2,
};
enum CellVideoOutRGBOutputRange : s32
{
CELL_VIDEO_OUT_RGB_OUTPUT_RANGE_LIMITED,
CELL_VIDEO_OUT_RGB_OUTPUT_RANGE_FULL,
CELL_VIDEO_OUT_RGB_OUTPUT_RANGE_LIMITED = 0,
CELL_VIDEO_OUT_RGB_OUTPUT_RANGE_FULL = 1,
};
using CellVideoOutCallback = s32(u32 slot, u32 videoOut, u32 deviceIndex, u32 event, vm::ptr<CellVideoOutDeviceInfo> info, vm::ptr<void> userData);