diff --git a/.gitignore b/.gitignore index 0e08ab7bb0..e92ae4a1bc 100644 --- a/.gitignore +++ b/.gitignore @@ -127,11 +127,6 @@ yaml-cpp.pc # miniupnp /3rdparty/miniupnp/x64/* -# opencv -/3rdparty/opencv/* -!/3rdparty/opencv/opencv410/build/x64/vc16/bin/opencv_world4100.dll -!/3rdparty/opencv/opencv410/build/x64/vc16/lib/opencv_world4100.lib - # llvm /3rdparty/llvm/llvm_build diff --git a/.gitmodules b/.gitmodules index ab95acc786..256be991bb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -96,3 +96,7 @@ path = 3rdparty/stblib/stb url = ../../nothings/stb.git ignore = dirty +[submodule "3rdparty/opencv"] + path = 3rdparty/opencv + url = ../../Megamouse/opencv_minimal.git + ignore = dirty diff --git a/3rdparty/opencv b/3rdparty/opencv new file mode 160000 index 0000000000..f76628fb5b --- /dev/null +++ b/3rdparty/opencv @@ -0,0 +1 @@ +Subproject commit f76628fb5b25746fcb75a7ce85be0d8c6439fc57 diff --git a/3rdparty/opencv/opencv410/build/x64/vc16/bin/opencv_world4100.dll b/3rdparty/opencv/opencv410/build/x64/vc16/bin/opencv_world4100.dll deleted file mode 100644 index de9b1ecc28..0000000000 Binary files a/3rdparty/opencv/opencv410/build/x64/vc16/bin/opencv_world4100.dll and /dev/null differ diff --git a/3rdparty/opencv/opencv410/build/x64/vc16/lib/opencv_world4100.lib b/3rdparty/opencv/opencv410/build/x64/vc16/lib/opencv_world4100.lib deleted file mode 100644 index 392fabf4b3..0000000000 Binary files a/3rdparty/opencv/opencv410/build/x64/vc16/lib/opencv_world4100.lib and /dev/null differ diff --git a/rpcs3/CMakeLists.txt b/rpcs3/CMakeLists.txt index 1512de77de..6f752ecc73 100644 --- a/rpcs3/CMakeLists.txt +++ b/rpcs3/CMakeLists.txt @@ -82,6 +82,9 @@ target_sources(rpcs3 Input/mm_joystick_handler.cpp Input/pad_thread.cpp Input/product_info.cpp + Input/ps_move_config.cpp + Input/ps_move_handler.cpp + Input/ps_move_tracker.cpp Input/raw_mouse_config.cpp Input/raw_mouse_handler.cpp Input/sdl_pad_handler.cpp diff --git a/rpcs3/Emu/Cell/Modules/cellGem.cpp b/rpcs3/Emu/Cell/Modules/cellGem.cpp index 6fea6f2479..bfa72c30c6 100644 --- a/rpcs3/Emu/Cell/Modules/cellGem.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGem.cpp @@ -25,8 +25,6 @@ LOG_CHANNEL(cellGem); -extern u32 get_buffer_size_by_format(s32 format, s32 width, s32 height); - template <> void fmt_class_string::format(std::string& out, u64 arg) { @@ -403,7 +401,8 @@ public: cellGem.notice("Could not load fake gem config. Using defaults."); } - cellGem.notice("Gem config=\n", g_cfg_gem.to_string()); + cellGem.notice("Real gem config=\n", g_cfg_gem_real.to_string()); + cellGem.notice("Fake gem config=\n", g_cfg_gem_fake.to_string()); }; SAVESTATE_INIT_POS(15); @@ -682,7 +681,7 @@ public: if (m_camera_info.buffer.addr() != addr && m_camera_info.pbuf[0].addr() != addr && m_camera_info.pbuf[1].addr() != addr) { - cellGem.error("gem_tracker: unexcepted image address: addr=0x%x, expected one of: 0x%x, 0x%x, 0x%x", addr, m_camera_info.buffer.addr(), m_camera_info.pbuf[0].addr(), m_camera_info.pbuf[1].addr()); + cellGem.error("gem_tracker: unexpected image address: addr=0x%x, expected one of: 0x%x, 0x%x, 0x%x", addr, m_camera_info.buffer.addr(), m_camera_info.pbuf[0].addr(), m_camera_info.pbuf[1].addr()); return false; } @@ -691,15 +690,15 @@ public: const auto& [width, height] = get_video_resolution(m_camera_info); const u32 expected_size = get_buffer_size_by_format(m_camera_info.format, width, height); - if (!m_camera_info.bytesize || m_camera_info.bytesize != expected_size) + if (!m_camera_info.bytesize || static_cast(m_camera_info.bytesize) != expected_size) { - cellGem.error("gem_tracker: unexcepted image size: size=%d, expected=%d", m_camera_info.bytesize, expected_size); + cellGem.error("gem_tracker: unexpected image size: size=%d, expected=%d", m_camera_info.bytesize, expected_size); return false; } if (!m_camera_info.bytesize) { - cellGem.error("gem_tracker: unexcepted image size: %d", m_camera_info.bytesize); + cellGem.error("gem_tracker: unexpected image size: %d", m_camera_info.bytesize); return false; } diff --git a/rpcs3/Emu/Io/PadHandler.cpp b/rpcs3/Emu/Io/PadHandler.cpp index e63368911b..a1aeeb7885 100644 --- a/rpcs3/Emu/Io/PadHandler.cpp +++ b/rpcs3/Emu/Io/PadHandler.cpp @@ -252,9 +252,7 @@ PadHandlerBase::connection PadHandlerBase::get_next_button_press(const std::stri // Keep the pad cached to reduce expensive one time requests if (!m_pad_for_pad_settings || m_pad_for_pad_settings->m_pad_handler != m_type) { - const pad_preview_values preview_values{}; m_pad_for_pad_settings = std::make_shared(m_type, 0, 0, 0, 0); - m_pad_for_pad_settings->m_sensors.resize(preview_values.size(), AnalogSensor(0, 0, 0, 0, 0)); } // Get extended device ID @@ -367,7 +365,6 @@ void PadHandlerBase::get_motion_sensors(const std::string& pad_id, const motion_ if (!m_pad_for_pad_settings || m_pad_for_pad_settings->m_pad_handler != m_type) { m_pad_for_pad_settings = std::make_shared(m_type, 0, 0, 0, 0); - m_pad_for_pad_settings->m_sensors.resize(preview_values.size(), AnalogSensor(0, 0, 0, 0, 0)); } // Get the current motion values diff --git a/rpcs3/Input/ps_move_tracker.cpp b/rpcs3/Input/ps_move_tracker.cpp index d6e3ded715..2e0d22ea05 100644 --- a/rpcs3/Input/ps_move_tracker.cpp +++ b/rpcs3/Input/ps_move_tracker.cpp @@ -18,9 +18,6 @@ namespace gem u8* video_data_out, u32 video_data_out_size); } -template class ps_move_tracker; -template class ps_move_tracker; - template ps_move_tracker::ps_move_tracker() { @@ -240,8 +237,6 @@ void ps_move_tracker::process_hues() const u32 width = m_width; const u32 height = m_height; - static const double sqrt3 = sqrt(3); - if constexpr (DiagnosticsEnabled) { std::fill(m_hues.begin(), m_hues.end(), 0); @@ -562,3 +557,6 @@ std::tuple ps_move_tracker::rgb_to_hsv(fl return { hue, saturation, cmax }; } + +template class ps_move_tracker; +template class ps_move_tracker; diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index 8d2ac8dbe5..37328608ed 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -90,7 +90,7 @@ opencv_world4100.lib;DbgHelp.lib;Ole32.lib;gdi32.lib;hidapi.lib;libusb-1.0.lib;winmm.lib;miniupnpc_static.lib;rtmidi.lib;imm32.lib;ksuser.lib;version.lib;OpenAL32.lib;XAudio.lib;GLGSRender.lib;shlwapi.lib;VKGSRender.lib;vulkan-1.lib;wolfssl.lib;libcurl.lib;Wldap32.lib;glslang.lib;OSDependent.lib;OGLCompiler.lib;SPIRV.lib;MachineIndependent.lib;GenericCodeGen.lib;Advapi32.lib;user32.lib;zlib.lib;zstd.lib;libpng16.lib;asmjit.lib;yaml-cpp.lib;discord-rpc.lib;emucore.lib;dxgi.lib;shell32.lib;Qt6Core.lib;Qt6Gui.lib;Qt6Widgets.lib;Qt6Concurrent.lib;Qt6Multimedia.lib;Qt6MultimediaWidgets.lib;Qt6Svg.lib;Qt6SvgWidgets.lib;7zip.lib;libcubeb.lib;cubeb.lib;soundtouch.lib;Avrt.lib;SDL.lib;%(AdditionalDependencies) - $(SolutionDir)3rdparty\opencv\opencv410\build\x64\vc16\lib;$(SolutionDir)3rdparty\openal\openal-soft\build;$(SolutionDir)3rdparty\glslang\build\hlsl\$(CONFIGURATION);$(SolutionDir)3rdparty\glslang\build\SPIRV\$(CONFIGURATION);$(SolutionDir)3rdparty\glslang\build\OGLCompilersDLL\$(CONFIGURATION);$(SolutionDir)3rdparty\glslang\build\glslang\OSDependent\Windows\$(CONFIGURATION);$(SolutionDir)3rdparty\glslang\build\glslang\$(CONFIGURATION);$(SolutionDir)3rdparty\discord-rpc\lib;$(SolutionDir)lib\$(CONFIGURATION)-$(PLATFORM);$(QTDIR)\lib;$(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) + $(SolutionDir)3rdparty\opencv\opencv410\build\x64\lib;$(SolutionDir)3rdparty\openal\openal-soft\build;$(SolutionDir)3rdparty\glslang\build\hlsl\$(CONFIGURATION);$(SolutionDir)3rdparty\glslang\build\SPIRV\$(CONFIGURATION);$(SolutionDir)3rdparty\glslang\build\OGLCompilersDLL\$(CONFIGURATION);$(SolutionDir)3rdparty\glslang\build\glslang\OSDependent\Windows\$(CONFIGURATION);$(SolutionDir)3rdparty\glslang\build\glslang\$(CONFIGURATION);$(SolutionDir)3rdparty\discord-rpc\lib;$(SolutionDir)lib\$(CONFIGURATION)-$(PLATFORM);$(QTDIR)\lib;$(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions) true Debug @@ -114,7 +114,7 @@ $(QTDIR)\bin\windeployqt --no-compiler-runtime --no-opengl-sw --no-patchqt --no-translations --no-quick --no-system-d3d-compiler --no-quick-import --plugindir "$(TargetDir)qt6\plugins" --release "$(TargetPath)" - xcopy /y /d "..\3rdparty\opencv\opencv410\build\x64\vc16\bin\opencv_world4100.dll" "$(OutDir)" + xcopy /y /d "..\3rdparty\opencv\opencv410\build\x64\bin\opencv_world4100.dll" "$(OutDir)" @@ -142,7 +142,7 @@ opencv_world4100.lib;DbgHelp.lib;Ole32.lib;gdi32.lib;hidapi.lib;libusb-1.0.lib;winmm.lib;miniupnpc_static.lib;rtmidi.lib;imm32.lib;ksuser.lib;version.lib;OpenAL32.lib;XAudio.lib;GLGSRender.lib;shlwapi.lib;VKGSRender.lib;vulkan-1.lib;wolfssl.lib;libcurl.lib;Wldap32.lib;glslangd.lib;OSDependentd.lib;OGLCompilerd.lib;SPIRVd.lib;MachineIndependentd.lib;GenericCodeGend.lib;Advapi32.lib;user32.lib;zlib.lib;zstd.lib;libpng16.lib;asmjit.lib;yaml-cpp.lib;discord-rpc.lib;emucore.lib;dxgi.lib;shell32.lib;Qt6Cored.lib;Qt6Guid.lib;Qt6Widgetsd.lib;Qt6Concurrentd.lib;Qt6Multimediad.lib;Qt6MultimediaWidgetsd.lib;Qt6Svgd.lib;Qt6SvgWidgetsd.lib;7zip.lib;libcubeb.lib;cubeb.lib;soundtouch.lib;Avrt.lib;SDL.lib;%(AdditionalDependencies) - $(SolutionDir)3rdparty\opencv\opencv410\build\x64\vc16\lib;$(SolutionDir)3rdparty\openal\openal-soft\build;$(SolutionDir)3rdparty\glslang\build\hlsl\$(CONFIGURATION);$(SolutionDir)3rdparty\glslang\build\SPIRV\$(CONFIGURATION);$(SolutionDir)3rdparty\glslang\build\OGLCompilersDLL\$(CONFIGURATION);$(SolutionDir)3rdparty\glslang\build\glslang\OSDependent\Windows\$(CONFIGURATION);$(SolutionDir)3rdparty\glslang\build\glslang\$(CONFIGURATION);$(SolutionDir)3rdparty\discord-rpc\lib;$(SolutionDir)lib\$(CONFIGURATION)-$(PLATFORM);$(QTDIR)\lib;$(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) + $(SolutionDir)3rdparty\opencv\opencv410\build\x64\lib;$(SolutionDir)3rdparty\openal\openal-soft\build;$(SolutionDir)3rdparty\glslang\build\hlsl\$(CONFIGURATION);$(SolutionDir)3rdparty\glslang\build\SPIRV\$(CONFIGURATION);$(SolutionDir)3rdparty\glslang\build\OGLCompilersDLL\$(CONFIGURATION);$(SolutionDir)3rdparty\glslang\build\glslang\OSDependent\Windows\$(CONFIGURATION);$(SolutionDir)3rdparty\glslang\build\glslang\$(CONFIGURATION);$(SolutionDir)3rdparty\discord-rpc\lib;$(SolutionDir)lib\$(CONFIGURATION)-$(PLATFORM);$(QTDIR)\lib;$(VULKAN_SDK)\Lib;%(AdditionalLibraryDirectories) "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /VERBOSE %(AdditionalOptions) true Debug @@ -167,7 +167,7 @@ $(QTDIR)\bin\windeployqt --no-compiler-runtime --no-opengl-sw --no-patchqt --no-translations --no-quick --no-system-d3d-compiler --no-quick-import --plugindir "$(TargetDir)qt6\plugins" --debug "$(TargetPath)" - xcopy /y /d "..\3rdparty\opencv\opencv410\build\x64\vc16\bin\opencv_world4100.dll" "$(OutDir)" + xcopy /y /d "..\3rdparty\opencv\opencv410\build\x64\bin\opencv_world4100.dll" "$(OutDir)" diff --git a/rpcs3/rpcs3qt/CMakeLists.txt b/rpcs3/rpcs3qt/CMakeLists.txt index 291b31b1f3..728afcaa35 100644 --- a/rpcs3/rpcs3qt/CMakeLists.txt +++ b/rpcs3/rpcs3qt/CMakeLists.txt @@ -65,6 +65,7 @@ add_library(rpcs3_ui STATIC pkg_install_dialog.cpp progress_dialog.cpp progress_indicator.cpp + ps_move_tracker_dialog.cpp qt_camera_handler.cpp qt_camera_video_sink.cpp qt_music_handler.cpp @@ -117,6 +118,7 @@ add_library(rpcs3_ui STATIC pad_settings_dialog.ui patch_creator_dialog.ui patch_manager_dialog.ui + ps_move_tracker_dialog.ui settings_dialog.ui shortcut_dialog.ui welcome_dialog.ui diff --git a/rpcs3/rpcs3qt/pad_settings_dialog.cpp b/rpcs3/rpcs3qt/pad_settings_dialog.cpp index ee239717af..1fbd63aad5 100644 --- a/rpcs3/rpcs3qt/pad_settings_dialog.cpp +++ b/rpcs3/rpcs3qt/pad_settings_dialog.cpp @@ -1984,6 +1984,7 @@ QString pad_settings_dialog::GetLocalizedPadName(pad_handler handler, const QStr case pad_handler::ds4: return tr("DS4 Pad #%0").arg(index); case pad_handler::dualsense: return tr("DualSense Pad #%0").arg(index); case pad_handler::skateboard: return tr("Skateboard #%0").arg(index); + case pad_handler::move: return tr("PS Move #%0").arg(index); #ifdef _WIN32 case pad_handler::xinput: return tr("XInput Pad #%0").arg(index); case pad_handler::mm: return tr("Joystick #%0").arg(index); diff --git a/rpcs3/rpcs3qt/ps_move_tracker_dialog.cpp b/rpcs3/rpcs3qt/ps_move_tracker_dialog.cpp index 6a5f4b0300..a28f7e4ada 100644 --- a/rpcs3/rpcs3qt/ps_move_tracker_dialog.cpp +++ b/rpcs3/rpcs3qt/ps_move_tracker_dialog.cpp @@ -412,7 +412,7 @@ void ps_move_tracker_dialog::process_camera_frame() { std::lock_guard camera_lock(m_camera_handler_mutex); - if (!m_camera_handler) + if (!m_camera_handler || m_camera_handler->get_state() == qt_camera_handler::camera_handler_state::closed) { // Wait some time std::this_thread::sleep_for(100us);