cellCamera fix

This commit is contained in:
Nekotekina 2015-06-27 00:39:42 +03:00
parent ec68e012f9
commit b7a320fbbd
2 changed files with 174 additions and 384 deletions

View File

@ -6,79 +6,60 @@
#include "cellCamera.h"
extern Module cellCamera;
//const char* attributes[] = {"GAIN", "REDBLUEGAIN", "SATURATION", "EXPOSURE", "BRIGHTNESS", "AEC", "AGC", "AWB", "ABC", "LED", "AUDIOGAIN", "QS", "NONZEROCOEFFS", "YUVFLAG",
// "JPEGFLAG", "BACKLIGHTCOMP", "MIRRORFLAG", "MEASUREDQS", "422FLAG", "USBLOAD", "GAMMA", "GREENGAIN", "AGCLIMIT", "DENOISE", "FRAMERATEADJUST",
// "PIXELOUTLIERFILTER", "AGCLOW", "AGCHIGH", "DEVICELOCATION", "FORMATCAP", "FORMATINDEX", "NUMFRAME", "FRAMEINDEX", "FRAMESIZE", "INTERVALTYPE",
// "INTERVALINDEX", "INTERVALVALUE", "COLORMATCHING", "PLFREQ", "DEVICEID", "DEVICECAP", "DEVICESPEED", "UVCREQCODE", "UVCREQDATA", "DEVICEID2",
// "READMODE", "GAMEPID", "PBUFFER", "READFINISH", "ATTRIBUTE_UNKNOWN"};
struct cellCameraInternal
{
bool m_bInitialized;
//CellCamera m_camera;
cellCameraInternal()
: m_bInitialized(false)
{
}
};
cellCameraInternal cellCameraInstance;
std::unique_ptr<camera_t> g_camera;
s32 cellCameraInit()
{
cellCamera.Warning("cellCameraInit()");
if (cellCameraInstance.m_bInitialized)
return CELL_CAMERA_ERROR_ALREADY_INIT;
if (Ini.Camera.GetValue() == 0)
{
return CELL_CAMERA_ERROR_DEVICE_NOT_FOUND;
}
if (g_camera->init.exchange(true))
{
return CELL_CAMERA_ERROR_ALREADY_INIT;
}
if (Ini.CameraType.GetValue() == 1)
{
//CellCamera camera;
//camera.attributes.SATURATION = 164;
//camera.attributes.BRIGHTNESS = 96;
//camera.attributes.AEC = 1;
//camera.attributes.AGC = 1;
//camera.attributes.AWB = 1;
//camera.attributes.ABC = 0;
//camera.attributes.LED = 1;
//camera.attributes.QS = 0;
//camera.attributes.NONZEROCOEFFS[0] = 32;
//camera.attributes.NONZEROCOEFFS[1] = 32;
//camera.attributes.YUVFLAG = 0;
//camera.attributes.BACKLIGHTCOMP = 0;
//camera.attributes.MIRRORFLAG = 1;
//camera.attributes._422FLAG = 1;
//camera.attributes.USBLOAD = 4;
//cellCameraInstance.m_camera = camera;
g_camera->attr[CELL_CAMERA_SATURATION] = { 164 };
g_camera->attr[CELL_CAMERA_BRIGHTNESS] = { 96 };
g_camera->attr[CELL_CAMERA_AEC] = { 1 };
g_camera->attr[CELL_CAMERA_AGC] = { 1 };
g_camera->attr[CELL_CAMERA_AWB] = { 1 };
g_camera->attr[CELL_CAMERA_ABC] = { 0 };
g_camera->attr[CELL_CAMERA_LED] = { 1 };
g_camera->attr[CELL_CAMERA_QS] = { 0 };
g_camera->attr[CELL_CAMERA_NONZEROCOEFFS] = { 32, 32 };
g_camera->attr[CELL_CAMERA_YUVFLAG] = { 0 };
g_camera->attr[CELL_CAMERA_BACKLIGHTCOMP] = { 0 };
g_camera->attr[CELL_CAMERA_MIRRORFLAG] = { 1 };
g_camera->attr[CELL_CAMERA_422FLAG] = { 1 };
g_camera->attr[CELL_CAMERA_USBLOAD] = { 4 };
}
else if (Ini.CameraType.GetValue() == 2)
{
//CellCamera camera;
//camera.attributes.SATURATION = 64;
//camera.attributes.BRIGHTNESS = 8;
//camera.attributes.AEC = 1;
//camera.attributes.AGC = 1;
//camera.attributes.AWB = 1;
//camera.attributes.LED = 1;
//camera.attributes.BACKLIGHTCOMP = 0;
//camera.attributes.MIRRORFLAG = 1;
//camera.attributes.GAMMA = 1;
//camera.attributes.AGCLIMIT = 4;
//camera.attributes.DENOISE = 0;
//camera.attributes.FRAMERATEADJUST = 0;
//camera.attributes.PIXELOUTLIERFILTER = 1;
//camera.attributes.AGCLOW = 48;
//camera.attributes.AGCHIGH = 64;
//cellCameraInstance.m_camera = camera;
g_camera->attr[CELL_CAMERA_SATURATION] = { 64 };
g_camera->attr[CELL_CAMERA_BRIGHTNESS] = { 8 };
g_camera->attr[CELL_CAMERA_AEC] = { 1 };
g_camera->attr[CELL_CAMERA_AGC] = { 1 };
g_camera->attr[CELL_CAMERA_AWB] = { 1 };
g_camera->attr[CELL_CAMERA_LED] = { 1 };
g_camera->attr[CELL_CAMERA_BACKLIGHTCOMP] = { 0 };
g_camera->attr[CELL_CAMERA_MIRRORFLAG] = { 1 };
g_camera->attr[CELL_CAMERA_GAMMA] = { 1 };
g_camera->attr[CELL_CAMERA_AGCLIMIT] = { 4 };
g_camera->attr[CELL_CAMERA_DENOISE] = { 0 };
g_camera->attr[CELL_CAMERA_FRAMERATEADJUST] = { 0 };
g_camera->attr[CELL_CAMERA_PIXELOUTLIERFILTER] = { 1 };
g_camera->attr[CELL_CAMERA_AGCLOW] = { 48 };
g_camera->attr[CELL_CAMERA_AGCHIGH] = { 64 };
}
// TODO: Some other default attributes? Need to check the actual behaviour on a real PS3.
cellCameraInstance.m_bInitialized = true;
return CELL_OK;
}
@ -86,10 +67,10 @@ s32 cellCameraEnd()
{
cellCamera.Warning("cellCameraEnd()");
if (!cellCameraInstance.m_bInitialized)
if (!g_camera->init.exchange(false))
{
return CELL_CAMERA_ERROR_NOT_INIT;
cellCameraInstance.m_bInitialized = false;
}
return CELL_OK;
}
@ -100,33 +81,21 @@ s32 cellCameraOpen()
return CELL_OK;
}
s32 cellCameraOpenEx()
s32 cellCameraOpenEx(s32 dev_num, vm::ptr<CellCameraInfoEx> info)
{
UNIMPLEMENTED_FUNC(cellCamera);
if (!cellCameraInstance.m_bInitialized)
return CELL_CAMERA_ERROR_NOT_INIT;
return CELL_OK;
}
s32 cellCameraClose()
s32 cellCameraClose(s32 dev_num)
{
UNIMPLEMENTED_FUNC(cellCamera);
if (!cellCameraInstance.m_bInitialized)
return CELL_CAMERA_ERROR_NOT_INIT;
return CELL_OK;
}
s32 cellCameraGetDeviceGUID()
s32 cellCameraGetDeviceGUID(s32 dev_num, vm::ptr<u32> guid)
{
UNIMPLEMENTED_FUNC(cellCamera);
if (!cellCameraInstance.m_bInitialized)
return CELL_CAMERA_ERROR_NOT_INIT;
return CELL_OK;
}
@ -134,8 +103,10 @@ s32 cellCameraGetType(s32 dev_num, vm::ptr<s32> type)
{
cellCamera.Warning("cellCameraGetType(dev_num=%d, type=*0x%x)", dev_num, type);
if (!cellCameraInstance.m_bInitialized)
if (!g_camera->init.load())
{
return CELL_CAMERA_ERROR_NOT_INIT;
}
switch (Ini.CameraType.GetValue())
{
@ -148,25 +119,25 @@ s32 cellCameraGetType(s32 dev_num, vm::ptr<s32> type)
return CELL_OK;
}
s32 cellCameraIsAvailable()
s32 cellCameraIsAvailable(s32 dev_num)
{
UNIMPLEMENTED_FUNC(cellCamera);
return CELL_OK;
}
s32 cellCameraIsAttached()
s32 cellCameraIsAttached(s32 dev_num)
{
UNIMPLEMENTED_FUNC(cellCamera);
return CELL_OK;
}
s32 cellCameraIsOpen()
s32 cellCameraIsOpen(s32 dev_num)
{
UNIMPLEMENTED_FUNC(cellCamera);
return CELL_OK;
}
s32 cellCameraIsStarted()
s32 cellCameraIsStarted(s32 dev_num)
{
UNIMPLEMENTED_FUNC(cellCamera);
return CELL_OK;
@ -176,118 +147,20 @@ s32 cellCameraGetAttribute(s32 dev_num, s32 attrib, vm::ptr<u32> arg1, vm::ptr<u
{
cellCamera.Warning("cellCameraGetAttribute(dev_num=%d, attrib=%d, arg1=*0x%x, arg2=*0x%x)", dev_num, attrib, arg1, arg2);
if (!cellCameraInstance.m_bInitialized)
return CELL_CAMERA_ERROR_NOT_INIT;
const auto attr_name = camera_t::get_attr_name(attrib);
//switch (attrib)
//{
//case 0:
// *arg1 = cellCameraInstance.m_camera.attributes.GAIN; break;
//case 1:
// *arg1 = cellCameraInstance.m_camera.attributes.REDBLUEGAIN; break;
//case 2:
// *arg1 = cellCameraInstance.m_camera.attributes.SATURATION; break;
//case 3:
// *arg1 = cellCameraInstance.m_camera.attributes.EXPOSURE; break;
//case 4:
// *arg1 = cellCameraInstance.m_camera.attributes.BRIGHTNESS; break;
//case 5:
// *arg1 = cellCameraInstance.m_camera.attributes.AEC; break;
//case 6:
// *arg1 = cellCameraInstance.m_camera.attributes.AGC; break;
//case 7:
// *arg1 = cellCameraInstance.m_camera.attributes.AWB; break;
//case 8:
// *arg1 = cellCameraInstance.m_camera.attributes.ABC; break;
//case 9:
// *arg1 = cellCameraInstance.m_camera.attributes.LED; break;
//case 10:
// *arg1 = cellCameraInstance.m_camera.attributes.AUDIOGAIN; break;
//case 11:
// *arg1 = cellCameraInstance.m_camera.attributes.QS; break;
//case 12:
//{
// *arg1 = cellCameraInstance.m_camera.attributes.NONZEROCOEFFS[0];
// *arg2 = cellCameraInstance.m_camera.attributes.NONZEROCOEFFS[1];
// break;
//}
//case 13:
// *arg1 = cellCameraInstance.m_camera.attributes.YUVFLAG; break;
//case 14:
// *arg1 = cellCameraInstance.m_camera.attributes.JPEGFLAG; break;
//case 15:
// *arg1 = cellCameraInstance.m_camera.attributes.BACKLIGHTCOMP; break;
//case 16:
// *arg1 = cellCameraInstance.m_camera.attributes.MIRRORFLAG; break;
//case 17:
// *arg1 = cellCameraInstance.m_camera.attributes.MEASUREDQS; break;
//case 18:
// *arg1 = cellCameraInstance.m_camera.attributes._422FLAG; break;
//case 19:
// *arg1 = cellCameraInstance.m_camera.attributes.USBLOAD; break;
//case 20:
// *arg1 = cellCameraInstance.m_camera.attributes.GAMMA; break;
//case 21:
// *arg1 = cellCameraInstance.m_camera.attributes.GREENGAIN; break;
//case 22:
// *arg1 = cellCameraInstance.m_camera.attributes.AGCLIMIT; break;
//case 23:
// *arg1 = cellCameraInstance.m_camera.attributes.DENOISE; break;
//case 24:
// *arg1 = cellCameraInstance.m_camera.attributes.FRAMERATEADJUST; break;
//case 25:
// *arg1 = cellCameraInstance.m_camera.attributes.PIXELOUTLIERFILTER; break;
//case 26:
// *arg1 = cellCameraInstance.m_camera.attributes.AGCLOW; break;
//case 27:
// *arg1 = cellCameraInstance.m_camera.attributes.AGCHIGH; break;
//case 28:
// *arg1 = cellCameraInstance.m_camera.attributes.DEVICELOCATION; break;
//case 29:
// *arg1 = cellCameraInstance.m_camera.attributes.FORMATCAP; break;
//case 30:
// *arg1 = cellCameraInstance.m_camera.attributes.FORMATINDEX; break;
//case 31:
// *arg1 = cellCameraInstance.m_camera.attributes.NUMFRAME; break;
//case 32:
// *arg1 = cellCameraInstance.m_camera.attributes.FRAMEINDEX; break;
//case 33:
// *arg1 = cellCameraInstance.m_camera.attributes.FRAMESIZE; break;
//case 34:
// *arg1 = cellCameraInstance.m_camera.attributes.INTERVALTYPE; break;
//case 35:
// *arg1 = cellCameraInstance.m_camera.attributes.INTERVALINDEX; break;
//case 36:
// *arg1 = cellCameraInstance.m_camera.attributes.INTERVALVALUE; break;
//case 37:
// *arg1 = cellCameraInstance.m_camera.attributes.COLORMATCHING; break;
//case 38:
// *arg1 = cellCameraInstance.m_camera.attributes.PLFREQ; break;
//case 39:
// *arg1 = cellCameraInstance.m_camera.attributes.DEVICEID; break;
//case 40:
// *arg1 = cellCameraInstance.m_camera.attributes.DEVICECAP; break;
//case 41:
// *arg1 = cellCameraInstance.m_camera.attributes.DEVICESPEED; break;
//case 42:
// *arg1 = cellCameraInstance.m_camera.attributes.UVCREQCODE; break;
//case 43:
// *arg1 = cellCameraInstance.m_camera.attributes.UVCREQDATA; break;
//case 44:
// *arg1 = cellCameraInstance.m_camera.attributes.DEVICEID2; break;
//case 45:
// *arg1 = cellCameraInstance.m_camera.attributes.READMODE; break;
//case 46:
// *arg1 = cellCameraInstance.m_camera.attributes.GAMEPID; break;
//case 47:
// *arg1 = cellCameraInstance.m_camera.attributes.PBUFFER; break;
//case 48:
// *arg1 = cellCameraInstance.m_camera.attributes.READFINISH; break;
//case 49:
// *arg1 = cellCameraInstance.m_camera.attributes.ATTRIBUTE_UNKNOWN; break;
//default:
// cellCamera.Error("Unexpected cellCameraGetAttribute attribute: %d", attrib); break;
//}
if (!g_camera->init.load())
{
return CELL_CAMERA_ERROR_NOT_INIT;
}
if (!attr_name) // invalid attributes don't have a name
{
return CELL_CAMERA_ERROR_PARAM;
}
*arg1 = g_camera->attr[attrib].v1;
*arg2 = g_camera->attr[attrib].v2;
return CELL_OK;
}
@ -296,129 +169,26 @@ s32 cellCameraSetAttribute(s32 dev_num, s32 attrib, u32 arg1, u32 arg2)
{
cellCamera.Warning("cellCameraSetAttribute(dev_num=%d, attrib=%d, arg1=%d, arg2=%d)", dev_num, attrib, arg1, arg2);
if (!cellCameraInstance.m_bInitialized)
return CELL_CAMERA_ERROR_NOT_INIT;
const auto attr_name = camera_t::get_attr_name(attrib);
//switch (attrib)
//{
//case 0:
// cellCameraInstance.m_camera.attributes.GAIN = arg1; break;
//case 1:
// cellCameraInstance.m_camera.attributes.REDBLUEGAIN = arg1; break;
//case 2:
// cellCameraInstance.m_camera.attributes.SATURATION = arg1; break;
//case 3:
// cellCameraInstance.m_camera.attributes.EXPOSURE = arg1; break;
//case 4:
// cellCameraInstance.m_camera.attributes.BRIGHTNESS = arg1; break;
//case 5:
// cellCameraInstance.m_camera.attributes.AEC = arg1; break;
//case 6:
// cellCameraInstance.m_camera.attributes.AGC = arg1; break;
//case 7:
// cellCameraInstance.m_camera.attributes.AWB = arg1; break;
//case 8:
// cellCameraInstance.m_camera.attributes.ABC = arg1; break;
//case 9:
// cellCameraInstance.m_camera.attributes.LED = arg1; break;
//case 10:
// cellCameraInstance.m_camera.attributes.AUDIOGAIN = arg1; break;
//case 11:
// cellCameraInstance.m_camera.attributes.QS = arg1; break;
//case 12:
//{
// cellCameraInstance.m_camera.attributes.NONZEROCOEFFS[0] = arg1;
// cellCameraInstance.m_camera.attributes.NONZEROCOEFFS[1] = arg2;
// break;
//}
//case 13:
// cellCameraInstance.m_camera.attributes.YUVFLAG = arg1; break;
//case 14:
// cellCameraInstance.m_camera.attributes.JPEGFLAG = arg1; break;
//case 15:
// cellCameraInstance.m_camera.attributes.BACKLIGHTCOMP = arg1; break;
//case 16:
// cellCameraInstance.m_camera.attributes.MIRRORFLAG = arg1; break;
//case 17:
// return CELL_CAMERA_ERROR_PARAM; break;
//case 18:
// cellCameraInstance.m_camera.attributes._422FLAG = arg1; break;
//case 19:
// cellCameraInstance.m_camera.attributes.USBLOAD = arg1; break;
//case 20:
// cellCameraInstance.m_camera.attributes.GAMMA = arg1; break;
//case 21:
// cellCameraInstance.m_camera.attributes.GREENGAIN = arg1; break;
//case 22:
// cellCameraInstance.m_camera.attributes.AGCLIMIT = arg1; break;
//case 23:
// cellCameraInstance.m_camera.attributes.DENOISE = arg1; break;
//case 24:
// cellCameraInstance.m_camera.attributes.FRAMERATEADJUST = arg1; break;
//case 25:
// cellCameraInstance.m_camera.attributes.PIXELOUTLIERFILTER = arg1; break;
//case 26:
// cellCameraInstance.m_camera.attributes.AGCLOW = arg1; break;
//case 27:
// cellCameraInstance.m_camera.attributes.AGCHIGH = arg1; break;
//case 28:
// cellCameraInstance.m_camera.attributes.DEVICELOCATION = arg1; break;
//case 29:
// cellCamera.Error("Tried to write to read-only (?) value: FORMATCAP"); break;
//case 30:
// cellCameraInstance.m_camera.attributes.FORMATINDEX = arg1; break;
//case 31:
// cellCameraInstance.m_camera.attributes.NUMFRAME = arg1; break;
//case 32:
// cellCameraInstance.m_camera.attributes.FRAMEINDEX = arg1; break;
//case 33:
// cellCameraInstance.m_camera.attributes.FRAMESIZE = arg1; break;
//case 34:
// cellCameraInstance.m_camera.attributes.INTERVALTYPE = arg1; break;
//case 35:
// cellCameraInstance.m_camera.attributes.INTERVALINDEX = arg1; break;
//case 36:
// cellCameraInstance.m_camera.attributes.INTERVALVALUE = arg1; break;
//case 37:
// cellCameraInstance.m_camera.attributes.COLORMATCHING = arg1; break;
//case 38:
// cellCameraInstance.m_camera.attributes.PLFREQ = arg1; break;
//case 39:
// return CELL_CAMERA_ERROR_PARAM; break;
//case 40:
// cellCameraInstance.m_camera.attributes.DEVICECAP = arg1; break;
//case 41:
// cellCameraInstance.m_camera.attributes.DEVICESPEED = arg1; break;
//case 42:
// cellCameraInstance.m_camera.attributes.UVCREQCODE = arg1; break;
//case 43:
// cellCameraInstance.m_camera.attributes.UVCREQDATA = arg1; break;
//case 44:
// return CELL_CAMERA_ERROR_PARAM; break;
//case 45:
// cellCamera.Error("Tried to write to read-only (?) value: READMODE"); break;
//case 46:
// cellCameraInstance.m_camera.attributes.GAMEPID = arg1; break;
//case 47:
// cellCameraInstance.m_camera.attributes.PBUFFER = arg1; break;
//case 48:
// cellCameraInstance.m_camera.attributes.READFINISH = arg1; break;
//case 49:
// cellCamera.Error("Tried to write to read-only (?) value: ATTRIBUTE_UNKNOWN"); break;
//default:
// cellCamera.Error("Unexpected cellCameraGetAttribute attribute: %d", attrib); break;
//}
if (!g_camera->init.load())
{
return CELL_CAMERA_ERROR_NOT_INIT;
}
if (!attr_name) // invalid attributes don't have a name
{
return CELL_CAMERA_ERROR_PARAM;
}
g_camera->attr[attrib] = { arg1, arg2 };
return CELL_OK;
}
s32 cellCameraGetBufferSize()
s32 cellCameraGetBufferSize(s32 dev_num, vm::ptr<CellCameraInfoEx> info)
{
UNIMPLEMENTED_FUNC(cellCamera);
if (!cellCameraInstance.m_bInitialized)
return CELL_CAMERA_ERROR_NOT_INIT;
return CELL_OK;
}
@ -428,143 +198,99 @@ s32 cellCameraGetBufferInfo()
return CELL_OK;
}
s32 cellCameraGetBufferInfoEx()
{
UNIMPLEMENTED_FUNC(cellCamera);
if (!cellCameraInstance.m_bInitialized)
return CELL_CAMERA_ERROR_NOT_INIT;
return CELL_OK;
}
s32 cellCameraPrepExtensionUnit()
s32 cellCameraGetBufferInfoEx(s32 dev_num, vm::ptr<CellCameraInfoEx> info)
{
UNIMPLEMENTED_FUNC(cellCamera);
return CELL_OK;
}
s32 cellCameraCtrlExtensionUnit()
s32 cellCameraPrepExtensionUnit(s32 dev_num, vm::ptr<u8> guidExtensionCode)
{
UNIMPLEMENTED_FUNC(cellCamera);
return CELL_OK;
}
s32 cellCameraGetExtensionUnit()
s32 cellCameraCtrlExtensionUnit(s32 dev_num, u8 request, u16 value, u16 length, vm::ptr<u8> data)
{
UNIMPLEMENTED_FUNC(cellCamera);
return CELL_OK;
}
s32 cellCameraSetExtensionUnit()
s32 cellCameraGetExtensionUnit(s32 dev_num, u16 value, u16 length, vm::ptr<u8> data)
{
UNIMPLEMENTED_FUNC(cellCamera);
return CELL_OK;
}
s32 cellCameraReset()
s32 cellCameraSetExtensionUnit(s32 dev_num, u16 value, u16 length, vm::ptr<u8> data)
{
UNIMPLEMENTED_FUNC(cellCamera);
if (!cellCameraInstance.m_bInitialized)
return CELL_CAMERA_ERROR_NOT_INIT;
return CELL_OK;
}
s32 cellCameraStart()
s32 cellCameraReset(s32 dev_num)
{
UNIMPLEMENTED_FUNC(cellCamera);
if (!cellCameraInstance.m_bInitialized)
return CELL_CAMERA_ERROR_NOT_INIT;
return CELL_OK;
}
s32 cellCameraRead()
s32 cellCameraStart(s32 dev_num)
{
UNIMPLEMENTED_FUNC(cellCamera);
if (!cellCameraInstance.m_bInitialized)
return CELL_CAMERA_ERROR_NOT_INIT;
return CELL_OK;
}
s32 cellCameraReadEx()
s32 cellCameraRead(s32 dev_num, vm::ptr<u32> frame_num, vm::ptr<u32> bytes_read)
{
UNIMPLEMENTED_FUNC(cellCamera);
if (!cellCameraInstance.m_bInitialized)
return CELL_CAMERA_ERROR_NOT_INIT;
return CELL_OK;
}
s32 cellCameraReadComplete()
s32 cellCameraReadEx(s32 dev_num, vm::ptr<CellCameraReadEx> read)
{
UNIMPLEMENTED_FUNC(cellCamera);
if (!cellCameraInstance.m_bInitialized)
return CELL_CAMERA_ERROR_NOT_INIT;
return CELL_OK;
}
s32 cellCameraStop()
s32 cellCameraReadComplete(s32 dev_num, u32 bufnum, u32 arg2)
{
UNIMPLEMENTED_FUNC(cellCamera);
if (!cellCameraInstance.m_bInitialized)
return CELL_CAMERA_ERROR_NOT_INIT;
return CELL_OK;
}
s32 cellCameraSetNotifyEventQueue()
s32 cellCameraStop(s32 dev_num)
{
UNIMPLEMENTED_FUNC(cellCamera);
if (!cellCameraInstance.m_bInitialized)
return CELL_CAMERA_ERROR_NOT_INIT;
return CELL_OK;
}
s32 cellCameraRemoveNotifyEventQueue()
s32 cellCameraSetNotifyEventQueue(u64 key)
{
UNIMPLEMENTED_FUNC(cellCamera);
if (!cellCameraInstance.m_bInitialized)
return CELL_CAMERA_ERROR_NOT_INIT;
return CELL_OK;
}
s32 cellCameraSetNotifyEventQueue2()
s32 cellCameraRemoveNotifyEventQueue(u64 key)
{
UNIMPLEMENTED_FUNC(cellCamera);
if (!cellCameraInstance.m_bInitialized)
return CELL_CAMERA_ERROR_NOT_INIT;
return CELL_OK;
}
s32 cellCameraRemoveNotifyEventQueue2()
s32 cellCameraSetNotifyEventQueue2(u64 key, u64 source, u64 flag)
{
UNIMPLEMENTED_FUNC(cellCamera);
return CELL_OK;
}
if (!cellCameraInstance.m_bInitialized)
return CELL_CAMERA_ERROR_NOT_INIT;
s32 cellCameraRemoveNotifyEventQueue2(u64 key)
{
UNIMPLEMENTED_FUNC(cellCamera);
return CELL_OK;
}
Module cellCamera("cellCamera", []()
{
cellCameraInstance.m_bInitialized = false;
g_camera = std::make_unique<camera_t>();
REG_FUNC(cellCamera, cellCameraInit);
REG_FUNC(cellCamera, cellCameraEnd);

View File

@ -5,19 +5,19 @@ namespace vm { using namespace ps3; }
// Error Codes
enum
{
CELL_CAMERA_ERROR_ALREADY_INIT = 0x80140801,
CELL_CAMERA_ERROR_NOT_INIT = 0x80140803,
CELL_CAMERA_ERROR_PARAM = 0x80140804,
CELL_CAMERA_ERROR_ALREADY_OPEN = 0x80140805,
CELL_CAMERA_ERROR_NOT_OPEN = 0x80140806,
CELL_CAMERA_ERROR_DEVICE_NOT_FOUND = 0x80140807,
CELL_CAMERA_ERROR_ALREADY_INIT = 0x80140801,
CELL_CAMERA_ERROR_NOT_INIT = 0x80140803,
CELL_CAMERA_ERROR_PARAM = 0x80140804,
CELL_CAMERA_ERROR_ALREADY_OPEN = 0x80140805,
CELL_CAMERA_ERROR_NOT_OPEN = 0x80140806,
CELL_CAMERA_ERROR_DEVICE_NOT_FOUND = 0x80140807,
CELL_CAMERA_ERROR_DEVICE_DEACTIVATED = 0x80140808,
CELL_CAMERA_ERROR_NOT_STARTED = 0x80140809,
CELL_CAMERA_ERROR_FORMAT_UNKNOWN = 0x8014080a,
CELL_CAMERA_ERROR_NOT_STARTED = 0x80140809,
CELL_CAMERA_ERROR_FORMAT_UNKNOWN = 0x8014080a,
CELL_CAMERA_ERROR_RESOLUTION_UNKNOWN = 0x8014080b,
CELL_CAMERA_ERROR_BAD_FRAMERATE = 0x8014080c,
CELL_CAMERA_ERROR_TIMEOUT = 0x8014080d,
CELL_CAMERA_ERROR_FATAL = 0x8014080f,
CELL_CAMERA_ERROR_BAD_FRAMERATE = 0x8014080c,
CELL_CAMERA_ERROR_TIMEOUT = 0x8014080d,
CELL_CAMERA_ERROR_FATAL = 0x8014080f,
};
// Event types
@ -313,8 +313,72 @@ struct CellCameraReadEx
};
// Custom struct to keep track of cameras
struct Camera
struct camera_t
{
u32 attr[512];
//CellCameraInfoEx info;
struct attr_t
{
u32 v1, v2;
};
std::atomic<bool> init{ false };
attr_t attr[500]{};
static const char* get_attr_name(s32 value)
{
switch (value)
{
case CELL_CAMERA_GAIN: return "CELL_CAMERA_GAIN";
case CELL_CAMERA_REDBLUEGAIN: return "CELL_CAMERA_REDBLUEGAIN";
case CELL_CAMERA_SATURATION: return "CELL_CAMERA_SATURATION";
case CELL_CAMERA_EXPOSURE: return "CELL_CAMERA_EXPOSURE";
case CELL_CAMERA_BRIGHTNESS: return "CELL_CAMERA_BRIGHTNESS";
case CELL_CAMERA_AEC: return "CELL_CAMERA_AEC";
case CELL_CAMERA_AGC: return "CELL_CAMERA_AGC";
case CELL_CAMERA_AWB: return "CELL_CAMERA_AWB";
case CELL_CAMERA_ABC: return "CELL_CAMERA_ABC";
case CELL_CAMERA_LED: return "CELL_CAMERA_LED";
case CELL_CAMERA_AUDIOGAIN: return "CELL_CAMERA_AUDIOGAIN";
case CELL_CAMERA_QS: return "CELL_CAMERA_QS";
case CELL_CAMERA_NONZEROCOEFFS: return "CELL_CAMERA_NONZEROCOEFFS";
case CELL_CAMERA_YUVFLAG: return "CELL_CAMERA_YUVFLAG";
case CELL_CAMERA_JPEGFLAG: return "CELL_CAMERA_JPEGFLAG";
case CELL_CAMERA_BACKLIGHTCOMP: return "CELL_CAMERA_BACKLIGHTCOMP";
case CELL_CAMERA_MIRRORFLAG: return "CELL_CAMERA_MIRRORFLAG";
case CELL_CAMERA_MEASUREDQS: return "CELL_CAMERA_MEASUREDQS";
case CELL_CAMERA_422FLAG: return "CELL_CAMERA_422FLAG";
case CELL_CAMERA_USBLOAD: return "CELL_CAMERA_USBLOAD";
case CELL_CAMERA_GAMMA: return "CELL_CAMERA_GAMMA";
case CELL_CAMERA_GREENGAIN: return "CELL_CAMERA_GREENGAIN";
case CELL_CAMERA_AGCLIMIT: return "CELL_CAMERA_AGCLIMIT";
case CELL_CAMERA_DENOISE: return "CELL_CAMERA_DENOISE";
case CELL_CAMERA_FRAMERATEADJUST: return "CELL_CAMERA_FRAMERATEADJUST";
case CELL_CAMERA_PIXELOUTLIERFILTER: return "CELL_CAMERA_PIXELOUTLIERFILTER";
case CELL_CAMERA_AGCLOW: return "CELL_CAMERA_AGCLOW";
case CELL_CAMERA_AGCHIGH: return "CELL_CAMERA_AGCHIGH";
case CELL_CAMERA_DEVICELOCATION: return "CELL_CAMERA_DEVICELOCATION";
case CELL_CAMERA_FORMATCAP: return "CELL_CAMERA_FORMATCAP";
case CELL_CAMERA_FORMATINDEX: return "CELL_CAMERA_FORMATINDEX";
case CELL_CAMERA_NUMFRAME: return "CELL_CAMERA_NUMFRAME";
case CELL_CAMERA_FRAMEINDEX: return "CELL_CAMERA_FRAMEINDEX";
case CELL_CAMERA_FRAMESIZE: return "CELL_CAMERA_FRAMESIZE";
case CELL_CAMERA_INTERVALTYPE: return "CELL_CAMERA_INTERVALTYPE";
case CELL_CAMERA_INTERVALINDEX: return "CELL_CAMERA_INTERVALINDEX";
case CELL_CAMERA_INTERVALVALUE: return "CELL_CAMERA_INTERVALVALUE";
case CELL_CAMERA_COLORMATCHING: return "CELL_CAMERA_COLORMATCHING";
case CELL_CAMERA_PLFREQ: return "CELL_CAMERA_PLFREQ";
case CELL_CAMERA_DEVICEID: return "CELL_CAMERA_DEVICEID";
case CELL_CAMERA_DEVICECAP: return "CELL_CAMERA_DEVICECAP";
case CELL_CAMERA_DEVICESPEED: return "CELL_CAMERA_DEVICESPEED";
case CELL_CAMERA_UVCREQCODE: return "CELL_CAMERA_UVCREQCODE";
case CELL_CAMERA_UVCREQDATA: return "CELL_CAMERA_UVCREQDATA";
case CELL_CAMERA_DEVICEID2: return "CELL_CAMERA_DEVICEID2";
case CELL_CAMERA_READMODE: return "CELL_CAMERA_READMODE";
case CELL_CAMERA_GAMEPID: return "CELL_CAMERA_GAMEPID";
case CELL_CAMERA_PBUFFER: return "CELL_CAMERA_PBUFFER";
case CELL_CAMERA_READFINISH: return "CELL_CAMERA_READFINISH";
}
return nullptr;
}
};