early-access version 2786

This commit is contained in:
pineappleEA 2022-06-15 19:54:21 +02:00
parent be59a9b258
commit 95b39f0bee
72 changed files with 15535 additions and 17792 deletions

View File

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 2779. This is the source code for early-access 2786.
## Legal Notice ## Legal Notice

View File

@ -60,27 +60,11 @@
]] ]]
cmake_minimum_required(VERSION 3.14.0 FATAL_ERROR) cmake_minimum_required(VERSION 3.14.0 FATAL_ERROR)
# On systems without Git installed, there were errors since execute_process seemed to not throw an error without it? # Get the CPPHTTPLIB_VERSION value and use it as a version
find_package(Git QUIET) # This gets the string with the CPPHTTPLIB_VERSION value from the header.
if(Git_FOUND) # This is so the maintainer doesn't actually need to update this manually.
# Gets the latest tag as a string like "v0.6.6" file(STRINGS httplib.h _raw_version_string REGEX "CPPHTTPLIB_VERSION \"([0-9]+\\.[0-9]+\\.[0-9]+)\"")
# Can silently fail if git isn't on the system
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --abbrev=0
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
OUTPUT_VARIABLE _raw_version_string
ERROR_VARIABLE _git_tag_error
)
endif()
# execute_process can fail silenty, so check for an error
# if there was an error, just use the user agent as a version
if(_git_tag_error OR NOT Git_FOUND)
message(WARNING "cpp-httplib failed to find the latest Git tag, falling back to using user agent as the version.")
# Get the user agent and use it as a version
# This gets the string with the user agent from the header.
# This is so the maintainer doesn't actually need to update this manually.
file(STRINGS httplib.h _raw_version_string REGEX "User\-Agent.*cpp\-httplib/([0-9]+\.?)+")
endif()
# Needed since git tags have "v" prefixing them. # Needed since git tags have "v" prefixing them.
# Also used if the fallback to user agent string is being used. # Also used if the fallback to user agent string is being used.
string(REGEX MATCH "([0-9]+\\.?)+" _httplib_version "${_raw_version_string}") string(REGEX MATCH "([0-9]+\\.?)+" _httplib_version "${_raw_version_string}")
@ -116,6 +100,7 @@ if (BUILD_SHARED_LIBS AND WIN32 AND HTTPLIB_COMPILE)
endif() endif()
# Threads needed for <thread> on some systems, and for <pthread.h> on Linux # Threads needed for <thread> on some systems, and for <pthread.h> on Linux
set(THREADS_PREFER_PTHREAD_FLAG true)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
# Since Cmake v3.11, Crypto & SSL became optional when not specified as COMPONENTS. # Since Cmake v3.11, Crypto & SSL became optional when not specified as COMPONENTS.
if(HTTPLIB_REQUIRE_OPENSSL) if(HTTPLIB_REQUIRE_OPENSSL)
@ -176,7 +161,7 @@ if(HTTPLIB_COMPILE)
ERROR_VARIABLE _httplib_split_error ERROR_VARIABLE _httplib_split_error
) )
if(_httplib_split_error) if(_httplib_split_error)
message(FATAL_ERROR "Failed when trying to split Cpp-httplib with the Python script.\n${_httplib_split_error}") message(FATAL_ERROR "Failed when trying to split cpp-httplib with the Python script.\n${_httplib_split_error}")
endif() endif()
# split.py puts output in "out" # split.py puts output in "out"
@ -188,6 +173,11 @@ if(HTTPLIB_COMPILE)
$<BUILD_INTERFACE:${_httplib_build_includedir}/httplib.h> $<BUILD_INTERFACE:${_httplib_build_includedir}/httplib.h>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/httplib.h> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/httplib.h>
) )
set_target_properties(${PROJECT_NAME}
PROPERTIES
VERSION ${${PROJECT_NAME}_VERSION}
SOVERSION ${${PROJECT_NAME}_VERSION_MAJOR}
)
else() else()
# This is for header-only. # This is for header-only.
set(_INTERFACE_OR_PUBLIC INTERFACE) set(_INTERFACE_OR_PUBLIC INTERFACE)
@ -198,19 +188,9 @@ endif()
# Only useful if building in-tree, versus using it from an installation. # Only useful if building in-tree, versus using it from an installation.
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
# Might be missing some, but this list is somewhat comprehensive # Require C++11
target_compile_features(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC} target_compile_features(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC}
cxx_std_11 cxx_std_11
cxx_nullptr
cxx_lambdas
cxx_override
cxx_defaulted_functions
cxx_attribute_deprecated
cxx_auto_type
cxx_decltype
cxx_deleted_functions
cxx_range_for
cxx_sizeof_member
) )
target_include_directories(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC} target_include_directories(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC}
@ -285,11 +265,9 @@ endif()
# and linkage information (doesn't find deps though). # and linkage information (doesn't find deps though).
install(TARGETS ${PROJECT_NAME} install(TARGETS ${PROJECT_NAME}
EXPORT httplibTargets EXPORT httplibTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
) )
install(FILES "${_httplib_build_includedir}/httplib.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(FILES "${_httplib_build_includedir}/httplib.h" TYPE INCLUDE)
install(FILES install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"

View File

@ -48,17 +48,12 @@ res->status;
res->body; res->body;
``` ```
### Try out the examples on Repl.it!
1. Run server at https://repl.it/@yhirose/cpp-httplib-server
2. Run client at https://repl.it/@yhirose/cpp-httplib-client
SSL Support SSL Support
----------- -----------
SSL support is available with `CPPHTTPLIB_OPENSSL_SUPPORT`. `libssl` and `libcrypto` should be linked. SSL support is available with `CPPHTTPLIB_OPENSSL_SUPPORT`. `libssl` and `libcrypto` should be linked.
NOTE: cpp-httplib currently supports only version 1.1.1. NOTE: cpp-httplib currently supports only version 1.1.1 and 3.0.
```c++ ```c++
#define CPPHTTPLIB_OPENSSL_SUPPORT #define CPPHTTPLIB_OPENSSL_SUPPORT
@ -183,6 +178,15 @@ The followings are built-in mappings:
| webm | video/webm | zip | application/zip | | webm | video/webm | zip | application/zip |
| mp3 | audio/mp3 | wasm | application/wasm | | mp3 | audio/mp3 | wasm | application/wasm |
### File request handler
```cpp
// The handler is called right before the response is sent to a client
svr.set_file_request_handler([](const Request &req, Response &res) {
...
});
```
NOTE: These static file server methods are not thread-safe. NOTE: These static file server methods are not thread-safe.
### Logging ### Logging
@ -220,7 +224,7 @@ svr.set_exception_handler([](const auto& req, auto& res, std::exception &e) {
### Pre routing handler ### Pre routing handler
```cpp ```cpp
svr.set_pre_routing_handler([](const auto& req, auto& res) -> bool { svr.set_pre_routing_handler([](const auto& req, auto& res) {
if (req.path == "/hello") { if (req.path == "/hello") {
res.set_content("world", "text/html"); res.set_content("world", "text/html");
return Server::HandlerResponse::Handled; return Server::HandlerResponse::Handled;
@ -256,6 +260,7 @@ svr.Post("/multipart", [&](const auto& req, auto& res) {
svr.Post("/content_receiver", svr.Post("/content_receiver",
[&](const Request &req, Response &res, const ContentReader &content_reader) { [&](const Request &req, Response &res, const ContentReader &content_reader) {
if (req.is_multipart_form_data()) { if (req.is_multipart_form_data()) {
// NOTE: `content_reader` is blocking until every form data field is read
MultipartFormDataItems files; MultipartFormDataItems files;
content_reader( content_reader(
[&](const MultipartFormData &file) { [&](const MultipartFormData &file) {
@ -272,7 +277,6 @@ svr.Post("/content_receiver",
body.append(data, data_length); body.append(data, data_length);
return true; return true;
}); });
res.set_content(body, "text/plain");
} }
}); });
``` ```
@ -303,7 +307,7 @@ Without content length:
svr.Get("/stream", [&](const Request &req, Response &res) { svr.Get("/stream", [&](const Request &req, Response &res) {
res.set_content_provider( res.set_content_provider(
"text/plain", // Content type "text/plain", // Content type
[&](size_t offset, size_t length, DataSink &sink) { [&](size_t offset, DataSink &sink) {
if (/* there is still data */) { if (/* there is still data */) {
std::vector<char> data; std::vector<char> data;
// prepare data... // prepare data...
@ -746,13 +750,29 @@ res = cli.Get("/resource/foo", {{"Accept-Encoding", "gzip, deflate, br"}});
res->body; // Compressed data res->body; // Compressed data
``` ```
Use `poll` instead of `select`
------------------------------
`select` system call is used as default since it's more widely supported. If you want to let cpp-httplib use `poll` instead, you can do so with `CPPHTTPLIB_USE_POLL`.
Split httplib.h into .h and .cc Split httplib.h into .h and .cc
------------------------------- -------------------------------
```bash ```console
> python3 split.py $ ./split.py -h
> ls out usage: split.py [-h] [-e EXTENSION] [-o OUT]
httplib.h httplib.cc
This script splits httplib.h into .h and .cc parts.
optional arguments:
-h, --help show this help message and exit
-e EXTENSION, --extension EXTENSION
extension of the implementation file (default: cc)
-o OUT, --out OUT where to write the files (default: out)
$ ./split.py
Wrote out/httplib.h and out/httplib.cc
``` ```
NOTE NOTE
@ -777,6 +797,8 @@ Include `httplib.h` before `Windows.h` or include `Windows.h` by defining `WIN32
#include <httplib.h> #include <httplib.h>
``` ```
Note: cpp-httplib officially supports only the latest Visual Studio. It might work with former versions of Visual Studio, but I can no longer verify it. Pull requests are always welcome for the older versions of Visual Studio unless they break the C++11 conformance.
Note: Windows 8 or lower and Cygwin on Windows are not supported. Note: Windows 8 or lower and Cygwin on Windows are not supported.
License License

View File

@ -0,0 +1,12 @@
FROM alpine as builder
WORKDIR /src/example
RUN apk add g++ make openssl-dev zlib-dev brotli-dev
COPY ./httplib.h /src
COPY ./example/hello.cc /src/example
COPY ./example/Makefile /src/example
RUN make hello
FROM alpine
RUN apk --no-cache add brotli libstdc++
COPY --from=builder /src/example/hello /bin/hello
CMD ["/bin/hello"]

View File

@ -1,14 +1,17 @@
#CXX = clang++ #CXX = clang++
CXXFLAGS = -std=c++11 -I.. -Wall -Wextra -pthread CXXFLAGS = -O2 -std=c++11 -I.. -Wall -Wextra -pthread
OPENSSL_DIR = /usr/local/opt/openssl PREFIX = /usr/local
#PREFIX = $(shell brew --prefix)
OPENSSL_DIR = $(PREFIX)/opt/openssl@1.1
#OPENSSL_DIR = $(PREFIX)/opt/openssl@3
OPENSSL_SUPPORT = -DCPPHTTPLIB_OPENSSL_SUPPORT -I$(OPENSSL_DIR)/include -L$(OPENSSL_DIR)/lib -lssl -lcrypto OPENSSL_SUPPORT = -DCPPHTTPLIB_OPENSSL_SUPPORT -I$(OPENSSL_DIR)/include -L$(OPENSSL_DIR)/lib -lssl -lcrypto
ZLIB_SUPPORT = -DCPPHTTPLIB_ZLIB_SUPPORT -lz ZLIB_SUPPORT = -DCPPHTTPLIB_ZLIB_SUPPORT -lz
BROTLI_DIR = /usr/local/opt/brotli BROTLI_DIR = $(PREFIX)/opt/brotli
# BROTLI_SUPPORT = -DCPPHTTPLIB_BROTLI_SUPPORT -I$(BROTLI_DIR)/include -L$(BROTLI_DIR)/lib -lbrotlicommon-static -lbrotlienc-static -lbrotlidec-static BROTLI_SUPPORT = -DCPPHTTPLIB_BROTLI_SUPPORT -I$(BROTLI_DIR)/include -L$(BROTLI_DIR)/lib -lbrotlicommon -lbrotlienc -lbrotlidec
all: server client hello simplecli simplesvr upload redirect ssesvr ssecli benchmark all: server client hello simplecli simplesvr upload redirect ssesvr ssecli benchmark
@ -47,4 +50,4 @@ pem:
openssl req -new -key key.pem | openssl x509 -days 3650 -req -signkey key.pem > cert.pem openssl req -new -key key.pem | openssl x509 -days 3650 -req -signkey key.pem > cert.pem
clean: clean:
rm server client hello simplecli simplesvr upload redirect ssesvr sselci benchmark *.pem rm server client hello simplecli simplesvr upload redirect ssesvr ssecli benchmark *.pem

View File

@ -15,5 +15,5 @@ int main(void) {
res.set_content("Hello World!", "text/plain"); res.set_content("Hello World!", "text/plain");
}); });
svr.listen("localhost", 8080); svr.listen("0.0.0.0", 8080);
} }

6
externals/cpp-httplib/example/uploader.sh vendored Executable file
View File

@ -0,0 +1,6 @@
#/usr/bin/env bash
for i in {1..10000}
do
echo "#### $i ####"
curl -X POST -F image_file=@$1 http://localhost:1234/post > /dev/null
done

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,110 @@
project('cpp-httplib', 'cpp', license: 'MIT') # SPDX-FileCopyrightText: 2021 Andrea Pappacoda
#
# SPDX-License-Identifier: MIT
cpp_httplib_dep = declare_dependency(include_directories: include_directories('.')) project(
'cpp-httplib',
'cpp',
license: 'MIT',
default_options: [
'cpp_std=c++11',
'buildtype=release',
'b_ndebug=if-release',
'b_lto=true',
'warning_level=3'
],
meson_version: '>=0.47.0'
)
# Check just in case downstream decides to edit the source
# and add a project version
version = meson.project_version()
if version == 'undefined'
cxx = meson.get_compiler('cpp')
version = cxx.get_define('CPPHTTPLIB_VERSION',
prefix: '#include <httplib.h>',
include_directories: include_directories('.')).strip('"')
assert(version != '', 'failed to get version from httplib.h')
endif
deps = [dependency('threads')]
args = []
openssl_dep = dependency('openssl', version: '>=1.1.1', required: get_option('cpp-httplib_openssl'))
if openssl_dep.found()
deps += openssl_dep
args += '-DCPPHTTPLIB_OPENSSL_SUPPORT'
endif
zlib_dep = dependency('zlib', required: get_option('cpp-httplib_zlib'))
if zlib_dep.found()
deps += zlib_dep
args += '-DCPPHTTPLIB_ZLIB_SUPPORT'
endif
brotli_deps = [dependency('libbrotlicommon', required: get_option('cpp-httplib_brotli'))]
brotli_deps += dependency('libbrotlidec', required: get_option('cpp-httplib_brotli'))
brotli_deps += dependency('libbrotlienc', required: get_option('cpp-httplib_brotli'))
brotli_found_all = true
foreach brotli_dep : brotli_deps
if not brotli_dep.found()
brotli_found_all = false
endif
endforeach
if brotli_found_all
deps += brotli_deps
args += '-DCPPHTTPLIB_BROTLI_SUPPORT'
endif
cpp_httplib_dep = dependency('', required: false)
if get_option('cpp-httplib_compile')
python3 = find_program('python3')
httplib_ch = custom_target(
'split',
input: 'httplib.h',
output: ['httplib.cc', 'httplib.h'],
command: [python3, files('split.py'), '--out', meson.current_build_dir()],
install: true,
install_dir: [false, get_option('includedir')]
)
lib = library(
'cpp-httplib',
sources: httplib_ch,
dependencies: deps,
cpp_args: args,
version: version,
install: true
)
cpp_httplib_dep = declare_dependency(compile_args: args, dependencies: deps, link_with: lib, sources: httplib_ch[1])
import('pkgconfig').generate(
lib,
description: 'A C++ HTTP/HTTPS server and client library',
extra_cflags: args,
url: 'https://github.com/yhirose/cpp-httplib',
version: version
)
else
install_headers('httplib.h')
cpp_httplib_dep = declare_dependency(compile_args: args, dependencies: deps, include_directories: include_directories('.'))
import('pkgconfig').generate(
name: 'cpp-httplib',
description: 'A C++ HTTP/HTTPS server and client library',
install_dir: join_paths(get_option('datadir'), 'pkgconfig'),
url: 'https://github.com/yhirose/cpp-httplib',
version: version
)
endif
if meson.version().version_compare('>=0.54.0') if meson.version().version_compare('>=0.54.0')
meson.override_dependency('cpp-httplib', cpp_httplib_dep) meson.override_dependency('cpp-httplib', cpp_httplib_dep)
endif endif
if get_option('cpp-httplib_test')
subdir('test')
endif

9
externals/cpp-httplib/meson_options.txt vendored Executable file
View File

@ -0,0 +1,9 @@
# SPDX-FileCopyrightText: 2021 Andrea Pappacoda
#
# SPDX-License-Identifier: MIT
option('cpp-httplib_openssl', type: 'feature', value: 'auto', description: 'Enable OpenSSL support')
option('cpp-httplib_zlib', type: 'feature', value: 'auto', description: 'Enable zlib support')
option('cpp-httplib_brotli', type: 'feature', value: 'auto', description: 'Enable Brotli support')
option('cpp-httplib_compile', type: 'boolean', value: false, description: 'Split the header into a compilable header & source file (requires python3)')
option('cpp-httplib_test', type: 'boolean', value: false, description: 'Build tests')

View File

@ -1,32 +1,67 @@
#!/usr/bin/env python3
"""This script splits httplib.h into .h and .cc parts."""
import argparse
import os import os
import sys import sys
border = '// ----------------------------------------------------------------------------' border = '// ----------------------------------------------------------------------------'
PythonVersion = sys.version_info[0]; args_parser = argparse.ArgumentParser(description=__doc__)
args_parser.add_argument(
"-e", "--extension", help="extension of the implementation file (default: cc)",
default="cc"
)
args_parser.add_argument(
"-o", "--out", help="where to write the files (default: out)", default="out"
)
args = args_parser.parse_args()
with open('httplib.h') as f: cur_dir = os.path.dirname(sys.argv[0])
lines = f.readlines() lib_name = 'httplib'
inImplementation = False header_name = '/' + lib_name + '.h'
source_name = '/' + lib_name + '.' + args.extension
if PythonVersion < 3: # get the input file
os.makedirs('out') in_file = cur_dir + header_name
# get the output file
h_out = args.out + header_name
cc_out = args.out + source_name
# if the modification time of the out file is after the in file,
# don't split (as it is already finished)
do_split = True
if os.path.exists(h_out):
in_time = os.path.getmtime(in_file)
out_time = os.path.getmtime(h_out)
do_split = in_time > out_time
if do_split:
with open(in_file) as f:
lines = f.readlines()
python_version = sys.version_info[0]
if python_version < 3:
os.makedirs(args.out)
else: else:
os.makedirs('out', exist_ok=True) os.makedirs(args.out, exist_ok=True)
with open('out/httplib.h', 'w') as fh: in_implementation = False
with open('out/httplib.cc', 'w') as fc: cc_out = args.out + source_name
fc.write('#include "httplib.h"\n') with open(h_out, 'w') as fh, open(cc_out, 'w') as fc:
fc.write('namespace httplib {\n') fc.write('#include "httplib.h"\n')
for line in lines: fc.write('namespace httplib {\n')
isBorderLine = border in line for line in lines:
if isBorderLine: is_border_line = border in line
inImplementation = not inImplementation if is_border_line:
else: in_implementation = not in_implementation
if inImplementation: elif in_implementation:
fc.write(line.replace('inline ', '')) fc.write(line.replace('inline ', ''))
pass else:
else: fh.write(line)
fh.write(line) fc.write('} // namespace httplib\n')
pass
fc.write('} // namespace httplib\n') print("Wrote {} and {}".format(h_out, cc_out))
else:
print("{} and {} are up to date".format(h_out, cc_out))

View File

@ -1,25 +1,61 @@
#CXX = clang++ CXX = clang++
CXXFLAGS = -g -std=c++11 -DGTEST_USE_OWN_TR1_TUPLE -I.. -I. -Wall -Wextra -Wtype-limits -Wconversion #-fsanitize=address CXXFLAGS = -g -std=c++11 -I. -Wall -Wextra -Wtype-limits -Wconversion -Wshadow # -fno-exceptions -DCPPHTTPLIB_NO_EXCEPTIONS -fsanitize=address
OPENSSL_DIR = /usr/local/opt/openssl@1.1 PREFIX = /usr/local
#PREFIX = $(shell brew --prefix)
OPENSSL_DIR = $(PREFIX)/opt/openssl@1.1
#OPENSSL_DIR = $(PREFIX)/opt/openssl@3
OPENSSL_SUPPORT = -DCPPHTTPLIB_OPENSSL_SUPPORT -I$(OPENSSL_DIR)/include -L$(OPENSSL_DIR)/lib -lssl -lcrypto OPENSSL_SUPPORT = -DCPPHTTPLIB_OPENSSL_SUPPORT -I$(OPENSSL_DIR)/include -L$(OPENSSL_DIR)/lib -lssl -lcrypto
ZLIB_SUPPORT = -DCPPHTTPLIB_ZLIB_SUPPORT -lz ZLIB_SUPPORT = -DCPPHTTPLIB_ZLIB_SUPPORT -lz
BROTLI_DIR = /usr/local/opt/brotli BROTLI_DIR = $(PREFIX)/opt/brotli
BROTLI_SUPPORT = -DCPPHTTPLIB_BROTLI_SUPPORT -I$(BROTLI_DIR)/include -L$(BROTLI_DIR)/lib -lbrotlicommon -lbrotlienc -lbrotlidec BROTLI_SUPPORT = -DCPPHTTPLIB_BROTLI_SUPPORT -I$(BROTLI_DIR)/include -L$(BROTLI_DIR)/lib -lbrotlicommon -lbrotlienc -lbrotlidec
all : test TEST_ARGS = gtest/gtest-all.cc gtest/gtest_main.cc $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT) $(BROTLI_SUPPORT) -pthread
# By default, use standalone_fuzz_target_runner.
# This runner does no fuzzing, but simply executes the inputs
# provided via parameters.
# Run e.g. "make all LIB_FUZZING_ENGINE=/path/to/libFuzzer.a"
# to link the fuzzer(s) against a real fuzzing engine.
# OSS-Fuzz will define its own value for LIB_FUZZING_ENGINE.
LIB_FUZZING_ENGINE ?= standalone_fuzz_target_runner.o
all : test test_split
./test ./test
proxy : test_proxy proxy : test_proxy
./test_proxy ./test_proxy
test : test.cc ../httplib.h Makefile cert.pem test : test.cc include_httplib.cc ../httplib.h Makefile cert.pem
$(CXX) -o test $(CXXFLAGS) test.cc gtest/gtest-all.cc gtest/gtest_main.cc $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT) $(BROTLI_SUPPORT) -pthread $(CXX) -o $@ -I.. $(CXXFLAGS) test.cc include_httplib.cc $(TEST_ARGS)
# Note: The intention of test_split is to verify that it works to compile and
# link the split httplib.h, so there is normally no need to execute it.
test_split : test.cc ../httplib.h httplib.cc Makefile cert.pem
$(CXX) -o $@ $(CXXFLAGS) test.cc httplib.cc $(TEST_ARGS)
test_proxy : test_proxy.cc ../httplib.h Makefile cert.pem test_proxy : test_proxy.cc ../httplib.h Makefile cert.pem
$(CXX) -o test_proxy $(CXXFLAGS) test_proxy.cc gtest/gtest-all.cc gtest/gtest_main.cc $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT) $(BROTLI_SUPPORT) -pthread $(CXX) -o $@ -I.. $(CXXFLAGS) test_proxy.cc $(TEST_ARGS)
# Runs server_fuzzer.cc based on value of $(LIB_FUZZING_ENGINE).
# Usage: make fuzz_test LIB_FUZZING_ENGINE=/path/to/libFuzzer
fuzz_test: server_fuzzer
./server_fuzzer fuzzing/corpus/*
# Fuzz target, so that you can choose which $(LIB_FUZZING_ENGINE) to use.
server_fuzzer : fuzzing/server_fuzzer.cc ../httplib.h standalone_fuzz_target_runner.o
$(CXX) -o $@ -I.. $(CXXFLAGS) $< $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT) $(BROTLI_SUPPORT) $(LIB_FUZZING_ENGINE) -pthread
# Standalone fuzz runner, which just reads inputs from fuzzing/corpus/ dir and
# feeds it to server_fuzzer.
standalone_fuzz_target_runner.o : fuzzing/standalone_fuzz_target_runner.cpp
$(CXX) -o $@ -I.. $(CXXFLAGS) -c $<
httplib.cc : ../httplib.h
python3 ../split.py -o .
cert.pem: cert.pem:
openssl genrsa 2048 > key.pem openssl genrsa 2048 > key.pem
@ -29,7 +65,9 @@ cert.pem:
openssl req -x509 -new -batch -config test.rootCA.conf -key rootCA.key.pem -days 1024 > rootCA.cert.pem openssl req -x509 -new -batch -config test.rootCA.conf -key rootCA.key.pem -days 1024 > rootCA.cert.pem
openssl genrsa 2048 > client.key.pem openssl genrsa 2048 > client.key.pem
openssl req -new -batch -config test.conf -key client.key.pem | openssl x509 -days 370 -req -CA rootCA.cert.pem -CAkey rootCA.key.pem -CAcreateserial > client.cert.pem openssl req -new -batch -config test.conf -key client.key.pem | openssl x509 -days 370 -req -CA rootCA.cert.pem -CAkey rootCA.key.pem -CAcreateserial > client.cert.pem
openssl genrsa -passout pass:test123! 2048 > key_encrypted.pem
openssl req -new -batch -config test.conf -key key_encrypted.pem | openssl x509 -days 3650 -req -signkey key_encrypted.pem > cert_encrypted.pem
#c_rehash . #c_rehash .
clean: clean:
rm -f test test_proxy pem *.0 *.1 *.srl rm -f test test_split test_proxy server_fuzzer *.pem *.0 *.o *.1 *.srl httplib.h httplib.cc

BIN
externals/cpp-httplib/test/fuzzing/corpus/3 vendored Executable file

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -20,16 +20,16 @@ int main(int argc, char **argv) {
for (int i = 1; i < argc; i++) { for (int i = 1; i < argc; i++) {
std::ifstream in(argv[i]); std::ifstream in(argv[i]);
in.seekg(0, in.end); in.seekg(0, in.end);
size_t length = in.tellg(); size_t length = static_cast<size_t>(in.tellg());
in.seekg (0, in.beg); in.seekg (0, in.beg);
std::cout << "Reading " << length << " bytes from " << argv[i] << std::endl; std::cout << "Reading " << length << " bytes from " << argv[i] << std::endl;
// Allocate exactly length bytes so that we reliably catch buffer overflows. // Allocate exactly length bytes so that we reliably catch buffer overflows.
std::vector<char> bytes(length); std::vector<char> bytes(length);
in.read(bytes.data(), bytes.size()); in.read(bytes.data(), static_cast<std::streamsize>(bytes.size()));
LLVMFuzzerTestOneInput(reinterpret_cast<const uint8_t *>(bytes.data()), LLVMFuzzerTestOneInput(reinterpret_cast<const uint8_t *>(bytes.data()),
bytes.size()); bytes.size());
std::cout << "Execution successful" << std::endl; std::cout << "Execution successful" << std::endl;
} }
std::cout << "Execution finished" << std::endl; std::cout << "Execution finished" << std::endl;
return 0; return 0;
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -27,13 +27,28 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <iostream> #include <cstdio>
#include "gtest/gtest.h" #include "gtest/gtest.h"
GTEST_API_ int main(int argc, char **argv) { #if GTEST_OS_ESP8266 || GTEST_OS_ESP32
std::cout << "Running main() from gtest_main.cc\n"; #if GTEST_OS_ESP8266
extern "C" {
#endif
void setup() {
testing::InitGoogleTest();
}
void loop() { RUN_ALL_TESTS(); }
#if GTEST_OS_ESP8266
}
#endif
#else
GTEST_API_ int main(int argc, char **argv) {
printf("Running main() from %s\n", __FILE__);
testing::InitGoogleTest(&argc, argv); testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS(); return RUN_ALL_TESTS();
} }
#endif

View File

@ -0,0 +1,5 @@
// The sole purpose of this file is to include httplib.h in a separate
// compilation unit, thus verifying that inline keywords have not been forgotten
// when linked together with test.cc.
#include <httplib.h>

112
externals/cpp-httplib/test/meson.build vendored Executable file
View File

@ -0,0 +1,112 @@
# SPDX-FileCopyrightText: 2021 Andrea Pappacoda
#
# SPDX-License-Identifier: MIT
gtest_dep = dependency('gtest', main: true)
openssl = find_program('openssl')
test_conf = files('test.conf')
key_pem = custom_target(
'key_pem',
output: 'key.pem',
command: [openssl, 'genrsa', '-out', '@OUTPUT@', '2048']
)
temp_req = custom_target(
'temp_req',
input: key_pem,
output: 'temp_req',
command: [openssl, 'req', '-new', '-batch', '-config', test_conf, '-key', '@INPUT@', '-out', '@OUTPUT@']
)
cert_pem = custom_target(
'cert_pem',
input: [temp_req, key_pem],
output: 'cert.pem',
command: [openssl, 'x509', '-in', '@INPUT0@', '-days', '3650', '-req', '-signkey', '@INPUT1@', '-out', '@OUTPUT@']
)
cert2_pem = custom_target(
'cert2_pem',
input: key_pem,
output: 'cert2.pem',
command: [openssl, 'req', '-x509', '-config', test_conf, '-key', '@INPUT@', '-sha256', '-days', '3650', '-nodes', '-out', '@OUTPUT@', '-extensions', 'SAN']
)
key_encrypted_pem = custom_target(
'key_encrypted_pem',
output: 'key_encrypted.pem',
command: [openssl, 'genrsa', '-passout', 'pass:test123!', '-out', '@OUTPUT@', '2048']
)
cert_encrypted_pem = custom_target(
'cert_encrypted_pem',
input: key_encrypted_pem,
output: 'cert_encrypted.pem',
command: [openssl, 'req', '-x509', '-config', test_conf, '-key', '@INPUT@', '-sha256', '-days', '3650', '-nodes', '-out', '@OUTPUT@', '-extensions', 'SAN']
)
rootca_key_pem = custom_target(
'rootca_key_pem',
output: 'rootCA.key.pem',
command: [openssl, 'genrsa', '-out', '@OUTPUT@', '2048']
)
rootca_cert_pem = custom_target(
'rootca_cert_pem',
input: rootca_key_pem,
output: 'rootCA.cert.pem',
command: [openssl, 'req', '-x509', '-new', '-batch', '-config', files('test.rootCA.conf'), '-key', '@INPUT@', '-days', '1024', '-out', '@OUTPUT@']
)
client_key_pem = custom_target(
'client_key_pem',
output: 'client.key.pem',
command: [openssl, 'genrsa', '-out', '@OUTPUT@', '2048']
)
client_temp_req = custom_target(
'client_temp_req',
input: client_key_pem,
output: 'client_temp_req',
command: [openssl, 'req', '-new', '-batch', '-config', test_conf, '-key', '@INPUT@', '-out', '@OUTPUT@']
)
client_cert_pem = custom_target(
'client_cert_pem',
input: [client_temp_req, rootca_cert_pem, rootca_key_pem],
output: 'client.cert.pem',
command: [openssl, 'x509', '-in', '@INPUT0@', '-days', '370', '-req', '-CA', '@INPUT1@', '-CAkey', '@INPUT2@', '-CAcreateserial', '-out', '@OUTPUT@']
)
# Copy test files to the build directory
configure_file(input: 'ca-bundle.crt', output: 'ca-bundle.crt', copy: true)
configure_file(input: 'image.jpg', output: 'image.jpg', copy: true)
subdir(join_paths('www', 'dir'))
subdir(join_paths('www2', 'dir'))
subdir(join_paths('www3', 'dir'))
test(
'main',
executable(
'main',
'test.cc',
dependencies: [
cpp_httplib_dep,
gtest_dep
]
),
depends: [
key_pem,
cert_pem,
cert2_pem,
key_encrypted_pem,
cert_encrypted_pem,
rootca_key_pem,
rootca_cert_pem,
client_key_pem,
client_cert_pem
],
workdir: meson.current_build_dir(),
timeout: 300
)

File diff suppressed because it is too large Load Diff

View File

@ -116,6 +116,7 @@
<AdditionalUsingDirectories> <AdditionalUsingDirectories>
</AdditionalUsingDirectories> </AdditionalUsingDirectories>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
@ -158,6 +159,7 @@
<AdditionalUsingDirectories> <AdditionalUsingDirectories>
</AdditionalUsingDirectories> </AdditionalUsingDirectories>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>

View File

@ -0,0 +1,7 @@
# SPDX-FileCopyrightText: 2021 Andrea Pappacoda
#
# SPDX-License-Identifier: MIT
configure_file(input: 'index.html', output: 'index.html', copy: true)
configure_file(input: 'test.abcde', output: 'test.abcde', copy: true)
configure_file(input: 'test.html', output: 'test.html', copy: true)

View File

@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: 2021 Andrea Pappacoda
#
# SPDX-License-Identifier: MIT
configure_file(input: 'index.html', output: 'index.html', copy: true)
configure_file(input: 'test.html', output: 'test.html', copy: true)

View File

@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: 2021 Andrea Pappacoda
#
# SPDX-License-Identifier: MIT
configure_file(input: 'index.html', output: 'index.html', copy: true)
configure_file(input: 'test.html', output: 'test.html', copy: true)

View File

@ -1246,7 +1246,7 @@ struct MicroProfileScopeLock
{ {
bool bUseLock; bool bUseLock;
std::recursive_mutex& m; std::recursive_mutex& m;
MicroProfileScopeLock(std::recursive_mutex& m) : bUseLock(g_bUseLock), m(m) MicroProfileScopeLock(std::recursive_mutex& m_) : bUseLock(g_bUseLock), m(m_)
{ {
if(bUseLock) if(bUseLock)
m.lock(); m.lock();

View File

@ -213,8 +213,8 @@ struct MicroProfileCustom
struct SOptionDesc struct SOptionDesc
{ {
SOptionDesc(){} SOptionDesc()=default;
SOptionDesc(uint8_t nSubType, uint8_t nIndex, const char* fmt, ...):nSubType(nSubType), nIndex(nIndex) SOptionDesc(uint8_t nSubType_, uint8_t nIndex_, const char* fmt, ...):nSubType(nSubType_), nIndex(nIndex_)
{ {
va_list args; va_list args;
va_start (args, fmt); va_start (args, fmt);
@ -573,10 +573,10 @@ inline void MicroProfileToolTipMeta(MicroProfileStringArray* pToolTip)
} }
else else
{ {
for(int i = 0; i < MICROPROFILE_META_MAX; ++i) for(int k = 0; k < MICROPROFILE_META_MAX; ++k)
{ {
nMetaSumInclusive[i] += nMetaSum[i]; nMetaSumInclusive[k] += nMetaSum[k];
nMetaSum[i] = 0; nMetaSum[k] = 0;
} }
} }
break; break;
@ -708,10 +708,10 @@ inline void MicroProfileDrawFloatTooltip(uint32_t nX, uint32_t nY, uint32_t nTok
if(UI.nMouseLeftMod) if(UI.nMouseLeftMod)
{ {
int nIndex = (g_MicroProfileUI.LockedToolTipFront + MICROPROFILE_TOOLTIP_MAX_LOCKED - 1) % MICROPROFILE_TOOLTIP_MAX_LOCKED; int nToolTipIndex = (g_MicroProfileUI.LockedToolTipFront + MICROPROFILE_TOOLTIP_MAX_LOCKED - 1) % MICROPROFILE_TOOLTIP_MAX_LOCKED;
g_MicroProfileUI.nLockedToolTipColor[nIndex] = S.TimerInfo[nTimerId].nColor; g_MicroProfileUI.nLockedToolTipColor[nToolTipIndex] = S.TimerInfo[nTimerId].nColor;
MicroProfileStringArrayCopy(&g_MicroProfileUI.LockedToolTips[nIndex], &ToolTip); MicroProfileStringArrayCopy(&g_MicroProfileUI.LockedToolTips[nToolTipIndex], &ToolTip);
g_MicroProfileUI.LockedToolTipFront = nIndex; g_MicroProfileUI.LockedToolTipFront = nToolTipIndex;
} }
} }
@ -917,9 +917,8 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int
float fStart = floor(fMsBase*fRcpStep) * fStep; float fStart = floor(fMsBase*fRcpStep) * fStep;
for(float f = fStart; f < fMsEnd; ) for(float f = fStart; f < fMsEnd; )
{ {
float fStart = f;
float fNext = f + fStep; float fNext = f + fStep;
MicroProfileDrawBox(((fStart-fMsBase) * fMsToScreen), nBaseY, (fNext-fMsBase) * fMsToScreen+1, nBaseY + nHeight, UI.nOpacityBackground | g_nMicroProfileBackColors[nColorIndex++ & 1]); MicroProfileDrawBox(((f-fMsBase) * fMsToScreen), nBaseY, (fNext-fMsBase) * fMsToScreen+1, nBaseY + nHeight, UI.nOpacityBackground | g_nMicroProfileBackColors[nColorIndex++ & 1]);
f = fNext; f = fNext;
} }
} }
@ -1116,9 +1115,9 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int
nMaxStackDepth = MicroProfileMax(nMaxStackDepth, nStackPos); nMaxStackDepth = MicroProfileMax(nMaxStackDepth, nStackPos);
float fMsStart = fToMs * MicroProfileLogTickDifference(nBaseTicks, nTickStart); float fMsStart = fToMs * MicroProfileLogTickDifference(nBaseTicks, nTickStart);
float fMsEnd = fToMs * MicroProfileLogTickDifference(nBaseTicks, nTickEnd); float fMsEnd2 = fToMs * MicroProfileLogTickDifference(nBaseTicks, nTickEnd);
float fXStart = fMsStart * fMsToScreen; float fXStart = fMsStart * fMsToScreen;
float fXEnd = fMsEnd * fMsToScreen; float fXEnd = fMsEnd2 * fMsToScreen;
float fYStart = (float)(nY + nStackPos * nYDelta); float fYStart = (float)(nY + nStackPos * nYDelta);
float fYEnd = fYStart + (MICROPROFILE_DETAILED_BAR_HEIGHT); float fYEnd = fYStart + (MICROPROFILE_DETAILED_BAR_HEIGHT);
float fXDist = MicroProfileMax(fXStart - fMouseX, fMouseX - fXEnd); float fXDist = MicroProfileMax(fXStart - fMouseX, fMouseX - fXEnd);
@ -1269,22 +1268,22 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int
if(UI.nRangeBegin != UI.nRangeEnd) if(UI.nRangeBegin != UI.nRangeEnd)
{ {
float fMsStart = fToMsCpu * MicroProfileLogTickDifference(nBaseTicksCpu, UI.nRangeBegin); float fMsStart = fToMsCpu * MicroProfileLogTickDifference(nBaseTicksCpu, UI.nRangeBegin);
float fMsEnd = fToMsCpu * MicroProfileLogTickDifference(nBaseTicksCpu, UI.nRangeEnd); float fMsEnd3 = fToMsCpu * MicroProfileLogTickDifference(nBaseTicksCpu, UI.nRangeEnd);
float fXStart = fMsStart * fMsToScreen; float fXStart = fMsStart * fMsToScreen;
float fXEnd = fMsEnd * fMsToScreen; float fXEnd = fMsEnd3 * fMsToScreen;
MicroProfileDrawBox(fXStart, nBaseY, fXEnd, nHeight, MICROPROFILE_FRAME_COLOR_HIGHTLIGHT, MicroProfileBoxTypeFlat); MicroProfileDrawBox(fXStart, nBaseY, fXEnd, nHeight, MICROPROFILE_FRAME_COLOR_HIGHTLIGHT, MicroProfileBoxTypeFlat);
MicroProfileDrawLineVertical(fXStart, nBaseY, nHeight, MICROPROFILE_FRAME_COLOR_HIGHTLIGHT | 0x44000000); MicroProfileDrawLineVertical(fXStart, nBaseY, nHeight, MICROPROFILE_FRAME_COLOR_HIGHTLIGHT | 0x44000000);
MicroProfileDrawLineVertical(fXEnd, nBaseY, nHeight, MICROPROFILE_FRAME_COLOR_HIGHTLIGHT | 0x44000000); MicroProfileDrawLineVertical(fXEnd, nBaseY, nHeight, MICROPROFILE_FRAME_COLOR_HIGHTLIGHT | 0x44000000);
fMsStart += fDetailedOffset; fMsStart += fDetailedOffset;
fMsEnd += fDetailedOffset; fMsEnd3 += fDetailedOffset;
char sBuffer[32]; char sBuffer[32];
uint32_t nLenStart = snprintf(sBuffer, sizeof(sBuffer)-1, "%.2fms", fMsStart); uint32_t nLenStart = snprintf(sBuffer, sizeof(sBuffer)-1, "%.2fms", fMsStart);
float fStartTextWidth = (float)((1+MICROPROFILE_TEXT_WIDTH) * nLenStart); float fStartTextWidth = (float)((1+MICROPROFILE_TEXT_WIDTH) * nLenStart);
float fStartTextX = fXStart - fStartTextWidth - 2; float fStartTextX = fXStart - fStartTextWidth - 2;
MicroProfileDrawBox(fStartTextX, nBaseY, fStartTextX + fStartTextWidth + 2, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat); MicroProfileDrawBox(fStartTextX, nBaseY, fStartTextX + fStartTextWidth + 2, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat);
MicroProfileDrawText(fStartTextX+1, nBaseY, UINT32_MAX, sBuffer, nLenStart); MicroProfileDrawText(fStartTextX+1, nBaseY, UINT32_MAX, sBuffer, nLenStart);
uint32_t nLenEnd = snprintf(sBuffer, sizeof(sBuffer)-1, "%.2fms", fMsEnd); uint32_t nLenEnd = snprintf(sBuffer, sizeof(sBuffer)-1, "%.2fms", fMsEnd3);
MicroProfileDrawBox(fXEnd+1, nBaseY, fXEnd+1+(1+MICROPROFILE_TEXT_WIDTH) * nLenEnd + 3, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat); MicroProfileDrawBox(fXEnd+1, nBaseY, fXEnd+1+(1+MICROPROFILE_TEXT_WIDTH) * nLenEnd + 3, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat);
MicroProfileDrawText(fXEnd+2, nBaseY+1, UINT32_MAX, sBuffer, nLenEnd); MicroProfileDrawText(fXEnd+2, nBaseY+1, UINT32_MAX, sBuffer, nLenEnd);
@ -1297,9 +1296,9 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int
if(UI.nRangeBeginGpu != UI.nRangeEndGpu) if(UI.nRangeBeginGpu != UI.nRangeEndGpu)
{ {
float fMsStart = fToMsGpu * MicroProfileLogTickDifference(nBaseTicksGpu, UI.nRangeBeginGpu); float fMsStart = fToMsGpu * MicroProfileLogTickDifference(nBaseTicksGpu, UI.nRangeBeginGpu);
float fMsEnd = fToMsGpu * MicroProfileLogTickDifference(nBaseTicksGpu, UI.nRangeEndGpu); float fMsEnd4 = fToMsGpu * MicroProfileLogTickDifference(nBaseTicksGpu, UI.nRangeEndGpu);
float fXStart = fMsStart * fMsToScreen; float fXStart = fMsStart * fMsToScreen;
float fXEnd = fMsEnd * fMsToScreen; float fXEnd = fMsEnd4 * fMsToScreen;
MicroProfileDrawBox(fXStart, nBaseY, fXEnd, nHeight, MICROPROFILE_FRAME_COLOR_HIGHTLIGHT_GPU, MicroProfileBoxTypeFlat); MicroProfileDrawBox(fXStart, nBaseY, fXEnd, nHeight, MICROPROFILE_FRAME_COLOR_HIGHTLIGHT_GPU, MicroProfileBoxTypeFlat);
MicroProfileDrawLineVertical(fXStart, nBaseY, nHeight, MICROPROFILE_FRAME_COLOR_HIGHTLIGHT_GPU | 0x44000000); MicroProfileDrawLineVertical(fXStart, nBaseY, nHeight, MICROPROFILE_FRAME_COLOR_HIGHTLIGHT_GPU | 0x44000000);
MicroProfileDrawLineVertical(fXEnd, nBaseY, nHeight, MICROPROFILE_FRAME_COLOR_HIGHTLIGHT_GPU | 0x44000000); MicroProfileDrawLineVertical(fXEnd, nBaseY, nHeight, MICROPROFILE_FRAME_COLOR_HIGHTLIGHT_GPU | 0x44000000);
@ -1307,14 +1306,14 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int
nBaseY += MICROPROFILE_TEXT_HEIGHT+1; nBaseY += MICROPROFILE_TEXT_HEIGHT+1;
fMsStart += fDetailedOffset; fMsStart += fDetailedOffset;
fMsEnd += fDetailedOffset; fMsEnd4 += fDetailedOffset;
char sBuffer[32]; char sBuffer[32];
uint32_t nLenStart = snprintf(sBuffer, sizeof(sBuffer)-1, "%.2fms", fMsStart); uint32_t nLenStart = snprintf(sBuffer, sizeof(sBuffer)-1, "%.2fms", fMsStart);
float fStartTextWidth = (float)((1+MICROPROFILE_TEXT_WIDTH) * nLenStart); float fStartTextWidth = (float)((1+MICROPROFILE_TEXT_WIDTH) * nLenStart);
float fStartTextX = fXStart - fStartTextWidth - 2; float fStartTextX = fXStart - fStartTextWidth - 2;
MicroProfileDrawBox(fStartTextX, nBaseY, fStartTextX + fStartTextWidth + 2, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat); MicroProfileDrawBox(fStartTextX, nBaseY, fStartTextX + fStartTextWidth + 2, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat);
MicroProfileDrawText(fStartTextX+1, nBaseY, UINT32_MAX, sBuffer, nLenStart); MicroProfileDrawText(fStartTextX+1, nBaseY, UINT32_MAX, sBuffer, nLenStart);
uint32_t nLenEnd = snprintf(sBuffer, sizeof(sBuffer)-1, "%.2fms", fMsEnd); uint32_t nLenEnd = snprintf(sBuffer, sizeof(sBuffer)-1, "%.2fms", fMsEnd4);
MicroProfileDrawBox(fXEnd+1, nBaseY, fXEnd+1+(1+MICROPROFILE_TEXT_WIDTH) * nLenEnd + 3, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat); MicroProfileDrawBox(fXEnd+1, nBaseY, fXEnd+1+(1+MICROPROFILE_TEXT_WIDTH) * nLenEnd + 3, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat);
MicroProfileDrawText(fXEnd+2, nBaseY+1, UINT32_MAX, sBuffer, nLenEnd); MicroProfileDrawText(fXEnd+2, nBaseY+1, UINT32_MAX, sBuffer, nLenEnd);
} }
@ -1716,8 +1715,8 @@ bool MicroProfileDrawGraph(uint32_t nScreenWidth, uint32_t nScreenHeight)
uint32_t nTextCount = 0; uint32_t nTextCount = 0;
uint32_t nGraphIndex = (S.nGraphPut + MICROPROFILE_GRAPH_HISTORY - int(MICROPROFILE_GRAPH_HISTORY*(1.f - fMouseXPrc))) % MICROPROFILE_GRAPH_HISTORY; uint32_t nGraphIndex = (S.nGraphPut + MICROPROFILE_GRAPH_HISTORY - int(MICROPROFILE_GRAPH_HISTORY*(1.f - fMouseXPrc))) % MICROPROFILE_GRAPH_HISTORY;
uint32_t nX = UI.nMouseX; uint32_t nMouseX = UI.nMouseX;
uint32_t nY = UI.nMouseY + 20; uint32_t nMouseY = UI.nMouseY + 20;
for(uint32_t i = 0; i < MICROPROFILE_MAX_GRAPHS; ++i) for(uint32_t i = 0; i < MICROPROFILE_MAX_GRAPHS; ++i)
{ {
@ -1736,7 +1735,7 @@ bool MicroProfileDrawGraph(uint32_t nScreenWidth, uint32_t nScreenHeight)
} }
if(nTextCount) if(nTextCount)
{ {
MicroProfileDrawFloatWindow(nX, nY, Strings.ppStrings, Strings.nNumStrings, 0, pColors); MicroProfileDrawFloatWindow(nMouseX, nMouseY, Strings.ppStrings, Strings.nNumStrings, 0, pColors);
} }
if(UI.nMouseRight) if(UI.nMouseRight)
@ -2321,8 +2320,8 @@ inline void MicroProfileDrawMenu(uint32_t nWidth, uint32_t nHeight)
uint32_t nMenuX[MICROPROFILE_MENU_MAX] = {0}; uint32_t nMenuX[MICROPROFILE_MENU_MAX] = {0};
uint32_t nNumMenuItems = 0; uint32_t nNumMenuItems = 0;
int nLen = snprintf(buffer, 127, "MicroProfile"); int nMPTextLen = snprintf(buffer, 127, "MicroProfile");
MicroProfileDrawText(nX, nY, UINT32_MAX, buffer, nLen); MicroProfileDrawText(nX, nY, UINT32_MAX, buffer, nMPTextLen);
nX += (sizeof("MicroProfile")+2) * (MICROPROFILE_TEXT_WIDTH+1); nX += (sizeof("MicroProfile")+2) * (MICROPROFILE_TEXT_WIDTH+1);
pMenuText[nNumMenuItems++] = "Mode"; pMenuText[nNumMenuItems++] = "Mode";
pMenuText[nNumMenuItems++] = "Groups"; pMenuText[nNumMenuItems++] = "Groups";
@ -2438,16 +2437,16 @@ inline void MicroProfileDrawMenu(uint32_t nWidth, uint32_t nHeight)
int nNumLines = 0; int nNumLines = 0;
bool bSelected = false; bool bSelected = false;
const char* pString = CB(nNumLines, &bSelected); const char* pString = CB(nNumLines, &bSelected);
uint32_t nWidth = 0, nHeight = 0; uint32_t nTextWidth = 0, nTextHeight = 0;
while(pString) while(pString)
{ {
nWidth = MicroProfileMax<int>(nWidth, (int)strlen(pString)); nTextWidth = MicroProfileMax<int>(nTextWidth, (int)strlen(pString));
nNumLines++; nNumLines++;
pString = CB(nNumLines, &bSelected); pString = CB(nNumLines, &bSelected);
} }
nWidth = (2+nWidth) * (MICROPROFILE_TEXT_WIDTH+1); nTextWidth = (2+nTextWidth) * (MICROPROFILE_TEXT_WIDTH+1);
nHeight = nNumLines * (MICROPROFILE_TEXT_HEIGHT+1); nTextHeight = nNumLines * (MICROPROFILE_TEXT_HEIGHT+1);
if(UI.nMouseY <= nY + nHeight+0 && UI.nMouseY >= nY-0 && UI.nMouseX <= nX + nWidth + 0 && UI.nMouseX >= nX - 0) if(UI.nMouseY <= nY + nTextHeight+0 && UI.nMouseY >= nY-0 && UI.nMouseX <= nX + nTextWidth + 0 && UI.nMouseX >= nX - 0)
{ {
UI.nActiveMenu = nMenu; UI.nActiveMenu = nMenu;
} }
@ -2455,21 +2454,21 @@ inline void MicroProfileDrawMenu(uint32_t nWidth, uint32_t nHeight)
{ {
UI.nActiveMenu = UINT32_MAX; UI.nActiveMenu = UINT32_MAX;
} }
MicroProfileDrawBox(nX, nY, nX + nWidth, nY + nHeight, 0xff000000|g_nMicroProfileBackColors[1]); MicroProfileDrawBox(nX, nY, nX + nTextWidth, nY + nTextHeight, 0xff000000|g_nMicroProfileBackColors[1]);
for(int i = 0; i < nNumLines; ++i) for(int i = 0; i < nNumLines; ++i)
{ {
bool bSelected = false; bool bSelected2 = false;
const char* pString = CB(i, &bSelected); const char* pString2 = CB(i, &bSelected2);
if(UI.nMouseY >= nY && UI.nMouseY < nY + MICROPROFILE_TEXT_HEIGHT + 1) if(UI.nMouseY >= nY && UI.nMouseY < nY + MICROPROFILE_TEXT_HEIGHT + 1)
{ {
if(UI.nMouseLeft || UI.nMouseRight) if(UI.nMouseLeft || UI.nMouseRight)
{ {
CBClick[nMenu](i); CBClick[nMenu](i);
} }
MicroProfileDrawBox(nX, nY, nX + nWidth, nY + MICROPROFILE_TEXT_HEIGHT + 1, 0xff888888); MicroProfileDrawBox(nX, nY, nX + nTextWidth, nY + MICROPROFILE_TEXT_HEIGHT + 1, 0xff888888);
} }
int nLen = snprintf(buffer, SBUF_SIZE-1, "%c %s", bSelected ? '*' : ' ' ,pString); int nTextLen = snprintf(buffer, SBUF_SIZE-1, "%c %s", bSelected2 ? '*' : ' ' ,pString2);
MicroProfileDrawText(nX, nY, UINT32_MAX, buffer, nLen); MicroProfileDrawText(nX, nY, UINT32_MAX, buffer, nTextLen);
nY += MICROPROFILE_TEXT_HEIGHT+1; nY += MICROPROFILE_TEXT_HEIGHT+1;
} }
} }
@ -2605,7 +2604,7 @@ inline void MicroProfileDrawCustom(uint32_t nWidth, uint32_t nHeight)
for(uint32_t i = 0; i < nCount; ++i) for(uint32_t i = 0; i < nCount; ++i)
{ {
nOffsetY += (1+MICROPROFILE_TEXT_HEIGHT); nOffsetY += (1+MICROPROFILE_TEXT_HEIGHT);
uint32_t nWidth = MicroProfileMin(nMaxWidth, (uint32_t)(nMaxWidth * pMs[i] * fRcpReference)); nWidth = MicroProfileMin(nMaxWidth, (uint32_t)(nMaxWidth * pMs[i] * fRcpReference));
MicroProfileDrawBox(nMaxOffsetX, nOffsetY, nMaxOffsetX+nWidth, nOffsetY+MICROPROFILE_TEXT_HEIGHT, pColors[i]|0xff000000); MicroProfileDrawBox(nMaxOffsetX, nOffsetY, nMaxOffsetX+nWidth, nOffsetY+MICROPROFILE_TEXT_HEIGHT, pColors[i]|0xff000000);
} }
} }

View File

@ -65,6 +65,10 @@ if (MSVC)
/we4305 # 'context': truncation from 'type1' to 'type2' /we4305 # 'context': truncation from 'type1' to 'type2'
/we4388 # 'expression': signed/unsigned mismatch /we4388 # 'expression': signed/unsigned mismatch
/we4389 # 'operator': signed/unsigned mismatch /we4389 # 'operator': signed/unsigned mismatch
/we4456 # Declaration of 'identifier' hides previous local declaration
/we4457 # Declaration of 'identifier' hides function parameter
/we4458 # Declaration of 'identifier' hides class member
/we4459 # Declaration of 'identifier' hides global declaration
/we4505 # 'function': unreferenced local function has been removed /we4505 # 'function': unreferenced local function has been removed
/we4547 # 'operator': operator before comma has no effect; expected operator with side-effect /we4547 # 'operator': operator before comma has no effect; expected operator with side-effect
/we4549 # 'operator1': operator before comma has no effect; did you intend 'operator2'? /we4549 # 'operator1': operator before comma has no effect; did you intend 'operator2'?
@ -92,6 +96,7 @@ else()
-Werror=missing-declarations -Werror=missing-declarations
-Werror=missing-field-initializers -Werror=missing-field-initializers
-Werror=reorder -Werror=reorder
-Werror=shadow
-Werror=sign-compare -Werror=sign-compare
-Werror=switch -Werror=switch
-Werror=uninitialized -Werror=uninitialized

View File

@ -49,9 +49,6 @@ if (NOT MSVC)
target_compile_options(audio_core PRIVATE target_compile_options(audio_core PRIVATE
-Werror=conversion -Werror=conversion
-Werror=ignored-qualifiers -Werror=ignored-qualifiers
-Werror=shadow
-Werror=unused-parameter
-Werror=unused-variable
$<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-parameter> $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-parameter>
$<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-variable> $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-variable>

View File

@ -33,9 +33,9 @@ void DetachedTasks::AddTask(std::function<void()> task) {
++instance->count; ++instance->count;
std::thread([task{std::move(task)}]() { std::thread([task{std::move(task)}]() {
task(); task();
std::unique_lock lock{instance->mutex}; std::unique_lock thread_lock{instance->mutex};
--instance->count; --instance->count;
std::notify_all_at_thread_exit(instance->cv, std::move(lock)); std::notify_all_at_thread_exit(instance->cv, std::move(thread_lock));
}).detach(); }).detach();
} }

View File

@ -743,16 +743,11 @@ if (MSVC)
/we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data
/we4245 # 'conversion': conversion from 'type1' to 'type2', signed/unsigned mismatch /we4245 # 'conversion': conversion from 'type1' to 'type2', signed/unsigned mismatch
/we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
/we4456 # Declaration of 'identifier' hides previous local declaration
/we4457 # Declaration of 'identifier' hides function parameter
/we4458 # Declaration of 'identifier' hides class member
/we4459 # Declaration of 'identifier' hides global declaration
) )
else() else()
target_compile_options(core PRIVATE target_compile_options(core PRIVATE
-Werror=conversion -Werror=conversion
-Werror=ignored-qualifiers -Werror=ignored-qualifiers
-Werror=shadow
$<$<CXX_COMPILER_ID:GNU>:-Werror=class-memaccess> $<$<CXX_COMPILER_ID:GNU>:-Werror=class-memaccess>
$<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-parameter> $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-parameter>

View File

@ -107,6 +107,7 @@ void ARM_Interface::Run() {
} }
// Otherwise, run the thread. // Otherwise, run the thread.
system.EnterDynarmicProfile();
if (current_thread->GetStepState() == StepState::StepPending) { if (current_thread->GetStepState() == StepState::StepPending) {
hr = StepJit(); hr = StepJit();
@ -116,6 +117,7 @@ void ARM_Interface::Run() {
} else { } else {
hr = RunJit(); hr = RunJit();
} }
system.ExitDynarmicProfile();
// Notify the debugger and go to sleep if a breakpoint was hit. // Notify the debugger and go to sleep if a breakpoint was hit.
if (Has(hr, breakpoint)) { if (Has(hr, breakpoint)) {

View File

@ -105,12 +105,10 @@ void CpuManager::MultiCoreRunGuestLoop() {
while (true) { while (true) {
auto* physical_core = &kernel.CurrentPhysicalCore(); auto* physical_core = &kernel.CurrentPhysicalCore();
system.EnterDynarmicProfile();
while (!physical_core->IsInterrupted()) { while (!physical_core->IsInterrupted()) {
physical_core->Run(); physical_core->Run();
physical_core = &kernel.CurrentPhysicalCore(); physical_core = &kernel.CurrentPhysicalCore();
} }
system.ExitDynarmicProfile();
{ {
Kernel::KScopedDisableDispatch dd(kernel); Kernel::KScopedDisableDispatch dd(kernel);
physical_core->ArmInterface().ClearExclusiveState(); physical_core->ArmInterface().ClearExclusiveState();
@ -143,12 +141,10 @@ void CpuManager::SingleCoreRunGuestLoop() {
auto& kernel = system.Kernel(); auto& kernel = system.Kernel();
while (true) { while (true) {
auto* physical_core = &kernel.CurrentPhysicalCore(); auto* physical_core = &kernel.CurrentPhysicalCore();
system.EnterDynarmicProfile();
if (!physical_core->IsInterrupted()) { if (!physical_core->IsInterrupted()) {
physical_core->Run(); physical_core->Run();
physical_core = &kernel.CurrentPhysicalCore(); physical_core = &kernel.CurrentPhysicalCore();
} }
system.ExitDynarmicProfile();
kernel.SetIsPhantomModeForSingleCore(true); kernel.SetIsPhantomModeForSingleCore(true);
system.CoreTiming().Advance(); system.CoreTiming().Advance();
kernel.SetIsPhantomModeForSingleCore(false); kernel.SetIsPhantomModeForSingleCore(false);

View File

@ -67,18 +67,20 @@ public:
} }
bool SignalDebugger(SignalInfo signal_info) { bool SignalDebugger(SignalInfo signal_info) {
std::scoped_lock lk{connection_lock}; {
std::scoped_lock lk{connection_lock};
if (stopped) { if (stopped) {
// Do not notify the debugger about another event. // Do not notify the debugger about another event.
// It should be ignored. // It should be ignored.
return false; return false;
}
// Set up the state.
stopped = true;
info = signal_info;
} }
// Set up the state.
stopped = true;
info = signal_info;
// Write a single byte into the pipe to wake up the debug interface. // Write a single byte into the pipe to wake up the debug interface.
boost::asio::write(signal_pipe, boost::asio::buffer(&stopped, sizeof(stopped))); boost::asio::write(signal_pipe, boost::asio::buffer(&stopped, sizeof(stopped)));
return true; return true;
@ -191,17 +193,22 @@ private:
break; break;
} }
case DebuggerAction::Continue: case DebuggerAction::Continue:
ResumeEmulation(); MarkResumed([&] { ResumeEmulation(); });
break; break;
case DebuggerAction::StepThreadUnlocked: case DebuggerAction::StepThreadUnlocked:
active_thread->SetStepState(Kernel::StepState::StepPending); MarkResumed([&] {
active_thread->Resume(Kernel::SuspendType::Debug); active_thread->SetStepState(Kernel::StepState::StepPending);
ResumeEmulation(active_thread); active_thread->Resume(Kernel::SuspendType::Debug);
ResumeEmulation(active_thread);
});
break; break;
case DebuggerAction::StepThreadLocked: case DebuggerAction::StepThreadLocked: {
active_thread->SetStepState(Kernel::StepState::StepPending); MarkResumed([&] {
active_thread->Resume(Kernel::SuspendType::Debug); active_thread->SetStepState(Kernel::StepState::StepPending);
active_thread->Resume(Kernel::SuspendType::Debug);
});
break; break;
}
case DebuggerAction::ShutdownEmulation: { case DebuggerAction::ShutdownEmulation: {
// Spawn another thread that will exit after shutdown, // Spawn another thread that will exit after shutdown,
// to avoid a deadlock // to avoid a deadlock
@ -231,11 +238,18 @@ private:
continue; continue;
} }
thread->Resume(Kernel::SuspendType::Debug);
thread->SetStepState(Kernel::StepState::NotStepping); thread->SetStepState(Kernel::StepState::NotStepping);
thread->Resume(Kernel::SuspendType::Debug);
} }
} }
template <typename Callback>
void MarkResumed(Callback&& cb) {
std::scoped_lock lk{connection_lock};
stopped = false;
cb();
}
void UpdateActiveThread() { void UpdateActiveThread() {
const auto& threads{ThreadList()}; const auto& threads{ThreadList()};
if (std::find(threads.begin(), threads.end(), active_thread) == threads.end()) { if (std::find(threads.begin(), threads.end(), active_thread) == threads.end()) {

View File

@ -15,6 +15,7 @@
#include "common/scope_exit.h" #include "common/scope_exit.h"
#include "core/core.h" #include "core/core.h"
#include "core/core_timing.h" #include "core/core_timing.h"
#include "core/debugger/debugger.h"
#include "core/hle/kernel/k_client_port.h" #include "core/hle/kernel/k_client_port.h"
#include "core/hle/kernel/k_client_session.h" #include "core/hle/kernel/k_client_session.h"
#include "core/hle/kernel/k_code_memory.h" #include "core/hle/kernel/k_code_memory.h"
@ -627,6 +628,12 @@ static void Break(Core::System& system, u32 reason, u64 info1, u64 info2) {
const auto thread_processor_id = current_thread->GetActiveCore(); const auto thread_processor_id = current_thread->GetActiveCore();
system.ArmInterface(static_cast<std::size_t>(thread_processor_id)).LogBacktrace(); system.ArmInterface(static_cast<std::size_t>(thread_processor_id)).LogBacktrace();
} }
if (system.DebuggerEnabled()) {
auto* thread = system.Kernel().GetCurrentEmuThread();
system.GetDebugger().NotifyThreadStopped(thread);
thread->RequestSuspend(Kernel::SuspendType::Debug);
}
} }
static void Break32(Core::System& system, u32 reason, u32 info1, u32 info2) { static void Break32(Core::System& system, u32 reason, u32 info1, u32 info2) {
@ -2982,7 +2989,6 @@ static const FunctionDef* GetSVCInfo64(u32 func_num) {
} }
void Call(Core::System& system, u32 immediate) { void Call(Core::System& system, u32 immediate) {
system.ExitDynarmicProfile();
auto& kernel = system.Kernel(); auto& kernel = system.Kernel();
kernel.EnterSVCProfile(); kernel.EnterSVCProfile();
@ -3007,8 +3013,6 @@ void Call(Core::System& system, u32 immediate) {
auto* host_context = thread->GetHostContext().get(); auto* host_context = thread->GetHostContext().get();
host_context->Rewind(); host_context->Rewind();
} }
system.EnterDynarmicProfile();
} }
} // namespace Kernel::Svc } // namespace Kernel::Svc

View File

@ -44,7 +44,6 @@ else()
-Werror -Werror
-Werror=conversion -Werror=conversion
-Werror=ignored-qualifiers -Werror=ignored-qualifiers
-Werror=shadow
$<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-parameter> $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-parameter>
$<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-variable> $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-variable>
-Werror=unused-variable -Werror=unused-variable

View File

@ -253,9 +253,6 @@ else()
-Werror -Werror
-Werror=conversion -Werror=conversion
-Werror=ignored-qualifiers -Werror=ignored-qualifiers
-Werror=implicit-fallthrough
-Werror=shadow
-Werror=sign-compare
$<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-parameter> $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-parameter>
$<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-variable> $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-variable>
-Werror=unused-variable -Werror=unused-variable

View File

@ -258,10 +258,6 @@ if (MSVC)
target_compile_options(video_core PRIVATE target_compile_options(video_core PRIVATE
/we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data
/we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data
/we4456 # Declaration of 'identifier' hides previous local declaration
/we4457 # Declaration of 'identifier' hides function parameter
/we4458 # Declaration of 'identifier' hides class member
/we4459 # Declaration of 'identifier' hides global declaration
) )
else() else()
target_compile_options(video_core PRIVATE target_compile_options(video_core PRIVATE
@ -269,7 +265,6 @@ else()
-Wno-error=sign-conversion -Wno-error=sign-conversion
-Werror=pessimizing-move -Werror=pessimizing-move
-Werror=redundant-move -Werror=redundant-move
-Werror=shadow
-Werror=type-limits -Werror=type-limits
$<$<CXX_COMPILER_ID:GNU>:-Werror=class-memaccess> $<$<CXX_COMPILER_ID:GNU>:-Werror=class-memaccess>

View File

@ -328,31 +328,32 @@ void ASTCDecoderPass::Assemble(Image& image, const StagingBufferRef& map,
const VkImageAspectFlags aspect_mask = image.AspectMask(); const VkImageAspectFlags aspect_mask = image.AspectMask();
const VkImage vk_image = image.Handle(); const VkImage vk_image = image.Handle();
const bool is_initialized = image.ExchangeInitialization(); const bool is_initialized = image.ExchangeInitialization();
scheduler.Record( scheduler.Record([vk_pipeline, vk_image, aspect_mask,
[vk_pipeline, vk_image, aspect_mask, is_initialized](vk::CommandBuffer cmdbuf) { is_initialized](vk::CommandBuffer cmdbuf) {
const VkImageMemoryBarrier image_barrier{ const VkImageMemoryBarrier image_barrier{
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
.pNext = nullptr, .pNext = nullptr,
.srcAccessMask = is_initialized ? VK_ACCESS_SHADER_WRITE_BIT : VkAccessFlags{}, .srcAccessMask = static_cast<VkAccessFlags>(is_initialized ? VK_ACCESS_SHADER_WRITE_BIT
.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT, : VK_ACCESS_NONE),
.oldLayout = is_initialized ? VK_IMAGE_LAYOUT_GENERAL : VK_IMAGE_LAYOUT_UNDEFINED, .dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT,
.newLayout = VK_IMAGE_LAYOUT_GENERAL, .oldLayout = is_initialized ? VK_IMAGE_LAYOUT_GENERAL : VK_IMAGE_LAYOUT_UNDEFINED,
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .newLayout = VK_IMAGE_LAYOUT_GENERAL,
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.image = vk_image, .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.subresourceRange{ .image = vk_image,
.aspectMask = aspect_mask, .subresourceRange{
.baseMipLevel = 0, .aspectMask = aspect_mask,
.levelCount = VK_REMAINING_MIP_LEVELS, .baseMipLevel = 0,
.baseArrayLayer = 0, .levelCount = VK_REMAINING_MIP_LEVELS,
.layerCount = VK_REMAINING_ARRAY_LAYERS, .baseArrayLayer = 0,
}, .layerCount = VK_REMAINING_ARRAY_LAYERS,
}; },
cmdbuf.PipelineBarrier(is_initialized ? VK_PIPELINE_STAGE_ALL_COMMANDS_BIT };
: VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, cmdbuf.PipelineBarrier(is_initialized ? VK_PIPELINE_STAGE_ALL_COMMANDS_BIT
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, image_barrier); : VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_COMPUTE, vk_pipeline); VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, image_barrier);
}); cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_COMPUTE, vk_pipeline);
});
for (const VideoCommon::SwizzleParameters& swizzle : swizzles) { for (const VideoCommon::SwizzleParameters& swizzle : swizzles) {
const size_t input_offset = swizzle.buffer_offset + map.offset; const size_t input_offset = swizzle.buffer_offset + map.offset;
const u32 num_dispatches_x = Common::DivCeil(swizzle.num_tiles.width, 8U); const u32 num_dispatches_x = Common::DivCeil(swizzle.num_tiles.width, 8U);

View File

@ -13,8 +13,8 @@ namespace WebService {
namespace Telemetry = Common::Telemetry; namespace Telemetry = Common::Telemetry;
struct TelemetryJson::Impl { struct TelemetryJson::Impl {
Impl(std::string host, std::string username, std::string token) Impl(std::string host_, std::string username_, std::string token_)
: host{std::move(host)}, username{std::move(username)}, token{std::move(token)} {} : host{std::move(host_)}, username{std::move(username_)}, token{std::move(token_)} {}
nlohmann::json& TopSection() { nlohmann::json& TopSection() {
return sections[static_cast<u8>(Telemetry::FieldType::None)]; return sections[static_cast<u8>(Telemetry::FieldType::None)];

View File

@ -30,10 +30,10 @@ constexpr std::array<const char, 1> API_VERSION{'1'};
constexpr std::size_t TIMEOUT_SECONDS = 30; constexpr std::size_t TIMEOUT_SECONDS = 30;
struct Client::Impl { struct Client::Impl {
Impl(std::string host, std::string username, std::string token) Impl(std::string host_, std::string username_, std::string token_)
: host{std::move(host)}, username{std::move(username)}, token{std::move(token)} { : host{std::move(host_)}, username{std::move(username_)}, token{std::move(token_)} {
std::scoped_lock lock{jwt_cache.mutex}; std::scoped_lock lock{jwt_cache.mutex};
if (this->username == jwt_cache.username && this->token == jwt_cache.token) { if (username == jwt_cache.username && token == jwt_cache.token) {
jwt = jwt_cache.jwt; jwt = jwt_cache.jwt;
} }
} }
@ -69,8 +69,8 @@ struct Client::Impl {
*/ */
WebResult GenericRequest(const std::string& method, const std::string& path, WebResult GenericRequest(const std::string& method, const std::string& path,
const std::string& data, const std::string& accept, const std::string& data, const std::string& accept,
const std::string& jwt = "", const std::string& username = "", const std::string& jwt_ = "", const std::string& username_ = "",
const std::string& token = "") { const std::string& token_ = "") {
if (cli == nullptr) { if (cli == nullptr) {
cli = std::make_unique<httplib::Client>(host.c_str()); cli = std::make_unique<httplib::Client>(host.c_str());
} }
@ -85,14 +85,14 @@ struct Client::Impl {
cli->set_write_timeout(TIMEOUT_SECONDS); cli->set_write_timeout(TIMEOUT_SECONDS);
httplib::Headers params; httplib::Headers params;
if (!jwt.empty()) { if (!jwt_.empty()) {
params = { params = {
{std::string("Authorization"), fmt::format("Bearer {}", jwt)}, {std::string("Authorization"), fmt::format("Bearer {}", jwt_)},
}; };
} else if (!username.empty()) { } else if (!username_.empty()) {
params = { params = {
{std::string("x-username"), username}, {std::string("x-username"), username_},
{std::string("x-token"), token}, {std::string("x-token"), token_},
}; };
} }

View File

@ -127,7 +127,7 @@ void EmuThread::run() {
class OpenGLSharedContext : public Core::Frontend::GraphicsContext { class OpenGLSharedContext : public Core::Frontend::GraphicsContext {
public: public:
/// Create the original context that should be shared from /// Create the original context that should be shared from
explicit OpenGLSharedContext(QSurface* surface) : surface(surface) { explicit OpenGLSharedContext(QSurface* surface_) : surface{surface_} {
QSurfaceFormat format; QSurfaceFormat format;
format.setVersion(4, 6); format.setVersion(4, 6);
format.setProfile(QSurfaceFormat::CompatibilityProfile); format.setProfile(QSurfaceFormat::CompatibilityProfile);
@ -364,9 +364,9 @@ void GRenderWindow::RestoreGeometry() {
QWidget::restoreGeometry(geometry); QWidget::restoreGeometry(geometry);
} }
void GRenderWindow::restoreGeometry(const QByteArray& geometry) { void GRenderWindow::restoreGeometry(const QByteArray& geometry_) {
// Make sure users of this class don't need to deal with backing up the geometry themselves // Make sure users of this class don't need to deal with backing up the geometry themselves
QWidget::restoreGeometry(geometry); QWidget::restoreGeometry(geometry_);
BackupGeometry(); BackupGeometry();
} }
@ -1014,8 +1014,8 @@ QStringList GRenderWindow::GetUnsupportedGLExtensions() const {
return unsupported_ext; return unsupported_ext;
} }
void GRenderWindow::OnEmulationStarting(EmuThread* emu_thread) { void GRenderWindow::OnEmulationStarting(EmuThread* emu_thread_) {
this->emu_thread = emu_thread; emu_thread = emu_thread_;
} }
void GRenderWindow::OnEmulationStopping() { void GRenderWindow::OnEmulationStopping() {

View File

@ -56,12 +56,12 @@ public:
/** /**
* Sets whether the emulation thread is running or not * Sets whether the emulation thread is running or not
* @param running Boolean value, set the emulation thread to running if true * @param running_ Boolean value, set the emulation thread to running if true
* @note This function is thread-safe * @note This function is thread-safe
*/ */
void SetRunning(bool running) { void SetRunning(bool running_) {
std::unique_lock lock{running_mutex}; std::unique_lock lock{running_mutex};
this->running = running; running = running_;
lock.unlock(); lock.unlock();
running_cv.notify_all(); running_cv.notify_all();
if (!running) { if (!running) {
@ -138,8 +138,8 @@ public:
void BackupGeometry(); void BackupGeometry();
void RestoreGeometry(); void RestoreGeometry();
void restoreGeometry(const QByteArray& geometry); // overridden void restoreGeometry(const QByteArray& geometry_); // overridden
QByteArray saveGeometry(); // overridden QByteArray saveGeometry(); // overridden
qreal windowPixelRatio() const; qreal windowPixelRatio() const;
@ -189,7 +189,7 @@ public:
void Exit(); void Exit();
public slots: public slots:
void OnEmulationStarting(EmuThread* emu_thread); void OnEmulationStarting(EmuThread* emu_thread_);
void OnEmulationStopping(); void OnEmulationStopping();
void OnFramebufferSizeChanged(); void OnFramebufferSizeChanged();

View File

@ -27,12 +27,11 @@
#include "yuzu/hotkeys.h" #include "yuzu/hotkeys.h"
#include "yuzu/uisettings.h" #include "yuzu/uisettings.h"
ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry_,
InputCommon::InputSubsystem* input_subsystem, InputCommon::InputSubsystem* input_subsystem,
Core::System& system_) Core::System& system_)
: QDialog(parent), ui{std::make_unique<Ui::ConfigureDialog>()}, : QDialog(parent), ui{std::make_unique<Ui::ConfigureDialog>()}, registry{registry_},
registry(registry), system{system_}, audio_tab{std::make_unique<ConfigureAudio>(system_, system{system_}, audio_tab{std::make_unique<ConfigureAudio>(system_, this)},
this)},
cpu_tab{std::make_unique<ConfigureCpu>(system_, this)}, cpu_tab{std::make_unique<ConfigureCpu>(system_, this)},
debug_tab_tab{std::make_unique<ConfigureDebugTab>(system_, this)}, debug_tab_tab{std::make_unique<ConfigureDebugTab>(system_, this)},
filesystem_tab{std::make_unique<ConfigureFilesystem>(this)}, filesystem_tab{std::make_unique<ConfigureFilesystem>(this)},

View File

@ -40,7 +40,7 @@ class ConfigureDialog : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
explicit ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, explicit ConfigureDialog(QWidget* parent, HotkeyRegistry& registry_,
InputCommon::InputSubsystem* input_subsystem, Core::System& system_); InputCommon::InputSubsystem* input_subsystem, Core::System& system_);
~ConfigureDialog() override; ~ConfigureDialog() override;

View File

@ -264,15 +264,16 @@ QString ConfigureInputPlayer::AnalogToText(const Common::ParamPackage& param,
return QObject::tr("[unknown]"); return QObject::tr("[unknown]");
} }
ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_index, ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_index_,
QWidget* bottom_row, QWidget* bottom_row_,
InputCommon::InputSubsystem* input_subsystem_, InputCommon::InputSubsystem* input_subsystem_,
InputProfiles* profiles_, Core::HID::HIDCore& hid_core_, InputProfiles* profiles_, Core::HID::HIDCore& hid_core_,
bool is_powered_on_, bool debug) bool is_powered_on_, bool debug_)
: QWidget(parent), ui(std::make_unique<Ui::ConfigureInputPlayer>()), player_index(player_index), : QWidget(parent),
debug(debug), is_powered_on{is_powered_on_}, input_subsystem{input_subsystem_}, ui(std::make_unique<Ui::ConfigureInputPlayer>()), player_index{player_index_}, debug{debug_},
profiles(profiles_), timeout_timer(std::make_unique<QTimer>()), is_powered_on{is_powered_on_}, input_subsystem{input_subsystem_}, profiles(profiles_),
poll_timer(std::make_unique<QTimer>()), bottom_row(bottom_row), hid_core{hid_core_} { timeout_timer(std::make_unique<QTimer>()),
poll_timer(std::make_unique<QTimer>()), bottom_row{bottom_row_}, hid_core{hid_core_} {
if (player_index == 0) { if (player_index == 0) {
auto* emulated_controller_p1 = auto* emulated_controller_p1 =
hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1); hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1);
@ -696,39 +697,38 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
UpdateControllerEnabledButtons(); UpdateControllerEnabledButtons();
UpdateControllerButtonNames(); UpdateControllerButtonNames();
UpdateMotionButtons(); UpdateMotionButtons();
connect(ui->comboControllerType, qOverload<int>(&QComboBox::currentIndexChanged), connect(ui->comboControllerType, qOverload<int>(&QComboBox::currentIndexChanged), [this](int) {
[this, player_index](int) { UpdateControllerAvailableButtons();
UpdateControllerAvailableButtons(); UpdateControllerEnabledButtons();
UpdateControllerEnabledButtons(); UpdateControllerButtonNames();
UpdateControllerButtonNames(); UpdateMotionButtons();
UpdateMotionButtons(); const Core::HID::NpadStyleIndex type =
const Core::HID::NpadStyleIndex type = GetControllerTypeFromIndex(ui->comboControllerType->currentIndex());
GetControllerTypeFromIndex(ui->comboControllerType->currentIndex());
if (player_index == 0) { if (player_index == 0) {
auto* emulated_controller_p1 = auto* emulated_controller_p1 =
hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1); hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1);
auto* emulated_controller_handheld = auto* emulated_controller_handheld =
hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld); hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld);
bool is_connected = emulated_controller->IsConnected(true); bool is_connected = emulated_controller->IsConnected(true);
emulated_controller_p1->SetNpadStyleIndex(type); emulated_controller_p1->SetNpadStyleIndex(type);
emulated_controller_handheld->SetNpadStyleIndex(type); emulated_controller_handheld->SetNpadStyleIndex(type);
if (is_connected) { if (is_connected) {
if (type == Core::HID::NpadStyleIndex::Handheld) { if (type == Core::HID::NpadStyleIndex::Handheld) {
emulated_controller_p1->Disconnect(); emulated_controller_p1->Disconnect();
emulated_controller_handheld->Connect(true); emulated_controller_handheld->Connect(true);
emulated_controller = emulated_controller_handheld; emulated_controller = emulated_controller_handheld;
} else { } else {
emulated_controller_handheld->Disconnect(); emulated_controller_handheld->Disconnect();
emulated_controller_p1->Connect(true); emulated_controller_p1->Connect(true);
emulated_controller = emulated_controller_p1; emulated_controller = emulated_controller_p1;
}
}
ui->controllerFrame->SetController(emulated_controller);
} }
emulated_controller->SetNpadStyleIndex(type); }
}); ui->controllerFrame->SetController(emulated_controller);
}
emulated_controller->SetNpadStyleIndex(type);
});
connect(ui->comboDevices, qOverload<int>(&QComboBox::activated), this, connect(ui->comboDevices, qOverload<int>(&QComboBox::activated), this,
&ConfigureInputPlayer::UpdateMappingWithDefaults); &ConfigureInputPlayer::UpdateMappingWithDefaults);

View File

@ -35,10 +35,10 @@
#include "yuzu/uisettings.h" #include "yuzu/uisettings.h"
#include "yuzu/util/util.h" #include "yuzu/util/util.h"
ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id, const std::string& file_name, ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::string& file_name,
Core::System& system_) Core::System& system_)
: QDialog(parent), ui(std::make_unique<Ui::ConfigurePerGame>()), : QDialog(parent),
title_id(title_id), system{system_} { ui(std::make_unique<Ui::ConfigurePerGame>()), title_id{title_id_}, system{system_} {
const auto file_path = std::filesystem::path(Common::FS::ToU8String(file_name)); const auto file_path = std::filesystem::path(Common::FS::ToU8String(file_name));
const auto config_file_name = title_id == 0 ? Common::FS::PathToUTF8String(file_path.filename()) const auto config_file_name = title_id == 0 ? Common::FS::PathToUTF8String(file_path.filename())
: fmt::format("{:016X}", title_id); : fmt::format("{:016X}", title_id);
@ -116,8 +116,8 @@ void ConfigurePerGame::HandleApplyButtonClicked() {
ApplyConfiguration(); ApplyConfiguration();
} }
void ConfigurePerGame::LoadFromFile(FileSys::VirtualFile file) { void ConfigurePerGame::LoadFromFile(FileSys::VirtualFile file_) {
this->file = std::move(file); file = std::move(file_);
LoadConfiguration(); LoadConfiguration();
} }

View File

@ -39,14 +39,14 @@ class ConfigurePerGame : public QDialog {
public: public:
// Cannot use std::filesystem::path due to https://bugreports.qt.io/browse/QTBUG-73263 // Cannot use std::filesystem::path due to https://bugreports.qt.io/browse/QTBUG-73263
explicit ConfigurePerGame(QWidget* parent, u64 title_id, const std::string& file_name, explicit ConfigurePerGame(QWidget* parent, u64 title_id_, const std::string& file_name,
Core::System& system_); Core::System& system_);
~ConfigurePerGame() override; ~ConfigurePerGame() override;
/// Save all button configurations to settings file /// Save all button configurations to settings file
void ApplyConfiguration(); void ApplyConfiguration();
void LoadFromFile(FileSys::VirtualFile file); void LoadFromFile(FileSys::VirtualFile file_);
private: private:
void changeEvent(QEvent* event) override; void changeEvent(QEvent* event) override;

View File

@ -89,8 +89,8 @@ void ConfigurePerGameAddons::ApplyConfiguration() {
Settings::values.disabled_addons[title_id] = disabled_addons; Settings::values.disabled_addons[title_id] = disabled_addons;
} }
void ConfigurePerGameAddons::LoadFromFile(FileSys::VirtualFile file) { void ConfigurePerGameAddons::LoadFromFile(FileSys::VirtualFile file_) {
this->file = std::move(file); file = std::move(file_);
LoadConfiguration(); LoadConfiguration();
} }

View File

@ -35,7 +35,7 @@ public:
/// Save all button configurations to settings file /// Save all button configurations to settings file
void ApplyConfiguration(); void ApplyConfiguration();
void LoadFromFile(FileSys::VirtualFile file); void LoadFromFile(FileSys::VirtualFile file_);
void SetTitleId(u64 id); void SetTitleId(u64 id);

View File

@ -165,10 +165,10 @@ ConfigureRingController::ConfigureRingController(QWidget* parent,
const std::string invert_str = invert_value ? "+" : "-"; const std::string invert_str = invert_value ? "+" : "-";
param.Set("invert_x", invert_str); param.Set("invert_x", invert_str);
emulated_device->SetRingParam(param); emulated_device->SetRingParam(param);
for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; for (int sub_button_id2 = 0; sub_button_id2 < ANALOG_SUB_BUTTONS_NUM;
++sub_button_id) { ++sub_button_id2) {
analog_map_buttons[sub_button_id]->setText( analog_map_buttons[sub_button_id2]->setText(
AnalogToText(param, analog_sub_buttons[sub_button_id])); AnalogToText(param, analog_sub_buttons[sub_button_id2]));
} }
}); });
context_menu.exec( context_menu.exec(

View File

@ -68,10 +68,10 @@ static QString ButtonToText(const Common::ParamPackage& param) {
} }
ConfigureTouchFromButton::ConfigureTouchFromButton( ConfigureTouchFromButton::ConfigureTouchFromButton(
QWidget* parent, const std::vector<Settings::TouchFromButtonMap>& touch_maps, QWidget* parent, const std::vector<Settings::TouchFromButtonMap>& touch_maps_,
InputCommon::InputSubsystem* input_subsystem_, const int default_index) InputCommon::InputSubsystem* input_subsystem_, const int default_index)
: QDialog(parent), ui(std::make_unique<Ui::ConfigureTouchFromButton>()), : QDialog(parent), ui(std::make_unique<Ui::ConfigureTouchFromButton>()),
touch_maps(touch_maps), input_subsystem{input_subsystem_}, selected_index(default_index), touch_maps{touch_maps_}, input_subsystem{input_subsystem_}, selected_index{default_index},
timeout_timer(std::make_unique<QTimer>()), poll_timer(std::make_unique<QTimer>()) { timeout_timer(std::make_unique<QTimer>()), poll_timer(std::make_unique<QTimer>()) {
ui->setupUi(this); ui->setupUi(this);
binding_list_model = new QStandardItemModel(0, 3, this); binding_list_model = new QStandardItemModel(0, 3, this);

View File

@ -37,7 +37,7 @@ class ConfigureTouchFromButton : public QDialog {
public: public:
explicit ConfigureTouchFromButton(QWidget* parent, explicit ConfigureTouchFromButton(QWidget* parent,
const std::vector<Settings::TouchFromButtonMap>& touch_maps, const std::vector<Settings::TouchFromButtonMap>& touch_maps_,
InputCommon::InputSubsystem* input_subsystem_, InputCommon::InputSubsystem* input_subsystem_,
int default_index = 0); int default_index = 0);
~ConfigureTouchFromButton() override; ~ConfigureTouchFromButton() override;

View File

@ -113,9 +113,9 @@ QString WaitTreeText::GetText() const {
return text; return text;
} }
WaitTreeMutexInfo::WaitTreeMutexInfo(VAddr mutex_address, const Kernel::KHandleTable& handle_table, WaitTreeMutexInfo::WaitTreeMutexInfo(VAddr mutex_address_, const Kernel::KHandleTable& handle_table,
Core::System& system_) Core::System& system_)
: mutex_address(mutex_address), system{system_} { : mutex_address{mutex_address_}, system{system_} {
mutex_value = system.Memory().Read32(mutex_address); mutex_value = system.Memory().Read32(mutex_address);
owner_handle = static_cast<Kernel::Handle>(mutex_value & Kernel::Svc::HandleWaitMask); owner_handle = static_cast<Kernel::Handle>(mutex_value & Kernel::Svc::HandleWaitMask);
owner = handle_table.GetObject<Kernel::KThread>(owner_handle).GetPointerUnsafe(); owner = handle_table.GetObject<Kernel::KThread>(owner_handle).GetPointerUnsafe();
@ -140,8 +140,8 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeMutexInfo::GetChildren() cons
return list; return list;
} }
WaitTreeCallstack::WaitTreeCallstack(const Kernel::KThread& thread, Core::System& system_) WaitTreeCallstack::WaitTreeCallstack(const Kernel::KThread& thread_, Core::System& system_)
: thread(thread), system{system_} {} : thread{thread_}, system{system_} {}
WaitTreeCallstack::~WaitTreeCallstack() = default; WaitTreeCallstack::~WaitTreeCallstack() = default;
QString WaitTreeCallstack::GetText() const { QString WaitTreeCallstack::GetText() const {
@ -171,8 +171,8 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeCallstack::GetChildren() cons
} }
WaitTreeSynchronizationObject::WaitTreeSynchronizationObject( WaitTreeSynchronizationObject::WaitTreeSynchronizationObject(
const Kernel::KSynchronizationObject& o, Core::System& system_) const Kernel::KSynchronizationObject& object_, Core::System& system_)
: object(o), system{system_} {} : object{object_}, system{system_} {}
WaitTreeSynchronizationObject::~WaitTreeSynchronizationObject() = default; WaitTreeSynchronizationObject::~WaitTreeSynchronizationObject() = default;
WaitTreeExpandableItem::WaitTreeExpandableItem() = default; WaitTreeExpandableItem::WaitTreeExpandableItem() = default;
@ -380,8 +380,8 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThread::GetChildren() const {
return list; return list;
} }
WaitTreeEvent::WaitTreeEvent(const Kernel::KReadableEvent& object, Core::System& system_) WaitTreeEvent::WaitTreeEvent(const Kernel::KReadableEvent& object_, Core::System& system_)
: WaitTreeSynchronizationObject(object, system_) {} : WaitTreeSynchronizationObject(object_, system_) {}
WaitTreeEvent::~WaitTreeEvent() = default; WaitTreeEvent::~WaitTreeEvent() = default;
WaitTreeThreadList::WaitTreeThreadList(std::vector<Kernel::KThread*>&& list, Core::System& system_) WaitTreeThreadList::WaitTreeThreadList(std::vector<Kernel::KThread*>&& list, Core::System& system_)

View File

@ -78,7 +78,7 @@ public:
class WaitTreeMutexInfo : public WaitTreeExpandableItem { class WaitTreeMutexInfo : public WaitTreeExpandableItem {
Q_OBJECT Q_OBJECT
public: public:
explicit WaitTreeMutexInfo(VAddr mutex_address, const Kernel::KHandleTable& handle_table, explicit WaitTreeMutexInfo(VAddr mutex_address_, const Kernel::KHandleTable& handle_table,
Core::System& system_); Core::System& system_);
~WaitTreeMutexInfo() override; ~WaitTreeMutexInfo() override;
@ -97,7 +97,7 @@ private:
class WaitTreeCallstack : public WaitTreeExpandableItem { class WaitTreeCallstack : public WaitTreeExpandableItem {
Q_OBJECT Q_OBJECT
public: public:
explicit WaitTreeCallstack(const Kernel::KThread& thread, Core::System& system_); explicit WaitTreeCallstack(const Kernel::KThread& thread_, Core::System& system_);
~WaitTreeCallstack() override; ~WaitTreeCallstack() override;
QString GetText() const override; QString GetText() const override;
@ -112,7 +112,7 @@ private:
class WaitTreeSynchronizationObject : public WaitTreeExpandableItem { class WaitTreeSynchronizationObject : public WaitTreeExpandableItem {
Q_OBJECT Q_OBJECT
public: public:
explicit WaitTreeSynchronizationObject(const Kernel::KSynchronizationObject& object, explicit WaitTreeSynchronizationObject(const Kernel::KSynchronizationObject& object_,
Core::System& system_); Core::System& system_);
~WaitTreeSynchronizationObject() override; ~WaitTreeSynchronizationObject() override;
@ -162,7 +162,7 @@ private:
class WaitTreeEvent : public WaitTreeSynchronizationObject { class WaitTreeEvent : public WaitTreeSynchronizationObject {
Q_OBJECT Q_OBJECT
public: public:
explicit WaitTreeEvent(const Kernel::KReadableEvent& object, Core::System& system_); explicit WaitTreeEvent(const Kernel::KReadableEvent& object_, Core::System& system_);
~WaitTreeEvent() override; ~WaitTreeEvent() override;
}; };

View File

@ -28,8 +28,8 @@
#include "yuzu/uisettings.h" #include "yuzu/uisettings.h"
#include "yuzu/util/controller_navigation.h" #include "yuzu/util/controller_navigation.h"
GameListSearchField::KeyReleaseEater::KeyReleaseEater(GameList* gamelist, QObject* parent) GameListSearchField::KeyReleaseEater::KeyReleaseEater(GameList* gamelist_, QObject* parent)
: QObject(parent), gamelist{gamelist} {} : QObject(parent), gamelist{gamelist_} {}
// EventFilter in order to process systemkeys while editing the searchfield // EventFilter in order to process systemkeys while editing the searchfield
bool GameListSearchField::KeyReleaseEater::eventFilter(QObject* obj, QEvent* event) { bool GameListSearchField::KeyReleaseEater::eventFilter(QObject* obj, QEvent* event) {
@ -80,9 +80,9 @@ bool GameListSearchField::KeyReleaseEater::eventFilter(QObject* obj, QEvent* eve
return QObject::eventFilter(obj, event); return QObject::eventFilter(obj, event);
} }
void GameListSearchField::setFilterResult(int visible, int total) { void GameListSearchField::setFilterResult(int visible_, int total_) {
this->visible = visible; visible = visible_;
this->total = total; total = total_;
label_filter_result->setText(tr("%1 of %n result(s)", "", total).arg(visible)); label_filter_result->setText(tr("%1 of %n result(s)", "", total).arg(visible));
} }
@ -309,9 +309,9 @@ void GameList::OnFilterCloseClicked() {
main_window->filterBarSetChecked(false); main_window->filterBarSetChecked(false);
} }
GameList::GameList(FileSys::VirtualFilesystem vfs, FileSys::ManualContentProvider* provider, GameList::GameList(FileSys::VirtualFilesystem vfs_, FileSys::ManualContentProvider* provider_,
Core::System& system_, GMainWindow* parent) Core::System& system_, GMainWindow* parent)
: QWidget{parent}, vfs(std::move(vfs)), provider(provider), system{system_} { : QWidget{parent}, vfs{std::move(vfs_)}, provider{provider_}, system{system_} {
watcher = new QFileSystemWatcher(this); watcher = new QFileSystemWatcher(this);
connect(watcher, &QFileSystemWatcher::directoryChanged, this, &GameList::RefreshGameDirectory); connect(watcher, &QFileSystemWatcher::directoryChanged, this, &GameList::RefreshGameDirectory);

View File

@ -67,8 +67,8 @@ public:
COLUMN_COUNT, // Number of columns COLUMN_COUNT, // Number of columns
}; };
explicit GameList(std::shared_ptr<FileSys::VfsFilesystem> vfs, explicit GameList(std::shared_ptr<FileSys::VfsFilesystem> vfs_,
FileSys::ManualContentProvider* provider, Core::System& system_, FileSys::ManualContentProvider* provider_, Core::System& system_,
GMainWindow* parent = nullptr); GMainWindow* parent = nullptr);
~GameList() override; ~GameList() override;

View File

@ -225,8 +225,8 @@ public:
static constexpr int GameDirRole = Qt::UserRole + 2; static constexpr int GameDirRole = Qt::UserRole + 2;
explicit GameListDir(UISettings::GameDir& directory, explicit GameListDir(UISettings::GameDir& directory,
GameListItemType dir_type = GameListItemType::CustomDir) GameListItemType dir_type_ = GameListItemType::CustomDir)
: dir_type{dir_type} { : dir_type{dir_type_} {
setData(type(), TypeRole); setData(type(), TypeRole);
UISettings::GameDir* game_dir = &directory; UISettings::GameDir* game_dir = &directory;
@ -348,7 +348,7 @@ public:
explicit GameListSearchField(GameList* parent = nullptr); explicit GameListSearchField(GameList* parent = nullptr);
QString filterText() const; QString filterText() const;
void setFilterResult(int visible, int total); void setFilterResult(int visible_, int total_);
void clear(); void clear();
void setFocus(); void setFocus();
@ -356,7 +356,7 @@ public:
private: private:
class KeyReleaseEater : public QObject { class KeyReleaseEater : public QObject {
public: public:
explicit KeyReleaseEater(GameList* gamelist, QObject* parent = nullptr); explicit KeyReleaseEater(GameList* gamelist_, QObject* parent = nullptr);
private: private:
GameList* gamelist = nullptr; GameList* gamelist = nullptr;

View File

@ -223,12 +223,12 @@ QList<QStandardItem*> MakeGameListEntry(const std::string& path, const std::stri
} }
} // Anonymous namespace } // Anonymous namespace
GameListWorker::GameListWorker(FileSys::VirtualFilesystem vfs, GameListWorker::GameListWorker(FileSys::VirtualFilesystem vfs_,
FileSys::ManualContentProvider* provider, FileSys::ManualContentProvider* provider_,
QVector<UISettings::GameDir>& game_dirs, QVector<UISettings::GameDir>& game_dirs_,
const CompatibilityList& compatibility_list, Core::System& system_) const CompatibilityList& compatibility_list_, Core::System& system_)
: vfs(std::move(vfs)), provider(provider), game_dirs(game_dirs), : vfs{std::move(vfs_)}, provider{provider_}, game_dirs{game_dirs_},
compatibility_list(compatibility_list), system{system_} {} compatibility_list{compatibility_list_}, system{system_} {}
GameListWorker::~GameListWorker() = default; GameListWorker::~GameListWorker() = default;

View File

@ -33,10 +33,10 @@ class GameListWorker : public QObject, public QRunnable {
Q_OBJECT Q_OBJECT
public: public:
explicit GameListWorker(std::shared_ptr<FileSys::VfsFilesystem> vfs, explicit GameListWorker(std::shared_ptr<FileSys::VfsFilesystem> vfs_,
FileSys::ManualContentProvider* provider, FileSys::ManualContentProvider* provider_,
QVector<UISettings::GameDir>& game_dirs, QVector<UISettings::GameDir>& game_dirs_,
const CompatibilityList& compatibility_list, Core::System& system_); const CompatibilityList& compatibility_list_, Core::System& system_);
~GameListWorker() override; ~GameListWorker() override;
/// Starts the processing of directory tree information. /// Starts the processing of directory tree information.

View File

@ -934,8 +934,7 @@ void GMainWindow::InitializeWidgets() {
Settings::values.renderer_backend.SetValue(Settings::RendererBackend::Vulkan); Settings::values.renderer_backend.SetValue(Settings::RendererBackend::Vulkan);
} else { } else {
Settings::values.renderer_backend.SetValue(Settings::RendererBackend::OpenGL); Settings::values.renderer_backend.SetValue(Settings::RendererBackend::OpenGL);
const auto filter = Settings::values.scaling_filter.GetValue(); if (Settings::values.scaling_filter.GetValue() == Settings::ScalingFilter::Fsr) {
if (filter == Settings::ScalingFilter::Fsr) {
Settings::values.scaling_filter.SetValue(Settings::ScalingFilter::NearestNeighbor); Settings::values.scaling_filter.SetValue(Settings::ScalingFilter::NearestNeighbor);
UpdateFilterText(); UpdateFilterText();
} }
@ -1442,7 +1441,7 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
} }
return false; return false;
} }
game_path = filename; current_game_path = filename;
system->TelemetrySession().AddField(Common::Telemetry::FieldType::App, "Frontend", "Qt"); system->TelemetrySession().AddField(Common::Telemetry::FieldType::App, "Frontend", "Qt");
return true; return true;
@ -1508,7 +1507,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
// Register an ExecuteProgram callback such that Core can execute a sub-program // Register an ExecuteProgram callback such that Core can execute a sub-program
system->RegisterExecuteProgramCallback( system->RegisterExecuteProgramCallback(
[this](std::size_t program_index) { render_window->ExecuteProgram(program_index); }); [this](std::size_t program_index_) { render_window->ExecuteProgram(program_index_); });
// Register an Exit callback such that Core can exit the currently running application. // Register an Exit callback such that Core can exit the currently running application.
system->RegisterExitCallback([this]() { render_window->Exit(); }); system->RegisterExitCallback([this]() { render_window->Exit(); });
@ -1641,7 +1640,7 @@ void GMainWindow::ShutdownGame() {
emu_frametime_label->setVisible(false); emu_frametime_label->setVisible(false);
renderer_status_button->setEnabled(!UISettings::values.has_broken_vulkan); renderer_status_button->setEnabled(!UISettings::values.has_broken_vulkan);
game_path.clear(); current_game_path.clear();
// When closing the game, destroy the GLWindow to clear the context after the game is closed // When closing the game, destroy the GLWindow to clear the context after the game is closed
render_window->ReleaseRenderTarget(); render_window->ReleaseRenderTarget();
@ -2560,7 +2559,7 @@ void GMainWindow::OnRestartGame() {
return; return;
} }
// Make a copy since BootGame edits game_path // Make a copy since BootGame edits game_path
BootGame(QString(game_path)); BootGame(QString(current_game_path));
} }
void GMainWindow::OnPauseGame() { void GMainWindow::OnPauseGame() {
@ -2989,7 +2988,7 @@ void GMainWindow::OnToggleAdaptingFilter() {
void GMainWindow::OnConfigurePerGame() { void GMainWindow::OnConfigurePerGame() {
const u64 title_id = system->GetCurrentProcessProgramID(); const u64 title_id = system->GetCurrentProcessProgramID();
OpenPerGameConfiguration(title_id, game_path.toStdString()); OpenPerGameConfiguration(title_id, current_game_path.toStdString());
} }
void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file_name) { void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file_name) {

View File

@ -369,7 +369,7 @@ private:
bool emulation_running = false; bool emulation_running = false;
std::unique_ptr<EmuThread> emu_thread; std::unique_ptr<EmuThread> emu_thread;
// The path to the game currently running // The path to the game currently running
QString game_path; QString current_game_path;
bool auto_paused = false; bool auto_paused = false;
bool auto_muted = false; bool auto_muted = false;

View File

@ -20,7 +20,7 @@ enum class MouseButton;
class EmuWindow_SDL2 : public Core::Frontend::EmuWindow { class EmuWindow_SDL2 : public Core::Frontend::EmuWindow {
public: public:
explicit EmuWindow_SDL2(InputCommon::InputSubsystem* input_subsystem, Core::System& system_); explicit EmuWindow_SDL2(InputCommon::InputSubsystem* input_subsystem_, Core::System& system_);
~EmuWindow_SDL2(); ~EmuWindow_SDL2();
/// Whether the window is still open, and a close request hasn't yet been sent /// Whether the window is still open, and a close request hasn't yet been sent

View File

@ -73,9 +73,9 @@ bool EmuWindow_SDL2_GL::SupportsRequiredGLExtensions() {
return unsupported_ext.empty(); return unsupported_ext.empty();
} }
EmuWindow_SDL2_GL::EmuWindow_SDL2_GL(InputCommon::InputSubsystem* input_subsystem, EmuWindow_SDL2_GL::EmuWindow_SDL2_GL(InputCommon::InputSubsystem* input_subsystem_,
Core::System& system_, bool fullscreen) Core::System& system_, bool fullscreen)
: EmuWindow_SDL2{input_subsystem, system_} { : EmuWindow_SDL2{input_subsystem_, system_} {
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 6); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 6);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY); SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);

View File

@ -17,7 +17,7 @@ class InputSubsystem;
class EmuWindow_SDL2_GL final : public EmuWindow_SDL2 { class EmuWindow_SDL2_GL final : public EmuWindow_SDL2 {
public: public:
explicit EmuWindow_SDL2_GL(InputCommon::InputSubsystem* input_subsystem, Core::System& system_, explicit EmuWindow_SDL2_GL(InputCommon::InputSubsystem* input_subsystem_, Core::System& system_,
bool fullscreen); bool fullscreen);
~EmuWindow_SDL2_GL(); ~EmuWindow_SDL2_GL();

View File

@ -21,9 +21,9 @@
#include <SDL.h> #include <SDL.h>
#include <SDL_syswm.h> #include <SDL_syswm.h>
EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsystem, EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsystem_,
Core::System& system_, bool fullscreen) Core::System& system_, bool fullscreen)
: EmuWindow_SDL2{input_subsystem, system_} { : EmuWindow_SDL2{input_subsystem_, system_} {
const std::string window_title = fmt::format("yuzu {} | {}-{} (Vulkan)", Common::g_build_name, const std::string window_title = fmt::format("yuzu {} | {}-{} (Vulkan)", Common::g_build_name,
Common::g_scm_branch, Common::g_scm_desc); Common::g_scm_branch, Common::g_scm_desc);
render_window = render_window =

View File

@ -18,7 +18,7 @@ class InputSubsystem;
class EmuWindow_SDL2_VK final : public EmuWindow_SDL2 { class EmuWindow_SDL2_VK final : public EmuWindow_SDL2 {
public: public:
explicit EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsystem, Core::System& system, explicit EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsystem_, Core::System& system,
bool fullscreen); bool fullscreen);
~EmuWindow_SDL2_VK() override; ~EmuWindow_SDL2_VK() override;