diff --git a/rpcs3/Emu/SysCalls/Modules/cellAvconfExt.cpp b/rpcs3/Emu/SysCalls/Modules/cellAvconfExt.cpp index bfa5df5c33f9..3ae0c8b64c23 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellAvconfExt.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellAvconfExt.cpp @@ -9,6 +9,8 @@ extern Module cellAvconfExt; +f32 g_gamma; + s32 cellAudioOutUnregisterDevice() { throw EXCEPTION(""); @@ -39,9 +41,18 @@ s32 cellVideoOutConvertCursorColor() throw EXCEPTION(""); } -s32 cellVideoOutGetGamma() +s32 cellVideoOutGetGamma(u32 videoOut, vm::ptr gamma) { - throw EXCEPTION(""); + cellAvconfExt.Warning("cellVideoOutGetGamma(videoOut=%d, gamma=*0x%x)", videoOut, gamma); + + if (videoOut != CELL_VIDEO_OUT_PRIMARY) + { + return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; + } + + *gamma = g_gamma; + + return CELL_OK; } s32 cellAudioInGetAvailableDeviceInfo() @@ -54,9 +65,23 @@ s32 cellAudioOutGetAvailableDeviceInfo() throw EXCEPTION(""); } -s32 cellVideoOutSetGamma() +s32 cellVideoOutSetGamma(u32 videoOut, f32 gamma) { - throw EXCEPTION(""); + cellAvconfExt.Warning("cellVideoOutSetGamma(videoOut=%d, gamma=%f)", videoOut, gamma); + + if (videoOut != CELL_VIDEO_OUT_PRIMARY) + { + return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; + } + + if (gamma < 0.8f || gamma > 1.2f) + { + return CELL_VIDEO_OUT_ERROR_ILLEGAL_PARAMETER; + } + + g_gamma = gamma; + + return CELL_OK; } s32 cellAudioOutRegisterDevice() @@ -114,6 +139,8 @@ s32 cellVideoOutGetScreenSize(u32 videoOut, vm::ptr screenSize) Module cellAvconfExt("cellAvconfExt", []() { + g_gamma = 1.0f; + REG_FUNC(cellAvconfExt, cellAudioOutUnregisterDevice); REG_FUNC(cellAvconfExt, cellAudioOutGetDeviceInfo2); REG_FUNC(cellAvconfExt, cellVideoOutSetXVColor); diff --git a/rpcs3/Emu/SysCalls/Modules/cellVideoOut.cpp b/rpcs3/Emu/SysCalls/Modules/cellVideoOut.cpp index b5ebae5cf885..95c903c8cd39 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellVideoOut.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellVideoOut.cpp @@ -25,11 +25,11 @@ s32 cellVideoOutGetState(u32 videoOut, u32 deviceIndex, vm::ptrdisplayMode.conversion = Emu.GetGSManager().GetInfo().mode.conversion; state->displayMode.aspect = Emu.GetGSManager().GetInfo().mode.aspect; state->displayMode.refreshRates = Emu.GetGSManager().GetInfo().mode.refreshRates; - return CELL_VIDEO_OUT_SUCCEEDED; + return CELL_OK; case CELL_VIDEO_OUT_SECONDARY: *state = { CELL_VIDEO_OUT_OUTPUT_STATE_DISABLED }; // ??? - return CELL_VIDEO_OUT_SUCCEEDED; + return CELL_OK; } return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; @@ -46,7 +46,7 @@ s32 cellVideoOutGetResolution(u32 resolutionId, vm::ptr resolution->width = ResolutionTable[num].width; resolution->height = ResolutionTable[num].height; - return CELL_VIDEO_OUT_SUCCEEDED; + return CELL_OK; } s32 cellVideoOutConfigure(u32 videoOut, vm::ptr config, vm::ptr option, u32 waitForEvent) @@ -73,10 +73,10 @@ s32 cellVideoOutConfigure(u32 videoOut, vm::ptr confi Emu.GetGSManager().GetInfo().mode.pitch = config->pitch; } - return CELL_VIDEO_OUT_SUCCEEDED; + return CELL_OK; case CELL_VIDEO_OUT_SECONDARY: - return CELL_VIDEO_OUT_SUCCEEDED; + return CELL_OK; } return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; @@ -97,11 +97,11 @@ s32 cellVideoOutGetConfiguration(u32 videoOut, vm::ptraspect = Emu.GetGSManager().GetInfo().mode.aspect; config->pitch = Emu.GetGSManager().GetInfo().mode.pitch; - return CELL_VIDEO_OUT_SUCCEEDED; + return CELL_OK; case CELL_VIDEO_OUT_SECONDARY: - return CELL_VIDEO_OUT_SUCCEEDED; + return CELL_OK; } return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; diff --git a/rpcs3/Emu/SysCalls/Modules/cellVideoOut.h b/rpcs3/Emu/SysCalls/Modules/cellVideoOut.h index eac1effdffba..84541bbee6b1 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellVideoOut.h +++ b/rpcs3/Emu/SysCalls/Modules/cellVideoOut.h @@ -1,8 +1,8 @@ #pragma once -enum VideoErrorCode +// Video Out Error Codes +enum { - CELL_VIDEO_OUT_SUCCEEDED = 0, CELL_VIDEO_OUT_ERROR_NOT_IMPLEMENTED = 0x8002b220, CELL_VIDEO_OUT_ERROR_ILLEGAL_CONFIGURATION = 0x8002b221, CELL_VIDEO_OUT_ERROR_ILLEGAL_PARAMETER = 0x8002b222,