mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-01 10:52:26 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bda8ba61d6 | |||
| 9443c1590b | |||
| da71711bed | |||
| d3b6283f4f | |||
| 858f9e5aea | |||
| e53e76168c |
+102
-65
@@ -552,7 +552,6 @@ macro(parse_object object)
|
|||||||
get_json_element("${object}" repo repo)
|
get_json_element("${object}" repo repo)
|
||||||
get_json_element("${object}" ci ci OFF)
|
get_json_element("${object}" ci ci OFF)
|
||||||
get_json_element("${object}" version version)
|
get_json_element("${object}" version version)
|
||||||
get_json_element("${object}" min_version min_version)
|
|
||||||
get_json_element("${object}" git_host git_host "github.com")
|
get_json_element("${object}" git_host git_host "github.com")
|
||||||
|
|
||||||
if (NOT version)
|
if (NOT version)
|
||||||
@@ -571,8 +570,8 @@ macro(parse_object object)
|
|||||||
set(disabled_platforms "")
|
set(disabled_platforms "")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
# TODO: correct hash if missing
|
|
||||||
get_json_element("${object}" hash hash)
|
get_json_element("${object}" hash hash)
|
||||||
|
get_json_element("${object}" min_version min_version)
|
||||||
get_json_element("${object}" url url)
|
get_json_element("${object}" url url)
|
||||||
get_json_element("${object}" artifact artifact)
|
get_json_element("${object}" artifact artifact)
|
||||||
get_json_element("${object}" source_subdir source_subdir)
|
get_json_element("${object}" source_subdir source_subdir)
|
||||||
@@ -945,8 +944,8 @@ function(AddCIPackage)
|
|||||||
REPO
|
REPO
|
||||||
PACKAGE
|
PACKAGE
|
||||||
EXTENSION
|
EXTENSION
|
||||||
MIN_VERSION
|
GIT_HOST
|
||||||
GIT_HOST)
|
PKGNAME)
|
||||||
|
|
||||||
set(multiValueArgs DISABLED_PLATFORMS)
|
set(multiValueArgs DISABLED_PLATFORMS)
|
||||||
|
|
||||||
@@ -996,9 +995,104 @@ function(AddCIPackage)
|
|||||||
set(ARTIFACT_REPO ${PKG_ARGS_REPO})
|
set(ARTIFACT_REPO ${PKG_ARGS_REPO})
|
||||||
set(ARTIFACT_PACKAGE ${PKG_ARGS_PACKAGE})
|
set(ARTIFACT_PACKAGE ${PKG_ARGS_PACKAGE})
|
||||||
|
|
||||||
# TODO: Use amd64/aarch64 naming for everything.
|
# plat/archname
|
||||||
# Also drop macos universal
|
if (DEFINED PKG_ARGS_PKGNAME)
|
||||||
|
set(pkgname ${PKG_ARGS_PKGNAME})
|
||||||
|
else()
|
||||||
|
if (MSVC)
|
||||||
|
set(platname windows)
|
||||||
|
elseif(MINGW)
|
||||||
|
set(platname mingw)
|
||||||
|
elseif(ANDROID)
|
||||||
|
set(platname android)
|
||||||
|
elseif(LINUX)
|
||||||
|
set(platname linux)
|
||||||
|
elseif(IOS)
|
||||||
|
set(platname ios)
|
||||||
|
elseif(APPLE)
|
||||||
|
set(platname macos)
|
||||||
|
else()
|
||||||
|
cpm_utils_message(WARNING
|
||||||
|
"Unsupported platform ${CMAKE_SYSTEM_NAME} for CI packages")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (CPMUTIL_AMD64)
|
||||||
|
set(archname amd64)
|
||||||
|
elseif(CPMUTIL_ARM64)
|
||||||
|
set(archname aarch64)
|
||||||
|
elseif(CPMUTIL_RISCV64)
|
||||||
|
set(archname riscv64)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (APPLE AND NOT CPMUTIL_ARM64)
|
||||||
|
cpm_utils_message(WARNING
|
||||||
|
"Unsupported platform/arch combo for CI packages")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (DEFINED platname AND DEFINED archname)
|
||||||
|
set(pkgname ${platname}-${archname})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (DEFINED pkgname
|
||||||
|
AND NOT "${pkgname}" IN_LIST DISABLED_PLATFORMS)
|
||||||
|
set(ARTIFACT
|
||||||
|
"${ARTIFACT_NAME}-${pkgname}-${ARTIFACT_VERSION}.${ARTIFACT_EXT}")
|
||||||
|
|
||||||
|
if (PKG_ARGS_MODULE_PATH)
|
||||||
|
set(EXTRA_ARGS MODULE_PATH)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# download sha512sum file
|
||||||
|
# TODO: CI pkgs
|
||||||
|
set(sha512sum_url
|
||||||
|
"https://${ARTIFACT_GIT_HOST}/${ARTIFACT_REPO}/releases/download/${ARTIFACT_VERSION}/${ARTIFACT}.sha512sum")
|
||||||
|
set(sha512sum_file
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/.cpmutil_${ARTIFACT}_sha512sum")
|
||||||
|
|
||||||
|
file(DOWNLOAD "${sha512sum_url}" "${sha512sum_file}"
|
||||||
|
STATUS sha512sum_status)
|
||||||
|
list(GET sha512sum_status 0 sha512sum_error)
|
||||||
|
|
||||||
|
if(sha512sum_error)
|
||||||
|
message(FATAL_ERROR "[CPMUtil] Failed to download sha512sum "
|
||||||
|
"for ${ARTIFACT_NAME} from ${sha512sum_url}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(READ "${sha512sum_file}" sha512sum_hash)
|
||||||
|
string(STRIP "${sha512sum_hash}" sha512sum_hash)
|
||||||
|
file(REMOVE "${sha512sum_file}")
|
||||||
|
|
||||||
|
AddPackage(
|
||||||
|
NAME ${ARTIFACT_PACKAGE}
|
||||||
|
REPO ${ARTIFACT_REPO}
|
||||||
|
VERSION ${ARTIFACT_VERSION}
|
||||||
|
ARTIFACT ${ARTIFACT}
|
||||||
|
CUSTOM_KEY "${ARTIFACT_VERSION}-${pkgname}"
|
||||||
|
HASH ${sha512sum_hash}
|
||||||
|
FORCE_BUNDLED_PACKAGE ON
|
||||||
|
${EXTRA_ARGS})
|
||||||
|
|
||||||
|
set(${ARTIFACT_PACKAGE}_ADDED TRUE PARENT_SCOPE)
|
||||||
|
Propagate(${ARTIFACT_PACKAGE}_SOURCE_DIR)
|
||||||
|
Propagate(CMAKE_PREFIX_PATH)
|
||||||
|
else()
|
||||||
|
cpm_utils_message(FATAL_ERROR "${ARTIFACT_NAME}:"
|
||||||
|
"Unsupported platform ${pkgname} for CI package")
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Utility function for Qt
|
||||||
|
function(AddQt repo version)
|
||||||
|
if (NOT DEFINED repo)
|
||||||
|
message(FATAL_ERROR "[CPMUtil] AddQt: repo is required")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT DEFINED version)
|
||||||
|
message(FATAL_ERROR "[CPMUtil] AddQt: version is required")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# TODO: update Qt
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
set(platname windows)
|
set(platname windows)
|
||||||
elseif(MINGW)
|
elseif(MINGW)
|
||||||
@@ -1035,64 +1129,6 @@ function(AddCIPackage)
|
|||||||
set(pkgname ${platname}-${archname})
|
set(pkgname ${platname}-${archname})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (DEFINED pkgname
|
|
||||||
AND NOT "${pkgname}" IN_LIST DISABLED_PLATFORMS)
|
|
||||||
set(ARTIFACT
|
|
||||||
"${ARTIFACT_NAME}-${pkgname}-${ARTIFACT_VERSION}.${ARTIFACT_EXT}")
|
|
||||||
|
|
||||||
if (PKG_ARGS_MODULE_PATH)
|
|
||||||
set(EXTRA_ARGS MODULE_PATH)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# download sha512sum file
|
|
||||||
# TODO: CI pkgs
|
|
||||||
set(sha512sum_url
|
|
||||||
"https://${ARTIFACT_GIT_HOST}/${ARTIFACT_REPO}/releases/download/v${ARTIFACT_VERSION}/${ARTIFACT}.sha512sum")
|
|
||||||
set(sha512sum_file
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/.cpmutil_${ARTIFACT}_sha512sum")
|
|
||||||
|
|
||||||
file(DOWNLOAD "${sha512sum_url}" "${sha512sum_file}"
|
|
||||||
STATUS sha512sum_status)
|
|
||||||
list(GET sha512sum_status 0 sha512sum_error)
|
|
||||||
|
|
||||||
if(sha512sum_error)
|
|
||||||
message(FATAL_ERROR "[CPMUtil] Failed to download sha512sum "
|
|
||||||
"for ${ARTIFACT_NAME} from ${sha512sum_url}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
file(READ "${sha512sum_file}" sha512sum_hash)
|
|
||||||
string(STRIP "${sha512sum_hash}" sha512sum_hash)
|
|
||||||
file(REMOVE "${sha512sum_file}")
|
|
||||||
|
|
||||||
AddPackage(
|
|
||||||
NAME ${ARTIFACT_PACKAGE}
|
|
||||||
REPO ${ARTIFACT_REPO}
|
|
||||||
VERSION "v${ARTIFACT_VERSION}"
|
|
||||||
ARTIFACT ${ARTIFACT}
|
|
||||||
CUSTOM_KEY "${ARTIFACT_VERSION}-${pkgname}"
|
|
||||||
HASH ${sha512sum_hash}
|
|
||||||
FORCE_BUNDLED_PACKAGE ON
|
|
||||||
${EXTRA_ARGS})
|
|
||||||
|
|
||||||
set(${ARTIFACT_PACKAGE}_ADDED TRUE PARENT_SCOPE)
|
|
||||||
Propagate(${ARTIFACT_PACKAGE}_SOURCE_DIR)
|
|
||||||
Propagate(CMAKE_PREFIX_PATH)
|
|
||||||
else()
|
|
||||||
cpm_utils_message(FATAL_ERROR "${ARTIFACT_NAME}:"
|
|
||||||
"Unsupported platform ${pkgname} for CI package")
|
|
||||||
endif()
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
# Utility function for Qt
|
|
||||||
function(AddQt repo version)
|
|
||||||
if (NOT DEFINED repo)
|
|
||||||
message(FATAL_ERROR "[CPMUtil] AddQt: repo is required")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT DEFINED version)
|
|
||||||
message(FATAL_ERROR "[CPMUtil] AddQt: version is required")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
AddCIPackage(
|
AddCIPackage(
|
||||||
NAME qt
|
NAME qt
|
||||||
PACKAGE Qt6
|
PACKAGE Qt6
|
||||||
@@ -1100,7 +1136,8 @@ function(AddQt repo version)
|
|||||||
REPO ${repo}
|
REPO ${repo}
|
||||||
DISABLED_PLATFORMS
|
DISABLED_PLATFORMS
|
||||||
android-x86_64 android-aarch64
|
android-x86_64 android-aarch64
|
||||||
MODULE_PATH)
|
MODULE_PATH
|
||||||
|
PKGNAME ${pkgname})
|
||||||
|
|
||||||
find_package(Qt6 REQUIRED PATHS ${Qt6_SOURCE_DIR} NO_DEFAULT_PATH)
|
find_package(Qt6 REQUIRED PATHS ${Qt6_SOURCE_DIR} NO_DEFAULT_PATH)
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<br>
|
<br>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<h4 align="center"><b>Eden</b> is a free and opensource (FOSS) Switch 1 emulator started by developer Camille LaVey.
|
<h4 align="center"><b>Eden</b> is a free and open-source (FOSS) Switch 1 emulator started by developer Camille LaVey.
|
||||||
<br>
|
<br>
|
||||||
Written in C++, with builds for Windows, Linux, macOS, Android, FreeBSD and more.
|
Written in C++, with builds for Windows, Linux, macOS, Android, FreeBSD and more.
|
||||||
</h4>
|
</h4>
|
||||||
|
|||||||
+12
-7
@@ -1,4 +1,12 @@
|
|||||||
{
|
{
|
||||||
|
"": {
|
||||||
|
"ci": true,
|
||||||
|
"hash": "9f50d993c39529e022ad456163de91ac5934e16faf8fc348f305355fc0a643c534f87ded707e11bd03bcbc0a1760bd20852b6533a67ac0558a078385181cb184",
|
||||||
|
"name": "SDL3",
|
||||||
|
"package": "SDL3",
|
||||||
|
"repo": "crueter-ci/SDL3",
|
||||||
|
"version": "3.4.14-1788231389-147a8ee32d"
|
||||||
|
},
|
||||||
"biscuit": {
|
"biscuit": {
|
||||||
"hash": "1229f345b014f7ca544dedb4edb3311e41ba736f9aa9a67f88b5f26f3c983288c6bb6cdedcfb0b8a02c63088a37e6a0d7ba97d9c2a4d721b213916327cffe28a",
|
"hash": "1229f345b014f7ca544dedb4edb3311e41ba736f9aa9a67f88b5f26f3c983288c6bb6cdedcfb0b8a02c63088a37e6a0d7ba97d9c2a4d721b213916327cffe28a",
|
||||||
"min_version": "0.9.1",
|
"min_version": "0.9.1",
|
||||||
@@ -79,11 +87,10 @@
|
|||||||
},
|
},
|
||||||
"ffmpeg-ci": {
|
"ffmpeg-ci": {
|
||||||
"ci": true,
|
"ci": true,
|
||||||
"min_version": "4.1",
|
|
||||||
"name": "ffmpeg",
|
"name": "ffmpeg",
|
||||||
"package": "FFmpeg",
|
"package": "FFmpeg",
|
||||||
"repo": "crueter-ci/FFmpeg",
|
"repo": "crueter-ci/FFmpeg",
|
||||||
"version": "8.0.1-c7b5f1537d"
|
"version": "9.0.1-1788120736-bf1b838f2a"
|
||||||
},
|
},
|
||||||
"fmt": {
|
"fmt": {
|
||||||
"hash": "f0da82c545b01692e9fd30fdfb613dbb8dd9716983dcd0ff19ac2a8d36f74beb5540ef38072fdecc1e34191b3682a8542ecbf3a61ef287dbba0a2679d4e023f2",
|
"hash": "f0da82c545b01692e9fd30fdfb613dbb8dd9716983dcd0ff19ac2a8d36f74beb5540ef38072fdecc1e34191b3682a8542ecbf3a61ef287dbba0a2679d4e023f2",
|
||||||
@@ -197,11 +204,10 @@
|
|||||||
},
|
},
|
||||||
"openssl-ci": {
|
"openssl-ci": {
|
||||||
"ci": true,
|
"ci": true,
|
||||||
"min_version": "3.0.0",
|
|
||||||
"name": "openssl",
|
"name": "openssl",
|
||||||
"package": "OpenSSL",
|
"package": "OpenSSL",
|
||||||
"repo": "crueter-ci/OpenSSL",
|
"repo": "crueter-ci/OpenSSL",
|
||||||
"version": "4.0.0-11b7b6ea3b"
|
"version": "4.0.1-1788234794-b64f68a94e"
|
||||||
},
|
},
|
||||||
"openssl-cmake": {
|
"openssl-cmake": {
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
@@ -255,11 +261,10 @@
|
|||||||
},
|
},
|
||||||
"sdl3-ci": {
|
"sdl3-ci": {
|
||||||
"ci": true,
|
"ci": true,
|
||||||
"min_version": "3.2.10",
|
|
||||||
"name": "SDL3",
|
"name": "SDL3",
|
||||||
"package": "SDL3",
|
"package": "SDL3",
|
||||||
"repo": "crueter-ci/SDL3",
|
"repo": "crueter-ci/SDL3",
|
||||||
"version": "3.4.8-d57c3b685c"
|
"version": "3.4.14-1788231389-147a8ee32d"
|
||||||
},
|
},
|
||||||
"simpleini": {
|
"simpleini": {
|
||||||
"find_args": "MODULE",
|
"find_args": "MODULE",
|
||||||
@@ -282,7 +287,7 @@
|
|||||||
"name": "sirit",
|
"name": "sirit",
|
||||||
"package": "sirit",
|
"package": "sirit",
|
||||||
"repo": "eden-emulator/sirit",
|
"repo": "eden-emulator/sirit",
|
||||||
"version": "1.0.5"
|
"version": "v1.0.7"
|
||||||
},
|
},
|
||||||
"spirv-headers": {
|
"spirv-headers": {
|
||||||
"hash": "d624371dd455c66a300344c89812598ffe11b5eedba555779f789e85c29dc67317741858c60e0744a1e6755cc0d2759b8659f0674f4cc31479c4cb6fc25ed23b",
|
"hash": "d624371dd455c66a300344c89812598ffe11b5eedba555779f789e85c29dc67317741858c60e0744a1e6755cc0d2759b8659f0674f4cc31479c4cb6fc25ed23b",
|
||||||
|
|||||||
Vendored
+8
-7
@@ -11,12 +11,12 @@ SPDX-License-Identifier: CC0-1.0
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<component type="desktop-application">
|
<component type="desktop-application">
|
||||||
<id>org.eden_emu.eden</id>
|
<id>dev.eden_emu.eden</id>
|
||||||
<metadata_license>CC0-1.0</metadata_license>
|
<metadata_license>CC0-1.0</metadata_license>
|
||||||
<name>eden</name>
|
<name>eden</name>
|
||||||
<summary>Nintendo Switch emulator</summary>
|
<summary>Nintendo Switch emulator</summary>
|
||||||
<description>
|
<description>
|
||||||
<p>Multiplatform FOSS Switch 1 emulator written in C++, derived from Yuzu and Sudachi</p>
|
<p>Eden is a free and open-source (FOSS) Switch 1 emulator started by developer Camille LaVey. Written in C++, with builds for Windows, Linux, macOS, Android, FreeBSD and more.</p>
|
||||||
</description>
|
</description>
|
||||||
<categories>
|
<categories>
|
||||||
<category>Game</category>
|
<category>Game</category>
|
||||||
@@ -28,14 +28,14 @@ SPDX-License-Identifier: CC0-1.0
|
|||||||
</keywords>
|
</keywords>
|
||||||
<url type="homepage">https://eden-emu.dev/</url>
|
<url type="homepage">https://eden-emu.dev/</url>
|
||||||
<url type="bugtracker">https://git.eden-emu.dev/eden-emu/eden/issues</url>
|
<url type="bugtracker">https://git.eden-emu.dev/eden-emu/eden/issues</url>
|
||||||
<url type="faq">https://eden-emu.dev/docs</url>
|
<url type="faq">https://eden-emu.dev/about</url>
|
||||||
<url type="help">https://eden-emu.dev/docs</url>
|
<url type="help">https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/user/README.md</url>
|
||||||
<url type="donation">https://eden-emu.dev/donations</url>
|
<url type="donation">https://liberapay.com/crueter</url>
|
||||||
<url type="translate">https://explore.transifex.com/edenemu/eden-emulator</url>
|
<url type="translate">https://explore.transifex.com/edenemu/eden-emulator</url>
|
||||||
<url type="contact">https://discord.gg/edenemu</url>
|
<url type="contact">https://discord.gg/HstXbPch7X</url>
|
||||||
<url type="vcs-browser">https://git.eden-emu.dev</url>
|
<url type="vcs-browser">https://git.eden-emu.dev</url>
|
||||||
<url type="contribute">https://git.eden-emu.dev/eden-emu/eden</url>
|
<url type="contribute">https://git.eden-emu.dev/eden-emu/eden</url>
|
||||||
<launchable type="desktop-id">org.eden_emu.eden.desktop</launchable>
|
<launchable type="desktop-id">dev.eden_emu.eden.desktop</launchable>
|
||||||
<provides>
|
<provides>
|
||||||
<binary>yuzu</binary>
|
<binary>yuzu</binary>
|
||||||
<binary>yuzu-cmd</binary>
|
<binary>yuzu-cmd</binary>
|
||||||
@@ -44,6 +44,7 @@ SPDX-License-Identifier: CC0-1.0
|
|||||||
<control>pointing</control>
|
<control>pointing</control>
|
||||||
<control>keyboard</control>
|
<control>keyboard</control>
|
||||||
<control>gamepad</control>
|
<control>gamepad</control>
|
||||||
|
<internet>offline-only</internet>
|
||||||
</supports>
|
</supports>
|
||||||
<requires>
|
<requires>
|
||||||
<memory>8192</memory>
|
<memory>8192</memory>
|
||||||
|
|||||||
Vendored
+4
-4
@@ -14,7 +14,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
|
|||||||
<mime-type type="application/x-nx-nro">
|
<mime-type type="application/x-nx-nro">
|
||||||
<comment>Nintendo Switch homebrew executable</comment>
|
<comment>Nintendo Switch homebrew executable</comment>
|
||||||
<acronym>NRO</acronym>
|
<acronym>NRO</acronym>
|
||||||
<icon name="org.eden_emu.eden"/>
|
<icon name="dev.eden_emu.eden"/>
|
||||||
<glob pattern="*.nro"/>
|
<glob pattern="*.nro"/>
|
||||||
<magic><match value="NRO" type="string" offset="16"/></magic>
|
<magic><match value="NRO" type="string" offset="16"/></magic>
|
||||||
</mime-type>
|
</mime-type>
|
||||||
@@ -22,7 +22,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
|
|||||||
<mime-type type="application/x-nx-nso">
|
<mime-type type="application/x-nx-nso">
|
||||||
<comment>Nintendo Switch homebrew executable</comment>
|
<comment>Nintendo Switch homebrew executable</comment>
|
||||||
<acronym>NSO</acronym>
|
<acronym>NSO</acronym>
|
||||||
<icon name="org.eden_emu.eden"/>
|
<icon name="dev.eden_emu.eden"/>
|
||||||
<glob pattern="*.nso"/>
|
<glob pattern="*.nso"/>
|
||||||
<magic><match value="NSO" type="string" offset="0"/></magic>
|
<magic><match value="NSO" type="string" offset="0"/></magic>
|
||||||
</mime-type>
|
</mime-type>
|
||||||
@@ -30,7 +30,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
|
|||||||
<mime-type type="application/x-nx-nsp">
|
<mime-type type="application/x-nx-nsp">
|
||||||
<comment>Nintendo Switch Package</comment>
|
<comment>Nintendo Switch Package</comment>
|
||||||
<acronym>NSP</acronym>
|
<acronym>NSP</acronym>
|
||||||
<icon name="org.eden_emu.eden"/>
|
<icon name="dev.eden_emu.eden"/>
|
||||||
<glob pattern="*.nsp"/>
|
<glob pattern="*.nsp"/>
|
||||||
<magic><match value="PFS" type="string" offset="0"/></magic>
|
<magic><match value="PFS" type="string" offset="0"/></magic>
|
||||||
</mime-type>
|
</mime-type>
|
||||||
@@ -38,7 +38,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
|
|||||||
<mime-type type="application/x-nx-xci">
|
<mime-type type="application/x-nx-xci">
|
||||||
<comment>Nintendo Switch Card Image</comment>
|
<comment>Nintendo Switch Card Image</comment>
|
||||||
<acronym>XCI</acronym>
|
<acronym>XCI</acronym>
|
||||||
<icon name="org.eden_emu.eden"/>
|
<icon name="dev.eden_emu.eden"/>
|
||||||
<glob pattern="*.xci"/>
|
<glob pattern="*.xci"/>
|
||||||
</mime-type>
|
</mime-type>
|
||||||
</mime-info>
|
</mime-info>
|
||||||
|
|||||||
Vendored
+3
-1
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
Qt has "Translation Rules for Plurals", small example
|
Qt has "Translation Rules for Plurals", small example
|
||||||
|
|
||||||
|
```cpp
|
||||||
// Take a source line like
|
// Take a source line like
|
||||||
tr("Building: %n shader(s)", "", i)
|
tr("Building: %n shader(s)", "", i)
|
||||||
|
|
||||||
@@ -9,8 +10,9 @@ Qt has "Translation Rules for Plurals", small example
|
|||||||
Building: 1 shader
|
Building: 1 shader
|
||||||
// i = 2:
|
// i = 2:
|
||||||
Building: 2 shaders
|
Building: 2 shaders
|
||||||
|
```
|
||||||
|
|
||||||
For yuzu the source language used is English, for all other languages handling of plurals is handled by Qt and the translation collaboration site. Handling plurals in the source language (English) requires special consideration.
|
For Yuzu the source language used is English, for all other languages handling of plurals is handled by Qt and the translation collaboration site. Handling plurals in the source language (English) requires special consideration.
|
||||||
|
|
||||||
With CMake flag GENERATE_QT_TRANSLATION a generated_en.ts file is created from the source. It ignored by git (`.gitignore` in the project root). It is placed in this directory so that the relative refrences with the source code is correct.
|
With CMake flag GENERATE_QT_TRANSLATION a generated_en.ts file is created from the source. It ignored by git (`.gitignore` in the project root). It is placed in this directory so that the relative refrences with the source code is correct.
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
# Translating
|
# Translating
|
||||||
|
|
||||||
This directory stores translation patches (TS files) for yuzu Qt frontend. This directory is linked with the [Eden project on transifex](https://app.transifex.com/edenemu/eden-emulator), so you can update the translation by executing `tx pull -t -a` in the root of this repository. If you want to contribute to the translation, please go the transifex link and submit your translation there.
|
This directory stores translation patches (TS files) for Yuzu Qt frontend. This directory is linked with the [Eden project on Transifex](https://app.transifex.com/edenemu/eden-emulator), so you can update the translation by executing `tx pull -t -a` in the root of this repository. If you want to contribute to the translation, please go the Transifex link and submit your translation there.
|
||||||
|
|
||||||
When creating/improving translations, please keep in mind:
|
When creating/improving translations, please keep in mind:
|
||||||
|
|
||||||
|
|||||||
+14
-5
@@ -5,6 +5,15 @@
|
|||||||
|
|
||||||
This is a full-fledged guide to build Eden on all supported platforms.
|
This is a full-fledged guide to build Eden on all supported platforms.
|
||||||
|
|
||||||
|
If you already have a development environment set up:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -G Ninja
|
||||||
|
cmake --build build
|
||||||
|
```
|
||||||
|
|
||||||
|
On Linux, macOS, and MinGW/MSYS2, make sure to read the [dependencies guide](Deps.md). On Android, read its [dedicated page](build/Android.md).
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
First, you must [install some dependencies](Deps.md).
|
First, you must [install some dependencies](Deps.md).
|
||||||
@@ -125,13 +134,13 @@ cmake -S . -B build -G "<GENERATOR>" -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COM
|
|||||||
|
|
||||||
<img src="https://user-images.githubusercontent.com/42481638/216899164-6cee8482-3d59-428f-b1bc-e6dc793c9b20.png" width="500">
|
<img src="https://user-images.githubusercontent.com/42481638/216899164-6cee8482-3d59-428f-b1bc-e6dc793c9b20.png" width="500">
|
||||||
|
|
||||||
- Click OK; now Clion will build a directory and index your code to allow for IntelliSense. Please be patient.
|
- Click OK; now CLion will build a directory and index your code to allow for IntelliSense. Please be patient.
|
||||||
- Once this process has been completed (No loading bar bottom right), you can now build eden
|
- Once this process has been completed (No loading bar bottom right), you can now build Eden
|
||||||
- In the top right, click on the drop-down menu, select all configurations, then select eden
|
- In the top right, click on the drop-down menu, select all configurations, then select Eden
|
||||||
|
|
||||||
<img src="https://user-images.githubusercontent.com/42481638/216899226-975048e9-bc6d-4ec1-bc2d-bd8a1e15ed04.png" height="500" >
|
<img src="https://user-images.githubusercontent.com/42481638/216899226-975048e9-bc6d-4ec1-bc2d-bd8a1e15ed04.png" height="500" >
|
||||||
|
|
||||||
- Now run by clicking the play button or pressing Shift+F10, and eden will auto-launch once built.
|
- Now run by clicking the play button or pressing Shift+F10, and Eden will auto-launch once built.
|
||||||
|
|
||||||
<img src="https://user-images.githubusercontent.com/42481638/216899275-d514ec6a-e563-470e-81e2-3e04f0429b68.png" width="500">
|
<img src="https://user-images.githubusercontent.com/42481638/216899275-d514ec6a-e563-470e-81e2-3e04f0429b68.png" width="500">
|
||||||
</details>
|
</details>
|
||||||
@@ -153,7 +162,7 @@ If your initial configure failed:
|
|||||||
- *Carefully* re-read the [dependencies guide](Deps.md)
|
- *Carefully* re-read the [dependencies guide](Deps.md)
|
||||||
- Clear the CPM cache (`.cache/cpm`) and CMake cache (`<build directory>/CMakeCache.txt`)
|
- Clear the CPM cache (`.cache/cpm`) and CMake cache (`<build directory>/CMakeCache.txt`)
|
||||||
- Evaluate the error and find any related settings
|
- Evaluate the error and find any related settings
|
||||||
- See the [CPM docs](CPM.md) to see if you may need to forcefully bundle any packages
|
- See the [CPM docs](CPMUtil.md) to see if you may need to forcefully bundle any packages
|
||||||
|
|
||||||
Otherwise, feel free to ask for help in Stoat or Discord.
|
Otherwise, feel free to ask for help in Stoat or Discord.
|
||||||
|
|
||||||
|
|||||||
+5
-23
@@ -12,10 +12,6 @@
|
|||||||
- [NetBSD](#netbsd)
|
- [NetBSD](#netbsd)
|
||||||
- [MSYS2](#msys2)
|
- [MSYS2](#msys2)
|
||||||
- [RedoxOS](#redoxos)
|
- [RedoxOS](#redoxos)
|
||||||
- [Windows](#windows)
|
|
||||||
- [Windows 7, Windows 8 and Windows 8.1](#windows-7-windows-8-and-windows-81)
|
|
||||||
- [Windows Vista and below](#windows-vista-and-below)
|
|
||||||
- [Windows on ARM](#windows-on-arm)
|
|
||||||
<!-- /TOC -->
|
<!-- /TOC -->
|
||||||
|
|
||||||
## Arch Linux
|
## Arch Linux
|
||||||
@@ -71,7 +67,7 @@ export LIBGL_ALWAYS_SOFTWARE=1
|
|||||||
|
|
||||||
Install `developer/gcc14` on OmniOS using pkgsrc.
|
Install `developer/gcc14` on OmniOS using pkgsrc.
|
||||||
|
|
||||||
Since so many dependencies are missing on `OmniOS`, you may wish to use `-DCPMUTIL_FORCE_BUNDLED=ON`
|
Since so many dependencies are missing on `OmniOS`, you may wish to use `-DCPMUTIL_FORCE_BUNDLED=ON` and `-DYUZU_USE_BUNDLED_OPENSSL=OFF`.
|
||||||
|
|
||||||
For OmniOS you are required to build glslang yourself:
|
For OmniOS you are required to build glslang yourself:
|
||||||
```sh
|
```sh
|
||||||
@@ -86,11 +82,13 @@ cmake --install build
|
|||||||
|
|
||||||
It may be tempting to specify `-t glslang`, but this will cause installation to fail. So don't.
|
It may be tempting to specify `-t glslang`, but this will cause installation to fail. So don't.
|
||||||
|
|
||||||
Using `--parallel` on CMake incorrectly passes `dmake ... -jn` instead of `dmake ... -j n`, this is a bug with OmniOS's CMake, and as such it's recommended to not use this option until it's fixed.
|
Using `--parallel` on CMake incorrectly passes `dmake ... -jn` instead of `dmake ... -j n`, this is a bug with OmniOS's CMake, it's recommended to not use this option until it's fixed.
|
||||||
|
|
||||||
You may also need to install `gmake` in order to properly build FFmpeg, this is provided by the `build-essential` package.
|
You may also need to install `gmake` in order to properly build FFmpeg, this is provided by the `build-essential` package.
|
||||||
|
|
||||||
If it wasn't obvious already, you require a X11 server to properly run the emulator within OmniOS, [this guide](https://web.archive.org/web/20260424200928/https://geekblood.wordpress.com/2017/10/26/installing-x11-and-a-desktop-environment-on-omnios/) is a great starting point for that, the links to pkgsrc are outdated so follow [this exemplar](https://pkgsrc.smartos.org/install-on-illumos/) as well:
|
If it wasn't obvious already, you require a X11 server to properly run the emulator within OmniOS, [this guide](https://web.archive.org/web/20260424200928/https://geekblood.wordpress.com/2017/10/26/installing-x11-and-a-desktop-environment-on-omnios/) is a great starting point for that, the links to pkgsrc are outdated so follow [this exemplar](https://pkgsrc.smartos.org/install-on-illumos/) as well.
|
||||||
|
|
||||||
|
For Solaris based OSes, `${CMAKE_SYSTEM_NAME}` isn't properly set on CMake (it's set to i686 on AMD64), you may find issues when building OpenSSL from `openssl-cmake`.
|
||||||
|
|
||||||
## HaikuOS
|
## HaikuOS
|
||||||
|
|
||||||
@@ -244,19 +242,3 @@ find ./*/ -name "*.dll" | while read -r dll; do deps "$dll"; done
|
|||||||
The package install may randomly hang at times, in which case it has to be restarted. ALWAYS do a `sudo pkg update` or the chances of it hanging will be close to 90%. If "multiple" installs fail at once, try installing 1 by 1 the packages.
|
The package install may randomly hang at times, in which case it has to be restarted. ALWAYS do a `sudo pkg update` or the chances of it hanging will be close to 90%. If "multiple" installs fail at once, try installing 1 by 1 the packages.
|
||||||
|
|
||||||
When CMake invokes certain file syscalls - it may sometimes cause crashes or corruptions on the (kernel?) address space - so reboot the system if there is a "hang" in CMake.
|
When CMake invokes certain file syscalls - it may sometimes cause crashes or corruptions on the (kernel?) address space - so reboot the system if there is a "hang" in CMake.
|
||||||
|
|
||||||
## Windows
|
|
||||||
|
|
||||||
### Windows 7, Windows 8 and Windows 8.1
|
|
||||||
|
|
||||||
DirectX 12 is not available - simply copy and paste a random DLL and name it `d3d12.dll`.
|
|
||||||
|
|
||||||
Install [Qt6 compatibility libraries](github.com/ANightly/qt6windows7) specifically Qt 6.9.5.
|
|
||||||
|
|
||||||
### Windows Vista and below
|
|
||||||
|
|
||||||
No support for Windows Vista (or below) is present at the moment. Check back later.
|
|
||||||
|
|
||||||
### Windows on ARM
|
|
||||||
|
|
||||||
If you're using Snapdragon X or 8CX, use the [the Vulkan translation layer](https://apps.microsoft.com/detail/9nqpsl29bfff?hl=en-us&gl=USE) only if the stock drivers do not work. And of course always keep your system up-to-date.
|
|
||||||
|
|||||||
+54
-5
@@ -6,7 +6,7 @@ When reporting issues or finding bugs, we often need backtraces, debug logs, or
|
|||||||
|
|
||||||
### Graphics Debugging
|
### Graphics Debugging
|
||||||
|
|
||||||
If your bug is related to a graphical issue--e.g. mismatched colors, vertex explosions, flickering, etc.--then you are required to include graphical debugging logs in your issue reports.
|
If your bug is related to a graphical issue -- e.g. mismatched colors, vertex explosions, flickering, etc. -- then you are required to include graphical debugging logs in your issue reports.
|
||||||
|
|
||||||
Graphics Debugging is found in General -> Debug on desktop, and Advanced Settings -> Debug on Android. Android users are all set; however, desktop users may need to install the Vulkan Validation Layers:
|
Graphics Debugging is found in General -> Debug on desktop, and Advanced Settings -> Debug on Android. Android users are all set; however, desktop users may need to install the Vulkan Validation Layers:
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ Once Graphics Debugging is enabled, run the problematic game again and continue.
|
|||||||
|
|
||||||
### Debug Logs
|
### Debug Logs
|
||||||
|
|
||||||
Debug logs can be found in General -> Debug -> Open Log Location on desktop, and Share Debug Logs on Android. This MUST be included in all bug reports, except for certain UI bugs--but we still highly recommend them even for UI bugs.
|
Debug logs can be found in `General -> Debug -> Open Log Location` on desktop, and `Share Debug Logs` on Android. This MUST be included in all bug reports, except for certain UI bugs -- but we still highly recommend them even for UI bugs.
|
||||||
|
|
||||||
## Debugging (host code)
|
## Debugging (host code)
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ You must have GDB installed for aarch64 to debug the target. Install it through
|
|||||||
- `sudo emerge --ask crossdev`
|
- `sudo emerge --ask crossdev`
|
||||||
- `sudo crossdev -t aarch64-unknown-linux-gnu --ex-gdb`
|
- `sudo crossdev -t aarch64-unknown-linux-gnu --ex-gdb`
|
||||||
|
|
||||||
Run `./build/bin/eden-cli -c <path to your config file (see logs where you run eden normally to see where it is)> -d -g <path to game>`, or `Enable GDB Stub` at General > Debug, then hook up an aarch64-gdb:
|
Run `./build/bin/eden-cli -c <path to your config file (see logs where you run Eden normally to see where it is)> -d -g <path to game>`, or `Enable GDB Stub` at General > Debug, then hook up an aarch64-gdb:
|
||||||
|
|
||||||
- `target remote localhost:6543`
|
- `target remote localhost:6543`
|
||||||
|
|
||||||
@@ -69,6 +69,55 @@ Expressions can be `variable_names` or `1234` (numbers) or `*var` (dereference o
|
|||||||
|
|
||||||
For more information type `info gdb` and read [the man page](https://man7.org/linux/man-pages/man1/gdb.1.html).
|
For more information type `info gdb` and read [the man page](https://man7.org/linux/man-pages/man1/gdb.1.html).
|
||||||
|
|
||||||
# RenderDoc (Graphic Debugging Tool)
|
# RenderDoc
|
||||||
|
|
||||||
Guidelines for graphical debugging using RenderDoc: **[RenderDoc usage](./RenderDoc.md)**
|
RenderDoc is a free, cross platform, multi-graphics API debugger. It is an invaluable tool for diagnosing issues with graphics applications, and includes support for Vulkan. Get it from [renderdoc.org](https://renderdoc.org).
|
||||||
|
|
||||||
|
RenderDoc can capture Eden's Vulkan output when its Vulkan layer is loaded before Eden creates the Vulkan device. Before using RenderDoc to diagnose issues, it's always good to make sure there are no validation errors. Any errors means the behavior of the application is undefined. That said, RenderDoc can help debug validation errors if you do have them.
|
||||||
|
|
||||||
|
## Usage on Windows
|
||||||
|
|
||||||
|
You can either use RenderDoc UI to launch Eden, or you can make Eden attach it internally:
|
||||||
|
|
||||||
|
On Windows PowerShell:
|
||||||
|
```powershell
|
||||||
|
$env:ENABLE_VULKAN_RENDERDOC_CAPTURE='1'
|
||||||
|
.\eden.exe
|
||||||
|
```
|
||||||
|
When RenderDoc is attached, Eden logs the default Windows capture folder:
|
||||||
|
```text
|
||||||
|
%LOCALAPPDATA%\Temp\RenderDoc
|
||||||
|
```
|
||||||
|
|
||||||
|
Press RenderDoc's capture hotkey, usually `F12`, to capture a frame. To stop using RenderDoc, close Eden and launch it again without `ENABLE_VULKAN_RENDERDOC_CAPTURE`.
|
||||||
|
|
||||||
|
## Eden Hotkey
|
||||||
|
|
||||||
|
Eden also has a separate `Toggle Renderdoc Capture` hotkey behind the debug setting `renderdoc_hotkey`.
|
||||||
|
That hotkey does not load or unload RenderDoc. It only toggles Eden's own manual capture through RenderDoc's API:
|
||||||
|
|
||||||
|
- First press: Starts a capture
|
||||||
|
- Second press: Ends that capture
|
||||||
|
|
||||||
|
## Simple checklist for debugging black screens using Renderdoc
|
||||||
|
|
||||||
|
When debugging a black screen, there are many ways the application could have setup Vulkan wrong.
|
||||||
|
Here is a short checklist of items to look at to make sure are appropriate:
|
||||||
|
|
||||||
|
- Draw call counts are correct (aka not zero, or if rendering many triangles, not 3)
|
||||||
|
- Vertex buffers are bound
|
||||||
|
- vertex attributes are correct - Make sure the size & offset of each attribute matches what should it should be
|
||||||
|
- Any bound push constants and descriptors have the right data - including:
|
||||||
|
- Matrices have correct values - double check the model, view, & projection matrices are uploaded correctly
|
||||||
|
- Pipeline state is correct
|
||||||
|
- viewport range is correct - x,y are 0,0; width & height are screen dimensions, minDepth is 0, maxDepth is 1, NDCDepthRange is 0,1
|
||||||
|
- Fill mode matches expected - usually solid
|
||||||
|
- Culling mode makes sense - commonly back or none
|
||||||
|
- The winding direction is correct - typically CCW (counter clockwise)
|
||||||
|
- Scissor region is correct - usually same as viewport's x,y,width, &height
|
||||||
|
- Blend state is correct
|
||||||
|
- Depth state is correct - typically enabled with Function set to Less than or Equal
|
||||||
|
- Swapchain images are bound when rendering to the swapchain
|
||||||
|
- Image being rendered to is the same as the one being presented when rendering to the swapchain
|
||||||
|
|
||||||
|
Alternatively, a [RenderDoc Extension](https://github.com/baldurk/renderdoc-contrib/tree/main/baldurk/whereismydraw) ([Archive](https://web.archive.org/web/20250000000000*/https://github.com/baldurk/renderdoc-contrib/tree/main/baldurk/whereismydraw)) exists which automates doing a lot of these manual steps.
|
||||||
|
|||||||
+5
-2
@@ -259,7 +259,10 @@ 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 vulkan-headers quazip-qt6`
|
As root run:
|
||||||
|
```sh
|
||||||
|
pkg install devel/cmake devel/sdl3 devel/boost-libs devel/catch2 devel/libfmt devel/nlohmann-json devel/ninja devel/nasm devel/autoconf devel/pkgconf devel/qt6-base x11-toolkits/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 graphics/vulkan-utility-libraries graphics/vulkan-headers graphics/spirv-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.
|
||||||
|
|
||||||
@@ -272,7 +275,7 @@ If using FreeBSD 12 or prior, use `devel/pkg-config` instead.
|
|||||||
For NetBSD +10.1:
|
For NetBSD +10.1:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
pkgin install git cmake boost fmtlib SDL3 catch2 libjwt spirv-headers spirv-tools ffmpeg7 libva nlohmann-json jq libopus qt6 cpp-httplib lz4 vulkan-headers nasm autoconf enet pkg-config libusb1 libcxx frozen
|
pkgin install git cmake boost fmtlib SDL3 catch2 libjwt spirv-headers spirv-tools ffmpeg7 libva nlohmann-json jq libopus qt6-qtbase qt6-qtcharts qt6-qtmultimedia qt6-qttools cpp-httplib lz4 vulkan-headers nasm autoconf enet pkg-config libusb1 libcxx frozen
|
||||||
```
|
```
|
||||||
|
|
||||||
[Caveats](./Caveats.md#netbsd).
|
[Caveats](./Caveats.md#netbsd).
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Design Overview
|
# Design Overview
|
||||||
|
|
||||||
Modern game consoles require heavy power to be emulated appropriatedly. This is why the emulator uses an approach known as HLE (High-Level-Emulation), in a nuthsell: Instead of accurately emulating every subsystem that forms part of a component, emulate the resulting visible I/O interface instead.
|
Modern game consoles require heavy power to be emulated appropriately. This is why the emulator uses an approach known as HLE (High-Level-Emulation), in a nutshell: Instead of accurately emulating every subsystem that forms part of a component, emulate the resulting visible I/O interface instead.
|
||||||
|
|
||||||
For example, take a disk write, instead of emulating a proper SD card we instead use the C++ standard library for I/O. Additionally we use the abstractions provided by the `fs` service to "lie" to programs about certain SD card properties. Notably this includes making up sizes for the fake SD card, giving "realistic" values or expected outputs for a given card, and so on. And instead of writing to an actual SD card, the emulator simply writes to a file.
|
For example, take a disk write, instead of emulating a proper SD card we instead use the C++ standard library for I/O. Additionally we use the abstractions provided by the `fs` service to "lie" to programs about certain SD card properties. Notably this includes making up sizes for the fake SD card, giving "realistic" values or expected outputs for a given card, and so on. And instead of writing to an actual SD card, the emulator simply writes to a file.
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ Handles everything related to audio, this is where most of the filtering and pro
|
|||||||
|
|
||||||
## src/common/
|
## src/common/
|
||||||
|
|
||||||
The [common](../src/common) folder contains just your basic pollyfills for whatever missing functionality. We heavily encourage new PRs to make use of one of the dependencies, or the standard C++ library. Minimizing the amount of things we reinvent the wheel for is always a good thing.
|
The [common](../src/common) folder contains just your basic polyfills for whatever missing functionality. We heavily encourage new PRs to make use of one of the dependencies, or the standard C++ library. Minimizing the amount of things we reinvent the wheel for is always a good thing.
|
||||||
|
|
||||||
## src/core/
|
## src/core/
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ Dedicated shader recompiler to translate Maxwell assembly code to either SPIR-V,
|
|||||||
|
|
||||||
## src/video_core/
|
## src/video_core/
|
||||||
|
|
||||||
Most of the things here have their own dedicated section. In short this is basically the entire Tegra NVIDIA Maxwell GPU emulation. Additionally it includes some [extra effects](../src/video_core/host_ahders) to emulate MSAA, D24 copies or as polyfill.
|
Most of the things here have their own dedicated section. In short this is basically the entire Tegra NVIDIA Maxwell GPU emulation. Additionally it includes some [extra effects](../src/video_core/host_shaders/opengl_smaa.glsl) to emulate MSAA, D24 copies or as polyfill.
|
||||||
|
|
||||||
Available backends are: Null, Vulkan, and OpenGL.
|
Available backends are: Null, Vulkan, and OpenGL.
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -91,7 +91,7 @@ You may additionally need the `Qt Extension Pack` extension if building Qt.
|
|||||||
|
|
||||||
# Build speedup
|
# Build speedup
|
||||||
|
|
||||||
If you have an HDD, use ramdisk (build in RAM), approximatedly you need 4GB for a full build with debug symbols:
|
If you have an HDD, use ramdisk (build in RAM), approximately you need 4GB for a full build with debug symbols:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
mkdir /tmp/ramdisk
|
mkdir /tmp/ramdisk
|
||||||
@@ -110,7 +110,7 @@ A general rule of thumb, before uploading files:
|
|||||||
- PNG files: Use [optipng](https://web.archive.org/web/20240325055059/https://optipng.sourceforge.net/).
|
- PNG files: Use [optipng](https://web.archive.org/web/20240325055059/https://optipng.sourceforge.net/).
|
||||||
- SVG files: Use [svgo](https://github.com/svg/svgo).
|
- SVG files: Use [svgo](https://github.com/svg/svgo).
|
||||||
|
|
||||||
May not be used but worth mentioning nonethless:
|
May not be used but worth mentioning nonetheless:
|
||||||
|
|
||||||
- OGG files: Use [OptiVorbis](https://github.com/OptiVorbis/OptiVorbis).
|
- OGG files: Use [OptiVorbis](https://github.com/OptiVorbis/OptiVorbis).
|
||||||
- Video files: Use ffmpeg, preferably re-encode as AV1.
|
- Video files: Use ffmpeg, preferably re-encode as AV1.
|
||||||
|
|||||||
+4
-5
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
Are you just a casual user? Take a look at our [User Handbook](./user) then!
|
Are you just a casual user? Take a look at our [User Handbook](./user) then!
|
||||||
|
|
||||||
If you want to register/signup as a contributor, take a gander at the [signup guide](./SIGNUP.md).
|
If you want to register/signup as a contributor, take a gander at [CONTRIBUTING.md](../CONTRIBUTING.md).
|
||||||
|
|
||||||
This contains documentation created by developers. This contains build instructions, guidelines, instructions/layouts for [cool stuff we made](./CPMUtil), and more.
|
This contains documentation created by developers, build instructions, guidelines, instructions/layouts for [cool stuff we made](./CPMUtil.md), and more.
|
||||||
|
|
||||||
- **[General Build Instructions](./Build.md)**
|
- **[General Build Instructions](./Build.md)**
|
||||||
- **[CMake Options](./Options.md)**
|
- **[CMake Options](./Options.md)**
|
||||||
@@ -12,11 +12,10 @@ This contains documentation created by developers. This contains build instructi
|
|||||||
- **[Development Guidelines](./Development.md)**
|
- **[Development Guidelines](./Development.md)**
|
||||||
- **[Dependencies](./Deps.md)**
|
- **[Dependencies](./Deps.md)**
|
||||||
- **[Debug Guidelines](./Debug.md)**
|
- **[Debug Guidelines](./Debug.md)**
|
||||||
- **[RenderDoc usage](./RenderDoc.md)**
|
- **[RenderDoc](./Debug.md#renderdoc)**
|
||||||
- **[CPM - CMake Package Manager](./CPMUtil)**
|
- **[CPM - CMake Package Manager](./CPMUtil.md)**
|
||||||
- **[Platform-Specific Caveats](./Caveats.md)**
|
- **[Platform-Specific Caveats](./Caveats.md)**
|
||||||
- **[The NVIDIA SM86 (Maxwell) GPU](./NvidiaGpu.md)**
|
- **[The NVIDIA SM86 (Maxwell) GPU](./NvidiaGpu.md)**
|
||||||
- **[Cross compilation](./CrossCompile.md)**
|
|
||||||
- **[Driver Bugs](./DriverBugs.md)**
|
- **[Driver Bugs](./DriverBugs.md)**
|
||||||
- **[Building Older Commits](./build/OlderCommits.md)**
|
- **[Building Older Commits](./build/OlderCommits.md)**
|
||||||
- Subsystems:
|
- Subsystems:
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
# RenderDoc
|
|
||||||
|
|
||||||
Renderdoc is a free, cross platform, multi-graphics API debugger. It is an invaluable tool for diagnosing issues with graphics applications, and includes support for Vulkan. Get it at [renderdoc.org](https://renderdoc.org).
|
|
||||||
|
|
||||||
RenderDoc can capture Eden's Vulkan output when its Vulkan layer is loaded before Eden creates the Vulkan device. Before using renderdoc to diagnose issues, it is always good to make sure there are no validation errors. Any errors means the behavior of the application is undefined. That said, renderdoc can help debug validation errors if you do have them.
|
|
||||||
|
|
||||||
## Usage on Windows
|
|
||||||
|
|
||||||
You can either use RenderDoc UI to launch eden, or you can make eden attach it internally:
|
|
||||||
|
|
||||||
On Windows PowerShell:
|
|
||||||
```powershell
|
|
||||||
$env:ENABLE_VULKAN_RENDERDOC_CAPTURE='1'
|
|
||||||
.\eden.exe
|
|
||||||
```
|
|
||||||
When RenderDoc is attached, Eden logs the default Windows capture folder:
|
|
||||||
```text
|
|
||||||
%LOCALAPPDATA%\Temp\RenderDoc
|
|
||||||
```
|
|
||||||
|
|
||||||
Press RenderDoc's capture hotkey, usually `F12`, to capture a frame. To stop using RenderDoc, close Eden and launch it again without `ENABLE_VULKAN_RENDERDOC_CAPTURE`.
|
|
||||||
|
|
||||||
## Eden Hotkey
|
|
||||||
|
|
||||||
Eden also has a separate `Toggle Renderdoc Capture` hotkey behind the debug setting `renderdoc_hotkey`.
|
|
||||||
That hotkey does not load or unload RenderDoc. It only toggles Eden's own manual capture through RenderDoc's API:
|
|
||||||
|
|
||||||
- first press: starts a capture
|
|
||||||
- second press: ends that capture
|
|
||||||
|
|
||||||
## Simple checklist for debugging black screens using Renderdoc
|
|
||||||
|
|
||||||
When debugging a black screen, there are many ways the application could have setup Vulkan wrong.
|
|
||||||
Here is a short checklist of items to look at to make sure are appropriate:
|
|
||||||
|
|
||||||
- Draw call counts are correct (aka not zero, or if rendering many triangles, not 3)
|
|
||||||
- Vertex buffers are bound
|
|
||||||
- vertex attributes are correct - Make sure the size & offset of each attribute matches what should it should be
|
|
||||||
- Any bound push constants and descriptors have the right data - including:
|
|
||||||
- Matrices have correct values - double check the model, view, & projection matrices are uploaded correctly
|
|
||||||
- Pipeline state is correct
|
|
||||||
- viewport range is correct - x,y are 0,0; width & height are screen dimensions, minDepth is 0, maxDepth is 1, NDCDepthRange is 0,1
|
|
||||||
- Fill mode matches expected - usually solid
|
|
||||||
- Culling mode makes sense - commonly back or none
|
|
||||||
- The winding direction is correct - typically CCW (counter clockwise)
|
|
||||||
- Scissor region is correct - usually same as viewport's x,y,width, &height
|
|
||||||
- Blend state is correct
|
|
||||||
- Depth state is correct - typically enabled with Function set to Less than or Equal
|
|
||||||
- Swapchain images are bound when rendering to the swapchain
|
|
||||||
- Image being rendered to is the same as the one being presented when rendering to the swapchain
|
|
||||||
|
|
||||||
Alternatively, a [RenderDoc Extension](https://github.com/baldurk/renderdoc-contrib/tree/main/baldurk/whereismydraw) ([Archive](https://web.archive.org/web/20250000000000*/https://github.com/baldurk/renderdoc-contrib/tree/main/baldurk/whereismydraw)) exists which automates doing a lot of these manual steps.
|
|
||||||
+4
-4
@@ -1,11 +1,11 @@
|
|||||||
# Settings
|
# Settings
|
||||||
|
|
||||||
> [!WARNING]
|
> [!WARNING]
|
||||||
> This guide is intended for developers ONLY. If you're looking for configuring the emulator itself, please read **[the user handbook](./user/README.md)**.
|
> This guide is intended for developers ONLY. If you're looking for configuring the emulator itself, read **[the user handbook](./user/README.md)**.
|
||||||
|
|
||||||
Settings on the emulator are very important, toggles and such can be used to guard and/or add branches to paths where some games may crash while others won't, and viceversa.
|
Settings on the emulator are very important, toggles and such can be used to guard and/or add branches to paths where some games may crash while others won't, and viceversa.
|
||||||
|
|
||||||
However, this process can be tedious for those unfamiliar; this document serves as a outline/documentation for the settings subsystem.
|
However, this process can be tedious for those unfamiliar; this document serves as an outline/documentation for the settings subsystem.
|
||||||
|
|
||||||
## Index
|
## Index
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ INSERT(Settings,
|
|||||||
|
|
||||||
#### Make sure to:
|
#### Make sure to:
|
||||||
|
|
||||||
* Keep display naming consistant
|
* Keep display naming consistent
|
||||||
* Put detailed info in the description
|
* Put detailed info in the description
|
||||||
* Use `\n` for line breaks in descriptions
|
* Use `\n` for line breaks in descriptions
|
||||||
|
|
||||||
@@ -191,7 +191,7 @@ The setting ranges from 0 to 65535 (0x0000 to 0xFFFF), where each bit represents
|
|||||||
|
|
||||||
### Advantages
|
### Advantages
|
||||||
|
|
||||||
The main advantage is to avoid deploying new disposable toggles (those made only for testing stage, and are disposed once new feature gets good to merge). This empowers devs to be free of all frontend burocracy and hassle of new toggles.
|
The main advantage is to avoid deploying new disposable toggles (those made only for testing stage, and are disposed once new feature gets good to merge). This empowers devs to be free of all frontend bureaucracy and hassle of new toggles.
|
||||||
|
|
||||||
Common advantages recap:
|
Common advantages recap:
|
||||||
|
|
||||||
|
|||||||
+42
-42
@@ -1,44 +1,44 @@
|
|||||||
# Dynarmic Design Documentation
|
# Dynarmic Design Documentation
|
||||||
|
|
||||||
Dynarmic is a dynamic recompiler for the ARMv6K architecture. Future plans for dynarmic include
|
Dynarmic is a dynamic recompiler for the ARMv6K architecture. Future plans for Dynarmic include
|
||||||
support for other versions of the ARM architecture, having a interpreter mode, and adding support
|
support for other versions of the ARM architecture, having a interpreter mode, and adding support
|
||||||
for other architectures.
|
for other architectures.
|
||||||
|
|
||||||
Users of this library interact with it primarily through the interface provided in
|
Users of this library interact with it primarily through the interface provided in
|
||||||
[`src/dynarmic/interface`](../src/dynarmic/interface). Users specify how dynarmic's CPU core interacts with
|
[`src/dynarmic/interface`](../../src/dynarmic/src/dynarmic/interface). Users specify how Dynarmic's CPU core interacts with
|
||||||
the rest of their system providing an implementation of the relevant `UserCallbacks` interface.
|
the rest of their system providing an implementation of the relevant `UserCallbacks` interface.
|
||||||
Users setup the CPU state using member functions of `Jit`, then call `Jit::Execute` to start CPU
|
Users setup the CPU state using member functions of `Jit`, then call `Jit::Execute` to start CPU
|
||||||
execution. The callbacks defined on `UserCallbacks` may be called from dynamically generated code,
|
execution. The callbacks defined on `UserCallbacks` may be called from dynamically generated code,
|
||||||
so users of the library should not depend on the stack being in a walkable state for unwinding.
|
so users of the library should not depend on the stack being in a walkable state for unwinding.
|
||||||
|
|
||||||
* A32: [`Jit`](../src/dynarmic/interface/A32/a32.h), [`UserCallbacks`](../src/dynarmic/interface/A32/config.h)
|
* A32: [`Jit`](../../src/dynarmic/src/dynarmic/interface/A32/a32.h), [`UserCallbacks`](../../src/dynarmic/src/dynarmic/interface/A32/config.h)
|
||||||
* A64: [`Jit`](../src/dynarmic/interface/A64/a64.h), [`UserCallbacks`](../src/dynarmic/interface/A64/config.h)
|
* A64: [`Jit`](../../src/dynarmic/src/dynarmic/interface/A64/a64.h), [`UserCallbacks`](../../src/dynarmic/src/dynarmic/interface/A64/config.h)
|
||||||
|
|
||||||
Dynarmic reads instructions from memory by calling `UserCallbacks::MemoryReadCode`. These
|
Dynarmic reads instructions from memory by calling `UserCallbacks::MemoryReadCode`. These
|
||||||
instructions then pass through several stages:
|
instructions then pass through several stages:
|
||||||
|
|
||||||
1. Decoding (Identifying what type of instruction it is and breaking it up into fields)
|
1. Decoding (Identifying what type of instruction it is and breaking it up into fields)
|
||||||
2. Translation (Generation of high-level IR from the instruction)
|
2. Translation (Generation of high-level IR from the instruction)
|
||||||
3. Optimization (Eliminiation of redundant microinstructions, other speed improvements)
|
3. Optimization (Elimination of redundant microinstructions, other speed improvements)
|
||||||
4. Emission (Generation of host-executable code into memory)
|
4. Emission (Generation of host-executable code into memory)
|
||||||
5. Execution (Host CPU jumps to the start of emitted code and runs it)
|
5. Execution (Host CPU jumps to the start of emitted code and runs it)
|
||||||
|
|
||||||
Using the A32 frontend with the x64 backend as an example:
|
Using the A32 frontend with the x64 backend as an example:
|
||||||
|
|
||||||
* Decoding is done by [double dispatch](https://en.wikipedia.org/wiki/Visitor_pattern) in
|
* Decoding is done by [double dispatch](https://en.wikipedia.org/wiki/Visitor_pattern) in
|
||||||
[`src/frontend/A32/decoder/{arm.h,thumb16.h,thumb32.h}`](../src/dynarmic/frontend/A32/decoder/).
|
[`src/frontend/A32/decoder/{arm.h,thumb16.h,thumb32.h}`](../../src/dynarmic/src/dynarmic/frontend/A32/decoder/).
|
||||||
* Translation is done by the visitors in [`src/dynarmic/frontend/A32/translate/translate_{arm,thumb}.cpp`](../src/dynarmic/frontend/A32/translate/).
|
* Translation is done by the visitors in [`src/dynarmic/frontend/A32/translate/translate_{arm,thumb}.cpp`](../../src/dynarmic/src/dynarmic/frontend/A32/translate/).
|
||||||
The function [`Translate`](../src/dynarmic/frontend/A32/translate/translate.h) takes a starting memory location,
|
The function [`Translate`](../../src/dynarmic/src/dynarmic/frontend/A32/translate/a32_translate.cpp) takes a starting memory location,
|
||||||
some CPU state, and memory reader callback and returns a basic block of IR.
|
some CPU state, and memory reader callback and returns a basic block of IR.
|
||||||
* The IR can be found under [`src/frontend/ir/`](../src/dynarmic/ir/).
|
* The IR can be found under [`src/frontend/ir/`](../../src/dynarmic/src/dynarmic/ir/).
|
||||||
* Optimizations can be found under [`src/ir_opt/`](../src/dynarmic/ir/opt/).
|
* Optimizations can be found under [`src/ir/opt_passes.cpp`](../../src/dynarmic/src/dynarmic/ir/opt_passes.cpp).
|
||||||
* Emission is done by `EmitX64` which can be found in [`src/dynarmic/backend/x64/emit_x64.{h,cpp}`](../src/dynarmic/backend/x64/).
|
* Emission is done by `EmitX64` which can be found in [`src/dynarmic/backend/x64/emit_x64.{h,cpp}`](../../src/dynarmic/src/dynarmic/backend/x64/).
|
||||||
* Execution is performed by calling `BlockOfCode::RunCode` in [`src/dynarmic/backend/x64/block_of_code.{h,cpp}`](../src/dynarmic/backend/x64/).
|
* Execution is performed by calling `BlockOfCode::RunCode` in [`src/dynarmic/backend/x64/block_of_code.{h,cpp}`](../../src/dynarmic/src/dynarmic/backend/x64/).
|
||||||
|
|
||||||
## Decoder
|
## Decoder
|
||||||
|
|
||||||
The decoder is a double dispatch decoder. Each instruction is represented by a line in the relevant
|
The decoder is a double dispatch decoder. Each instruction is represented by a line in the relevant
|
||||||
instruction table. Here is an example line from [`arm.h`](../src/dynarmic/frontend/A32/decoder/arm.h):
|
instruction table. Here is an example line from [`arm.h`](../../src/dynarmic/src/dynarmic/frontend/A32/decoder/arm.h):
|
||||||
|
|
||||||
INST(&V::arm_ADC_imm, "ADC (imm)", "cccc0010101Snnnnddddrrrrvvvvvvvv")
|
INST(&V::arm_ADC_imm, "ADC (imm)", "cccc0010101Snnnnddddrrrrvvvvvvvv")
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ error results.
|
|||||||
## Translator
|
## Translator
|
||||||
|
|
||||||
The translator is a visitor that uses the decoder to decode instructions. The translator generates IR code with the
|
The translator is a visitor that uses the decoder to decode instructions. The translator generates IR code with the
|
||||||
help of the [`IREmitter` class](../src/dynarmic/ir/ir_emitter.h). An example of a translation function follows:
|
help of the [`IREmitter` class](../../src/dynarmic/src/dynarmic/ir/ir_emitter.h). An example of a translation function follows:
|
||||||
|
|
||||||
bool ArmTranslatorVisitor::arm_ADC_imm(Cond cond, bool S, Reg n, Reg d, int rotate, Imm8 imm8) {
|
bool ArmTranslatorVisitor::arm_ADC_imm(Cond cond, bool S, Reg n, Reg d, int rotate, Imm8 imm8) {
|
||||||
u32 imm32 = ArmExpandImm(rotate, imm8);
|
u32 imm32 = ArmExpandImm(rotate, imm8);
|
||||||
@@ -107,7 +107,7 @@ function analyser in the medium-term future.
|
|||||||
Dynarmic's intermediate representation is typed. Each microinstruction may take zero or more arguments and may
|
Dynarmic's intermediate representation is typed. Each microinstruction may take zero or more arguments and may
|
||||||
return zero or more arguments. A subset of the microinstructions available is documented below.
|
return zero or more arguments. A subset of the microinstructions available is documented below.
|
||||||
|
|
||||||
A complete list of microinstructions can be found in [src/dynarmic/ir/opcodes.inc](../src/dynarmic/ir/opcodes.inc).
|
A complete list of microinstructions can be found in [src/dynarmic/ir/opcodes.inc](../../src/dynarmic/src/dynarmic/ir/opcodes.inc).
|
||||||
|
|
||||||
The below lists some commonly used microinstructions.
|
The below lists some commonly used microinstructions.
|
||||||
|
|
||||||
@@ -273,7 +273,7 @@ Exclusive OR (i.e.: XOR)
|
|||||||
|
|
||||||
### Callback: {Read,Write}Memory{8,16,32,64}
|
### Callback: {Read,Write}Memory{8,16,32,64}
|
||||||
|
|
||||||
```c++
|
```cpp
|
||||||
<u8> ReadMemory8(<u32> vaddr)
|
<u8> ReadMemory8(<u32> vaddr)
|
||||||
<u8> ReadMemory16(<u32> vaddr)
|
<u8> ReadMemory16(<u32> vaddr)
|
||||||
<u8> ReadMemory32(<u32> vaddr)
|
<u8> ReadMemory32(<u32> vaddr)
|
||||||
@@ -288,7 +288,7 @@ Memory access.
|
|||||||
|
|
||||||
### Terminal: ReturnToDispatch
|
### Terminal: ReturnToDispatch
|
||||||
|
|
||||||
```c++
|
```cpp
|
||||||
SetTerm(IR::Term::ReturnToDispatch{})
|
SetTerm(IR::Term::ReturnToDispatch{})
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -297,7 +297,7 @@ The dispatcher will use the value in R15 to determine what comes next.
|
|||||||
|
|
||||||
### Terminal: LinkBlock
|
### Terminal: LinkBlock
|
||||||
|
|
||||||
```c++
|
```cpp
|
||||||
SetTerm(IR::Term::LinkBlock{next})
|
SetTerm(IR::Term::LinkBlock{next})
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -307,7 +307,7 @@ dispatcher, which will return control to the host.
|
|||||||
|
|
||||||
### Terminal: LinkBlockFast
|
### Terminal: LinkBlockFast
|
||||||
|
|
||||||
```c++
|
```cpp
|
||||||
SetTerm(IR::Term::LinkBlockFast{next})
|
SetTerm(IR::Term::LinkBlockFast{next})
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -316,7 +316,7 @@ This promises guarantees that must be held at runtime - i.e that the program won
|
|||||||
|
|
||||||
### Terminal: PopRSBHint
|
### Terminal: PopRSBHint
|
||||||
|
|
||||||
```c++
|
```cpp
|
||||||
SetTerm(IR::Term::PopRSBHint{})
|
SetTerm(IR::Term::PopRSBHint{})
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -328,7 +328,7 @@ this optimization or doesn't have a RSB may choose to implement this exactly as
|
|||||||
|
|
||||||
### Terminal: If
|
### Terminal: If
|
||||||
|
|
||||||
```c++
|
```cpp
|
||||||
SetTerm(IR::Term::If{cond, term_then, term_else})
|
SetTerm(IR::Term::If{cond, term_then, term_else})
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -366,7 +366,7 @@ Do NEVER modify `%r15`, we must make it clear that this register is "immutable"
|
|||||||
|
|
||||||
### `Scratch`
|
### `Scratch`
|
||||||
|
|
||||||
```c++
|
```cpp
|
||||||
Xbyak::Reg64 ScratchGpr(HostLocList desired_locations = any_gpr);
|
Xbyak::Reg64 ScratchGpr(HostLocList desired_locations = any_gpr);
|
||||||
Xbyak::Xmm ScratchXmm(HostLocList desired_locations = any_xmm);
|
Xbyak::Xmm ScratchXmm(HostLocList desired_locations = any_xmm);
|
||||||
```
|
```
|
||||||
@@ -375,7 +375,7 @@ At runtime, allocate one of the registers in `desired_locations`. You are free t
|
|||||||
|
|
||||||
### Pure `Use`
|
### Pure `Use`
|
||||||
|
|
||||||
```c++
|
```cpp
|
||||||
Xbyak::Reg64 UseGpr(Argument& arg);
|
Xbyak::Reg64 UseGpr(Argument& arg);
|
||||||
Xbyak::Xmm UseXmm(Argument& arg);
|
Xbyak::Xmm UseXmm(Argument& arg);
|
||||||
OpArg UseOpArg(Argument& arg);
|
OpArg UseOpArg(Argument& arg);
|
||||||
@@ -391,7 +391,7 @@ This register **must not** have it's value changed.
|
|||||||
|
|
||||||
### `UseScratch`
|
### `UseScratch`
|
||||||
|
|
||||||
```c++
|
```cpp
|
||||||
Xbyak::Reg64 UseScratchGpr(Argument& arg);
|
Xbyak::Reg64 UseScratchGpr(Argument& arg);
|
||||||
Xbyak::Xmm UseScratchXmm(Argument& arg);
|
Xbyak::Xmm UseScratchXmm(Argument& arg);
|
||||||
void UseScratch(Argument& arg, HostLoc host_loc);
|
void UseScratch(Argument& arg, HostLoc host_loc);
|
||||||
@@ -409,7 +409,7 @@ You are free to modify the value in the register. The register is discarded at t
|
|||||||
|
|
||||||
A `Define` is the defintion of a value. This is the only time when a value may be set.
|
A `Define` is the defintion of a value. This is the only time when a value may be set.
|
||||||
|
|
||||||
```c++
|
```cpp
|
||||||
void DefineValue(IR::Inst* inst, const Xbyak::Reg& reg);
|
void DefineValue(IR::Inst* inst, const Xbyak::Reg& reg);
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -420,7 +420,7 @@ value to the specified register `reg`.
|
|||||||
|
|
||||||
Adding a `Define` to an existing value.
|
Adding a `Define` to an existing value.
|
||||||
|
|
||||||
```c++
|
```cpp
|
||||||
void DefineValue(IR::Inst* inst, Argument& arg);
|
void DefineValue(IR::Inst* inst, Argument& arg);
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -458,7 +458,7 @@ One complication dynarmic has is that a compiled block is not uniquely identifia
|
|||||||
the PC alone, but bits in the FPSCR and CPSR are also relevant. We resolve this by
|
the PC alone, but bits in the FPSCR and CPSR are also relevant. We resolve this by
|
||||||
computing a 64-bit `UniqueHash` that is guaranteed to uniquely identify a block.
|
computing a 64-bit `UniqueHash` that is guaranteed to uniquely identify a block.
|
||||||
|
|
||||||
```c++
|
```cpp
|
||||||
u64 LocationDescriptor::UniqueHash() const {
|
u64 LocationDescriptor::UniqueHash() const {
|
||||||
// This value MUST BE UNIQUE.
|
// This value MUST BE UNIQUE.
|
||||||
// This calculation has to match up with EmitX64::EmitTerminalPopRSBHint
|
// This calculation has to match up with EmitX64::EmitTerminalPopRSBHint
|
||||||
@@ -482,18 +482,18 @@ point. Each element in `rsb_location_descriptors` is a `UniqueHash` and they
|
|||||||
each correspond to an element in `rsb_codeptrs`. `rsb_codeptrs` contains the
|
each correspond to an element in `rsb_codeptrs`. `rsb_codeptrs` contains the
|
||||||
host addresses for the corresponding the compiled blocks.
|
host addresses for the corresponding the compiled blocks.
|
||||||
|
|
||||||
`RSBSize` was chosen by performance testing. Note that this is bigger than the
|
`RSB_SIZE` was chosen by performance testing. Note that this is bigger than the
|
||||||
size of the real RSB in hardware (which has 3 entries). Larger RSBs than 8
|
size of the real RSB in hardware (which has 3 entries). Larger RSBs than 8
|
||||||
showed degraded performance.
|
showed degraded performance.
|
||||||
|
|
||||||
```c++
|
```cpp
|
||||||
struct JitState {
|
struct JitState {
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
static constexpr size_t RSBSize = 8; // MUST be a power of 2.
|
static constexpr size_t RSB_SIZE = 8; // MUST be a power of 2.
|
||||||
u32 rsb_ptr = 0;
|
u32 rsb_ptr = 0;
|
||||||
std::array<u64, RSBSize> rsb_location_descriptors;
|
std::array<u64, RSB_SIZE> rsb_location_descriptors;
|
||||||
std::array<u64, RSBSize> rsb_codeptrs;
|
std::array<u64, RSB_SIZE> rsb_codeptrs;
|
||||||
void ResetRSB();
|
void ResetRSB();
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
@@ -505,7 +505,7 @@ struct JitState {
|
|||||||
We insert our prediction at the insertion point iff the RSB doesn't already
|
We insert our prediction at the insertion point iff the RSB doesn't already
|
||||||
contain a prediction with the same `UniqueHash`.
|
contain a prediction with the same `UniqueHash`.
|
||||||
|
|
||||||
```c++
|
```cpp
|
||||||
void EmitX64::EmitPushRSB(IR::Block&, IR::Inst* inst) {
|
void EmitX64::EmitPushRSB(IR::Block&, IR::Inst* inst) {
|
||||||
using namespace Xbyak::util;
|
using namespace Xbyak::util;
|
||||||
|
|
||||||
@@ -521,7 +521,7 @@ void EmitX64::EmitPushRSB(IR::Block&, IR::Inst* inst) {
|
|||||||
|
|
||||||
code->mov(index_reg, dword[code.ABI_JIT_PTR + offsetof(JitState, rsb_ptr)]);
|
code->mov(index_reg, dword[code.ABI_JIT_PTR + offsetof(JitState, rsb_ptr)]);
|
||||||
code->add(index_reg, 1);
|
code->add(index_reg, 1);
|
||||||
code->and_(index_reg, u32(JitState::RSBSize - 1));
|
code->and_(index_reg, u32(JitState::RSB_SIZE - 1));
|
||||||
|
|
||||||
code->mov(loc_desc_reg, u64(imm64));
|
code->mov(loc_desc_reg, u64(imm64));
|
||||||
CodePtr patch_location = code->getCurr<CodePtr>();
|
CodePtr patch_location = code->getCurr<CodePtr>();
|
||||||
@@ -530,7 +530,7 @@ void EmitX64::EmitPushRSB(IR::Block&, IR::Inst* inst) {
|
|||||||
code->EnsurePatchLocationSize(patch_location, 10);
|
code->EnsurePatchLocationSize(patch_location, 10);
|
||||||
|
|
||||||
Xbyak::Label label;
|
Xbyak::Label label;
|
||||||
for (size_t i = 0; i < JitState::RSBSize; ++i) {
|
for (size_t i = 0; i < JitState::RSB_SIZE; ++i) {
|
||||||
code->cmp(loc_desc_reg, qword[code.ABI_JIT_PTR + offsetof(JitState, rsb_location_descriptors) + i * sizeof(u64)]);
|
code->cmp(loc_desc_reg, qword[code.ABI_JIT_PTR + offsetof(JitState, rsb_location_descriptors) + i * sizeof(u64)]);
|
||||||
code->je(label, code->T_SHORT);
|
code->je(label, code->T_SHORT);
|
||||||
}
|
}
|
||||||
@@ -544,12 +544,12 @@ void EmitX64::EmitPushRSB(IR::Block&, IR::Inst* inst) {
|
|||||||
|
|
||||||
In pseudocode:
|
In pseudocode:
|
||||||
|
|
||||||
```c++
|
```cpp
|
||||||
for (i := 0 .. RSBSize-1)
|
for (i := 0 .. RSB_SIZE-1)
|
||||||
if (rsb_location_descriptors[i] == imm64)
|
if (rsb_location_descriptors[i] == imm64)
|
||||||
goto label;
|
goto label;
|
||||||
rsb_ptr++;
|
rsb_ptr++;
|
||||||
rsb_ptr %= RSBSize;
|
rsb_ptr %= RSB_SIZE;
|
||||||
rsb_location_desciptors[rsb_ptr] = imm64; //< The UniqueHash
|
rsb_location_desciptors[rsb_ptr] = imm64; //< The UniqueHash
|
||||||
rsb_codeptr[rsb_ptr] = /* codeptr corresponding to the UniqueHash */;
|
rsb_codeptr[rsb_ptr] = /* codeptr corresponding to the UniqueHash */;
|
||||||
label:
|
label:
|
||||||
@@ -559,7 +559,7 @@ label:
|
|||||||
|
|
||||||
To check if a predicition is in the RSB, we linearly scan the RSB.
|
To check if a predicition is in the RSB, we linearly scan the RSB.
|
||||||
|
|
||||||
```c++
|
```cpp
|
||||||
void EmitX64::EmitTerminalPopRSBHint(IR::Term::PopRSBHint, IR::LocationDescriptor initial_location) {
|
void EmitX64::EmitTerminalPopRSBHint(IR::Term::PopRSBHint, IR::LocationDescriptor initial_location) {
|
||||||
using namespace Xbyak::util;
|
using namespace Xbyak::util;
|
||||||
|
|
||||||
@@ -571,7 +571,7 @@ void EmitX64::EmitTerminalPopRSBHint(IR::Term::PopRSBHint, IR::LocationDescripto
|
|||||||
code->or_(rbx, rcx);
|
code->or_(rbx, rcx);
|
||||||
|
|
||||||
code->mov(rax, u64(code->GetReturnFromRunCodeAddress()));
|
code->mov(rax, u64(code->GetReturnFromRunCodeAddress()));
|
||||||
for (size_t i = 0; i < JitState::RSBSize; ++i) {
|
for (size_t i = 0; i < JitState::RSB_SIZE; ++i) {
|
||||||
code->cmp(rbx, qword[code.ABI_JIT_PTR + offsetof(JitState, rsb_location_descriptors) + i * sizeof(u64)]);
|
code->cmp(rbx, qword[code.ABI_JIT_PTR + offsetof(JitState, rsb_location_descriptors) + i * sizeof(u64)]);
|
||||||
code->cmove(rax, qword[code.ABI_JIT_PTR + offsetof(JitState, rsb_codeptrs) + i * sizeof(u64)]);
|
code->cmove(rax, qword[code.ABI_JIT_PTR + offsetof(JitState, rsb_codeptrs) + i * sizeof(u64)]);
|
||||||
}
|
}
|
||||||
@@ -582,10 +582,10 @@ void EmitX64::EmitTerminalPopRSBHint(IR::Term::PopRSBHint, IR::LocationDescripto
|
|||||||
|
|
||||||
In pseudocode:
|
In pseudocode:
|
||||||
|
|
||||||
```c++
|
```cpp
|
||||||
rbx := ComputeUniqueHash()
|
rbx := ComputeUniqueHash()
|
||||||
rax := ReturnToDispatch
|
rax := ReturnToDispatch
|
||||||
for (i := 0 .. RSBSize-1)
|
for (i := 0 .. RSB_SIZE-1)
|
||||||
if (rbx == rsb_location_descriptors[i])
|
if (rbx == rsb_location_descriptors[i])
|
||||||
rax = rsb_codeptrs[i]
|
rax = rsb_codeptrs[i]
|
||||||
goto rax
|
goto rax
|
||||||
|
|||||||
+9
-314
@@ -3,175 +3,20 @@ Dynarmic
|
|||||||
|
|
||||||
A dynamic recompiler for ARM.
|
A dynamic recompiler for ARM.
|
||||||
|
|
||||||
Highlight features:
|
*Note that an adversarial guest program [can determine if it's being ran under Dynarmic](#disadvantages-of-dynarmic). Preventing this is not a goal of this project.*
|
||||||
|
|
||||||
- Fast dynamic binary translation via Just-in-Time compilation
|
Cortex-A57 (32 and 64 bit) is the emulated guest target. See [ArchVersion](../../src/dynarmic/src/dynarmic/interface/A32/arch_version.h).
|
||||||
- Clean API
|
|
||||||
- Implemented in modern C++20
|
|
||||||
- Hooks exposed for easy code instrumentation
|
|
||||||
- Code injection support for very fine-grained instrumentation
|
|
||||||
- Support for unusual address space setups (bring-your-own memory system)
|
|
||||||
- Native support for most popular operating systems (Windows, macOS, Linux, FreeBSD, OpenBSD, NetBSD, Android)
|
|
||||||
|
|
||||||
*Please note that an adversarial guest program [can determine if it is being run under dynarmic](#disadvantages-of-dynarmic). Preventing this is not a goal of this project.*
|
The only supported host architectures are x86-64, and AArch64. There are no plans to support any 32-bit architectures.
|
||||||
|
|
||||||
### Supported guest architectures
|
See [an example usage](../../src/dynarmic/tests/print_info.cpp).
|
||||||
|
|
||||||
* v3
|
|
||||||
* v4
|
|
||||||
* v4T
|
|
||||||
* v5TE
|
|
||||||
* v6K
|
|
||||||
* v6T2
|
|
||||||
* v7A
|
|
||||||
* 32-bit v8
|
|
||||||
* 64-bit v8
|
|
||||||
|
|
||||||
You can specify the specific guest version using [ArchVersion](src/dynarmic/interface/A32/arch_version.h).
|
|
||||||
|
|
||||||
There are no plans to support v1 or v2.
|
|
||||||
|
|
||||||
### Supported host architectures
|
|
||||||
|
|
||||||
* x86-64
|
|
||||||
* AArch64
|
|
||||||
|
|
||||||
There are no plans to support any 32-bit architecture.
|
|
||||||
|
|
||||||
Important API Changes in v6.x Series
|
|
||||||
------------------------------------
|
|
||||||
|
|
||||||
* **v6.7.0**
|
|
||||||
* To support use cases where one wants to have the guest to have the same address space as the host, `nullptr` is now a valid value for `fastmem_pointer`.
|
|
||||||
**This change is not backwards-compatible.** If you were previously using `nullptr` to represent an invalid fastmem arena, you will now have to use `std::nullopt`.
|
|
||||||
|
|
||||||
|
|
||||||
Documentation
|
|
||||||
-------------
|
|
||||||
|
|
||||||
Design documentation can be found at [./Design.md](./Design.md).
|
Design documentation can be found at [./Design.md](./Design.md).
|
||||||
|
|
||||||
|
|
||||||
Usage Example
|
|
||||||
-------------
|
|
||||||
|
|
||||||
The below is a minimal example. Bring-your-own memory system.
|
|
||||||
|
|
||||||
```cpp
|
|
||||||
#include <array>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <cstdio>
|
|
||||||
#include <exception>
|
|
||||||
|
|
||||||
#include "dynarmic/interface/A32/a32.h"
|
|
||||||
#include "dynarmic/interface/A32/config.h"
|
|
||||||
|
|
||||||
using u8 = std::uint8_t;
|
|
||||||
using u16 = std::uint16_t;
|
|
||||||
using u32 = std::uint32_t;
|
|
||||||
using u64 = std::uint64_t;
|
|
||||||
|
|
||||||
class MyEnvironment final : public Dynarmic::A32::UserCallbacks {
|
|
||||||
public:
|
|
||||||
u64 ticks_left = 0;
|
|
||||||
std::array<u8, 2048> memory{};
|
|
||||||
|
|
||||||
u8 MemoryRead8(u32 vaddr) override {
|
|
||||||
if (vaddr >= memory.size()) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return memory[vaddr];
|
|
||||||
}
|
|
||||||
|
|
||||||
u16 MemoryRead16(u32 vaddr) override {
|
|
||||||
return u16(MemoryRead8(vaddr)) | u16(MemoryRead8(vaddr + 1)) << 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 MemoryRead32(u32 vaddr) override {
|
|
||||||
return u32(MemoryRead16(vaddr)) | u32(MemoryRead16(vaddr + 2)) << 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
u64 MemoryRead64(u32 vaddr) override {
|
|
||||||
return u64(MemoryRead32(vaddr)) | u64(MemoryRead32(vaddr + 4)) << 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemoryWrite8(u32 vaddr, u8 value) override {
|
|
||||||
if (vaddr >= memory.size()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
memory[vaddr] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemoryWrite16(u32 vaddr, u16 value) override {
|
|
||||||
MemoryWrite8(vaddr, u8(value));
|
|
||||||
MemoryWrite8(vaddr + 1, u8(value >> 8));
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemoryWrite32(u32 vaddr, u32 value) override {
|
|
||||||
MemoryWrite16(vaddr, u16(value));
|
|
||||||
MemoryWrite16(vaddr + 2, u16(value >> 16));
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemoryWrite64(u32 vaddr, u64 value) override {
|
|
||||||
MemoryWrite32(vaddr, u32(value));
|
|
||||||
MemoryWrite32(vaddr + 4, u32(value >> 32));
|
|
||||||
}
|
|
||||||
|
|
||||||
void CallSVC(u32 swi) override {
|
|
||||||
// Do something.
|
|
||||||
}
|
|
||||||
|
|
||||||
void ExceptionRaised(u32 pc, Dynarmic::A32::Exception exception) override {
|
|
||||||
// Do something.
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddTicks(u64 ticks) override {
|
|
||||||
if (ticks > ticks_left) {
|
|
||||||
ticks_left = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ticks_left -= ticks;
|
|
||||||
}
|
|
||||||
|
|
||||||
u64 GetTicksRemaining() override {
|
|
||||||
return ticks_left;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
|
||||||
MyEnvironment env;
|
|
||||||
Dynarmic::A32::UserConfig user_config;
|
|
||||||
user_config.callbacks = &env;
|
|
||||||
Dynarmic::A32::Jit cpu{user_config};
|
|
||||||
|
|
||||||
// Execute at least 1 instruction.
|
|
||||||
// (Note: More than one instruction may be executed.)
|
|
||||||
env.ticks_left = 1;
|
|
||||||
|
|
||||||
// Write some code to memory.
|
|
||||||
env.MemoryWrite16(0, 0x0088); // lsls r0, r1, #2
|
|
||||||
env.MemoryWrite16(2, 0xE7FE); // b +#0 (infinite loop)
|
|
||||||
|
|
||||||
// Setup registers.
|
|
||||||
cpu.Regs()[0] = 1;
|
|
||||||
cpu.Regs()[1] = 2;
|
|
||||||
cpu.Regs()[15] = 0; // PC = 0
|
|
||||||
cpu.SetCpsr(0x00000030); // Thumb mode
|
|
||||||
|
|
||||||
// Execute!
|
|
||||||
cpu.Run();
|
|
||||||
|
|
||||||
// Here we would expect cpu.Regs()[0] == 8
|
|
||||||
printf("R0: %u\n", cpu.Regs()[0]);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Alternatives to Dynarmic
|
Alternatives to Dynarmic
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
Here are some projects with the same goals as dynarmic:
|
Here are some projects with the same goals as Dynarmic:
|
||||||
|
|
||||||
* [Unicorn](https://www.unicorn-engine.org/) - Recompiling multi-architecture CPU emulator, based on QEMU
|
* [Unicorn](https://www.unicorn-engine.org/) - Recompiling multi-architecture CPU emulator, based on QEMU
|
||||||
* [SkyEye](http://skyeye.sourceforge.net) - Cached interpreter for ARM
|
* [SkyEye](http://skyeye.sourceforge.net) - Cached interpreter for ARM
|
||||||
@@ -189,8 +34,8 @@ More general alternatives:
|
|||||||
Disadvantages of Dynarmic
|
Disadvantages of Dynarmic
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
In the pursuit of speed, some behavior not commonly depended upon is elided. Therefore this emulator does not match spec.
|
In the pursuit of speed, some behavior not commonly depended upon is elided. Hence this emulator doesn't match spec.
|
||||||
Please note that this would mean that a guest application can easily determine if it is being run under instrumentation.
|
Note that this would mean that a guest application can easily determine if it's being ran under instrumentation.
|
||||||
|
|
||||||
Known examples:
|
Known examples:
|
||||||
|
|
||||||
@@ -205,156 +50,6 @@ Use this code base at your own risk.
|
|||||||
Legal
|
Legal
|
||||||
-----
|
-----
|
||||||
|
|
||||||
dynarmic is under a 0BSD license. See LICENSE.txt for more details.
|
Dynarmic is under a GPLv3 license, check the relevant file headers for more information.
|
||||||
|
|
||||||
dynarmic uses several other libraries, whose licenses are included below:
|
Dynarmic uses several open-source libraries, whose licenses are included inside thereof.
|
||||||
|
|
||||||
### biscuit
|
|
||||||
|
|
||||||
```
|
|
||||||
Copyright 2021 Lioncash/Lioncache
|
|
||||||
|
|
||||||
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.
|
|
||||||
```
|
|
||||||
|
|
||||||
### catch
|
|
||||||
|
|
||||||
```
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person or organization
|
|
||||||
obtaining a copy of the software and accompanying documentation covered by
|
|
||||||
this license (the "Software") to use, reproduce, display, distribute,
|
|
||||||
execute, and transmit the Software, and to prepare derivative works of the
|
|
||||||
Software, and to permit third-parties to whom the Software is furnished to
|
|
||||||
do so, all subject to the following:
|
|
||||||
|
|
||||||
The copyright notices in the Software and this entire statement, including
|
|
||||||
the above license grant, this restriction and the following disclaimer,
|
|
||||||
must be included in all copies of the Software, in whole or in part, and
|
|
||||||
all derivative works of the Software, unless such copies or derivative
|
|
||||||
works are solely in the form of machine-executable object code generated by
|
|
||||||
a source language processor.
|
|
||||||
|
|
||||||
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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
|
||||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
|
||||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
|
||||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
DEALINGS IN THE SOFTWARE.
|
|
||||||
```
|
|
||||||
|
|
||||||
### fmt
|
|
||||||
|
|
||||||
```
|
|
||||||
Copyright (c) 2012 - 2016, Victor Zverovich
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright notice, this
|
|
||||||
list of conditions and the following disclaimer.
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
||||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
```
|
|
||||||
|
|
||||||
### mcl & oaknut
|
|
||||||
|
|
||||||
```
|
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2022 merryhime <https://mary.rs>
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
```
|
|
||||||
Copyright (c) 2007 MITSUNARI Shigeo
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
Redistributions of source code must retain the above copyright notice, this
|
|
||||||
list of conditions and the following disclaimer.
|
|
||||||
Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
Neither the name of the copyright owner nor the names of its contributors may
|
|
||||||
be used to endorse or promote products derived from this software without
|
|
||||||
specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
||||||
THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
-----------------------------------------------------------------------------
|
|
||||||
ソースコード形式かバイナリ形式か、変更するかしないかを問わず、以下の条件を満た
|
|
||||||
す場合に限り、再頒布および使用が許可されます。
|
|
||||||
|
|
||||||
ソースコードを再頒布する場合、上記の著作権表示、本条件一覧、および下記免責条項
|
|
||||||
を含めること。
|
|
||||||
バイナリ形式で再頒布する場合、頒布物に付属のドキュメント等の資料に、上記の著作
|
|
||||||
権表示、本条件一覧、および下記免責条項を含めること。
|
|
||||||
書面による特別の許可なしに、本ソフトウェアから派生した製品の宣伝または販売促進
|
|
||||||
に、著作権者の名前またはコントリビューターの名前を使用してはならない。
|
|
||||||
本ソフトウェアは、著作権者およびコントリビューターによって「現状のまま」提供さ
|
|
||||||
れており、明示黙示を問わず、商業的な使用可能性、および特定の目的に対する適合性
|
|
||||||
に関する暗黙の保証も含め、またそれに限定されない、いかなる保証もありません。
|
|
||||||
著作権者もコントリビューターも、事由のいかんを問わず、 損害発生の原因いかんを
|
|
||||||
問わず、かつ責任の根拠が契約であるか厳格責任であるか(過失その他の)不法行為で
|
|
||||||
あるかを問わず、仮にそのような損害が発生する可能性を知らされていたとしても、
|
|
||||||
本ソフトウェアの使用によって発生した(代替品または代用サービスの調達、使用の
|
|
||||||
喪失、データの喪失、利益の喪失、業務の中断も含め、またそれに限定されない)直接
|
|
||||||
損害、間接損害、偶発的な損害、特別損害、懲罰的損害、または結果損害について、
|
|
||||||
一切責任を負わないものとします。
|
|
||||||
```
|
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ All code, AI or not, is held under a **strict standard of excellence**. AI/LLM-g
|
|||||||
|
|
||||||
## Licensing concerns
|
## Licensing concerns
|
||||||
|
|
||||||
This is an area of ongoing litigation, and as such is still very iffy. For the time being, know that allowing AI to ingest the codebase may end up with its copyleft code regurgitated into incompatibly-licensed proprietary or permissive software. For you, this means to **not** feed code into LLMs.
|
This is an area of ongoing litigation, and as such, is still very iffy. For the time being, know that allowing AI to ingest the codebase may end up with its copyleft code regurgitated into incompatibly-licensed proprietary or permissive software. For you, this means to **not** feed code into LLMs.
|
||||||
|
|
||||||
AI models may have also ingested AGPLv3 code, which is license-incompatible with our codebase.
|
AI models may have also ingested AGPLv3 code, which is license-incompatible with our codebase.
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ Everyone has their own way of viewing good/bad C++ practices, my general outline
|
|||||||
- Exploit the fact `std::atomic<uint32_t>/std::atomic<int32_t>` is basically free on most arches that matter.
|
- Exploit the fact `std::atomic<uint32_t>/std::atomic<int32_t>` is basically free on most arches that matter.
|
||||||
- In x86_64, an atomic `uint32_t` is basically `mov [m32], r32`, which is essentially free/cheap.
|
- In x86_64, an atomic `uint32_t` is basically `mov [m32], r32`, which is essentially free/cheap.
|
||||||
- Avoid template parameters unless you really need them.
|
- Avoid template parameters unless you really need them.
|
||||||
- For small inlineable functions this is fine, for more complex ones, please consider the generated assembly.
|
- For small inline-able functions this is fine, for more complex ones, consider the generated assembly.
|
||||||
- Dont make your own memcpy/memset/strcpy/strncpy/etc.
|
- Don't make your own memcpy/memset/strcpy/strncpy/etc.
|
||||||
- Seriously DON'T DO THIS. You will NOT beat the compiler.
|
- Seriously DON'T DO THIS. You will NOT beat the compiler.
|
||||||
- Nor 30 years of writing optimized `mem*`.
|
- Nor 30 years of writing optimized `mem*`.
|
||||||
- If your code is slow, don't blame `mem*`, blame your code.
|
- If your code is slow, don't blame `mem*`, blame your code.
|
||||||
@@ -37,7 +37,7 @@ Everyone has their own way of viewing good/bad C++ practices, my general outline
|
|||||||
- Function parameters are cheap. Don't be afraid to use as many as needed (API usability permitting).
|
- Function parameters are cheap. Don't be afraid to use as many as needed (API usability permitting).
|
||||||
- Don't save a reference in structures of a parent object, i.e:
|
- Don't save a reference in structures of a parent object, i.e:
|
||||||
|
|
||||||
```c++
|
```cpp
|
||||||
struct Child {
|
struct Child {
|
||||||
Parent& parent;
|
Parent& parent;
|
||||||
void Mehod() {
|
void Mehod() {
|
||||||
@@ -48,7 +48,7 @@ Everyone has their own way of viewing good/bad C++ practices, my general outline
|
|||||||
|
|
||||||
- Instead you can do the following:
|
- Instead you can do the following:
|
||||||
|
|
||||||
```c++
|
```cpp
|
||||||
struct Child {
|
struct Child {
|
||||||
void Mehod(Parent& parent) {
|
void Mehod(Parent& parent) {
|
||||||
parent.Something();
|
parent.Something();
|
||||||
@@ -66,6 +66,6 @@ Programming, alongside the physical act of writing code, also consists of archit
|
|||||||
- Dependencies that are legitimately useful to have are few and far between.
|
- Dependencies that are legitimately useful to have are few and far between.
|
||||||
- At the same time, NIHing your own implementations of widely adopted algorithms or standards can be quite subpar.
|
- At the same time, NIHing your own implementations of widely adopted algorithms or standards can be quite subpar.
|
||||||
- For dependencies that are very large but contain something you need, consider cherry-picking the individual files it needs (or writing a smaller version of it)
|
- For dependencies that are very large but contain something you need, consider cherry-picking the individual files it needs (or writing a smaller version of it)
|
||||||
- Try to rely less on indirection for architecturing systems
|
- Try to rely less on indirection for architecting systems
|
||||||
- If the underlying HLE kernel emulation requires it, try making a solution that keeps things local
|
- If the underlying HLE kernel emulation requires it, try making a solution that keeps things local
|
||||||
- For example, there isn't a need for file descriptors to each be a pointer, when they could be a fixed table size with elements that may be emplaced at will.
|
- For example, there isn't a need for file descriptors to each be a pointer, when they could be a fixed table size with elements that may be emplaced at will.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Use this guide whenever you want to modify the Date or Time that Eden reports to games. This can be useful for modifying RNG elements, skipping wait times in games, etc.
|
Use this guide whenever you want to modify the Date or Time that Eden reports to games. This can be useful for modifying RNG elements, skipping wait times in games, etc.
|
||||||
|
|
||||||
**Click [Here](https://evilperson1337.notion.site/Setting-a-Custom-Date-Time-in-Eden-2b357c2edaf680acb8d4e63ccc126564) for a version of this guide with images & visual elements.**
|
**[See here](https://evilperson1337.notion.site/Setting-a-Custom-Date-Time-in-Eden-2b357c2edaf680acb8d4e63ccc126564) for an illustrated guide.**
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
+18
-14
@@ -44,7 +44,7 @@ Only Fedora/riscv64 has been tested, but in theory, every riscv64 distribution t
|
|||||||
|
|
||||||
## Other
|
## Other
|
||||||
|
|
||||||
Other architectures, such as SPARC, MIPS, PowerPC, Loong, and all 32-bit architectures are completely unsupported, as there is no JIT backend or emitter thereof. If you want support for it--submit patches!
|
Other architectures, such as SPARC, MIPS, PowerPC, Loong, and all 32-bit architectures are completely unsupported, as there is no JIT backend or emitter thereof. If you want support for it -- submit patches!
|
||||||
|
|
||||||
IA-64 (Itanium) support is completely unknown. Existing amd64 packages will not run on IA-64 (assuming you can even find a supported Windows/Linux distribution)
|
IA-64 (Itanium) support is completely unknown. Existing amd64 packages will not run on IA-64 (assuming you can even find a supported Windows/Linux distribution)
|
||||||
|
|
||||||
@@ -52,28 +52,32 @@ IA-64 (Itanium) support is completely unknown. Existing amd64 packages will not
|
|||||||
|
|
||||||
The vast majority of Eden's testing is done on Windows, Linux, and Android. However, first-class support is also provided for:
|
The vast majority of Eden's testing is done on Windows, Linux, and Android. However, first-class support is also provided for:
|
||||||
|
|
||||||
- HaikuOS
|
- FreeBSD (amd64, aarch64)
|
||||||
- FreeBSD
|
- HaikuOS (amd64)
|
||||||
- OpenBSD
|
- OpenBSD (amd64)
|
||||||
- NetBSD
|
- NetBSD (amd64)
|
||||||
- OpenIndiana (Solaris)
|
- macOS (aarch64)
|
||||||
- macOS
|
- OpenIndiana aka. OpenSolaris (amd64)
|
||||||
|
|
||||||
## Linux
|
## Linux
|
||||||
|
|
||||||
While all modern Linux distributions are supported (Fedora >40, Ubuntu >24.04, Debian >12, Arch, Gentoo, etc.), the vast majority of testing and development for Linux is on Arch and Gentoo. Most major build system changes are tested on Gentoo first and foremost, so if builds fail on any modern distribution no matter what you do, it's likely a bug and should be reported.
|
While all modern Linux distributions are supported (Fedora >40, Ubuntu >24.04, Debian >12, Arch, Gentoo, etc.), the vast majority of testing and development for Linux is on Arch and Gentoo. Most major build system changes are tested on Gentoo first and foremost, so if builds fail on any modern distribution no matter what you do, it's likely a bug and should be reported.
|
||||||
|
|
||||||
Intel and Nvidia GPU support is limited. AMD (RADV) drivers receive first-class testing and are known to provide the most stable Eden experience possible.
|
Intel and NVIDIA GPU support is limited. AMD (RADV) drivers receive first-class testing and are known to provide the most stable Eden experience possible.
|
||||||
|
|
||||||
Wayland is not recommended. Testing has shown significantly worse performance on most Wayland compositors compared to X11, alongside mysterious bugs and compatibility errors. For now, set `QT_QPA_PLATFORM=xcb` when running Eden, or pass `-platform xcb` to the launch arguments.
|
Wayland is not recommended. Testing has shown significantly worse performance on most Wayland compositors compared to X11, alongside mysterious bugs and compatibility errors. For now, set `QT_QPA_PLATFORM=xcb` when running Eden, or pass `-platform xcb` to the launch arguments.
|
||||||
|
|
||||||
## Windows
|
## Windows
|
||||||
|
|
||||||
Windows 10 and 11 are supported. Support for Windows 8.x is unknown, and Windows 7 support is unlikely to ever be added.
|
Windows 10 and 11 are supported. Anything below is unsupported.
|
||||||
|
|
||||||
In order to run Eden, you will probably need to install the [Visual C++ Redistributable](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170).
|
To run Eden, you'll need to install [Visual C++ Redistributable](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170).
|
||||||
|
|
||||||
Neither AMD nor Nvidia drivers work nearly as well as Linux's RADV drivers. Compatibility is still largely the same, but performance and some hard-to-run games may suffer compared to Linux.
|
Neither AMD/NVIDIA drivers work nearly as well as Linux's RADV drivers. Compatibility is still largely the same, but performance and some hard-to-run games may suffer compared to Linux.
|
||||||
|
|
||||||
|
### Windows on ARM
|
||||||
|
|
||||||
|
If you're using Snapdragon X or 8CX, install the [Vulkan translation layer](https://apps.microsoft.com/detail/9nqpsl29bfff?hl=en-us&gl=USE) only if the stock drivers don't work. And of course always keep your system up-to-date.
|
||||||
|
|
||||||
## Android
|
## Android
|
||||||
|
|
||||||
@@ -123,13 +127,13 @@ Do note that building the GUI version with Qt versions higher than 6.7.3 will ca
|
|||||||
|
|
||||||
## *BSD, Solaris
|
## *BSD, Solaris
|
||||||
|
|
||||||
BSD and Solaris distributions tend to lag behind Linux in terms of Vulkan and other library compatibility. For example, OpenIndiana (Solaris) does not properly package Qt, meaning the recommended method of usage is to use `eden-cli` only for now. Solaris also generally works better with OpenGL.
|
BSD and Solaris distributions tend to lag behind Linux in terms of Vulkan and ports. For example, OpenIndiana (Solaris) does not properly package Qt, meaning the recommended method of usage is to use `eden-cli` for now. Solaris also generally works better with OpenGL.
|
||||||
|
|
||||||
AMD GPU support on these platforms is limited or nonexistent.
|
AMD GPU support on these platforms is limited or nonexistent, bar for OpenBSD which has a dedicated AMD GPU stack.
|
||||||
|
|
||||||
## HaikuOS
|
## HaikuOS
|
||||||
|
|
||||||
HaikuOS supports (see below) Vulkan 1.3 and has Mesa 24.0. Because OpenGL ES is used instead of the desktop flavour of OpenGL the OpenGL backend is actually worse than the Vulkan one in terms of stability and system support. OpenGL is highly not recommended due to it being: out of tree builds of Mesa and generally unstable ones at that. Users are advised to use Vulkan whenever possible.
|
HaikuOS supports (see below) Vulkan 1.3 and has Mesa 24.0. Because OpenGL ES is used instead of the desktop flavour of OpenGL the OpenGL backend is actually worse than the Vulkan one in terms of stability and system support. OpenGL is highly not recommended due to it being out of tree builds of Mesa and generally unstable ones at that. Users are advised to use Vulkan instead.
|
||||||
|
|
||||||
- Additionally system drivers for NVIDIA and Intel iGPUs exist and provide a native Vulkan ICD with the `Xcb` interface as opposed to the native `BView`
|
- Additionally system drivers for NVIDIA and Intel iGPUs exist and provide a native Vulkan ICD with the `Xcb` interface as opposed to the native `BView`
|
||||||
- In order to obtain Vulkan 1.3 support with native `BView` support; Swiftshader can be compiled from source [see this thread](https://discuss.haiku-os.org/t/swiftshader-vulkan-software-renderer-on-haiku/11526/6).
|
- In order to obtain Vulkan 1.3 support with native `BView` support; Swiftshader can be compiled from source [see this thread](https://discuss.haiku-os.org/t/swiftshader-vulkan-software-renderer-on-haiku/11526/6).
|
||||||
|
|||||||
+6
-6
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
Eden is a very complicated piece of software, and as such there are many knobs and toggles that can be configured. Most of these are invisible to normal users, however power users may be able to leverage them to their advantage.
|
Eden is a very complicated piece of software, there are many knobs and toggles that can be configured. Most of these are invisible to normal users, however, power users may be able to leverage them to their advantage.
|
||||||
|
|
||||||
This handbook primarily describes such knobs and toggles. Normal configuration options are described within the emulator itself and will not be covered in detail.
|
This handbook primarily describes such knobs and toggles. Normal configuration options are described within the emulator itself and will not be covered in detail.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
The emulator is very demanding on hardware, and as such requires a decent mid-range computer/cellphone.
|
The emulator is very demanding on hardware and requires a decent mid-range computer/cellphone.
|
||||||
|
|
||||||
See [the requirements page](https://archive.is/sv83h) for recommended and minimum specs.
|
See [the requirements page](https://archive.is/sv83h) for recommended and minimum specs.
|
||||||
|
|
||||||
@@ -22,8 +22,8 @@ If your GPU doesn't support or is just behind by a minor version, see Mesa envir
|
|||||||
- RC releases: Release candidate, generally "less stable but still stable" versions.
|
- RC releases: Release candidate, generally "less stable but still stable" versions.
|
||||||
- Full release: "The stablest possible you could get".
|
- Full release: "The stablest possible you could get".
|
||||||
- Nightly: Builds done around 2PM UTC (if there are any changes), generally stable, but not recommended for the average user. These contain daily updates and may contain critical fixes for some games.
|
- Nightly: Builds done around 2PM UTC (if there are any changes), generally stable, but not recommended for the average user. These contain daily updates and may contain critical fixes for some games.
|
||||||
- Master: Unstable builds, can lead from a game working exceptionally fine to absolute crashing in some systems because someone forgot to check if NixOS or Solaris worked. These contain straight from the oven fixes, please don't use them unless you plan to contribute something! They're very experimental! Still 95% of the time it will work just fine.
|
- Master: Unstable builds, can range from games working exceptionally well to instantly crashing. These contain straight from the oven fixes, don't use them unless you plan to contribute something! They're very experimental! Still 95% of the time they will work just fine.
|
||||||
- PR builds: Highly experimental builds, testers may grab from these. The average user should treat them the same as master builds, except sometimes they straight up don't build/work.
|
- PR builds: Highly experimental builds, testers may grab from these. The average user should treat them the same as master builds.
|
||||||
|
|
||||||
## User configuration
|
## User configuration
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ Eden will store configuration files in the following directories:
|
|||||||
- **Linux, macOS, FreeBSD, Solaris, OpenBSD**: `$XDG_DATA_HOME`, `$XDG_CACHE_HOME`, `$XDG_CONFIG_HOME`.
|
- **Linux, macOS, FreeBSD, Solaris, OpenBSD**: `$XDG_DATA_HOME`, `$XDG_CACHE_HOME`, `$XDG_CONFIG_HOME`.
|
||||||
- **HaikuOS**: `/boot/home/config/settings/eden`
|
- **HaikuOS**: `/boot/home/config/settings/eden`
|
||||||
|
|
||||||
If a `user` directory is present in the current working directory, that will override all global configuration directories and the emulator will use that instead.
|
If a `user` directory is present in the current working directory, that will override all global configuration directories and the emulator will use the `user` directory instead.
|
||||||
|
|
||||||
### Environment variables
|
### Environment variables
|
||||||
|
|
||||||
@@ -64,4 +64,4 @@ Then just running `chmod +x script.sh && source script.sh`.
|
|||||||
|
|
||||||
## Compatibility list
|
## Compatibility list
|
||||||
|
|
||||||
Eden doesn't mantain a compatibility list. However, [EmuReady](https://www.emuready.com/) has a more fine-grained compatibility information for multiple emulators/forks as well.
|
Eden doesn't maintain a compatibility list. However, [EmuReady](https://www.emuready.com/) has a more fine-grained compatibility information for multiple emulators/forks as well.
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ If they don't run - then that's a bug!
|
|||||||
|
|
||||||
## Atmosphere
|
## Atmosphere
|
||||||
|
|
||||||
Fusee Galee, the bootloader and other low-level mechanisms are not emulated at the moment.
|
Fusée Gelée, the bootloader and other low-level mechanisms are not emulated at the moment.
|
||||||
|
|
||||||
Having OFW is recommended, but may not be required (untested).
|
Having OFW is recommended, but may not be required (untested).
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ There are two main applications, an SDL-based app (`eden-cli`) and a Qt based ap
|
|||||||
|
|
||||||
## eden
|
## eden
|
||||||
|
|
||||||
- `./eden <path>`: Running with a single argument and nothing else, will make the emulator look for the given file and load it, this behaviour is similar to `eden-cli`; allows dragging and dropping games into the application.
|
- `./eden <path>`: Running with a single argument and nothing else, will make the emulator look for the given file and load it, this behavior is similar to `eden-cli`; allows dragging and dropping games into the application.
|
||||||
- `-g <path>`: Alternate way to specify what to load, overrides. However let it be noted that arguments that use `-` will be treated as options/ignored, if your game, for some reason, starts with `-`, in order to safely handle it you may need to specify it as an argument.
|
- `-g <path>`: Alternate way to specify what to load, overrides. However let it be noted that arguments that use `-` will be treated as options/ignored, if your game, for some reason, starts with `-`, in order to safely handle it you may need to specify it as an argument.
|
||||||
- `-f`: Use fullscreen.
|
- `-f`: Use fullscreen.
|
||||||
- `-u <number>`: Select the index of the user to load as.
|
- `-u <number>`: Select the index of the user to load as.
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
# User Handbook - Controllers
|
# User Handbook - Controllers
|
||||||
|
|
||||||
Most of the controls should work out of the box. If not, please use a joystick calibrator to ensure it's not an issue with your own controller, for example:
|
Most of the controls should work out of the box. If not, use a joystick calibrator to ensure it's not an issue with your own controller, for example:
|
||||||
|
|
||||||
- https://github.com/dkosmari/calibrate-joystick
|
- https://github.com/dkosmari/calibrate-joystick
|
||||||
|
|
||||||
## Using external controllers on the Steamdeck
|
## Using external controllers on the Steamdeck
|
||||||
|
|
||||||
In desktop mode ignore your pro controller/xbox contoller external controller and use **Steam Virtual Gamepad 0 as Player 1**. If you have multiple external controllers set **Player 2 to Steam Virtual Gamepad 1**. Steam app must not be closed on desktop mode.
|
In desktop mode ignore your Pro controller/XBOX controller external controller and use **Steam Virtual Gamepad 0 as Player 1**. If you have multiple external controllers set **Player 2 to Steam Virtual Gamepad 1**. Steam app must not be closed on desktop mode.
|
||||||
|
|
||||||
Here's the annoying part of it. When waking up the steam deck from sleep try not to touch any button on the Steamdeck and turn on your external controller. Then open the Eden.AppImage. If you're lucky you can get your external controller to be position 0 and also Steam Virtual Gamepad 0 in desktop mode. If not that is ok too unless you need to configure player 1 to have gyro. You might need to repeat this to get your external controller as Steam Virtual Gamepad 0 so you can config Player 1 having gyro. You might be able to config player 1 to have gyro with the Steamdeck itself. Or you can also config player 1, 2, 3, etc, to have gyro somehow. Make sure they are all using Virtual Gamepads though.
|
Here's the annoying part of it. When waking up the steam deck from sleep try not to touch any button on the Steamdeck and turn on your external controller. Then open the Eden.AppImage. If you're lucky you can get your external controller to be position 0 and also Steam Virtual Gamepad 0 in desktop mode. If not that is ok too unless you need to configure player 1 to have gyro. You might need to repeat this to get your external controller as Steam Virtual Gamepad 0 so you can config Player 1 having gyro. You might be able to config player 1 to have gyro with the Steamdeck itself. Or you can also config player 1, 2, 3, etc, to have gyro somehow. Make sure they are all using Virtual Gamepads though.
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ Basically the Steamdeck or the external controller is fighting for position 0 an
|
|||||||
|
|
||||||
Use this guide for when you want to configure specific controller settings to be reused.
|
Use this guide for when you want to configure specific controller settings to be reused.
|
||||||
|
|
||||||
**Click [Here](https://evilperson1337.notion.site/Configuring-Controller-Profiles-2be57c2edaf680eabc3ac8c333ec75c4) for a version of this guide with images & visual elements.**
|
**[See here](https://evilperson1337.notion.site/Configuring-Controller-Profiles-2be57c2edaf680eabc3ac8c333ec75c4) for an illustrated guide.**
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -30,8 +30,8 @@ Use this guide for when you want to configure specific controller settings to be
|
|||||||
|
|
||||||
#### Steps
|
#### Steps
|
||||||
1. Launch Eden and wait for it to load.
|
1. Launch Eden and wait for it to load.
|
||||||
2. Navigate to *Emulation > Configure...*
|
2. Navigate to `Emulation > Configure...`
|
||||||
3. Select **Controls** from the left-hand menu and configure your controller for the way you want it to be in game.
|
3. Select **Controls** from the left-hand menu and configure your controller for the way you want it to be in-game.
|
||||||
4. Select **New** and enter a name for the profile in the box that appears. Press **OK** to save the profile settings.
|
4. Select **New** and enter a name for the profile in the box that appears. Press **OK** to save the profile settings.
|
||||||
5. Select **OK** to close the settings menu.
|
5. Select **OK** to close the settings menu.
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ Use this guide for when you want to configure specific controller settings to be
|
|||||||
|
|
||||||
Use this guide when you want to set up specific controller profiles for specific games. This can be useful for certain games like *Captain Toad Treasure Tracker* where a blue dot appears in the middle of the screen when you have docked mode enabled, but not handheld mode.
|
Use this guide when you want to set up specific controller profiles for specific games. This can be useful for certain games like *Captain Toad Treasure Tracker* where a blue dot appears in the middle of the screen when you have docked mode enabled, but not handheld mode.
|
||||||
|
|
||||||
**Click [Here](https://evilperson1337.notion.site/Setting-Controller-Profiles-By-Game-2b057c2edaf681658a57f0c199cb6083) for a version of this guide with images & visual elements.**
|
**[See here](https://evilperson1337.notion.site/Setting-Controller-Profiles-By-Game-2b057c2edaf681658a57f0c199cb6083) for an illustrated guide.**
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -47,7 +47,6 @@ Use this guide when you want to set up specific controller profiles for specific
|
|||||||
|
|
||||||
- Eden Emulator set up and fully configured
|
- Eden Emulator set up and fully configured
|
||||||
- Controller Profile Created
|
- Controller Profile Created
|
||||||
- See [*Configuring Controller Profiles*](./ControllerProfiles.md) for instructions on how to do this if needed.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ HaikuOS bundles a Mesa library that doesn't support full core OpenGL 4.6 (requir
|
|||||||
### Fixes for Windows 10 and above having "Device loss"
|
### Fixes for Windows 10 and above having "Device loss"
|
||||||
|
|
||||||
Run the following batch script *inside* the Eden folder:
|
Run the following batch script *inside* the Eden folder:
|
||||||
```cmd
|
```bat
|
||||||
@echo off
|
@echo off
|
||||||
pushd "%~dp0"
|
pushd "%~dp0"
|
||||||
if exist "%temp%\FixFullScreen.reg" (
|
if exist "%temp%\FixFullScreen.reg" (
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Getting Gyro/Motion Controls Working on Steam Deck
|
# Getting Gyro/Motion Controls Working on Steam Deck
|
||||||
Use this guide when you want to use the Steam Deck's native gyro functionality for motion controls in Eden.
|
Use this guide when you want to use the Steam Deck's native gyro functionality for motion controls in Eden.
|
||||||
|
|
||||||
**Click [Here](https://evilperson1337.notion.site/Getting-Gyro-Motion-Controls-Working-on-Steam-Deck-2b057c2edaf681a1aaade35db6e0fd1b) for a version of this guide with images & visual elements.**
|
**[See here](https://evilperson1337.notion.site/Getting-Gyro-Motion-Controls-Working-on-Steam-Deck-2b057c2edaf681a1aaade35db6e0fd1b) for an illustrated guide.**
|
||||||
|
|
||||||
## Steamdeck
|
## Steamdeck
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Use this when you need to review the logs to determine an issue or provide them to a member of the Eden team.
|
Use this when you need to review the logs to determine an issue or provide them to a member of the Eden team.
|
||||||
|
|
||||||
**Click [Here](https://evilperson1337.notion.site/How-to-Access-Logs-2b057c2edaf68105a281fe1688a332d4) for a version of this guide with images & visual elements.**
|
**[See here](https://evilperson1337.notion.site/How-to-Access-Logs-2b057c2edaf68105a281fe1688a332d4) for an illustrated guide.**
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Use this guide when you want to manually import save files for use in the Eden emulator.
|
Use this guide when you want to manually import save files for use in the Eden emulator.
|
||||||
|
|
||||||
**Click [Here](https://evilperson1337.notion.site/Importing-Saves-Into-Eden-2b057c2edaf681fe968df8d63821ccae) for a version of this guide with images & visual elements.**
|
**[See here](https://evilperson1337.notion.site/Importing-Saves-Into-Eden-2b057c2edaf681fe968df8d63821ccae) for an illustrated guide.**
|
||||||
|
|
||||||
### Pre-Requisites
|
### Pre-Requisites
|
||||||
- Eden emulator already set up and configured.
|
- Eden emulator already set up and configured.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Use this guide for when you want to install an Atmosphere-based mod for use in Eden.
|
Use this guide for when you want to install an Atmosphere-based mod for use in Eden.
|
||||||
|
|
||||||
**Click [Here](https://evilperson1337.notion.site/Installing-Atmosphere-Mods-2b057c2edaf681fe8d39cbfc2d0cc799) for a version of this guide with images & visual elements.**
|
**[See here](https://evilperson1337.notion.site/Installing-Atmosphere-Mods-2b057c2edaf681fe8d39cbfc2d0cc799) for an illustrated guide.**
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ Use this guide when you want to install Updates or DLC for your games in Eden.
|
|||||||
|
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
**Click [Here](https://evilperson1337.notion.site/Working-with-Updates-DLC-in-Eden-2b057c2edaf681dfb65dfc4dd96980c0) for a version of this guide with images & visual elements.**
|
**[See here](https://evilperson1337.notion.site/Working-with-Updates-DLC-in-Eden-2b057c2edaf681dfb65dfc4dd96980c0) for an illustrated guide.**
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
+12
-12
@@ -4,7 +4,7 @@ Use this guide to answer questions regarding and to start using the multiplayer
|
|||||||
## Multiplayer FAQ
|
## Multiplayer FAQ
|
||||||
This FAQ will serve as a general quick question and answer simple questions.
|
This FAQ will serve as a general quick question and answer simple questions.
|
||||||
|
|
||||||
**Click [Here](https://evilperson1337.notion.site/Multiplayer-FAQ-2c357c2edaf680fca2e9ce59969a220f) for a version of this guide with images & visual elements.**
|
**[See here](https://evilperson1337.notion.site/Multiplayer-FAQ-2c357c2edaf680fca2e9ce59969a220f) for an illustrated guide.**
|
||||||
|
|
||||||
### Can Eden Play Games with a Switch Console?
|
### Can Eden Play Games with a Switch Console?
|
||||||
No - The only emulator that has this kind of functionality is *Ryujinx* and it's forks. This solution requires loading a custom module on a modded switch console to work.
|
No - The only emulator that has this kind of functionality is *Ryujinx* and it's forks. This solution requires loading a custom module on a modded switch console to work.
|
||||||
@@ -40,7 +40,7 @@ While it would be nice if everything always worked perfectly - that is not reali
|
|||||||
1. Emulator Version Mismatches
|
1. Emulator Version Mismatches
|
||||||
1. Occasionally updates to the emulator of choice alter how the LDN functionality is handled. In these situations, unexpected behavior can occur when trying to establish LDN connections. This is a good first step to check if you are having issues playing a game together, but can join the same lobby without issue.
|
1. Occasionally updates to the emulator of choice alter how the LDN functionality is handled. In these situations, unexpected behavior can occur when trying to establish LDN connections. This is a good first step to check if you are having issues playing a game together, but can join the same lobby without issue.
|
||||||
2. Game Version Mismatches
|
2. Game Version Mismatches
|
||||||
1. It is best practice to have the game version be identical to each other in order to ensure that there is no difference in how the programs are handling the LDN logic. Games are black boxes that the dev team cannot see into to ensure the logic handling operates the same way. For this reason, it is highly advised that the game versions match across all the players. This would be a good 2nd step to check if you are having issues playing a game together, but can join the same lobby without issue.
|
1. It is best practice to have the game version be identical to each other in order to ensure that there is no difference in how the programs are handling the LDN logic. Games are black boxes that the dev team can't see into to ensure the logic handling operates the same way. For this reason, it is highly advised that the game versions match across all the players. This would be a good 2nd step to check if you are having issues playing a game together, but can join the same lobby without issue.
|
||||||
3. Latency
|
3. Latency
|
||||||
1. Because this implementation is emulating a LAN/Local Wireless connection - it is extremely sensitive to network latency and drops. Eden has done a good job of trying to account for this and not immediately drop users out - but it is not infallible. If latency is a concern or becomes an issue - consider hosting a room.
|
1. Because this implementation is emulating a LAN/Local Wireless connection - it is extremely sensitive to network latency and drops. Eden has done a good job of trying to account for this and not immediately drop users out - but it is not infallible. If latency is a concern or becomes an issue - consider hosting a room.
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ While it would be nice if everything always worked perfectly - that is not reali
|
|||||||
## Joining a Multiplayer Room
|
## Joining a Multiplayer Room
|
||||||
Use this when you need to connect to a multiplayer room for LDN functionality inside of Eden. This does not cover how to host a room, only joining existing ones.
|
Use this when you need to connect to a multiplayer room for LDN functionality inside of Eden. This does not cover how to host a room, only joining existing ones.
|
||||||
|
|
||||||
**Click [Here](https://evilperson1337.notion.site/Access-Your-Multiplayer-Room-Externally-2c357c2edaf681c0ab2ce2ee624d809d) for a version of this guide with images & visual elements.**
|
**[See here](https://evilperson1337.notion.site/Access-Your-Multiplayer-Room-Externally-2c357c2edaf681c0ab2ce2ee624d809d) for an illustrated guide.**
|
||||||
|
|
||||||
### Pre-Requisites
|
### Pre-Requisites
|
||||||
- Eden set up and functioning
|
- Eden set up and functioning
|
||||||
@@ -66,7 +66,7 @@ There are 2 primary methods that you can use to connect to an existing room, dep
|
|||||||
|
|
||||||
<aside>
|
<aside>
|
||||||
|
|
||||||
***NOTE:*** Just because a lobby appears on the public lobby list, does not mean that the hoster has properly configured the necessary port forwarding/firewall rules to allow a connection. If you cannot connect to a lobby, move onto another entry as the issue is probably not on your end. Start looking at your environment if you are unable to connect to multiple/any lobbies.
|
***NOTE:*** Just because a lobby appears on the public lobby list, does not mean that the host has properly configured the necessary port forwarding/firewall rules to allow a connection. If you can't connect to a lobby, move onto another entry as the issue is probably not on your end. Start looking at your environment if you are unable to connect to multiple/any lobbies.
|
||||||
|
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
@@ -82,10 +82,10 @@ There are 2 primary methods that you can use to connect to an existing room, dep
|
|||||||
3. You will now see a window showing everyone on the lobby, or an error message.
|
3. You will now see a window showing everyone on the lobby, or an error message.
|
||||||
|
|
||||||
### Direct Connecting to a Room
|
### Direct Connecting to a Room
|
||||||
If the hoster has not made the lobby public, or you don't want to find it in the public game browser - use this option to connect.
|
If the host has not made the lobby public, or you don't want to find it in the public game browser - use this option to connect.
|
||||||
|
|
||||||
1. Open Eden and navigate to *Multiplayer > Direct Connect*.
|
1. Open Eden and navigate to *Multiplayer > Direct Connect*.
|
||||||
2. Enter the *Server Address, Port*, *Nickname* (what your user will be called in the room), and a *Password* (if the hoster set one, otherwise leave it blank) and hit **Connect.**
|
2. Enter the *Server Address, Port*, *Nickname* (what your user will be called in the room), and a *Password* (if the host set one, otherwise leave it blank) and hit **Connect.**
|
||||||
3. You will now see a window showing everyone on the lobby, or an error message.
|
3. You will now see a window showing everyone on the lobby, or an error message.
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -93,7 +93,7 @@ If the hoster has not made the lobby public, or you don't want to find it in the
|
|||||||
## Hosting a Multiplayer Room
|
## Hosting a Multiplayer Room
|
||||||
Use this guide for when you want to host a multiplayer lobby to play with others in Eden. In order to have someone access the room from outside your local network, see the *Access Your Multiplayer Room Externally* section for next steps.
|
Use this guide for when you want to host a multiplayer lobby to play with others in Eden. In order to have someone access the room from outside your local network, see the *Access Your Multiplayer Room Externally* section for next steps.
|
||||||
|
|
||||||
**Click [Here](https://evilperson1337.notion.site/Hosting-a-Multiplayer-Room-2c357c2edaf6819481dbe8a99926cea2) for a version of this guide with images & visual elements.**
|
**[See here](https://evilperson1337.notion.site/Hosting-a-Multiplayer-Room-2c357c2edaf6819481dbe8a99926cea2) for an illustrated guide.**
|
||||||
|
|
||||||
### Pre-Requisites
|
### Pre-Requisites
|
||||||
- Eden set up and Functioning
|
- Eden set up and Functioning
|
||||||
@@ -123,7 +123,7 @@ Use this guide for when you want to host a multiplayer lobby to play with others
|
|||||||
## Access Your Multiplayer Room Externally
|
## Access Your Multiplayer Room Externally
|
||||||
Quite often the person with whom you want to play is located off of your internal network (LAN). If you want to host a room and play with them you will need to get your devices to communicate with each other. This guide will go over your options on how to do this so that you can play together.
|
Quite often the person with whom you want to play is located off of your internal network (LAN). If you want to host a room and play with them you will need to get your devices to communicate with each other. This guide will go over your options on how to do this so that you can play together.
|
||||||
|
|
||||||
**Click [Here](https://evilperson1337.notion.site/Access-Your-Multiplayer-Room-Externally-2c357c2edaf681c0ab2ce2ee624d809d) for a version of this guide with images & visual elements.**
|
**[See here](https://evilperson1337.notion.site/Access-Your-Multiplayer-Room-Externally-2c357c2edaf681c0ab2ce2ee624d809d) for an illustrated guide.**
|
||||||
|
|
||||||
### Pre-Requisites
|
### Pre-Requisites
|
||||||
- Eden set up and Functioning
|
- Eden set up and Functioning
|
||||||
@@ -137,7 +137,7 @@ Quite often the person with whom you want to play is located off of your interna
|
|||||||
|
|
||||||
<aside>
|
<aside>
|
||||||
|
|
||||||
Use this option if you want the greatest performance/lowest latency, don't want to install any software, and have the ability to modify your networking equipment's configuration (most notably - your router). Avoid this option if you cannot modify your router's configuration or are uncomfortable with looking up things on your own.
|
Use this option if you want the greatest performance/lowest latency, don't want to install any software, and have the ability to modify your networking equipment's configuration (most notably - your router). Avoid this option if you can't modify your router's configuration or are uncomfortable with looking up things on your own.
|
||||||
|
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ Remember you can't have one port open for multiple devices at the same time - yo
|
|||||||
|
|
||||||
<aside>
|
<aside>
|
||||||
|
|
||||||
Use this option if you don't want to have to worry about other users machine/configuration settings, but also cannot do port forwarding. This will still require that you as the hoster install a program and sign up for an account - but will prevent you from having to deal with port forwards or networking equipment. Avoid this option if there is not a close relay and you are getting issues with latency.
|
Use this option if you don't want to have to worry about other users machine/configuration settings, but also can't do port forwarding. This will still require that you as the host install a program and sign up for an account - but will prevent you from having to deal with port forwards or networking equipment. Avoid this option if there is not a close relay and you are getting issues with latency.
|
||||||
|
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
@@ -193,7 +193,7 @@ The VPN solution is a good compromise between the tunnelling solution and port f
|
|||||||
## Finding the Server Information for a Multiplayer Room
|
## Finding the Server Information for a Multiplayer Room
|
||||||
Use this guide when you need to determine the connection information for the Public Multiplayer Lobby you are connected to.
|
Use this guide when you need to determine the connection information for the Public Multiplayer Lobby you are connected to.
|
||||||
|
|
||||||
**Click [Here](https://evilperson1337.notion.site/Finding-the-Server-Information-for-a-Multiplayer-Room-2c557c2edaf6809e94e8ed3429b9eb26) for a version of this guide with images & visual elements.**
|
**[See here](https://evilperson1337.notion.site/Finding-the-Server-Information-for-a-Multiplayer-Room-2c557c2edaf6809e94e8ed3429b9eb26) for an illustrated guide.**
|
||||||
|
|
||||||
### Pre-Requisites
|
### Pre-Requisites
|
||||||
- Eden set up and configured
|
- Eden set up and configured
|
||||||
@@ -256,7 +256,7 @@ Use this guide when you need to determine the connection information for the Pub
|
|||||||
## Multiplayer for Local Co-Op Games
|
## Multiplayer for Local Co-Op Games
|
||||||
Use this guide when you want to play with a friend on a different system for games that only support local co-op.
|
Use this guide when you want to play with a friend on a different system for games that only support local co-op.
|
||||||
|
|
||||||
**Click [Here](https://evilperson1337.notion.site/Multiplayer-for-Local-Co-Op-Games-2c657c2edaf680c59975ec6b52022a2d) for a version of this guide with images & visual elements.**
|
**[See here](https://evilperson1337.notion.site/Multiplayer-for-Local-Co-Op-Games-2c657c2edaf680c59975ec6b52022a2d) for an illustrated guide.**
|
||||||
|
|
||||||
Occasionally you will want to play a game with a friend on a game that does not support LDN multiplayer, and only offer local co-op (multiple controllers connected to a single console), such as with *New Super Mario Bros. U Deluxe.* Emulation solutions have developed 2 primary methods for handling these cases.
|
Occasionally you will want to play a game with a friend on a game that does not support LDN multiplayer, and only offer local co-op (multiple controllers connected to a single console), such as with *New Super Mario Bros. U Deluxe.* Emulation solutions have developed 2 primary methods for handling these cases.
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
# User Handbook - Native Application Development
|
# User Handbook - Native Application Development
|
||||||
|
|
||||||
Debugging on physical hardware can get tedious and time consuming. Users are empowered with the debugging capabilities of the emulator to ensure their applications run as-is on the system. To the greatest extent possible atleast.
|
Debugging on physical hardware can get tedious and time consuming. Users are empowered with the debugging capabilities of the emulator to ensure their applications run as-is on the system. To the greatest extent possible at least.
|
||||||
|
|
||||||
## Debugging
|
## Debugging
|
||||||
|
|
||||||
**Standard key prefix**: Allows to redirect the key manager to a file other than `prod.keys` (for example `other` would redirect to `other.keys`). This is useful for testing multiple keysets. Default is `prod`.
|
**Standard key prefix**: Allows to redirect the key manager to a file other than `prod.keys` (for example `other` would redirect to `other.keys`). This is useful for testing multiple keysets. Default is `prod`.
|
||||||
|
|
||||||
**Changing serial**: Very basic way to set debug values for the serial (and battery number). Developers do not need to write the full serial as only the first digits (excluding the last) will be accoutned for. Region settings will affect the generated serial. The serial corresponds to a non-OLED/Lite console.
|
**Changing serial**: Very basic way to set debug values for the serial (and battery number). Developers do not need to write the full serial as only the first digits (excluding the last) will be accounted for. Region settings will affect the generated serial. The serial corresponds to a non-OLED/Lite console.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Use this guide to get starting using the Eden emulator.
|
Use this guide to get starting using the Eden emulator.
|
||||||
|
|
||||||
**Click [Here](https://evilperson1337.notion.site/Eden-Quick-Start-2b057c2edaf6817b9859d8bcdb474017) for a version of this guide with images & visual elements.**
|
**[See here](https://evilperson1337.notion.site/Eden-Quick-Start-2b057c2edaf6817b9859d8bcdb474017) for an illustrated guide.**
|
||||||
|
|
||||||
## Windows
|
## Windows
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ Use this guide to get starting using the Eden emulator.
|
|||||||
|
|
||||||
## macOS
|
## macOS
|
||||||
|
|
||||||
Current macOS support is still experimental and very reliant on MoltenVK developments, plans have shifted to properly provide support for KosmicKrisp and similar new GPU endeavours, but macOS users still are bound to MoltenVK itself.
|
Current macOS support is still experimental and very reliant on MoltenVK developments, plans have shifted to properly provide support for KosmicKrisp and similar new GPU endeavors, but macOS users still are bound to MoltenVK itself.
|
||||||
|
|
||||||
Users of macOS may wish to use [Asahi Linux](https://wiki.gentoo.org/wiki/Project:Asahi/Guide) for the rising KosmicKrisp support.
|
Users of macOS may wish to use [Asahi Linux](https://wiki.gentoo.org/wiki/Project:Asahi/Guide) for the rising KosmicKrisp support.
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ As of writing, neither macOS nor Asahi has support for NCE; additionally Asahi h
|
|||||||
|
|
||||||
Use this guide when you need to allow Eden to run on a Mac system, but are being blocked by Apple Security policy.
|
Use this guide when you need to allow Eden to run on a Mac system, but are being blocked by Apple Security policy.
|
||||||
|
|
||||||
**Click [Here](https://evilperson1337.notion.site/Allowing-Eden-to-Run-on-MacOS-2b057c2edaf681fea63dc81027efeffd) for a version of this guide with images & visual elements.**
|
**[See here](https://evilperson1337.notion.site/Allowing-Eden-to-Run-on-MacOS-2b057c2edaf681fea63dc81027efeffd) for an illustrated guide.**
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,4 @@ A copy of this handbook is [available online](https://git.eden-emu.dev/eden-emu/
|
|||||||
- **[Gyro Controls](./GyroControls.md)**
|
- **[Gyro Controls](./GyroControls.md)**
|
||||||
- **[Platforms and Architectures](./Architectures.md)**
|
- **[Platforms and Architectures](./Architectures.md)**
|
||||||
- **[Native Application Development](./Native.md)**
|
- **[Native Application Development](./Native.md)**
|
||||||
- **[Adding Boolean Settings Toggles](./AddingBooleanToggles.md)**
|
|
||||||
- **[Adding Debug Knobs](./AddingDebugKnobs.md)**
|
|
||||||
- **[Testing](./Testing.md)**
|
- **[Testing](./Testing.md)**
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ This guide explains how to set up a public/private self hosted Eden server/lobby
|
|||||||
- Next, under Server OS Images, select Ubuntu 24.04 LTS. Configure CPU/RAM/specs as desired for your server. Complete the creation process.
|
- Next, under Server OS Images, select Ubuntu 24.04 LTS. Configure CPU/RAM/specs as desired for your server. Complete the creation process.
|
||||||
|
|
||||||
- Enable the Kamatera firewall and set default policy: IN: DROP, OUT: ACCEPT.
|
- Enable the Kamatera firewall and set default policy: IN: DROP, OUT: ACCEPT.
|
||||||
- After setting the default policy, add the three following rules: #1: SSH Access - Direction: IN, Interface: net0, Macro: SSH - Secure Shell Traffic, Source: ANY, Port: Blank/Auto (Handeld by SSH), Destination: Blank/Auto (Handeld by SSH), Policy: ACCEPT, leave a comment: SSH access.
|
- After setting the default policy, add the three following rules: #1: SSH Access - Direction: IN, Interface: net0, Macro: SSH - Secure Shell Traffic, Source: ANY, Port: Blank/Auto (Handled by SSH), Destination: Blank/Auto (Handled by SSH), Policy: ACCEPT, leave a comment: SSH access.
|
||||||
- Then, after creating the first rule, add TCP & UDP Ports for Eden - Direction: IN, Interface: net0, Protocol: TCP or UDP (for respective rule), Source: ANY, Destination Port: 24872, Policy: ACCEPT, leave a comment: Eden server port.
|
- Then, after creating the first rule, add TCP & UDP Ports for Eden - Direction: IN, Interface: net0, Protocol: TCP or UDP (for respective rule), Source: ANY, Destination Port: 24872, Policy: ACCEPT, leave a comment: Eden server port.
|
||||||
- Note: Only UDP is required for Eden; opening TCP is optional.
|
- Note: Only UDP is required for Eden; opening TCP is optional.
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ Most of the development adds new settings that enhance performance/compatibility
|
|||||||
|
|
||||||
As such, this guide will NOT mention those kind of settings, we'd rather mention settings which have a long shelf time (i.e won't get removed in future releases) and are likely to be unchanged.
|
As such, this guide will NOT mention those kind of settings, we'd rather mention settings which have a long shelf time (i.e won't get removed in future releases) and are likely to be unchanged.
|
||||||
|
|
||||||
Some of the options are self explainatory, and they do exactly what they say they do (i.e "Pause when not in focus"); such options will be also skipped due to triviality.
|
Some of the options are self explanatory, and they do exactly what they say they do (i.e "Pause when not in focus"); such options will be also skipped due to triviality.
|
||||||
|
|
||||||
## Foreword
|
## Foreword
|
||||||
|
|
||||||
Before touching the settings, please see the game boots with stock options. We try our best to ensure users can boot any game using the default settings. If they don't work, then you may try fiddling with options - but please, first use stock options.
|
Before touching the settings, see the game boots with stock options. We try our best to ensure users can boot any game using the default settings. If they don't work, then you may try fiddling with options - but please, first use stock options.
|
||||||
|
|
||||||
## General
|
## General
|
||||||
|
|
||||||
@@ -25,15 +25,15 @@ Before touching the settings, please see the game boots with stock options. We t
|
|||||||
|
|
||||||
## System
|
## System
|
||||||
|
|
||||||
- `System/RNG Seed`: Set to 0 (and uncheck) to disable ASLR systemwide (this makes mods like CTGP to stop working); by default it enables ASLR to replicate console behaviour.
|
- `System/RNG Seed`: Set to 0 (and uncheck) to disable ASLR system-wide (this makes mods like CTGP to stop working); by default it enables ASLR to replicate console behavior.
|
||||||
- `Network/Enable Airplane Mode`: Enable this if a game is crashing before loading AND the logs mention anything related to "web" or "internet" services.
|
- `Network/Enable Airplane Mode`: Enable this if a game is crashing before loading AND the logs mention anything related to "web" or "internet" services.
|
||||||
|
|
||||||
## CPU
|
## CPU
|
||||||
|
|
||||||
- `Fastmem`, aka. `CPU/Enable Host MMU`: Enables "fastmem"; a detailed description of fastmem can be found [here](../dynarmic/Design.md#fast-memory-fastmem).
|
- `Fastmem`, aka. `CPU/Enable Host MMU`: Enables "fastmem"; a detailed description of fastmem can be found [here](../dynarmic/Design.md#fast-memory-fastmem).
|
||||||
- `CPU/Unsafe FMA`: Enables deliberate innacurate FMA behaviour which may affect how FMA returns any given operation - this may introduce tiny floating point errors which can cascade in sensitive code (i.e FFmpeg).
|
- `CPU/Unsafe FMA`: Enables deliberate inaccurate FMA behavior which may affect how FMA returns any given operation - this may introduce tiny floating point errors which can cascade in sensitive code (i.e FFmpeg).
|
||||||
- `CPU/Faster FRSQRTE and FRECPE`: Introduces accuracy errors on square root and reciprocals in exchange for less checks - this introduces inaccuracies with some cases but it's mostly safe.
|
- `CPU/Faster FRSQRTE and FRECPE`: Introduces accuracy errors on square root and reciprocals in exchange for less checks - this introduces inaccuracies with some cases but it's mostly safe.
|
||||||
- `CPU/Faster ASIMD Instructions`: Skips rounding mode checks for ARM ASIMD instructions - this means some code dpeending on these rounding modes may misbehave.
|
- `CPU/Faster ASIMD Instructions`: Skips rounding mode checks for ARM ASIMD instructions - this means some code depending on these rounding modes may misbehave.
|
||||||
- `CPU/Disable address space checks`: Before each memory access, the emulator checks the address is in range, if not it faults; this option makes it so the emulator skips the check entirely (which may be expensive for a myriad of reasons). However at the same time this allows the guest program to "break out" of the emulation context by writing to arbitrary addresses.
|
- `CPU/Disable address space checks`: Before each memory access, the emulator checks the address is in range, if not it faults; this option makes it so the emulator skips the check entirely (which may be expensive for a myriad of reasons). However at the same time this allows the guest program to "break out" of the emulation context by writing to arbitrary addresses.
|
||||||
- `CPU/Ignore global monitor`: This relies on a quirk present on x86 to avoid the ARM global monitor emulation, this may increase performance in mutex-heavy contexts (i.e games waiting for next frames or such); but also can cause deadlocks and fun to debug issues.
|
- `CPU/Ignore global monitor`: This relies on a quirk present on x86 to avoid the ARM global monitor emulation, this may increase performance in mutex-heavy contexts (i.e games waiting for next frames or such); but also can cause deadlocks and fun to debug issues.
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
Use this when you want to import the Eden AppImage into your Steam Library along with artwork using *Steam ROM Manager.*
|
Use this when you want to import the Eden AppImage into your Steam Library along with artwork using *Steam ROM Manager.*
|
||||||
|
|
||||||
**Click [Here](https://evilperson1337.notion.site/Importing-Eden-into-Steam-with-Steam-Rom-Manager-2b757c2edaf68054851bc287b6382cb5) for a version of this guide with images & visual elements.**
|
**[See here](https://evilperson1337.notion.site/Importing-Eden-into-Steam-with-Steam-Rom-Manager-2b757c2edaf68054851bc287b6382cb5) for an illustrated guide.**
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ We will need to create a new parser for the Emulators. Unlike with the EmuDeck
|
|||||||
2. **Parser Title**: *Emulators - Emulators*
|
2. **Parser Title**: *Emulators - Emulators*
|
||||||
3. **Steam Directory**: *${steamdirglobal}*
|
3. **Steam Directory**: *${steamdirglobal}*
|
||||||
4. **User Accounts**: *Global*
|
4. **User Accounts**: *Global*
|
||||||
5. **ROMs Directory**: <path to directory containing eden AppImage>
|
5. **ROMs Directory**: <path to directory containing Eden AppImage>
|
||||||
6. **Steam Collections**: *Emulation* (OPTIONAL)
|
6. **Steam Collections**: *Emulation* (OPTIONAL)
|
||||||
2. Parser Specific Configuration
|
2. Parser Specific Configuration
|
||||||
1. **Search Glob**: *${title}@(.AppImage|.APPIMAGE|.appimage)*
|
1. **Search Glob**: *${title}@(.AppImage|.APPIMAGE|.appimage)*
|
||||||
@@ -167,7 +167,7 @@ Now that we have the parser or shell script created, we can actually add it to S
|
|||||||
|
|
||||||
Use this when you want to import your games inside Eden into Steam to launch with artwork from Steam Game Mode without needing to launch Eden first.
|
Use this when you want to import your games inside Eden into Steam to launch with artwork from Steam Game Mode without needing to launch Eden first.
|
||||||
|
|
||||||
**Click [Here](https://evilperson1337.notion.site/Importing-Games-into-Steam-with-Steam-Rom-Manager-2b757c2edaf680d7a491c92b138f1fcc) for a version of this guide with images & visual elements.**
|
**[See here](https://evilperson1337.notion.site/Importing-Games-into-Steam-with-Steam-Rom-Manager-2b757c2edaf680d7a491c92b138f1fcc) for an illustrated guide.**
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Use this guide for when you want to configure automated backup/syncing of your Eden save files using [*Syncthing*](https://syncthing.net/).
|
Use this guide for when you want to configure automated backup/syncing of your Eden save files using [*Syncthing*](https://syncthing.net/).
|
||||||
|
|
||||||
**Click [Here](https://evilperson1337.notion.site/Backing-Up-Syncing-Eden-Game-Saves-2b357c2edaf68000b40cfab2c2c3dc0a) for a version of this guide with images & visual elements.**
|
**[See here](https://evilperson1337.notion.site/Backing-Up-Syncing-Eden-Game-Saves-2b357c2edaf68000b40cfab2c2c3dc0a) for an illustrated guide.**
|
||||||
|
|
||||||
### Pre-Requisites
|
### Pre-Requisites
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ For regressions/bugs from PRs or commits:
|
|||||||
- [ ] Bisected PR? (if it has commits)
|
- [ ] Bisected PR? (if it has commits)
|
||||||
- [ ] Found bisected commit?
|
- [ ] Found bisected commit?
|
||||||
|
|
||||||
If an issue sporadically appears, try to do multiple runs, try if possible, to count the number of times it has failed and the number of times it has "worked just fine"; say it worked 3 times but failed 1. then there is a 1/4th chance every run that the issue is replicated - so every bisect step would require 4 runs to ensure there is atleast a chance of triggering the bug.
|
If an issue sporadically appears, try to do multiple runs, try if possible, to count the number of times it has failed and the number of times it has "worked just fine"; say it worked 3 times but failed 1. then there is a 1/4th chance every run that the issue is replicated - so every bisect step would require 4 runs to ensure there is at least a chance of triggering the bug.
|
||||||
|
|
||||||
## What to do when something seems off
|
## What to do when something seems off
|
||||||
|
|
||||||
@@ -96,4 +96,4 @@ The faulty commit then, is 6th of Jan. This is called bisection https://git-scm.
|
|||||||
- PR's marked with **WIP** do NOT need to be tested unless explicitly asked (check the git in case)
|
- PR's marked with **WIP** do NOT need to be tested unless explicitly asked (check the git in case)
|
||||||
- Sometimes license checks may fail, hover over the build icon to see if builds did succeed, as the CI will push builds even if license checks fail.
|
- Sometimes license checks may fail, hover over the build icon to see if builds did succeed, as the CI will push builds even if license checks fail.
|
||||||
- All open PRs can be viewed [here](https://git.eden-emu.dev/eden-emu/eden/pulls/).
|
- All open PRs can be viewed [here](https://git.eden-emu.dev/eden-emu/eden/pulls/).
|
||||||
- If site is down use one of the [mirrors](./user/ThirdParty.md#mirrors).
|
- If site is down use one of the [mirrors](./ThirdParty.md#mirrors).
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
# User Handbook - Third party tools and extras
|
# User Handbook - Third party tools and extras
|
||||||
|
|
||||||
The Eden emulator by itself lacks some functionality - or otherwise requires external files (such as packaging) to operate correctly in a given OS. Addendum to that some repositories provide nightly or specialised builds of the emulator.
|
The Eden emulator by itself lacks some functionality - or otherwise requires external files (such as packaging) to operate correctly in a given OS. Addendum to that some repositories provide nightly or specialized builds of the emulator.
|
||||||
|
|
||||||
While most of the links mentioned in this guide are relatively "safe"; we urge users to use their due diligence and appropriatedly verify the integrity of all files downloaded and ensure they're not compromised.
|
While most of the links mentioned in this guide are relatively "safe"; we urge users to use their due diligence and appropriately verify the integrity of all files downloaded and ensure they're not compromised.
|
||||||
|
|
||||||
- [NixOS Eden Flake](https://github.com/Grantimatter/eden-flake)
|
- [NixOS Eden Flake](https://github.com/Grantimatter/eden-flake)
|
||||||
- [ES-DE Frontend Support](https://github.com/GlazedBelmont/es-de-android-custom-systems)
|
- [ES-DE Frontend Support](https://github.com/GlazedBelmont/es-de-android-custom-systems)
|
||||||
@@ -18,13 +18,13 @@ The main origin repository is always at <https://git.eden-emu.dev/eden-emu/eden>
|
|||||||
|
|
||||||
Other mirrors obviously exist on the internet, but we can't guarantee their reliability and/or availability.
|
Other mirrors obviously exist on the internet, but we can't guarantee their reliability and/or availability.
|
||||||
|
|
||||||
If you're someone wanting to make a mirror, simply setup forgejo and automatically mirror from the origin repository. Or you could mirror a mirror to save us bandwidth... your choice!
|
If you're someone wanting to make a mirror, simply setup Forgejo and automatically mirror from the origin repository. Or you could mirror a mirror to save us bandwidth... your choice!
|
||||||
|
|
||||||
## Configuring Obtainium
|
## Configuring Obtainium
|
||||||
|
|
||||||
Very nice handy app, here's a quick rundown how to configure:
|
Very nice handy app, here's a quick rundown how to configure:
|
||||||
|
|
||||||
1. Copy the URL: <https://git.eden-emu.dev/eden-emu/eden/> (or one of your favourite mirrors)
|
1. Copy the URL: <https://git.eden-emu.dev/eden-emu/eden/> (or one of your favorite mirrors)
|
||||||
2. Open Obtainium and tap `Add App`.
|
2. Open Obtainium and tap `Add App`.
|
||||||
3. Paste the URL into the `App Source URL` field.
|
3. Paste the URL into the `App Source URL` field.
|
||||||
4. Override Source: Look for the `Override Source` dropdown menu and select `Forgejo (Codeberg)`.
|
4. Override Source: Look for the `Override Source` dropdown menu and select `Forgejo (Codeberg)`.
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
## Eden Fails to Launch and Does Not Leave Any Logs
|
## Eden Fails to Launch and Does Not Leave Any Logs
|
||||||
|
|
||||||
**Click [Here](https://evilperson1337.notion.site/Windows-Eden-Fails-to-Launch-and-Does-Not-Leave-Any-Logs-2b057c2edaf68156b640cf1ac549870a) for a version of this guide with images & visual elements.**
|
**[See here](https://evilperson1337.notion.site/Windows-Eden-Fails-to-Launch-and-Does-Not-Leave-Any-Logs-2b057c2edaf68156b640cf1ac549870a) for an illustrated guide.**
|
||||||
|
|
||||||
### Error Details
|
### Error Details
|
||||||
|
|
||||||
@@ -24,11 +24,11 @@
|
|||||||
|
|
||||||
**Error Log Entries:**
|
**Error Log Entries:**
|
||||||
|
|
||||||
```
|
```text
|
||||||
None
|
None
|
||||||
```
|
```
|
||||||
**Example Error Message Entry in Windows Event Viewer**
|
**Example Error Message Entry in Windows Event Viewer**
|
||||||
```
|
```text
|
||||||
Faulting application name: eden.exe, version: 0.0.0.0, time stamp: 0x6795dc3c
|
Faulting application name: eden.exe, version: 0.0.0.0, time stamp: 0x6795dc3c
|
||||||
Faulting module name: ntdll.dll, version: 10.0.26100.3037, time stamp: 0x95e6c489
|
Faulting module name: ntdll.dll, version: 10.0.26100.3037, time stamp: 0x95e6c489
|
||||||
Exception code: 0xc0000005
|
Exception code: 0xc0000005
|
||||||
@@ -73,7 +73,7 @@ Faulting package-relative application ID:
|
|||||||
|
|
||||||
5. Look for an entry with the Level of Error, and look for a message similar to the following
|
5. Look for an entry with the Level of Error, and look for a message similar to the following
|
||||||
|
|
||||||
```
|
```text
|
||||||
Faulting application name: Eden.exe, version: 0.0.0.0, time stamp: 0x6795dc3c
|
Faulting application name: Eden.exe, version: 0.0.0.0, time stamp: 0x6795dc3c
|
||||||
Faulting module name: ntdll.dll, version: 10.0.26100.3037, time stamp: 0x95e6c489
|
Faulting module name: ntdll.dll, version: 10.0.26100.3037, time stamp: 0x95e6c489
|
||||||
Exception code: 0xc0000005
|
Exception code: 0xc0000005
|
||||||
@@ -90,7 +90,7 @@ Faulting package-relative application ID:
|
|||||||
6. Run a Command Prompt terminal Window as Administrator.
|
6. Run a Command Prompt terminal Window as Administrator.
|
||||||
7. Enter the following command and wait for it to complete. It will take a while, just be patient and do other things while it completes.
|
7. Enter the following command and wait for it to complete. It will take a while, just be patient and do other things while it completes.
|
||||||
|
|
||||||
```
|
```bat
|
||||||
DISM /Online /Cleanup-Image /RestoreHealth
|
DISM /Online /Cleanup-Image /RestoreHealth
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Use this guide when you want to load Amiibo into your games for use with the Eden emulator.
|
Use this guide when you want to load Amiibo into your games for use with the Eden emulator.
|
||||||
|
|
||||||
**Click [Here](https://evilperson1337.notion.site/Using-Amiibo-with-Eden-2b057c2edaf681b1b28ec6be600c6d3e) for a version of this guide with images & visual elements.**
|
**[See here](https://evilperson1337.notion.site/Using-Amiibo-with-Eden-2b057c2edaf681b1b28ec6be600c6d3e) for an illustrated guide.**
|
||||||
|
|
||||||
## Android
|
## Android
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ TBD
|
|||||||
|
|
||||||
<aside>
|
<aside>
|
||||||
|
|
||||||
***NOTE***: Eden only supports the *.bin* amiibo format, ***NOT*** the *.nfc* format.
|
***NOTE***: Eden only supports the *.bin* Amiibo format, ***NOT*** the *.nfc* format.
|
||||||
|
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ TBD
|
|||||||
|
|
||||||
<aside>
|
<aside>
|
||||||
|
|
||||||
***NOTE***: It seems the scanning functionality is spotty and will sometimes throw a "*The current game is not looking for amiibos*" message, even though it is. Usually you just need to try loading it again or restarting the scanning from the game. In some situations it was only resolved by restarting the game.
|
***NOTE***: It seems the scanning functionality is spotty and will sometimes throw a "*The current game is not looking for Amiibos*" message, even though it is. Usually you just need to try loading it again or restarting the scanning from the game. In some situations it was only resolved by restarting the game.
|
||||||
|
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Use this guide when you want to add cheats into a game to alter gameplay for use with the Eden emulator.
|
Use this guide when you want to add cheats into a game to alter gameplay for use with the Eden emulator.
|
||||||
|
|
||||||
**Click [Here](https://evilperson1337.notion.site/Using-Cheats-with-Eden-2b057c2edaf6818fab66c276e2304bb4) for a version of this guide with images & visual elements.**
|
**[See here](https://evilperson1337.notion.site/Using-Cheats-with-Eden-2b057c2edaf6818fab66c276e2304bb4) for an illustrated guide.**
|
||||||
|
|
||||||
## Android
|
## Android
|
||||||
|
|
||||||
|
|||||||
Vendored
-3
@@ -161,9 +161,6 @@ if (NOT ANDROID)
|
|||||||
AddJsonPackage(sdl3)
|
AddJsonPackage(sdl3)
|
||||||
else()
|
else()
|
||||||
message(STATUS "Using bundled SDL3")
|
message(STATUS "Using bundled SDL3")
|
||||||
if (FREEBSD)
|
|
||||||
set(BUILD_SHARED_LIBS ON)
|
|
||||||
endif()
|
|
||||||
AddJsonPackage(sdl3-ci)
|
AddJsonPackage(sdl3-ci)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
Vendored
-2
@@ -4,8 +4,6 @@
|
|||||||
# SPDX-FileCopyrightText: 2021 yuzu Emulator Project
|
# SPDX-FileCopyrightText: 2021 yuzu Emulator Project
|
||||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
# TODO(crueter, MaranBr): Externals FFmpeg 8.0
|
|
||||||
|
|
||||||
set(FFmpeg_HWACCEL_LIBRARIES)
|
set(FFmpeg_HWACCEL_LIBRARIES)
|
||||||
set(FFmpeg_HWACCEL_FLAGS)
|
set(FFmpeg_HWACCEL_FLAGS)
|
||||||
set(FFmpeg_HWACCEL_INCLUDE_DIRS)
|
set(FFmpeg_HWACCEL_INCLUDE_DIRS)
|
||||||
|
|||||||
@@ -89,7 +89,6 @@ add_library(
|
|||||||
param_package.h
|
param_package.h
|
||||||
parent_of_member.h
|
parent_of_member.h
|
||||||
point.h
|
point.h
|
||||||
quaternion.h
|
|
||||||
range_map.h
|
range_map.h
|
||||||
range_mutex.h
|
range_mutex.h
|
||||||
range_sets.h
|
range_sets.h
|
||||||
|
|||||||
@@ -1,79 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "common/vector_math.h"
|
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
class Quaternion {
|
|
||||||
public:
|
|
||||||
Vec3<T> xyz;
|
|
||||||
T w{};
|
|
||||||
|
|
||||||
[[nodiscard]] Quaternion<decltype(-T{})> Inverse() const {
|
|
||||||
return {-xyz, w};
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] Quaternion<decltype(T{} + T{})> operator+(const Quaternion& other) const {
|
|
||||||
return {xyz + other.xyz, w + other.w};
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] Quaternion<decltype(T{} - T{})> operator-(const Quaternion& other) const {
|
|
||||||
return {xyz - other.xyz, w - other.w};
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] Quaternion<decltype(T{} * T{} - T{} * T{})> operator*(
|
|
||||||
const Quaternion& other) const {
|
|
||||||
return {xyz * other.w + other.xyz * w + Cross(xyz, other.xyz),
|
|
||||||
w * other.w - Dot(xyz, other.xyz)};
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] Quaternion<T> Normalized() const {
|
|
||||||
T length = std::sqrt(xyz.Length2() + w * w);
|
|
||||||
return {xyz / length, w / length};
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] std::array<decltype(-T{}), 16> ToMatrix() const {
|
|
||||||
const T x2 = xyz[0] * xyz[0];
|
|
||||||
const T y2 = xyz[1] * xyz[1];
|
|
||||||
const T z2 = xyz[2] * xyz[2];
|
|
||||||
|
|
||||||
const T xy = xyz[0] * xyz[1];
|
|
||||||
const T wz = w * xyz[2];
|
|
||||||
const T xz = xyz[0] * xyz[2];
|
|
||||||
const T wy = w * xyz[1];
|
|
||||||
const T yz = xyz[1] * xyz[2];
|
|
||||||
const T wx = w * xyz[0];
|
|
||||||
|
|
||||||
return {1.0f - 2.0f * (y2 + z2),
|
|
||||||
2.0f * (xy + wz),
|
|
||||||
2.0f * (xz - wy),
|
|
||||||
0.0f,
|
|
||||||
2.0f * (xy - wz),
|
|
||||||
1.0f - 2.0f * (x2 + z2),
|
|
||||||
2.0f * (yz + wx),
|
|
||||||
0.0f,
|
|
||||||
2.0f * (xz + wy),
|
|
||||||
2.0f * (yz - wx),
|
|
||||||
1.0f - 2.0f * (x2 + y2),
|
|
||||||
0.0f,
|
|
||||||
0.0f,
|
|
||||||
0.0f,
|
|
||||||
0.0f,
|
|
||||||
1.0f};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
[[nodiscard]] auto QuaternionRotate(const Quaternion<T>& q, const Vec3<T>& v) {
|
|
||||||
return v + 2 * Cross(q.xyz, Cross(q.xyz, v) + v * q.w);
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] inline Quaternion<float> MakeQuaternion(const Vec3<float>& axis, float angle) {
|
|
||||||
return {axis * std::sin(angle / 2), std::cos(angle / 2)};
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Common
|
|
||||||
+89
-713
@@ -1,4 +1,4 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: 2014 Tony Wasserka
|
// SPDX-FileCopyrightText: 2014 Tony Wasserka
|
||||||
@@ -7,752 +7,128 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef __ARM_NEON
|
|
||||||
#include <arm_neon.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
template <typename T>
|
template <typename T, size_t N>
|
||||||
class Vec2;
|
class Vec {
|
||||||
template <typename T>
|
|
||||||
class Vec3;
|
|
||||||
template <typename T>
|
|
||||||
class Vec4;
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
class Vec2 {
|
|
||||||
public:
|
public:
|
||||||
T x{};
|
std::array<T, N> elems{};
|
||||||
T y{};
|
|
||||||
|
|
||||||
constexpr Vec2() = default;
|
constexpr Vec() = default;
|
||||||
constexpr Vec2(const T& x_, const T& y_) : x(x_), y(y_) {}
|
constexpr Vec(T e0) noexcept : elems{e0} {}
|
||||||
|
constexpr Vec(T e0, T e1) noexcept : elems{e0, e1} {}
|
||||||
|
constexpr Vec(T e0, T e1, T e2) noexcept : elems{e0, e1, e2} {}
|
||||||
|
constexpr Vec(T e0, T e1, T e2, T e4) noexcept : elems{e0, e1, e2, e4} {}
|
||||||
|
//explicit constexpr Vec(const std::initializer_list<T> elems_) noexcept : elems{elems_} {}
|
||||||
|
|
||||||
template <typename T2>
|
[[nodiscard]] constexpr Vec<decltype(T{} + T{}), N> operator+(const Vec o) const noexcept {
|
||||||
[[nodiscard]] constexpr Vec2<T2> Cast() const {
|
Vec<decltype(T{} + T{}), N> r{};
|
||||||
return Vec2<T2>(static_cast<T2>(x), static_cast<T2>(y));
|
for (size_t i = 0; i < N; ++i)
|
||||||
|
r.elems[i] = elems[i] + o.elems[i];
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
constexpr Vec<T, N> operator+=(const Vec<T, N> o) noexcept { return *this = *this + o; }
|
||||||
|
|
||||||
[[nodiscard]] static constexpr Vec2 AssignToAll(const T& f) {
|
[[nodiscard]] constexpr Vec<decltype(T{} - T{}), N> operator-(const Vec o) const noexcept {
|
||||||
return Vec2{f, f};
|
Vec<decltype(T{} - T{}), N> r{};
|
||||||
}
|
for (size_t i = 0; i < N; ++i)
|
||||||
|
r.elems[i] = elems[i] - o.elems[i];
|
||||||
[[nodiscard]] constexpr Vec2<decltype(T{} + T{})> operator+(const Vec2& other) const {
|
return r;
|
||||||
return {x + other.x, y + other.y};
|
|
||||||
}
|
|
||||||
constexpr Vec2& operator+=(const Vec2& other) {
|
|
||||||
x += other.x;
|
|
||||||
y += other.y;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
[[nodiscard]] constexpr Vec2<decltype(T{} - T{})> operator-(const Vec2& other) const {
|
|
||||||
return {x - other.x, y - other.y};
|
|
||||||
}
|
|
||||||
constexpr Vec2& operator-=(const Vec2& other) {
|
|
||||||
x -= other.x;
|
|
||||||
y -= other.y;
|
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
|
constexpr Vec<T, N> operator-=(const Vec<T, N> o) noexcept { return *this = *this - o; }
|
||||||
|
|
||||||
template <typename U = T>
|
template <typename U = T>
|
||||||
[[nodiscard]] constexpr Vec2<std::enable_if_t<std::is_signed_v<U>, U>> operator-() const {
|
[[nodiscard]] constexpr Vec<std::enable_if_t<std::is_signed_v<U>, U>, N> operator-() const noexcept {
|
||||||
return {-x, -y};
|
Vec<U, N> r{};
|
||||||
}
|
for (size_t i = 0; i < N; ++i)
|
||||||
[[nodiscard]] constexpr Vec2<decltype(T{} * T{})> operator*(const Vec2& other) const {
|
r.elems[i] = -elems[i];
|
||||||
return {x * other.x, y * other.y};
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] constexpr Vec<decltype(T{} * T{}), N> operator*(const Vec o) const noexcept {
|
||||||
|
Vec<decltype(T{} * T{}), N> r{};
|
||||||
|
for (size_t i = 0; i < N; ++i)
|
||||||
|
r.elems[i] = elems[i] * o.elems[i];
|
||||||
|
return r;
|
||||||
|
}
|
||||||
template <typename V>
|
template <typename V>
|
||||||
[[nodiscard]] constexpr Vec2<decltype(T{} * V{})> operator*(const V& f) const {
|
[[nodiscard]] constexpr Vec<decltype(T{} * V{}), N> operator*(const V f) const noexcept {
|
||||||
using TV = decltype(T{} * V{});
|
using TV = decltype(T{} * V{});
|
||||||
using C = std::common_type_t<T, V>;
|
using C = std::common_type_t<T, V>;
|
||||||
|
Vec<TV, N> r{};
|
||||||
return {
|
for (size_t i = 0; i < N; ++i)
|
||||||
static_cast<TV>(static_cast<C>(x) * static_cast<C>(f)),
|
r.elems[i] = TV(C(elems[i]) * C(f));
|
||||||
static_cast<TV>(static_cast<C>(y) * static_cast<C>(f)),
|
return r;
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
template <typename V>
|
||||||
|
constexpr Vec<T, N> operator*=(const V f) noexcept { return *this = *this * f; }
|
||||||
|
|
||||||
template <typename V>
|
template <typename V>
|
||||||
constexpr Vec2& operator*=(const V& f) {
|
[[nodiscard]] constexpr Vec<decltype(T{} / V{}), N> operator/(const V f) const noexcept {
|
||||||
*this = *this * f;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename V>
|
|
||||||
[[nodiscard]] constexpr Vec2<decltype(T{} / V{})> operator/(const V& f) const {
|
|
||||||
using TV = decltype(T{} / V{});
|
using TV = decltype(T{} / V{});
|
||||||
using C = std::common_type_t<T, V>;
|
using C = std::common_type_t<T, V>;
|
||||||
|
Vec<TV, N> r{};
|
||||||
return {
|
for (size_t i = 0; i < N; ++i)
|
||||||
static_cast<TV>(static_cast<C>(x) / static_cast<C>(f)),
|
r.elems[i] = TV(C(elems[i]) / C(f));
|
||||||
static_cast<TV>(static_cast<C>(y) / static_cast<C>(f)),
|
return r;
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename V>
|
template <typename V>
|
||||||
constexpr Vec2& operator/=(const V& f) {
|
constexpr Vec<T, N> operator/=(const V f) noexcept { return *this = *this / f; }
|
||||||
*this = *this / f;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr T Length2() const {
|
[[nodiscard]] constexpr T Length2() const noexcept {
|
||||||
return x * x + y * y;
|
T r{};
|
||||||
|
for (size_t i = 0; i < N; ++i)
|
||||||
|
r += elems[i] * elems[i];
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only implemented for T=float
|
// Only implemented for T=float
|
||||||
[[nodiscard]] float Length() const;
|
[[nodiscard]] T Length() const { return T(std::sqrt(float(Length2()))); }
|
||||||
[[nodiscard]] float Normalize(); // returns the previous length, which is often useful
|
[[nodiscard]] Vec<T, N> Normalized() const { return *this / Length(); }
|
||||||
|
[[nodiscard]] constexpr T& operator[](std::size_t i) noexcept { return elems[i]; }
|
||||||
|
[[nodiscard]] constexpr const T& operator[](std::size_t i) const noexcept { return elems[i]; }
|
||||||
|
|
||||||
[[nodiscard]] constexpr T& operator[](std::size_t i) {
|
[[nodiscard]] std::array<decltype(-T{}), 16> ToMatrix() const {
|
||||||
return *((&x) + i);
|
const T x2 = elems[0] * elems[0];
|
||||||
}
|
const T y2 = elems[1] * elems[1];
|
||||||
[[nodiscard]] constexpr const T& operator[](std::size_t i) const {
|
const T z2 = elems[2] * elems[2];
|
||||||
return *((&x) + i);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr void SetZero() {
|
const T xy = elems[0] * elems[1];
|
||||||
x = 0;
|
const T wz = elems[3] * elems[2];
|
||||||
y = 0;
|
const T xz = elems[0] * elems[2];
|
||||||
}
|
const T wy = elems[3] * elems[1];
|
||||||
|
const T yz = elems[1] * elems[2];
|
||||||
// Common aliases: UV (texel coordinates), ST (texture coordinates)
|
const T wx = elems[3] * elems[0];
|
||||||
[[nodiscard]] constexpr T& u() {
|
return {
|
||||||
return x;
|
1.0f - 2.0f * (y2 + z2),
|
||||||
}
|
2.0f * (xy + wz),
|
||||||
[[nodiscard]] constexpr T& v() {
|
2.0f * (xz - wy),
|
||||||
return y;
|
0.0f,
|
||||||
}
|
2.0f * (xy - wz),
|
||||||
[[nodiscard]] constexpr T& s() {
|
1.0f - 2.0f * (x2 + z2),
|
||||||
return x;
|
2.0f * (yz + wx),
|
||||||
}
|
0.0f,
|
||||||
[[nodiscard]] constexpr T& t() {
|
2.0f * (xz + wy),
|
||||||
return y;
|
2.0f * (yz - wx),
|
||||||
}
|
1.0f - 2.0f * (x2 + y2),
|
||||||
|
0.0f,
|
||||||
[[nodiscard]] constexpr const T& u() const {
|
0.0f,
|
||||||
return x;
|
0.0f,
|
||||||
}
|
0.0f,
|
||||||
[[nodiscard]] constexpr const T& v() const {
|
1.0f
|
||||||
return y;
|
};
|
||||||
}
|
|
||||||
[[nodiscard]] constexpr const T& s() const {
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
[[nodiscard]] constexpr const T& t() const {
|
|
||||||
return y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// swizzlers - create a subvector of specific components
|
|
||||||
[[nodiscard]] constexpr Vec2 yx() const {
|
|
||||||
return Vec2(y, x);
|
|
||||||
}
|
|
||||||
[[nodiscard]] constexpr Vec2 vu() const {
|
|
||||||
return Vec2(y, x);
|
|
||||||
}
|
|
||||||
[[nodiscard]] constexpr Vec2 ts() const {
|
|
||||||
return Vec2(y, x);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, typename V>
|
template <typename T, size_t N, typename V>
|
||||||
[[nodiscard]] constexpr Vec2<T> operator*(const V& f, const Vec2<T>& vec) {
|
[[nodiscard]] constexpr Vec<T, N> operator*(const V f, const Vec<T, N> v) noexcept {
|
||||||
using C = std::common_type_t<T, V>;
|
using C = std::common_type_t<T, V>;
|
||||||
|
Vec<T, N> r{};
|
||||||
return Vec2<T>(static_cast<T>(static_cast<C>(f) * static_cast<C>(vec.x)),
|
for (size_t i = 0; i < N; ++i)
|
||||||
static_cast<T>(static_cast<C>(f) * static_cast<C>(vec.y)));
|
r.elems[i] = T(C(f) * C(v.elems[i]));
|
||||||
}
|
return r;
|
||||||
|
|
||||||
using Vec2f = Vec2<float>;
|
|
||||||
|
|
||||||
template <>
|
|
||||||
inline float Vec2<float>::Length() const {
|
|
||||||
return std::sqrt(x * x + y * y);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <>
|
|
||||||
inline float Vec2<float>::Normalize() {
|
|
||||||
float length = Length();
|
|
||||||
*this /= length;
|
|
||||||
return length;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
class Vec3 {
|
|
||||||
public:
|
|
||||||
T x{};
|
|
||||||
T y{};
|
|
||||||
T z{};
|
|
||||||
|
|
||||||
constexpr Vec3() = default;
|
|
||||||
constexpr Vec3(const T& x_, const T& y_, const T& z_) : x(x_), y(y_), z(z_) {}
|
|
||||||
|
|
||||||
template <typename T2>
|
|
||||||
[[nodiscard]] constexpr Vec3<T2> Cast() const {
|
|
||||||
return Vec3<T2>(static_cast<T2>(x), static_cast<T2>(y), static_cast<T2>(z));
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] static constexpr Vec3 AssignToAll(const T& f) {
|
|
||||||
return Vec3(f, f, f);
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr Vec3<decltype(T{} + T{})> operator+(const Vec3& other) const {
|
|
||||||
return {x + other.x, y + other.y, z + other.z};
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr Vec3& operator+=(const Vec3& other) {
|
|
||||||
x += other.x;
|
|
||||||
y += other.y;
|
|
||||||
z += other.z;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr Vec3<decltype(T{} - T{})> operator-(const Vec3& other) const {
|
|
||||||
return {x - other.x, y - other.y, z - other.z};
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr Vec3& operator-=(const Vec3& other) {
|
|
||||||
x -= other.x;
|
|
||||||
y -= other.y;
|
|
||||||
z -= other.z;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename U = T>
|
|
||||||
[[nodiscard]] constexpr Vec3<std::enable_if_t<std::is_signed_v<U>, U>> operator-() const {
|
|
||||||
return {-x, -y, -z};
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr Vec3<decltype(T{} * T{})> operator*(const Vec3& other) const {
|
|
||||||
return {x * other.x, y * other.y, z * other.z};
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename V>
|
|
||||||
[[nodiscard]] constexpr Vec3<decltype(T{} * V{})> operator*(const V& f) const {
|
|
||||||
using TV = decltype(T{} * V{});
|
|
||||||
using C = std::common_type_t<T, V>;
|
|
||||||
|
|
||||||
return {
|
|
||||||
static_cast<TV>(static_cast<C>(x) * static_cast<C>(f)),
|
|
||||||
static_cast<TV>(static_cast<C>(y) * static_cast<C>(f)),
|
|
||||||
static_cast<TV>(static_cast<C>(z) * static_cast<C>(f)),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename V>
|
|
||||||
constexpr Vec3& operator*=(const V& f) {
|
|
||||||
*this = *this * f;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
template <typename V>
|
|
||||||
[[nodiscard]] constexpr Vec3<decltype(T{} / V{})> operator/(const V& f) const {
|
|
||||||
using TV = decltype(T{} / V{});
|
|
||||||
using C = std::common_type_t<T, V>;
|
|
||||||
|
|
||||||
return {
|
|
||||||
static_cast<TV>(static_cast<C>(x) / static_cast<C>(f)),
|
|
||||||
static_cast<TV>(static_cast<C>(y) / static_cast<C>(f)),
|
|
||||||
static_cast<TV>(static_cast<C>(z) / static_cast<C>(f)),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename V>
|
|
||||||
constexpr Vec3& operator/=(const V& f) {
|
|
||||||
*this = *this / f;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RotateFromOrigin(float roll, float pitch, float yaw) {
|
|
||||||
float temp = y;
|
|
||||||
y = std::cos(roll) * y - std::sin(roll) * z;
|
|
||||||
z = std::sin(roll) * temp + std::cos(roll) * z;
|
|
||||||
|
|
||||||
temp = x;
|
|
||||||
x = std::cos(pitch) * x + std::sin(pitch) * z;
|
|
||||||
z = -std::sin(pitch) * temp + std::cos(pitch) * z;
|
|
||||||
|
|
||||||
temp = x;
|
|
||||||
x = std::cos(yaw) * x - std::sin(yaw) * y;
|
|
||||||
y = std::sin(yaw) * temp + std::cos(yaw) * y;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr T Length2() const {
|
|
||||||
return x * x + y * y + z * z;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only implemented for T=float
|
|
||||||
[[nodiscard]] float Length() const;
|
|
||||||
[[nodiscard]] Vec3 Normalized() const;
|
|
||||||
[[nodiscard]] float Normalize(); // returns the previous length, which is often useful
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr T& operator[](std::size_t i) {
|
|
||||||
return *((&x) + i);
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr const T& operator[](std::size_t i) const {
|
|
||||||
return *((&x) + i);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr void SetZero() {
|
|
||||||
x = 0;
|
|
||||||
y = 0;
|
|
||||||
z = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Common aliases: UVW (texel coordinates), RGB (colors), STQ (texture coordinates)
|
|
||||||
[[nodiscard]] constexpr T& u() {
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
[[nodiscard]] constexpr T& v() {
|
|
||||||
return y;
|
|
||||||
}
|
|
||||||
[[nodiscard]] constexpr T& w() {
|
|
||||||
return z;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr T& r() {
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
[[nodiscard]] constexpr T& g() {
|
|
||||||
return y;
|
|
||||||
}
|
|
||||||
[[nodiscard]] constexpr T& b() {
|
|
||||||
return z;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr T& s() {
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
[[nodiscard]] constexpr T& t() {
|
|
||||||
return y;
|
|
||||||
}
|
|
||||||
[[nodiscard]] constexpr T& q() {
|
|
||||||
return z;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr const T& u() const {
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
[[nodiscard]] constexpr const T& v() const {
|
|
||||||
return y;
|
|
||||||
}
|
|
||||||
[[nodiscard]] constexpr const T& w() const {
|
|
||||||
return z;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr const T& r() const {
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
[[nodiscard]] constexpr const T& g() const {
|
|
||||||
return y;
|
|
||||||
}
|
|
||||||
[[nodiscard]] constexpr const T& b() const {
|
|
||||||
return z;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr const T& s() const {
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
[[nodiscard]] constexpr const T& t() const {
|
|
||||||
return y;
|
|
||||||
}
|
|
||||||
[[nodiscard]] constexpr const T& q() const {
|
|
||||||
return z;
|
|
||||||
}
|
|
||||||
|
|
||||||
// swizzlers - create a subvector of specific components
|
|
||||||
// e.g. Vec2 uv() { return Vec2(x,y); }
|
|
||||||
// _DEFINE_SWIZZLER2 defines a single such function, DEFINE_SWIZZLER2 defines all of them for all
|
|
||||||
// component names (x<->r) and permutations (xy<->yx)
|
|
||||||
#define _DEFINE_SWIZZLER2(a, b, name) \
|
|
||||||
[[nodiscard]] constexpr Vec2<T> name() const { return Vec2<T>(a, b); }
|
|
||||||
#define DEFINE_SWIZZLER2(a, b, a2, b2, a3, b3, a4, b4) \
|
|
||||||
_DEFINE_SWIZZLER2(a, b, a##b); \
|
|
||||||
_DEFINE_SWIZZLER2(a, b, a2##b2); \
|
|
||||||
_DEFINE_SWIZZLER2(a, b, a3##b3); \
|
|
||||||
_DEFINE_SWIZZLER2(a, b, a4##b4); \
|
|
||||||
_DEFINE_SWIZZLER2(b, a, b##a); \
|
|
||||||
_DEFINE_SWIZZLER2(b, a, b2##a2); \
|
|
||||||
_DEFINE_SWIZZLER2(b, a, b3##a3); \
|
|
||||||
_DEFINE_SWIZZLER2(b, a, b4##a4)
|
|
||||||
|
|
||||||
DEFINE_SWIZZLER2(x, y, r, g, u, v, s, t);
|
|
||||||
DEFINE_SWIZZLER2(x, z, r, b, u, w, s, q);
|
|
||||||
DEFINE_SWIZZLER2(y, z, g, b, v, w, t, q);
|
|
||||||
#undef DEFINE_SWIZZLER2
|
|
||||||
#undef _DEFINE_SWIZZLER2
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T, typename V>
|
|
||||||
[[nodiscard]] constexpr Vec3<T> operator*(const V& f, const Vec3<T>& vec) {
|
|
||||||
using C = std::common_type_t<T, V>;
|
|
||||||
|
|
||||||
return Vec3<T>(static_cast<T>(static_cast<C>(f) * static_cast<C>(vec.x)),
|
|
||||||
static_cast<T>(static_cast<C>(f) * static_cast<C>(vec.y)),
|
|
||||||
static_cast<T>(static_cast<C>(f) * static_cast<C>(vec.z)));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <>
|
|
||||||
inline float Vec3<float>::Length() const {
|
|
||||||
return std::sqrt(x * x + y * y + z * z);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <>
|
|
||||||
inline Vec3<float> Vec3<float>::Normalized() const {
|
|
||||||
return *this / Length();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <>
|
|
||||||
inline float Vec3<float>::Normalize() {
|
|
||||||
float length = Length();
|
|
||||||
*this /= length;
|
|
||||||
return length;
|
|
||||||
}
|
|
||||||
|
|
||||||
using Vec3f = Vec3<float>;
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
class Vec4 {
|
|
||||||
public:
|
|
||||||
T x{};
|
|
||||||
T y{};
|
|
||||||
T z{};
|
|
||||||
T w{};
|
|
||||||
|
|
||||||
constexpr Vec4() = default;
|
|
||||||
constexpr Vec4(const T& x_, const T& y_, const T& z_, const T& w_)
|
|
||||||
: x(x_), y(y_), z(z_), w(w_) {}
|
|
||||||
|
|
||||||
template <typename T2>
|
|
||||||
[[nodiscard]] constexpr Vec4<T2> Cast() const {
|
|
||||||
return Vec4<T2>(static_cast<T2>(x), static_cast<T2>(y), static_cast<T2>(z),
|
|
||||||
static_cast<T2>(w));
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] static constexpr Vec4 AssignToAll(const T& f) {
|
|
||||||
return Vec4(f, f, f, f);
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr Vec4<decltype(T{} + T{})> operator+(const Vec4& other) const {
|
|
||||||
return {x + other.x, y + other.y, z + other.z, w + other.w};
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr Vec4& operator+=(const Vec4& other) {
|
|
||||||
x += other.x;
|
|
||||||
y += other.y;
|
|
||||||
z += other.z;
|
|
||||||
w += other.w;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr Vec4<decltype(T{} - T{})> operator-(const Vec4& other) const {
|
|
||||||
return {x - other.x, y - other.y, z - other.z, w - other.w};
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr Vec4& operator-=(const Vec4& other) {
|
|
||||||
x -= other.x;
|
|
||||||
y -= other.y;
|
|
||||||
z -= other.z;
|
|
||||||
w -= other.w;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename U = T>
|
|
||||||
[[nodiscard]] constexpr Vec4<std::enable_if_t<std::is_signed_v<U>, U>> operator-() const {
|
|
||||||
return {-x, -y, -z, -w};
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr Vec4<decltype(T{} * T{})> operator*(const Vec4& other) const {
|
|
||||||
return {x * other.x, y * other.y, z * other.z, w * other.w};
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename V>
|
|
||||||
[[nodiscard]] constexpr Vec4<decltype(T{} * V{})> operator*(const V& f) const {
|
|
||||||
using TV = decltype(T{} * V{});
|
|
||||||
using C = std::common_type_t<T, V>;
|
|
||||||
|
|
||||||
return {
|
|
||||||
static_cast<TV>(static_cast<C>(x) * static_cast<C>(f)),
|
|
||||||
static_cast<TV>(static_cast<C>(y) * static_cast<C>(f)),
|
|
||||||
static_cast<TV>(static_cast<C>(z) * static_cast<C>(f)),
|
|
||||||
static_cast<TV>(static_cast<C>(w) * static_cast<C>(f)),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename V>
|
|
||||||
constexpr Vec4& operator*=(const V& f) {
|
|
||||||
*this = *this * f;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename V>
|
|
||||||
[[nodiscard]] constexpr Vec4<decltype(T{} / V{})> operator/(const V& f) const {
|
|
||||||
using TV = decltype(T{} / V{});
|
|
||||||
using C = std::common_type_t<T, V>;
|
|
||||||
|
|
||||||
return {
|
|
||||||
static_cast<TV>(static_cast<C>(x) / static_cast<C>(f)),
|
|
||||||
static_cast<TV>(static_cast<C>(y) / static_cast<C>(f)),
|
|
||||||
static_cast<TV>(static_cast<C>(z) / static_cast<C>(f)),
|
|
||||||
static_cast<TV>(static_cast<C>(w) / static_cast<C>(f)),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename V>
|
|
||||||
constexpr Vec4& operator/=(const V& f) {
|
|
||||||
*this = *this / f;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr T Length2() const {
|
|
||||||
return x * x + y * y + z * z + w * w;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr T& operator[](std::size_t i) {
|
|
||||||
return *((&x) + i);
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr const T& operator[](std::size_t i) const {
|
|
||||||
return *((&x) + i);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr void SetZero() {
|
|
||||||
x = 0;
|
|
||||||
y = 0;
|
|
||||||
z = 0;
|
|
||||||
w = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Common alias: RGBA (colors)
|
|
||||||
[[nodiscard]] constexpr T& r() {
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
[[nodiscard]] constexpr T& g() {
|
|
||||||
return y;
|
|
||||||
}
|
|
||||||
[[nodiscard]] constexpr T& b() {
|
|
||||||
return z;
|
|
||||||
}
|
|
||||||
[[nodiscard]] constexpr T& a() {
|
|
||||||
return w;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr const T& r() const {
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
[[nodiscard]] constexpr const T& g() const {
|
|
||||||
return y;
|
|
||||||
}
|
|
||||||
[[nodiscard]] constexpr const T& b() const {
|
|
||||||
return z;
|
|
||||||
}
|
|
||||||
[[nodiscard]] constexpr const T& a() const {
|
|
||||||
return w;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Swizzlers - Create a subvector of specific components
|
|
||||||
// e.g. Vec2 uv() { return Vec2(x,y); }
|
|
||||||
|
|
||||||
// _DEFINE_SWIZZLER2 defines a single such function
|
|
||||||
// DEFINE_SWIZZLER2_COMP1 defines one-component functions for all component names (x<->r)
|
|
||||||
// DEFINE_SWIZZLER2_COMP2 defines two component functions for all component names (x<->r) and
|
|
||||||
// permutations (xy<->yx)
|
|
||||||
#define _DEFINE_SWIZZLER2(a, b, name) \
|
|
||||||
[[nodiscard]] constexpr Vec2<T> name() const { return Vec2<T>(a, b); }
|
|
||||||
#define DEFINE_SWIZZLER2_COMP1(a, a2) \
|
|
||||||
_DEFINE_SWIZZLER2(a, a, a##a); \
|
|
||||||
_DEFINE_SWIZZLER2(a, a, a2##a2)
|
|
||||||
#define DEFINE_SWIZZLER2_COMP2(a, b, a2, b2) \
|
|
||||||
_DEFINE_SWIZZLER2(a, b, a##b); \
|
|
||||||
_DEFINE_SWIZZLER2(a, b, a2##b2); \
|
|
||||||
_DEFINE_SWIZZLER2(b, a, b##a); \
|
|
||||||
_DEFINE_SWIZZLER2(b, a, b2##a2)
|
|
||||||
|
|
||||||
DEFINE_SWIZZLER2_COMP2(x, y, r, g);
|
|
||||||
DEFINE_SWIZZLER2_COMP2(x, z, r, b);
|
|
||||||
DEFINE_SWIZZLER2_COMP2(x, w, r, a);
|
|
||||||
DEFINE_SWIZZLER2_COMP2(y, z, g, b);
|
|
||||||
DEFINE_SWIZZLER2_COMP2(y, w, g, a);
|
|
||||||
DEFINE_SWIZZLER2_COMP2(z, w, b, a);
|
|
||||||
DEFINE_SWIZZLER2_COMP1(x, r);
|
|
||||||
DEFINE_SWIZZLER2_COMP1(y, g);
|
|
||||||
DEFINE_SWIZZLER2_COMP1(z, b);
|
|
||||||
DEFINE_SWIZZLER2_COMP1(w, a);
|
|
||||||
#undef DEFINE_SWIZZLER2_COMP1
|
|
||||||
#undef DEFINE_SWIZZLER2_COMP2
|
|
||||||
#undef _DEFINE_SWIZZLER2
|
|
||||||
|
|
||||||
#define _DEFINE_SWIZZLER3(a, b, c, name) \
|
|
||||||
[[nodiscard]] constexpr Vec3<T> name() const { return Vec3<T>(a, b, c); }
|
|
||||||
#define DEFINE_SWIZZLER3_COMP1(a, a2) \
|
|
||||||
_DEFINE_SWIZZLER3(a, a, a, a##a##a); \
|
|
||||||
_DEFINE_SWIZZLER3(a, a, a, a2##a2##a2)
|
|
||||||
#define DEFINE_SWIZZLER3_COMP3(a, b, c, a2, b2, c2) \
|
|
||||||
_DEFINE_SWIZZLER3(a, b, c, a##b##c); \
|
|
||||||
_DEFINE_SWIZZLER3(a, c, b, a##c##b); \
|
|
||||||
_DEFINE_SWIZZLER3(b, a, c, b##a##c); \
|
|
||||||
_DEFINE_SWIZZLER3(b, c, a, b##c##a); \
|
|
||||||
_DEFINE_SWIZZLER3(c, a, b, c##a##b); \
|
|
||||||
_DEFINE_SWIZZLER3(c, b, a, c##b##a); \
|
|
||||||
_DEFINE_SWIZZLER3(a, b, c, a2##b2##c2); \
|
|
||||||
_DEFINE_SWIZZLER3(a, c, b, a2##c2##b2); \
|
|
||||||
_DEFINE_SWIZZLER3(b, a, c, b2##a2##c2); \
|
|
||||||
_DEFINE_SWIZZLER3(b, c, a, b2##c2##a2); \
|
|
||||||
_DEFINE_SWIZZLER3(c, a, b, c2##a2##b2); \
|
|
||||||
_DEFINE_SWIZZLER3(c, b, a, c2##b2##a2)
|
|
||||||
|
|
||||||
DEFINE_SWIZZLER3_COMP3(x, y, z, r, g, b);
|
|
||||||
DEFINE_SWIZZLER3_COMP3(x, y, w, r, g, a);
|
|
||||||
DEFINE_SWIZZLER3_COMP3(x, z, w, r, b, a);
|
|
||||||
DEFINE_SWIZZLER3_COMP3(y, z, w, g, b, a);
|
|
||||||
DEFINE_SWIZZLER3_COMP1(x, r);
|
|
||||||
DEFINE_SWIZZLER3_COMP1(y, g);
|
|
||||||
DEFINE_SWIZZLER3_COMP1(z, b);
|
|
||||||
DEFINE_SWIZZLER3_COMP1(w, a);
|
|
||||||
#undef DEFINE_SWIZZLER3_COMP1
|
|
||||||
#undef DEFINE_SWIZZLER3_COMP3
|
|
||||||
#undef _DEFINE_SWIZZLER3
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T, typename V>
|
|
||||||
[[nodiscard]] constexpr Vec4<decltype(V{} * T{})> operator*(const V& f, const Vec4<T>& vec) {
|
|
||||||
using TV = decltype(V{} * T{});
|
|
||||||
using C = std::common_type_t<T, V>;
|
|
||||||
|
|
||||||
return {
|
|
||||||
static_cast<TV>(static_cast<C>(f) * static_cast<C>(vec.x)),
|
|
||||||
static_cast<TV>(static_cast<C>(f) * static_cast<C>(vec.y)),
|
|
||||||
static_cast<TV>(static_cast<C>(f) * static_cast<C>(vec.z)),
|
|
||||||
static_cast<TV>(static_cast<C>(f) * static_cast<C>(vec.w)),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
using Vec4f = Vec4<float>;
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
constexpr decltype(T{} * T{} + T{} * T{}) Dot(const Vec2<T>& a, const Vec2<T>& b) {
|
|
||||||
return a.x * b.x + a.y * b.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
[[nodiscard]] constexpr decltype(T{} * T{} + T{} * T{}) Dot(const Vec3<T>& a, const Vec3<T>& b) {
|
|
||||||
return a.x * b.x + a.y * b.y + a.z * b.z;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
[[nodiscard]] constexpr decltype(T{} * T{} + T{} * T{}) Dot(const Vec4<T>& a, const Vec4<T>& b) {
|
|
||||||
return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <>
|
|
||||||
[[nodiscard]] inline float Dot(const Vec4<float>& a, const Vec4<float>& b) {
|
|
||||||
#ifdef __ARM_NEON
|
|
||||||
float32x4_t va = vld1q_f32(&a.x);
|
|
||||||
float32x4_t vb = vld1q_f32(&b.x);
|
|
||||||
float32x4_t result = vmulq_f32(va, vb);
|
|
||||||
#if defined(__aarch64__) // Use vaddvq_f32 in ARMv8 architectures
|
|
||||||
return vaddvq_f32(result);
|
|
||||||
#else // Use manual addition for older architectures
|
|
||||||
float32x2_t sum2 = vadd_f32(vget_high_f32(result), vget_low_f32(result));
|
|
||||||
return vget_lane_f32(vpadd_f32(sum2, sum2), 0);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
[[nodiscard]] constexpr Vec3<decltype(T{} * T{} - T{} * T{})> Cross(const Vec3<T>& a,
|
|
||||||
const Vec3<T>& b) {
|
|
||||||
return {a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x};
|
|
||||||
}
|
|
||||||
|
|
||||||
// linear interpolation via float: 0.0=begin, 1.0=end
|
|
||||||
template <typename X>
|
|
||||||
[[nodiscard]] constexpr decltype(X{} * float{} + X{} * float{}) Lerp(const X& begin, const X& end,
|
|
||||||
const float t) {
|
|
||||||
return begin * (1.f - t) + end * t;
|
|
||||||
}
|
|
||||||
|
|
||||||
// linear interpolation via int: 0=begin, base=end
|
|
||||||
template <typename X, int base>
|
|
||||||
[[nodiscard]] constexpr decltype((X{} * int{} + X{} * int{}) / base) LerpInt(const X& begin,
|
|
||||||
const X& end,
|
|
||||||
const int t) {
|
|
||||||
return (begin * (base - t) + end * t) / base;
|
|
||||||
}
|
|
||||||
|
|
||||||
// bilinear interpolation. s is for interpolating x00-x01 and x10-x11, and t is for the second
|
|
||||||
// interpolation.
|
|
||||||
template <typename X>
|
|
||||||
[[nodiscard]] constexpr auto BilinearInterp(const X& x00, const X& x01, const X& x10, const X& x11,
|
|
||||||
const float s, const float t) {
|
|
||||||
auto y0 = Lerp(x00, x01, s);
|
|
||||||
auto y1 = Lerp(x10, x11, s);
|
|
||||||
return Lerp(y0, y1, t);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Utility vector factories
|
|
||||||
template <typename T>
|
|
||||||
[[nodiscard]] constexpr Vec2<T> MakeVec(const T& x, const T& y) {
|
|
||||||
return Vec2<T>{x, y};
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
[[nodiscard]] constexpr Vec3<T> MakeVec(const T& x, const T& y, const T& z) {
|
|
||||||
return Vec3<T>{x, y, z};
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
[[nodiscard]] constexpr Vec4<T> MakeVec(const T& x, const T& y, const Vec2<T>& zw) {
|
|
||||||
return MakeVec(x, y, zw[0], zw[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
[[nodiscard]] constexpr Vec3<T> MakeVec(const Vec2<T>& xy, const T& z) {
|
|
||||||
return MakeVec(xy[0], xy[1], z);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
[[nodiscard]] constexpr Vec3<T> MakeVec(const T& x, const Vec2<T>& yz) {
|
|
||||||
return MakeVec(x, yz[0], yz[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
[[nodiscard]] constexpr Vec4<T> MakeVec(const T& x, const T& y, const T& z, const T& w) {
|
|
||||||
return Vec4<T>{x, y, z, w};
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
[[nodiscard]] constexpr Vec4<T> MakeVec(const Vec2<T>& xy, const T& z, const T& w) {
|
|
||||||
return MakeVec(xy[0], xy[1], z, w);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
[[nodiscard]] constexpr Vec4<T> MakeVec(const T& x, const Vec2<T>& yz, const T& w) {
|
|
||||||
return MakeVec(x, yz[0], yz[1], w);
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE: This has priority over "Vec2<Vec2<T>> MakeVec(const Vec2<T>& x, const Vec2<T>& y)".
|
|
||||||
// Even if someone wanted to use an odd object like Vec2<Vec2<T>>, the compiler would error
|
|
||||||
// out soon enough due to misuse of the returned structure.
|
|
||||||
template <typename T>
|
|
||||||
[[nodiscard]] constexpr Vec4<T> MakeVec(const Vec2<T>& xy, const Vec2<T>& zw) {
|
|
||||||
return MakeVec(xy[0], xy[1], zw[0], zw[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
[[nodiscard]] constexpr Vec4<T> MakeVec(const Vec3<T>& xyz, const T& w) {
|
|
||||||
return MakeVec(xyz[0], xyz[1], xyz[2], w);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
[[nodiscard]] constexpr Vec4<T> MakeVec(const T& x, const Vec3<T>& yzw) {
|
|
||||||
return MakeVec(x, yzw[0], yzw[1], yzw[2]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Common
|
} // namespace Common
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
@@ -30,15 +33,15 @@ struct DeviceSettings {
|
|||||||
INSERT_PADDING_BYTES(0x20); // Reserved
|
INSERT_PADDING_BYTES(0x20); // Reserved
|
||||||
|
|
||||||
// nn::settings::system::ConsoleSixAxisSensorAccelerationBias
|
// nn::settings::system::ConsoleSixAxisSensorAccelerationBias
|
||||||
Common::Vec3<f32> console_six_axis_sensor_acceleration_bias;
|
Common::Vec<f32, 3> console_six_axis_sensor_acceleration_bias;
|
||||||
// nn::settings::system::ConsoleSixAxisSensorAngularVelocityBias
|
// nn::settings::system::ConsoleSixAxisSensorAngularVelocityBias
|
||||||
Common::Vec3<f32> console_six_axis_sensor_angular_velocity_bias;
|
Common::Vec<f32, 3> console_six_axis_sensor_angular_velocity_bias;
|
||||||
// nn::settings::system::ConsoleSixAxisSensorAccelerationGain
|
// nn::settings::system::ConsoleSixAxisSensorAccelerationGain
|
||||||
std::array<u8, 0x24> console_six_axis_sensor_acceleration_gain;
|
std::array<u8, 0x24> console_six_axis_sensor_acceleration_gain;
|
||||||
// nn::settings::system::ConsoleSixAxisSensorAngularVelocityGain
|
// nn::settings::system::ConsoleSixAxisSensorAngularVelocityGain
|
||||||
std::array<u8, 0x24> console_six_axis_sensor_angular_velocity_gain;
|
std::array<u8, 0x24> console_six_axis_sensor_angular_velocity_gain;
|
||||||
// nn::settings::system::ConsoleSixAxisSensorAngularVelocityTimeBias
|
// nn::settings::system::ConsoleSixAxisSensorAngularVelocityTimeBias
|
||||||
Common::Vec3<f32> console_six_axis_sensor_angular_velocity_time_bias;
|
Common::Vec<f32, 3> console_six_axis_sensor_angular_velocity_time_bias;
|
||||||
// nn::settings::system::ConsoleSixAxisSensorAngularAcceleration
|
// nn::settings::system::ConsoleSixAxisSensorAngularAcceleration
|
||||||
std::array<u8, 0x24> console_six_axis_sensor_angular_acceleration;
|
std::array<u8, 0x24> console_six_axis_sensor_angular_acceleration;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
@@ -153,15 +153,15 @@ struct SystemSettings {
|
|||||||
INSERT_PADDING_BYTES(0x7FF8); // Reserved
|
INSERT_PADDING_BYTES(0x7FF8); // Reserved
|
||||||
|
|
||||||
// nn::settings::system::ConsoleSixAxisSensorAccelerationBias
|
// nn::settings::system::ConsoleSixAxisSensorAccelerationBias
|
||||||
Common::Vec3<f32> console_six_axis_sensor_acceleration_bias;
|
Common::Vec<f32, 3> console_six_axis_sensor_acceleration_bias;
|
||||||
// nn::settings::system::ConsoleSixAxisSensorAngularVelocityBias
|
// nn::settings::system::ConsoleSixAxisSensorAngularVelocityBias
|
||||||
Common::Vec3<f32> console_six_axis_sensor_angular_velocity_bias;
|
Common::Vec<f32, 3> console_six_axis_sensor_angular_velocity_bias;
|
||||||
// nn::settings::system::ConsoleSixAxisSensorAccelerationGain
|
// nn::settings::system::ConsoleSixAxisSensorAccelerationGain
|
||||||
std::array<u8, 0x24> console_six_axis_sensor_acceleration_gain;
|
std::array<u8, 0x24> console_six_axis_sensor_acceleration_gain;
|
||||||
// nn::settings::system::ConsoleSixAxisSensorAngularVelocityGain
|
// nn::settings::system::ConsoleSixAxisSensorAngularVelocityGain
|
||||||
std::array<u8, 0x24> console_six_axis_sensor_angular_velocity_gain;
|
std::array<u8, 0x24> console_six_axis_sensor_angular_velocity_gain;
|
||||||
// nn::settings::system::ConsoleSixAxisSensorAngularVelocityTimeBias
|
// nn::settings::system::ConsoleSixAxisSensorAngularVelocityTimeBias
|
||||||
Common::Vec3<f32> console_six_axis_sensor_angular_velocity_time_bias;
|
Common::Vec<f32, 3> console_six_axis_sensor_angular_velocity_time_bias;
|
||||||
// nn::settings::system::ConsoleSixAxisSensorAngularAcceleration
|
// nn::settings::system::ConsoleSixAxisSensorAngularAcceleration
|
||||||
std::array<u8, 0x24> console_six_axis_sensor_angular_velocity_acceleration;
|
std::array<u8, 0x24> console_six_axis_sensor_angular_velocity_acceleration;
|
||||||
INSERT_PADDING_BYTES(0x70); // Reserved
|
INSERT_PADDING_BYTES(0x70); // Reserved
|
||||||
|
|||||||
@@ -170,12 +170,12 @@ void EmulatedConsole::SetMotion(const Common::Input::CallbackStatus& callback) {
|
|||||||
auto& emulated = console.motion_values.emulated;
|
auto& emulated = console.motion_values.emulated;
|
||||||
|
|
||||||
raw_status = TransformToMotion(callback);
|
raw_status = TransformToMotion(callback);
|
||||||
emulated.SetAcceleration(Common::Vec3f{
|
emulated.SetAcceleration(Common::Vec<f32, 3>{
|
||||||
raw_status.accel.x.value,
|
raw_status.accel.x.value,
|
||||||
raw_status.accel.y.value,
|
raw_status.accel.y.value,
|
||||||
raw_status.accel.z.value,
|
raw_status.accel.z.value,
|
||||||
});
|
});
|
||||||
emulated.SetGyroscope(Common::Vec3f{
|
emulated.SetGyroscope(Common::Vec<f32, 3>{
|
||||||
raw_status.gyro.x.value,
|
raw_status.gyro.x.value,
|
||||||
raw_status.gyro.y.value,
|
raw_status.gyro.y.value,
|
||||||
raw_status.gyro.z.value,
|
raw_status.gyro.z.value,
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
#include "common/input.h"
|
#include "common/input.h"
|
||||||
#include "common/param_package.h"
|
#include "common/param_package.h"
|
||||||
#include "common/point.h"
|
#include "common/point.h"
|
||||||
#include "common/quaternion.h"
|
|
||||||
#include "common/vector_math.h"
|
#include "common/vector_math.h"
|
||||||
#include "hid_core/frontend/motion_input.h"
|
#include "hid_core/frontend/motion_input.h"
|
||||||
#include "hid_core/hid_types.h"
|
#include "hid_core/hid_types.h"
|
||||||
@@ -43,12 +42,12 @@ using TouchValues = std::array<Common::Input::TouchStatus, MaxTouchDevices>;
|
|||||||
|
|
||||||
// Contains all motion related data that is used on the services
|
// Contains all motion related data that is used on the services
|
||||||
struct ConsoleMotion {
|
struct ConsoleMotion {
|
||||||
Common::Vec3f accel{};
|
Common::Vec<f32, 3> accel{};
|
||||||
Common::Vec3f gyro{};
|
Common::Vec<f32, 3> gyro{};
|
||||||
Common::Vec3f rotation{};
|
Common::Vec<f32, 3> rotation{};
|
||||||
std::array<Common::Vec3f, 3> orientation{};
|
std::array<Common::Vec<f32, 3>, 3> orientation{};
|
||||||
Common::Quaternion<f32> quaternion{};
|
Common::Vec<f32, 4> quaternion{};
|
||||||
Common::Vec3f gyro_bias{};
|
Common::Vec<f32, 3> gyro_bias{};
|
||||||
f32 verticalization_error{};
|
f32 verticalization_error{};
|
||||||
bool is_at_rest{};
|
bool is_at_rest{};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1051,12 +1051,12 @@ void EmulatedController::SetMotion(const Common::Input::CallbackStatus& callback
|
|||||||
auto& emulated = controller.motion_values[index].emulated;
|
auto& emulated = controller.motion_values[index].emulated;
|
||||||
|
|
||||||
raw_status = TransformToMotion(callback);
|
raw_status = TransformToMotion(callback);
|
||||||
emulated.SetAcceleration(Common::Vec3f{
|
emulated.SetAcceleration(Common::Vec<f32, 3>{
|
||||||
raw_status.accel.x.value,
|
raw_status.accel.x.value,
|
||||||
raw_status.accel.y.value,
|
raw_status.accel.y.value,
|
||||||
raw_status.accel.z.value,
|
raw_status.accel.z.value,
|
||||||
});
|
});
|
||||||
emulated.SetGyroscope(Common::Vec3f{
|
emulated.SetGyroscope(Common::Vec<f32, 3>{
|
||||||
raw_status.gyro.x.value,
|
raw_status.gyro.x.value,
|
||||||
raw_status.gyro.y.value,
|
raw_status.gyro.y.value,
|
||||||
raw_status.gyro.z.value,
|
raw_status.gyro.z.value,
|
||||||
|
|||||||
@@ -107,11 +107,11 @@ struct RingSensorForce {
|
|||||||
using NfcState = Common::Input::NfcStatus;
|
using NfcState = Common::Input::NfcStatus;
|
||||||
|
|
||||||
struct ControllerMotion {
|
struct ControllerMotion {
|
||||||
Common::Vec3f accel{};
|
Common::Vec<f32, 3> accel{};
|
||||||
Common::Vec3f gyro{};
|
Common::Vec<f32, 3> gyro{};
|
||||||
Common::Vec3f rotation{};
|
Common::Vec<f32, 3> rotation{};
|
||||||
Common::Vec3f euler{};
|
Common::Vec<f32, 3> euler{};
|
||||||
std::array<Common::Vec3f, 3> orientation{};
|
std::array<Common::Vec<f32, 3>, 3> orientation{};
|
||||||
bool is_at_rest{};
|
bool is_at_rest{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -26,20 +26,19 @@ void MotionInput::SetPID(f32 new_kp, f32 new_ki, f32 new_kd) {
|
|||||||
kd = new_kd;
|
kd = new_kd;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotionInput::SetAcceleration(const Common::Vec3f& acceleration) {
|
void MotionInput::SetAcceleration(const Common::Vec<f32, 3>& acceleration) {
|
||||||
accel = acceleration;
|
accel = acceleration;
|
||||||
|
accel[0] = std::clamp(accel[0], -AccelMaxValue, AccelMaxValue);
|
||||||
accel.x = std::clamp(accel.x, -AccelMaxValue, AccelMaxValue);
|
accel[1] = std::clamp(accel[1], -AccelMaxValue, AccelMaxValue);
|
||||||
accel.y = std::clamp(accel.y, -AccelMaxValue, AccelMaxValue);
|
accel[2] = std::clamp(accel[2], -AccelMaxValue, AccelMaxValue);
|
||||||
accel.z = std::clamp(accel.z, -AccelMaxValue, AccelMaxValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotionInput::SetGyroscope(const Common::Vec3f& gyroscope) {
|
void MotionInput::SetGyroscope(const Common::Vec<f32, 3>& gyroscope) {
|
||||||
gyro = gyroscope - gyro_bias;
|
gyro = gyroscope - gyro_bias;
|
||||||
|
|
||||||
gyro.x = std::clamp(gyro.x, -GyroMaxValue, GyroMaxValue);
|
gyro[0] = std::clamp(gyro[0], -GyroMaxValue, GyroMaxValue);
|
||||||
gyro.y = std::clamp(gyro.y, -GyroMaxValue, GyroMaxValue);
|
gyro[1] = std::clamp(gyro[1], -GyroMaxValue, GyroMaxValue);
|
||||||
gyro.z = std::clamp(gyro.z, -GyroMaxValue, GyroMaxValue);
|
gyro[2] = std::clamp(gyro[2], -GyroMaxValue, GyroMaxValue);
|
||||||
|
|
||||||
// Auto adjust gyro_bias to minimize drift
|
// Auto adjust gyro_bias to minimize drift
|
||||||
if (!IsMoving(IsAtRestRelaxed)) {
|
if (!IsMoving(IsAtRestRelaxed)) {
|
||||||
@@ -59,25 +58,25 @@ void MotionInput::SetGyroscope(const Common::Vec3f& gyroscope) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotionInput::SetQuaternion(const Common::Quaternion<f32>& quaternion) {
|
void MotionInput::SetQuaternion(const Common::Vec<f32, 4>& quaternion) {
|
||||||
quat = quaternion;
|
quat = quaternion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotionInput::SetEulerAngles(const Common::Vec3f& euler_angles) {
|
void MotionInput::SetEulerAngles(const Common::Vec<f32, 3>& euler_angles) {
|
||||||
const float cr = std::cos(euler_angles.x * 0.5f);
|
const float cr = std::cos(euler_angles[0] * 0.5f);
|
||||||
const float sr = std::sin(euler_angles.x * 0.5f);
|
const float sr = std::sin(euler_angles[0] * 0.5f);
|
||||||
const float cp = std::cos(euler_angles.y * 0.5f);
|
const float cp = std::cos(euler_angles[1] * 0.5f);
|
||||||
const float sp = std::sin(euler_angles.y * 0.5f);
|
const float sp = std::sin(euler_angles[1] * 0.5f);
|
||||||
const float cy = std::cos(euler_angles.z * 0.5f);
|
const float cy = std::cos(euler_angles[2] * 0.5f);
|
||||||
const float sy = std::sin(euler_angles.z * 0.5f);
|
const float sy = std::sin(euler_angles[2] * 0.5f);
|
||||||
|
|
||||||
quat.w = cr * cp * cy + sr * sp * sy;
|
quat[3] = cr * cp * cy + sr * sp * sy;
|
||||||
quat.xyz.x = sr * cp * cy - cr * sp * sy;
|
quat[0] = sr * cp * cy - cr * sp * sy;
|
||||||
quat.xyz.y = cr * sp * cy + sr * cp * sy;
|
quat[1] = cr * sp * cy + sr * cp * sy;
|
||||||
quat.xyz.z = cr * cp * sy - sr * sp * cy;
|
quat[2] = cr * cp * sy - sr * sp * cy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotionInput::SetGyroBias(const Common::Vec3f& bias) {
|
void MotionInput::SetGyroBias(const Common::Vec<f32, 3>& bias) {
|
||||||
gyro_bias = bias;
|
gyro_bias = bias;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +97,7 @@ void MotionInput::ResetRotations() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MotionInput::ResetQuaternion() {
|
void MotionInput::ResetQuaternion() {
|
||||||
quat = {{0.0f, 0.0f, -1.0f}, 0.0f};
|
quat = Common::Vec<f32, 4>{0.0f, 0.0f, -1.0f, 0.0f};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MotionInput::IsMoving(f32 sensitivity) const {
|
bool MotionInput::IsMoving(f32 sensitivity) const {
|
||||||
@@ -137,10 +136,10 @@ void MotionInput::UpdateOrientation(u64 elapsed_time) {
|
|||||||
ResetOrientation();
|
ResetOrientation();
|
||||||
}
|
}
|
||||||
// Short name local variable for readability
|
// Short name local variable for readability
|
||||||
f32 q1 = quat.w;
|
f32 q1 = quat[3];
|
||||||
f32 q2 = quat.xyz[0];
|
f32 q2 = quat[0];
|
||||||
f32 q3 = quat.xyz[1];
|
f32 q3 = quat[1];
|
||||||
f32 q4 = quat.xyz[2];
|
f32 q4 = quat[2];
|
||||||
const auto sample_period = static_cast<f32>(elapsed_time) / 1000000.0f;
|
const auto sample_period = static_cast<f32>(elapsed_time) / 1000000.0f;
|
||||||
|
|
||||||
// Ignore invalid elapsed time
|
// Ignore invalid elapsed time
|
||||||
@@ -150,23 +149,23 @@ void MotionInput::UpdateOrientation(u64 elapsed_time) {
|
|||||||
|
|
||||||
const auto normal_accel = accel.Normalized();
|
const auto normal_accel = accel.Normalized();
|
||||||
auto rad_gyro = gyro * std::numbers::pi_v<float> * 2.f;
|
auto rad_gyro = gyro * std::numbers::pi_v<float> * 2.f;
|
||||||
const f32 swap = rad_gyro.x;
|
const f32 swap = rad_gyro[0];
|
||||||
rad_gyro.x = rad_gyro.y;
|
rad_gyro[0] = rad_gyro[1];
|
||||||
rad_gyro.y = -swap;
|
rad_gyro[1] = -swap;
|
||||||
rad_gyro.z = -rad_gyro.z;
|
rad_gyro[2] = -rad_gyro[2];
|
||||||
|
|
||||||
// Clear gyro values if there is no gyro present
|
// Clear gyro values if there is no gyro present
|
||||||
if (only_accelerometer) {
|
if (only_accelerometer) {
|
||||||
rad_gyro.x = 0;
|
rad_gyro[0] = 0;
|
||||||
rad_gyro.y = 0;
|
rad_gyro[1] = 0;
|
||||||
rad_gyro.z = 0;
|
rad_gyro[2] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore drift correction if acceleration is not reliable
|
// Ignore drift correction if acceleration is not reliable
|
||||||
if (accel.Length() >= 0.75f && accel.Length() <= 1.25f) {
|
if (accel.Length() >= 0.75f && accel.Length() <= 1.25f) {
|
||||||
const f32 ax = -normal_accel.x;
|
const f32 ax = -normal_accel[0];
|
||||||
const f32 ay = normal_accel.y;
|
const f32 ay = normal_accel[1];
|
||||||
const f32 az = -normal_accel.z;
|
const f32 az = -normal_accel[2];
|
||||||
|
|
||||||
// Estimated direction of gravity
|
// Estimated direction of gravity
|
||||||
const f32 vx = 2.0f * (q2 * q4 - q1 * q3);
|
const f32 vx = 2.0f * (q2 * q4 - q1 * q3);
|
||||||
@@ -174,7 +173,7 @@ void MotionInput::UpdateOrientation(u64 elapsed_time) {
|
|||||||
const f32 vz = q1 * q1 - q2 * q2 - q3 * q3 + q4 * q4;
|
const f32 vz = q1 * q1 - q2 * q2 - q3 * q3 + q4 * q4;
|
||||||
|
|
||||||
// Error is cross product between estimated direction and measured direction of gravity
|
// Error is cross product between estimated direction and measured direction of gravity
|
||||||
const Common::Vec3f new_real_error = {
|
const Common::Vec<f32, 3> new_real_error{
|
||||||
az * vx - ax * vz,
|
az * vx - ax * vz,
|
||||||
ay * vz - az * vy,
|
ay * vz - az * vy,
|
||||||
ax * vy - ay * vx,
|
ax * vy - ay * vx,
|
||||||
@@ -202,16 +201,16 @@ void MotionInput::UpdateOrientation(u64 elapsed_time) {
|
|||||||
rad_gyro += 10.0f * kd * derivative_error;
|
rad_gyro += 10.0f * kd * derivative_error;
|
||||||
|
|
||||||
// Emulate gyro values for games that need them
|
// Emulate gyro values for games that need them
|
||||||
gyro.x = -rad_gyro.y;
|
gyro[0] = -rad_gyro[1];
|
||||||
gyro.y = rad_gyro.x;
|
gyro[1] = rad_gyro[0];
|
||||||
gyro.z = -rad_gyro.z;
|
gyro[2] = -rad_gyro[2];
|
||||||
UpdateRotation(elapsed_time);
|
UpdateRotation(elapsed_time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const f32 gx = rad_gyro.y;
|
const f32 gx = rad_gyro[1];
|
||||||
const f32 gy = rad_gyro.x;
|
const f32 gy = rad_gyro[0];
|
||||||
const f32 gz = rad_gyro.z;
|
const f32 gz = rad_gyro[2];
|
||||||
|
|
||||||
// Integrate rate of change of quaternion
|
// Integrate rate of change of quaternion
|
||||||
const f32 pa = q2;
|
const f32 pa = q2;
|
||||||
@@ -222,57 +221,58 @@ void MotionInput::UpdateOrientation(u64 elapsed_time) {
|
|||||||
q3 = pb + (q1 * gy - pa * gz + pc * gx) * (0.5f * sample_period);
|
q3 = pb + (q1 * gy - pa * gz + pc * gx) * (0.5f * sample_period);
|
||||||
q4 = pc + (q1 * gz + pa * gy - pb * gx) * (0.5f * sample_period);
|
q4 = pc + (q1 * gz + pa * gy - pb * gx) * (0.5f * sample_period);
|
||||||
|
|
||||||
quat.w = q1;
|
quat[3] = q1;
|
||||||
quat.xyz[0] = q2;
|
quat[0] = q2;
|
||||||
quat.xyz[1] = q3;
|
quat[1] = q3;
|
||||||
quat.xyz[2] = q4;
|
quat[2] = q4;
|
||||||
quat = quat.Normalized();
|
quat = quat.Normalized();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::array<Common::Vec3f, 3> MotionInput::GetOrientation() const {
|
std::array<Common::Vec<f32, 3>, 3> MotionInput::GetOrientation() const {
|
||||||
const Common::Quaternion<float> quad{
|
const Common::Vec<f32, 4> quad{
|
||||||
.xyz = {-quat.xyz[1], -quat.xyz[0], -quat.w},
|
-quat[1],
|
||||||
.w = -quat.xyz[2],
|
-quat[0],
|
||||||
|
-quat[3],
|
||||||
|
-quat[2],
|
||||||
};
|
};
|
||||||
const std::array<float, 16> matrix4x4 = quad.ToMatrix();
|
const std::array<f32, 16> matrix4x4 = quad.ToMatrix();
|
||||||
|
return {Common::Vec<f32, 3>(matrix4x4[0], matrix4x4[1], -matrix4x4[2]),
|
||||||
return {Common::Vec3f(matrix4x4[0], matrix4x4[1], -matrix4x4[2]),
|
Common::Vec<f32, 3>(matrix4x4[4], matrix4x4[5], -matrix4x4[6]),
|
||||||
Common::Vec3f(matrix4x4[4], matrix4x4[5], -matrix4x4[6]),
|
Common::Vec<f32, 3>(-matrix4x4[8], -matrix4x4[9], matrix4x4[10])};
|
||||||
Common::Vec3f(-matrix4x4[8], -matrix4x4[9], matrix4x4[10])};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Vec3f MotionInput::GetAcceleration() const {
|
Common::Vec<f32, 3> MotionInput::GetAcceleration() const {
|
||||||
return accel;
|
return accel;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Vec3f MotionInput::GetGyroscope() const {
|
Common::Vec<f32, 3> MotionInput::GetGyroscope() const {
|
||||||
return gyro;
|
return gyro;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Vec3f MotionInput::GetGyroBias() const {
|
Common::Vec<f32, 3> MotionInput::GetGyroBias() const {
|
||||||
return gyro_bias;
|
return gyro_bias;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Quaternion<f32> MotionInput::GetQuaternion() const {
|
Common::Vec<f32, 4> MotionInput::GetQuaternion() const {
|
||||||
return quat;
|
return quat;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Vec3f MotionInput::GetRotations() const {
|
Common::Vec<f32, 3> MotionInput::GetRotations() const {
|
||||||
return rotations;
|
return rotations;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Vec3f MotionInput::GetEulerAngles() const {
|
Common::Vec<f32, 3> MotionInput::GetEulerAngles() const {
|
||||||
// roll (x-axis rotation)
|
// roll (x-axis rotation)
|
||||||
const float sinr_cosp = 2 * (quat.w * quat.xyz.x + quat.xyz.y * quat.xyz.z);
|
const float sinr_cosp = 2 * (quat[3] * quat[0] + quat[1] * quat[2]);
|
||||||
const float cosr_cosp = 1 - 2 * (quat.xyz.x * quat.xyz.x + quat.xyz.y * quat.xyz.y);
|
const float cosr_cosp = 1 - 2 * (quat[0] * quat[0] + quat[1] * quat[1]);
|
||||||
|
|
||||||
// pitch (y-axis rotation)
|
// pitch (y-axis rotation)
|
||||||
const float sinp = std::sqrt(1 + 2 * (quat.w * quat.xyz.y - quat.xyz.x * quat.xyz.z));
|
const float sinp = std::sqrt(1 + 2 * (quat[3] * quat[1] - quat[0] * quat[2]));
|
||||||
const float cosp = std::sqrt(1 - 2 * (quat.w * quat.xyz.y - quat.xyz.x * quat.xyz.z));
|
const float cosp = std::sqrt(1 - 2 * (quat[3] * quat[1] - quat[0] * quat[2]));
|
||||||
|
|
||||||
// yaw (z-axis rotation)
|
// yaw (z-axis rotation)
|
||||||
const float siny_cosp = 2 * (quat.w * quat.xyz.z + quat.xyz.x * quat.xyz.y);
|
const float siny_cosp = 2 * (quat[3] * quat[2] + quat[0] * quat[1]);
|
||||||
const float cosy_cosp = 1 - 2 * (quat.xyz.y * quat.xyz.y + quat.xyz.z * quat.xyz.z);
|
const float cosy_cosp = 1 - 2 * (quat[1] * quat[1] + quat[2] * quat[2]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
std::atan2(sinr_cosp, cosr_cosp),
|
std::atan2(sinr_cosp, cosr_cosp),
|
||||||
@@ -285,13 +285,13 @@ void MotionInput::ResetOrientation() {
|
|||||||
if (!reset_enabled || only_accelerometer) {
|
if (!reset_enabled || only_accelerometer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!IsMoving(IsAtRestRelaxed) && accel.z <= -0.9f) {
|
if (!IsMoving(IsAtRestRelaxed) && accel[2] <= -0.9f) {
|
||||||
++reset_counter;
|
++reset_counter;
|
||||||
if (reset_counter > 900) {
|
if (reset_counter > 900) {
|
||||||
quat.w = 0;
|
quat[3] = 0;
|
||||||
quat.xyz[0] = 0;
|
quat[0] = 0;
|
||||||
quat.xyz[1] = 0;
|
quat[1] = 0;
|
||||||
quat.xyz[2] = -1;
|
quat[2] = -1;
|
||||||
SetOrientationFromAccelerometer();
|
SetOrientationFromAccelerometer();
|
||||||
integral_error = {};
|
integral_error = {};
|
||||||
reset_counter = 0;
|
reset_counter = 0;
|
||||||
@@ -309,15 +309,15 @@ void MotionInput::SetOrientationFromAccelerometer() {
|
|||||||
|
|
||||||
while (!IsCalibrated(0.01f) && ++iterations < 100) {
|
while (!IsCalibrated(0.01f) && ++iterations < 100) {
|
||||||
// Short name local variable for readability
|
// Short name local variable for readability
|
||||||
f32 q1 = quat.w;
|
f32 q1 = quat[3];
|
||||||
f32 q2 = quat.xyz[0];
|
f32 q2 = quat[0];
|
||||||
f32 q3 = quat.xyz[1];
|
f32 q3 = quat[1];
|
||||||
f32 q4 = quat.xyz[2];
|
f32 q4 = quat[2];
|
||||||
|
|
||||||
Common::Vec3f rad_gyro;
|
Common::Vec<f32, 3> rad_gyro;
|
||||||
const f32 ax = -normal_accel.x;
|
const f32 ax = -normal_accel[0];
|
||||||
const f32 ay = normal_accel.y;
|
const f32 ay = normal_accel[1];
|
||||||
const f32 az = -normal_accel.z;
|
const f32 az = -normal_accel[2];
|
||||||
|
|
||||||
// Estimated direction of gravity
|
// Estimated direction of gravity
|
||||||
const f32 vx = 2.0f * (q2 * q4 - q1 * q3);
|
const f32 vx = 2.0f * (q2 * q4 - q1 * q3);
|
||||||
@@ -325,7 +325,7 @@ void MotionInput::SetOrientationFromAccelerometer() {
|
|||||||
const f32 vz = q1 * q1 - q2 * q2 - q3 * q3 + q4 * q4;
|
const f32 vz = q1 * q1 - q2 * q2 - q3 * q3 + q4 * q4;
|
||||||
|
|
||||||
// Error is cross product between estimated direction and measured direction of gravity
|
// Error is cross product between estimated direction and measured direction of gravity
|
||||||
const Common::Vec3f new_real_error = {
|
const Common::Vec<f32, 3> new_real_error = {
|
||||||
az * vx - ax * vz,
|
az * vx - ax * vz,
|
||||||
ay * vz - az * vy,
|
ay * vz - az * vy,
|
||||||
ax * vy - ay * vx,
|
ax * vy - ay * vx,
|
||||||
@@ -338,9 +338,9 @@ void MotionInput::SetOrientationFromAccelerometer() {
|
|||||||
rad_gyro += 5.0f * ki * integral_error;
|
rad_gyro += 5.0f * ki * integral_error;
|
||||||
rad_gyro += 10.0f * kd * derivative_error;
|
rad_gyro += 10.0f * kd * derivative_error;
|
||||||
|
|
||||||
const f32 gx = rad_gyro.y;
|
const f32 gx = rad_gyro[1];
|
||||||
const f32 gy = rad_gyro.x;
|
const f32 gy = rad_gyro[0];
|
||||||
const f32 gz = rad_gyro.z;
|
const f32 gz = rad_gyro[2];
|
||||||
|
|
||||||
// Integrate rate of change of quaternion
|
// Integrate rate of change of quaternion
|
||||||
const f32 pa = q2;
|
const f32 pa = q2;
|
||||||
@@ -351,10 +351,10 @@ void MotionInput::SetOrientationFromAccelerometer() {
|
|||||||
q3 = pb + (q1 * gy - pa * gz + pc * gx) * (0.5f * sample_period);
|
q3 = pb + (q1 * gy - pa * gz + pc * gx) * (0.5f * sample_period);
|
||||||
q4 = pc + (q1 * gz + pa * gy - pb * gx) * (0.5f * sample_period);
|
q4 = pc + (q1 * gz + pa * gy - pb * gx) * (0.5f * sample_period);
|
||||||
|
|
||||||
quat.w = q1;
|
quat[3] = q1;
|
||||||
quat.xyz[0] = q2;
|
quat[0] = q2;
|
||||||
quat.xyz[1] = q3;
|
quat[1] = q3;
|
||||||
quat.xyz[2] = q4;
|
quat[2] = q4;
|
||||||
quat = quat.Normalized();
|
quat = quat.Normalized();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/quaternion.h"
|
|
||||||
#include "common/vector_math.h"
|
#include "common/vector_math.h"
|
||||||
|
|
||||||
namespace Core::HID {
|
namespace Core::HID {
|
||||||
@@ -34,11 +36,11 @@ public:
|
|||||||
MotionInput& operator=(MotionInput&&) = default;
|
MotionInput& operator=(MotionInput&&) = default;
|
||||||
|
|
||||||
void SetPID(f32 new_kp, f32 new_ki, f32 new_kd);
|
void SetPID(f32 new_kp, f32 new_ki, f32 new_kd);
|
||||||
void SetAcceleration(const Common::Vec3f& acceleration);
|
void SetAcceleration(const Common::Vec<f32, 3>& acceleration);
|
||||||
void SetGyroscope(const Common::Vec3f& gyroscope);
|
void SetGyroscope(const Common::Vec<f32, 3>& gyroscope);
|
||||||
void SetQuaternion(const Common::Quaternion<f32>& quaternion);
|
void SetQuaternion(const Common::Vec<f32, 4>& quaternion);
|
||||||
void SetEulerAngles(const Common::Vec3f& euler_angles);
|
void SetEulerAngles(const Common::Vec<f32, 3>& euler_angles);
|
||||||
void SetGyroBias(const Common::Vec3f& bias);
|
void SetGyroBias(const Common::Vec<f32, 3>& bias);
|
||||||
void SetGyroThreshold(f32 threshold);
|
void SetGyroThreshold(f32 threshold);
|
||||||
|
|
||||||
/// Applies a modifier on top of the normal gyro threshold
|
/// Applies a modifier on top of the normal gyro threshold
|
||||||
@@ -53,13 +55,13 @@ public:
|
|||||||
|
|
||||||
void Calibrate();
|
void Calibrate();
|
||||||
|
|
||||||
[[nodiscard]] std::array<Common::Vec3f, 3> GetOrientation() const;
|
[[nodiscard]] std::array<Common::Vec<f32, 3>, 3> GetOrientation() const;
|
||||||
[[nodiscard]] Common::Vec3f GetAcceleration() const;
|
[[nodiscard]] Common::Vec<f32, 3> GetAcceleration() const;
|
||||||
[[nodiscard]] Common::Vec3f GetGyroscope() const;
|
[[nodiscard]] Common::Vec<f32, 3> GetGyroscope() const;
|
||||||
[[nodiscard]] Common::Vec3f GetGyroBias() const;
|
[[nodiscard]] Common::Vec<f32, 3> GetGyroBias() const;
|
||||||
[[nodiscard]] Common::Vec3f GetRotations() const;
|
[[nodiscard]] Common::Vec<f32, 3> GetRotations() const;
|
||||||
[[nodiscard]] Common::Quaternion<f32> GetQuaternion() const;
|
[[nodiscard]] Common::Vec<f32, 4> GetQuaternion() const;
|
||||||
[[nodiscard]] Common::Vec3f GetEulerAngles() const;
|
[[nodiscard]] Common::Vec<f32, 3> GetEulerAngles() const;
|
||||||
|
|
||||||
[[nodiscard]] bool IsMoving(f32 sensitivity) const;
|
[[nodiscard]] bool IsMoving(f32 sensitivity) const;
|
||||||
[[nodiscard]] bool IsCalibrated(f32 sensitivity) const;
|
[[nodiscard]] bool IsCalibrated(f32 sensitivity) const;
|
||||||
@@ -75,24 +77,24 @@ private:
|
|||||||
f32 kd;
|
f32 kd;
|
||||||
|
|
||||||
// PID errors
|
// PID errors
|
||||||
Common::Vec3f real_error;
|
Common::Vec<f32, 3> real_error;
|
||||||
Common::Vec3f integral_error;
|
Common::Vec<f32, 3> integral_error;
|
||||||
Common::Vec3f derivative_error;
|
Common::Vec<f32, 3> derivative_error;
|
||||||
|
|
||||||
// Quaternion containing the device orientation
|
// Quaternion containing the device orientation
|
||||||
Common::Quaternion<f32> quat;
|
Common::Vec<f32, 4> quat;
|
||||||
|
|
||||||
// Number of full rotations in each axis
|
// Number of full rotations in each axis
|
||||||
Common::Vec3f rotations;
|
Common::Vec<f32, 3> rotations;
|
||||||
|
|
||||||
// Acceleration vector measurement in G force
|
// Acceleration vector measurement in G force
|
||||||
Common::Vec3f accel;
|
Common::Vec<f32, 3> accel;
|
||||||
|
|
||||||
// Gyroscope vector measurement in radians/s.
|
// Gyroscope vector measurement in radians/s.
|
||||||
Common::Vec3f gyro;
|
Common::Vec<f32, 3> gyro;
|
||||||
|
|
||||||
// Vector to be subtracted from gyro measurements
|
// Vector to be subtracted from gyro measurements
|
||||||
Common::Vec3f gyro_bias;
|
Common::Vec<f32, 3> gyro_bias;
|
||||||
|
|
||||||
// Minimum gyro amplitude to detect if the device is moving
|
// Minimum gyro amplitude to detect if the device is moving
|
||||||
f32 gyro_threshold = 0.0f;
|
f32 gyro_threshold = 0.0f;
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// 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
|
||||||
|
|
||||||
@@ -602,10 +605,10 @@ static_assert(sizeof(SixAxisSensorAttribute) == 4, "SixAxisSensorAttribute is an
|
|||||||
struct SixAxisSensorState {
|
struct SixAxisSensorState {
|
||||||
s64 delta_time{};
|
s64 delta_time{};
|
||||||
s64 sampling_number{};
|
s64 sampling_number{};
|
||||||
Common::Vec3f accel{};
|
Common::Vec<f32, 3> accel{};
|
||||||
Common::Vec3f gyro{};
|
Common::Vec<f32, 3> gyro{};
|
||||||
Common::Vec3f rotation{};
|
Common::Vec<f32, 3> rotation{};
|
||||||
std::array<Common::Vec3f, 3> orientation{};
|
std::array<Common::Vec<f32, 3>, 3> orientation{};
|
||||||
SixAxisSensorAttribute attribute{};
|
SixAxisSensorAttribute attribute{};
|
||||||
INSERT_PADDING_BYTES(4); // Reserved
|
INSERT_PADDING_BYTES(4); // Reserved
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
@@ -196,7 +196,7 @@ struct ConsoleSixAxisSensorSharedMemoryFormat {
|
|||||||
bool is_seven_six_axis_sensor_at_rest{};
|
bool is_seven_six_axis_sensor_at_rest{};
|
||||||
INSERT_PADDING_BYTES(3); // padding
|
INSERT_PADDING_BYTES(3); // padding
|
||||||
f32 verticalization_error{};
|
f32 verticalization_error{};
|
||||||
Common::Vec3f gyro_bias{};
|
Common::Vec<f32, 3> gyro_bias{};
|
||||||
INSERT_PADDING_BYTES(4); // padding
|
INSERT_PADDING_BYTES(4); // padding
|
||||||
};
|
};
|
||||||
static_assert(sizeof(ConsoleSixAxisSensorSharedMemoryFormat) == 0x20,
|
static_assert(sizeof(ConsoleSixAxisSensorSharedMemoryFormat) == 0x20,
|
||||||
|
|||||||
@@ -46,14 +46,11 @@ void SevenSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
|||||||
next_seven_sixaxis_state.accel = motion_status.accel;
|
next_seven_sixaxis_state.accel = motion_status.accel;
|
||||||
next_seven_sixaxis_state.gyro = motion_status.gyro;
|
next_seven_sixaxis_state.gyro = motion_status.gyro;
|
||||||
next_seven_sixaxis_state.quaternion = {
|
next_seven_sixaxis_state.quaternion = {
|
||||||
{
|
motion_status.quaternion[1],
|
||||||
motion_status.quaternion.xyz.y,
|
motion_status.quaternion[0],
|
||||||
motion_status.quaternion.xyz.x,
|
-motion_status.quaternion[3],
|
||||||
-motion_status.quaternion.w,
|
-motion_status.quaternion[2],
|
||||||
},
|
|
||||||
-motion_status.quaternion.xyz.z,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
seven_sixaxis_lifo.WriteNextEntry(next_seven_sixaxis_state);
|
seven_sixaxis_lifo.WriteNextEntry(next_seven_sixaxis_state);
|
||||||
transfer_memory_owner->GetMemory().WriteBlock(transfer_memory, &seven_sixaxis_lifo,
|
transfer_memory_owner->GetMemory().WriteBlock(transfer_memory, &seven_sixaxis_lifo,
|
||||||
sizeof(seven_sixaxis_lifo));
|
sizeof(seven_sixaxis_lifo));
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/quaternion.h"
|
#include "common/vector_math.h"
|
||||||
#include "common/typed_address.h"
|
#include "common/typed_address.h"
|
||||||
#include "hid_core/resources/controller_base.h"
|
#include "hid_core/resources/controller_base.h"
|
||||||
#include "hid_core/resources/ring_lifo.h"
|
#include "hid_core/resources/ring_lifo.h"
|
||||||
@@ -51,9 +51,9 @@ private:
|
|||||||
u64 timestamp{};
|
u64 timestamp{};
|
||||||
u64 sampling_number{};
|
u64 sampling_number{};
|
||||||
u64 unknown{};
|
u64 unknown{};
|
||||||
Common::Vec3f accel{};
|
Common::Vec<f32, 3> accel{};
|
||||||
Common::Vec3f gyro{};
|
Common::Vec<f32, 3> gyro{};
|
||||||
Common::Quaternion<f32> quaternion{};
|
Common::Vec<f32, 4> quaternion{};
|
||||||
};
|
};
|
||||||
static_assert(sizeof(SevenSixAxisState) == 0x48, "SevenSixAxisState is an invalid size");
|
static_assert(sizeof(SevenSixAxisState) == 0x48, "SevenSixAxisState is an invalid size");
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
@@ -93,9 +96,9 @@ void SixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
|||||||
.accel = {0, 0, -1.0f},
|
.accel = {0, 0, -1.0f},
|
||||||
.orientation =
|
.orientation =
|
||||||
{
|
{
|
||||||
Common::Vec3f{1.0f, 0, 0},
|
Common::Vec<f32, 3>{1.0f, 0, 0},
|
||||||
Common::Vec3f{0, 1.0f, 0},
|
Common::Vec<f32, 3>{0, 1.0f, 0},
|
||||||
Common::Vec3f{0, 0, 1.0f},
|
Common::Vec<f32, 3>{0, 0, 1.0f},
|
||||||
},
|
},
|
||||||
.attribute = {1},
|
.attribute = {1},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -88,8 +88,8 @@ void Mouse::UpdateStickInput() {
|
|||||||
last_mouse_change *= maximum_stick_range;
|
last_mouse_change *= maximum_stick_range;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetAxis(identifier, mouse_axis_x, last_mouse_change.x);
|
SetAxis(identifier, mouse_axis_x, last_mouse_change[0]);
|
||||||
SetAxis(identifier, mouse_axis_y, -last_mouse_change.y);
|
SetAxis(identifier, mouse_axis_y, -last_mouse_change[1]);
|
||||||
|
|
||||||
// Decay input over time
|
// Decay input over time
|
||||||
const float clamped_length = (std::min)(1.0f, length);
|
const float clamped_length = (std::min)(1.0f, length);
|
||||||
@@ -104,20 +104,20 @@ void Mouse::UpdateMotionInput() {
|
|||||||
const float sensitivity =
|
const float sensitivity =
|
||||||
IsMousePanningEnabled() ? default_motion_panning_sensitivity : default_motion_sensitivity;
|
IsMousePanningEnabled() ? default_motion_panning_sensitivity : default_motion_sensitivity;
|
||||||
|
|
||||||
const float rotation_velocity = std::sqrt(last_motion_change.x * last_motion_change.x +
|
const float rotation_velocity = std::sqrt(last_motion_change[0] * last_motion_change[0] +
|
||||||
last_motion_change.y * last_motion_change.y);
|
last_motion_change[1] * last_motion_change[1]);
|
||||||
|
|
||||||
// Clamp rotation speed
|
// Clamp rotation speed
|
||||||
if (rotation_velocity > maximum_rotation_speed / sensitivity) {
|
if (rotation_velocity > maximum_rotation_speed / sensitivity) {
|
||||||
const float multiplier = maximum_rotation_speed / rotation_velocity / sensitivity;
|
const float multiplier = maximum_rotation_speed / rotation_velocity / sensitivity;
|
||||||
last_motion_change.x = last_motion_change.x * multiplier;
|
last_motion_change[0] = last_motion_change[0] * multiplier;
|
||||||
last_motion_change.y = last_motion_change.y * multiplier;
|
last_motion_change[1] = last_motion_change[1] * multiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
const BasicMotion motion_data{
|
const BasicMotion motion_data{
|
||||||
.gyro_x = last_motion_change.x * sensitivity,
|
.gyro_x = last_motion_change[0] * sensitivity,
|
||||||
.gyro_y = last_motion_change.y * sensitivity,
|
.gyro_y = last_motion_change[1] * sensitivity,
|
||||||
.gyro_z = last_motion_change.z * sensitivity,
|
.gyro_z = last_motion_change[2] * sensitivity,
|
||||||
.accel_x = 0,
|
.accel_x = 0,
|
||||||
.accel_y = 0,
|
.accel_y = 0,
|
||||||
.accel_z = 0,
|
.accel_z = 0,
|
||||||
@@ -125,53 +125,46 @@ void Mouse::UpdateMotionInput() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (IsMousePanningEnabled()) {
|
if (IsMousePanningEnabled()) {
|
||||||
last_motion_change.x = 0;
|
last_motion_change[0] = 0;
|
||||||
last_motion_change.y = 0;
|
last_motion_change[1] = 0;
|
||||||
}
|
}
|
||||||
last_motion_change.z = 0;
|
last_motion_change[2] = 0;
|
||||||
|
|
||||||
SetMotion(motion_identifier, 0, motion_data);
|
SetMotion(motion_identifier, 0, motion_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mouse::Move(int x, int y, int center_x, int center_y) {
|
void Mouse::Move(int x, int y, int center_x, int center_y) {
|
||||||
if (IsMousePanningEnabled()) {
|
if (IsMousePanningEnabled()) {
|
||||||
const auto mouse_change =
|
auto const mouse_change_int = Common::Vec<int, 2>(x, y) - Common::Vec<int, 2>(center_x, center_y);
|
||||||
(Common::MakeVec(x, y) - Common::MakeVec(center_x, center_y)).Cast<float>();
|
auto const mouse_change = Common::Vec<float, 2>(float(mouse_change_int[0]), float(mouse_change_int[1]));
|
||||||
const float x_sensitivity =
|
auto const x_sensitivity = Settings::values.mouse_panning_x_sensitivity.GetValue() * default_panning_sensitivity;
|
||||||
Settings::values.mouse_panning_x_sensitivity.GetValue() * default_panning_sensitivity;
|
auto const y_sensitivity = Settings::values.mouse_panning_y_sensitivity.GetValue() * default_panning_sensitivity;
|
||||||
const float y_sensitivity =
|
auto const deadzone_cw = Settings::values.mouse_panning_deadzone_counterweight.GetValue() * default_deadzone_counterweight;
|
||||||
Settings::values.mouse_panning_y_sensitivity.GetValue() * default_panning_sensitivity;
|
last_motion_change += {-mouse_change[1] * x_sensitivity, -mouse_change[0] * y_sensitivity, 0};
|
||||||
const float deadzone_counterweight =
|
last_mouse_change[0] += mouse_change[0] * x_sensitivity;
|
||||||
Settings::values.mouse_panning_deadzone_counterweight.GetValue() *
|
last_mouse_change[1] += mouse_change[1] * y_sensitivity;
|
||||||
default_deadzone_counterweight;
|
// Bind the mouse change to [0 <= deadzone_cw <= 1.0]
|
||||||
|
|
||||||
last_motion_change += {-mouse_change.y * x_sensitivity, -mouse_change.x * y_sensitivity, 0};
|
|
||||||
last_mouse_change.x += mouse_change.x * x_sensitivity;
|
|
||||||
last_mouse_change.y += mouse_change.y * y_sensitivity;
|
|
||||||
|
|
||||||
// Bind the mouse change to [0 <= deadzone_counterweight <= 1.0]
|
|
||||||
const float length = last_mouse_change.Length();
|
const float length = last_mouse_change.Length();
|
||||||
if (length < deadzone_counterweight && length != 0.0f) {
|
if (length < deadzone_cw && length != 0.0f) {
|
||||||
last_mouse_change /= length;
|
last_mouse_change /= length;
|
||||||
last_mouse_change *= deadzone_counterweight;
|
last_mouse_change *= deadzone_cw;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (button_pressed) {
|
if (button_pressed) {
|
||||||
const auto mouse_move = Common::MakeVec<int>(x, y) - mouse_origin;
|
const auto mouse_move = Common::Vec<int, 2>(x, y) - mouse_origin;
|
||||||
const float x_sensitivity =
|
const float x_sensitivity =
|
||||||
Settings::values.mouse_panning_x_sensitivity.GetValue() * default_stick_sensitivity;
|
Settings::values.mouse_panning_x_sensitivity.GetValue() * default_stick_sensitivity;
|
||||||
const float y_sensitivity =
|
const float y_sensitivity =
|
||||||
Settings::values.mouse_panning_y_sensitivity.GetValue() * default_stick_sensitivity;
|
Settings::values.mouse_panning_y_sensitivity.GetValue() * default_stick_sensitivity;
|
||||||
SetAxis(identifier, mouse_axis_x, static_cast<float>(mouse_move.x) * x_sensitivity);
|
SetAxis(identifier, mouse_axis_x, float(mouse_move[0]) * x_sensitivity);
|
||||||
SetAxis(identifier, mouse_axis_y, static_cast<float>(-mouse_move.y) * y_sensitivity);
|
SetAxis(identifier, mouse_axis_y, float(-mouse_move[1]) * y_sensitivity);
|
||||||
|
|
||||||
last_motion_change = {
|
last_motion_change = {
|
||||||
static_cast<float>(-mouse_move.y) * x_sensitivity,
|
float(-mouse_move[1]) * x_sensitivity,
|
||||||
static_cast<float>(-mouse_move.x) * y_sensitivity,
|
float(-mouse_move[0]) * y_sensitivity,
|
||||||
last_motion_change.z,
|
last_motion_change[2],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -220,18 +213,18 @@ void Mouse::ReleaseButton(MouseButton button) {
|
|||||||
SetAxis(identifier, mouse_axis_y, 0);
|
SetAxis(identifier, mouse_axis_y, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
last_motion_change.x = 0;
|
last_motion_change[0] = 0;
|
||||||
last_motion_change.y = 0;
|
last_motion_change[1] = 0;
|
||||||
|
|
||||||
button_pressed = false;
|
button_pressed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mouse::MouseWheelChange(int x, int y) {
|
void Mouse::MouseWheelChange(int x, int y) {
|
||||||
wheel_position.x += x;
|
wheel_position[0] += x;
|
||||||
wheel_position.y += y;
|
wheel_position[1] += y;
|
||||||
last_motion_change.z += static_cast<f32>(y);
|
last_motion_change[2] += static_cast<f32>(y);
|
||||||
SetAxis(identifier, wheel_axis_x, static_cast<f32>(wheel_position.x));
|
SetAxis(identifier, wheel_axis_x, static_cast<f32>(wheel_position[0]));
|
||||||
SetAxis(identifier, wheel_axis_y, static_cast<f32>(wheel_position.y));
|
SetAxis(identifier, wheel_axis_y, static_cast<f32>(wheel_position[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mouse::ReleaseAllButtons() {
|
void Mouse::ReleaseAllButtons() {
|
||||||
|
|||||||
@@ -107,11 +107,11 @@ private:
|
|||||||
|
|
||||||
Common::Input::ButtonNames GetUIButtonName(const Common::ParamPackage& params) const;
|
Common::Input::ButtonNames GetUIButtonName(const Common::ParamPackage& params) const;
|
||||||
|
|
||||||
Common::Vec2<int> mouse_origin;
|
Common::Vec<int, 2> mouse_origin;
|
||||||
Common::Vec2<int> last_mouse_position;
|
Common::Vec<int, 2> last_mouse_position;
|
||||||
Common::Vec2<float> last_mouse_change;
|
Common::Vec<float, 2> last_mouse_change;
|
||||||
Common::Vec3<float> last_motion_change;
|
Common::Vec<float, 3> last_motion_change;
|
||||||
Common::Vec2<int> wheel_position;
|
Common::Vec<int, 2> wheel_position;
|
||||||
bool button_pressed = false;
|
bool button_pressed = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2936,10 +2936,10 @@ void PlayerControlPreview::DrawArrow(QPainter& p, const QPointF center, const Di
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw motion functions
|
// Draw motion functions
|
||||||
void PlayerControlPreview::Draw3dCube(QPainter& p, QPointF center, const Common::Vec3f& euler,
|
void PlayerControlPreview::Draw3dCube(QPainter& p, QPointF center, const Common::Vec<f32, 3>& euler,
|
||||||
float size) {
|
float size) {
|
||||||
std::array<Common::Vec3f, 8> cube{
|
std::array<Common::Vec<f32, 3>, 8> cube{
|
||||||
Common::Vec3f{-0.7f, -1, -0.5f},
|
Common::Vec<f32, 3>{-0.7f, -1, -0.5f},
|
||||||
{-0.7f, 1, -0.5f},
|
{-0.7f, 1, -0.5f},
|
||||||
{0.7f, 1, -0.5f},
|
{0.7f, 1, -0.5f},
|
||||||
{0.7f, -1, -0.5f},
|
{0.7f, -1, -0.5f},
|
||||||
@@ -2949,30 +2949,38 @@ void PlayerControlPreview::Draw3dCube(QPainter& p, QPointF center, const Common:
|
|||||||
{0.7f, -1, 0.5f},
|
{0.7f, -1, 0.5f},
|
||||||
};
|
};
|
||||||
|
|
||||||
for (Common::Vec3f& point : cube) {
|
for (Common::Vec<f32, 3>& point : cube) {
|
||||||
point.RotateFromOrigin(euler.x, euler.y, euler.z);
|
float temp = point[1];
|
||||||
|
point[1] = std::cos(euler[0]) * point[1] - std::sin(euler[0]) * point[2];
|
||||||
|
point[2] = std::sin(euler[0]) * temp + std::cos(euler[0]) * point[2];
|
||||||
|
temp = point[0];
|
||||||
|
point[0] = std::cos(euler[1]) * point[0] + std::sin(euler[1]) * point[2];
|
||||||
|
point[2] = -std::sin(euler[1]) * temp + std::cos(euler[1]) * point[2];
|
||||||
|
temp = point[0];
|
||||||
|
point[0] = std::cos(euler[2]) * point[0] - std::sin(euler[2]) * point[1];
|
||||||
|
point[1] = std::sin(euler[2]) * temp + std::cos(euler[2]) * point[1];
|
||||||
point *= size;
|
point *= size;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::array<QPointF, 4> front_face{
|
const std::array<QPointF, 4> front_face{
|
||||||
center + QPointF{cube[0].x, cube[0].y},
|
center + QPointF{cube[0][0], cube[0][1]},
|
||||||
center + QPointF{cube[1].x, cube[1].y},
|
center + QPointF{cube[1][0], cube[1][1]},
|
||||||
center + QPointF{cube[2].x, cube[2].y},
|
center + QPointF{cube[2][0], cube[2][1]},
|
||||||
center + QPointF{cube[3].x, cube[3].y},
|
center + QPointF{cube[3][0], cube[3][1]},
|
||||||
};
|
};
|
||||||
const std::array<QPointF, 4> back_face{
|
const std::array<QPointF, 4> back_face{
|
||||||
center + QPointF{cube[4].x, cube[4].y},
|
center + QPointF{cube[4][0], cube[4][1]},
|
||||||
center + QPointF{cube[5].x, cube[5].y},
|
center + QPointF{cube[5][0], cube[5][1]},
|
||||||
center + QPointF{cube[6].x, cube[6].y},
|
center + QPointF{cube[6][0], cube[6][1]},
|
||||||
center + QPointF{cube[7].x, cube[7].y},
|
center + QPointF{cube[7][0], cube[7][1]},
|
||||||
};
|
};
|
||||||
|
|
||||||
DrawPolygon(p, front_face);
|
DrawPolygon(p, front_face);
|
||||||
DrawPolygon(p, back_face);
|
DrawPolygon(p, back_face);
|
||||||
p.drawLine(center + QPointF{cube[0].x, cube[0].y}, center + QPointF{cube[4].x, cube[4].y});
|
p.drawLine(center + QPointF{cube[0][0], cube[0][1]}, center + QPointF{cube[4][0], cube[4][1]});
|
||||||
p.drawLine(center + QPointF{cube[1].x, cube[1].y}, center + QPointF{cube[5].x, cube[5].y});
|
p.drawLine(center + QPointF{cube[1][0], cube[1][1]}, center + QPointF{cube[5][0], cube[5][1]});
|
||||||
p.drawLine(center + QPointF{cube[2].x, cube[2].y}, center + QPointF{cube[6].x, cube[6].y});
|
p.drawLine(center + QPointF{cube[2][0], cube[2][1]}, center + QPointF{cube[6][0], cube[6][1]});
|
||||||
p.drawLine(center + QPointF{cube[3].x, cube[3].y}, center + QPointF{cube[7].x, cube[7].y});
|
p.drawLine(center + QPointF{cube[3][0], cube[3][1]}, center + QPointF{cube[7][0], cube[7][1]});
|
||||||
}
|
}
|
||||||
|
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
||||||
@@ -198,7 +198,7 @@ private:
|
|||||||
void DrawArrow(QPainter& p, QPointF center, Direction direction, float size);
|
void DrawArrow(QPainter& p, QPointF center, Direction direction, float size);
|
||||||
|
|
||||||
// Draw motion functions
|
// Draw motion functions
|
||||||
void Draw3dCube(QPainter& p, QPointF center, const Common::Vec3f& euler, float size);
|
void Draw3dCube(QPainter& p, QPointF center, const Common::Vec<f32, 3>& euler, float size);
|
||||||
|
|
||||||
// Draw primitive types
|
// Draw primitive types
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
|
|||||||
+3
-2
@@ -9,7 +9,7 @@ Tools for Eden and other subprojects. When adding new scripts please use `#!/bin
|
|||||||
## Binaries
|
## Binaries
|
||||||
|
|
||||||
- `maxwell-spirv`: Converts Maxwell shaders (dumped from `.ash` files) into SPIR-V code (emitted into STDOUT).
|
- `maxwell-spirv`: Converts Maxwell shaders (dumped from `.ash` files) into SPIR-V code (emitted into STDOUT).
|
||||||
- `maxwell-disas`: Dumb raw Maxwell dissasembler.
|
- `maxwell-disas`: Dumb raw Maxwell disassembler.
|
||||||
- `maxwell-ir`: Dump generated IR of Maxwell shaders.
|
- `maxwell-ir`: Dump generated IR of Maxwell shaders.
|
||||||
|
|
||||||
## Scripts
|
## Scripts
|
||||||
@@ -32,7 +32,8 @@ Tools for Eden and other subprojects. When adding new scripts please use `#!/bin
|
|||||||
- `fuzzsettings.cpp`: Fuzz settings files.
|
- `fuzzsettings.cpp`: Fuzz settings files.
|
||||||
|
|
||||||
## Android
|
## Android
|
||||||
It's recommended to run these scritps after almost any Android change, as they are relatively fast and important both for APK bloat and CI.
|
|
||||||
|
It's recommended to run these scripts after almost any Android change, as they are relatively fast and important both for APK bloat and CI.
|
||||||
|
|
||||||
- `unused-strings.sh`: Finds unused strings in `strings.xml` files.
|
- `unused-strings.sh`: Finds unused strings in `strings.xml` files.
|
||||||
- `stale-translations.sh`: Finds translated strings that aren't present in the source `strings.xml` file.
|
- `stale-translations.sh`: Finds translated strings that aren't present in the source `strings.xml` file.
|
||||||
|
|||||||
Reference in New Issue
Block a user