summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.ci/scripts/windows/docker.sh5
-rw-r--r--.gitmodules3
-rw-r--r--CMakeLists.txt146
-rw-r--r--CMakeModules/CopyYuzuFFmpegDeps.cmake2
-rw-r--r--README.md2
m---------externals/ffmpeg0
-rw-r--r--externals/find-modules/FindFFmpeg.cmake247
-rw-r--r--src/audio_core/stream.cpp9
-rw-r--r--src/common/string_util.cpp14
-rw-r--r--src/core/hle/service/hid/hid.cpp1
-rw-r--r--src/core/hle/service/olsc/olsc.cpp13
-rw-r--r--src/video_core/CMakeLists.txt11
-rw-r--r--src/yuzu/configuration/configure_input_player_widget.cpp34
-rw-r--r--src/yuzu/configuration/configure_input_player_widget.h2
14 files changed, 368 insertions, 121 deletions
diff --git a/.ci/scripts/windows/docker.sh b/.ci/scripts/windows/docker.sh
index 2bc9f36ab..192a01fd8 100755
--- a/.ci/scripts/windows/docker.sh
+++ b/.ci/scripts/windows/docker.sh
@@ -42,3 +42,8 @@ done
42pip3 install pefile 42pip3 install pefile
43python3 .ci/scripts/windows/scan_dll.py package/*.exe "package/" 43python3 .ci/scripts/windows/scan_dll.py package/*.exe "package/"
44python3 .ci/scripts/windows/scan_dll.py package/imageformats/*.dll "package/" 44python3 .ci/scripts/windows/scan_dll.py package/imageformats/*.dll "package/"
45
46# copy FFmpeg libraries
47EXTERNALS_PATH="$(pwd)/build/externals"
48FFMPEG_DLL_PATH="$(find ${EXTERNALS_PATH} -maxdepth 1 -type d | grep ffmpeg)/bin"
49find ${FFMPEG_DLL_PATH} -type f -regex ".*\.dll" -exec cp -v {} package/ ';'
diff --git a/.gitmodules b/.gitmodules
index 41022615b..4962f7bfd 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -37,3 +37,6 @@
37[submodule "opus"] 37[submodule "opus"]
38 path = externals/opus/opus 38 path = externals/opus/opus
39 url = https://github.com/xiph/opus.git 39 url = https://github.com/xiph/opus.git
40[submodule "externals/ffmpeg"]
41 path = externals/ffmpeg
42 url = https://git.ffmpeg.org/ffmpeg.git
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 27aa56780..c45123139 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,6 +18,8 @@ CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" ON "EN
18 18
19option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON) 19option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON)
20 20
21CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled yuzu" ON "WIN32" OFF)
22
21option(YUZU_USE_QT_WEB_ENGINE "Use QtWebEngine for web applet implementation" OFF) 23option(YUZU_USE_QT_WEB_ENGINE "Use QtWebEngine for web applet implementation" OFF)
22 24
23option(YUZU_ENABLE_BOXCAT "Enable the Boxcat service, a yuzu high-level implementation of BCAT" ON) 25option(YUZU_ENABLE_BOXCAT "Enable the Boxcat service, a yuzu high-level implementation of BCAT" ON)
@@ -384,19 +386,141 @@ if (NOT LIBUSB_FOUND)
384 set(LIBUSB_LIBRARIES usb) 386 set(LIBUSB_LIBRARIES usb)
385endif() 387endif()
386 388
387# Use system installed ffmpeg. 389# List of all FFmpeg components required
388if (NOT MSVC) 390set(FFmpeg_COMPONENTS
389 find_package(FFmpeg REQUIRED) 391 avcodec
390else() 392 avutil
391 set(FFMPEG_EXT_NAME "ffmpeg-4.2.1") 393 swscale)
392 set(FFMPEG_PATH "${CMAKE_BINARY_DIR}/externals/${FFMPEG_EXT_NAME}") 394
393 download_bundled_external("ffmpeg/" ${FFMPEG_EXT_NAME} "") 395if (NOT YUZU_USE_BUNDLED_FFMPEG)
394 set(FFMPEG_FOUND YES) 396 # Use system installed FFmpeg
395 set(FFMPEG_INCLUDE_DIR "${FFMPEG_PATH}/include" CACHE PATH "Path to FFmpeg headers" FORCE) 397 find_package(FFmpeg REQUIRED COMPONENTS ${FFmpeg_COMPONENTS})
396 set(FFMPEG_LIBRARY_DIR "${FFMPEG_PATH}/bin" CACHE PATH "Path to FFmpeg library" FORCE) 398
397 set(FFMPEG_DLL_DIR "${FFMPEG_PATH}/bin" CACHE PATH "Path to FFmpeg dll's" FORCE) 399 if (FFmpeg_FOUND)
400 # Overwrite aggregate defines from FFmpeg module to avoid over-linking libraries.
401 # Prevents shipping too many libraries with the AppImage.
402 set(FFmpeg_LIBRARIES "")
403 set(FFmpeg_INCLUDE_DIR "")
404
405 foreach(COMPONENT ${FFmpeg_COMPONENTS})
406 set(FFmpeg_LIBRARIES ${FFmpeg_LIBRARIES} ${FFmpeg_LIBRARY_${COMPONENT}} CACHE PATH "Paths to FFmpeg libraries" FORCE)
407 set(FFmpeg_INCLUDE_DIR ${FFmpeg_INCLUDE_DIR} ${FFmpeg_INCLUDE_${COMPONENT}} CACHE PATH "Path to FFmpeg headers" FORCE)
408 endforeach()
409 else()
410 message(WARNING "FFmpeg not found, falling back to externals")
411 set(YUZU_USE_BUNDLED_FFMPEG ON)
412 endif()
413endif()
414
415if (YUZU_USE_BUNDLED_FFMPEG)
416 if (NOT WIN32)
417 # Build FFmpeg from externals
418 message(STATUS "Using FFmpeg from externals")
419
420 # FFmpeg has source that requires one of nasm or yasm to assemble it.
421 # REQUIRED throws an error if not found here during configuration rather than during compilation.
422 find_program(ASSEMBLER NAMES nasm yasm REQUIRED)
423
424 set(FFmpeg_PREFIX ${PROJECT_SOURCE_DIR}/externals/ffmpeg)
425 set(FFmpeg_BUILD_DIR ${PROJECT_BINARY_DIR}/externals/ffmpeg)
426 set(FFmpeg_MAKEFILE ${FFmpeg_BUILD_DIR}/Makefile)
427 make_directory(${FFmpeg_BUILD_DIR})
428
429 # Read version string from external
430 file(READ ${FFmpeg_PREFIX}/RELEASE FFmpeg_VERSION)
431 set(FFmpeg_FOUND NO)
432 if (NOT FFmpeg_VERSION STREQUAL "")
433 set(FFmpeg_FOUND YES)
434 endif()
435
436 foreach(COMPONENT ${FFmpeg_COMPONENTS})
437 set(FFmpeg_${COMPONENT}_PREFIX "${FFmpeg_BUILD_DIR}/lib${COMPONENT}")
438 set(FFmpeg_${COMPONENT}_LIB_NAME "lib${COMPONENT}.a")
439 set(FFmpeg_${COMPONENT}_LIBRARY "${FFmpeg_${COMPONENT}_PREFIX}/${FFmpeg_${COMPONENT}_LIB_NAME}")
440
441 set(FFmpeg_LIBRARIES
442 ${FFmpeg_LIBRARIES}
443 ${FFmpeg_${COMPONENT}_LIBRARY}
444 CACHE PATH "Paths to FFmpeg libraries" FORCE)
445 endforeach()
446
447 set(FFmpeg_INCLUDE_DIR
448 ${FFmpeg_PREFIX}
449 CACHE PATH "Path to FFmpeg headers" FORCE)
450
451 # `configure` parameters builds only exactly what yuzu needs from FFmpeg
452 # `--disable-{vaapi,vdpau}` is needed to avoid linking issues
453 add_custom_command(
454 OUTPUT
455 ${FFmpeg_MAKEFILE}
456 COMMAND
457 /bin/bash ${FFmpeg_PREFIX}/configure
458 --disable-avdevice
459 --disable-avfilter
460 --disable-avformat
461 --disable-doc
462 --disable-everything
463 --disable-ffmpeg
464 --disable-ffprobe
465 --disable-network
466 --disable-postproc
467 --disable-swresample
468 --disable-vaapi
469 --disable-vdpau
470 --enable-decoder=h264
471 --enable-decoder=vp9
472 WORKING_DIRECTORY
473 ${FFmpeg_BUILD_DIR}
474 )
475
476 # Workaround for Ubuntu 18.04's older version of make not being able to call make as a child
477 # with context of the jobserver. Also helps ninja users.
478 execute_process(
479 COMMAND
480 nproc
481 OUTPUT_VARIABLE
482 SYSTEM_THREADS)
483
484 add_custom_command(
485 OUTPUT
486 ${FFmpeg_LIBRARIES}
487 COMMAND
488 make -j${SYSTEM_THREADS}
489 WORKING_DIRECTORY
490 ${FFmpeg_BUILD_DIR}
491 )
492
493 # ALL makes this custom target build every time
494 # but it won't actually build if the DEPENDS parameter is up to date
495 add_custom_target(ffmpeg-build ALL DEPENDS ${FFmpeg_LIBRARIES})
496 add_custom_target(ffmpeg-configure ALL DEPENDS ${FFmpeg_MAKEFILE})
497
498 if (FFmpeg_FOUND)
499 message(STATUS "Found FFmpeg version ${FFmpeg_VERSION}")
500
501 add_dependencies(ffmpeg-build ffmpeg-configure)
502 else()
503 message(FATAL_ERROR "FFmpeg not found")
504 endif()
505 else() # WIN32
506 # Use yuzu FFmpeg binaries
507 set(FFmpeg_EXT_NAME "ffmpeg-4.2.1")
508 set(FFmpeg_PATH "${CMAKE_BINARY_DIR}/externals/${FFmpeg_EXT_NAME}")
509 download_bundled_external("ffmpeg/" ${FFmpeg_EXT_NAME} "")
510 set(FFmpeg_FOUND YES)
511 set(FFmpeg_INCLUDE_DIR "${FFmpeg_PATH}/include" CACHE PATH "Path to FFmpeg headers" FORCE)
512 set(FFmpeg_LIBRARY_DIR "${FFmpeg_PATH}/bin" CACHE PATH "Path to FFmpeg library directory" FORCE)
513 set(FFmpeg_DLL_DIR "${FFmpeg_PATH}/bin" CACHE PATH "Path to FFmpeg dll's" FORCE)
514 set(FFmpeg_LIBRARIES
515 ${FFmpeg_LIBRARY_DIR}/swscale.lib
516 ${FFmpeg_LIBRARY_DIR}/avcodec.lib
517 ${FFmpeg_LIBRARY_DIR}/avutil.lib
518 CACHE PATH "Paths to FFmpeg libraries" FORCE)
519 endif()
398endif() 520endif()
399 521
522unset(FFmpeg_COMPONENTS)
523
400# Prefer the -pthread flag on Linux. 524# Prefer the -pthread flag on Linux.
401set(THREADS_PREFER_PTHREAD_FLAG ON) 525set(THREADS_PREFER_PTHREAD_FLAG ON)
402find_package(Threads REQUIRED) 526find_package(Threads REQUIRED)
diff --git a/CMakeModules/CopyYuzuFFmpegDeps.cmake b/CMakeModules/CopyYuzuFFmpegDeps.cmake
index cca1eeeab..b7162cf17 100644
--- a/CMakeModules/CopyYuzuFFmpegDeps.cmake
+++ b/CMakeModules/CopyYuzuFFmpegDeps.cmake
@@ -1,7 +1,7 @@
1function(copy_yuzu_FFmpeg_deps target_dir) 1function(copy_yuzu_FFmpeg_deps target_dir)
2 include(WindowsCopyFiles) 2 include(WindowsCopyFiles)
3 set(DLL_DEST "${CMAKE_BINARY_DIR}/bin/$<CONFIG>/") 3 set(DLL_DEST "${CMAKE_BINARY_DIR}/bin/$<CONFIG>/")
4 windows_copy_files(${target_dir} ${FFMPEG_DLL_DIR} ${DLL_DEST} 4 windows_copy_files(${target_dir} ${FFmpeg_DLL_DIR} ${DLL_DEST}
5 avcodec-58.dll 5 avcodec-58.dll
6 avutil-56.dll 6 avutil-56.dll
7 swresample-3.dll 7 swresample-3.dll
diff --git a/README.md b/README.md
index fbf62eb7c..cb1a64d8c 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,7 @@ If you want to contribute to the user interface translation, please check out th
33 33
34 34
35### Support 35### Support
36We happily accept monetary donations or donated games and hardware. Please see our [donations page](https://yuzu-emu.org/donate/) for more information on how you can contribute to yuzu. Any donations received will go towards things like: 36We happily accept monetary donations, or donated games and hardware. Please see our [donations page](https://yuzu-emu.org/donate/) for more information on how you can contribute to yuzu. Any donations received will go towards things like:
37* Switch consoles to explore and reverse-engineer the hardware 37* Switch consoles to explore and reverse-engineer the hardware
38* Switch games for testing, reverse-engineering, and implementing new features 38* Switch games for testing, reverse-engineering, and implementing new features
39* Web hosting and infrastructure setup 39* Web hosting and infrastructure setup
diff --git a/externals/ffmpeg b/externals/ffmpeg
new file mode 160000
Subproject 6b6b9e593dd4d3aaf75f48d40a13ef03bdef9fd
diff --git a/externals/find-modules/FindFFmpeg.cmake b/externals/find-modules/FindFFmpeg.cmake
index 77b331e00..61b6dc8d2 100644
--- a/externals/find-modules/FindFFmpeg.cmake
+++ b/externals/find-modules/FindFFmpeg.cmake
@@ -1,100 +1,187 @@
1# - Try to find ffmpeg libraries (libavcodec, libavformat and libavutil) 1# FindFFmpeg
2# Once done this will define 2# ----------
3# 3#
4# FFMPEG_FOUND - system has ffmpeg or libav 4# Copyright 2019 Citra Emulator Project
5# FFMPEG_INCLUDE_DIR - the ffmpeg include directory 5# Licensed under GPLv2 or any later version
6# FFMPEG_LIBRARIES - Link these to use ffmpeg
7# FFMPEG_LIBAVCODEC
8# FFMPEG_LIBAVFORMAT
9# FFMPEG_LIBAVUTIL
10# 6#
11# Copyright (c) 2008 Andreas Schneider <mail@cynapses.org> 7# Find the native FFmpeg includes and libraries
12# Modified for other libraries by Lasse Kärkkäinen <tronic>
13# Modified for Hedgewars by Stepik777
14# Modified for FFmpeg-example Tuukka Pasanen 2018
15# Modified for yuzu toastUnlimted 2020
16# 8#
17# Redistribution and use is allowed according to the terms of the New 9# This module defines the following variables:
18# BSD license. 10#
11# FFmpeg_INCLUDE_<component>: where to find <component>.h
12# FFmpeg_LIBRARY_<component>: where to find the <component> library
13# FFmpeg_INCLUDE_DIR: aggregate all the include paths
14# FFmpeg_LIBRARIES: aggregate all the paths to the libraries
15# FFmpeg_FOUND: True if all components have been found
16#
17# This module defines the following targets, which are prefered over variables:
18#
19# FFmpeg::<component>: Target to use <component> directly, with include path,
20# library and dependencies set up. If you are using a static build, you are
21# responsible for adding any external dependencies (such as zlib, bzlib...).
22#
23# <component> can be one of:
24# avcodec
25# avdevice
26# avfilter
27# avformat
28# avutil
29# postproc
30# swresample
31# swscale
19# 32#
20 33
21include(FindPackageHandleStandardArgs) 34set(_FFmpeg_ALL_COMPONENTS
22 35 avcodec
23find_package_handle_standard_args(FFMPEG 36 avdevice
24 FOUND_VAR FFMPEG_FOUND 37 avfilter
25 REQUIRED_VARS 38 avformat
26 FFMPEG_LIBRARY 39 avutil
27 FFMPEG_INCLUDE_DIR 40 postproc
28 VERSION_VAR FFMPEG_VERSION 41 swresample
42 swscale
29) 43)
30 44
31if(FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR) 45set(_FFmpeg_DEPS_avcodec avutil)
32 # in cache already 46set(_FFmpeg_DEPS_avdevice avcodec avformat avutil)
33 set(FFMPEG_FOUND TRUE) 47set(_FFmpeg_DEPS_avfilter avutil)
34else() 48set(_FFmpeg_DEPS_avformat avcodec avutil)
35 # use pkg-config to get the directories and then use these values 49set(_FFmpeg_DEPS_postproc avutil)
36 # in the FIND_PATH() and FIND_LIBRARY() calls 50set(_FFmpeg_DEPS_swresample avutil)
37 find_package(PkgConfig) 51set(_FFmpeg_DEPS_swscale avutil)
38 if(PKG_CONFIG_FOUND) 52
39 pkg_check_modules(_FFMPEG_AVCODEC libavcodec) 53function(find_ffmpeg LIBNAME)
40 pkg_check_modules(_FFMPEG_AVUTIL libavutil) 54 if(DEFINED ENV{FFMPEG_DIR})
41 pkg_check_modules(_FFMPEG_SWSCALE libswscale) 55 set(FFMPEG_DIR $ENV{FFMPEG_DIR})
42 endif() 56 endif()
43 57
44 find_path(FFMPEG_AVCODEC_INCLUDE_DIR 58 if(FFMPEG_DIR)
45 NAMES libavcodec/avcodec.h 59 list(APPEND INCLUDE_PATHS
46 PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS} 60 ${FFMPEG_DIR}
47 /usr/include 61 ${FFMPEG_DIR}/ffmpeg
48 /usr/local/include 62 ${FFMPEG_DIR}/lib${LIBNAME}
49 /opt/local/include 63 ${FFMPEG_DIR}/include/lib${LIBNAME}
50 /sw/include 64 ${FFMPEG_DIR}/include/ffmpeg
51 PATH_SUFFIXES ffmpeg libav) 65 ${FFMPEG_DIR}/include
52 66 NO_DEFAULT_PATH
53 find_library(FFMPEG_LIBAVCODEC 67 NO_CMAKE_FIND_ROOT_PATH
54 NAMES avcodec 68 )
55 PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS} 69 list(APPEND LIB_PATHS
56 /usr/lib 70 ${FFMPEG_DIR}
57 /usr/local/lib 71 ${FFMPEG_DIR}/lib
58 /opt/local/lib 72 ${FFMPEG_DIR}/lib${LIBNAME}
59 /sw/lib) 73 NO_DEFAULT_PATH
74 NO_CMAKE_FIND_ROOT_PATH
75 )
76 else()
77 list(APPEND INCLUDE_PATHS
78 /usr/local/include/ffmpeg
79 /usr/local/include/lib${LIBNAME}
80 /usr/include/ffmpeg
81 /usr/include/lib${LIBNAME}
82 /usr/include/ffmpeg/lib${LIBNAME}
83 )
60 84
61 find_library(FFMPEG_LIBAVUTIL 85 list(APPEND LIB_PATHS
62 NAMES avutil
63 PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS}
64 /usr/lib
65 /usr/local/lib 86 /usr/local/lib
66 /opt/local/lib
67 /sw/lib)
68
69 find_library(FFMPEG_LIBSWSCALE
70 NAMES swscale
71 PATHS ${_FFMPEG_SWSCALE_LIBRARY_DIRS}
72 /usr/lib 87 /usr/lib
73 /usr/local/lib 88 )
74 /opt/local/lib
75 /sw/lib)
76
77 if(FFMPEG_LIBAVCODEC AND FFMPEG_LIBAVUTIL AND FFMPEG_LIBSWSCALE)
78 set(FFMPEG_FOUND TRUE)
79 endif() 89 endif()
80 90
81 if(FFMPEG_FOUND) 91 find_path(FFmpeg_INCLUDE_${LIBNAME} lib${LIBNAME}/${LIBNAME}.h
82 set(FFMPEG_INCLUDE_DIR ${FFMPEG_AVCODEC_INCLUDE_DIR}) 92 HINTS ${INCLUDE_PATHS}
83 set(FFMPEG_LIBRARIES 93 )
84 ${FFMPEG_LIBAVCODEC} 94
85 ${FFMPEG_LIBAVUTIL} 95 find_library(FFmpeg_LIBRARY_${LIBNAME} ${LIBNAME}
86 ${FFMPEG_LIBSWSCALE}) 96 HINTS ${LIB_PATHS}
97 )
98
99 if(NOT FFMPEG_DIR AND (NOT FFmpeg_LIBRARY_${LIBNAME} OR NOT FFmpeg_INCLUDE_${LIBNAME}))
100 # Didn't find it in the usual paths, try pkg-config
101 find_package(PkgConfig QUIET)
102 pkg_check_modules(FFmpeg_PKGCONFIG_${LIBNAME} QUIET lib${LIBNAME})
103
104 find_path(FFmpeg_INCLUDE_${LIBNAME} lib${LIBNAME}/${LIBNAME}.h
105 ${FFmpeg_PKGCONFIG_${LIBNAME}_INCLUDE_DIRS}
106 )
107
108 find_library(FFmpeg_LIBRARY_${LIBNAME} ${LIBNAME}
109 ${FFmpeg_PKGCONFIG_${LIBNAME}_LIBRARY_DIRS}
110 )
87 endif() 111 endif()
88 112
89 if(FFMPEG_FOUND) 113 if(FFmpeg_INCLUDE_${LIBNAME} AND FFmpeg_LIBRARY_${LIBNAME})
90 if(NOT FFMPEG_FIND_QUIETLY) 114 set(FFmpeg_INCLUDE_${LIBNAME} "${FFmpeg_INCLUDE_${LIBNAME}}" PARENT_SCOPE)
91 message(STATUS 115 set(FFmpeg_LIBRARY_${LIBNAME} "${FFmpeg_LIBRARY_${LIBNAME}}" PARENT_SCOPE)
92 "Found FFMPEG or Libav: ${FFMPEG_LIBRARIES}, ${FFMPEG_INCLUDE_DIR}") 116
117 # Extract FFmpeg version from version.h
118 foreach(v MAJOR MINOR MICRO)
119 set(FFmpeg_${LIBNAME}_VERSION_${v} 0)
120 endforeach()
121 string(TOUPPER ${LIBNAME} LIBNAME_UPPER)
122 file(STRINGS "${FFmpeg_INCLUDE_${LIBNAME}}/lib${LIBNAME}/version.h" _FFmpeg_VERSION_H_CONTENTS REGEX "#define LIB${LIBNAME_UPPER}_VERSION_(MAJOR|MINOR|MICRO) ")
123 set(_FFmpeg_VERSION_REGEX "([0-9]+)")
124 foreach(v MAJOR MINOR MICRO)
125 if("${_FFmpeg_VERSION_H_CONTENTS}" MATCHES "#define LIB${LIBNAME_UPPER}_VERSION_${v}[\\t ]+${_FFmpeg_VERSION_REGEX}")
126 set(FFmpeg_${LIBNAME}_VERSION_${v} "${CMAKE_MATCH_1}")
127 endif()
128 endforeach()
129 set(FFmpeg_${LIBNAME}_VERSION "${FFmpeg_${LIBNAME}_VERSION_MAJOR}.${FFmpeg_${LIBNAME}_VERSION_MINOR}.${FFmpeg_${LIBNAME}_VERSION_MICRO}")
130 set(FFmpeg_${c}_VERSION "${FFmpeg_${LIBNAME}_VERSION}" PARENT_SCOPE)
131 unset(_FFmpeg_VERSION_REGEX)
132 unset(_FFmpeg_VERSION_H_CONTENTS)
133
134 set(FFmpeg_${c}_FOUND TRUE PARENT_SCOPE)
135 if(NOT FFmpeg_FIND_QUIETLY)
136 message("-- Found ${LIBNAME}: ${FFmpeg_INCLUDE_${LIBNAME}} ${FFmpeg_LIBRARY_${LIBNAME}} (version: ${FFmpeg_${LIBNAME}_VERSION})")
93 endif() 137 endif()
94 else() 138 endif()
95 if(FFMPEG_FIND_REQUIRED) 139endfunction()
96 message(FATAL_ERROR 140
97 "Could not find libavcodec or libavutil or libswscale") 141foreach(c ${_FFmpeg_ALL_COMPONENTS})
142 find_ffmpeg(${c})
143endforeach()
144
145foreach(c ${_FFmpeg_ALL_COMPONENTS})
146 if(FFmpeg_${c}_FOUND)
147 list(APPEND FFmpeg_INCLUDE_DIR ${FFmpeg_INCLUDE_${c}})
148 list(APPEND FFmpeg_LIBRARIES ${FFmpeg_LIBRARY_${c}})
149
150 add_library(FFmpeg::${c} IMPORTED UNKNOWN)
151 set_target_properties(FFmpeg::${c} PROPERTIES
152 IMPORTED_LOCATION ${FFmpeg_LIBRARY_${c}}
153 INTERFACE_INCLUDE_DIRECTORIES ${FFmpeg_INCLUDE_${c}}
154 )
155 if(_FFmpeg_DEPS_${c})
156 set(deps)
157 foreach(dep ${_FFmpeg_DEPS_${c}})
158 list(APPEND deps FFmpeg::${dep})
159 endforeach()
160
161 set_target_properties(FFmpeg::${c} PROPERTIES
162 INTERFACE_LINK_LIBRARIES "${deps}"
163 )
164 unset(deps)
98 endif() 165 endif()
99 endif() 166 endif()
167endforeach()
168
169if(FFmpeg_INCLUDE_DIR)
170 list(REMOVE_DUPLICATES FFmpeg_INCLUDE_DIR)
100endif() 171endif()
172
173foreach(c ${FFmpeg_FIND_COMPONENTS})
174 list(APPEND _FFmpeg_REQUIRED_VARS FFmpeg_INCLUDE_${c} FFmpeg_LIBRARY_${c})
175endforeach()
176
177include(FindPackageHandleStandardArgs)
178find_package_handle_standard_args(FFmpeg
179 REQUIRED_VARS ${_FFmpeg_REQUIRED_VARS}
180 HANDLE_COMPONENTS
181)
182
183foreach(c ${_FFmpeg_ALL_COMPONENTS})
184 unset(_FFmpeg_DEPS_${c})
185endforeach()
186unset(_FFmpeg_ALL_COMPONENTS)
187unset(_FFmpeg_REQUIRED_VARS)
diff --git a/src/audio_core/stream.cpp b/src/audio_core/stream.cpp
index 5b0b285cd..b0f6f0c34 100644
--- a/src/audio_core/stream.cpp
+++ b/src/audio_core/stream.cpp
@@ -111,7 +111,14 @@ void Stream::PlayNextBuffer(std::chrono::nanoseconds ns_late) {
111 111
112 sink_stream.EnqueueSamples(GetNumChannels(), active_buffer->GetSamples()); 112 sink_stream.EnqueueSamples(GetNumChannels(), active_buffer->GetSamples());
113 113
114 core_timing.ScheduleEvent(GetBufferReleaseNS(*active_buffer) - ns_late, release_event, {}); 114 const auto buffer_release_ns = GetBufferReleaseNS(*active_buffer);
115
116 // If ns_late is higher than the update rate ignore the delay
117 if (ns_late > buffer_release_ns) {
118 ns_late = {};
119 }
120
121 core_timing.ScheduleEvent(buffer_release_ns - ns_late, release_event, {});
115} 122}
116 123
117void Stream::ReleaseActiveBuffer(std::chrono::nanoseconds ns_late) { 124void Stream::ReleaseActiveBuffer(std::chrono::nanoseconds ns_late) {
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index 4cba2aaa4..7b614ad89 100644
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -141,27 +141,13 @@ std::string ReplaceAll(std::string result, const std::string& src, const std::st
141} 141}
142 142
143std::string UTF16ToUTF8(const std::u16string& input) { 143std::string UTF16ToUTF8(const std::u16string& input) {
144#ifdef _MSC_VER
145 // Workaround for missing char16_t/char32_t instantiations in MSVC2017
146 std::wstring_convert<std::codecvt_utf8_utf16<__int16>, __int16> convert;
147 std::basic_string<__int16> tmp_buffer(input.cbegin(), input.cend());
148 return convert.to_bytes(tmp_buffer);
149#else
150 std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert; 144 std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
151 return convert.to_bytes(input); 145 return convert.to_bytes(input);
152#endif
153} 146}
154 147
155std::u16string UTF8ToUTF16(const std::string& input) { 148std::u16string UTF8ToUTF16(const std::string& input) {
156#ifdef _MSC_VER
157 // Workaround for missing char16_t/char32_t instantiations in MSVC2017
158 std::wstring_convert<std::codecvt_utf8_utf16<__int16>, __int16> convert;
159 auto tmp_buffer = convert.from_bytes(input);
160 return std::u16string(tmp_buffer.cbegin(), tmp_buffer.cend());
161#else
162 std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert; 149 std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
163 return convert.from_bytes(input); 150 return convert.from_bytes(input);
164#endif
165} 151}
166 152
167#ifdef _WIN32 153#ifdef _WIN32
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 51a010a55..1e2677320 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -110,6 +110,7 @@ void IAppletResource::DeactivateController(HidController controller) {
110 110
111IAppletResource ::~IAppletResource() { 111IAppletResource ::~IAppletResource() {
112 system.CoreTiming().UnscheduleEvent(pad_update_event, 0); 112 system.CoreTiming().UnscheduleEvent(pad_update_event, 0);
113 system.CoreTiming().UnscheduleEvent(motion_update_event, 0);
113} 114}
114 115
115void IAppletResource::GetSharedMemoryHandle(Kernel::HLERequestContext& ctx) { 116void IAppletResource::GetSharedMemoryHandle(Kernel::HLERequestContext& ctx) {
diff --git a/src/core/hle/service/olsc/olsc.cpp b/src/core/hle/service/olsc/olsc.cpp
index 4440135ed..e2ac71fa1 100644
--- a/src/core/hle/service/olsc/olsc.cpp
+++ b/src/core/hle/service/olsc/olsc.cpp
@@ -17,7 +17,7 @@ public:
17 static const FunctionInfo functions[] = { 17 static const FunctionInfo functions[] = {
18 {0, &OLSC::Initialize, "Initialize"}, 18 {0, &OLSC::Initialize, "Initialize"},
19 {10, nullptr, "VerifySaveDataBackupLicenseAsync"}, 19 {10, nullptr, "VerifySaveDataBackupLicenseAsync"},
20 {13, nullptr, "GetSaveDataBackupSetting"}, 20 {13, &OLSC::GetSaveDataBackupSetting, "GetSaveDataBackupSetting"},
21 {14, &OLSC::SetSaveDataBackupSettingEnabled, "SetSaveDataBackupSettingEnabled"}, 21 {14, &OLSC::SetSaveDataBackupSettingEnabled, "SetSaveDataBackupSettingEnabled"},
22 {15, nullptr, "SetCustomData"}, 22 {15, nullptr, "SetCustomData"},
23 {16, nullptr, "DeleteSaveDataBackupSetting"}, 23 {16, nullptr, "DeleteSaveDataBackupSetting"},
@@ -52,6 +52,17 @@ private:
52 rb.Push(RESULT_SUCCESS); 52 rb.Push(RESULT_SUCCESS);
53 } 53 }
54 54
55 void GetSaveDataBackupSetting(Kernel::HLERequestContext& ctx) {
56 LOG_WARNING(Service_OLSC, "(STUBBED) called");
57
58 // backup_setting is set to 0 since real value is unknown
59 constexpr u64 backup_setting = 0;
60
61 IPC::ResponseBuilder rb{ctx, 4};
62 rb.Push(RESULT_SUCCESS);
63 rb.Push(backup_setting);
64 }
65
55 void SetSaveDataBackupSettingEnabled(Kernel::HLERequestContext& ctx) { 66 void SetSaveDataBackupSettingEnabled(Kernel::HLERequestContext& ctx) {
56 LOG_WARNING(Service_OLSC, "(STUBBED) called"); 67 LOG_WARNING(Service_OLSC, "(STUBBED) called");
57 68
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt
index 2cf95937e..dd4c29ed3 100644
--- a/src/video_core/CMakeLists.txt
+++ b/src/video_core/CMakeLists.txt
@@ -271,14 +271,13 @@ create_target_directory_groups(video_core)
271target_link_libraries(video_core PUBLIC common core) 271target_link_libraries(video_core PUBLIC common core)
272target_link_libraries(video_core PRIVATE glad xbyak) 272target_link_libraries(video_core PRIVATE glad xbyak)
273 273
274if (MSVC) 274if (YUZU_USE_BUNDLED_FFMPEG AND NOT WIN32)
275 target_include_directories(video_core PRIVATE ${FFMPEG_INCLUDE_DIR}) 275 add_dependencies(video_core ffmpeg-build)
276 target_link_libraries(video_core PUBLIC ${FFMPEG_LIBRARY_DIR}/swscale.lib ${FFMPEG_LIBRARY_DIR}/avcodec.lib ${FFMPEG_LIBRARY_DIR}/avutil.lib)
277else()
278 target_include_directories(video_core PRIVATE ${FFMPEG_INCLUDE_DIR})
279 target_link_libraries(video_core PRIVATE ${FFMPEG_LIBRARIES})
280endif() 276endif()
281 277
278target_include_directories(video_core PRIVATE ${FFmpeg_INCLUDE_DIR})
279target_link_libraries(video_core PRIVATE ${FFmpeg_LIBRARIES})
280
282add_dependencies(video_core host_shaders) 281add_dependencies(video_core host_shaders)
283target_include_directories(video_core PRIVATE ${HOST_SHADERS_INCLUDE}) 282target_include_directories(video_core PRIVATE ${HOST_SHADERS_INCLUDE})
284target_include_directories(video_core PRIVATE sirit ../../externals/Vulkan-Headers/include) 283target_include_directories(video_core PRIVATE sirit ../../externals/Vulkan-Headers/include)
diff --git a/src/yuzu/configuration/configure_input_player_widget.cpp b/src/yuzu/configuration/configure_input_player_widget.cpp
index e3e8bde48..e77ccc057 100644
--- a/src/yuzu/configuration/configure_input_player_widget.cpp
+++ b/src/yuzu/configuration/configure_input_player_widget.cpp
@@ -699,9 +699,9 @@ void PlayerControlPreview::DrawProController(QPainter& p, const QPointF center)
699 { 699 {
700 // Draw joysticks 700 // Draw joysticks
701 using namespace Settings::NativeAnalog; 701 using namespace Settings::NativeAnalog;
702 DrawProJoystick(p, center + QPointF(-111, -55) + (axis_values[LStick].value * 11), 702 DrawProJoystick(p, center + QPointF(-111, -55), axis_values[LStick].value, 11,
703 button_values[Settings::NativeButton::LStick]); 703 button_values[Settings::NativeButton::LStick]);
704 DrawProJoystick(p, center + QPointF(51, 0) + (axis_values[RStick].value * 11), 704 DrawProJoystick(p, center + QPointF(51, 0), axis_values[RStick].value, 11,
705 button_values[Settings::NativeButton::RStick]); 705 button_values[Settings::NativeButton::RStick]);
706 DrawRawJoystick(p, center + QPointF(-50, 105), axis_values[LStick].raw_value, 706 DrawRawJoystick(p, center + QPointF(-50, 105), axis_values[LStick].raw_value,
707 axis_values[LStick].properties); 707 axis_values[LStick].properties);
@@ -2273,15 +2273,39 @@ void PlayerControlPreview::DrawJoystickSideview(QPainter& p, const QPointF cente
2273 p.drawLine(p2.at(32), p2.at(71)); 2273 p.drawLine(p2.at(32), p2.at(71));
2274} 2274}
2275 2275
2276void PlayerControlPreview::DrawProJoystick(QPainter& p, const QPointF center, bool pressed) { 2276void PlayerControlPreview::DrawProJoystick(QPainter& p, const QPointF center, const QPointF offset,
2277 float offset_scalar, bool pressed) {
2278 const float radius1 = 24.0f;
2279 const float radius2 = 17.0f;
2280
2281 const QPointF offset_center = center + offset * offset_scalar;
2282
2283 const auto amplitude = static_cast<float>(
2284 1.0 - std::sqrt((offset.x() * offset.x()) + (offset.y() * offset.y())) * 0.1f);
2285
2286 const float rotation =
2287 ((offset.x() == 0) ? atan(1) * 2 : atan(offset.y() / offset.x())) * (180 / (atan(1) * 4));
2288
2289 p.save();
2290 p.translate(offset_center);
2291 p.rotate(rotation);
2292
2277 // Outer circle 2293 // Outer circle
2278 p.setPen(colors.outline); 2294 p.setPen(colors.outline);
2279 p.setBrush(pressed ? colors.highlight : colors.button); 2295 p.setBrush(pressed ? colors.highlight : colors.button);
2280 DrawCircle(p, center, 24.0f); 2296 p.drawEllipse(QPointF(0, 0), radius1 * amplitude, radius1);
2281 2297
2282 // Inner circle 2298 // Inner circle
2283 p.setBrush(pressed ? colors.highlight2 : colors.button2); 2299 p.setBrush(pressed ? colors.highlight2 : colors.button2);
2284 DrawCircle(p, center, 17.0f); 2300
2301 const float inner_offset =
2302 (radius1 - radius2) * 0.4f * ((offset.x() == 0 && offset.y() < 0) ? -1.0f : 1.0f);
2303 const float offset_factor = (1.0f - amplitude) / 0.1f;
2304
2305 p.drawEllipse(QPointF((offset.x() < 0) ? -inner_offset : inner_offset, 0) * offset_factor,
2306 radius2 * amplitude, radius2);
2307
2308 p.restore();
2285} 2309}
2286 2310
2287void PlayerControlPreview::DrawGCJoystick(QPainter& p, const QPointF center, bool pressed) { 2311void PlayerControlPreview::DrawGCJoystick(QPainter& p, const QPointF center, bool pressed) {
diff --git a/src/yuzu/configuration/configure_input_player_widget.h b/src/yuzu/configuration/configure_input_player_widget.h
index 39565f795..676effbfd 100644
--- a/src/yuzu/configuration/configure_input_player_widget.h
+++ b/src/yuzu/configuration/configure_input_player_widget.h
@@ -140,7 +140,7 @@ private:
140 void DrawJoystickSideview(QPainter& p, QPointF center, float angle, float size, bool pressed); 140 void DrawJoystickSideview(QPainter& p, QPointF center, float angle, float size, bool pressed);
141 void DrawRawJoystick(QPainter& p, QPointF center, const QPointF value, 141 void DrawRawJoystick(QPainter& p, QPointF center, const QPointF value,
142 const Input::AnalogProperties properties); 142 const Input::AnalogProperties properties);
143 void DrawProJoystick(QPainter& p, QPointF center, bool pressed); 143 void DrawProJoystick(QPainter& p, QPointF center, QPointF offset, float scalar, bool pressed);
144 void DrawGCJoystick(QPainter& p, QPointF center, bool pressed); 144 void DrawGCJoystick(QPainter& p, QPointF center, bool pressed);
145 145
146 // Draw button functions 146 // Draw button functions