Skip to content

Commit

Permalink
Implement cellVideoOutGetGamma/SetGamma
Browse files Browse the repository at this point in the history
Also fixed settings window being too small and some minor formatting.
  • Loading branch information
tambry authored and Nekotekina committed Sep 7, 2015
1 parent 7e01c81 commit ff3bfa1
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 13 deletions.
35 changes: 31 additions & 4 deletions rpcs3/Emu/SysCalls/Modules/cellAvconfExt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

extern Module cellAvconfExt;

f32 g_gamma;

s32 cellAudioOutUnregisterDevice()
{
throw EXCEPTION("");
Expand Down Expand Up @@ -39,9 +41,18 @@ s32 cellVideoOutConvertCursorColor()
throw EXCEPTION("");
}

s32 cellVideoOutGetGamma()
s32 cellVideoOutGetGamma(u32 videoOut, vm::ptr<f32> 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()
Expand All @@ -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()
Expand Down Expand Up @@ -114,6 +139,8 @@ s32 cellVideoOutGetScreenSize(u32 videoOut, vm::ptr<float> screenSize)

Module cellAvconfExt("cellAvconfExt", []()
{
g_gamma = 1.0f;

REG_FUNC(cellAvconfExt, cellAudioOutUnregisterDevice);
REG_FUNC(cellAvconfExt, cellAudioOutGetDeviceInfo2);
REG_FUNC(cellAvconfExt, cellVideoOutSetXVColor);
Expand Down
14 changes: 7 additions & 7 deletions rpcs3/Emu/SysCalls/Modules/cellVideoOut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ s32 cellVideoOutGetState(u32 videoOut, u32 deviceIndex, vm::ptr<CellVideoOutStat
state->displayMode.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;
Expand All @@ -46,7 +46,7 @@ s32 cellVideoOutGetResolution(u32 resolutionId, vm::ptr<CellVideoOutResolution>
resolution->width = ResolutionTable[num].width;
resolution->height = ResolutionTable[num].height;

return CELL_VIDEO_OUT_SUCCEEDED;
return CELL_OK;
}

s32 cellVideoOutConfigure(u32 videoOut, vm::ptr<CellVideoOutConfiguration> config, vm::ptr<CellVideoOutOption> option, u32 waitForEvent)
Expand All @@ -73,10 +73,10 @@ s32 cellVideoOutConfigure(u32 videoOut, vm::ptr<CellVideoOutConfiguration> 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;
Expand All @@ -97,11 +97,11 @@ s32 cellVideoOutGetConfiguration(u32 videoOut, vm::ptr<CellVideoOutConfiguration
config->aspect = 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;
Expand Down
4 changes: 2 additions & 2 deletions rpcs3/Emu/SysCalls/Modules/cellVideoOut.h
Original file line number Diff line number Diff line change
@@ -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,
Expand Down

0 comments on commit ff3bfa1

Please sign in to comment.