From e67cf6832160b499bac6eac069d7f4431cdcc422 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Fri, 22 Oct 2021 01:56:03 +0200 Subject: [PATCH] cellCamera: fix compilation on linux --- rpcs3/Emu/Cell/Modules/cellCamera.cpp | 23 ++++++++++++----------- rpcs3/Emu/system_config.h | 2 +- rpcs3/rpcs3qt/gui_application.cpp | 1 + rpcs3/rpcs3qt/qt_camera_handler.cpp | 2 +- rpcs3/rpcs3qt/qt_camera_video_surface.cpp | 4 ++-- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellCamera.cpp b/rpcs3/Emu/Cell/Modules/cellCamera.cpp index 742386acf8..eef3e83201 100644 --- a/rpcs3/Emu/Cell/Modules/cellCamera.cpp +++ b/rpcs3/Emu/Cell/Modules/cellCamera.cpp @@ -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); } diff --git a/rpcs3/Emu/system_config.h b/rpcs3/Emu/system_config.h index 1cd654b404..099baa1f21 100644 --- a/rpcs3/Emu/system_config.h +++ b/rpcs3/Emu/system_config.h @@ -243,7 +243,7 @@ struct cfg_root : cfg::node cfg::_enum mouse{ this, "Mouse", mouse_handler::basic }; cfg::_enum camera{ this, "Camera", camera_handler::null }; cfg::_enum camera_type{ this, "Camera type", fake_camera_type::unknown }; - cfg::_enum camera_flip{ this, "Camera flip", camera_flip::none, true }; + cfg::_enum camera_flip_option{ this, "Camera flip", camera_flip::none, true }; cfg::string camera_id{ this, "Camera ID", "Default", true }; cfg::_enum move{ this, "Move", move_handler::null }; cfg::_enum buzz{ this, "Buzz emulated controller", buzz_handler::null }; diff --git a/rpcs3/rpcs3qt/gui_application.cpp b/rpcs3/rpcs3qt/gui_application.cpp index 640bba95b5..8d6c295123 100644 --- a/rpcs3/rpcs3qt/gui_application.cpp +++ b/rpcs3/rpcs3qt/gui_application.cpp @@ -365,6 +365,7 @@ void gui_application::InitializeCallbacks() return std::make_shared(); } } + return nullptr; }; callbacks.get_gs_frame = [this]() -> std::unique_ptr { return get_gs_frame(); }; callbacks.get_msg_dialog = [this]() -> std::shared_ptr { return m_show_gui ? std::make_shared() : nullptr; }; diff --git a/rpcs3/rpcs3qt/qt_camera_handler.cpp b/rpcs3/rpcs3qt/qt_camera_handler.cpp index 8f65bf5176..848f5cd773 100644 --- a/rpcs3/rpcs3qt/qt_camera_handler.cpp +++ b/rpcs3/rpcs3qt/qt_camera_handler.cpp @@ -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(m_width) == resolution.width() && static_cast(m_height) == resolution.height()) { settings.setResolution(resolution.width(), resolution.height()); break; diff --git a/rpcs3/rpcs3qt/qt_camera_video_surface.cpp b/rpcs3/rpcs3qt/qt_camera_video_surface.cpp index 8e82741d2e..5473045476 100644 --- a/rpcs3/rpcs3qt/qt_camera_video_surface.cpp +++ b/rpcs3/rpcs3qt/qt_camera_video_surface.cpp @@ -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(image.width()) && m_height != static_cast(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)