1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

cellCamera: fix compilation on linux

This commit is contained in:
Megamouse 2021-10-22 01:56:03 +02:00
parent 60d35e17ac
commit e67cf68321
5 changed files with 17 additions and 15 deletions

View File

@ -322,12 +322,10 @@ error_code check_init_and_open(s32 dev_num)
error_code check_resolution(s32 dev_num)
{
// TODO: Some sort of connection check maybe?
error_code error = CELL_OK;
if (error == CELL_CAMERA_ERROR_RESOLUTION_UNKNOWN)
{
return CELL_CAMERA_ERROR_TIMEOUT;
}
//if (error == CELL_CAMERA_ERROR_RESOLUTION_UNKNOWN)
//{
// return CELL_CAMERA_ERROR_TIMEOUT;
//}
// TODO: Yet another CELL_CAMERA_ERROR_FATAL
return CELL_OK;
}
@ -1591,7 +1589,7 @@ void camera_context::operator()()
Emu.CallAfter([&]()
{
send_frame_update_event = on_handler_state(handler->get_state());
send_frame_update_event = handler ? on_handler_state(handler->get_state()) : true;
wake_up = true;
wake_up.notify_one();
});
@ -1629,7 +1627,7 @@ void camera_context::operator()()
data3 = 0; // unused
}
if (queue->send(evt_data.source, CELL_CAMERA_FRAME_UPDATE, data2, data3) == CELL_OK) [[likely]]
if (queue->send(evt_data.source, CELL_CAMERA_FRAME_UPDATE, data2, data3) == 0) [[likely]]
{
++frame_num;
}
@ -1667,8 +1665,11 @@ bool camera_context::open_camera()
{
handler.reset();
handler = Emu.GetCallbacks().get_camera_handler();
handler->open_camera();
result = on_handler_state(handler->get_state());
if (handler)
{
handler->open_camera();
result = on_handler_state(handler->get_state());
}
wake_up = true;
wake_up.notify_one();
});
@ -1813,7 +1814,7 @@ void camera_context::send_attach_state(bool attached)
{
if (auto queue = lv2_event_queue::find(key))
{
if (queue->send(evt_data.source, attached ? CELL_CAMERA_ATTACH : CELL_CAMERA_DETACH, 0, 0) != CELL_OK) [[unlikely]]
if (queue->send(evt_data.source, attached ? CELL_CAMERA_ATTACH : CELL_CAMERA_DETACH, 0, 0) != 0) [[unlikely]]
{
cellCamera.warning("Failed to send attach event (attached=%d)", attached);
}

View File

@ -243,7 +243,7 @@ struct cfg_root : cfg::node
cfg::_enum<mouse_handler> mouse{ this, "Mouse", mouse_handler::basic };
cfg::_enum<camera_handler> camera{ this, "Camera", camera_handler::null };
cfg::_enum<fake_camera_type> camera_type{ this, "Camera type", fake_camera_type::unknown };
cfg::_enum<camera_flip> camera_flip{ this, "Camera flip", camera_flip::none, true };
cfg::_enum<camera_flip> camera_flip_option{ this, "Camera flip", camera_flip::none, true };
cfg::string camera_id{ this, "Camera ID", "Default", true };
cfg::_enum<move_handler> move{ this, "Move", move_handler::null };
cfg::_enum<buzz_handler> buzz{ this, "Buzz emulated controller", buzz_handler::null };

View File

@ -365,6 +365,7 @@ void gui_application::InitializeCallbacks()
return std::make_shared<qt_camera_handler>();
}
}
return nullptr;
};
callbacks.get_gs_frame = [this]() -> std::unique_ptr<GSFrameBase> { return get_gs_frame(); };
callbacks.get_msg_dialog = [this]() -> std::shared_ptr<MsgDialogBase> { return m_show_gui ? std::make_shared<msg_dialog_frame>() : nullptr; };

View File

@ -311,7 +311,7 @@ void qt_camera_handler::update_camera_settings()
}
for (const QSize& resolution : resolutions)
{
if (m_width == resolution.width() && m_height == resolution.height())
if (static_cast<int>(m_width) == resolution.width() && static_cast<int>(m_height) == resolution.height())
{
settings.setResolution(resolution.width(), resolution.height());
break;

View File

@ -98,13 +98,13 @@ bool qt_camera_video_surface::present(const QVideoFrame& frame)
else
{
// Scale image if necessary
if (m_width > 0 && m_height > 0 && m_width != image.width() && m_height != image.height())
if (m_width > 0 && m_height > 0 && m_width != static_cast<u32>(image.width()) && m_height != static_cast<u32>(image.height()))
{
image = image.scaled(m_width, m_height, Qt::AspectRatioMode::IgnoreAspectRatio, Qt::SmoothTransformation);
}
// Determine image flip
const camera_flip flip_setting = g_cfg.io.camera_flip;
const camera_flip flip_setting = g_cfg.io.camera_flip_option;
bool flip_horizontally = m_front_facing; // Front facing cameras are flipped already
if (flip_setting == camera_flip::horizontal || flip_setting == camera_flip::both)