HLE: add more error_code

This commit is contained in:
Megamouse 2019-11-15 20:15:00 +01:00
parent 0f2adab05f
commit 0b28f0fa14
5 changed files with 152 additions and 75 deletions

View file

@ -3,16 +3,16 @@
#include "Utilities/BEType.h"
// Error codes
enum
enum CellAudioInError
{
CELL_AUDIO_IN_ERROR_NOT_IMPLEMENTED = 0x8002b260,
CELL_AUDIO_IN_ERROR_ILLEGAL_CONFIGURATION = 0x8002b261,
CELL_AUDIO_IN_ERROR_ILLEGAL_PARAMETER = 0x8002b262,
CELL_AUDIO_IN_ERROR_NOT_IMPLEMENTED = 0x8002b260,
CELL_AUDIO_IN_ERROR_ILLEGAL_CONFIGURATION = 0x8002b261,
CELL_AUDIO_IN_ERROR_ILLEGAL_PARAMETER = 0x8002b262,
CELL_AUDIO_IN_ERROR_PARAMETER_OUT_OF_RANGE = 0x8002b263,
CELL_AUDIO_IN_ERROR_DEVICE_NOT_FOUND = 0x8002b264,
CELL_AUDIO_IN_ERROR_UNSUPPORTED_AUDIO_IN = 0x8002b265,
CELL_AUDIO_IN_ERROR_DEVICE_NOT_FOUND = 0x8002b264,
CELL_AUDIO_IN_ERROR_UNSUPPORTED_AUDIO_IN = 0x8002b265,
CELL_AUDIO_IN_ERROR_UNSUPPORTED_SOUND_MODE = 0x8002b266,
CELL_AUDIO_IN_ERROR_CONDITION_BUSY = 0x8002b267,
CELL_AUDIO_IN_ERROR_CONDITION_BUSY = 0x8002b267,
};
enum

View file

@ -1,11 +1,32 @@
#include "stdafx.h"
#include "stdafx.h"
#include "Emu/Cell/PPUModule.h"
#include "cellAudioOut.h"
extern logs::channel cellSysutil;
s32 cellAudioOutGetSoundAvailability(u32 audioOut, u32 type, u32 fs, u32 option)
template<>
void fmt_class_string<CellAudioOutError>::format(std::string& out, u64 arg)
{
format_enum(out, arg, [](auto error)
{
switch (error)
{
STR_CASE(CELL_AUDIO_OUT_ERROR_NOT_IMPLEMENTED);
STR_CASE(CELL_AUDIO_OUT_ERROR_ILLEGAL_CONFIGURATION);
STR_CASE(CELL_AUDIO_OUT_ERROR_ILLEGAL_PARAMETER);
STR_CASE(CELL_AUDIO_OUT_ERROR_PARAMETER_OUT_OF_RANGE);
STR_CASE(CELL_AUDIO_OUT_ERROR_DEVICE_NOT_FOUND);
STR_CASE(CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT);
STR_CASE(CELL_AUDIO_OUT_ERROR_UNSUPPORTED_SOUND_MODE);
STR_CASE(CELL_AUDIO_OUT_ERROR_CONDITION_BUSY);
}
return unknown;
});
}
error_code cellAudioOutGetSoundAvailability(u32 audioOut, u32 type, u32 fs, u32 option)
{
cellSysutil.warning("cellAudioOutGetSoundAvailability(audioOut=%d, type=%d, fs=0x%x, option=%d)", audioOut, type, fs, option);
@ -36,14 +57,14 @@ s32 cellAudioOutGetSoundAvailability(u32 audioOut, u32 type, u32 fs, u32 option)
switch (audioOut)
{
case CELL_AUDIO_OUT_PRIMARY: return available;
case CELL_AUDIO_OUT_SECONDARY: return 0;
case CELL_AUDIO_OUT_PRIMARY: return not_an_error(available);
case CELL_AUDIO_OUT_SECONDARY: return not_an_error(0);
}
return CELL_AUDIO_OUT_ERROR_ILLEGAL_CONFIGURATION;
}
s32 cellAudioOutGetSoundAvailability2(u32 audioOut, u32 type, u32 fs, u32 ch, u32 option)
error_code cellAudioOutGetSoundAvailability2(u32 audioOut, u32 type, u32 fs, u32 ch, u32 option)
{
cellSysutil.warning("cellAudioOutGetSoundAvailability2(audioOut=%d, type=%d, fs=0x%x, ch=%d, option=%d)", audioOut, type, fs, ch, option);
@ -83,17 +104,24 @@ s32 cellAudioOutGetSoundAvailability2(u32 audioOut, u32 type, u32 fs, u32 ch, u3
switch (audioOut)
{
case CELL_AUDIO_OUT_PRIMARY: return available;
case CELL_AUDIO_OUT_SECONDARY: return 0;
case CELL_AUDIO_OUT_PRIMARY: return not_an_error(available);
case CELL_AUDIO_OUT_SECONDARY: return not_an_error(0);
default:
break;
}
return CELL_AUDIO_OUT_ERROR_ILLEGAL_CONFIGURATION;
}
s32 cellAudioOutGetState(u32 audioOut, u32 deviceIndex, vm::ptr<CellAudioOutState> state)
error_code cellAudioOutGetState(u32 audioOut, u32 deviceIndex, vm::ptr<CellAudioOutState> state)
{
cellSysutil.warning("cellAudioOutGetState(audioOut=0x%x, deviceIndex=0x%x, state=*0x%x)", audioOut, deviceIndex, state);
if (!state)
{
return CELL_AUDIO_OUT_ERROR_ILLEGAL_PARAMETER;
}
*state = {};
switch (audioOut)
@ -119,10 +147,15 @@ s32 cellAudioOutGetState(u32 audioOut, u32 deviceIndex, vm::ptr<CellAudioOutStat
return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT;
}
s32 cellAudioOutConfigure(u32 audioOut, vm::ptr<CellAudioOutConfiguration> config, vm::ptr<CellAudioOutOption> option, u32 waitForEvent)
error_code cellAudioOutConfigure(u32 audioOut, vm::ptr<CellAudioOutConfiguration> config, vm::ptr<CellAudioOutOption> option, u32 waitForEvent)
{
cellSysutil.warning("cellAudioOutConfigure(audioOut=%d, config=*0x%x, option=*0x%x, waitForEvent=%d)", audioOut, config, option, waitForEvent);
if (!config)
{
return CELL_AUDIO_OUT_ERROR_ILLEGAL_PARAMETER;
}
switch (audioOut)
{
case CELL_AUDIO_OUT_PRIMARY:
@ -147,11 +180,20 @@ s32 cellAudioOutConfigure(u32 audioOut, vm::ptr<CellAudioOutConfiguration> confi
return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT;
}
s32 cellAudioOutGetConfiguration(u32 audioOut, vm::ptr<CellAudioOutConfiguration> config, vm::ptr<CellAudioOutOption> option)
error_code cellAudioOutGetConfiguration(u32 audioOut, vm::ptr<CellAudioOutConfiguration> config, vm::ptr<CellAudioOutOption> option)
{
cellSysutil.warning("cellAudioOutGetConfiguration(audioOut=%d, config=*0x%x, option=*0x%x)", audioOut, config, option);
if (option) *option = {};
if (!config)
{
return CELL_AUDIO_OUT_ERROR_ILLEGAL_PARAMETER;
}
if (option)
{
*option = {};
}
*config = {};
switch (audioOut)
@ -166,29 +208,43 @@ s32 cellAudioOutGetConfiguration(u32 audioOut, vm::ptr<CellAudioOutConfiguration
case CELL_AUDIO_OUT_SECONDARY:
return CELL_OK;
default:
break;
}
return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT;
}
s32 cellAudioOutGetNumberOfDevice(u32 audioOut)
error_code cellAudioOutGetNumberOfDevice(u32 audioOut)
{
cellSysutil.warning("cellAudioOutGetNumberOfDevice(audioOut=%d)", audioOut);
switch (audioOut)
{
case CELL_AUDIO_OUT_PRIMARY: return 1;
case CELL_AUDIO_OUT_SECONDARY: return 0;
case CELL_AUDIO_OUT_PRIMARY:
return not_an_error(1);
case CELL_AUDIO_OUT_SECONDARY:
return not_an_error(0);
default:
break;
}
return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT;
}
s32 cellAudioOutGetDeviceInfo(u32 audioOut, u32 deviceIndex, vm::ptr<CellAudioOutDeviceInfo> info)
error_code cellAudioOutGetDeviceInfo(u32 audioOut, u32 deviceIndex, vm::ptr<CellAudioOutDeviceInfo> info)
{
cellSysutil.todo("cellAudioOutGetDeviceInfo(audioOut=%d, deviceIndex=%d, info=*0x%x)", audioOut, deviceIndex, info);
if (deviceIndex) return CELL_AUDIO_OUT_ERROR_DEVICE_NOT_FOUND;
if (!info)
{
return CELL_AUDIO_OUT_ERROR_ILLEGAL_PARAMETER;
}
if (deviceIndex)
{
return CELL_AUDIO_OUT_ERROR_DEVICE_NOT_FOUND;
}
info->portType = CELL_AUDIO_OUT_PORT_HDMI;
info->availableModeCount = 2;
@ -206,51 +262,46 @@ s32 cellAudioOutGetDeviceInfo(u32 audioOut, u32 deviceIndex, vm::ptr<CellAudioOu
return CELL_OK;
}
s32 cellAudioOutSetCopyControl(u32 audioOut, u32 control)
error_code cellAudioOutSetCopyControl(u32 audioOut, u32 control)
{
cellSysutil.warning("cellAudioOutSetCopyControl(audioOut=%d, control=%d)", audioOut, control);
if (control > CELL_AUDIO_OUT_COPY_CONTROL_COPY_NEVER)
{
return CELL_AUDIO_OUT_ERROR_ILLEGAL_PARAMETER;
}
switch (audioOut)
{
case CELL_AUDIO_OUT_PRIMARY:
case CELL_AUDIO_OUT_SECONDARY:
break;
default: return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT;
}
switch (control)
{
case CELL_AUDIO_OUT_COPY_CONTROL_COPY_FREE:
case CELL_AUDIO_OUT_COPY_CONTROL_COPY_ONCE:
case CELL_AUDIO_OUT_COPY_CONTROL_COPY_NEVER:
break;
default: return CELL_AUDIO_OUT_ERROR_ILLEGAL_PARAMETER;
default:
return CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT;
}
return CELL_OK;
}
s32 cellAudioOutConfigure2()
error_code cellAudioOutConfigure2()
{
cellSysutil.todo("cellAudioOutConfigure2()");
return CELL_OK;
}
s32 cellAudioOutGetConfiguration2()
error_code cellAudioOutGetConfiguration2()
{
cellSysutil.todo("cellAudioOutGetConfiguration2()");
return CELL_OK;
}
s32 cellAudioOutRegisterCallback()
error_code cellAudioOutRegisterCallback()
{
cellSysutil.todo("cellAudioOutRegisterCallback()");
return CELL_OK;
}
s32 cellAudioOutUnregisterCallback()
error_code cellAudioOutUnregisterCallback()
{
cellSysutil.todo("cellAudioOutUnregisterCallback()");
return CELL_OK;

View file

@ -1,18 +1,18 @@
#pragma once
#pragma once
#include "Emu/Memory/vm_ptr.h"
// Error codes
enum
enum CellAudioOutError
{
CELL_AUDIO_OUT_ERROR_NOT_IMPLEMENTED = 0x8002b240,
CELL_AUDIO_OUT_ERROR_ILLEGAL_CONFIGURATION = 0x8002b241,
CELL_AUDIO_OUT_ERROR_ILLEGAL_PARAMETER = 0x8002b242,
CELL_AUDIO_OUT_ERROR_NOT_IMPLEMENTED = 0x8002b240,
CELL_AUDIO_OUT_ERROR_ILLEGAL_CONFIGURATION = 0x8002b241,
CELL_AUDIO_OUT_ERROR_ILLEGAL_PARAMETER = 0x8002b242,
CELL_AUDIO_OUT_ERROR_PARAMETER_OUT_OF_RANGE = 0x8002b243,
CELL_AUDIO_OUT_ERROR_DEVICE_NOT_FOUND = 0x8002b244,
CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT = 0x8002b245,
CELL_AUDIO_OUT_ERROR_DEVICE_NOT_FOUND = 0x8002b244,
CELL_AUDIO_OUT_ERROR_UNSUPPORTED_AUDIO_OUT = 0x8002b245,
CELL_AUDIO_OUT_ERROR_UNSUPPORTED_SOUND_MODE = 0x8002b246,
CELL_AUDIO_OUT_ERROR_CONDITION_BUSY = 0x8002b247,
CELL_AUDIO_OUT_ERROR_CONDITION_BUSY = 0x8002b247,
};

View file

@ -12,6 +12,27 @@
LOG_CHANNEL(cellAvconfExt);
template<>
void fmt_class_string<CellAudioInError>::format(std::string& out, u64 arg)
{
format_enum(out, arg, [](auto error)
{
switch (error)
{
STR_CASE(CELL_AUDIO_IN_ERROR_NOT_IMPLEMENTED);
STR_CASE(CELL_AUDIO_IN_ERROR_ILLEGAL_CONFIGURATION);
STR_CASE(CELL_AUDIO_IN_ERROR_ILLEGAL_PARAMETER);
STR_CASE(CELL_AUDIO_IN_ERROR_PARAMETER_OUT_OF_RANGE);
STR_CASE(CELL_AUDIO_IN_ERROR_DEVICE_NOT_FOUND);
STR_CASE(CELL_AUDIO_IN_ERROR_UNSUPPORTED_AUDIO_IN);
STR_CASE(CELL_AUDIO_IN_ERROR_UNSUPPORTED_SOUND_MODE);
STR_CASE(CELL_AUDIO_IN_ERROR_CONDITION_BUSY);
}
return unknown;
});
}
struct avconf_manager
{
std::vector<CellAudioInDeviceInfo> devices;
@ -121,31 +142,31 @@ void avconf_manager::copy_device_info(u32 num, vm::ptr<CellAudioInDeviceInfo> in
strcpy(info->name, devices[num].name);
}
s32 cellAudioOutUnregisterDevice(u32 deviceNumber)
error_code cellAudioOutUnregisterDevice(u32 deviceNumber)
{
cellAvconfExt.todo("cellAudioOutUnregisterDevice(deviceNumber=0x%x)", deviceNumber);
return CELL_OK;
}
s32 cellAudioOutGetDeviceInfo2(u32 deviceNumber, u32 deviceIndex, vm::ptr<CellAudioOutDeviceInfo2> info)
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);
return CELL_OK;
}
s32 cellVideoOutSetXVColor()
error_code cellVideoOutSetXVColor()
{
UNIMPLEMENTED_FUNC(cellAvconfExt);
return CELL_OK;
}
s32 cellVideoOutSetupDisplay()
error_code cellVideoOutSetupDisplay()
{
UNIMPLEMENTED_FUNC(cellAvconfExt);
return CELL_OK;
}
s32 cellAudioInGetDeviceInfo(u32 deviceNumber, u32 deviceIndex, vm::ptr<CellAudioInDeviceInfo> info)
error_code cellAudioInGetDeviceInfo(u32 deviceNumber, u32 deviceIndex, vm::ptr<CellAudioInDeviceInfo> info)
{
cellAvconfExt.todo("cellAudioInGetDeviceInfo(deviceNumber=0x%x, deviceIndex=0x%x, info=*0x%x)", deviceNumber, deviceIndex, info);
@ -159,14 +180,14 @@ s32 cellAudioInGetDeviceInfo(u32 deviceNumber, u32 deviceIndex, vm::ptr<CellAudi
return CELL_OK;
}
s32 cellVideoOutConvertCursorColor(u32 videoOut, s32 displaybuffer_format, f32 gamma, s32 source_buffer_format, vm::ptr<void> src_addr, vm::ptr<u32> dest_addr, s32 num)
error_code cellVideoOutConvertCursorColor(u32 videoOut, s32 displaybuffer_format, f32 gamma, s32 source_buffer_format, vm::ptr<void> src_addr, vm::ptr<u32> dest_addr, s32 num)
{
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);
return CELL_OK;
}
s32 cellVideoOutGetGamma(u32 videoOut, vm::ptr<f32> gamma)
error_code cellVideoOutGetGamma(u32 videoOut, vm::ptr<f32> gamma)
{
cellAvconfExt.warning("cellVideoOutGetGamma(videoOut=%d, gamma=*0x%x)", videoOut, gamma);
@ -181,7 +202,7 @@ s32 cellVideoOutGetGamma(u32 videoOut, vm::ptr<f32> gamma)
return CELL_OK;
}
s32 cellAudioInGetAvailableDeviceInfo(u32 count, vm::ptr<CellAudioInDeviceInfo> device_info)
error_code cellAudioInGetAvailableDeviceInfo(u32 count, vm::ptr<CellAudioInDeviceInfo> device_info)
{
cellAvconfExt.todo("cellAudioInGetAvailableDeviceInfo(count=0x%x, info=*0x%x)", count, device_info);
@ -199,16 +220,16 @@ s32 cellAudioInGetAvailableDeviceInfo(u32 count, vm::ptr<CellAudioInDeviceInfo>
av_manager->copy_device_info(index, device_info + index);
}
return (s32)num_devices_returned;
return not_an_error((s32)num_devices_returned);
}
s32 cellAudioOutGetAvailableDeviceInfo(u32 count, vm::ptr<CellAudioOutDeviceInfo2> info)
error_code cellAudioOutGetAvailableDeviceInfo(u32 count, vm::ptr<CellAudioOutDeviceInfo2> info)
{
cellAvconfExt.todo("cellAudioOutGetAvailableDeviceInfo(count=0x%x, info=*0x%x)", count, info);
return 0; // number of available devices
return not_an_error(0); // number of available devices
}
s32 cellVideoOutSetGamma(u32 videoOut, f32 gamma)
error_code cellVideoOutSetGamma(u32 videoOut, f32 gamma)
{
cellAvconfExt.warning("cellVideoOutSetGamma(videoOut=%d, gamma=%f)", videoOut, gamma);
@ -228,38 +249,43 @@ s32 cellVideoOutSetGamma(u32 videoOut, f32 gamma)
return CELL_OK;
}
s32 cellAudioOutRegisterDevice(u64 deviceType, vm::cptr<char> name, vm::ptr<CellAudioOutRegistrationOption> option, vm::ptr<CellAudioOutDeviceConfiguration> config)
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);
return 0; // device number
return not_an_error(0); // device number
}
s32 cellAudioOutSetDeviceMode(u32 deviceMode)
error_code cellAudioOutSetDeviceMode(u32 deviceMode)
{
cellAvconfExt.todo("cellAudioOutSetDeviceMode(deviceMode=0x%x)", deviceMode);
return CELL_OK;
}
s32 cellAudioInSetDeviceMode(u32 deviceMode)
error_code cellAudioInSetDeviceMode(u32 deviceMode)
{
cellAvconfExt.todo("cellAudioInSetDeviceMode(deviceMode=0x%x)", deviceMode);
return CELL_OK;
}
s32 cellAudioInRegisterDevice(u64 deviceType, vm::cptr<char> name, vm::ptr<CellAudioInRegistrationOption> option, vm::ptr<CellAudioInDeviceConfiguration> config)
error_code cellAudioInRegisterDevice(u64 deviceType, vm::cptr<char> name, vm::ptr<CellAudioInRegistrationOption> option, vm::ptr<CellAudioInDeviceConfiguration> config)
{
cellAvconfExt.todo("cellAudioInRegisterDevice(deviceType=0x%llx, name=%s, option=*0x%x, config=*0x%x)", deviceType, name, option, config);
return 0; // device number
if (!option || !config || !name) // TODO: check first member of option for > 5 ?
{
return CELL_AUDIO_IN_ERROR_ILLEGAL_PARAMETER;
}
return not_an_error(0); // device number
}
s32 cellAudioInUnregisterDevice(u32 deviceNumber)
error_code cellAudioInUnregisterDevice(u32 deviceNumber)
{
cellAvconfExt.todo("cellAudioInUnregisterDevice(deviceNumber=0x%x)", deviceNumber);
return CELL_OK;
}
s32 cellVideoOutGetScreenSize(u32 videoOut, vm::ptr<f32> screenSize)
error_code cellVideoOutGetScreenSize(u32 videoOut, vm::ptr<f32> screenSize)
{
cellAvconfExt.warning("cellVideoOutGetScreenSize(videoOut=%d, screenSize=*0x%x)", videoOut, screenSize);
@ -280,7 +306,7 @@ s32 cellVideoOutGetScreenSize(u32 videoOut, vm::ptr<f32> screenSize)
return CELL_VIDEO_OUT_ERROR_VALUE_IS_NOT_SET;
}
s32 cellVideoOutSetCopyControl(u32 videoOut, u32 control)
error_code cellVideoOutSetCopyControl(u32 videoOut, u32 control)
{
cellAvconfExt.todo("cellVideoOutSetCopyControl(videoOut=%d, control=0x%x)", videoOut, control);
return CELL_OK;

View file

@ -263,37 +263,37 @@ error_code cellVideoOutGetResolutionAvailability(u32 videoOut, u32 resolutionId,
return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT;
}
s32 cellVideoOutConfigure2()
error_code cellVideoOutConfigure2()
{
cellSysutil.todo("cellVideoOutConfigure2()");
return CELL_OK;
}
s32 cellVideoOutGetResolutionAvailability2()
error_code cellVideoOutGetResolutionAvailability2()
{
cellSysutil.todo("cellVideoOutGetResolutionAvailability2()");
return CELL_OK;
}
s32 cellVideoOutGetConvertCursorColorInfo(vm::ptr<u8> rgbOutputRange)
error_code cellVideoOutGetConvertCursorColorInfo(vm::ptr<u8> rgbOutputRange)
{
cellSysutil.todo("cellVideoOutGetConvertCursorColorInfo()");
return CELL_OK;
}
s32 cellVideoOutDebugSetMonitorType(u32 videoOut, u32 monitorType)
error_code cellVideoOutDebugSetMonitorType(u32 videoOut, u32 monitorType)
{
cellSysutil.todo("cellVideoOutDebugSetMonitorType()");
return CELL_OK;
}
s32 cellVideoOutRegisterCallback(u32 slot, vm::ptr<CellVideoOutCallback> function, vm::ptr<void> userData)
error_code cellVideoOutRegisterCallback(u32 slot, vm::ptr<CellVideoOutCallback> function, vm::ptr<void> userData)
{
cellSysutil.todo("cellVideoOutRegisterCallback()");
return CELL_OK;
}
s32 cellVideoOutUnregisterCallback(u32 slot)
error_code cellVideoOutUnregisterCallback(u32 slot)
{
cellSysutil.todo("cellVideoOutUnregisterCallback()");
return CELL_OK;