mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-01 18:53:17 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c10f473f0d | |||
| dad3ce6a33 | |||
| cb9ec1dc1a | |||
| f7e5ceeacb | |||
| b7f0f98519 | |||
| 7fda6dde73 | |||
| 106a61c943 |
@@ -1,26 +0,0 @@
|
|||||||
From b3622608433c183ba868a1dc8dd9cf285eb3b916 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Dario Petrillo <dario.pk1@gmail.com>
|
|
||||||
Date: Thu, 27 Nov 2025 23:12:38 +0100
|
|
||||||
Subject: [PATCH] avoid extra memset when clearing an empty table
|
|
||||||
|
|
||||||
---
|
|
||||||
include/ankerl/unordered_dense.h | 6 ++++--
|
|
||||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/include/ankerl/unordered_dense.h b/include/ankerl/unordered_dense.h
|
|
||||||
index 0835342..4938212 100644
|
|
||||||
--- a/include/ankerl/unordered_dense.h
|
|
||||||
+++ b/include/ankerl/unordered_dense.h
|
|
||||||
@@ -1490,8 +1490,10 @@ class table : public std::conditional_t<is_map_v<T>, base_table_type_map<T>, bas
|
|
||||||
// modifiers //////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void clear() {
|
|
||||||
- m_values.clear();
|
|
||||||
- clear_buckets();
|
|
||||||
+ if (!empty()) {
|
|
||||||
+ m_values.clear();
|
|
||||||
+ clear_buckets();
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
auto insert(value_type const& value) -> std::pair<iterator, bool> {
|
|
||||||
@@ -540,7 +540,6 @@ add_subdirectory(externals)
|
|||||||
# pass targets from externals
|
# pass targets from externals
|
||||||
# TODO(crueter): CPMUtil Propagate func?
|
# TODO(crueter): CPMUtil Propagate func?
|
||||||
find_package(enet)
|
find_package(enet)
|
||||||
find_package(unordered_dense REQUIRED)
|
|
||||||
|
|
||||||
if (ARCHITECTURE_x86 OR ARCHITECTURE_x86_64)
|
if (ARCHITECTURE_x86 OR ARCHITECTURE_x86_64)
|
||||||
find_package(xbyak)
|
find_package(xbyak)
|
||||||
|
|||||||
@@ -301,17 +301,6 @@
|
|||||||
"repo": "eden-emu/tzdb_to_nx",
|
"repo": "eden-emu/tzdb_to_nx",
|
||||||
"version": "230326"
|
"version": "230326"
|
||||||
},
|
},
|
||||||
"unordered-dense": {
|
|
||||||
"bundled": true,
|
|
||||||
"find_args": "CONFIG",
|
|
||||||
"hash": "d2106f6640f6bfb81755e4b8bfb64982e46ec4a507cacdb38f940123212ccf35a20b43c70c6f01d7bfb8c246d1a16f7845d8052971949cea9def1475e3fa02c8",
|
|
||||||
"package": "unordered_dense",
|
|
||||||
"patches": [
|
|
||||||
"0001-avoid-memset-when-clearing-an-empty-table.patch"
|
|
||||||
],
|
|
||||||
"repo": "martinus/unordered_dense",
|
|
||||||
"version": "7b55cab841"
|
|
||||||
},
|
|
||||||
"vulkan-headers": {
|
"vulkan-headers": {
|
||||||
"hash": "d2846ea228415772645eea4b52a9efd33e6a563043dd3de059e798be6391a8f0ca089f455ae420ff22574939ed0f48ed7c6ff3d5a9987d5231dbf3b3f89b484b",
|
"hash": "d2846ea228415772645eea4b52a9efd33e6a563043dd3de059e798be6391a8f0ca089f455ae420ff22574939ed0f48ed7c6ff3d5a9987d5231dbf3b3f89b484b",
|
||||||
"min_version": "1.4.317",
|
"min_version": "1.4.317",
|
||||||
|
|||||||
+4
-5
@@ -80,7 +80,6 @@ Certain other dependencies will be fetched by CPM regardless. System packages *c
|
|||||||
* [httplib](https://github.com/yhirose/cpp-httplib) - if `ENABLE_UPDATE_CHECKER` or `ENABLE_WEB_SERVICE` are on
|
* [httplib](https://github.com/yhirose/cpp-httplib) - if `ENABLE_UPDATE_CHECKER` or `ENABLE_WEB_SERVICE` are on
|
||||||
* This package is known to be broken on the AUR.
|
* This package is known to be broken on the AUR.
|
||||||
* [cpp-jwt](https://github.com/arun11299/cpp-jwt) 1.4+ - if `ENABLE_WEB_SERVICE` is on
|
* [cpp-jwt](https://github.com/arun11299/cpp-jwt) 1.4+ - if `ENABLE_WEB_SERVICE` is on
|
||||||
* [unordered-dense](https://github.com/martinus/unordered_dense)
|
|
||||||
|
|
||||||
On amd64:
|
On amd64:
|
||||||
|
|
||||||
@@ -119,7 +118,7 @@ Now, install all deps:
|
|||||||
sudo emerge -a \
|
sudo emerge -a \
|
||||||
app-arch/lz4 app-arch/zstd app-arch/unzip \
|
app-arch/lz4 app-arch/zstd app-arch/unzip \
|
||||||
dev-libs/libfmt dev-libs/libusb dev-libs/mcl dev-libs/sirit \
|
dev-libs/libfmt dev-libs/libusb dev-libs/mcl dev-libs/sirit \
|
||||||
dev-libs/unordered_dense dev-libs/boost dev-libs/openssl dev-libs/discord-rpc \
|
dev-libs/boost dev-libs/openssl dev-libs/discord-rpc \
|
||||||
dev-util/spirv-tools dev-util/spirv-headers dev-util/vulkan-headers \
|
dev-util/spirv-tools dev-util/spirv-headers dev-util/vulkan-headers \
|
||||||
dev-util/vulkan-utility-libraries dev-util/glslang \
|
dev-util/vulkan-utility-libraries dev-util/glslang \
|
||||||
media-gfx/renderdoc media-libs/libva media-libs/opus media-video/ffmpeg \
|
media-gfx/renderdoc media-libs/libva media-libs/opus media-video/ffmpeg \
|
||||||
@@ -260,7 +259,7 @@ brew install molten-vk
|
|||||||
<details>
|
<details>
|
||||||
<summary>FreeBSD</summary>
|
<summary>FreeBSD</summary>
|
||||||
|
|
||||||
As root run: `pkg install devel/cmake sdl3 devel/boost-libs devel/catch2 devel/libfmt devel/nlohmann-json devel/ninja devel/nasm devel/autoconf devel/pkgconf devel/qt6-base devel/qt6-charts devel/simpleini net/enet multimedia/ffnvcodec-headers multimedia/ffmpeg audio/opus archivers/liblz4 lang/gcc12 graphics/glslang graphics/vulkan-utility-libraries graphics/spirv-tools www/cpp-httplib devel/unordered-dense vulkan-headers quazip-qt6`
|
As root run: `pkg install devel/cmake sdl3 devel/boost-libs devel/catch2 devel/libfmt devel/nlohmann-json devel/ninja devel/nasm devel/autoconf devel/pkgconf devel/qt6-base devel/qt6-charts devel/simpleini net/enet multimedia/ffnvcodec-headers multimedia/ffmpeg audio/opus archivers/liblz4 lang/gcc12 graphics/glslang graphics/vulkan-utility-libraries graphics/spirv-tools www/cpp-httplib vulkan-headers quazip-qt6`
|
||||||
|
|
||||||
If using FreeBSD 12 or prior, use `devel/pkg-config` instead.
|
If using FreeBSD 12 or prior, use `devel/pkg-config` instead.
|
||||||
|
|
||||||
@@ -294,7 +293,7 @@ pkg_add cmake nasm git boost unzip--iconv autoconf-2.72p0 bash ffmpeg glslang gm
|
|||||||
<summary>DragonFlyBSD</summary>
|
<summary>DragonFlyBSD</summary>
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
pkg install gcc14 git cmake unzip nasm autoconf bash pkgconf ffmpeg glslang gmake jq nlohmann-json enet spirv-tools sdl3 vulkan-utility-libraries vulkan-headers catch2 libfmt openssl liblz4 boost-libs cpp-httplib qt6-base qt6-charts quazip-qt6 unordered-dense libva-vdpau-driver libva-utils libva-intel-driver
|
pkg install gcc14 git cmake unzip nasm autoconf bash pkgconf ffmpeg glslang gmake jq nlohmann-json enet spirv-tools sdl3 vulkan-utility-libraries vulkan-headers catch2 libfmt openssl liblz4 boost-libs cpp-httplib qt6-base qt6-charts quazip-qt6 libva-vdpau-driver libva-utils libva-intel-driver
|
||||||
```
|
```
|
||||||
|
|
||||||
[Caveats](./Caveats.md#dragonflybsd).
|
[Caveats](./Caveats.md#dragonflybsd).
|
||||||
@@ -328,7 +327,7 @@ sudo pkgin install git cmake autoconf build-essential libusb-1 nasm gcc13
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
BASE="git make autoconf libtool automake-wrapper jq patch"
|
BASE="git make autoconf libtool automake-wrapper jq patch"
|
||||||
MINGW="qt6-base qt6-charts qt6-tools qt6-translations qt6-svg cmake toolchain clang python-pip openssl vulkan-memory-allocator vulkan-devel glslang boost fmt lz4 nlohmann-json zlib zstd enet opus libusb unordered_dense openssl SDL3"
|
MINGW="qt6-base qt6-charts qt6-tools qt6-translations qt6-svg cmake toolchain clang python-pip openssl vulkan-memory-allocator vulkan-devel glslang boost fmt lz4 nlohmann-json zlib zstd enet opus libusb openssl SDL3"
|
||||||
# Either x86_64 or clang-aarch64 (Windows on ARM)
|
# Either x86_64 or clang-aarch64 (Windows on ARM)
|
||||||
packages="$BASE"
|
packages="$BASE"
|
||||||
for pkg in $MINGW; do
|
for pkg in $MINGW; do
|
||||||
|
|||||||
@@ -308,32 +308,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
```
|
```
|
||||||
|
|
||||||
### unordered_dense
|
|
||||||
|
|
||||||
```
|
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2022 Martin Leitner-Ankerl
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
```
|
|
||||||
|
|
||||||
### xbyak
|
### xbyak
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
Vendored
-3
@@ -58,9 +58,6 @@ if (WIN32 AND NOT TARGET LLVM::Demangle)
|
|||||||
add_library(LLVM::Demangle ALIAS demangle)
|
add_library(LLVM::Demangle ALIAS demangle)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# unordered_dense
|
|
||||||
AddJsonPackage(unordered-dense)
|
|
||||||
|
|
||||||
# httplib
|
# httplib
|
||||||
if (IOS)
|
if (IOS)
|
||||||
set(HTTPLIB_USE_BROTLI_IF_AVAILABLE OFF)
|
set(HTTPLIB_USE_BROTLI_IF_AVAILABLE OFF)
|
||||||
|
|||||||
+1
@@ -11,6 +11,7 @@ import org.yuzu.yuzu_emu.utils.NativeConfig
|
|||||||
enum class StringSetting(override val key: String) : AbstractStringSetting {
|
enum class StringSetting(override val key: String) : AbstractStringSetting {
|
||||||
DRIVER_PATH("driver_path"),
|
DRIVER_PATH("driver_path"),
|
||||||
DEVICE_NAME("device_name"),
|
DEVICE_NAME("device_name"),
|
||||||
|
LOG_FILTER("log_filter"),
|
||||||
PROGRAM_ARGS("program_args"),
|
PROGRAM_ARGS("program_args"),
|
||||||
|
|
||||||
WEB_TOKEN("eden_token"),
|
WEB_TOKEN("eden_token"),
|
||||||
|
|||||||
+7
@@ -1033,6 +1033,13 @@ abstract class SettingsItem(
|
|||||||
descriptionId = R.string.use_auto_stub_description
|
descriptionId = R.string.use_auto_stub_description
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
put(
|
||||||
|
StringInputSetting(
|
||||||
|
StringSetting.LOG_FILTER,
|
||||||
|
titleId = R.string.log_filter,
|
||||||
|
descriptionId = R.string.log_filter_description
|
||||||
|
)
|
||||||
|
)
|
||||||
put(
|
put(
|
||||||
SpinBoxSetting(
|
SpinBoxSetting(
|
||||||
UShortSetting.DEBUG_KNOBS,
|
UShortSetting.DEBUG_KNOBS,
|
||||||
|
|||||||
+1
@@ -1323,6 +1323,7 @@ class SettingsFragmentPresenter(
|
|||||||
add(HeaderSetting(R.string.log))
|
add(HeaderSetting(R.string.log))
|
||||||
|
|
||||||
add(BooleanSetting.DEBUG_FLUSH_BY_LINE.key)
|
add(BooleanSetting.DEBUG_FLUSH_BY_LINE.key)
|
||||||
|
add(StringSetting.LOG_FILTER.key)
|
||||||
}
|
}
|
||||||
|
|
||||||
add(HeaderSetting(R.string.general))
|
add(HeaderSetting(R.string.general))
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ struct RomMetadata {
|
|||||||
std::vector<u8> icon;
|
std::vector<u8> icon;
|
||||||
bool isHomebrew;
|
bool isHomebrew;
|
||||||
};
|
};
|
||||||
static ankerl::unordered_dense::map<std::string, RomMetadata> m_rom_metadata_cache;
|
static ::Common::unordered_map<std::string, RomMetadata> m_rom_metadata_cache;
|
||||||
|
|
||||||
static RomMetadata CacheRomMetadata(const std::string& path) {
|
static RomMetadata CacheRomMetadata(const std::string& path) {
|
||||||
auto& instance = EmulationSession::GetInstance();
|
auto& instance = EmulationSession::GetInstance();
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#include "input_common/drivers/virtual_gamepad.h"
|
#include "input_common/drivers/virtual_gamepad.h"
|
||||||
#include "native.h"
|
#include "native.h"
|
||||||
|
|
||||||
ankerl::unordered_dense::map<std::string, std::unique_ptr<AndroidConfig>> map_profiles;
|
::Common::unordered_map<std::string, std::unique_ptr<AndroidConfig>> map_profiles;
|
||||||
|
|
||||||
bool IsHandheldOnly() {
|
bool IsHandheldOnly() {
|
||||||
const auto npad_style_set =
|
const auto npad_style_set =
|
||||||
|
|||||||
@@ -636,6 +636,8 @@
|
|||||||
<string name="log">Logging</string>
|
<string name="log">Logging</string>
|
||||||
<string name="flush_by_line">Flush debug logs by line</string>
|
<string name="flush_by_line">Flush debug logs by line</string>
|
||||||
<string name="flush_by_line_description">Flushes debugging logs on each line written, making debugging easier in cases of crashing or freezing.</string>
|
<string name="flush_by_line_description">Flushes debugging logs on each line written, making debugging easier in cases of crashing or freezing.</string>
|
||||||
|
<string name="log_filter">Log filter</string>
|
||||||
|
<string name="log_filter_description">Controls Eden\'s log categories. Example: *:Info Service.LM:Debug</string>
|
||||||
|
|
||||||
<!-- GPU Logging strings -->
|
<!-- GPU Logging strings -->
|
||||||
<string name="gpu_logging_header">GPU Logging</string>
|
<string name="gpu_logging_header">GPU Logging</string>
|
||||||
|
|||||||
@@ -147,7 +147,8 @@ add_library(
|
|||||||
cpu_features.cpp
|
cpu_features.cpp
|
||||||
cpu_features.h
|
cpu_features.h
|
||||||
httplib.h
|
httplib.h
|
||||||
net/net.h net/net.cpp)
|
net/net.h net/net.cpp
|
||||||
|
container/unordered_map.h container/unordered_set.h)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_sources(common PRIVATE windows/timer_resolution.cpp
|
target_sources(common PRIVATE windows/timer_resolution.cpp
|
||||||
@@ -241,7 +242,7 @@ if (lz4_ADDED)
|
|||||||
target_include_directories(common PRIVATE ${lz4_SOURCE_DIR}/lib)
|
target_include_directories(common PRIVATE ${lz4_SOURCE_DIR}/lib)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(common PUBLIC fmt::fmt stb::headers Threads::Threads unordered_dense::unordered_dense)
|
target_link_libraries(common PUBLIC fmt::fmt stb::headers Threads::Threads)
|
||||||
target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd)
|
target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd)
|
||||||
|
|
||||||
# Please refer to src/common/demangle.cpp
|
# Please refer to src/common/demangle.cpp
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "common/container_hash.h"
|
||||||
|
|
||||||
|
#include <boost/unordered/unordered_flat_map.hpp>
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
|
|
||||||
|
template <class Key, class T, class Hash = std::hash<Key>, class Pred = std::equal_to<Key>,
|
||||||
|
class Allocator = std::allocator<std::pair<const Key, T>>>
|
||||||
|
using unordered_map = boost::unordered::unordered_flat_map<Key, T, Hash, Pred, Allocator>;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "common/container_hash.h"
|
||||||
|
|
||||||
|
#include <boost/unordered/unordered_flat_set.hpp>
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
|
|
||||||
|
template <class Key, class Hash = std::hash<Key>, class Pred = std::equal_to<Key>,
|
||||||
|
class Allocator = std::allocator<Key>>
|
||||||
|
using unordered_set = boost::unordered::unordered_flat_set<Key, Hash, Pred, Allocator>;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -10,8 +10,11 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <functional>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
#include <tuple>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
@@ -69,10 +72,17 @@ struct HashCombineImpl<64> {
|
|||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
requires std::is_unsigned_v<T>
|
||||||
inline void HashCombine(std::size_t& seed, const T& v) {
|
inline void HashCombine(std::size_t& seed, const T& v) {
|
||||||
seed = detail::HashCombineImpl<sizeof(std::size_t) * CHAR_BIT>::fn(seed, detail::HashValue(v));
|
seed = detail::HashCombineImpl<sizeof(std::size_t) * CHAR_BIT>::fn(seed, detail::HashValue(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
requires (!std::is_unsigned_v<T>)
|
||||||
|
inline void HashCombine(std::size_t& seed, const T& v) {
|
||||||
|
seed = detail::HashCombineImpl<sizeof(std::size_t) * CHAR_BIT>::fn(seed, std::hash<T>{}(v));
|
||||||
|
}
|
||||||
|
|
||||||
template <typename It>
|
template <typename It>
|
||||||
inline std::size_t HashRange(It first, It last) {
|
inline std::size_t HashRange(It first, It last) {
|
||||||
std::size_t seed = 0;
|
std::size_t seed = 0;
|
||||||
@@ -95,3 +105,26 @@ std::size_t HashValue(const std::vector<T, Allocator>& v) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Common
|
} // namespace Common
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
|
||||||
|
template <typename... Args>
|
||||||
|
struct hash<std::tuple<Args...>> {
|
||||||
|
std::size_t operator()(const std::tuple<Args...>& t) const noexcept {
|
||||||
|
std::size_t seed = 0;
|
||||||
|
std::apply([&seed](const Args&... args) { (Common::HashCombine(seed, args), ...); }, t);
|
||||||
|
return seed;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class A, class B>
|
||||||
|
struct hash<std::pair<A, B>> {
|
||||||
|
std::size_t operator()(const std::pair<A, B>& p) const noexcept {
|
||||||
|
std::size_t seed = 0;
|
||||||
|
Common::HashCombine(seed, p.first);
|
||||||
|
Common::HashCombine(seed, p.second);
|
||||||
|
return seed;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace std
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/fs/fs.h"
|
#include "common/fs/fs.h"
|
||||||
@@ -196,8 +196,8 @@ private:
|
|||||||
SetLegacyPathImpl(legacy_path, new_path);
|
SetLegacyPathImpl(legacy_path, new_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
ankerl::unordered_dense::map<EdenPath, fs::path> eden_paths;
|
::Common::unordered_map<EdenPath, fs::path> eden_paths;
|
||||||
ankerl::unordered_dense::map<EmuPath, fs::path> legacy_paths;
|
::Common::unordered_map<EmuPath, fs::path> legacy_paths;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool ValidatePath(const fs::path& path) {
|
bool ValidatePath(const fs::path& path) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
#include <boost/icl/separate_interval_set.hpp>
|
#include <boost/icl/separate_interval_set.hpp>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "common/dynamic_library.h"
|
#include "common/dynamic_library.h"
|
||||||
@@ -391,7 +391,7 @@ private:
|
|||||||
|
|
||||||
std::mutex placeholder_mutex; ///< Mutex for placeholders
|
std::mutex placeholder_mutex; ///< Mutex for placeholders
|
||||||
boost::icl::separate_interval_set<size_t> placeholders; ///< Mapped placeholders
|
boost::icl::separate_interval_set<size_t> placeholders; ///< Mapped placeholders
|
||||||
ankerl::unordered_dense::map<size_t, size_t> placeholder_host_pointers; ///< Placeholder backing offset
|
::Common::unordered_map<size_t, size_t> placeholder_host_pointers; ///< Placeholder backing offset
|
||||||
};
|
};
|
||||||
|
|
||||||
#elif defined(__OPENORBIS__) || defined(__managarm__)
|
#elif defined(__OPENORBIS__) || defined(__managarm__)
|
||||||
|
|||||||
+2
-2
@@ -9,7 +9,7 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "common/logging.h"
|
#include "common/logging.h"
|
||||||
@@ -412,7 +412,7 @@ public:
|
|||||||
namespace Impl {
|
namespace Impl {
|
||||||
|
|
||||||
template <typename InputDeviceType>
|
template <typename InputDeviceType>
|
||||||
using FactoryListType = ankerl::unordered_dense::map<std::string, std::shared_ptr<Factory<InputDeviceType>>>;
|
using FactoryListType = ::Common::unordered_map<std::string, std::shared_ptr<Factory<InputDeviceType>>>;
|
||||||
|
|
||||||
template <typename InputDeviceType>
|
template <typename InputDeviceType>
|
||||||
struct FactoryList {
|
struct FactoryList {
|
||||||
|
|||||||
@@ -8,14 +8,14 @@
|
|||||||
|
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
/// A string-based key-value container supporting serializing to and deserializing from a string
|
/// A string-based key-value container supporting serializing to and deserializing from a string
|
||||||
class ParamPackage {
|
class ParamPackage {
|
||||||
public:
|
public:
|
||||||
using DataType = ankerl::unordered_dense::map<std::string, std::string>;
|
using DataType = ::Common::unordered_map<std::string, std::string>;
|
||||||
|
|
||||||
ParamPackage() = default;
|
ParamPackage() = default;
|
||||||
explicit ParamPackage(const std::string& serialized);
|
explicit ParamPackage(const std::string& serialized);
|
||||||
|
|||||||
@@ -22,10 +22,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// You must ensure this matches with src/common/x64/xbyak.h on root dir
|
// You must ensure this matches with src/common/x64/xbyak.h on root dir
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
#include "common/container/unordered_set.h"
|
||||||
#include <boost/unordered_map.hpp>
|
#include <boost/unordered_map.hpp>
|
||||||
#define XBYAK_STD_UNORDERED_SET ankerl::unordered_dense::set
|
#define XBYAK_STD_UNORDERED_SET ::Common::unordered_set
|
||||||
#define XBYAK_STD_UNORDERED_MAP ankerl::unordered_dense::map
|
#define XBYAK_STD_UNORDERED_MAP ::Common::unordered_map
|
||||||
#define XBYAK_STD_UNORDERED_MULTIMAP boost::unordered_multimap
|
#define XBYAK_STD_UNORDERED_MULTIMAP boost::unordered_multimap
|
||||||
#include <xbyak/xbyak.h>
|
#include <xbyak/xbyak.h>
|
||||||
#include <xbyak/xbyak_util.h>
|
#include <xbyak/xbyak_util.h>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
|
||||||
#include <dynarmic/interface/A64/a64.h>
|
#include <dynarmic/interface/A64/a64.h>
|
||||||
#include <dynarmic/interface/code_page.h>
|
#include <dynarmic/interface/code_page.h>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <span>
|
#include <span>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <oaknut/code_block.hpp>
|
#include <oaknut/code_block.hpp>
|
||||||
#include <oaknut/oaknut.hpp>
|
#include <oaknut/oaknut.hpp>
|
||||||
@@ -46,7 +46,7 @@ enum class PatchMode : u32 {
|
|||||||
|
|
||||||
using ModuleTextAddress = u64;
|
using ModuleTextAddress = u64;
|
||||||
using PatchTextAddress = u64;
|
using PatchTextAddress = u64;
|
||||||
using EntryTrampolines = ankerl::unordered_dense::map<ModuleTextAddress, PatchTextAddress>;
|
using EntryTrampolines = ::Common::unordered_map<ModuleTextAddress, PatchTextAddress>;
|
||||||
|
|
||||||
class Patcher {
|
class Patcher {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <span>
|
#include <span>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
|
||||||
#include "common/hex_util.h"
|
#include "common/hex_util.h"
|
||||||
#include "common/logging.h"
|
#include "common/logging.h"
|
||||||
@@ -104,7 +104,7 @@ struct IPSwitchRecord {
|
|||||||
size_t count;
|
size_t count;
|
||||||
};
|
};
|
||||||
struct IPSwitchCompiler::IPSwitchPatch {
|
struct IPSwitchCompiler::IPSwitchPatch {
|
||||||
ankerl::unordered_dense::map<u32, IPSwitchRecord> records;
|
::Common::unordered_map<u32, IPSwitchRecord> records;
|
||||||
bool enabled;
|
bool enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -123,11 +123,13 @@ static IPSwitchRecord EscapeStringSequences(std::string_view sv) {
|
|||||||
for (auto it = sv.cbegin(); it != sv.cend(); ) {
|
for (auto it = sv.cbegin(); it != sv.cend(); ) {
|
||||||
if (*it == '\\' && it + 1 < sv.cend()) {
|
if (*it == '\\' && it + 1 < sv.cend()) {
|
||||||
switch (it[1]) {
|
switch (it[1]) {
|
||||||
case 'n': r.data[r.count] = '\n'; break;
|
case 'a': r.data[r.count] = '\a'; break;
|
||||||
case 't': r.data[r.count] = '\t'; break;
|
|
||||||
case 'b': r.data[r.count] = '\b'; break;
|
case 'b': r.data[r.count] = '\b'; break;
|
||||||
case 'r': r.data[r.count] = '\r'; break;
|
|
||||||
case 'e': r.data[r.count] = '\e'; break;
|
case 'e': r.data[r.count] = '\e'; break;
|
||||||
|
case 'f': r.data[r.count] = '\f'; break;
|
||||||
|
case 'n': r.data[r.count] = '\n'; break;
|
||||||
|
case 'r': r.data[r.count] = '\r'; break;
|
||||||
|
case 't': r.data[r.count] = '\t'; break;
|
||||||
case 'v': r.data[r.count] = '\v'; break;
|
case 'v': r.data[r.count] = '\v'; break;
|
||||||
case '?': r.data[r.count] = '\?'; break;
|
case '?': r.data[r.count] = '\?'; break;
|
||||||
default: r.data[r.count] = it[1]; break;
|
default: r.data[r.count] = it[1]; break;
|
||||||
@@ -142,40 +144,60 @@ static IPSwitchRecord EscapeStringSequences(std::string_view sv) {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] static inline std::array<u8, 32> ReadNSOBuildId(std::string_view const s) {
|
|
||||||
std::array<u8, 32> r{};
|
|
||||||
for (std::size_t i = 0; i < s.size(); ++i)
|
|
||||||
r[i / 2] |= u8(u8(Common::ToHexNibble(s[i])) << u8((i % 2) * 4));
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IPSwitchCompiler::Parse(std::span<u8 const> bytes) {
|
void IPSwitchCompiler::Parse(std::span<u8 const> bytes) {
|
||||||
LOG_INFO(Loader, "IPSwitchCompiler: '{}'", patch_text->GetName());
|
LOG_INFO(Loader, "IPSwitchCompiler: '{}'", patch_text->GetName());
|
||||||
bool is_little_endian = false;
|
bool is_little_endian = true;
|
||||||
s64 offset_shift = 0;
|
s64 offset_shift = 0;
|
||||||
//bool print_values = false;
|
//bool print_values = false;
|
||||||
|
|
||||||
auto const parse_line = [&](std::string_view const line) {
|
auto const parse_line = [&](std::string_view const line) {
|
||||||
// Keep in mind lines have trimmed spaces (at the end & start)!
|
// Keep in mind lines have trimmed spaces (at the end & start)!
|
||||||
LOG_INFO(Loader, "<{}>", line);
|
LOG_INFO(Loader, "<{}>", line);
|
||||||
if (line.starts_with("@stop")) {
|
// IPSwitch is case insensitive
|
||||||
return false; // Force stop
|
// Yes this is how the logic goes for the main reference parsers!
|
||||||
} else if (line.starts_with("@nsobid-")) { // NSO Build ID Specifier
|
if (line.size() > 2 && line[0] == '@') {
|
||||||
nso_build_id = ReadNSOBuildId(line.substr(8));
|
switch (line[1]) {
|
||||||
} else if (line.starts_with("@enabled")) {
|
// yes, @nsobid too -- NSO Build ID Specifier
|
||||||
patches.push_back({{}, true}); //enabled patch
|
case 'n':
|
||||||
} else if (line.starts_with("@disabled")) {
|
case 'N':
|
||||||
patches.push_back({{}, false}); //disabled patch
|
nso_build_id = Common::HexStringToArray<0x20>(fmt::format("{:0<64}", line.substr(8)));
|
||||||
} else if (line.starts_with("@flag offset_shift ")) {
|
break;
|
||||||
offset_shift = std::strtoll(line.data() + 19, nullptr, 0); // Offset Shift Flag
|
// @stop
|
||||||
} else if (line.starts_with("@little-endian")) {
|
case 's':
|
||||||
is_little_endian = true; // Set values to read as little endian
|
case 'S':
|
||||||
} else if (line.starts_with("@big-endian")) {
|
return false;
|
||||||
is_little_endian = false; // Set values to read as big endian
|
// @enabled
|
||||||
} else if (line.starts_with("@flag print_values")) {
|
case 'e':
|
||||||
//print_values = true; // Force printing of applied values
|
case 'E':
|
||||||
} else if (line.starts_with("@")) {
|
patches.push_back({{}, true});
|
||||||
LOG_WARNING(Loader, "Unknown flag {}", line);
|
break;
|
||||||
|
// @disabled
|
||||||
|
case 'd':
|
||||||
|
case 'D':
|
||||||
|
patches.push_back({{}, false});
|
||||||
|
break;
|
||||||
|
// @flag
|
||||||
|
case 'f':
|
||||||
|
case 'F': {
|
||||||
|
if (line.starts_with("@flag offset_shift")) {
|
||||||
|
offset_shift = std::strtoll(line.data() + 19, nullptr, 0); // Offset Shift Flag
|
||||||
|
} else if (line.starts_with("@flag print_values")) {
|
||||||
|
//print_values = true; // Force printing of applied values
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'l':
|
||||||
|
case 'L':
|
||||||
|
is_little_endian = true;
|
||||||
|
break;
|
||||||
|
// IPS parsers dont support big endian no more, we do due to backcompat
|
||||||
|
case 'b':
|
||||||
|
case 'B':
|
||||||
|
is_little_endian = false;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
LOG_WARNING(Loader, "Unknown flag {}", line);
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
size_t offset = size_t(std::strtoul(line.data(), nullptr, 16));
|
size_t offset = size_t(std::strtoul(line.data(), nullptr, 16));
|
||||||
offset += size_t(offset_shift);
|
offset += size_t(offset_shift);
|
||||||
@@ -197,6 +219,7 @@ void IPSwitchCompiler::Parse(std::span<u8 const> bytes) {
|
|||||||
auto const start = line.cbegin() + first_space + 1;
|
auto const start = line.cbegin() + first_space + 1;
|
||||||
auto const end = line.cend();
|
auto const end = line.cend();
|
||||||
if (start <= line.cend() && end <= line.cend()) {
|
if (start <= line.cend() && end <= line.cend()) {
|
||||||
|
// Actually IPS wants ordering from {lsb, ..., msb} -- so LE and BE are inverted, fun!
|
||||||
auto const hs = Common::HexStringToVector({start, end}, is_little_endian);
|
auto const hs = Common::HexStringToVector({start, end}, is_little_endian);
|
||||||
std::memcpy(r.data.data(), hs.data(), hs.size());
|
std::memcpy(r.data.data(), hs.data(), hs.size());
|
||||||
r.count = hs.size();
|
r.count = hs.size();
|
||||||
@@ -231,7 +254,8 @@ void IPSwitchCompiler::Parse(std::span<u8 const> bytes) {
|
|||||||
char quote = '\0';
|
char quote = '\0';
|
||||||
auto const sline_start = p;
|
auto const sline_start = p;
|
||||||
for (; p < sline.cend(); ) {
|
for (; p < sline.cend(); ) {
|
||||||
if ((!quote && p + 1 < sline.cend() && p[0] == '/' && p[1] == '/')
|
// we dont check for "//", IPS checks for '/' only...
|
||||||
|
if ((!quote && p[0] == '/')
|
||||||
|| (!quote && p[0] == '#')) {
|
|| (!quote && p[0] == '#')) {
|
||||||
break;
|
break;
|
||||||
} else if (p[0] == '\"' || p[0] == '\'') {
|
} else if (p[0] == '\"' || p[0] == '\'') {
|
||||||
@@ -266,6 +290,8 @@ VirtualFile IPSwitchCompiler::Apply(const VirtualFile& in) const {
|
|||||||
if (record.first + replace_size > in_data.size())
|
if (record.first + replace_size > in_data.size())
|
||||||
replace_size = in_data.size() - record.first;
|
replace_size = in_data.size() - record.first;
|
||||||
std::memcpy(in_data.data() + record.first, record.second.data.data(), replace_size);
|
std::memcpy(in_data.data() + record.first, record.second.data.data(), replace_size);
|
||||||
|
} else {
|
||||||
|
LOG_WARNING(Loader, "record offs={:x},size={:x}", record.first, record.second.data.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -566,7 +566,7 @@ VirtualFile RegisteredCache::GetFileAtID(NcaID id) const {
|
|||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::optional<NcaID> CheckMapForContentRecord(const ankerl::unordered_dense::map<u64, CNMT>& map, u64 title_id, ContentRecordType type) {
|
static std::optional<NcaID> CheckMapForContentRecord(const ::Common::unordered_map<u64, CNMT>& map, u64 title_id, ContentRecordType type) {
|
||||||
auto cmnt_iter = map.find(title_id);
|
auto cmnt_iter = map.find(title_id);
|
||||||
u8 id_offset = 0;
|
u8 id_offset = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
#include <boost/container/flat_map.hpp>
|
#include <boost/container/flat_map.hpp>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/crypto/key_manager.h"
|
#include "core/crypto/key_manager.h"
|
||||||
@@ -209,11 +209,11 @@ private:
|
|||||||
ContentProviderParsingFunction parser;
|
ContentProviderParsingFunction parser;
|
||||||
|
|
||||||
// maps tid -> NcaID of meta
|
// maps tid -> NcaID of meta
|
||||||
ankerl::unordered_dense::map<u64, NcaID> meta_id;
|
::Common::unordered_map<u64, NcaID> meta_id;
|
||||||
// maps tid -> meta
|
// maps tid -> meta
|
||||||
ankerl::unordered_dense::map<u64, CNMT> meta;
|
::Common::unordered_map<u64, CNMT> meta;
|
||||||
// maps tid -> meta for CNMT in yuzu_meta
|
// maps tid -> meta for CNMT in yuzu_meta
|
||||||
ankerl::unordered_dense::map<u64, CNMT> yuzu_meta;
|
::Common::unordered_map<u64, CNMT> yuzu_meta;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class ContentProviderUnionSlot {
|
enum class ContentProviderUnionSlot {
|
||||||
@@ -313,8 +313,8 @@ private:
|
|||||||
void ProcessXCI(const VirtualFile& file);
|
void ProcessXCI(const VirtualFile& file);
|
||||||
|
|
||||||
std::vector<VirtualDir> load_dirs;
|
std::vector<VirtualDir> load_dirs;
|
||||||
ankerl::unordered_dense::map<std::tuple<u64, ContentRecordType, TitleType>, VirtualFile> entries;
|
::Common::unordered_map<std::tuple<u64, ContentRecordType, TitleType>, VirtualFile> entries;
|
||||||
ankerl::unordered_dense::map<u64, u32> versions;
|
::Common::unordered_map<u64, u32> versions;
|
||||||
std::vector<ExternalUpdateEntry> multi_version_entries;
|
std::vector<ExternalUpdateEntry> multi_version_entries;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_set.h"
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include "core/file_sys/vfs/vfs_layered.h"
|
#include "core/file_sys/vfs/vfs_layered.h"
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ std::string LayeredVfsDirectory::GetFullPath() const {
|
|||||||
|
|
||||||
std::vector<VirtualFile> LayeredVfsDirectory::GetFiles() const {
|
std::vector<VirtualFile> LayeredVfsDirectory::GetFiles() const {
|
||||||
std::vector<VirtualFile> out;
|
std::vector<VirtualFile> out;
|
||||||
ankerl::unordered_dense::set<std::string> out_names;
|
::Common::unordered_set<std::string> out_names;
|
||||||
|
|
||||||
for (const auto& layer : dirs) {
|
for (const auto& layer : dirs) {
|
||||||
for (auto& file : layer->GetFiles()) {
|
for (auto& file : layer->GetFiles()) {
|
||||||
@@ -79,7 +79,7 @@ std::vector<VirtualFile> LayeredVfsDirectory::GetFiles() const {
|
|||||||
|
|
||||||
std::vector<VirtualDir> LayeredVfsDirectory::GetSubdirectories() const {
|
std::vector<VirtualDir> LayeredVfsDirectory::GetSubdirectories() const {
|
||||||
std::vector<VirtualDir> out;
|
std::vector<VirtualDir> out;
|
||||||
ankerl::unordered_dense::set<std::string> out_names;
|
::Common::unordered_set<std::string> out_names;
|
||||||
|
|
||||||
for (const auto& layer : dirs) {
|
for (const auto& layer : dirs) {
|
||||||
for (const auto& sd : layer->GetSubdirectories()) {
|
for (const auto& sd : layer->GetSubdirectories()) {
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ private:
|
|||||||
std::array<DebugWatchpoint, Core::Hardware::NUM_WATCHPOINTS> m_watchpoints{};
|
std::array<DebugWatchpoint, Core::Hardware::NUM_WATCHPOINTS> m_watchpoints{};
|
||||||
std::map<KProcessAddress, u64> m_debug_page_refcounts{};
|
std::map<KProcessAddress, u64> m_debug_page_refcounts{};
|
||||||
#ifdef HAS_NCE
|
#ifdef HAS_NCE
|
||||||
ankerl::unordered_dense::map<u64, u64> m_post_handlers{};
|
::Common::unordered_map<u64, u64> m_post_handlers{};
|
||||||
#endif
|
#endif
|
||||||
std::unique_ptr<Core::ExclusiveMonitor> m_exclusive_monitor;
|
std::unique_ptr<Core::ExclusiveMonitor> m_exclusive_monitor;
|
||||||
Core::Memory::Memory m_memory;
|
Core::Memory::Memory m_memory;
|
||||||
@@ -494,7 +494,7 @@ public:
|
|||||||
static void Switch(KernelCore& kernel, KProcess* cur_process, KProcess* next_process);
|
static void Switch(KernelCore& kernel, KProcess* cur_process, KProcess* next_process);
|
||||||
|
|
||||||
#ifdef HAS_NCE
|
#ifdef HAS_NCE
|
||||||
ankerl::unordered_dense::map<u64, u64>& GetPostHandlers() noexcept {
|
::Common::unordered_map<u64, u64>& GetPostHandlers() noexcept {
|
||||||
return m_post_handlers;
|
return m_post_handlers;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -10,7 +10,8 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
#include "common/container/unordered_set.h"
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
@@ -792,8 +793,8 @@ struct KernelCore::Impl {
|
|||||||
|
|
||||||
std::optional<KObjectNameGlobalData> object_name_global_data;
|
std::optional<KObjectNameGlobalData> object_name_global_data;
|
||||||
|
|
||||||
ankerl::unordered_dense::set<KAutoObject*> registered_objects;
|
::Common::unordered_set<KAutoObject*> registered_objects;
|
||||||
ankerl::unordered_dense::set<KAutoObject*> registered_in_use_objects;
|
::Common::unordered_set<KAutoObject*> registered_in_use_objects;
|
||||||
|
|
||||||
std::mutex server_lock;
|
std::mutex server_lock;
|
||||||
std::vector<std::unique_ptr<Service::ServerManager>> server_managers;
|
std::vector<std::unique_ptr<Service::ServerManager>> server_managers;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "common/polyfill_thread.h"
|
#include "common/polyfill_thread.h"
|
||||||
|
|||||||
@@ -129,9 +129,9 @@ Result DisplayLayerManager::IsSystemBufferSharingEnabled() {
|
|||||||
(void)m_display_service->GetContainer()->SetLayerStackMask(m_system_shared_layer_id,
|
(void)m_display_service->GetContainer()->SetLayerStackMask(m_system_shared_layer_id,
|
||||||
this->GetLayerStackMask());
|
this->GetLayerStackMask());
|
||||||
m_manager_display_service->SetLayerBlending(m_blending_enabled, m_system_shared_layer_id);
|
m_manager_display_service->SetLayerBlending(m_blending_enabled, m_system_shared_layer_id);
|
||||||
s32 initial_z = Foreground;
|
s32 initial_z = 1;
|
||||||
if (m_applet_id == AppletId::OverlayDisplay) {
|
if (m_applet_id == AppletId::OverlayDisplay) {
|
||||||
initial_z = Overlay;
|
initial_z = -1;
|
||||||
(void)m_display_service->GetContainer()->SetLayerIsOverlay(m_system_shared_layer_id, true);
|
(void)m_display_service->GetContainer()->SetLayerIsOverlay(m_system_shared_layer_id, true);
|
||||||
}
|
}
|
||||||
m_manager_display_service->SetLayerZIndex(initial_z, m_system_shared_layer_id);
|
m_manager_display_service->SetLayerZIndex(initial_z, m_system_shared_layer_id);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "common/common_funcs.h"
|
#include "common/common_funcs.h"
|
||||||
@@ -176,6 +176,6 @@ struct WebCommonReturnValue {
|
|||||||
};
|
};
|
||||||
static_assert(sizeof(WebCommonReturnValue) == 0x1010, "WebCommonReturnValue has incorrect size.");
|
static_assert(sizeof(WebCommonReturnValue) == 0x1010, "WebCommonReturnValue has incorrect size.");
|
||||||
|
|
||||||
using WebArgInputTLVMap = ankerl::unordered_dense::map<WebArgInputTLVType, std::vector<u8>>;
|
using WebArgInputTLVMap = ::Common::unordered_map<WebArgInputTLVType, std::vector<u8>>;
|
||||||
|
|
||||||
} // namespace Service::AM::Frontend
|
} // namespace Service::AM::Frontend
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ std::vector<u8> default_logo_small;
|
|||||||
std::vector<u8> default_logo_large;
|
std::vector<u8> default_logo_large;
|
||||||
bool default_logos_loaded = false;
|
bool default_logos_loaded = false;
|
||||||
|
|
||||||
ankerl::unordered_dense::map<std::string, std::vector<u8>> news_images_small;
|
::Common::unordered_map<std::string, std::vector<u8>> news_images_small;
|
||||||
ankerl::unordered_dense::map<std::string, std::vector<u8>> news_images_large;
|
::Common::unordered_map<std::string, std::vector<u8>> news_images_large;
|
||||||
std::mutex images_mutex;
|
std::mutex images_mutex;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#include <optional>
|
#include <optional>
|
||||||
#include <span>
|
#include <span>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
@@ -93,7 +93,7 @@ private:
|
|||||||
static s64 Now();
|
static s64 Now();
|
||||||
|
|
||||||
mutable std::mutex mtx;
|
mutable std::mutex mtx;
|
||||||
ankerl::unordered_dense::map<std::string, StoredNews> items;
|
::Common::unordered_map<std::string, StoredNews> items;
|
||||||
size_t open_counter{};
|
size_t open_counter{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
|
||||||
#include "common/fs/fs.h"
|
#include "common/fs/fs.h"
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
@@ -88,7 +88,7 @@ private:
|
|||||||
AlbumFileDateTime ConvertToAlbumDateTime(u64 posix_time) const;
|
AlbumFileDateTime ConvertToAlbumDateTime(u64 posix_time) const;
|
||||||
|
|
||||||
bool is_mounted{};
|
bool is_mounted{};
|
||||||
ankerl::unordered_dense::map<AlbumFileId, std::filesystem::path> album_files;
|
::Common::unordered_map<AlbumFileId, std::filesystem::path> album_files;
|
||||||
|
|
||||||
Core::System& system;
|
Core::System& system;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include <random>
|
#include <random>
|
||||||
#include <span>
|
#include <span>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
|
||||||
#include "common/logging.h"
|
#include "common/logging.h"
|
||||||
#include "common/socket_types.h"
|
#include "common/socket_types.h"
|
||||||
@@ -119,7 +119,7 @@ protected:
|
|||||||
std::array<LanStation, StationCountMax> stations;
|
std::array<LanStation, StationCountMax> stations;
|
||||||
std::array<NodeLatestUpdate, NodeCountMax> node_changes{};
|
std::array<NodeLatestUpdate, NodeCountMax> node_changes{};
|
||||||
std::array<u8, NodeCountMax> node_last_states{};
|
std::array<u8, NodeCountMax> node_last_states{};
|
||||||
ankerl::unordered_dense::map<MacAddress, NetworkInfo, MACAddressHash> scan_results{};
|
::Common::unordered_map<MacAddress, NetworkInfo, MACAddressHash> scan_results{};
|
||||||
NodeInfo node_info{};
|
NodeInfo node_info{};
|
||||||
NetworkInfo network_info{};
|
NetworkInfo network_info{};
|
||||||
State state{State::None};
|
State state{State::None};
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
#include <boost/container_hash/hash.hpp>
|
#include <boost/container_hash/hash.hpp>
|
||||||
#include "common/logging.h"
|
#include "common/logging.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
@@ -331,7 +331,7 @@ private:
|
|||||||
};
|
};
|
||||||
static_assert(sizeof(LogPacketHeader) == 0x18, "LogPacketHeader is an invalid size");
|
static_assert(sizeof(LogPacketHeader) == 0x18, "LogPacketHeader is an invalid size");
|
||||||
|
|
||||||
ankerl::unordered_dense::map<LogPacketHeaderEntry, std::vector<u8>> entries{};
|
::Common::unordered_map<LogPacketHeaderEntry, std::vector<u8>> entries{};
|
||||||
LogDestination destination{LogDestination::All};
|
LogDestination destination{LogDestination::All};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
#include <common/settings.h>
|
#include <common/settings.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
|
||||||
#include "core/device_memory_manager.h"
|
#include "core/device_memory_manager.h"
|
||||||
#include "core/hle/service/nvdrv/nvdata.h"
|
#include "core/hle/service/nvdrv/nvdata.h"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "common/bit_field.h"
|
#include "common/bit_field.h"
|
||||||
@@ -161,7 +161,7 @@ private:
|
|||||||
std::list<std::shared_ptr<Handle>> unmap_queue{};
|
std::list<std::shared_ptr<Handle>> unmap_queue{};
|
||||||
std::mutex unmap_queue_lock{}; //!< Protects access to `unmap_queue`
|
std::mutex unmap_queue_lock{}; //!< Protects access to `unmap_queue`
|
||||||
|
|
||||||
ankerl::unordered_dense::map<Handle::Id, std::shared_ptr<Handle>>
|
::Common::unordered_map<Handle::Id, std::shared_ptr<Handle>>
|
||||||
handles{}; //!< Main owning map of handles
|
handles{}; //!< Main owning map of handles
|
||||||
std::mutex handles_lock; //!< Protects access to `handles`
|
std::mutex handles_lock; //!< Protects access to `handles`
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_set.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "common/address_space.h"
|
#include "common/address_space.h"
|
||||||
@@ -113,7 +113,7 @@ private:
|
|||||||
};
|
};
|
||||||
static_assert(sizeof(IoctlRemapEntry) == 20, "IoctlRemapEntry is incorrect size");
|
static_assert(sizeof(IoctlRemapEntry) == 20, "IoctlRemapEntry is incorrect size");
|
||||||
|
|
||||||
ankerl::unordered_dense::set<s64_le> map_buffer_offsets{};
|
::Common::unordered_set<s64_le> map_buffer_offsets{};
|
||||||
|
|
||||||
struct IoctlMapBufferEx {
|
struct IoctlMapBufferEx {
|
||||||
MappingFlags flags{}; // bit0: fixed_offset, bit2: cacheable
|
MappingFlags flags{}; // bit0: fixed_offset, bit2: cacheable
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ private:
|
|||||||
NvCore::SyncpointManager& syncpoint_manager;
|
NvCore::SyncpointManager& syncpoint_manager;
|
||||||
NvCore::NvMap& nvmap;
|
NvCore::NvMap& nvmap;
|
||||||
std::shared_ptr<Tegra::Control::ChannelState> channel_state;
|
std::shared_ptr<Tegra::Control::ChannelState> channel_state;
|
||||||
ankerl::unordered_dense::map<DeviceFD, NvCore::SessionId> sessions;
|
::Common::unordered_map<DeviceFD, NvCore::SessionId> sessions;
|
||||||
u32 channel_syncpoint;
|
u32 channel_syncpoint;
|
||||||
std::mutex channel_mutex;
|
std::mutex channel_mutex;
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
@@ -138,7 +138,7 @@ protected:
|
|||||||
NvCore::NvMap& nvmap;
|
NvCore::NvMap& nvmap;
|
||||||
NvCore::ChannelType channel_type;
|
NvCore::ChannelType channel_type;
|
||||||
std::array<u32, MaxSyncPoints> device_syncpoints{};
|
std::array<u32, MaxSyncPoints> device_syncpoints{};
|
||||||
ankerl::unordered_dense::map<DeviceFD, NvCore::SessionId> sessions;
|
::Common::unordered_map<DeviceFD, NvCore::SessionId> sessions;
|
||||||
};
|
};
|
||||||
}; // namespace Devices
|
}; // namespace Devices
|
||||||
} // namespace Service::Nvidia
|
} // namespace Service::Nvidia
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "common/common_funcs.h"
|
#include "common/common_funcs.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
@@ -118,7 +118,7 @@ private:
|
|||||||
|
|
||||||
NvCore::Container& container;
|
NvCore::Container& container;
|
||||||
NvCore::NvMap& file;
|
NvCore::NvMap& file;
|
||||||
ankerl::unordered_dense::map<DeviceFD, NvCore::SessionId> sessions;
|
::Common::unordered_map<DeviceFD, NvCore::SessionId> sessions;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::Nvidia::Devices
|
} // namespace Service::Nvidia::Devices
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <span>
|
#include <span>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/hle/service/kernel_helpers.h"
|
#include "core/hle/service/kernel_helpers.h"
|
||||||
@@ -103,7 +103,7 @@ private:
|
|||||||
/// Id to use for the next open file descriptor.
|
/// Id to use for the next open file descriptor.
|
||||||
DeviceFD next_fd = 1;
|
DeviceFD next_fd = 1;
|
||||||
|
|
||||||
using FilesContainerType = ankerl::unordered_dense::map<DeviceFD, std::shared_ptr<Devices::nvdevice>>;
|
using FilesContainerType = ::Common::unordered_map<DeviceFD, std::shared_ptr<Devices::nvdevice>>;
|
||||||
/// Mapping of file descriptors to the devices they reference.
|
/// Mapping of file descriptors to the devices they reference.
|
||||||
FilesContainerType open_files;
|
FilesContainerType open_files;
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ private:
|
|||||||
|
|
||||||
EventInterface events_interface;
|
EventInterface events_interface;
|
||||||
|
|
||||||
ankerl::unordered_dense::map<std::string, std::function<FilesContainerType::iterator(DeviceFD)>> builders;
|
::Common::unordered_map<std::string, std::function<FilesContainerType::iterator(DeviceFD)>> builders;
|
||||||
};
|
};
|
||||||
|
|
||||||
void LoopProcess(Core::System& system);
|
void LoopProcess(Core::System& system);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/hle/service/nvnflinger/binder.h"
|
#include "core/hle/service/nvnflinger/binder.h"
|
||||||
@@ -39,8 +39,8 @@ private:
|
|||||||
|
|
||||||
mutable std::mutex lock;
|
mutable std::mutex lock;
|
||||||
s32 last_id = 0;
|
s32 last_id = 0;
|
||||||
ankerl::unordered_dense::map<s32, std::shared_ptr<android::IBinder>> binders;
|
::Common::unordered_map<s32, std::shared_ptr<android::IBinder>> binders;
|
||||||
ankerl::unordered_dense::map<s32, RefCounts> refcounts;
|
::Common::unordered_map<s32, RefCounts> refcounts;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::Nvnflinger
|
} // namespace Service::Nvnflinger
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
|
||||||
#include "common/uuid.h"
|
#include "common/uuid.h"
|
||||||
#include "core/hle/service/cmif_types.h"
|
#include "core/hle/service/cmif_types.h"
|
||||||
@@ -56,10 +56,10 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ankerl::unordered_dense::map<AppKey, bool, AppKeyHash> app_auto_transfer_{};
|
::Common::unordered_map<AppKey, bool, AppKeyHash> app_auto_transfer_{};
|
||||||
ankerl::unordered_dense::map<Common::UUID, bool> global_auto_upload_{};
|
::Common::unordered_map<Common::UUID, bool> global_auto_upload_{};
|
||||||
ankerl::unordered_dense::map<Common::UUID, bool> global_auto_download_{};
|
::Common::unordered_map<Common::UUID, bool> global_auto_download_{};
|
||||||
ankerl::unordered_dense::map<AppKey, u8, AppKeyHash> autonomy_task_status_{};
|
::Common::unordered_map<AppKey, u8, AppKeyHash> autonomy_task_status_{};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::OLSC
|
} // namespace Service::OLSC
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/hle/service/hle_ipc.h"
|
#include "core/hle/service/hle_ipc.h"
|
||||||
|
|
||||||
@@ -99,8 +99,8 @@ private:
|
|||||||
void ReportUnimplementedFunction(HLERequestContext& ctx, const FunctionInfoBase* info);
|
void ReportUnimplementedFunction(HLERequestContext& ctx, const FunctionInfoBase* info);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ankerl::unordered_dense::map<u32, FunctionInfoBase> handlers;
|
::Common::unordered_map<u32, FunctionInfoBase> handlers;
|
||||||
ankerl::unordered_dense::map<u32, FunctionInfoBase> handlers_tipc;
|
::Common::unordered_map<u32, FunctionInfoBase> handlers_tipc;
|
||||||
/// Used to gain exclusive access to the service members, e.g. from CoreTiming thread.
|
/// Used to gain exclusive access to the service members, e.g. from CoreTiming thread.
|
||||||
std::mutex lock_service;
|
std::mutex lock_service;
|
||||||
/// System context that the service operates under.
|
/// System context that the service operates under.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
#include <concepts>
|
#include <concepts>
|
||||||
|
|
||||||
#include "core/hle/kernel/k_port.h"
|
#include "core/hle/kernel/k_port.h"
|
||||||
@@ -100,8 +100,8 @@ private:
|
|||||||
|
|
||||||
/// Map of registered services, retrieved using GetServicePort.
|
/// Map of registered services, retrieved using GetServicePort.
|
||||||
mutable std::mutex lock;
|
mutable std::mutex lock;
|
||||||
ankerl::unordered_dense::map<std::string, SessionRequestHandlerFactory> registered_services;
|
::Common::unordered_map<std::string, SessionRequestHandlerFactory> registered_services;
|
||||||
ankerl::unordered_dense::map<std::string, Kernel::KClientPort*> service_ports;
|
::Common::unordered_map<std::string, Kernel::KClientPort*> service_ports;
|
||||||
|
|
||||||
/// Kernel context
|
/// Kernel context
|
||||||
Kernel::KernelCore& kernel;
|
Kernel::KernelCore& kernel;
|
||||||
|
|||||||
@@ -54,11 +54,11 @@ void PutValue(std::span<u8> buffer, const T& t) {
|
|||||||
|
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
void BSD::PollWork::Execute(BSD* bsd) {
|
void BSD_USA::PollWork::Execute(BSD_USA* bsd) {
|
||||||
std::tie(ret, bsd_errno) = bsd->PollImpl(write_buffer, read_buffer, nfds, timeout);
|
std::tie(ret, bsd_errno) = bsd->PollImpl(write_buffer, read_buffer, nfds, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::PollWork::Response(HLERequestContext& ctx) {
|
void BSD_USA::PollWork::Response(HLERequestContext& ctx) {
|
||||||
if (write_buffer.size() > 0) {
|
if (write_buffer.size() > 0) {
|
||||||
ctx.WriteBuffer(write_buffer);
|
ctx.WriteBuffer(write_buffer);
|
||||||
}
|
}
|
||||||
@@ -69,11 +69,11 @@ void BSD::PollWork::Response(HLERequestContext& ctx) {
|
|||||||
rb.PushEnum(bsd_errno);
|
rb.PushEnum(bsd_errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::AcceptWork::Execute(BSD* bsd) {
|
void BSD_USA::AcceptWork::Execute(BSD_USA* bsd) {
|
||||||
std::tie(ret, bsd_errno) = bsd->AcceptImpl(fd, write_buffer);
|
std::tie(ret, bsd_errno) = bsd->AcceptImpl(fd, write_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::AcceptWork::Response(HLERequestContext& ctx) {
|
void BSD_USA::AcceptWork::Response(HLERequestContext& ctx) {
|
||||||
if (write_buffer.size() > 0) {
|
if (write_buffer.size() > 0) {
|
||||||
ctx.WriteBuffer(write_buffer);
|
ctx.WriteBuffer(write_buffer);
|
||||||
}
|
}
|
||||||
@@ -85,22 +85,22 @@ void BSD::AcceptWork::Response(HLERequestContext& ctx) {
|
|||||||
rb.Push<u32>(static_cast<u32>(write_buffer.size()));
|
rb.Push<u32>(static_cast<u32>(write_buffer.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::ConnectWork::Execute(BSD* bsd) {
|
void BSD_USA::ConnectWork::Execute(BSD_USA* bsd) {
|
||||||
bsd_errno = bsd->ConnectImpl(fd, addr);
|
bsd_errno = bsd->ConnectImpl(fd, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::ConnectWork::Response(HLERequestContext& ctx) {
|
void BSD_USA::ConnectWork::Response(HLERequestContext& ctx) {
|
||||||
IPC::ResponseBuilder rb{ctx, 4};
|
IPC::ResponseBuilder rb{ctx, 4};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.Push<s32>(bsd_errno == Errno::SUCCESS ? 0 : -1);
|
rb.Push<s32>(bsd_errno == Errno::SUCCESS ? 0 : -1);
|
||||||
rb.PushEnum(bsd_errno);
|
rb.PushEnum(bsd_errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::RecvWork::Execute(BSD* bsd) {
|
void BSD_USA::RecvWork::Execute(BSD_USA* bsd) {
|
||||||
std::tie(ret, bsd_errno) = bsd->RecvImpl(fd, flags, message);
|
std::tie(ret, bsd_errno) = bsd->RecvImpl(fd, flags, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::RecvWork::Response(HLERequestContext& ctx) {
|
void BSD_USA::RecvWork::Response(HLERequestContext& ctx) {
|
||||||
ctx.WriteBuffer(message);
|
ctx.WriteBuffer(message);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 4};
|
IPC::ResponseBuilder rb{ctx, 4};
|
||||||
@@ -109,11 +109,11 @@ void BSD::RecvWork::Response(HLERequestContext& ctx) {
|
|||||||
rb.PushEnum(bsd_errno);
|
rb.PushEnum(bsd_errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::RecvFromWork::Execute(BSD* bsd) {
|
void BSD_USA::RecvFromWork::Execute(BSD_USA* bsd) {
|
||||||
std::tie(ret, bsd_errno) = bsd->RecvFromImpl(fd, flags, message, addr);
|
std::tie(ret, bsd_errno) = bsd->RecvFromImpl(fd, flags, message, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::RecvFromWork::Response(HLERequestContext& ctx) {
|
void BSD_USA::RecvFromWork::Response(HLERequestContext& ctx) {
|
||||||
ctx.WriteBuffer(message, 0);
|
ctx.WriteBuffer(message, 0);
|
||||||
if (!addr.empty()) {
|
if (!addr.empty()) {
|
||||||
ctx.WriteBuffer(addr, 1);
|
ctx.WriteBuffer(addr, 1);
|
||||||
@@ -126,29 +126,29 @@ void BSD::RecvFromWork::Response(HLERequestContext& ctx) {
|
|||||||
rb.Push<u32>(static_cast<u32>(addr.size()));
|
rb.Push<u32>(static_cast<u32>(addr.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::SendWork::Execute(BSD* bsd) {
|
void BSD_USA::SendWork::Execute(BSD_USA* bsd) {
|
||||||
std::tie(ret, bsd_errno) = bsd->SendImpl(fd, flags, message);
|
std::tie(ret, bsd_errno) = bsd->SendImpl(fd, flags, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::SendWork::Response(HLERequestContext& ctx) {
|
void BSD_USA::SendWork::Response(HLERequestContext& ctx) {
|
||||||
IPC::ResponseBuilder rb{ctx, 4};
|
IPC::ResponseBuilder rb{ctx, 4};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.Push<s32>(ret);
|
rb.Push<s32>(ret);
|
||||||
rb.PushEnum(bsd_errno);
|
rb.PushEnum(bsd_errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::SendToWork::Execute(BSD* bsd) {
|
void BSD_USA::SendToWork::Execute(BSD_USA* bsd) {
|
||||||
std::tie(ret, bsd_errno) = bsd->SendToImpl(fd, flags, message, addr);
|
std::tie(ret, bsd_errno) = bsd->SendToImpl(fd, flags, message, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::SendToWork::Response(HLERequestContext& ctx) {
|
void BSD_USA::SendToWork::Response(HLERequestContext& ctx) {
|
||||||
IPC::ResponseBuilder rb{ctx, 4};
|
IPC::ResponseBuilder rb{ctx, 4};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.Push<s32>(ret);
|
rb.Push<s32>(ret);
|
||||||
rb.PushEnum(bsd_errno);
|
rb.PushEnum(bsd_errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::RegisterClient(HLERequestContext& ctx) {
|
void BSD_USA::RegisterClient(HLERequestContext& ctx) {
|
||||||
LOG_WARNING(Service, "(STUBBED) called");
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
@@ -157,7 +157,7 @@ void BSD::RegisterClient(HLERequestContext& ctx) {
|
|||||||
rb.Push<s32>(0); // bsd errno
|
rb.Push<s32>(0); // bsd errno
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::StartMonitoring(HLERequestContext& ctx) {
|
void BSD_USA::StartMonitoring(HLERequestContext& ctx) {
|
||||||
LOG_WARNING(Service, "(STUBBED) called");
|
LOG_WARNING(Service, "(STUBBED) called");
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
@@ -165,7 +165,7 @@ void BSD::StartMonitoring(HLERequestContext& ctx) {
|
|||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::Socket(HLERequestContext& ctx) {
|
void BSD_USA::Socket(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const u32 domain = rp.Pop<u32>();
|
const u32 domain = rp.Pop<u32>();
|
||||||
const u32 type = rp.Pop<u32>();
|
const u32 type = rp.Pop<u32>();
|
||||||
@@ -181,7 +181,7 @@ void BSD::Socket(HLERequestContext& ctx) {
|
|||||||
rb.PushEnum(bsd_errno);
|
rb.PushEnum(bsd_errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::SocketExempt(HLERequestContext& ctx) {
|
void BSD_USA::SocketExempt(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const u32 domain = rp.Pop<u32>();
|
const u32 domain = rp.Pop<u32>();
|
||||||
const u32 type = rp.Pop<u32>();
|
const u32 type = rp.Pop<u32>();
|
||||||
@@ -200,7 +200,7 @@ void BSD::SocketExempt(HLERequestContext& ctx) {
|
|||||||
rb.PushEnum(bsd_errno);
|
rb.PushEnum(bsd_errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::Select(HLERequestContext& ctx) {
|
void BSD_USA::Select(HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service, "(STUBBED) called");
|
LOG_DEBUG(Service, "(STUBBED) called");
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 4};
|
IPC::ResponseBuilder rb{ctx, 4};
|
||||||
@@ -210,7 +210,7 @@ void BSD::Select(HLERequestContext& ctx) {
|
|||||||
rb.Push<u32>(0); // bsd errno
|
rb.Push<u32>(0); // bsd errno
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::Poll(HLERequestContext& ctx) {
|
void BSD_USA::Poll(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const s32 nfds = rp.Pop<s32>();
|
const s32 nfds = rp.Pop<s32>();
|
||||||
const s32 timeout = rp.Pop<s32>();
|
const s32 timeout = rp.Pop<s32>();
|
||||||
@@ -225,7 +225,7 @@ void BSD::Poll(HLERequestContext& ctx) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::Accept(HLERequestContext& ctx) {
|
void BSD_USA::Accept(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const s32 fd = rp.Pop<s32>();
|
const s32 fd = rp.Pop<s32>();
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ void BSD::Accept(HLERequestContext& ctx) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::Bind(HLERequestContext& ctx) {
|
void BSD_USA::Bind(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const s32 fd = rp.Pop<s32>();
|
const s32 fd = rp.Pop<s32>();
|
||||||
|
|
||||||
@@ -245,7 +245,7 @@ void BSD::Bind(HLERequestContext& ctx) {
|
|||||||
BuildErrnoResponse(ctx, BindImpl(fd, ctx.ReadBuffer()));
|
BuildErrnoResponse(ctx, BindImpl(fd, ctx.ReadBuffer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::Connect(HLERequestContext& ctx) {
|
void BSD_USA::Connect(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const s32 fd = rp.Pop<s32>();
|
const s32 fd = rp.Pop<s32>();
|
||||||
|
|
||||||
@@ -257,7 +257,7 @@ void BSD::Connect(HLERequestContext& ctx) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::GetPeerName(HLERequestContext& ctx) {
|
void BSD_USA::GetPeerName(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const s32 fd = rp.Pop<s32>();
|
const s32 fd = rp.Pop<s32>();
|
||||||
|
|
||||||
@@ -275,7 +275,7 @@ void BSD::GetPeerName(HLERequestContext& ctx) {
|
|||||||
rb.Push<u32>(static_cast<u32>(write_buffer.size()));
|
rb.Push<u32>(static_cast<u32>(write_buffer.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::GetSockName(HLERequestContext& ctx) {
|
void BSD_USA::GetSockName(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const s32 fd = rp.Pop<s32>();
|
const s32 fd = rp.Pop<s32>();
|
||||||
|
|
||||||
@@ -293,7 +293,7 @@ void BSD::GetSockName(HLERequestContext& ctx) {
|
|||||||
rb.Push<u32>(static_cast<u32>(write_buffer.size()));
|
rb.Push<u32>(static_cast<u32>(write_buffer.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::GetSockOpt(HLERequestContext& ctx) {
|
void BSD_USA::GetSockOpt(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const s32 fd = rp.Pop<s32>();
|
const s32 fd = rp.Pop<s32>();
|
||||||
const u32 level = rp.Pop<u32>();
|
const u32 level = rp.Pop<u32>();
|
||||||
@@ -315,7 +315,7 @@ void BSD::GetSockOpt(HLERequestContext& ctx) {
|
|||||||
rb.Push<u32>(static_cast<u32>(optval.size()));
|
rb.Push<u32>(static_cast<u32>(optval.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::Listen(HLERequestContext& ctx) {
|
void BSD_USA::Listen(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const s32 fd = rp.Pop<s32>();
|
const s32 fd = rp.Pop<s32>();
|
||||||
const s32 backlog = rp.Pop<s32>();
|
const s32 backlog = rp.Pop<s32>();
|
||||||
@@ -325,7 +325,7 @@ void BSD::Listen(HLERequestContext& ctx) {
|
|||||||
BuildErrnoResponse(ctx, ListenImpl(fd, backlog));
|
BuildErrnoResponse(ctx, ListenImpl(fd, backlog));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::Fcntl(HLERequestContext& ctx) {
|
void BSD_USA::Fcntl(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const s32 fd = rp.Pop<s32>();
|
const s32 fd = rp.Pop<s32>();
|
||||||
const s32 cmd = rp.Pop<s32>();
|
const s32 cmd = rp.Pop<s32>();
|
||||||
@@ -341,7 +341,7 @@ void BSD::Fcntl(HLERequestContext& ctx) {
|
|||||||
rb.PushEnum(bsd_errno);
|
rb.PushEnum(bsd_errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::SetSockOpt(HLERequestContext& ctx) {
|
void BSD_USA::SetSockOpt(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
|
|
||||||
const s32 fd = rp.Pop<s32>();
|
const s32 fd = rp.Pop<s32>();
|
||||||
@@ -355,7 +355,7 @@ void BSD::SetSockOpt(HLERequestContext& ctx) {
|
|||||||
BuildErrnoResponse(ctx, SetSockOptImpl(fd, level, optname, optval));
|
BuildErrnoResponse(ctx, SetSockOptImpl(fd, level, optname, optval));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::Shutdown(HLERequestContext& ctx) {
|
void BSD_USA::Shutdown(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
|
|
||||||
const s32 fd = rp.Pop<s32>();
|
const s32 fd = rp.Pop<s32>();
|
||||||
@@ -366,7 +366,7 @@ void BSD::Shutdown(HLERequestContext& ctx) {
|
|||||||
BuildErrnoResponse(ctx, ShutdownImpl(fd, how));
|
BuildErrnoResponse(ctx, ShutdownImpl(fd, how));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::Recv(HLERequestContext& ctx) {
|
void BSD_USA::Recv(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
|
|
||||||
const s32 fd = rp.Pop<s32>();
|
const s32 fd = rp.Pop<s32>();
|
||||||
@@ -381,7 +381,7 @@ void BSD::Recv(HLERequestContext& ctx) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::RecvFrom(HLERequestContext& ctx) {
|
void BSD_USA::RecvFrom(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
|
|
||||||
const s32 fd = rp.Pop<s32>();
|
const s32 fd = rp.Pop<s32>();
|
||||||
@@ -398,7 +398,7 @@ void BSD::RecvFrom(HLERequestContext& ctx) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::Send(HLERequestContext& ctx) {
|
void BSD_USA::Send(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
|
|
||||||
const s32 fd = rp.Pop<s32>();
|
const s32 fd = rp.Pop<s32>();
|
||||||
@@ -413,7 +413,7 @@ void BSD::Send(HLERequestContext& ctx) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::SendTo(HLERequestContext& ctx) {
|
void BSD_USA::SendTo(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const s32 fd = rp.Pop<s32>();
|
const s32 fd = rp.Pop<s32>();
|
||||||
const u32 flags = rp.Pop<u32>();
|
const u32 flags = rp.Pop<u32>();
|
||||||
@@ -429,7 +429,7 @@ void BSD::SendTo(HLERequestContext& ctx) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::Write(HLERequestContext& ctx) {
|
void BSD_USA::Write(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const s32 fd = rp.Pop<s32>();
|
const s32 fd = rp.Pop<s32>();
|
||||||
|
|
||||||
@@ -442,7 +442,7 @@ void BSD::Write(HLERequestContext& ctx) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::Read(HLERequestContext& ctx) {
|
void BSD_USA::Read(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const s32 fd = rp.Pop<s32>();
|
const s32 fd = rp.Pop<s32>();
|
||||||
|
|
||||||
@@ -454,7 +454,7 @@ void BSD::Read(HLERequestContext& ctx) {
|
|||||||
rb.Push<u32>(0); // bsd errno
|
rb.Push<u32>(0); // bsd errno
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::Close(HLERequestContext& ctx) {
|
void BSD_USA::Close(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const s32 fd = rp.Pop<s32>();
|
const s32 fd = rp.Pop<s32>();
|
||||||
|
|
||||||
@@ -464,7 +464,7 @@ void BSD::Close(HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Only bsd:s is able to dup()
|
/// @brief Only bsd:s is able to dup()
|
||||||
void BSD::DuplicateSocket(HLERequestContext& ctx) {
|
void BSD_USA::DuplicateSocket(HLERequestContext& ctx) {
|
||||||
struct InputParameters {
|
struct InputParameters {
|
||||||
s32 fd;
|
s32 fd;
|
||||||
u64 reserved;
|
u64 reserved;
|
||||||
@@ -505,7 +505,7 @@ void BSD::DuplicateSocket(HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::EventFd(HLERequestContext& ctx) {
|
void BSD_USA::EventFd(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const u64 initval = rp.Pop<u64>();
|
const u64 initval = rp.Pop<u64>();
|
||||||
const u32 flags = rp.Pop<u32>();
|
const u32 flags = rp.Pop<u32>();
|
||||||
@@ -516,12 +516,12 @@ void BSD::EventFd(HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename Work>
|
template <typename Work>
|
||||||
void BSD::ExecuteWork(HLERequestContext& ctx, Work work) {
|
void BSD_USA::ExecuteWork(HLERequestContext& ctx, Work work) {
|
||||||
work.Execute(this);
|
work.Execute(this);
|
||||||
work.Response(ctx);
|
work.Response(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<s32, Errno> BSD::SocketImpl(Domain domain, Type type, Protocol protocol) {
|
std::pair<s32, Errno> BSD_USA::SocketImpl(Domain domain, Type type, Protocol protocol) {
|
||||||
// user bsd:u has restrictions on SOCK_SEQPACKET and SOCK_RAW
|
// user bsd:u has restrictions on SOCK_SEQPACKET and SOCK_RAW
|
||||||
if (is_user && (type == Type::SEQPACKET || type == Type::RAW)) {
|
if (is_user && (type == Type::SEQPACKET || type == Type::RAW)) {
|
||||||
if (type == Type::RAW && domain == Domain::INET && protocol == Protocol::ICMP) {
|
if (type == Type::RAW && domain == Domain::INET && protocol == Protocol::ICMP) {
|
||||||
@@ -565,7 +565,7 @@ std::pair<s32, Errno> BSD::SocketImpl(Domain domain, Type type, Protocol protoco
|
|||||||
return {fd, Errno::SUCCESS};
|
return {fd, Errno::SUCCESS};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<s32, Errno> BSD::PollImpl(std::vector<u8>& write_buffer, std::span<const u8> read_buffer,
|
std::pair<s32, Errno> BSD_USA::PollImpl(std::vector<u8>& write_buffer, std::span<const u8> read_buffer,
|
||||||
s32 nfds, s32 timeout) {
|
s32 nfds, s32 timeout) {
|
||||||
if (nfds <= 0) {
|
if (nfds <= 0) {
|
||||||
// When no entries are provided, -1 is returned with errno zero
|
// When no entries are provided, -1 is returned with errno zero
|
||||||
@@ -632,7 +632,7 @@ std::pair<s32, Errno> BSD::PollImpl(std::vector<u8>& write_buffer, std::span<con
|
|||||||
return Translate(result);
|
return Translate(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<s32, Errno> BSD::AcceptImpl(s32 fd, std::vector<u8>& write_buffer) {
|
std::pair<s32, Errno> BSD_USA::AcceptImpl(s32 fd, std::vector<u8>& write_buffer) {
|
||||||
if (!IsFileDescriptorValid(fd)) {
|
if (!IsFileDescriptorValid(fd)) {
|
||||||
return {-1, Errno::BADF};
|
return {-1, Errno::BADF};
|
||||||
}
|
}
|
||||||
@@ -660,7 +660,7 @@ std::pair<s32, Errno> BSD::AcceptImpl(s32 fd, std::vector<u8>& write_buffer) {
|
|||||||
return {new_fd, Errno::SUCCESS};
|
return {new_fd, Errno::SUCCESS};
|
||||||
}
|
}
|
||||||
|
|
||||||
Errno BSD::BindImpl(s32 fd, std::span<const u8> addr) {
|
Errno BSD_USA::BindImpl(s32 fd, std::span<const u8> addr) {
|
||||||
if (!IsFileDescriptorValid(fd)) {
|
if (!IsFileDescriptorValid(fd)) {
|
||||||
return Errno::BADF;
|
return Errno::BADF;
|
||||||
}
|
}
|
||||||
@@ -675,7 +675,7 @@ Errno BSD::BindImpl(s32 fd, std::span<const u8> addr) {
|
|||||||
return Translate(file_descriptors[fd]->socket->Bind(Translate(addr_in)));
|
return Translate(file_descriptors[fd]->socket->Bind(Translate(addr_in)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Errno BSD::ConnectImpl(s32 fd, std::span<const u8> addr) {
|
Errno BSD_USA::ConnectImpl(s32 fd, std::span<const u8> addr) {
|
||||||
if (!IsFileDescriptorValid(fd)) {
|
if (!IsFileDescriptorValid(fd)) {
|
||||||
return Errno::BADF;
|
return Errno::BADF;
|
||||||
}
|
}
|
||||||
@@ -698,7 +698,7 @@ Errno BSD::ConnectImpl(s32 fd, std::span<const u8> addr) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Errno BSD::GetPeerNameImpl(s32 fd, std::vector<u8>& write_buffer) {
|
Errno BSD_USA::GetPeerNameImpl(s32 fd, std::vector<u8>& write_buffer) {
|
||||||
if (!IsFileDescriptorValid(fd)) {
|
if (!IsFileDescriptorValid(fd)) {
|
||||||
return Errno::BADF;
|
return Errno::BADF;
|
||||||
}
|
}
|
||||||
@@ -720,7 +720,7 @@ Errno BSD::GetPeerNameImpl(s32 fd, std::vector<u8>& write_buffer) {
|
|||||||
return Translate(bsd_errno);
|
return Translate(bsd_errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
Errno BSD::GetSockNameImpl(s32 fd, std::vector<u8>& write_buffer) {
|
Errno BSD_USA::GetSockNameImpl(s32 fd, std::vector<u8>& write_buffer) {
|
||||||
if (!IsFileDescriptorValid(fd)) {
|
if (!IsFileDescriptorValid(fd)) {
|
||||||
return Errno::BADF;
|
return Errno::BADF;
|
||||||
}
|
}
|
||||||
@@ -742,7 +742,7 @@ Errno BSD::GetSockNameImpl(s32 fd, std::vector<u8>& write_buffer) {
|
|||||||
return Translate(bsd_errno);
|
return Translate(bsd_errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
Errno BSD::ListenImpl(s32 fd, s32 backlog) {
|
Errno BSD_USA::ListenImpl(s32 fd, s32 backlog) {
|
||||||
if (!IsFileDescriptorValid(fd)) {
|
if (!IsFileDescriptorValid(fd)) {
|
||||||
return Errno::BADF;
|
return Errno::BADF;
|
||||||
}
|
}
|
||||||
@@ -753,7 +753,7 @@ Errno BSD::ListenImpl(s32 fd, s32 backlog) {
|
|||||||
return Translate(file_descriptors[fd]->socket->Listen(backlog));
|
return Translate(file_descriptors[fd]->socket->Listen(backlog));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<s32, Errno> BSD::FcntlImpl(s32 fd, FcntlCmd cmd, s32 arg) {
|
std::pair<s32, Errno> BSD_USA::FcntlImpl(s32 fd, FcntlCmd cmd, s32 arg) {
|
||||||
if (!IsFileDescriptorValid(fd)) {
|
if (!IsFileDescriptorValid(fd)) {
|
||||||
return {-1, Errno::BADF};
|
return {-1, Errno::BADF};
|
||||||
}
|
}
|
||||||
@@ -783,7 +783,7 @@ std::pair<s32, Errno> BSD::FcntlImpl(s32 fd, FcntlCmd cmd, s32 arg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Errno BSD::GetSockOptImpl(s32 fd, u32 level, OptName optname, std::vector<u8>& optval) {
|
Errno BSD_USA::GetSockOptImpl(s32 fd, u32 level, OptName optname, std::vector<u8>& optval) {
|
||||||
if (!IsFileDescriptorValid(fd)) {
|
if (!IsFileDescriptorValid(fd)) {
|
||||||
return Errno::BADF;
|
return Errno::BADF;
|
||||||
}
|
}
|
||||||
@@ -818,7 +818,7 @@ Errno BSD::GetSockOptImpl(s32 fd, u32 level, OptName optname, std::vector<u8>& o
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Errno BSD::SetSockOptImpl(s32 fd, u32 level, OptName optname, std::span<const u8> optval) {
|
Errno BSD_USA::SetSockOptImpl(s32 fd, u32 level, OptName optname, std::span<const u8> optval) {
|
||||||
if (!IsFileDescriptorValid(fd)) {
|
if (!IsFileDescriptorValid(fd)) {
|
||||||
return Errno::BADF;
|
return Errno::BADF;
|
||||||
}
|
}
|
||||||
@@ -872,7 +872,7 @@ Errno BSD::SetSockOptImpl(s32 fd, u32 level, OptName optname, std::span<const u8
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Errno BSD::ShutdownImpl(s32 fd, s32 how) {
|
Errno BSD_USA::ShutdownImpl(s32 fd, s32 how) {
|
||||||
if (!IsFileDescriptorValid(fd)) {
|
if (!IsFileDescriptorValid(fd)) {
|
||||||
return Errno::BADF;
|
return Errno::BADF;
|
||||||
}
|
}
|
||||||
@@ -884,7 +884,7 @@ Errno BSD::ShutdownImpl(s32 fd, s32 how) {
|
|||||||
return Translate(file_descriptors[fd]->socket->Shutdown(host_how));
|
return Translate(file_descriptors[fd]->socket->Shutdown(host_how));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<s32, Errno> BSD::RecvImpl(s32 fd, u32 flags, std::vector<u8>& message) {
|
std::pair<s32, Errno> BSD_USA::RecvImpl(s32 fd, u32 flags, std::vector<u8>& message) {
|
||||||
if (!IsFileDescriptorValid(fd)) {
|
if (!IsFileDescriptorValid(fd)) {
|
||||||
return {-1, Errno::BADF};
|
return {-1, Errno::BADF};
|
||||||
}
|
}
|
||||||
@@ -911,7 +911,7 @@ std::pair<s32, Errno> BSD::RecvImpl(s32 fd, u32 flags, std::vector<u8>& message)
|
|||||||
return {ret, bsd_errno};
|
return {ret, bsd_errno};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<s32, Errno> BSD::RecvFromImpl(s32 fd, u32 flags, std::vector<u8>& message,
|
std::pair<s32, Errno> BSD_USA::RecvFromImpl(s32 fd, u32 flags, std::vector<u8>& message,
|
||||||
std::vector<u8>& addr) {
|
std::vector<u8>& addr) {
|
||||||
if (!IsFileDescriptorValid(fd)) {
|
if (!IsFileDescriptorValid(fd)) {
|
||||||
return {-1, Errno::BADF};
|
return {-1, Errno::BADF};
|
||||||
@@ -958,7 +958,7 @@ std::pair<s32, Errno> BSD::RecvFromImpl(s32 fd, u32 flags, std::vector<u8>& mess
|
|||||||
return {ret, bsd_errno};
|
return {ret, bsd_errno};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<s32, Errno> BSD::SendImpl(s32 fd, u32 flags, std::span<const u8> message) {
|
std::pair<s32, Errno> BSD_USA::SendImpl(s32 fd, u32 flags, std::span<const u8> message) {
|
||||||
if (!IsFileDescriptorValid(fd)) {
|
if (!IsFileDescriptorValid(fd)) {
|
||||||
return {-1, Errno::BADF};
|
return {-1, Errno::BADF};
|
||||||
}
|
}
|
||||||
@@ -969,7 +969,7 @@ std::pair<s32, Errno> BSD::SendImpl(s32 fd, u32 flags, std::span<const u8> messa
|
|||||||
return Translate(file_descriptors[fd]->socket->Send(message, flags));
|
return Translate(file_descriptors[fd]->socket->Send(message, flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<s32, Errno> BSD::SendToImpl(s32 fd, u32 flags, std::span<const u8> message,
|
std::pair<s32, Errno> BSD_USA::SendToImpl(s32 fd, u32 flags, std::span<const u8> message,
|
||||||
std::span<const u8> addr) {
|
std::span<const u8> addr) {
|
||||||
if (!IsFileDescriptorValid(fd)) {
|
if (!IsFileDescriptorValid(fd)) {
|
||||||
return {-1, Errno::BADF};
|
return {-1, Errno::BADF};
|
||||||
@@ -991,7 +991,7 @@ std::pair<s32, Errno> BSD::SendToImpl(s32 fd, u32 flags, std::span<const u8> mes
|
|||||||
return Translate(file_descriptors[fd]->socket->SendTo(flags, message, p_addr_in));
|
return Translate(file_descriptors[fd]->socket->SendTo(flags, message, p_addr_in));
|
||||||
}
|
}
|
||||||
|
|
||||||
Errno BSD::CloseImpl(s32 fd) {
|
Errno BSD_USA::CloseImpl(s32 fd) {
|
||||||
if (!IsFileDescriptorValid(fd)) {
|
if (!IsFileDescriptorValid(fd)) {
|
||||||
return Errno::BADF;
|
return Errno::BADF;
|
||||||
}
|
}
|
||||||
@@ -1011,7 +1011,7 @@ Errno BSD::CloseImpl(s32 fd) {
|
|||||||
return bsd_errno;
|
return bsd_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::variant<s32, Errno> BSD::DuplicateSocketImpl(s32 fd) {
|
std::variant<s32, Errno> BSD_USA::DuplicateSocketImpl(s32 fd) {
|
||||||
if (!IsFileDescriptorValid(fd)) {
|
if (!IsFileDescriptorValid(fd)) {
|
||||||
return Errno::BADF;
|
return Errno::BADF;
|
||||||
}
|
}
|
||||||
@@ -1030,7 +1030,7 @@ std::variant<s32, Errno> BSD::DuplicateSocketImpl(s32 fd) {
|
|||||||
return new_fd;
|
return new_fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<std::shared_ptr<Network::SocketBase>> BSD::GetSocket(s32 fd) {
|
std::optional<std::shared_ptr<Network::SocketBase>> BSD_USA::GetSocket(s32 fd) {
|
||||||
if (!IsFileDescriptorValid(fd)) {
|
if (!IsFileDescriptorValid(fd)) {
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
@@ -1041,7 +1041,7 @@ std::optional<std::shared_ptr<Network::SocketBase>> BSD::GetSocket(s32 fd) {
|
|||||||
return file_descriptors[fd]->socket;
|
return file_descriptors[fd]->socket;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 BSD::FindFreeFileDescriptorHandle() noexcept {
|
s32 BSD_USA::FindFreeFileDescriptorHandle() noexcept {
|
||||||
for (s32 fd = 0; fd < static_cast<s32>(file_descriptors.size()); ++fd) {
|
for (s32 fd = 0; fd < static_cast<s32>(file_descriptors.size()); ++fd) {
|
||||||
if (!file_descriptors[fd]) {
|
if (!file_descriptors[fd]) {
|
||||||
return fd;
|
return fd;
|
||||||
@@ -1050,7 +1050,7 @@ s32 BSD::FindFreeFileDescriptorHandle() noexcept {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BSD::IsFileDescriptorValid(s32 fd) const noexcept {
|
bool BSD_USA::IsFileDescriptorValid(s32 fd) const noexcept {
|
||||||
if (fd > static_cast<s32>(MAX_FD) || fd < 0) {
|
if (fd > static_cast<s32>(MAX_FD) || fd < 0) {
|
||||||
LOG_ERROR(Service, "Invalid file descriptor handle={}", fd);
|
LOG_ERROR(Service, "Invalid file descriptor handle={}", fd);
|
||||||
return false;
|
return false;
|
||||||
@@ -1062,7 +1062,7 @@ bool BSD::IsFileDescriptorValid(s32 fd) const noexcept {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::BuildErrnoResponse(HLERequestContext& ctx, Errno bsd_errno) const noexcept {
|
void BSD_USA::BuildErrnoResponse(HLERequestContext& ctx, Errno bsd_errno) const noexcept {
|
||||||
IPC::ResponseBuilder rb{ctx, 4};
|
IPC::ResponseBuilder rb{ctx, 4};
|
||||||
|
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
@@ -1070,7 +1070,7 @@ void BSD::BuildErrnoResponse(HLERequestContext& ctx, Errno bsd_errno) const noex
|
|||||||
rb.PushEnum(bsd_errno);
|
rb.PushEnum(bsd_errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSD::OnProxyPacketReceived(const Network::ProxyPacket& packet) {
|
void BSD_USA::OnProxyPacketReceived(const Network::ProxyPacket& packet) {
|
||||||
for (auto& optional_descriptor : file_descriptors) {
|
for (auto& optional_descriptor : file_descriptors) {
|
||||||
if (!optional_descriptor.has_value()) {
|
if (!optional_descriptor.has_value()) {
|
||||||
continue;
|
continue;
|
||||||
@@ -1080,43 +1080,43 @@ void BSD::OnProxyPacketReceived(const Network::ProxyPacket& packet) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BSD::BSD(Core::System& system_, const char* name, bool is_user_)
|
BSD_USA::BSD_USA(Core::System& system_, const char* name, bool is_user_)
|
||||||
: ServiceFramework{system_, name}
|
: ServiceFramework{system_, name}
|
||||||
, is_user{is_user_} {
|
, is_user{is_user_} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &BSD::RegisterClient, "RegisterClient"},
|
{0, &BSD_USA::RegisterClient, "RegisterClient"},
|
||||||
{1, &BSD::StartMonitoring, "StartMonitoring"},
|
{1, &BSD_USA::StartMonitoring, "StartMonitoring"},
|
||||||
{2, &BSD::Socket, "Socket"},
|
{2, &BSD_USA::Socket, "Socket"},
|
||||||
{3, &BSD::SocketExempt, "SocketExempt"},
|
{3, &BSD_USA::SocketExempt, "SocketExempt"},
|
||||||
{4, nullptr, "Open"},
|
{4, nullptr, "Open"},
|
||||||
{5, &BSD::Select, "Select"},
|
{5, &BSD_USA::Select, "Select"},
|
||||||
{6, &BSD::Poll, "Poll"},
|
{6, &BSD_USA::Poll, "Poll"},
|
||||||
{7, nullptr, "Sysctl"},
|
{7, nullptr, "Sysctl"},
|
||||||
{8, &BSD::Recv, "Recv"},
|
{8, &BSD_USA::Recv, "Recv"},
|
||||||
{9, &BSD::RecvFrom, "RecvFrom"},
|
{9, &BSD_USA::RecvFrom, "RecvFrom"},
|
||||||
{10, &BSD::Send, "Send"},
|
{10, &BSD_USA::Send, "Send"},
|
||||||
{11, &BSD::SendTo, "SendTo"},
|
{11, &BSD_USA::SendTo, "SendTo"},
|
||||||
{12, &BSD::Accept, "Accept"},
|
{12, &BSD_USA::Accept, "Accept"},
|
||||||
{13, &BSD::Bind, "Bind"},
|
{13, &BSD_USA::Bind, "Bind"},
|
||||||
{14, &BSD::Connect, "Connect"},
|
{14, &BSD_USA::Connect, "Connect"},
|
||||||
{15, &BSD::GetPeerName, "GetPeerName"},
|
{15, &BSD_USA::GetPeerName, "GetPeerName"},
|
||||||
{16, &BSD::GetSockName, "GetSockName"},
|
{16, &BSD_USA::GetSockName, "GetSockName"},
|
||||||
{17, &BSD::GetSockOpt, "GetSockOpt"},
|
{17, &BSD_USA::GetSockOpt, "GetSockOpt"},
|
||||||
{18, &BSD::Listen, "Listen"},
|
{18, &BSD_USA::Listen, "Listen"},
|
||||||
{19, nullptr, "Ioctl"},
|
{19, nullptr, "Ioctl"},
|
||||||
{20, &BSD::Fcntl, "Fcntl"},
|
{20, &BSD_USA::Fcntl, "Fcntl"},
|
||||||
{21, &BSD::SetSockOpt, "SetSockOpt"},
|
{21, &BSD_USA::SetSockOpt, "SetSockOpt"},
|
||||||
{22, &BSD::Shutdown, "Shutdown"},
|
{22, &BSD_USA::Shutdown, "Shutdown"},
|
||||||
{23, nullptr, "ShutdownAllSockets"},
|
{23, nullptr, "ShutdownAllSockets"},
|
||||||
{24, &BSD::Write, "Write"},
|
{24, &BSD_USA::Write, "Write"},
|
||||||
{25, &BSD::Read, "Read"},
|
{25, &BSD_USA::Read, "Read"},
|
||||||
{26, &BSD::Close, "Close"},
|
{26, &BSD_USA::Close, "Close"},
|
||||||
{27, &BSD::DuplicateSocket, "DuplicateSocket"},
|
{27, &BSD_USA::DuplicateSocket, "DuplicateSocket"},
|
||||||
{28, nullptr, "GetResourceStatistics"},
|
{28, nullptr, "GetResourceStatistics"},
|
||||||
{29, nullptr, "RecvMMsg"}, //3.0.0+
|
{29, nullptr, "RecvMMsg"}, //3.0.0+
|
||||||
{30, nullptr, "SendMMsg"}, //3.0.0+
|
{30, nullptr, "SendMMsg"}, //3.0.0+
|
||||||
{31, &BSD::EventFd, "EventFd"}, //7.0.0+
|
{31, &BSD_USA::EventFd, "EventFd"}, //7.0.0+
|
||||||
{32, nullptr, "RegisterResourceStatisticsName"}, //7.0.0+
|
{32, nullptr, "RegisterResourceStatisticsName"}, //7.0.0+
|
||||||
{33, nullptr, "RegisterClientShared"}, //10.0.0+
|
{33, nullptr, "RegisterClientShared"}, //10.0.0+
|
||||||
{34, nullptr, "GetSocketStatistics"}, //15.0.0+
|
{34, nullptr, "GetSocketStatistics"}, //15.0.0+
|
||||||
@@ -1144,13 +1144,13 @@ BSD::BSD(Core::System& system_, const char* name, bool is_user_)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BSD::~BSD() {
|
BSD_USA::~BSD_USA() {
|
||||||
if (auto room_member = Network::GetRoomMember().lock()) {
|
if (auto room_member = Network::GetRoomMember().lock()) {
|
||||||
room_member->Unbind(proxy_packet_received);
|
room_member->Unbind(proxy_packet_received);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_lock<std::mutex> BSD::LockService() noexcept {
|
std::unique_lock<std::mutex> BSD_USA::LockService() noexcept {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ class Socket;
|
|||||||
|
|
||||||
namespace Service::Sockets {
|
namespace Service::Sockets {
|
||||||
|
|
||||||
class BSD final : public ServiceFramework<BSD> {
|
class BSD_USA final : public ServiceFramework<BSD_USA> {
|
||||||
public:
|
public:
|
||||||
explicit BSD(Core::System& system_, const char* name, bool is_user);
|
explicit BSD_USA(Core::System& system_, const char* name, bool is_user);
|
||||||
~BSD() override;
|
~BSD_USA() override;
|
||||||
|
|
||||||
// These methods are called from SSL; the first two are also called from
|
// These methods are called from SSL; the first two are also called from
|
||||||
// this class for the corresponding IPC methods.
|
// this class for the corresponding IPC methods.
|
||||||
@@ -50,7 +50,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct PollWork {
|
struct PollWork {
|
||||||
void Execute(BSD* bsd);
|
void Execute(BSD_USA* bsd);
|
||||||
void Response(HLERequestContext& ctx);
|
void Response(HLERequestContext& ctx);
|
||||||
|
|
||||||
s32 nfds;
|
s32 nfds;
|
||||||
@@ -62,7 +62,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct AcceptWork {
|
struct AcceptWork {
|
||||||
void Execute(BSD* bsd);
|
void Execute(BSD_USA* bsd);
|
||||||
void Response(HLERequestContext& ctx);
|
void Response(HLERequestContext& ctx);
|
||||||
|
|
||||||
s32 fd;
|
s32 fd;
|
||||||
@@ -72,7 +72,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct ConnectWork {
|
struct ConnectWork {
|
||||||
void Execute(BSD* bsd);
|
void Execute(BSD_USA* bsd);
|
||||||
void Response(HLERequestContext& ctx);
|
void Response(HLERequestContext& ctx);
|
||||||
|
|
||||||
s32 fd;
|
s32 fd;
|
||||||
@@ -81,7 +81,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct RecvWork {
|
struct RecvWork {
|
||||||
void Execute(BSD* bsd);
|
void Execute(BSD_USA* bsd);
|
||||||
void Response(HLERequestContext& ctx);
|
void Response(HLERequestContext& ctx);
|
||||||
|
|
||||||
s32 fd;
|
s32 fd;
|
||||||
@@ -92,7 +92,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct RecvFromWork {
|
struct RecvFromWork {
|
||||||
void Execute(BSD* bsd);
|
void Execute(BSD_USA* bsd);
|
||||||
void Response(HLERequestContext& ctx);
|
void Response(HLERequestContext& ctx);
|
||||||
|
|
||||||
s32 fd;
|
s32 fd;
|
||||||
@@ -104,7 +104,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct SendWork {
|
struct SendWork {
|
||||||
void Execute(BSD* bsd);
|
void Execute(BSD_USA* bsd);
|
||||||
void Response(HLERequestContext& ctx);
|
void Response(HLERequestContext& ctx);
|
||||||
|
|
||||||
s32 fd;
|
s32 fd;
|
||||||
@@ -115,7 +115,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct SendToWork {
|
struct SendToWork {
|
||||||
void Execute(BSD* bsd);
|
void Execute(BSD_USA* bsd);
|
||||||
void Response(HLERequestContext& ctx);
|
void Response(HLERequestContext& ctx);
|
||||||
|
|
||||||
s32 fd;
|
s32 fd;
|
||||||
|
|||||||
@@ -66,9 +66,9 @@ void LoopProcess(Core::System& system) {
|
|||||||
|
|
||||||
server_manager->RegisterNamedService("ethc:c", std::make_shared<ETHC_C>(system));
|
server_manager->RegisterNamedService("ethc:c", std::make_shared<ETHC_C>(system));
|
||||||
server_manager->RegisterNamedService("ethc:i", std::make_shared<ETHC_I>(system));
|
server_manager->RegisterNamedService("ethc:i", std::make_shared<ETHC_I>(system));
|
||||||
server_manager->RegisterNamedService("bsd:s", std::make_shared<BSD>(system, "bsd:s", false));
|
server_manager->RegisterNamedService("bsd:s", std::make_shared<BSD_USA>(system, "bsd:s", false));
|
||||||
server_manager->RegisterNamedService("bsd:u", std::make_shared<BSD>(system, "bsd:u", true));
|
server_manager->RegisterNamedService("bsd:u", std::make_shared<BSD_USA>(system, "bsd:u", true));
|
||||||
server_manager->RegisterNamedService("bsd:a", std::make_shared<BSD>(system, "bsd:a", true));
|
server_manager->RegisterNamedService("bsd:a", std::make_shared<BSD_USA>(system, "bsd:a", true));
|
||||||
server_manager->RegisterNamedService("bsd:nu", std::make_shared<BSD_NU>(system));
|
server_manager->RegisterNamedService("bsd:nu", std::make_shared<BSD_NU>(system));
|
||||||
server_manager->RegisterNamedService("bsdcfg", std::make_shared<BSDCFG>(system, "bsdcfg"));
|
server_manager->RegisterNamedService("bsdcfg", std::make_shared<BSDCFG>(system, "bsdcfg"));
|
||||||
server_manager->RegisterNamedService("ifcfg", std::make_shared<BSDCFG>(system, "ifcfg"));
|
server_manager->RegisterNamedService("ifcfg", std::make_shared<BSDCFG>(system, "ifcfg"));
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ public:
|
|||||||
LOG_ERROR(Service_SSL,
|
LOG_ERROR(Service_SSL,
|
||||||
"do_not_close_socket was changed after setting socket; is this right?");
|
"do_not_close_socket was changed after setting socket; is this right?");
|
||||||
} else {
|
} else {
|
||||||
auto bsd = system.ServiceManager().GetService<Service::Sockets::BSD>("bsd:u");
|
auto bsd = system.ServiceManager().GetService<Service::Sockets::BSD_USA>("bsd:u");
|
||||||
if (bsd) {
|
if (bsd) {
|
||||||
auto err = bsd->CloseImpl(fd);
|
auto err = bsd->CloseImpl(fd);
|
||||||
if (err != Service::Sockets::Errno::SUCCESS) {
|
if (err != Service::Sockets::Errno::SUCCESS) {
|
||||||
@@ -157,7 +157,7 @@ private:
|
|||||||
Result SetSocketDescriptorImpl(s32* out_fd, s32 fd) {
|
Result SetSocketDescriptorImpl(s32* out_fd, s32 fd) {
|
||||||
LOG_DEBUG(Service_SSL, "called, fd={}", fd);
|
LOG_DEBUG(Service_SSL, "called, fd={}", fd);
|
||||||
ASSERT(!did_handshake);
|
ASSERT(!did_handshake);
|
||||||
auto bsd = system.ServiceManager().GetService<Service::Sockets::BSD>("bsd:u");
|
auto bsd = system.ServiceManager().GetService<Service::Sockets::BSD_USA>("bsd:u");
|
||||||
ASSERT_OR_EXECUTE(bsd, { return ResultInternalError; });
|
ASSERT_OR_EXECUTE(bsd, { return ResultInternalError; });
|
||||||
|
|
||||||
auto const res_v = bsd->DuplicateSocketImpl(fd);
|
auto const res_v = bsd->DuplicateSocketImpl(fd);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/polyfill_thread.h"
|
#include "common/polyfill_thread.h"
|
||||||
@@ -49,7 +49,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
Core::System& m_system;
|
Core::System& m_system;
|
||||||
Container& m_container;
|
Container& m_container;
|
||||||
ankerl::unordered_dense::map<u64, VsyncManager> m_vsync_managers;
|
::Common::unordered_map<u64, VsyncManager> m_vsync_managers;
|
||||||
std::shared_ptr<Core::Timing::EventType> m_event;
|
std::shared_ptr<Core::Timing::EventType> m_event;
|
||||||
Common::Event m_signal;
|
Common::Event m_signal;
|
||||||
std::jthread m_thread;
|
std::jthread m_thread;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
@@ -21,8 +21,8 @@
|
|||||||
namespace Core::LaunchTimestampCache {
|
namespace Core::LaunchTimestampCache {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
using CacheMap = ankerl::unordered_dense::map<u64, s64>;
|
using CacheMap = ::Common::unordered_map<u64, s64>;
|
||||||
using CountMap = ankerl::unordered_dense::map<u64, u64>;
|
using CountMap = ::Common::unordered_map<u64, u64>;
|
||||||
|
|
||||||
std::mutex g_mutex;
|
std::mutex g_mutex;
|
||||||
CacheMap g_cache;
|
CacheMap g_cache;
|
||||||
|
|||||||
@@ -120,7 +120,6 @@ if (NOT Boost_FOUND)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(fmt 8 CONFIG)
|
find_package(fmt 8 CONFIG)
|
||||||
find_package(unordered_dense REQUIRED)
|
|
||||||
|
|
||||||
if ("arm64" IN_LIST ARCHITECTURE OR DYNARMIC_TESTS)
|
if ("arm64" IN_LIST ARCHITECTURE OR DYNARMIC_TESTS)
|
||||||
find_package(oaknut 2.0.1 CONFIG)
|
find_package(oaknut 2.0.1 CONFIG)
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ if (NOT @BUILD_SHARED_LIBS@)
|
|||||||
find_dependency(Boost 1.57)
|
find_dependency(Boost 1.57)
|
||||||
find_dependency(fmt 9)
|
find_dependency(fmt 9)
|
||||||
find_dependency(mcl 0.1.12 EXACT)
|
find_dependency(mcl 0.1.12 EXACT)
|
||||||
find_dependency(unordered_dense)
|
|
||||||
|
|
||||||
if ("arm64" IN_LIST ARCHITECTURE)
|
if ("arm64" IN_LIST ARCHITECTURE)
|
||||||
find_dependency(oaknut 2.0.1)
|
find_dependency(oaknut 2.0.1)
|
||||||
|
|||||||
@@ -387,7 +387,6 @@ set_target_properties(dynarmic PROPERTIES
|
|||||||
|
|
||||||
target_compile_options(dynarmic PRIVATE ${DYNARMIC_CXX_FLAGS})
|
target_compile_options(dynarmic PRIVATE ${DYNARMIC_CXX_FLAGS})
|
||||||
|
|
||||||
target_link_libraries(dynarmic PRIVATE unordered_dense::unordered_dense)
|
|
||||||
target_link_libraries(dynarmic PUBLIC fmt::fmt common)
|
target_link_libraries(dynarmic PUBLIC fmt::fmt common)
|
||||||
|
|
||||||
if (BOOST_NO_HEADERS)
|
if (BOOST_NO_HEADERS)
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ CodePtr AddressSpace::GetOrEmit(IR::LocationDescriptor descriptor) {
|
|||||||
return block_info.entry_point;
|
return block_info.entry_point;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddressSpace::InvalidateBasicBlocks(const ankerl::unordered_dense::set<IR::LocationDescriptor>& descriptors) {
|
void AddressSpace::InvalidateBasicBlocks(const ::Common::unordered_set<IR::LocationDescriptor>& descriptors) {
|
||||||
UnprotectCodeMemory();
|
UnprotectCodeMemory();
|
||||||
|
|
||||||
for (const auto& descriptor : descriptors) {
|
for (const auto& descriptor : descriptors) {
|
||||||
|
|||||||
@@ -14,7 +14,8 @@
|
|||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include <oaknut/code_block.hpp>
|
#include <oaknut/code_block.hpp>
|
||||||
#include <oaknut/oaknut.hpp>
|
#include <oaknut/oaknut.hpp>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
#include "common/container/unordered_set.h"
|
||||||
|
|
||||||
#include "dynarmic/backend/arm64/emit_arm64.h"
|
#include "dynarmic/backend/arm64/emit_arm64.h"
|
||||||
#include "dynarmic/backend/arm64/fastmem.h"
|
#include "dynarmic/backend/arm64/fastmem.h"
|
||||||
@@ -41,7 +42,7 @@ public:
|
|||||||
|
|
||||||
CodePtr GetOrEmit(IR::LocationDescriptor descriptor);
|
CodePtr GetOrEmit(IR::LocationDescriptor descriptor);
|
||||||
|
|
||||||
void InvalidateBasicBlocks(const ankerl::unordered_dense::set<IR::LocationDescriptor>& descriptors);
|
void InvalidateBasicBlocks(const ::Common::unordered_set<IR::LocationDescriptor>& descriptors);
|
||||||
|
|
||||||
void ClearCache();
|
void ClearCache();
|
||||||
protected:
|
protected:
|
||||||
@@ -76,9 +77,9 @@ protected:
|
|||||||
// A IR::LocationDescriptor will have one current CodePtr.
|
// A IR::LocationDescriptor will have one current CodePtr.
|
||||||
// However, there can be multiple other CodePtrs which are older, previously invalidated blocks.
|
// However, there can be multiple other CodePtrs which are older, previously invalidated blocks.
|
||||||
std::map<CodePtr, IR::LocationDescriptor> reverse_block_entries;
|
std::map<CodePtr, IR::LocationDescriptor> reverse_block_entries;
|
||||||
ankerl::unordered_dense::map<IR::LocationDescriptor, CodePtr> block_entries;
|
::Common::unordered_map<IR::LocationDescriptor, CodePtr> block_entries;
|
||||||
ankerl::unordered_dense::map<CodePtr, EmittedBlockInfo> block_infos;
|
::Common::unordered_map<CodePtr, EmittedBlockInfo> block_infos;
|
||||||
ankerl::unordered_dense::map<IR::LocationDescriptor, ankerl::unordered_dense::set<CodePtr>> block_references;
|
::Common::unordered_map<IR::LocationDescriptor, ::Common::unordered_set<CodePtr>> block_references;
|
||||||
|
|
||||||
ExceptionHandler exception_handler;
|
ExceptionHandler exception_handler;
|
||||||
FastmemManager fastmem_manager;
|
FastmemManager fastmem_manager;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
|
||||||
#include "dynarmic/backend/arm64/fastmem.h"
|
#include "dynarmic/backend/arm64/fastmem.h"
|
||||||
#include "dynarmic/interface/A32/coprocessor.h"
|
#include "dynarmic/interface/A32/coprocessor.h"
|
||||||
@@ -105,8 +105,8 @@ struct EmittedBlockInfo {
|
|||||||
CodePtr entry_point;
|
CodePtr entry_point;
|
||||||
std::size_t size;
|
std::size_t size;
|
||||||
std::vector<Relocation> relocations;
|
std::vector<Relocation> relocations;
|
||||||
ankerl::unordered_dense::map<IR::LocationDescriptor, std::vector<BlockRelocation>> block_relocations;
|
::Common::unordered_map<IR::LocationDescriptor, std::vector<BlockRelocation>> block_relocations;
|
||||||
ankerl::unordered_dense::map<std::ptrdiff_t, FastmemPatchInfo> fastmem_patch_info;
|
::Common::unordered_map<std::ptrdiff_t, FastmemPatchInfo> fastmem_patch_info;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EmitConfig {
|
struct EmitConfig {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_set.h"
|
||||||
|
|
||||||
#include "dynarmic/mcl/bit.hpp"
|
#include "dynarmic/mcl/bit.hpp"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
@@ -59,7 +59,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
ExceptionHandler& exception_handler;
|
ExceptionHandler& exception_handler;
|
||||||
ankerl::unordered_dense::set<DoNotFastmemMarker, DoNotFastmemMarkerHash> do_not_fastmem;
|
::Common::unordered_set<DoNotFastmemMarker, DoNotFastmemMarkerHash> do_not_fastmem;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Dynarmic::Backend::Arm64
|
} // namespace Dynarmic::Backend::Arm64
|
||||||
|
|||||||
@@ -18,7 +18,8 @@
|
|||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "dynarmic/mcl/is_instance_of_template.hpp"
|
#include "dynarmic/mcl/is_instance_of_template.hpp"
|
||||||
#include <oaknut/oaknut.hpp>
|
#include <oaknut/oaknut.hpp>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
#include "common/container/unordered_set.h"
|
||||||
|
|
||||||
#include "dynarmic/backend/arm64/stack_layout.h"
|
#include "dynarmic/backend/arm64/stack_layout.h"
|
||||||
#include "dynarmic/ir/cond.h"
|
#include "dynarmic/ir/cond.h"
|
||||||
@@ -336,7 +337,7 @@ private:
|
|||||||
std::array<HostLocInfo, SpillCount> spills;
|
std::array<HostLocInfo, SpillCount> spills;
|
||||||
|
|
||||||
mutable std::size_t alloc_candidate_index = 0;
|
mutable std::size_t alloc_candidate_index = 0;
|
||||||
ankerl::unordered_dense::set<const IR::Inst*> defined_insts;
|
::Common::unordered_set<const IR::Inst*> defined_insts;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|||||||
@@ -11,13 +11,13 @@
|
|||||||
#include <boost/icl/interval_map.hpp>
|
#include <boost/icl/interval_map.hpp>
|
||||||
#include <boost/icl/interval_set.hpp>
|
#include <boost/icl/interval_set.hpp>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_set.h"
|
||||||
|
|
||||||
namespace Dynarmic::Backend {
|
namespace Dynarmic::Backend {
|
||||||
|
|
||||||
template<typename P>
|
template<typename P>
|
||||||
void BlockRangeInformation<P>::AddRange(boost::icl::discrete_interval<P> range, IR::LocationDescriptor location) {
|
void BlockRangeInformation<P>::AddRange(boost::icl::discrete_interval<P> range, IR::LocationDescriptor location) {
|
||||||
block_ranges.add(std::make_pair(range, ankerl::unordered_dense::set<IR::LocationDescriptor>{location}));
|
block_ranges.add(std::make_pair(range, ::Common::unordered_set<IR::LocationDescriptor>{location}));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename P>
|
template<typename P>
|
||||||
@@ -26,8 +26,8 @@ void BlockRangeInformation<P>::ClearCache() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename P>
|
template<typename P>
|
||||||
ankerl::unordered_dense::set<IR::LocationDescriptor> BlockRangeInformation<P>::InvalidateRanges(const boost::icl::interval_set<P>& ranges) {
|
::Common::unordered_set<IR::LocationDescriptor> BlockRangeInformation<P>::InvalidateRanges(const boost::icl::interval_set<P>& ranges) {
|
||||||
ankerl::unordered_dense::set<IR::LocationDescriptor> erase_locations;
|
::Common::unordered_set<IR::LocationDescriptor> erase_locations;
|
||||||
for (auto invalidate_interval : ranges) {
|
for (auto invalidate_interval : ranges) {
|
||||||
auto pair = block_ranges.equal_range(invalidate_interval);
|
auto pair = block_ranges.equal_range(invalidate_interval);
|
||||||
for (auto it = pair.first; it != pair.second; ++it)
|
for (auto it = pair.first; it != pair.second; ++it)
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
|
|
||||||
#include <boost/icl/interval_map.hpp>
|
#include <boost/icl/interval_map.hpp>
|
||||||
#include <boost/icl/interval_set.hpp>
|
#include <boost/icl/interval_set.hpp>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
#include "common/container/unordered_set.h"
|
||||||
|
|
||||||
#include "dynarmic/ir/location_descriptor.h"
|
#include "dynarmic/ir/location_descriptor.h"
|
||||||
|
|
||||||
@@ -23,8 +24,8 @@ class BlockRangeInformation {
|
|||||||
public:
|
public:
|
||||||
void AddRange(boost::icl::discrete_interval<P> range, IR::LocationDescriptor location);
|
void AddRange(boost::icl::discrete_interval<P> range, IR::LocationDescriptor location);
|
||||||
void ClearCache();
|
void ClearCache();
|
||||||
ankerl::unordered_dense::set<IR::LocationDescriptor> InvalidateRanges(const boost::icl::interval_set<P>& ranges);
|
::Common::unordered_set<IR::LocationDescriptor> InvalidateRanges(const boost::icl::interval_set<P>& ranges);
|
||||||
boost::icl::interval_map<P, ankerl::unordered_dense::set<IR::LocationDescriptor>> block_ranges;
|
boost::icl::interval_map<P, ::Common::unordered_set<IR::LocationDescriptor>> block_ranges;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Dynarmic::Backend
|
} // namespace Dynarmic::Backend
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
#include <optional>
|
#include <optional>
|
||||||
#include <shared_mutex>
|
#include <shared_mutex>
|
||||||
|
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ class SigHandler {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ankerl::unordered_dense::map<u64, CodeBlockInfo> code_block_infos;
|
::Common::unordered_map<u64, CodeBlockInfo> code_block_infos;
|
||||||
std::shared_mutex code_block_infos_mutex;
|
std::shared_mutex code_block_infos_mutex;
|
||||||
struct sigaction old_sa_segv;
|
struct sigaction old_sa_segv;
|
||||||
struct sigaction old_sa_bus;
|
struct sigaction old_sa_bus;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "dynarmic/backend/loongarch64/lagoon_cpp.h"
|
#include "dynarmic/backend/loongarch64/lagoon_cpp.h"
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
|
||||||
#include "dynarmic/backend/loongarch64/code_block.h"
|
#include "dynarmic/backend/loongarch64/code_block.h"
|
||||||
#include "dynarmic/backend/loongarch64/emit_loongarch64.h"
|
#include "dynarmic/backend/loongarch64/emit_loongarch64.h"
|
||||||
@@ -53,8 +53,8 @@ private:
|
|||||||
const A32::UserConfig conf;
|
const A32::UserConfig conf;
|
||||||
CodeBlock cb;
|
CodeBlock cb;
|
||||||
|
|
||||||
ankerl::unordered_dense::map<u64, CodePtr> block_entries;
|
::Common::unordered_map<u64, CodePtr> block_entries;
|
||||||
ankerl::unordered_dense::map<u64, EmittedBlockInfo> block_infos;
|
::Common::unordered_map<u64, EmittedBlockInfo> block_infos;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct PreludeInfo {
|
struct PreludeInfo {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "dynarmic/backend/loongarch64/lagoon_cpp.h"
|
#include "dynarmic/backend/loongarch64/lagoon_cpp.h"
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <biscuit/assembler.hpp>
|
#include <biscuit/assembler.hpp>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
|
||||||
#include "dynarmic/backend/riscv64/code_block.h"
|
#include "dynarmic/backend/riscv64/code_block.h"
|
||||||
#include "dynarmic/backend/riscv64/emit_riscv64.h"
|
#include "dynarmic/backend/riscv64/emit_riscv64.h"
|
||||||
@@ -74,8 +74,8 @@ private:
|
|||||||
CodeBlock cb;
|
CodeBlock cb;
|
||||||
biscuit::Assembler as;
|
biscuit::Assembler as;
|
||||||
|
|
||||||
ankerl::unordered_dense::map<u64, CodePtr> block_entries;
|
::Common::unordered_map<u64, CodePtr> block_entries;
|
||||||
ankerl::unordered_dense::map<u64, EmittedBlockInfo> block_infos;
|
::Common::unordered_map<u64, EmittedBlockInfo> block_infos;
|
||||||
|
|
||||||
struct PreludeInfo {
|
struct PreludeInfo {
|
||||||
CodePtr end_of_prelude;
|
CodePtr end_of_prelude;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "dynarmic/mcl/is_instance_of_template.hpp"
|
#include "dynarmic/mcl/is_instance_of_template.hpp"
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
|
||||||
#include "dynarmic/backend/riscv64/stack_layout.h"
|
#include "dynarmic/backend/riscv64/stack_layout.h"
|
||||||
#include "dynarmic/ir/cond.h"
|
#include "dynarmic/ir/cond.h"
|
||||||
|
|||||||
@@ -13,7 +13,8 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
#include "common/container/unordered_set.h"
|
||||||
|
|
||||||
#include "dynarmic/backend/block_range_information.h"
|
#include "dynarmic/backend/block_range_information.h"
|
||||||
#include "dynarmic/backend/x64/a32_jitstate.h"
|
#include "dynarmic/backend/x64/a32_jitstate.h"
|
||||||
@@ -126,11 +127,11 @@ public:
|
|||||||
RegAlloc reg_alloc; //reusable reg alloc
|
RegAlloc reg_alloc; //reusable reg alloc
|
||||||
BlockRangeInformation<u32> block_ranges;
|
BlockRangeInformation<u32> block_ranges;
|
||||||
std::array<FastDispatchEntry, fast_dispatch_table_size> fast_dispatch_table;
|
std::array<FastDispatchEntry, fast_dispatch_table_size> fast_dispatch_table;
|
||||||
ankerl::unordered_dense::map<u64, FastmemPatchInfo> fastmem_patch_info;
|
::Common::unordered_map<u64, FastmemPatchInfo> fastmem_patch_info;
|
||||||
ankerl::unordered_dense::map<std::tuple<bool, size_t, int, int>, void (*)()> read_fallbacks;
|
::Common::unordered_map<std::tuple<bool, size_t, int, int>, void (*)()> read_fallbacks;
|
||||||
ankerl::unordered_dense::map<std::tuple<bool, size_t, int, int>, void (*)()> write_fallbacks;
|
::Common::unordered_map<std::tuple<bool, size_t, int, int>, void (*)()> write_fallbacks;
|
||||||
ankerl::unordered_dense::map<std::tuple<bool, size_t, int, int>, void (*)()> exclusive_write_fallbacks;
|
::Common::unordered_map<std::tuple<bool, size_t, int, int>, void (*)()> exclusive_write_fallbacks;
|
||||||
ankerl::unordered_dense::set<DoNotFastmemMarker> do_not_fastmem;
|
::Common::unordered_set<DoNotFastmemMarker> do_not_fastmem;
|
||||||
boost::container::stable_vector<Xbyak::Label> shared_labels;
|
boost::container::stable_vector<Xbyak::Label> shared_labels;
|
||||||
void (*memory_read_128)() = nullptr; // Dummy
|
void (*memory_read_128)() = nullptr; // Dummy
|
||||||
void (*memory_write_128)() = nullptr; // Dummy
|
void (*memory_write_128)() = nullptr; // Dummy
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
#include "common/container/unordered_set.h"
|
||||||
#include <boost/container/static_vector.hpp>
|
#include <boost/container/static_vector.hpp>
|
||||||
|
|
||||||
#include "dynarmic/backend/block_range_information.h"
|
#include "dynarmic/backend/block_range_information.h"
|
||||||
@@ -122,11 +123,11 @@ public:
|
|||||||
RegAlloc reg_alloc; //reusable reg alloc
|
RegAlloc reg_alloc; //reusable reg alloc
|
||||||
BlockRangeInformation<u64> block_ranges;
|
BlockRangeInformation<u64> block_ranges;
|
||||||
std::array<FastDispatchEntry, fast_dispatch_table_size> fast_dispatch_table;
|
std::array<FastDispatchEntry, fast_dispatch_table_size> fast_dispatch_table;
|
||||||
ankerl::unordered_dense::map<u64, FastmemPatchInfo> fastmem_patch_info;
|
::Common::unordered_map<u64, FastmemPatchInfo> fastmem_patch_info;
|
||||||
ankerl::unordered_dense::map<std::tuple<bool, size_t, int, int>, void (*)()> read_fallbacks;
|
::Common::unordered_map<std::tuple<bool, size_t, int, int>, void (*)()> read_fallbacks;
|
||||||
ankerl::unordered_dense::map<std::tuple<bool, size_t, int, int>, void (*)()> write_fallbacks;
|
::Common::unordered_map<std::tuple<bool, size_t, int, int>, void (*)()> write_fallbacks;
|
||||||
ankerl::unordered_dense::map<std::tuple<bool, size_t, int, int>, void (*)()> exclusive_write_fallbacks;
|
::Common::unordered_map<std::tuple<bool, size_t, int, int>, void (*)()> exclusive_write_fallbacks;
|
||||||
ankerl::unordered_dense::set<DoNotFastmemMarker> do_not_fastmem;
|
::Common::unordered_set<DoNotFastmemMarker> do_not_fastmem;
|
||||||
boost::container::stable_vector<Xbyak::Label> shared_labels;
|
boost::container::stable_vector<Xbyak::Label> shared_labels;
|
||||||
const void* terminal_handler_pop_rsb_hint = nullptr;
|
const void* terminal_handler_pop_rsb_hint = nullptr;
|
||||||
const void* terminal_handler_fast_dispatch_hint = nullptr;
|
const void* terminal_handler_fast_dispatch_hint = nullptr;
|
||||||
|
|||||||
@@ -76,57 +76,34 @@ void ProtectMemory(const void* base, size_t size, bool is_executable) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
HostFeature GetHostFeatures() {
|
static const HostFeature features = []() {
|
||||||
HostFeature features = {};
|
HostFeature f{};
|
||||||
#ifdef DYNARMIC_ENABLE_CPU_FEATURE_DETECTION
|
#ifdef DYNARMIC_ENABLE_CPU_FEATURE_DETECTION
|
||||||
using Cpu = Xbyak::util::Cpu;
|
using Cpu = Xbyak::util::Cpu;
|
||||||
Xbyak::util::Cpu cpu_info{};
|
Xbyak::util::Cpu cpu_info{};
|
||||||
if (cpu_info.has(Cpu::tSSSE3))
|
if (cpu_info.has(Cpu::tSSSE3)) f |= HostFeature::SSSE3;
|
||||||
features |= HostFeature::SSSE3;
|
if (cpu_info.has(Cpu::tSSE41)) f |= HostFeature::SSE41;
|
||||||
if (cpu_info.has(Cpu::tSSE41))
|
if (cpu_info.has(Cpu::tSSE42)) f |= HostFeature::SSE42;
|
||||||
features |= HostFeature::SSE41;
|
if (cpu_info.has(Cpu::tAVX)) f |= HostFeature::AVX;
|
||||||
if (cpu_info.has(Cpu::tSSE42))
|
if (cpu_info.has(Cpu::tAVX2)) f |= HostFeature::AVX2;
|
||||||
features |= HostFeature::SSE42;
|
if (cpu_info.has(Cpu::tAVX512F)) f |= HostFeature::AVX512F;
|
||||||
if (cpu_info.has(Cpu::tAVX))
|
if (cpu_info.has(Cpu::tAVX512CD)) f |= HostFeature::AVX512CD;
|
||||||
features |= HostFeature::AVX;
|
if (cpu_info.has(Cpu::tAVX512VL)) f |= HostFeature::AVX512VL;
|
||||||
if (cpu_info.has(Cpu::tAVX2))
|
if (cpu_info.has(Cpu::tAVX512BW)) f |= HostFeature::AVX512BW;
|
||||||
features |= HostFeature::AVX2;
|
if (cpu_info.has(Cpu::tAVX512DQ)) f |= HostFeature::AVX512DQ;
|
||||||
if (cpu_info.has(Cpu::tAVX512F))
|
if (cpu_info.has(Cpu::tAVX512_BITALG)) f |= HostFeature::AVX512BITALG;
|
||||||
features |= HostFeature::AVX512F;
|
if (cpu_info.has(Cpu::tAVX512VBMI)) f |= HostFeature::AVX512VBMI;
|
||||||
if (cpu_info.has(Cpu::tAVX512CD))
|
if (cpu_info.has(Cpu::tPCLMULQDQ)) f |= HostFeature::PCLMULQDQ;
|
||||||
features |= HostFeature::AVX512CD;
|
if (cpu_info.has(Cpu::tF16C)) f |= HostFeature::F16C;
|
||||||
if (cpu_info.has(Cpu::tAVX512VL))
|
if (cpu_info.has(Cpu::tFMA)) f |= HostFeature::FMA;
|
||||||
features |= HostFeature::AVX512VL;
|
if (cpu_info.has(Cpu::tAESNI)) f |= HostFeature::AES;
|
||||||
if (cpu_info.has(Cpu::tAVX512BW))
|
if (cpu_info.has(Cpu::tSHA)) f |= HostFeature::SHA;
|
||||||
features |= HostFeature::AVX512BW;
|
if (cpu_info.has(Cpu::tPOPCNT)) f |= HostFeature::POPCNT;
|
||||||
if (cpu_info.has(Cpu::tAVX512DQ))
|
if (cpu_info.has(Cpu::tBMI1)) f |= HostFeature::BMI1;
|
||||||
features |= HostFeature::AVX512DQ;
|
if (cpu_info.has(Cpu::tBMI2)) f |= HostFeature::BMI2;
|
||||||
if (cpu_info.has(Cpu::tAVX512_BITALG))
|
if (cpu_info.has(Cpu::tLZCNT)) f |= HostFeature::LZCNT;
|
||||||
features |= HostFeature::AVX512BITALG;
|
if (cpu_info.has(Cpu::tGFNI)) f |= HostFeature::GFNI;
|
||||||
if (cpu_info.has(Cpu::tAVX512VBMI))
|
if (cpu_info.has(Cpu::tWAITPKG)) f |= HostFeature::WAITPKG;
|
||||||
features |= HostFeature::AVX512VBMI;
|
|
||||||
if (cpu_info.has(Cpu::tPCLMULQDQ))
|
|
||||||
features |= HostFeature::PCLMULQDQ;
|
|
||||||
if (cpu_info.has(Cpu::tF16C))
|
|
||||||
features |= HostFeature::F16C;
|
|
||||||
if (cpu_info.has(Cpu::tFMA))
|
|
||||||
features |= HostFeature::FMA;
|
|
||||||
if (cpu_info.has(Cpu::tAESNI))
|
|
||||||
features |= HostFeature::AES;
|
|
||||||
if (cpu_info.has(Cpu::tSHA))
|
|
||||||
features |= HostFeature::SHA;
|
|
||||||
if (cpu_info.has(Cpu::tPOPCNT))
|
|
||||||
features |= HostFeature::POPCNT;
|
|
||||||
if (cpu_info.has(Cpu::tBMI1))
|
|
||||||
features |= HostFeature::BMI1;
|
|
||||||
if (cpu_info.has(Cpu::tBMI2))
|
|
||||||
features |= HostFeature::BMI2;
|
|
||||||
if (cpu_info.has(Cpu::tLZCNT))
|
|
||||||
features |= HostFeature::LZCNT;
|
|
||||||
if (cpu_info.has(Cpu::tGFNI))
|
|
||||||
features |= HostFeature::GFNI;
|
|
||||||
if (cpu_info.has(Cpu::tWAITPKG))
|
|
||||||
features |= HostFeature::WAITPKG;
|
|
||||||
if (cpu_info.has(Cpu::tBMI2)) {
|
if (cpu_info.has(Cpu::tBMI2)) {
|
||||||
// BMI2 instructions such as pdep and pext have been very slow up until Zen 3.
|
// BMI2 instructions such as pdep and pext have been very slow up until Zen 3.
|
||||||
// Check for Zen 3 or newer by its family (0x19).
|
// Check for Zen 3 or newer by its family (0x19).
|
||||||
@@ -138,12 +115,15 @@ HostFeature GetHostFeatures() {
|
|||||||
const u32 family_extended = mcl::bit::get_bits<20, 27>(data[0]);
|
const u32 family_extended = mcl::bit::get_bits<20, 27>(data[0]);
|
||||||
const u32 family = family_base + family_extended;
|
const u32 family = family_base + family_extended;
|
||||||
if (family >= 0x19)
|
if (family >= 0x19)
|
||||||
features |= HostFeature::FastBMI2;
|
f |= HostFeature::FastBMI2;
|
||||||
} else {
|
} else {
|
||||||
features |= HostFeature::FastBMI2;
|
f |= HostFeature::FastBMI2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return f;
|
||||||
#endif
|
#endif
|
||||||
|
}();
|
||||||
|
HostFeature GetHostFeatures() {
|
||||||
return features;
|
return features;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
#include "dynarmic/backend/x64/xbyak.h"
|
#include "dynarmic/backend/x64/xbyak.h"
|
||||||
|
|
||||||
namespace Dynarmic::Backend::X64 {
|
namespace Dynarmic::Backend::X64 {
|
||||||
@@ -43,7 +43,7 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ankerl::unordered_dense::map<ConstantT, void*, ConstantHash> constant_info;
|
::Common::unordered_map<ConstantT, void*, ConstantHash> constant_info;
|
||||||
std::span<ConstantT> pool;
|
std::span<ConstantT> pool;
|
||||||
std::size_t insertion_point;
|
std::size_t insertion_point;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,7 +14,8 @@
|
|||||||
#include <boost/variant/detail/apply_visitor_binary.hpp>
|
#include <boost/variant/detail/apply_visitor_binary.hpp>
|
||||||
#include "dynarmic/mcl/bit.hpp"
|
#include "dynarmic/mcl/bit.hpp"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
#include "common/container/unordered_set.h"
|
||||||
|
|
||||||
#include "dynarmic/backend/x64/block_of_code.h"
|
#include "dynarmic/backend/x64/block_of_code.h"
|
||||||
#include "dynarmic/backend/x64/nzcv_util.h"
|
#include "dynarmic/backend/x64/nzcv_util.h"
|
||||||
@@ -396,7 +397,7 @@ void EmitX64::ClearCache() {
|
|||||||
PerfMapClear();
|
PerfMapClear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmitX64::InvalidateBasicBlocks(const ankerl::unordered_dense::set<IR::LocationDescriptor>& locations) {
|
void EmitX64::InvalidateBasicBlocks(const ::Common::unordered_set<IR::LocationDescriptor>& locations) {
|
||||||
code.EnableWriting();
|
code.EnableWriting();
|
||||||
for (const auto& descriptor : locations) {
|
for (const auto& descriptor : locations) {
|
||||||
if (auto const it = block_descriptors.find(descriptor); it != block_descriptors.end()) {
|
if (auto const it = block_descriptors.find(descriptor); it != block_descriptors.end()) {
|
||||||
|
|||||||
@@ -16,7 +16,8 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
#include "common/container/unordered_set.h"
|
||||||
#include <boost/container/stable_vector.hpp>
|
#include <boost/container/stable_vector.hpp>
|
||||||
#include <boost/container/small_vector.hpp>
|
#include <boost/container/small_vector.hpp>
|
||||||
|
|
||||||
@@ -88,7 +89,7 @@ public:
|
|||||||
virtual void ClearCache();
|
virtual void ClearCache();
|
||||||
|
|
||||||
/// Invalidates a selection of basic blocks.
|
/// Invalidates a selection of basic blocks.
|
||||||
void InvalidateBasicBlocks(const ankerl::unordered_dense::set<IR::LocationDescriptor>& locations);
|
void InvalidateBasicBlocks(const ::Common::unordered_set<IR::LocationDescriptor>& locations);
|
||||||
|
|
||||||
//protected:
|
//protected:
|
||||||
// Microinstruction emitters
|
// Microinstruction emitters
|
||||||
@@ -131,8 +132,8 @@ public:
|
|||||||
// State
|
// State
|
||||||
BlockOfCode& code;
|
BlockOfCode& code;
|
||||||
ExceptionHandler exception_handler;
|
ExceptionHandler exception_handler;
|
||||||
ankerl::unordered_dense::map<IR::LocationDescriptor, BlockDescriptor> block_descriptors;
|
::Common::unordered_map<IR::LocationDescriptor, BlockDescriptor> block_descriptors;
|
||||||
ankerl::unordered_dense::map<IR::LocationDescriptor, PatchInformation> patch_information;
|
::Common::unordered_map<IR::LocationDescriptor, PatchInformation> patch_information;
|
||||||
|
|
||||||
// We need materialized protected members
|
// We need materialized protected members
|
||||||
friend class A64EmitX64;
|
friend class A64EmitX64;
|
||||||
|
|||||||
@@ -4,10 +4,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// You must ensure this matches with src/common/x64/xbyak.h on root dir
|
// You must ensure this matches with src/common/x64/xbyak.h on root dir
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
#include "common/container/unordered_set.h"
|
||||||
#include <boost/unordered_map.hpp>
|
#include <boost/unordered_map.hpp>
|
||||||
#define XBYAK_STD_UNORDERED_SET ankerl::unordered_dense::set
|
#define XBYAK_STD_UNORDERED_SET ::Common::unordered_set
|
||||||
#define XBYAK_STD_UNORDERED_MAP ankerl::unordered_dense::map
|
#define XBYAK_STD_UNORDERED_MAP ::Common::unordered_map
|
||||||
#define XBYAK_STD_UNORDERED_MULTIMAP boost::unordered_multimap
|
#define XBYAK_STD_UNORDERED_MULTIMAP boost::unordered_multimap
|
||||||
#include <xbyak/xbyak.h>
|
#include <xbyak/xbyak.h>
|
||||||
#include <xbyak/xbyak_util.h>
|
#include <xbyak/xbyak_util.h>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <bit>
|
#include <bit>
|
||||||
|
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
#include "boost/container/small_vector.hpp"
|
#include "boost/container/small_vector.hpp"
|
||||||
#include "dynarmic/frontend/A32/a32_ir_emitter.h"
|
#include "dynarmic/frontend/A32/a32_ir_emitter.h"
|
||||||
#include "dynarmic/frontend/A32/a32_location_descriptor.h"
|
#include "dynarmic/frontend/A32/a32_location_descriptor.h"
|
||||||
@@ -1433,7 +1433,7 @@ static void VerificationPass(const IR::Block& block) {
|
|||||||
ASSERT(IR::AreTypesCompatible(t1, t2));
|
ASSERT(IR::AreTypesCompatible(t1, t2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ankerl::unordered_dense::map<IR::Inst*, size_t> actual_uses;
|
::Common::unordered_map<IR::Inst*, size_t> actual_uses;
|
||||||
for (auto const& inst : block.instructions) {
|
for (auto const& inst : block.instructions) {
|
||||||
for (size_t i = 0; i < inst.NumArgs(); i++)
|
for (size_t i = 0; i < inst.NumArgs(); i++)
|
||||||
if (IR::Value const arg = inst.GetArg(i); !arg.IsImmediate())
|
if (IR::Value const arg = inst.GetArg(i); !arg.IsImmediate())
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
|
||||||
#include <catch2/catch_test_macros.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
@@ -23,7 +23,7 @@ namespace {
|
|||||||
class MyEnvironment final : public A64::UserCallbacks {
|
class MyEnvironment final : public A64::UserCallbacks {
|
||||||
public:
|
public:
|
||||||
u64 ticks_left = 0;
|
u64 ticks_left = 0;
|
||||||
ankerl::unordered_dense::map<u64, u8> memory{};
|
::Common::unordered_map<u64, u8> memory{};
|
||||||
|
|
||||||
u8 MemoryRead8(u64 vaddr) override {
|
u8 MemoryRead8(u64 vaddr) override {
|
||||||
return memory[vaddr];
|
return memory[vaddr];
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "dynarmic/interface/A64/a64.h"
|
#include "dynarmic/interface/A64/a64.h"
|
||||||
@@ -17,7 +17,7 @@ using Vector = Dynarmic::A64::Vector;
|
|||||||
|
|
||||||
class A64TestEnv : public Dynarmic::A64::UserCallbacks {
|
class A64TestEnv : public Dynarmic::A64::UserCallbacks {
|
||||||
public:
|
public:
|
||||||
ankerl::unordered_dense::map<u64, u8> modified_memory;
|
::Common::unordered_map<u64, u8> modified_memory;
|
||||||
std::vector<u32> code_mem;
|
std::vector<u32> code_mem;
|
||||||
u64 ticks_left = 0;
|
u64 ticks_left = 0;
|
||||||
u64 code_mem_start_address = 0;
|
u64 code_mem_start_address = 0;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ add_executable(dynarmic_tests
|
|||||||
A64/real_world.cpp
|
A64/real_world.cpp
|
||||||
A64/testenv.h
|
A64/testenv.h
|
||||||
)
|
)
|
||||||
target_link_libraries(dynarmic_tests PRIVATE merry::oaknut unordered_dense::unordered_dense)
|
target_link_libraries(dynarmic_tests PRIVATE merry::oaknut)
|
||||||
|
|
||||||
if (DYNARMIC_TESTS_USE_UNICORN)
|
if (DYNARMIC_TESTS_USE_UNICORN)
|
||||||
target_link_libraries(dynarmic_tests PRIVATE Unicorn::Unicorn)
|
target_link_libraries(dynarmic_tests PRIVATE Unicorn::Unicorn)
|
||||||
@@ -72,7 +72,7 @@ add_executable(dynarmic_print_info
|
|||||||
print_info.cpp
|
print_info.cpp
|
||||||
)
|
)
|
||||||
create_target_directory_groups(dynarmic_print_info)
|
create_target_directory_groups(dynarmic_print_info)
|
||||||
target_link_libraries(dynarmic_print_info PRIVATE dynarmic fmt::fmt unordered_dense::unordered_dense)
|
target_link_libraries(dynarmic_print_info PRIVATE dynarmic fmt::fmt)
|
||||||
if (BOOST_NO_HEADERS)
|
if (BOOST_NO_HEADERS)
|
||||||
target_link_libraries(dynarmic_print_info PRIVATE Boost::variant Boost::icl Boost::pool)
|
target_link_libraries(dynarmic_print_info PRIVATE Boost::variant Boost::icl Boost::pool)
|
||||||
else()
|
else()
|
||||||
@@ -93,7 +93,7 @@ add_executable(dynarmic_test_generator
|
|||||||
|
|
||||||
create_target_directory_groups(dynarmic_test_generator)
|
create_target_directory_groups(dynarmic_test_generator)
|
||||||
|
|
||||||
target_link_libraries(dynarmic_test_generator PRIVATE dynarmic fmt::fmt unordered_dense::unordered_dense)
|
target_link_libraries(dynarmic_test_generator PRIVATE dynarmic fmt::fmt)
|
||||||
if (BOOST_NO_HEADERS)
|
if (BOOST_NO_HEADERS)
|
||||||
target_link_libraries(dynarmic_test_generator PRIVATE Boost::variant Boost::icl Boost::pool)
|
target_link_libraries(dynarmic_test_generator PRIVATE Boost::variant Boost::icl Boost::pool)
|
||||||
else()
|
else()
|
||||||
@@ -110,7 +110,7 @@ add_executable(dynarmic_test_reader
|
|||||||
test_reader.cpp
|
test_reader.cpp
|
||||||
)
|
)
|
||||||
create_target_directory_groups(dynarmic_test_reader)
|
create_target_directory_groups(dynarmic_test_reader)
|
||||||
target_link_libraries(dynarmic_test_reader PRIVATE dynarmic fmt::fmt unordered_dense::unordered_dense)
|
target_link_libraries(dynarmic_test_reader PRIVATE dynarmic fmt::fmt)
|
||||||
if (BOOST_NO_HEADERS)
|
if (BOOST_NO_HEADERS)
|
||||||
target_link_libraries(dynarmic_test_reader PRIVATE Boost::variant Boost::icl Boost::pool)
|
target_link_libraries(dynarmic_test_reader PRIVATE Boost::variant Boost::icl Boost::pool)
|
||||||
else()
|
else()
|
||||||
@@ -123,7 +123,7 @@ target_compile_definitions(dynarmic_test_reader PRIVATE FMT_USE_USER_DEFINED_LIT
|
|||||||
#
|
#
|
||||||
create_target_directory_groups(dynarmic_tests)
|
create_target_directory_groups(dynarmic_tests)
|
||||||
|
|
||||||
target_link_libraries(dynarmic_tests PRIVATE dynarmic Catch2::Catch2WithMain fmt::fmt unordered_dense::unordered_dense)
|
target_link_libraries(dynarmic_tests PRIVATE dynarmic Catch2::Catch2WithMain fmt::fmt)
|
||||||
if (BOOST_NO_HEADERS)
|
if (BOOST_NO_HEADERS)
|
||||||
target_link_libraries(dynarmic_tests PRIVATE Boost::variant Boost::icl Boost::pool)
|
target_link_libraries(dynarmic_tests PRIVATE Boost::variant Boost::icl Boost::pool)
|
||||||
else()
|
else()
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
|
||||||
#include "common/common_funcs.h"
|
#include "common/common_funcs.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
@@ -185,7 +185,7 @@ private:
|
|||||||
|
|
||||||
mutable std::mutex mutex;
|
mutable std::mutex mutex;
|
||||||
mutable std::mutex callback_mutex;
|
mutable std::mutex callback_mutex;
|
||||||
ankerl::unordered_dense::map<int, ConsoleUpdateCallback> callback_list;
|
::Common::unordered_map<int, ConsoleUpdateCallback> callback_list;
|
||||||
int last_callback_key = 0;
|
int last_callback_key = 0;
|
||||||
|
|
||||||
// Stores the current status of all console input
|
// Stores the current status of all console input
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/input.h"
|
#include "common/input.h"
|
||||||
@@ -636,7 +636,7 @@ private:
|
|||||||
ControllerMotionDevices virtual_motion_devices;
|
ControllerMotionDevices virtual_motion_devices;
|
||||||
|
|
||||||
mutable std::mutex callback_mutex;
|
mutable std::mutex callback_mutex;
|
||||||
ankerl::unordered_dense::map<int, ControllerUpdateCallback> callback_list;
|
::Common::unordered_map<int, ControllerUpdateCallback> callback_list;
|
||||||
int last_callback_key = 0;
|
int last_callback_key = 0;
|
||||||
|
|
||||||
// Stores the current status of all controller input
|
// Stores the current status of all controller input
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
@@ -205,7 +205,7 @@ private:
|
|||||||
|
|
||||||
mutable std::mutex mutex;
|
mutable std::mutex mutex;
|
||||||
mutable std::mutex callback_mutex;
|
mutable std::mutex callback_mutex;
|
||||||
ankerl::unordered_dense::map<int, InterfaceUpdateCallback> callback_list;
|
::Common::unordered_map<int, InterfaceUpdateCallback> callback_list;
|
||||||
int last_callback_key = 0;
|
int last_callback_key = 0;
|
||||||
|
|
||||||
// Stores the current status of all external device input
|
// Stores the current status of all external device input
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public:
|
|||||||
Common::Input::ButtonNames GetUIName(const Common::ParamPackage& params) const override;
|
Common::Input::ButtonNames GetUIName(const Common::ParamPackage& params) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ankerl::unordered_dense::map<PadIdentifier, jobject> input_devices;
|
::Common::unordered_map<PadIdentifier, jobject> input_devices;
|
||||||
|
|
||||||
/// Returns the correct identifier corresponding to the player index
|
/// Returns the correct identifier corresponding to the player index
|
||||||
PadIdentifier GetIdentifier(const std::string& guid, size_t port) const;
|
PadIdentifier GetIdentifier(const std::string& guid, size_t port) const;
|
||||||
|
|||||||
@@ -732,7 +732,7 @@ SDLDriver::~SDLDriver() {
|
|||||||
|
|
||||||
std::vector<Common::ParamPackage> SDLDriver::GetInputDevices() const {
|
std::vector<Common::ParamPackage> SDLDriver::GetInputDevices() const {
|
||||||
std::vector<Common::ParamPackage> devices;
|
std::vector<Common::ParamPackage> devices;
|
||||||
ankerl::unordered_dense::map<int, std::shared_ptr<SDLJoystick>> joycon_pairs;
|
::Common::unordered_map<int, std::shared_ptr<SDLJoystick>> joycon_pairs;
|
||||||
for (const auto& [key, value] : joystick_map) {
|
for (const auto& [key, value] : joystick_map) {
|
||||||
for (const auto& joystick : value) {
|
for (const auto& joystick : value) {
|
||||||
if (!joystick->GetSDLJoystick()) {
|
if (!joystick->GetSDLJoystick()) {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ private:
|
|||||||
Common::SPSCQueue<VibrationRequest> vibration_queue;
|
Common::SPSCQueue<VibrationRequest> vibration_queue;
|
||||||
|
|
||||||
/// Map of GUID of a list of corresponding virtual Joysticks
|
/// Map of GUID of a list of corresponding virtual Joysticks
|
||||||
ankerl::unordered_dense::map<Common::UUID, std::vector<std::shared_ptr<SDLJoystick>>> joystick_map;
|
::Common::unordered_map<Common::UUID, std::vector<std::shared_ptr<SDLJoystick>>> joystick_map;
|
||||||
std::mutex joystick_map_mutex;
|
std::mutex joystick_map_mutex;
|
||||||
|
|
||||||
bool start_thread = false;
|
bool start_thread = false;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/input.h"
|
#include "common/input.h"
|
||||||
@@ -270,10 +270,10 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
struct ControllerData {
|
struct ControllerData {
|
||||||
ankerl::unordered_dense::map<int, bool> buttons;
|
::Common::unordered_map<int, bool> buttons;
|
||||||
ankerl::unordered_dense::map<int, u8> hat_buttons;
|
::Common::unordered_map<int, u8> hat_buttons;
|
||||||
ankerl::unordered_dense::map<int, float> axes;
|
::Common::unordered_map<int, float> axes;
|
||||||
ankerl::unordered_dense::map<int, BasicMotion> motions;
|
::Common::unordered_map<int, BasicMotion> motions;
|
||||||
Common::Input::BatteryLevel battery{};
|
Common::Input::BatteryLevel battery{};
|
||||||
Common::Input::BodyColorStatus color{};
|
Common::Input::BodyColorStatus color{};
|
||||||
Common::Input::CameraStatus camera{};
|
Common::Input::CameraStatus camera{};
|
||||||
@@ -301,8 +301,8 @@ private:
|
|||||||
bool configuring{false};
|
bool configuring{false};
|
||||||
const std::string input_engine;
|
const std::string input_engine;
|
||||||
int last_callback_key = 0;
|
int last_callback_key = 0;
|
||||||
ankerl::unordered_dense::map<PadIdentifier, ControllerData> controller_list;
|
::Common::unordered_map<PadIdentifier, ControllerData> controller_list;
|
||||||
ankerl::unordered_dense::map<int, InputIdentifier> callback_list;
|
::Common::unordered_map<int, InputIdentifier> callback_list;
|
||||||
MappingCallback mapping_callback;
|
MappingCallback mapping_callback;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
@@ -56,9 +56,9 @@ enum class InputType { None, Button, Stick, Motion, Touch };
|
|||||||
* Given a ParamPackage for a Device returned from `GetInputDevices`, attempt to get the default
|
* Given a ParamPackage for a Device returned from `GetInputDevices`, attempt to get the default
|
||||||
* mapping for the device.
|
* mapping for the device.
|
||||||
*/
|
*/
|
||||||
using AnalogMapping = ankerl::unordered_dense::map<Settings::NativeAnalog::Values, Common::ParamPackage>;
|
using AnalogMapping = ::Common::unordered_map<Settings::NativeAnalog::Values, Common::ParamPackage>;
|
||||||
using ButtonMapping = ankerl::unordered_dense::map<Settings::NativeButton::Values, Common::ParamPackage>;
|
using ButtonMapping = ::Common::unordered_map<Settings::NativeButton::Values, Common::ParamPackage>;
|
||||||
using MotionMapping = ankerl::unordered_dense::map<Settings::NativeMotion::Values, Common::ParamPackage>;
|
using MotionMapping = ::Common::unordered_map<Settings::NativeMotion::Values, Common::ParamPackage>;
|
||||||
|
|
||||||
class InputSubsystem {
|
class InputSubsystem {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -217,7 +217,6 @@ add_library(shader_recompiler STATIC
|
|||||||
frontend/maxwell/translate_program.h
|
frontend/maxwell/translate_program.h
|
||||||
host_translate_info.h
|
host_translate_info.h
|
||||||
ir_opt/collect_shader_info_pass.cpp
|
ir_opt/collect_shader_info_pass.cpp
|
||||||
ir_opt/compaction_fallback_pass.cpp
|
|
||||||
ir_opt/conditional_barrier_pass.cpp
|
ir_opt/conditional_barrier_pass.cpp
|
||||||
ir_opt/constant_propagation_pass.cpp
|
ir_opt/constant_propagation_pass.cpp
|
||||||
ir_opt/dead_code_elimination_pass.cpp
|
ir_opt/dead_code_elimination_pass.cpp
|
||||||
|
|||||||
@@ -217,10 +217,6 @@ Id EmitShuffleIndex(EmitContext& ctx, IR::Inst* inst, Id value, Id index, Id cla
|
|||||||
|
|
||||||
Id EmitShuffleUp(EmitContext& ctx, IR::Inst* inst, Id value, Id index, Id clamp,
|
Id EmitShuffleUp(EmitContext& ctx, IR::Inst* inst, Id value, Id index, Id clamp,
|
||||||
Id segmentation_mask) {
|
Id segmentation_mask) {
|
||||||
if (!StageSupportsSubgroups(ctx)) {
|
|
||||||
SetInBoundsFlag(inst, ctx.false_value);
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
const Id thread_id{EmitLaneId(ctx)};
|
const Id thread_id{EmitLaneId(ctx)};
|
||||||
const Id max_thread_id{GetMaxThreadId(ctx, thread_id, clamp, segmentation_mask)};
|
const Id max_thread_id{GetMaxThreadId(ctx, thread_id, clamp, segmentation_mask)};
|
||||||
Id src_thread_id{ctx.OpISub(ctx.U32[1], thread_id, index)};
|
Id src_thread_id{ctx.OpISub(ctx.U32[1], thread_id, index)};
|
||||||
@@ -236,10 +232,6 @@ Id EmitShuffleUp(EmitContext& ctx, IR::Inst* inst, Id value, Id index, Id clamp,
|
|||||||
|
|
||||||
Id EmitShuffleDown(EmitContext& ctx, IR::Inst* inst, Id value, Id index, Id clamp,
|
Id EmitShuffleDown(EmitContext& ctx, IR::Inst* inst, Id value, Id index, Id clamp,
|
||||||
Id segmentation_mask) {
|
Id segmentation_mask) {
|
||||||
if (!StageSupportsSubgroups(ctx)) {
|
|
||||||
SetInBoundsFlag(inst, ctx.false_value);
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
const Id thread_id{EmitLaneId(ctx)};
|
const Id thread_id{EmitLaneId(ctx)};
|
||||||
const Id max_thread_id{GetMaxThreadId(ctx, thread_id, clamp, segmentation_mask)};
|
const Id max_thread_id{GetMaxThreadId(ctx, thread_id, clamp, segmentation_mask)};
|
||||||
Id src_thread_id{ctx.OpIAdd(ctx.U32[1], thread_id, index)};
|
Id src_thread_id{ctx.OpIAdd(ctx.U32[1], thread_id, index)};
|
||||||
@@ -255,10 +247,6 @@ Id EmitShuffleDown(EmitContext& ctx, IR::Inst* inst, Id value, Id index, Id clam
|
|||||||
|
|
||||||
Id EmitShuffleButterfly(EmitContext& ctx, IR::Inst* inst, Id value, Id index, Id clamp,
|
Id EmitShuffleButterfly(EmitContext& ctx, IR::Inst* inst, Id value, Id index, Id clamp,
|
||||||
Id segmentation_mask) {
|
Id segmentation_mask) {
|
||||||
if (!StageSupportsSubgroups(ctx)) {
|
|
||||||
SetInBoundsFlag(inst, ctx.false_value);
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
const Id thread_id{EmitLaneId(ctx)};
|
const Id thread_id{EmitLaneId(ctx)};
|
||||||
const Id max_thread_id{GetMaxThreadId(ctx, thread_id, clamp, segmentation_mask)};
|
const Id max_thread_id{GetMaxThreadId(ctx, thread_id, clamp, segmentation_mask)};
|
||||||
Id src_thread_id{ctx.OpBitwiseXor(ctx.U32[1], thread_id, index)};
|
Id src_thread_id{ctx.OpBitwiseXor(ctx.U32[1], thread_id, index)};
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
#include <sirit/sirit.h>
|
#include <sirit/sirit.h>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_set.h"
|
||||||
|
|
||||||
#include "shader_recompiler/backend/bindings.h"
|
#include "shader_recompiler/backend/bindings.h"
|
||||||
#include "shader_recompiler/frontend/ir/program.h"
|
#include "shader_recompiler/frontend/ir/program.h"
|
||||||
@@ -370,7 +370,7 @@ public:
|
|||||||
Id load_const_func_u32x4{};
|
Id load_const_func_u32x4{};
|
||||||
|
|
||||||
// Sirit::Id doesn't play nice with *::set<>
|
// Sirit::Id doesn't play nice with *::set<>
|
||||||
ankerl::unordered_dense::set<u32> non_uniform_ids;
|
::Common::unordered_set<u32> non_uniform_ids;
|
||||||
|
|
||||||
bool uses_nonuniform_sampled_image{};
|
bool uses_nonuniform_sampled_image{};
|
||||||
bool uses_nonuniform_storage_image{};
|
bool uses_nonuniform_storage_image{};
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "shader_recompiler/program_header.h"
|
#include "shader_recompiler/program_header.h"
|
||||||
@@ -126,9 +126,9 @@ protected:
|
|||||||
u32 start_address{};
|
u32 start_address{};
|
||||||
bool is_proprietary_driver{};
|
bool is_proprietary_driver{};
|
||||||
public:
|
public:
|
||||||
ankerl::unordered_dense::map<CbufWordKey, u32, CbufWordKeyHash> cbuf_word_cache;
|
::Common::unordered_map<CbufWordKey, u32, CbufWordKeyHash> cbuf_word_cache;
|
||||||
ankerl::unordered_dense::map<HandleKey, u32, HandleKeyHash> handle_cache;
|
::Common::unordered_map<HandleKey, u32, HandleKeyHash> handle_cache;
|
||||||
ankerl::unordered_dense::map<const IR::Inst*, ConstBufferAddr> track_cache;
|
::Common::unordered_map<const IR::Inst*, ConstBufferAddr> track_cache;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Shader
|
} // namespace Shader
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@@ -390,7 +390,7 @@ private:
|
|||||||
std::optional<Node> return_label) {
|
std::optional<Node> return_label) {
|
||||||
Statement* const false_stmt{pool.Create(Identity{}, IR::Condition{false}, &root_stmt)};
|
Statement* const false_stmt{pool.Create(Identity{}, IR::Condition{false}, &root_stmt)};
|
||||||
Tree& root{root_stmt.children};
|
Tree& root{root_stmt.children};
|
||||||
ankerl::unordered_dense::map<Flow::Block*, Node> local_labels;
|
::Common::unordered_map<Flow::Block*, Node> local_labels;
|
||||||
local_labels.reserve(function.blocks.size());
|
local_labels.reserve(function.blocks.size());
|
||||||
|
|
||||||
for (Flow::Block& block : function.blocks) {
|
for (Flow::Block& block : function.blocks) {
|
||||||
|
|||||||
@@ -299,7 +299,6 @@ IR::Program TranslateProgram(ObjectPool<IR::Inst>& inst_pool, ObjectPool<IR::Blo
|
|||||||
Optimization::PositionPass(env, program);
|
Optimization::PositionPass(env, program);
|
||||||
|
|
||||||
Optimization::GlobalMemoryToStorageBufferPass(program, normalized_host_info);
|
Optimization::GlobalMemoryToStorageBufferPass(program, normalized_host_info);
|
||||||
Optimization::CompactionFallbackPass(program, normalized_host_info);
|
|
||||||
Optimization::TexturePass(env, program, normalized_host_info);
|
Optimization::TexturePass(env, program, normalized_host_info);
|
||||||
|
|
||||||
if (Settings::values.resolution_info.active || Settings::values.rescale_hack.GetValue()) {
|
if (Settings::values.resolution_info.active || Settings::values.rescale_hack.GetValue()) {
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ struct HostTranslateInfo {
|
|||||||
///< passthrough shaders
|
///< passthrough shaders
|
||||||
bool support_conditional_barrier{}; ///< True when the device supports barriers in conditional
|
bool support_conditional_barrier{}; ///< True when the device supports barriers in conditional
|
||||||
///< control flow
|
///< control flow
|
||||||
bool support_subgroup_in_geometry_stage{};
|
|
||||||
|
|
||||||
void ApplyDescriptorLimitPolicy() noexcept {
|
void ApplyDescriptorLimitPolicy() noexcept {
|
||||||
if (min_ssbo_alignment == 0) {
|
if (min_ssbo_alignment == 0) {
|
||||||
|
|||||||
@@ -1,71 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
#include "shader_recompiler/frontend/ir/ir_emitter.h"
|
|
||||||
#include "shader_recompiler/host_translate_info.h"
|
|
||||||
#include "shader_recompiler/ir_opt/passes.h"
|
|
||||||
|
|
||||||
namespace Shader::Optimization {
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
constexpr int MAX_BALLOT_SEARCH_DEPTH = 8;
|
|
||||||
|
|
||||||
bool DependsOnSubgroupBallot(const IR::Value& value, int depth) {
|
|
||||||
if (depth > MAX_BALLOT_SEARCH_DEPTH || value.IsImmediate()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
IR::Inst* const producer{value.Inst()};
|
|
||||||
if (producer->GetOpcode() == IR::Opcode::SubgroupBallot) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (producer->GetOpcode() == IR::Opcode::Phi) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const size_t num_args{producer->NumArgs()};
|
|
||||||
for (size_t index = 0; index < num_args; ++index) {
|
|
||||||
if (DependsOnSubgroupBallot(producer->Arg(index), depth + 1)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RewriteAtomic(IR::Block& block, IR::Inst& inst) {
|
|
||||||
const auto insert_point{IR::Block::InstructionList::s_iterator_to(inst)};
|
|
||||||
IR::IREmitter ir{block, insert_point};
|
|
||||||
|
|
||||||
const IR::U32 amount{inst.Arg(2)};
|
|
||||||
const IR::U32 primitive_id{ir.GetAttributeU32(IR::Attribute::PrimitiveId)};
|
|
||||||
const IR::U1 reserves_slot{ir.INotEqual(amount, ir.Imm32(0u))};
|
|
||||||
const IR::U32 slot_end{ir.IAdd(primitive_id, ir.Imm32(1u))};
|
|
||||||
const IR::U32 high_water{IR::U32{ir.Select(reserves_slot, slot_end, ir.Imm32(0u))}};
|
|
||||||
|
|
||||||
block.PrependNewInst(insert_point, IR::Opcode::StorageAtomicUMax32,
|
|
||||||
{inst.Arg(0), inst.Arg(1), high_water});
|
|
||||||
|
|
||||||
inst.ReplaceUsesWith(primitive_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // Anonymous namespace
|
|
||||||
|
|
||||||
void CompactionFallbackPass(IR::Program& program, const HostTranslateInfo& host_info) {
|
|
||||||
if (program.stage != Stage::Geometry || host_info.support_subgroup_in_geometry_stage) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (IR::Block* const block : program.post_order_blocks) {
|
|
||||||
for (IR::Inst& inst : block->Instructions()) {
|
|
||||||
if (inst.GetOpcode() != IR::Opcode::StorageAtomicIAdd32) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!inst.HasUses()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!DependsOnSubgroupBallot(inst.Arg(2), 0)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
RewriteAtomic(*block, inst);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Shader::Optimization
|
|
||||||
@@ -1,6 +1,3 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
@@ -16,7 +13,6 @@ struct HostTranslateInfo;
|
|||||||
namespace Shader::Optimization {
|
namespace Shader::Optimization {
|
||||||
|
|
||||||
void CollectShaderInfoPass(Environment& env, IR::Program& program);
|
void CollectShaderInfoPass(Environment& env, IR::Program& program);
|
||||||
void CompactionFallbackPass(IR::Program& program, const HostTranslateInfo& host_info);
|
|
||||||
void ConditionalBarrierPass(IR::Program& program);
|
void ConditionalBarrierPass(IR::Program& program);
|
||||||
void ConstantPropagationPass(Environment& env, IR::Program& program);
|
void ConstantPropagationPass(Environment& env, IR::Program& program);
|
||||||
void DeadCodeEliminationPass(IR::Program& program);
|
void DeadCodeEliminationPass(IR::Program& program);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#include <deque>
|
#include <deque>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <span>
|
#include <span>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
#include <variant>
|
#include <variant>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <bit>
|
#include <bit>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include "common/container/unordered_map.h"
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <boost/container/small_vector.hpp>
|
#include <boost/container/small_vector.hpp>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user