mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 03:25:16 +00:00
Added CAMERA_NOT_INIT checks for no camera setting
This commit is contained in:
parent
6b1d80ec25
commit
69fc1f2613
1 changed files with 61 additions and 61 deletions
|
@ -276,11 +276,6 @@ s32 cellCameraInit()
|
|||
{
|
||||
cellCamera.todo("cellCameraInit()");
|
||||
|
||||
if (g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
// Start camera thread
|
||||
const auto g_camera = fxm::make<camera_thread>("Camera Thread");
|
||||
|
||||
|
@ -289,6 +284,11 @@ s32 cellCameraInit()
|
|||
return CELL_CAMERA_ERROR_ALREADY_INIT;
|
||||
}
|
||||
|
||||
if (g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
std::lock_guard lock(g_camera->mutex);
|
||||
|
||||
switch (g_cfg.io.camera_type)
|
||||
|
@ -349,11 +349,6 @@ s32 cellCameraEnd()
|
|||
{
|
||||
cellCamera.todo("cellCameraEnd()");
|
||||
|
||||
if (g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
const auto g_camera = fxm::withdraw<camera_thread>();
|
||||
|
||||
if (!g_camera)
|
||||
|
@ -456,11 +451,6 @@ s32 cellCameraClose(s32 dev_num)
|
|||
return CELL_CAMERA_ERROR_PARAM;
|
||||
}
|
||||
|
||||
if (g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
return CELL_CAMERA_ERROR_NOT_OPEN;
|
||||
}
|
||||
|
||||
const auto g_camera = fxm::get<camera_thread>();
|
||||
|
||||
if (!g_camera)
|
||||
|
@ -468,6 +458,11 @@ s32 cellCameraClose(s32 dev_num)
|
|||
return CELL_CAMERA_ERROR_NOT_INIT;
|
||||
}
|
||||
|
||||
if (g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
return CELL_CAMERA_ERROR_NOT_OPEN;
|
||||
}
|
||||
|
||||
std::lock_guard lock(g_camera->mutex);
|
||||
|
||||
if (!g_camera->is_open)
|
||||
|
@ -503,11 +498,6 @@ s32 cellCameraGetType(s32 dev_num, vm::ptr<s32> type)
|
|||
{
|
||||
cellCamera.todo("cellCameraGetType(dev_num=%d, type=*0x%x)", dev_num, type);
|
||||
|
||||
if (g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
return CELL_CAMERA_ERROR_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
const auto g_camera = fxm::get<camera_thread>();
|
||||
|
||||
if (!g_camera)
|
||||
|
@ -515,6 +505,11 @@ s32 cellCameraGetType(s32 dev_num, vm::ptr<s32> type)
|
|||
return CELL_CAMERA_ERROR_NOT_INIT;
|
||||
}
|
||||
|
||||
if (g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
return CELL_CAMERA_ERROR_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (!check_dev_num(dev_num) || !type )
|
||||
{
|
||||
return CELL_CAMERA_ERROR_PARAM;
|
||||
|
@ -636,11 +631,6 @@ s32 cellCameraGetAttribute(s32 dev_num, s32 attrib, vm::ptr<u32> arg1, vm::ptr<u
|
|||
const auto attr_name = get_camera_attr_name(attrib);
|
||||
cellCamera.todo("cellCameraGetAttribute(dev_num=%d, attrib=%d=%s, arg1=*0x%x, arg2=*0x%x)", dev_num, attrib, attr_name, arg1, arg2);
|
||||
|
||||
if (g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
return CELL_CAMERA_ERROR_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
const auto g_camera = fxm::get<camera_thread>();
|
||||
|
||||
if (!g_camera)
|
||||
|
@ -648,6 +638,11 @@ s32 cellCameraGetAttribute(s32 dev_num, s32 attrib, vm::ptr<u32> arg1, vm::ptr<u
|
|||
return CELL_CAMERA_ERROR_NOT_INIT;
|
||||
}
|
||||
|
||||
if (g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
return CELL_CAMERA_ERROR_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (!check_dev_num(dev_num) || !attr_name || !arg1) // invalid attributes don't have a name and at least arg1 should not be NULL
|
||||
{
|
||||
return CELL_CAMERA_ERROR_PARAM;
|
||||
|
@ -683,11 +678,6 @@ s32 cellCameraSetAttribute(s32 dev_num, s32 attrib, u32 arg1, u32 arg2)
|
|||
const auto attr_name = get_camera_attr_name(attrib);
|
||||
cellCamera.todo("cellCameraSetAttribute(dev_num=%d, attrib=%d=%s, arg1=%d, arg2=%d)", dev_num, attrib, attr_name, arg1, arg2);
|
||||
|
||||
if (g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
return CELL_CAMERA_ERROR_NOT_OPEN;
|
||||
}
|
||||
|
||||
const auto g_camera = fxm::get<camera_thread>();
|
||||
|
||||
if (!g_camera)
|
||||
|
@ -695,6 +685,11 @@ s32 cellCameraSetAttribute(s32 dev_num, s32 attrib, u32 arg1, u32 arg2)
|
|||
return CELL_CAMERA_ERROR_NOT_INIT;
|
||||
}
|
||||
|
||||
if (g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
return CELL_CAMERA_ERROR_NOT_OPEN;
|
||||
}
|
||||
|
||||
if (!check_dev_num(dev_num) || !attr_name) // invalid attributes don't have a name
|
||||
{
|
||||
return CELL_CAMERA_ERROR_PARAM;
|
||||
|
@ -715,11 +710,6 @@ s32 cellCameraGetBufferSize(s32 dev_num, vm::ptr<CellCameraInfoEx> info)
|
|||
{
|
||||
cellCamera.todo("cellCameraGetBufferSize(dev_num=%d, info=*0x%x)", dev_num, info);
|
||||
|
||||
if (g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
return CELL_CAMERA_ERROR_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
const auto g_camera = fxm::get<camera_thread>();
|
||||
|
||||
if (!g_camera)
|
||||
|
@ -727,6 +717,11 @@ s32 cellCameraGetBufferSize(s32 dev_num, vm::ptr<CellCameraInfoEx> info)
|
|||
return CELL_CAMERA_ERROR_NOT_INIT;
|
||||
}
|
||||
|
||||
if (g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
return CELL_CAMERA_ERROR_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
// the next few checks have a strange order, if I can trust the tests
|
||||
|
||||
if (!check_dev_num(dev_num))
|
||||
|
@ -784,11 +779,6 @@ s32 cellCameraGetBufferInfoEx(s32 dev_num, vm::ptr<CellCameraInfoEx> info)
|
|||
|
||||
// the following should be moved to cellCameraGetBufferInfo
|
||||
|
||||
if (g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
return CELL_CAMERA_ERROR_NOT_OPEN;
|
||||
}
|
||||
|
||||
const auto g_camera = fxm::get<camera_thread>();
|
||||
|
||||
if (!g_camera)
|
||||
|
@ -796,6 +786,11 @@ s32 cellCameraGetBufferInfoEx(s32 dev_num, vm::ptr<CellCameraInfoEx> info)
|
|||
return CELL_CAMERA_ERROR_NOT_INIT;
|
||||
}
|
||||
|
||||
if (g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
return CELL_CAMERA_ERROR_NOT_OPEN;
|
||||
}
|
||||
|
||||
if (!check_dev_num(dev_num))
|
||||
{
|
||||
return CELL_CAMERA_ERROR_PARAM;
|
||||
|
@ -852,11 +847,6 @@ s32 cellCameraReset(s32 dev_num)
|
|||
return CELL_CAMERA_ERROR_PARAM;
|
||||
}
|
||||
|
||||
if (g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
return CELL_CAMERA_ERROR_NOT_OPEN;
|
||||
}
|
||||
|
||||
const auto g_camera = fxm::get<camera_thread>();
|
||||
|
||||
if (!g_camera)
|
||||
|
@ -864,6 +854,11 @@ s32 cellCameraReset(s32 dev_num)
|
|||
return CELL_CAMERA_ERROR_NOT_INIT;
|
||||
}
|
||||
|
||||
if (g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
return CELL_CAMERA_ERROR_NOT_OPEN;
|
||||
}
|
||||
|
||||
if (!g_camera->is_open)
|
||||
{
|
||||
return CELL_CAMERA_ERROR_NOT_OPEN;
|
||||
|
@ -888,11 +883,6 @@ s32 cellCameraStart(s32 dev_num)
|
|||
return CELL_CAMERA_ERROR_PARAM;
|
||||
}
|
||||
|
||||
if (g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
return CELL_CAMERA_ERROR_NOT_OPEN;
|
||||
}
|
||||
|
||||
const auto g_camera = fxm::get<camera_thread>();
|
||||
|
||||
if (!g_camera)
|
||||
|
@ -900,6 +890,11 @@ s32 cellCameraStart(s32 dev_num)
|
|||
return CELL_CAMERA_ERROR_NOT_INIT;
|
||||
}
|
||||
|
||||
if (g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
return CELL_CAMERA_ERROR_NOT_OPEN;
|
||||
}
|
||||
|
||||
std::lock_guard lock(g_camera->mutex);
|
||||
|
||||
if (!g_camera->is_open)
|
||||
|
@ -948,11 +943,6 @@ s32 cellCameraReadEx(s32 dev_num, vm::ptr<CellCameraReadEx> read)
|
|||
{
|
||||
cellCamera.todo("cellCameraReadEx(dev_num=%d, read=0x%x)", dev_num, read);
|
||||
|
||||
if (g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
return CELL_CAMERA_ERROR_NOT_OPEN;
|
||||
}
|
||||
|
||||
const auto g_camera = fxm::get<camera_thread>();
|
||||
|
||||
if (!g_camera)
|
||||
|
@ -960,6 +950,11 @@ s32 cellCameraReadEx(s32 dev_num, vm::ptr<CellCameraReadEx> read)
|
|||
return CELL_CAMERA_ERROR_NOT_INIT;
|
||||
}
|
||||
|
||||
if (g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
return CELL_CAMERA_ERROR_NOT_OPEN;
|
||||
}
|
||||
|
||||
if (!check_dev_num(dev_num))
|
||||
{
|
||||
return CELL_CAMERA_ERROR_PARAM;
|
||||
|
@ -1014,11 +1009,6 @@ s32 cellCameraStop(s32 dev_num)
|
|||
return CELL_CAMERA_ERROR_PARAM;
|
||||
}
|
||||
|
||||
if (g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
return CELL_CAMERA_ERROR_NOT_OPEN;
|
||||
}
|
||||
|
||||
const auto g_camera = fxm::get<camera_thread>();
|
||||
|
||||
if (!g_camera)
|
||||
|
@ -1026,6 +1016,11 @@ s32 cellCameraStop(s32 dev_num)
|
|||
return CELL_CAMERA_ERROR_NOT_INIT;
|
||||
}
|
||||
|
||||
if (g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
return CELL_CAMERA_ERROR_NOT_OPEN;
|
||||
}
|
||||
|
||||
if (!g_camera->is_open)
|
||||
{
|
||||
return CELL_CAMERA_ERROR_NOT_OPEN;
|
||||
|
@ -1064,6 +1059,11 @@ s32 cellCameraSetNotifyEventQueue(u64 key)
|
|||
return CELL_CAMERA_ERROR_NOT_INIT;
|
||||
}
|
||||
|
||||
if (g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
g_camera->add_queue(key, 0, 0);
|
||||
|
||||
return CELL_OK;
|
||||
|
@ -1162,7 +1162,7 @@ void camera_context::operator()()
|
|||
{
|
||||
const s32 fps = info.framerate;
|
||||
|
||||
if (!fps || Emu.IsPaused())
|
||||
if (!fps || Emu.IsPaused() || g_cfg.io.camera == camera_handler::null)
|
||||
{
|
||||
thread_ctrl::wait_for(1000); // hack
|
||||
continue;
|
||||
|
|
Loading…
Add table
Reference in a new issue