diff --git a/rpcs3/Emu/Cell/Modules/cellAudioOut.cpp b/rpcs3/Emu/Cell/Modules/cellAudioOut.cpp index 7a8f830289..36cfa116fd 100644 --- a/rpcs3/Emu/Cell/Modules/cellAudioOut.cpp +++ b/rpcs3/Emu/Cell/Modules/cellAudioOut.cpp @@ -545,15 +545,15 @@ error_code cellAudioOutSetCopyControl(u32 audioOut, u32 control) return CELL_OK; } -error_code cellAudioOutRegisterCallback() +error_code cellAudioOutRegisterCallback(u32 slot, vm::ptr function, vm::ptr 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; } diff --git a/rpcs3/Emu/Cell/Modules/cellAudioOut.h b/rpcs3/Emu/Cell/Modules/cellAudioOut.h index f7e9e7b716..9fc46447ed 100644 --- a/rpcs3/Emu/Cell/Modules/cellAudioOut.h +++ b/rpcs3/Emu/Cell/Modules/cellAudioOut.h @@ -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 reserved; }; struct CellAudioOutRegistrationOption { - //(Omitted) + be_t reserved; }; struct CellAudioOutDeviceConfiguration { - //(Omitted) + u8 volume; + u8 reserved[31]; }; +typedef s32(CellAudioOutCallback)(u32 slot, u32 audioOut, u32 deviceIndex, u32 event, vm::ptr info, vm::ptr userData); + // FXO Object diff --git a/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp b/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp index 66c95ff02b..acd8c5b1b5 100644 --- a/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp +++ b/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp @@ -156,18 +156,36 @@ error_code cellAudioOutUnregisterDevice(u32 deviceNumber) error_code cellAudioOutGetDeviceInfo2(u32 deviceNumber, u32 deviceIndex, vm::ptr 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 rgbOutputRange); // Forward declaration + + vm::var rgbOutputRange; + if (error_code error = cellVideoOutGetConvertCursorColorInfo(rgbOutputRange)) + { + return error; + } + return CELL_OK; } @@ -220,7 +265,7 @@ error_code cellVideoOutGetGamma(u32 videoOut, vm::ptr gamma) error_code cellAudioInGetAvailableDeviceInfo(u32 count, vm::ptr 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 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 name, vm::ptr option, vm::ptr 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 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; } diff --git a/rpcs3/Emu/Cell/Modules/cellSysconf.cpp b/rpcs3/Emu/Cell/Modules/cellSysconf.cpp index a8ecce04a7..c36027a2ac 100644 --- a/rpcs3/Emu/Cell/Modules/cellSysconf.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSysconf.cpp @@ -42,6 +42,12 @@ error_code cellSysconfOpen(u32 type, vm::ptr func, vm::ptr< error_code cellSysconfBtGetDeviceList(vm::ptr deviceList) { cellSysconf.todo("cellSysconfBtGetDeviceList(deviceList=*0x%x)", deviceList); + + if (!deviceList) + { + return CELL_SYSCONF_ERROR_PARAM; + } + return CELL_OK; } diff --git a/rpcs3/Emu/Cell/Modules/cellVideoOut.cpp b/rpcs3/Emu/Cell/Modules/cellVideoOut.cpp index 5dbcd9b202..de2764f3eb 100644 --- a/rpcs3/Emu/Cell/Modules/cellVideoOut.cpp +++ b/rpcs3/Emu/Cell/Modules/cellVideoOut.cpp @@ -374,25 +374,33 @@ error_code cellVideoOutGetResolutionAvailability(u32 videoOut, u32 resolutionId, error_code cellVideoOutGetConvertCursorColorInfo(vm::ptr 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 function, vm::ptr 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; } diff --git a/rpcs3/Emu/Cell/Modules/cellVideoOut.h b/rpcs3/Emu/Cell/Modules/cellVideoOut.h index 6661a39044..c3529d195b 100644 --- a/rpcs3/Emu/Cell/Modules/cellVideoOut.h +++ b/rpcs3/Emu/Cell/Modules/cellVideoOut.h @@ -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 info, vm::ptr userData);