Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c754d3b821 | |||
| 269f6ead31 | |||
| be972d7fdc | |||
| 972860ac8f | |||
| 3d3ed4b7d1 | |||
| be21ccce25 | |||
| db83070bf2 | |||
| e903d70d9e | |||
| 802531c457 | |||
| bd071e3464 | |||
| a845100bf0 | |||
| 943f1fc760 | |||
| 072da77516 | |||
| 035f4611cb | |||
| ea92c081b7 | |||
| 69665063a9 | |||
| b4d5760014 | |||
| 0731f40f4d | |||
| 3e6a5566cf | |||
| d89e02d3ac | |||
| a2aa4d97e1 | |||
| 26a03d2473 | |||
| b7c1ded159 | |||
| cbd4cf2d8c | |||
| a3debcf731 | |||
| 5239cbe2a7 | |||
| 0e11fe8b5e | |||
| 0689f73147 | |||
| a95efaf18f | |||
| 58968bd127 | |||
| 05f36d990c | |||
| eb88a40a8e |
@@ -0,0 +1,2 @@
|
|||||||
|
liberapay: crueter
|
||||||
|
custom: 'https://www.paypal.biz/edenemulator'
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
- [ ] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions).
|
- [ ] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions).
|
||||||
- [ ] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md).
|
|
||||||
- [ ] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability.
|
- [ ] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability.
|
||||||
|
- [ ] I have read and followed the [website policy](https://git.eden-emu.dev/eden-emu/site-policy).
|
||||||
|
- [ ] I affirm that the content of this pull request body was written and submitted entirely by me, in my own words, and not by an AI agent or LLM.
|
||||||
|
- [ ] I affirm that I did not read any of this, and understand that my pull request will be closed if I check this box.
|
||||||
|
- [ ] I affirm that, by submitting this pull request, I am responsible for all of the changes contained within these commits.
|
||||||
|
|
||||||
-------------------
|
-------------------
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
# Build directory
|
# Build directory
|
||||||
/[Bb]uild*/
|
/[Bb]uild*/
|
||||||
doc-build/
|
doc-build/
|
||||||
|
out/
|
||||||
AppDir/
|
AppDir/
|
||||||
uruntime
|
uruntime
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
diff --git a/cmake/ConfigureOpenSSL.cmake b/cmake/ConfigureOpenSSL.cmake
|
||||||
|
index 3012e05..2ae23ff 100644
|
||||||
|
--- a/cmake/ConfigureOpenSSL.cmake
|
||||||
|
+++ b/cmake/ConfigureOpenSSL.cmake
|
||||||
|
@@ -108,7 +108,8 @@ function(configure_openssl)
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT "${CONFIGURE_OPTIONS_OLD}" STREQUAL "")
|
||||||
|
- if(CONFIGURE_OPTIONS STREQUAL CONFIGURE_OPTIONS_OLD)
|
||||||
|
+ # TODO(lizzie): Emscripten has issues with rebuilding due to the wrapper it uses
|
||||||
|
+ if(CMAKE_SYSTEM_NAME MATCHES "Emscripten" OR CONFIGURE_OPTIONS STREQUAL CONFIGURE_OPTIONS_OLD)
|
||||||
|
message(STATUS "Found previous configure results. Don't perform configuration")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
@@ -134,10 +135,24 @@ function(configure_openssl)
|
||||||
|
set(VERBOSE_OPTION OUTPUT_QUIET)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
+ if (CMAKE_SYSTEM_NAME MATCHES "Emscripten")
|
||||||
|
+ set(EMSCRIPTEN_CMAKE_WRAPPER "emcmake")
|
||||||
|
+ find_program(EMCC emcc REQUIRED)
|
||||||
|
+ set(EMSCRIPTEN_LINKER ${EMCC})
|
||||||
|
+ list(APPEND CONFIGURE_COMMAND wasm64)
|
||||||
|
+ else()
|
||||||
|
+ set(EMSCRIPTEN_CMAKE_WRAPPER "")
|
||||||
|
+ set(EMSCRIPTEN_LINKER ${CMAKE_LINKER})
|
||||||
|
+ endif ()
|
||||||
|
+
|
||||||
|
execute_process(
|
||||||
|
- COMMAND ${CMAKE_COMMAND} -E env
|
||||||
|
+ COMMAND ${EMSCRIPTEN_CMAKE_WRAPPER} ${CMAKE_COMMAND} -E env
|
||||||
|
"CFLAGS=${CMAKE_C_FLAGS}"
|
||||||
|
"CXXFLAGS=${CMAKE_CXX_FLAGS}"
|
||||||
|
+ "LDFLAGS=${CMAKE_CXX_LINK_FLAGS}"
|
||||||
|
+ "CC=${CMAKE_C_COMPILER}"
|
||||||
|
+ "CXX=${CMAKE_CXX_COMPILER}"
|
||||||
|
+ "LD=${EMSCRIPTEN_LINKER}"
|
||||||
|
${CONFIGURE_COMMAND}
|
||||||
|
WORKING_DIRECTORY ${CONFIGURE_BUILD_DIR}
|
||||||
|
${VERBOSE_OPTION}
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
# AGENTS
|
# AGENTS
|
||||||
|
|
||||||
Read and follow the AI policy found in `docs/policies/AI.md`, and the coding policies found in `docs/policies/Coding.md`.
|
Read and follow the [contribution guidelines](./CONTRIBUTING.md) and our [site policy](https://git.eden-emu.dev/eden-emu/site-policy/src/branch/master)..
|
||||||
|
|
||||||
Do not, under any circumstances, ever submit PRs or push commits on behalf of the user.
|
Do not, under any circumstances, ever:
|
||||||
|
|
||||||
|
- Submit PRs, push commits, or request any API calls on behalf of the user.
|
||||||
|
- Write commit messages, PR descriptions, or issues on behalf of the user.
|
||||||
|
|
||||||
Keep comments to a reasonable level. Do not overexplain or add/remove comments from unrelated parts of the codebase.
|
Keep comments to a reasonable level. Do not overexplain or add/remove comments from unrelated parts of the codebase.
|
||||||
|
|||||||
@@ -16,17 +16,38 @@ Eden is free, open-source, copyleft software, licensed under the terms of the [G
|
|||||||
|
|
||||||
### Policies
|
### Policies
|
||||||
|
|
||||||
- We are trialing a slightly relaxed AI policy to allow high-quality contributors to use AI *responsibly*. Please read our [detailed AI policy](docs/policies/AI.md) for more info.
|
- AI usage is allowed, but we reserve the right to close and rework your PR if you don't fully understand the changes you're making. Additionally:
|
||||||
- Usage of any form of profanity or otherwise unsavory language is generally discouraged.
|
- As a common courtesy, please disclose your AI usage under the PR description, as `Assisted-by: <AI model> (<how it helped>)`.
|
||||||
- This is primarily because it rarely helps to actually understand what's going on.
|
- All PR descriptions, issue bodies, and comments **must** be written by you, in your own words.
|
||||||
- Remember that your comments should be focused and actually address what's happening. With very few exceptions, expletives are actively detrimental at best.
|
- AI-written comments/descriptions/bodies are not only difficult for us to read, they also indicate to us that you did not put in the effort to actually understand your changes. These will be closed, deleted, or hidden without warning.
|
||||||
- New code must follow the same general style as the surrounding codebase. Exceptions may be granted in certain cases.
|
- Spamming of low-effort AI-generated pull requests or issues is considered a [Human Effort Denial of Service](https://tiangolo.com/open-source/contributing/#human-effort-denial-of-service), and will result in the immediate suspension of your Forgejo account, or you getting blocked from the organization on other platforms.
|
||||||
|
- Usage of any form of profanity or otherwise unsavory language is discouraged but not strictly disallowed.
|
||||||
|
- New code must follow the same style as the surrounding codebase. Exceptions may be granted in certain cases.
|
||||||
- Maintainers reserve the right to change your patches and pull requests at will. We will try to avoid this.
|
- Maintainers reserve the right to change your patches and pull requests at will. We will try to avoid this.
|
||||||
- You should generally respect all decisions made by the [code owners](docs/CODEOWNERS) in your particular subsystem.
|
- You should generally respect all decisions made by the [code owners](docs/CODEOWNERS) in your particular subsystem.
|
||||||
- However, if you feel they are overstepping or are incorrect, don't be afraid to stand your ground! Maintainers are not always correct.
|
- However, if you feel they are overstepping or are incorrect, don't be afraid to stand your ground! Maintainers are not always correct.
|
||||||
- While we do *not* adhere to the terms of a formal code of conduct, you will generally be expected to respect other developers, contributors, and community members.
|
- While we do *not* adhere to the terms of a formal code of conduct, you are expected to treat other developers, contributors, and community members respectfully.
|
||||||
- You **must** have basic knowledge of [Git](https://git-scm.com/learn). Knowing how to manage your branches and follow proper fork policies is a necessity.
|
- You **must** have basic knowledge of [Git](https://git-scm.com/learn). Knowing how to manage your branches and follow proper fork policies is a necessity.
|
||||||
|
|
||||||
|
### Pull Requests
|
||||||
|
|
||||||
|
Pull requests are only to be merged by core developers when properly tested and discussions conclude on Discord or other communication channels. Labels are recommended but not required. However, all PRs MUST be namespaced and optionally typed:
|
||||||
|
|
||||||
|
```txt
|
||||||
|
[cmake] refactor: CPM over submodules
|
||||||
|
[desktop] feat: implement firmware install from ZIP
|
||||||
|
[hle] stub fw20 functions
|
||||||
|
[core] test: raise maximum CPU cores to 6
|
||||||
|
[cmake, core] Unbreak FreeBSD Building Process
|
||||||
|
```
|
||||||
|
|
||||||
|
- The level of namespacing is generally left to the committer's choice.
|
||||||
|
- However, we never recommend going more than two levels *except* in `hle`, in which case you may go as many as four levels depending on the specificity of your changes.
|
||||||
|
- Ocassionally, up to two additional namespaces may be provided for more clarity.
|
||||||
|
- Changes that affect the entire project (sans CMake changes) should be namespaced as `meta`.
|
||||||
|
- Maintainers are permitted to change namespaces at will.
|
||||||
|
- Commits within PRs are not required to be namespaced, but it is highly recommended.
|
||||||
|
|
||||||
### Where do I start?
|
### Where do I start?
|
||||||
|
|
||||||
Anywhere you like! If you are facing an issue and want to fix it, go ahead. For new features, you are heavily encouraged to open a feature request on GitHub, Codeberg, or Forgejo first, discussing the motivations, potential implementation, and user flow of your desired feature. Our UI/UX designers will work with you to refine your feature before you actually choose to implement it.
|
Anywhere you like! If you are facing an issue and want to fix it, go ahead. For new features, you are heavily encouraged to open a feature request on GitHub, Codeberg, or Forgejo first, discussing the motivations, potential implementation, and user flow of your desired feature. Our UI/UX designers will work with you to refine your feature before you actually choose to implement it.
|
||||||
@@ -38,7 +59,10 @@ You may also search for open issues on [GitHub](https://github.com/eden-emulator
|
|||||||
There are five primary ways to contribute.
|
There are five primary ways to contribute.
|
||||||
|
|
||||||
- Submit pull requests directly to our source tree
|
- Submit pull requests directly to our source tree
|
||||||
- You must first request an account on our Forgejo. See [Signup](#how-do-i-sign-up)
|
- You must first [create an account](https://git.eden-emu.dev/user/sign_up).
|
||||||
|
- You may use an internal account, or you may use a GitHub/Codeberg account linked to our instance.
|
||||||
|
- Please make sure to read our [site policy](https://git.eden-emu.dev/eden-emu/site-policy/src/branch/master).
|
||||||
|
- Both your account and your associated fork must be public, *not* limited/private, otherwise our CI workflow will not work on your pull requests.
|
||||||
- Submit pull requests to our [GitHub mirror](https://github.com/eden-emulator/Issue-Reports)
|
- Submit pull requests to our [GitHub mirror](https://github.com/eden-emulator/Issue-Reports)
|
||||||
- Note that this is subject to being removed by DMCA, so don't rely on this.
|
- Note that this is subject to being removed by DMCA, so don't rely on this.
|
||||||
- Submit pull requests to our [Codeberg mirror](https://codeberg.org/eden-emu/eden)
|
- Submit pull requests to our [Codeberg mirror](https://codeberg.org/eden-emu/eden)
|
||||||
@@ -48,33 +72,10 @@ There are five primary ways to contribute.
|
|||||||
- Alongside the contents of your email, please attach the patch/diff file itself for easy access and use.
|
- Alongside the contents of your email, please attach the patch/diff file itself for easy access and use.
|
||||||
- Email our developers at [`developers@eden-emu.dev`](mailto:developers@eden-emu.dev) with any of your relevant findings or code changes.
|
- Email our developers at [`developers@eden-emu.dev`](mailto:developers@eden-emu.dev) with any of your relevant findings or code changes.
|
||||||
|
|
||||||
To test your changes, ensure to read the [build documentation](./docs/Build.md) for your specific platform(s) to ensure everything compiles and works properly. You should also make sure that your branch is up-to-date with the upstream `master` branch before opening a pull request.
|
To test your changes, ensure to read the [build documentation](./docs/Build.md) for your specific platform(s) to ensure everything compiles and works properly. You should also make sure that your branch is up-to-date with the upstream `master` branch before opening a pull request. **You** are responsible for ensuring that your contribution does what it says and doesn't break everything else horribly.
|
||||||
|
|
||||||
### How do I sign up?
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>To sign up and begin contributing... (click to open)</summary>
|
|
||||||
|
|
||||||
Email [crueter@crueter.xyz](mailto:crueter@crueter.xyz) with the following format:
|
|
||||||
|
|
||||||
```txt
|
|
||||||
Subject: [Eden Git] Registration Request
|
|
||||||
Username: <Your Desired Username>
|
|
||||||
Email: <Your Desired Email>
|
|
||||||
I wish to sign up because... <your reason here>
|
|
||||||
```
|
|
||||||
|
|
||||||
Received mail that does not follow this format will be ignored.
|
|
||||||
|
|
||||||
Once your request is processed, you will receive a confirmation email with your temporary password and some information on Git access and policies. If you do not receive a response within 48 hours, feel free to send another email.
|
|
||||||
|
|
||||||
> [!WARNING]
|
|
||||||
> Some email providers may place the response email in your spam/junk folder; notable offenders include Gmail and Outlook. *Always* ensure to check your Spam or Junk folder.
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
## Non-code Contributions
|
## Non-code Contributions
|
||||||
|
|
||||||
Alongside the other contribution methods listed up top, you can also choose to contribute through documentation, organization, or community guides. These can be done either through the code contribution methods described above, or created externally and shared via our Discord community.
|
Alongside the other contribution methods listed up top, you can also choose to contribute through documentation, organization, or community guides. These can be done either through the code contribution methods described above, or created externally and shared via our Discord community.
|
||||||
|
|
||||||
If you have an external tool/page that you believe would be handy to integrate/link into Eden, please additionally email our developers at [`developers@eden-emu.dev`](mailto:developers@eden-emu.dev). **Do not submit vibe-coded or AI generated tools or applications**.
|
If you have an external tool/page that you believe would be handy to integrate/link into Eden, please additionally email our developers at [`developers@eden-emu.dev`](mailto:developers@eden-emu.dev).
|
||||||
|
|||||||
@@ -202,7 +202,8 @@
|
|||||||
"0001-cpmutil-compat.patch",
|
"0001-cpmutil-compat.patch",
|
||||||
"0002-use-ccache.patch",
|
"0002-use-ccache.patch",
|
||||||
"0003-use-cmake-compiler-flags.patch",
|
"0003-use-cmake-compiler-flags.patch",
|
||||||
"0004-use-shell-wrapper.patch"
|
"0004-use-shell-wrapper.patch",
|
||||||
|
"0005-cross-compile.patch"
|
||||||
],
|
],
|
||||||
"repo": "jimmy-park/openssl-cmake",
|
"repo": "jimmy-park/openssl-cmake",
|
||||||
"version": "3.6.2"
|
"version": "3.6.2"
|
||||||
@@ -351,13 +352,13 @@
|
|||||||
},
|
},
|
||||||
"zstd": {
|
"zstd": {
|
||||||
"find_args": "MODULE",
|
"find_args": "MODULE",
|
||||||
"hash": "cc5ad4b119a9c2ea57f0b71eeff01113bb506e0d17000159c5409cb8236d22e38c52d5e9e97e7947a4bf1b2dfc44b6c503ab2d9aedbd59458435c6a2849cb029",
|
"hash": "2b006c3c110c38bd2f5896b42d36a38931c8eae261f30552f9a9fd04458d218d8f1a1425f117fd12af545ed77042e4b2d1a1a9b6286c4d0b9d74ef79f20a8f08",
|
||||||
"min_version": "1.5",
|
"min_version": "1.5",
|
||||||
"options": [
|
"options": [
|
||||||
"ZSTD_BUILD_SHARED OFF"
|
"ZSTD_BUILD_SHARED OFF"
|
||||||
],
|
],
|
||||||
"repo": "facebook/zstd",
|
"repo": "facebook/zstd",
|
||||||
"source_subdir": "build/cmake",
|
"source_subdir": "build/cmake",
|
||||||
"version": "b8d6101fba"
|
"version": "33618c8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 5.6 KiB |
@@ -1,144 +1 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" fill="none" viewBox="0 0 512 512"><defs><linearGradient id="c"><stop offset="0" style="stop-color:#f71baa;stop-opacity:.56623769"/><stop offset="1" style="stop-color:#fa87d4;stop-opacity:.25"/></linearGradient><linearGradient id="b"><stop offset="0" style="stop-color:#fe00b1;stop-opacity:1"/><stop offset="1" style="stop-color:#fe00b1;stop-opacity:0"/></linearGradient><linearGradient id="a"><stop offset="0" style="stop-color:#ff0950;stop-opacity:.5"/><stop offset=".496" style="stop-color:#bf42f6;stop-opacity:.75"/><stop offset="1" style="stop-color:#5da5ed;stop-opacity:1"/></linearGradient><linearGradient xlink:href="#a" id="d" x1="270.4" x2="270.4" y1="40" y2="494.4" gradientTransform="translate(-33.928 -34.199)scale(1.07505)" gradientUnits="userSpaceOnUse" spreadMethod="reflect"/><linearGradient xlink:href="#b" id="f" x1="125.402" x2="431.024" y1="271.834" y2="271.834" gradientTransform="translate(-33.928 -34.199)scale(1.07505)" gradientUnits="userSpaceOnUse"/><linearGradient xlink:href="#c" id="e" x1="270.4" x2="270.4" y1="33.584" y2="500.816" gradientTransform="translate(-33.928 -34.199)scale(1.07505)" gradientUnits="userSpaceOnUse"/></defs><circle cx="256.764" cy="253.054" r="244.25" style="fill:url(#d);fill-opacity:1;stroke:url(#e);stroke-width:13.7948;stroke-opacity:.566238;paint-order:stroke fill markers"/><path d="M55.701 114.372a244 244 0 0 0-10.836 17.2h423.797a244 244 0 0 0-10.837-17.2z" style="fill:#fff;fill-opacity:.5;stroke:none;stroke-width:17.2007;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"/><path d="m219.665 499.138-10.338-55.949" style="fill:#ff2bd5;fill-opacity:1;stroke-width:14.3776;stroke-opacity:.415999;paint-order:stroke fill markers"/><path d="M58.272 395.39a244 244 0 0 0 13.54 17.2h369.902a244 244 0 0 0 13.541-17.2zM24.605 328.953a244 244 0 0 0 6.347 17.2h451.623a244 244 0 0 0 6.347-17.2zM12.586 259.075a244 244 0 0 0 1.033 17.2h486.289a244 244 0 0 0 1.033-17.2z" style="fill:#fff;fill-opacity:.5;stroke:none;stroke-width:17.2007;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"/><path d="M306.217 12.242s-11.75 42.031-17.703 63.363c-12.713 9.965-21.075 19.29-21.075 19.29s-22.956-32.534-44.85-46.065c-21.892-13.531-51.398-11.788-51.398-11.788s-12.257 0-27.092 5.806c-14.836 5.805-20.857 9.675-20.857 9.675s15.053-.43 37.199 7.095 31.82 12.042 31.82 12.042l30.423-6.881-8.277 11.611s14.514 9.353 22.362 17.739c7.848 8.385 11.502 13.114 11.502 13.114s-13.652-5.697-55.579-1.826-83.209 59.127-83.209 59.127 40.42-16.771 64.287-22.362c23.866-5.59 46.657-8.386 46.657-8.386s-18.06 7.74-37.41 40.207c-19.351 32.467-13.762 84.07-13.762 84.07s30.747-61.923 60.203-82.778 35.476-21.501 35.476-21.501-23.65 50.742-32.896 132.23c-9.245 81.489 29.671 217.804 29.671 217.804l46.872-7.311s-44.721-44.291-48.591-158.676 16.34-182.758 16.34-182.758 16.771 1.29 41.712 34.401 39.56 60.203 39.56 60.203 9.463-53.753-11.178-78.264-52.463-35.26-52.463-35.26 13.438-6.988 41.282-4.945c27.844 2.042 85.6 28.444 85.6 28.444S405.336 132.903 369 114.355s-79.77.307-79.77.307 4.055-16.119 28.533-34.21C342.24 62.358 373.56 44.42 373.56 44.42s-25.845 1.217-54.124 12.62c-7.036 2.837-13.79 6.605-19.966 10.666l17.067-53.528z" style="fill:url(#f);fill-opacity:1;stroke:#fff;stroke-width:17.2007;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers"/></svg>
|
||||||
<svg
|
|
||||||
width="512"
|
|
||||||
height="512"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 512 512"
|
|
||||||
version="1.1"
|
|
||||||
id="svg7"
|
|
||||||
sodipodi:docname="base.svg"
|
|
||||||
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
|
|
||||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
||||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
xmlns:svg="http://www.w3.org/2000/svg">
|
|
||||||
<defs
|
|
||||||
id="defs7">
|
|
||||||
<linearGradient
|
|
||||||
id="linearGradient24"
|
|
||||||
inkscape:collect="always">
|
|
||||||
<stop
|
|
||||||
style="stop-color:#f71baa;stop-opacity:0.56623769;"
|
|
||||||
offset="0"
|
|
||||||
id="stop24" />
|
|
||||||
<stop
|
|
||||||
style="stop-color:#fa87d4;stop-opacity:0.25;"
|
|
||||||
offset="1"
|
|
||||||
id="stop25" />
|
|
||||||
</linearGradient>
|
|
||||||
<rect
|
|
||||||
x="22.627417"
|
|
||||||
y="402.76802"
|
|
||||||
width="521.34025"
|
|
||||||
height="248.94868"
|
|
||||||
id="rect24" />
|
|
||||||
<linearGradient
|
|
||||||
id="linearGradient1"
|
|
||||||
inkscape:collect="always">
|
|
||||||
<stop
|
|
||||||
style="stop-color:#fe00b1;stop-opacity:1;"
|
|
||||||
offset="0"
|
|
||||||
id="stop1" />
|
|
||||||
<stop
|
|
||||||
style="stop-color:#fe00b1;stop-opacity:0;"
|
|
||||||
offset="1"
|
|
||||||
id="stop2" />
|
|
||||||
</linearGradient>
|
|
||||||
<linearGradient
|
|
||||||
id="linearGradient11"
|
|
||||||
inkscape:collect="always">
|
|
||||||
<stop
|
|
||||||
style="stop-color:#ff0950;stop-opacity:0.5;"
|
|
||||||
offset="0"
|
|
||||||
id="stop11" />
|
|
||||||
<stop
|
|
||||||
style="stop-color:#bf42f6;stop-opacity:0.75;"
|
|
||||||
offset="0.49556771"
|
|
||||||
id="stop20" />
|
|
||||||
<stop
|
|
||||||
style="stop-color:#5da5ed;stop-opacity:1;"
|
|
||||||
offset="1"
|
|
||||||
id="stop12" />
|
|
||||||
</linearGradient>
|
|
||||||
<linearGradient
|
|
||||||
inkscape:collect="always"
|
|
||||||
xlink:href="#linearGradient11"
|
|
||||||
id="linearGradient12"
|
|
||||||
x1="270.39996"
|
|
||||||
y1="39.999989"
|
|
||||||
x2="270.39996"
|
|
||||||
y2="494.39996"
|
|
||||||
gradientUnits="userSpaceOnUse"
|
|
||||||
spreadMethod="reflect"
|
|
||||||
gradientTransform="matrix(1.075046,0,0,1.075046,-33.928383,-34.198735)" />
|
|
||||||
<linearGradient
|
|
||||||
inkscape:collect="always"
|
|
||||||
xlink:href="#linearGradient1"
|
|
||||||
id="linearGradient2"
|
|
||||||
x1="125.40197"
|
|
||||||
y1="271.834"
|
|
||||||
x2="431.02424"
|
|
||||||
y2="271.834"
|
|
||||||
gradientUnits="userSpaceOnUse"
|
|
||||||
gradientTransform="matrix(1.075046,0,0,1.075046,-33.928383,-34.198735)" />
|
|
||||||
<linearGradient
|
|
||||||
inkscape:collect="always"
|
|
||||||
xlink:href="#linearGradient24"
|
|
||||||
id="linearGradient25"
|
|
||||||
x1="270.39996"
|
|
||||||
y1="33.58408"
|
|
||||||
x2="270.39996"
|
|
||||||
y2="500.81589"
|
|
||||||
gradientUnits="userSpaceOnUse"
|
|
||||||
gradientTransform="matrix(1.075046,0,0,1.075046,-33.928383,-34.198735)" />
|
|
||||||
</defs>
|
|
||||||
<sodipodi:namedview
|
|
||||||
id="namedview7"
|
|
||||||
pagecolor="#ffffff"
|
|
||||||
bordercolor="#000000"
|
|
||||||
borderopacity="0.25"
|
|
||||||
inkscape:showpageshadow="2"
|
|
||||||
inkscape:pageopacity="0.0"
|
|
||||||
inkscape:pagecheckerboard="0"
|
|
||||||
inkscape:deskcolor="#d1d1d1"
|
|
||||||
inkscape:zoom="0.88388348"
|
|
||||||
inkscape:cx="141.98704"
|
|
||||||
inkscape:cy="265.87215"
|
|
||||||
inkscape:window-width="1600"
|
|
||||||
inkscape:window-height="849"
|
|
||||||
inkscape:window-x="0"
|
|
||||||
inkscape:window-y="27"
|
|
||||||
inkscape:window-maximized="1"
|
|
||||||
inkscape:current-layer="svg7" />
|
|
||||||
<circle
|
|
||||||
style="fill:url(#linearGradient12);fill-opacity:1;stroke:url(#linearGradient25);stroke-width:13.7948;stroke-opacity:0.566238;paint-order:stroke fill markers"
|
|
||||||
id="path8"
|
|
||||||
cx="256.76401"
|
|
||||||
cy="253.05354"
|
|
||||||
r="244.25046" />
|
|
||||||
<path
|
|
||||||
id="rect1-3"
|
|
||||||
style="fill:#ffffff;fill-opacity:0.5;stroke:none;stroke-width:17.2007;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
|
|
||||||
d="M 55.701477,114.37179 A 244.25044,244.25044 0 0 0 44.86493,131.57252 h 423.79699 a 244.25044,244.25044 0 0 0 -10.83655,-17.20073 z" />
|
|
||||||
<path
|
|
||||||
style="fill:#ff2bd5;fill-opacity:1;stroke-width:14.3776;stroke-opacity:0.415999;paint-order:stroke fill markers"
|
|
||||||
d="M 219.6651,499.13816 209.32675,443.18948"
|
|
||||||
id="path9" />
|
|
||||||
<path
|
|
||||||
id="rect1-2"
|
|
||||||
style="fill:#ffffff;fill-opacity:0.5;stroke:none;stroke-width:17.2007;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
|
|
||||||
d="m 58.271509,395.38922 a 244.25044,244.25044 0 0 0 13.54096,17.20073 H 441.71437 a 244.25044,244.25044 0 0 0 13.54097,-17.20073 z" />
|
|
||||||
<path
|
|
||||||
id="rect1-2-5"
|
|
||||||
style="fill:#ffffff;fill-opacity:0.5;stroke:none;stroke-width:17.2007;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
|
|
||||||
d="m 24.604933,328.95264 a 244.25044,244.25044 0 0 0 6.347389,17.20074 H 482.57453 a 244.25044,244.25044 0 0 0 6.34738,-17.20074 z" />
|
|
||||||
<path
|
|
||||||
id="rect1"
|
|
||||||
style="fill:#ffffff;fill-opacity:0.5;stroke:none;stroke-width:17.2007;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
|
|
||||||
d="m 12.586253,259.07464 a 244.25044,244.25044 0 0 0 1.033053,17.20075 H 499.90754 a 244.25044,244.25044 0 0 0 1.03305,-17.20075 z" />
|
|
||||||
<path
|
|
||||||
id="path15"
|
|
||||||
style="fill:url(#linearGradient2);fill-opacity:1;stroke:#ffffff;stroke-width:17.2007;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers"
|
|
||||||
d="m 306.21658,12.242412 c 0,0 -11.75029,42.031067 -17.70256,63.362621 -12.7133,9.964494 -21.07468,19.289937 -21.07468,19.289937 0,0 -22.95662,-32.534232 -44.84956,-46.065299 C 200.69681,35.298604 171.19123,37.04196 171.19123,37.04196 c 0,0 -12.25678,4.2e-4 -27.09242,5.805668 -14.83563,5.805249 -20.85631,9.675414 -20.85631,9.675414 0,0 15.05232,-0.430438 37.19828,7.094883 22.14594,7.525322 31.82093,12.041775 31.82093,12.041775 l 30.42255,-6.880714 -8.27702,11.611336 c 0,0 14.51396,9.3529 22.36179,17.738259 7.84785,8.385359 11.50216,13.114729 11.50216,13.114729 0,0 -13.65224,-5.69691 -55.57904,-1.82674 -41.92679,3.87016 -83.20898,59.12752 -83.20898,59.12752 0,0 40.42048,-16.77155 64.28649,-22.36179 23.86602,-5.59024 46.65742,-8.3862 46.65742,-8.3862 0,0 -18.05952,7.74075 -37.41035,40.20714 -19.35082,32.46639 -13.76142,84.06986 -13.76142,84.06986 0,0 30.74631,-61.92266 60.20258,-82.77854 29.45625,-20.8559 35.47652,-21.50092 35.47652,-21.50092 0,0 -23.6506,50.74216 -32.896,132.23065 -9.24539,81.48849 29.67085,217.8039 29.67085,217.8039 l 46.87159,-7.31116 c 0,0 -44.72107,-44.29147 -48.59124,-158.67636 -3.87017,-114.3849 16.33986,-182.75782 16.33986,-182.75782 0,0 16.77156,1.29005 41.71263,34.40147 24.94106,33.11142 39.56043,60.20258 39.56043,60.20258 0,0 9.46208,-53.75314 -11.1788,-78.26419 -20.64088,-24.51105 -52.46309,-35.26025 -52.46309,-35.26025 0,0 13.4385,-6.98738 41.28219,-4.94479 27.84369,2.04258 85.60053,28.44463 85.60053,28.44462 0,0 -15.50743,-26.7591 -51.84367,-45.30731 -36.33623,-18.548198 -79.76967,0.30655 -79.76967,0.30655 0,0 4.05525,-16.118294 28.53281,-34.210394 24.47756,-18.092095 55.79742,-36.030833 55.79742,-36.030833 0,0 -25.84554,1.216607 -54.12395,12.619193 -7.03608,2.837127 -13.78978,6.605056 -19.96604,10.666471 l 17.06635,-53.527632 z" />
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 11 KiB |
@@ -1,80 +1 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" fill="none" viewBox="0 0 512 512"><defs><linearGradient id="a"><stop offset="0" style="stop-color:#f977d9;stop-opacity:1"/><stop offset=".541" style="stop-color:#a655d5;stop-opacity:1"/><stop offset=".571" style="stop-color:#984fd5;stop-opacity:1"/><stop offset=".597" style="stop-color:#8c4ad4;stop-opacity:1"/><stop offset="1" style="stop-color:#3928d2;stop-opacity:1"/></linearGradient><linearGradient xlink:href="#a" id="b" x1="264.175" x2="264.175" y1="28.386" y2="488.651" gradientTransform="matrix(.97816 0 0 .9788 4.57 5.88)" gradientUnits="userSpaceOnUse"/></defs><path d="M262.975 33.688A218.443 225.23 0 0 0 138.838 73.59l2.3-1.324 20.083-7.07 19.799-3.678 23.334 2.687L228.96 76.65 265.8 115 283 99.4l21.6-13.6 26.4-9.4 29.6-6.8 19.355-.391a218.443 225.23 0 0 0-116.98-35.521M380.076 69.29l-29.877 8.51-21 11.398L307.4 108l-18.6 21.8-1.4 5.2 15-5.4 16.6-1.8 29.8 4 21.4 9.6 22.8 20 6.6 10.2-24.8-10.8-36.4-10-29.2-.8-20.4 4.4 4.4.8 26 13.6 18.8 18.4 12.8 36.8-1.6 36-23.2-37.2-23.2-28.8-25.2-21.6-8.4 15.2-12.4 94L258 364l20.4 88.8 18.795 28.57a218.443 225.23 0 0 0 184.223-222.452A218.443 225.23 0 0 0 380.076 69.291M133.074 77.84a218.443 225.23 0 0 0-88.54 181.078A218.443 225.23 0 0 0 257.04 484.066l-9.695-25.437-9.475-40.445-4.809-37.76-2.687-25.457-.424-33.658 2.404-29.98 5.092-36.347 17.112-63.074 7.07-19.375-6.08 1.557-14.567 6.787-11.382 9.322-19 18-13.2 21.201-11 23.2-13 16.4-2-15.8 2.2-23.8 9.4-27 16.4-24.4 21.641-24.559-12.02 2.264-31.962 7.07-28.99 8.627L119.925 183l.707-2.83 9.191-14.283 21.356-18.385 21.779-12.02 17.111-5.941 18.951-1.555 18.667.707 20.082-.283-1.272-3.252-19.799-19.234-7.072-8.485 1.84-7.353-14.71 3.959-10.888 1.414-16.406-6.787-23.334-7.213z" style="fill:url(#b);fill-opacity:1;stroke:none;stroke-width:13.3314;stroke-opacity:1;paint-order:stroke fill markers"/><path d="M259.367 490.166 298.4 483.2l-20-30.4L258 364l-1.2-82.4 12.4-94 8.4-15.2 25.2 21.6 23.2 28.8 23.2 37.2 1.6-36-12.8-36.8-18.8-18.4-26-13.6-4.4-.8 20.4-4.4 29.2.8 36.4 10 24.8 10.8-6.6-10.2-22.8-20-21.4-9.6-29.8-4-16.6 1.8-15 5.4 1.4-5.2 18.6-21.8 21.8-18.8 21-11.4 30.2-8.6-19.8.4-29.6 6.8-26.4 9.4L283 99.4 265.8 115 228.96 76.65l-24.607-12.445-23.335-2.687-19.799 3.677-20.082 7.071-9.333 5.374 24.324 3.818 23.335 7.213 16.404 6.788 10.89-1.414 14.708-3.96-1.839 7.354 7.071 8.485 19.8 19.234 1.272 3.252-20.082.283-18.667-.707-18.95 1.556-17.113 5.94-21.779 12.02-21.354 18.385-9.193 14.284-.707 2.828 28.143-11.597 28.991-8.626 31.962-7.071 12.02-2.263L199.4 178 183 202.4l-9.4 27-2.2 23.8 2 15.8 13-16.4 11-23.2 13.2-21.2 19-18 11.382-9.322 14.566-6.789 6.081-1.555-7.07 19.375-17.113 63.073-5.09 36.346-2.405 29.981.424 33.658 2.687 25.456 4.809 37.76 9.475 40.446z" style="fill:#1b1b1b;fill-opacity:.12492698;stroke:none;stroke-width:13.374;stroke-opacity:.415999;paint-order:stroke fill markers"/></svg>
|
||||||
<svg
|
|
||||||
width="512"
|
|
||||||
height="512"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 512 512"
|
|
||||||
version="1.1"
|
|
||||||
id="svg7"
|
|
||||||
sodipodi:docname="base_small.svg"
|
|
||||||
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
|
|
||||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
||||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
xmlns:svg="http://www.w3.org/2000/svg">
|
|
||||||
<defs
|
|
||||||
id="defs7">
|
|
||||||
<linearGradient
|
|
||||||
id="linearGradient10"
|
|
||||||
inkscape:collect="always">
|
|
||||||
<stop
|
|
||||||
style="stop-color:#f977d9;stop-opacity:1;"
|
|
||||||
offset="0"
|
|
||||||
id="stop10" />
|
|
||||||
<stop
|
|
||||||
style="stop-color:#a655d5;stop-opacity:1;"
|
|
||||||
offset="0.54051435"
|
|
||||||
id="stop13" />
|
|
||||||
<stop
|
|
||||||
style="stop-color:#984fd5;stop-opacity:1;"
|
|
||||||
offset="0.5714342"
|
|
||||||
id="stop12" />
|
|
||||||
<stop
|
|
||||||
style="stop-color:#8c4ad4;stop-opacity:1;"
|
|
||||||
offset="0.59666741"
|
|
||||||
id="stop14" />
|
|
||||||
<stop
|
|
||||||
style="stop-color:#3928d2;stop-opacity:1;"
|
|
||||||
offset="1"
|
|
||||||
id="stop11" />
|
|
||||||
</linearGradient>
|
|
||||||
<linearGradient
|
|
||||||
inkscape:collect="always"
|
|
||||||
xlink:href="#linearGradient10"
|
|
||||||
id="linearGradient11"
|
|
||||||
x1="264.17508"
|
|
||||||
y1="28.385544"
|
|
||||||
x2="264.17508"
|
|
||||||
y2="488.65109"
|
|
||||||
gradientUnits="userSpaceOnUse"
|
|
||||||
gradientTransform="matrix(0.97815818,0,0,0.97880258,4.570042,5.8799159)" />
|
|
||||||
</defs>
|
|
||||||
<sodipodi:namedview
|
|
||||||
id="namedview7"
|
|
||||||
pagecolor="#ffffff"
|
|
||||||
bordercolor="#000000"
|
|
||||||
borderopacity="0.25"
|
|
||||||
inkscape:showpageshadow="2"
|
|
||||||
inkscape:pageopacity="0.0"
|
|
||||||
inkscape:pagecheckerboard="0"
|
|
||||||
inkscape:deskcolor="#d1d1d1"
|
|
||||||
inkscape:zoom="0.88388348"
|
|
||||||
inkscape:cx="153.30075"
|
|
||||||
inkscape:cy="243.24473"
|
|
||||||
inkscape:window-width="1600"
|
|
||||||
inkscape:window-height="849"
|
|
||||||
inkscape:window-x="0"
|
|
||||||
inkscape:window-y="27"
|
|
||||||
inkscape:window-maximized="1"
|
|
||||||
inkscape:current-layer="svg7"
|
|
||||||
showguides="false" />
|
|
||||||
<path
|
|
||||||
id="path9"
|
|
||||||
style="fill:url(#linearGradient11);fill-opacity:1;stroke:none;stroke-width:13.3314;stroke-opacity:1;paint-order:stroke fill markers"
|
|
||||||
d="M 262.97461 33.6875 A 218.44267 225.23091 0 0 0 138.83789 73.589844 L 141.13867 72.265625 L 161.2207 65.195312 L 181.01953 61.517578 L 204.35352 64.205078 L 228.96094 76.650391 L 265.80078 115 L 283 99.400391 L 304.59961 85.800781 L 331 76.400391 L 360.59961 69.599609 L 379.95508 69.208984 A 218.44267 225.23091 0 0 0 262.97461 33.6875 z M 380.07617 69.291016 L 350.19922 77.800781 L 329.19922 89.199219 L 307.40039 108 L 288.80078 129.80078 L 287.40039 135 L 302.40039 129.59961 L 319 127.80078 L 348.80078 131.80078 L 370.19922 141.40039 L 393 161.40039 L 399.59961 171.59961 L 374.80078 160.80078 L 338.40039 150.80078 L 309.19922 150 L 288.80078 154.40039 L 293.19922 155.19922 L 319.19922 168.80078 L 338 187.19922 L 350.80078 224 L 349.19922 260 L 326 222.80078 L 302.80078 194 L 277.59961 172.40039 L 269.19922 187.59961 L 256.80078 281.59961 L 258 364 L 278.40039 452.80078 L 297.19531 481.36914 A 218.44267 225.23091 0 0 0 481.41797 258.91797 A 218.44267 225.23091 0 0 0 380.07617 69.291016 z M 133.07422 77.839844 A 218.44267 225.23091 0 0 0 44.533203 258.91797 A 218.44267 225.23091 0 0 0 257.04102 484.06641 L 247.3457 458.62891 L 237.87109 418.18359 L 233.0625 380.42383 L 230.375 354.9668 L 229.95117 321.30859 L 232.35547 291.32812 L 237.44727 254.98242 L 254.55859 191.9082 L 261.62891 172.5332 L 255.54883 174.08984 L 240.98242 180.87695 L 229.59961 190.19922 L 210.59961 208.19922 L 197.40039 229.40039 L 186.40039 252.59961 L 173.40039 269 L 171.40039 253.19922 L 173.59961 229.40039 L 183 202.40039 L 199.40039 178 L 221.04102 153.44141 L 209.02148 155.70508 L 177.05859 162.77539 L 148.06836 171.40234 L 119.92578 183 L 120.63281 180.16992 L 129.82422 165.88672 L 151.17969 147.50195 L 172.95898 135.48242 L 190.07031 129.54102 L 209.02148 127.98633 L 227.6875 128.69336 L 247.76953 128.41016 L 246.49805 125.1582 L 226.69922 105.92383 L 219.62695 97.439453 L 221.4668 90.085938 L 206.75781 94.044922 L 195.86914 95.458984 L 179.46289 88.671875 L 156.12891 81.458984 L 133.07422 77.839844 z " />
|
|
||||||
<path
|
|
||||||
style="fill:#1b1b1b;fill-opacity:0.12492698;stroke:none;stroke-width:13.374;stroke-opacity:0.415999;paint-order:stroke fill markers"
|
|
||||||
d="m 259.36665,490.16617 39.03323,-6.96642 -20,-30.4 -20.4,-88.8 -1.2,-82.4 12.4,-94 8.4,-15.2 25.2,21.6 23.2,28.8 23.2,37.2 1.6,-36 -12.8,-36.8 -18.8,-18.4 -26,-13.6 -4.4,-0.8 20.4,-4.4 29.2,0.8 36.4,10 24.8,10.8 -6.6,-10.2 -22.8,-20 -21.4,-9.6 -29.8,-4 -16.6,1.8 -15,5.4 1.4,-5.2 18.6,-21.8 21.8,-18.800003 21,-11.4 30.2,-8.6 -19.8,0.4 -29.6,6.8 -26.4,9.4 -21.6,13.6 -17.2,15.600003 -36.83882,-38.349628 -24.60732,-12.445079 -23.33452,-2.687006 -19.79899,3.676955 -20.08184,7.071068 -9.33381,5.374012 24.32448,3.818376 23.33452,7.212489 16.40488,6.788226 10.88944,-1.414214 14.70782,-3.959798 -1.83847,7.353911 7.07106,8.485288 19.79899,19.2333 1.2728,3.25269 -20.08184,0.28284 -18.66762,-0.7071 -18.95046,1.55563 -17.11198,5.9397 -21.77889,12.02081 -21.35462,18.38478 -9.19239,14.28356 -0.70711,2.82843 28.14285,-11.59656 28.99138,-8.6267 31.96122,-7.07107 12.02082,-2.26274 -21.64158,24.55783 -16.4,24.4 -9.4,27 -2.2,23.8 2,15.8 13,-16.4 11,-23.2 13.2,-21.2 19,-18 11.38199,-9.32209 14.5664,-6.78822 6.08112,-1.55564 -7.07107,19.37473 -17.11198,63.07393 -5.09117,36.34528 -2.40416,29.98133 0.42426,33.65828 2.68701,25.45585 4.80832,37.7595 9.47523,40.44651 z"
|
|
||||||
id="path8-4" />
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@@ -6,10 +6,31 @@ General guide for cross compiling.
|
|||||||
|
|
||||||
A painless guide for cross compilation (or to test NCE) from a x86_64 system without polluting your main.
|
A painless guide for cross compilation (or to test NCE) from a x86_64 system without polluting your main.
|
||||||
|
|
||||||
- Install QEMU: `sudo pkg install qemu`
|
```sh
|
||||||
- Download Debian 13: `wget https://cdimage.debian.org/debian-cd/current/arm64/iso-cd/debian-13.0.0-arm64-netinst.iso`
|
#!/bin/sh
|
||||||
- Create a system disk: `qemu-img create -f qcow2 debian-13-arm64-ci.qcow2 30G`
|
ISO_FILE="debian-13.0.0-arm64-netinst.iso"
|
||||||
- Run the VM: `qemu-system-aarch64 -M virt -m 2G -cpu max -bios /usr/local/share/qemu/edk2-aarch64-code.fd -drive if=none,file=debian-13.0.0-arm64-netinst.iso,format=raw,id=cdrom -device scsi-cd,drive=cdrom -drive if=none,file=debian-13-arm64-ci.qcow2,id=hd0,format=qcow2 -device virtio-blk-device,drive=hd0 -device virtio-gpu-pci -device usb-ehci -device usb-kbd -device intel-hda -device hda-output -nic user,model=virtio-net-pci`
|
DISK_FILE="debian-13-arm64-ci.qcow2"
|
||||||
|
which -- qemu-system-aarch64 || sudo pkg install qemu
|
||||||
|
[ -f "$ISO_FILE" ] || wget https://cdimage.debian.org/debian-cd/current/arm64/iso-cd/$ISO_FILE
|
||||||
|
[ -f "$DISK_FILE" ] || qemu-img create -f qcow2 "$DISK_FILE" 30G
|
||||||
|
QEMU_FLAGS=(
|
||||||
|
-M virt
|
||||||
|
-m 2G
|
||||||
|
-cpu max
|
||||||
|
-bios /usr/local/share/qemu/edk2-aarch64-code.fd
|
||||||
|
-drive if=none,file=$ISO_FILE,format=raw,id=cdrom
|
||||||
|
-drive if=none,file=$DISK_FILE,id=hd0,format=qcow2
|
||||||
|
-device scsi-cd,drive=cdrom
|
||||||
|
-device virtio-blk-device,drive=hd0
|
||||||
|
-device virtio-gpu-pci
|
||||||
|
-device usb-ehci
|
||||||
|
-device usb-kbd
|
||||||
|
-device intel-hda
|
||||||
|
-device hda-output
|
||||||
|
-nic user,model=virtio-net-pci
|
||||||
|
)
|
||||||
|
qemu-system-aarch64 "${QEMU_FLAGS[@]}"
|
||||||
|
```
|
||||||
|
|
||||||
## Gentoo
|
## Gentoo
|
||||||
|
|
||||||
|
|||||||
@@ -24,25 +24,6 @@ If the work is licensed/vendored from other people or projects, you may omit the
|
|||||||
|
|
||||||
For more information on the license header script, run `.ci/license-header.sh -h`.
|
For more information on the license header script, run `.ci/license-header.sh -h`.
|
||||||
|
|
||||||
## Pull Requests
|
|
||||||
|
|
||||||
Pull requests are only to be merged by core developers when properly tested and discussions conclude on Discord or other communication channels. Labels are recommended but not required. However, all PRs MUST be namespaced and optionally typed:
|
|
||||||
|
|
||||||
```txt
|
|
||||||
[cmake] refactor: CPM over submodules
|
|
||||||
[desktop] feat: implement firmware install from ZIP
|
|
||||||
[hle] stub fw20 functions
|
|
||||||
[core] test: raise maximum CPU cores to 6
|
|
||||||
[cmake, core] Unbreak FreeBSD Building Process
|
|
||||||
```
|
|
||||||
|
|
||||||
- The level of namespacing is generally left to the committer's choice.
|
|
||||||
- However, we never recommend going more than two levels *except* in `hle`, in which case you may go as many as four levels depending on the specificity of your changes.
|
|
||||||
- Ocassionally, up to two additional namespaces may be provided for more clarity.
|
|
||||||
- Changes that affect the entire project (sans CMake changes) should be namespaced as `meta`.
|
|
||||||
- Maintainers are permitted to change namespaces at will.
|
|
||||||
- Commits within PRs are not required to be namespaced, but it is highly recommended.
|
|
||||||
|
|
||||||
## Adding new settings
|
## Adding new settings
|
||||||
|
|
||||||
When adding new settings, use `tr("Setting:")` if the setting is meant to be a field, otherwise use `tr("Setting")` if the setting is meant to be a Yes/No or checkmark type of setting, see [this short style guide](https://learn.microsoft.com/en-us/style-guide/punctuation/colons#in-ui).
|
When adding new settings, use `tr("Setting:")` if the setting is meant to be a field, otherwise use `tr("Setting")` if the setting is meant to be a Yes/No or checkmark type of setting, see [this short style guide](https://learn.microsoft.com/en-us/style-guide/punctuation/colons#in-ui).
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ This contains documentation created by developers, build instructions, guideline
|
|||||||
|
|
||||||
Policies and information on development.
|
Policies and information on development.
|
||||||
|
|
||||||
- **[AI and LLM Usage](./policies/AI.md)**
|
- **[AI and LLM Usage](./CONTRIBUTING.md#policies)**
|
||||||
- **[Coding guidelines](./policies/Coding.md)**
|
- **[Coding guidelines](./policies/Coding.md)**
|
||||||
- **[Contributing](../CONTRIBUTING.md)**
|
- **[Contributing](../CONTRIBUTING.md)**
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 128 KiB After Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 89 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 17 KiB |
@@ -1,203 +0,0 @@
|
|||||||
# AI Policy
|
|
||||||
|
|
||||||
> [!WARNING]
|
|
||||||
> We are trialing a slightly relaxed AI policy to allow high-quality contributors to use AI *responsibly*.
|
|
||||||
> This policy is subject to change at any point in time, so check back frequently.
|
|
||||||
>
|
|
||||||
> This banner will be removed once we have finalized our revised policy.
|
|
||||||
|
|
||||||
- [AI Policy](#ai-policy)
|
|
||||||
- [TL;DR](#tldr)
|
|
||||||
- [Definitions](#definitions)
|
|
||||||
- [Scope](#scope)
|
|
||||||
- [Introduction](#introduction)
|
|
||||||
- [Requirements](#requirements)
|
|
||||||
- [Sign-off, Authorship, and Copyright](#sign-off-authorship-and-copyright)
|
|
||||||
- [Permitted Usage](#permitted-usage)
|
|
||||||
- [Recommended Prior Discussion](#recommended-prior-discussion)
|
|
||||||
- [Forbidden Usage](#forbidden-usage)
|
|
||||||
- [Human Effort Denial of Service](#human-effort-denial-of-service)
|
|
||||||
- [Disclosure](#disclosure)
|
|
||||||
- [Codebase Ingestion](#codebase-ingestion)
|
|
||||||
- [Enforcement](#enforcement)
|
|
||||||
- [Addendum: AI Commit Messages](#addendum-ai-commit-messages)
|
|
||||||
- [References](#references)
|
|
||||||
|
|
||||||
## TL;DR
|
|
||||||
|
|
||||||
AI-assisted contributions are welcome, provided you take responsibility for them.
|
|
||||||
|
|
||||||
- You **must** disclose any AI or LLM usage in your pull request description *and* commit message.
|
|
||||||
- You **must** be able to explain, defend, and revise every line of code you submit.
|
|
||||||
- Commit messages, PR descriptions, issues, and comments **must** be written by you. Verbatim AI output is not acceptable.
|
|
||||||
- Undisclosed AI usage will result in your contribution being rejected.
|
|
||||||
- Low-quality contributions, disclosed or not, will be reworked or rejected.
|
|
||||||
- Spamming automated PRs, comments, or issues is treated as a Denial of Service (DoS) attack on our reviewers; see [Human Effort Denial of Service](#human-effort-denial-of-service).
|
|
||||||
|
|
||||||
## Definitions
|
|
||||||
|
|
||||||
An *AI or LLM-based tool* is any piece of software that generates code, text, or other content through machine learning models. This includes, but is not limited to: chat assistants, agentic coding tools/harnesses, inline code completion suggestions you have accepted into the code, and AI-driven explanation/refactoring features.
|
|
||||||
|
|
||||||
For the purposes of this policy, basic deterministic/static development tools (such as clang-tidy, git, compilers, etc.) are not considered AI tools.
|
|
||||||
|
|
||||||
Terms such as "substantially", "large-scale", "majority", and "low-quality" are intentionally left vague, and will be interpreted at the maintainers' discretion. When in doubt, ask first.
|
|
||||||
|
|
||||||
## Scope
|
|
||||||
|
|
||||||
This policy applies to all code contributions, alongside issues and pull requests surrounding this codebase. This includes:
|
|
||||||
|
|
||||||
- Commit messages
|
|
||||||
- PR descriptions
|
|
||||||
- Code review comments
|
|
||||||
- Issue/PR comments
|
|
||||||
- Patches submitted via e-mail
|
|
||||||
|
|
||||||
Areas that are not directly related to code--such as our surrounding communities--are not covered by the terms of this policy. Additionally, spelling/grammar checking via AI or LLM-based tools is not covered under this document.
|
|
||||||
|
|
||||||
## Introduction
|
|
||||||
|
|
||||||
In the right hands, AI and LLM-based tools are incredibly useful for getting features and bugfixes out the door as fast as possible. At the same time, reviewer bandwidth is a scarce resource. We are therefore open to AI-assisted contributions, provided they are produced and disclosed properly.
|
|
||||||
|
|
||||||
The goal of this document is *not* to set arbitrary restrictions, but rather to keep our development healthy and stable, while still allowing contributors to use the tools they find helpful. A contribution must be worth more to the project than the time it takes to review it.
|
|
||||||
|
|
||||||
Throughout this document, **must** and **must not** are inflexible, binding requirements. Refusal to follow these is treated as a violation of the terms outlined in this document.
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
These apply to all contributions, whether AI-assisted or not. AI-assisted contributions also carry additional disclosure requirements as outlined in [Disclosure](#disclosure).
|
|
||||||
|
|
||||||
1. *Disclosure*. Any and all usage of AI or LLM-based tools within any contribution **must** be explicitly marked and disclosed as appropriate.
|
|
||||||
2. *Responsibility*. The human submitter of any contribution is held wholly responsible for the accuracy, completeness, and intent of what is submitted. You **must** be able to explain, defend, and revise your code during review.
|
|
||||||
3. *Review*. All code **must** be thoroughly reviewed by the author before opening a PR or marking it ready for review.
|
|
||||||
4. *Testing*. All code changes **must** be tested directly by the human author.
|
|
||||||
5. *Quality*. All submitted code is held to a strict standard of excellence. Low-quality AI-generated content does not uphold this standard.
|
|
||||||
6. *Licensing*. All code **must** be compatible with the GPLv3 or later. You **must** warrant that you have the right to submit it under those terms, and that it was not copied from work published under an incompatible license.
|
|
||||||
|
|
||||||
## Sign-off, Authorship, and Copyright
|
|
||||||
|
|
||||||
AI agents **must not** add `Signed-off-by:` tags. The human submitter **must** sign off on all changes.
|
|
||||||
|
|
||||||
Similarly, AI agents cannot hold authorship or copyright over code, and **must not** add `Co-authored-by:` or `Co-developed-by:` tags. The human submitter **must** author all changes.
|
|
||||||
|
|
||||||
## Permitted Usage
|
|
||||||
|
|
||||||
This is a non-exhaustive list of permitted uses of AI and LLM-based tools, provided they are disclosed properly.
|
|
||||||
|
|
||||||
- Drafting issues and pull requests, provided the final text and submitted code are substantially your own.
|
|
||||||
- Debugging issues, bugs, glitches, and crashes, whether pre-existing or introduced by your own changes.
|
|
||||||
- Reviewing your own changes before submitting a PR.
|
|
||||||
- Research, brainstorming, and codebase searching/understanding.
|
|
||||||
- Applying tedious but not particularly large changes, such as mass-migrating specific classes to polyfills or abstractions.
|
|
||||||
|
|
||||||
## Recommended Prior Discussion
|
|
||||||
|
|
||||||
Some usage cases are not necessarily forbidden nor permitted. These should be discussed with maintainers in an issue or e-mail *before* submission. Maintainers and reviewers may also comment on this during the review/submission phase.
|
|
||||||
|
|
||||||
- Generating boilerplate/scaffolding for new code.
|
|
||||||
- Writing unit tests.
|
|
||||||
- Large-scale refactors primarily driven by an AI agent.
|
|
||||||
- Any contribution where an AI agent or model was responsible for the majority of the implementation.
|
|
||||||
|
|
||||||
## Forbidden Usage
|
|
||||||
|
|
||||||
This is a non-exhaustive list of strictly forbidden uses of AI and LLM-based tools.
|
|
||||||
|
|
||||||
- Vibecoding, or changes entirely authored by AI agents without human intervention or understanding.
|
|
||||||
- If you don't choose to put in the necessary effort to understand every line of code you submitted, neither will we.
|
|
||||||
- Fully AI-generated commit messages, PR descriptions, issues, or comments. See [Addendum: AI Commit Messages](#addendum-ai-commit-messages).
|
|
||||||
- Submission of AI-assisted work that is not disclosed per the [Disclosure](#disclosure) requirements.
|
|
||||||
- Low-quality submissions that fail to satisfy our standard of code excellence.
|
|
||||||
- Submitting secrets, credentials, private user data, or unpublished security reports to third-party AI services.
|
|
||||||
- This includes console keys, encryption material, and private vulnerability disclosures.
|
|
||||||
- Verbatim AI code reviews (e.g. Codex/Copilot reviews).
|
|
||||||
|
|
||||||
## Human Effort Denial of Service
|
|
||||||
|
|
||||||
Using automated tools and AI to submit PRs, issues, and comments that we have to carefully review and handle is considered a [Denial-of-service attack](https://en.wikipedia.org/wiki/Denial-of-service_attack) on our human effort.
|
|
||||||
|
|
||||||
It takes very little effort on your side (an LLM prompt) to generate a large amount of effort on ours (careful and thorough code review). Please respect our time and don't do that.
|
|
||||||
|
|
||||||
## Disclosure
|
|
||||||
|
|
||||||
How you disclose AI usage is up to you. However, it **must** be explicit, easy to identify, and placed both within the commit message *and* the surrounding PR description. For patches submitted by e-mail, the cover letter counts as the PR description. We recommend an `Assisted-by:` footer:
|
|
||||||
|
|
||||||
```txt
|
|
||||||
Assisted-by: <model> (<what it was used for>)
|
|
||||||
```
|
|
||||||
|
|
||||||
For instance:
|
|
||||||
|
|
||||||
```txt
|
|
||||||
Assisted-by: Claude Opus 5.5 (initial draft and code review)
|
|
||||||
```
|
|
||||||
|
|
||||||
Contributions without a commit message (e.g. issues/comments) should instead use a plain sentence in the text body such as `I used <model> to help with <X>`. PRs and commit messages may opt to use this format as well.
|
|
||||||
|
|
||||||
Multi-commit series/squashes **must** maintain the trailer. Maintainers will handle this for merges to master, but you are responsible for ensuring the disclosure survives into the final commit/PR body of squashes within your branches.
|
|
||||||
|
|
||||||
Regardless, what matters is that reviewers can tell *at a glance* where and how AI was involved in your contribution.
|
|
||||||
|
|
||||||
## Codebase Ingestion
|
|
||||||
|
|
||||||
Ingestion of this codebase by LLMs for any purpose--such as training or prompt context--is permitted *for now*. This may change at any point as litigation and court rulings around AI and code copyright proceed.
|
|
||||||
|
|
||||||
AI models may have ingested AGPLv3 or otherwise copyleft-incompatible code and may regurgitate it. You remain responsible for ensuring that all code you submit is compatible with the GPLv3 or later.
|
|
||||||
|
|
||||||
## Enforcement
|
|
||||||
|
|
||||||
- If we suspect undisclosed AI usage in a contribution, we will ask for disclosure.
|
|
||||||
- Refusal to provide disclosure will result in rejection of the contribution, and your PR or issue will be closed. Maintainers may choose to rework it themselves if the change is worth having.
|
|
||||||
- Accounts that spam us with repeated automated PRs or comments will be blocked or permanently suspended from our Git instance.
|
|
||||||
- Maintainers reserve the right to close your issues and pull requests if you don't follow the guidelines and procedures outlined in this document, and refuse or fail to make changes as necessary to comply.
|
|
||||||
- Repeated failures to comply may result in loss of contribution privileges.
|
|
||||||
|
|
||||||
## Addendum: AI Commit Messages
|
|
||||||
|
|
||||||
The patchset for pull request [#3422](https://git.eden-emu.dev/eden-emu/eden/pulls/3422) was fed into a dedicated code AI model, and it produced the following:
|
|
||||||
|
|
||||||
```txt
|
|
||||||
profile_manager: Refactor user deletion to use index instead of UUID
|
|
||||||
|
|
||||||
This commit improves the user profile deletion flow in the following ways:
|
|
||||||
|
|
||||||
1. **UI layer (ConfigureProfileManager)**:
|
|
||||||
- Replaces UUID-based deletion with index-based deletion
|
|
||||||
- Passes the selected row index from the tree view to the confirmation dialog
|
|
||||||
- Emits deleteUser(int index) signal from ConfigureProfileManagerDeleteDialog
|
|
||||||
- Removes lambda capture and std::function callback in favor of direct signal/slot connection
|
|
||||||
|
|
||||||
2. **Delete dialog**:
|
|
||||||
- Changes SetInfo() signature to accept index instead of accept callback
|
|
||||||
- Stores index internally and emits it via deleteUser signal on acceptance
|
|
||||||
|
|
||||||
3. **Core ProfileManager**:
|
|
||||||
- Refactors RemoveUser(UUID) → RemoveProfileAtIndex(index)
|
|
||||||
- Removes duplicated stable_partition + save logic from RemoveUser()
|
|
||||||
- Centralizes profile removal and save-file writing in RemoveProfileAtIndex()
|
|
||||||
|
|
||||||
4. **Minor follow-up**:
|
|
||||||
- Adds profile_manager.ResetUserSaveFile() call in PopulateUserList() to ensure consistent state when refreshing the user list
|
|
||||||
|
|
||||||
These changes eliminate redundant code, reduce the risk of UUID → index mismatch bugs, and make the deletion path more straightforward and maintainable.
|
|
||||||
|
|
||||||
Fixes: potential inconsistency when user order changes between UI and backend
|
|
||||||
```
|
|
||||||
|
|
||||||
This:
|
|
||||||
|
|
||||||
- Is needlessly verbose (nobody cares about most of these details)
|
|
||||||
- Doesn't address the actual purpose of the PR (fixing a double-deletion bug in the profile manager)
|
|
||||||
- Has unicode arrows (this is bad for command-line editors)
|
|
||||||
- Uses corporate and word-salad language that pads out the message to make it look like a lot changed
|
|
||||||
|
|
||||||
A good commit message should be concise, descriptive, and convey the *intent* behind the change, such as the bug being fixed or the feature being added. It should *not* be a detailed changelog of every individual byte that's changed.
|
|
||||||
|
|
||||||
## References
|
|
||||||
|
|
||||||
This policy document has been adapted from the AI policies of numerous other free and open-source projects, whether restrictive or permissive.
|
|
||||||
|
|
||||||
- [Gitea](https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md#ai-contribution-policy)
|
|
||||||
- The [Linux kernel](https://kernel.org/doc/html/next/process/coding-assistants.html)
|
|
||||||
- [Gentoo Linux](https://wiki.gentoo.org/wiki/Project:Council/AI_policy)
|
|
||||||
- [cURL](https://curl.se/dev/contribute.html#on-ai-use-in-curl)
|
|
||||||
- [FastAPI](https://tiangolo.com/open-source/contributing/#automated-code-and-ai)
|
|
||||||
@@ -45,12 +45,13 @@ Another option would be to launch the game in Eden and close it - then go into t
|
|||||||
***INFO***: Make sure you select the correct directory or it will not work, the screen should show the **cheats** sub-directory.
|
***INFO***: Make sure you select the correct directory or it will not work, the screen should show the **cheats** sub-directory.
|
||||||
|
|
||||||
</aside>
|
</aside>
|
||||||
2. You should now see the cheat appear in the **Add-ons** screen.
|
|
||||||
3. Launch the game and confirm that the cheat is applied.
|
9. You should now see the cheat appear in the **Add-ons** screen.
|
||||||
|
10. Launch the game and confirm that the cheat is applied.
|
||||||
|
|
||||||
### Step 2: Multiple Cheats
|
### Step 2: Multiple Cheats
|
||||||
|
|
||||||
In order to install multiple cheats, you must repeat the steps above with the new cheat, creating a new directory with the name of the cheat and cheats directory. You **cannot** install multiple cheats with a single file.
|
In order to install multiple cheats, you must repeat the steps above with the new cheat, creating a new directory with the name of the cheat and cheats directory.
|
||||||
|
|
||||||
Community Member [Ninjistix](https://github.com/Ninjistix) created a utility (Windows or anything that can run Python) that can take a file with multiple cheats and create the files/structure for you with a provided Build ID. To download and run it, see the [GitHub Project](https://github.com/Ninjistix/nxCheat_Splitter) page.
|
Community Member [Ninjistix](https://github.com/Ninjistix) created a utility (Windows or anything that can run Python) that can take a file with multiple cheats and create the files/structure for you with a provided Build ID. To download and run it, see the [GitHub Project](https://github.com/Ninjistix/nxCheat_Splitter) page.
|
||||||
|
|
||||||
@@ -122,7 +123,7 @@ Another option would be to launch the game in Eden and close it - then go into t
|
|||||||
|
|
||||||
### Step 2: Multiple Cheats
|
### Step 2: Multiple Cheats
|
||||||
|
|
||||||
In order to install multiple cheats, you must repeat the steps above with the new cheat, creating a new directory with the name of the cheat and cheats directory. You **cannot** install multiple cheats with a single file.
|
In order to install multiple cheats, you must repeat the steps above with the new cheat, creating a new directory with the name of the cheat and cheats directory.
|
||||||
|
|
||||||
Community Member [Ninjistix](https://github.com/Ninjistix) created a utility (Windows or anything that can run Python) that can take a file with multiple cheats and create the files/structure for you with a provided Build ID. To download and run it, see the [GitHub Project](https://github.com/Ninjistix/nxCheat_Splitter) page.
|
Community Member [Ninjistix](https://github.com/Ninjistix) created a utility (Windows or anything that can run Python) that can take a file with multiple cheats and create the files/structure for you with a provided Build ID. To download and run it, see the [GitHub Project](https://github.com/Ninjistix/nxCheat_Splitter) page.
|
||||||
|
|
||||||
@@ -154,3 +155,11 @@ Cheats are enabled by default, but can be disabled so they don't affect gameplay
|
|||||||
3. *Select/Deselect* the name of the cheat you wish to enable/disable.
|
3. *Select/Deselect* the name of the cheat you wish to enable/disable.
|
||||||
4. Click **OK** to close the window.
|
4. Click **OK** to close the window.
|
||||||
5. Launch the game to confirm the cheat is/is not active.
|
5. Launch the game to confirm the cheat is/is not active.
|
||||||
|
|
||||||
|
### Runtime Cheat Controls
|
||||||
|
|
||||||
|
* While a game is running, open **Cheats** from the menu bar to toggle individual entries from the loaded cheat files. The menu stays open while toggling entries and is hidden when the running game has no cheats. Runtime changes apply to the current game session only.
|
||||||
|
|
||||||
|
* Use **Configure > System > Core > Enable cheats by default** to choose whether regular cheats start enabled. The setting can also be overridden for an individual game from its **System** settings.
|
||||||
|
|
||||||
|
* Master Code entries (`{}` blocks) are always enabled and appear as disabled and checked items in the runtime menu.
|
||||||
|
|||||||
@@ -101,6 +101,11 @@ endfunction()
|
|||||||
# ia64 exists
|
# ia64 exists
|
||||||
# the rest exist, but are probably less popular than ia64
|
# the rest exist, but are probably less popular than ia64
|
||||||
|
|
||||||
|
detect_architecture_symbols(
|
||||||
|
ARCH wasm
|
||||||
|
SYMBOLS
|
||||||
|
"__EMSCRIPTEN__")
|
||||||
|
|
||||||
detect_architecture_symbols(
|
detect_architecture_symbols(
|
||||||
ARCH arm64
|
ARCH arm64
|
||||||
SYMBOLS
|
SYMBOLS
|
||||||
@@ -203,11 +208,6 @@ detect_architecture_symbols(
|
|||||||
"__loongarch__"
|
"__loongarch__"
|
||||||
"__loongarch64")
|
"__loongarch64")
|
||||||
|
|
||||||
detect_architecture_symbols(
|
|
||||||
ARCH wasm
|
|
||||||
SYMBOLS
|
|
||||||
"__EMSCRIPTEN__")
|
|
||||||
|
|
||||||
# "generic" target
|
# "generic" target
|
||||||
# If you have reached this point, you're on some as-of-yet unsupported architecture.
|
# If you have reached this point, you're on some as-of-yet unsupported architecture.
|
||||||
# See the docs up above for known unsupported architectures
|
# See the docs up above for known unsupported architectures
|
||||||
|
|||||||
@@ -34,6 +34,13 @@ import org.yuzu.yuzu_emu.applets.web.WebBrowser
|
|||||||
* with the native side of the Yuzu code.
|
* with the native side of the Yuzu code.
|
||||||
*/
|
*/
|
||||||
object NativeLibrary {
|
object NativeLibrary {
|
||||||
|
@Keep
|
||||||
|
class RuntimeCheat(
|
||||||
|
val id: Int,
|
||||||
|
val name: String,
|
||||||
|
val enabled: Boolean,
|
||||||
|
val isMaster: Boolean
|
||||||
|
)
|
||||||
@Keep
|
@Keep
|
||||||
data class UpdateResult(
|
data class UpdateResult(
|
||||||
var tag: String = "",
|
var tag: String = "",
|
||||||
@@ -197,6 +204,9 @@ object NativeLibrary {
|
|||||||
*/
|
*/
|
||||||
external fun isPaused(): Boolean
|
external fun isPaused(): Boolean
|
||||||
|
|
||||||
|
external fun getRuntimeCheats(): Array<RuntimeCheat>
|
||||||
|
external fun setRuntimeCheatEnabled(id: Int, enabled: Boolean): Boolean
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the performance stats for the current game
|
* Returns the performance stats for the current game
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ enum class BooleanSetting(override val key: String) : AbstractBooleanSetting {
|
|||||||
FASTMEM("cpuopt_fastmem"),
|
FASTMEM("cpuopt_fastmem"),
|
||||||
FASTMEM_EXCLUSIVES("cpuopt_fastmem_exclusives"),
|
FASTMEM_EXCLUSIVES("cpuopt_fastmem_exclusives"),
|
||||||
CORE_SYNC_CORE_SPEED("sync_core_speed"),
|
CORE_SYNC_CORE_SPEED("sync_core_speed"),
|
||||||
|
ENABLE_CHEATS_BY_DEFAULT("enable_cheats_by_default"),
|
||||||
RENDERER_USE_SPEED_LIMIT("use_speed_limit"),
|
RENDERER_USE_SPEED_LIMIT("use_speed_limit"),
|
||||||
USE_CUSTOM_CPU_TICKS("use_custom_cpu_ticks"),
|
USE_CUSTOM_CPU_TICKS("use_custom_cpu_ticks"),
|
||||||
SKIP_CPU_INNER_INVALIDATION("skip_cpu_inner_invalidation"),
|
SKIP_CPU_INNER_INVALIDATION("skip_cpu_inner_invalidation"),
|
||||||
NCE_INVALIDATION_GPU_READBACK("nce_invalidation_gpu_readback"),
|
|
||||||
FIX_BLOOM_EFFECTS("fix_bloom_effects"),
|
FIX_BLOOM_EFFECTS("fix_bloom_effects"),
|
||||||
EMULATE_BGR565("emulate_bgr565"),
|
EMULATE_BGR565("emulate_bgr565"),
|
||||||
RESCALE_HACK("rescale_hack"),
|
RESCALE_HACK("rescale_hack"),
|
||||||
|
|||||||
@@ -316,6 +316,13 @@ abstract class SettingsItem(
|
|||||||
descriptionId = R.string.use_sync_core_description
|
descriptionId = R.string.use_sync_core_description
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
put(
|
||||||
|
SwitchSetting(
|
||||||
|
BooleanSetting.ENABLE_CHEATS_BY_DEFAULT,
|
||||||
|
titleId = R.string.enable_cheats_by_default,
|
||||||
|
descriptionId = R.string.enable_cheats_by_default_description
|
||||||
|
)
|
||||||
|
)
|
||||||
put(
|
put(
|
||||||
SingleChoiceSetting(
|
SingleChoiceSetting(
|
||||||
IntSetting.REGION_INDEX,
|
IntSetting.REGION_INDEX,
|
||||||
@@ -859,13 +866,6 @@ abstract class SettingsItem(
|
|||||||
descriptionId = R.string.skip_cpu_inner_invalidation_description
|
descriptionId = R.string.skip_cpu_inner_invalidation_description
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
put(
|
|
||||||
SwitchSetting(
|
|
||||||
BooleanSetting.NCE_INVALIDATION_GPU_READBACK,
|
|
||||||
titleId = R.string.nce_invalidation_gpu_readback,
|
|
||||||
descriptionId = R.string.nce_invalidation_gpu_readback_description
|
|
||||||
)
|
|
||||||
)
|
|
||||||
put(
|
put(
|
||||||
SwitchSetting(
|
SwitchSetting(
|
||||||
BooleanSetting.FIX_BLOOM_EFFECTS,
|
BooleanSetting.FIX_BLOOM_EFFECTS,
|
||||||
|
|||||||
@@ -510,6 +510,7 @@ class SettingsFragmentPresenter(
|
|||||||
add(IntSetting.FAST_CPU_TIME.key)
|
add(IntSetting.FAST_CPU_TIME.key)
|
||||||
add(IntSetting.FAST_GPU_TIME.key)
|
add(IntSetting.FAST_GPU_TIME.key)
|
||||||
add(BooleanSetting.CORE_SYNC_CORE_SPEED.key)
|
add(BooleanSetting.CORE_SYNC_CORE_SPEED.key)
|
||||||
|
add(BooleanSetting.ENABLE_CHEATS_BY_DEFAULT.key)
|
||||||
|
|
||||||
add(IntSetting.MEMORY_LAYOUT.key)
|
add(IntSetting.MEMORY_LAYOUT.key)
|
||||||
add(BooleanSetting.USE_CUSTOM_CPU_TICKS.key)
|
add(BooleanSetting.USE_CUSTOM_CPU_TICKS.key)
|
||||||
@@ -554,7 +555,6 @@ class SettingsFragmentPresenter(
|
|||||||
add(HeaderSetting(R.string.hacks))
|
add(HeaderSetting(R.string.hacks))
|
||||||
|
|
||||||
add(BooleanSetting.SKIP_CPU_INNER_INVALIDATION.key)
|
add(BooleanSetting.SKIP_CPU_INNER_INVALIDATION.key)
|
||||||
add(BooleanSetting.NCE_INVALIDATION_GPU_READBACK.key)
|
|
||||||
add(BooleanSetting.FIX_BLOOM_EFFECTS.key)
|
add(BooleanSetting.FIX_BLOOM_EFFECTS.key)
|
||||||
add(BooleanSetting.EMULATE_BGR565.key)
|
add(BooleanSetting.EMULATE_BGR565.key)
|
||||||
add(BooleanSetting.RENDERER_ASYNCHRONOUS_SHADERS.key)
|
add(BooleanSetting.RENDERER_ASYNCHRONOUS_SHADERS.key)
|
||||||
|
|||||||
@@ -734,6 +734,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|||||||
|
|
||||||
binding.inGameMenu.menu.findItem(R.id.menu_quick_settings)?.isVisible =
|
binding.inGameMenu.menu.findItem(R.id.menu_quick_settings)?.isVisible =
|
||||||
BooleanSetting.ENABLE_QUICK_SETTINGS.getBoolean()
|
BooleanSetting.ENABLE_QUICK_SETTINGS.getBoolean()
|
||||||
|
binding.inGameMenu.menu.findItem(R.id.menu_cheats)?.isVisible = false
|
||||||
|
|
||||||
binding.pausedIcon.setOnClickListener {
|
binding.pausedIcon.setOnClickListener {
|
||||||
if (this::emulationState.isInitialized && emulationState.isPaused) {
|
if (this::emulationState.isInitialized && emulationState.isPaused) {
|
||||||
@@ -817,6 +818,12 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|||||||
|
|
||||||
R.id.menu_load_amiibo -> handleLoadAmiiboSelection()
|
R.id.menu_load_amiibo -> handleLoadAmiiboSelection()
|
||||||
|
|
||||||
|
R.id.menu_cheats -> {
|
||||||
|
binding.drawerLayout.closeDrawer(binding.inGameMenu)
|
||||||
|
showRuntimeCheatDialog()
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
R.id.menu_controls -> {
|
R.id.menu_controls -> {
|
||||||
val action = HomeNavigationDirections.actionGlobalSettingsActivity(
|
val action = HomeNavigationDirections.actionGlobalSettingsActivity(
|
||||||
null,
|
null,
|
||||||
@@ -962,6 +969,8 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|||||||
|
|
||||||
emulationState.updateSurface()
|
emulationState.updateSurface()
|
||||||
|
|
||||||
|
binding.inGameMenu.menu.findItem(R.id.menu_cheats)?.isVisible =
|
||||||
|
NativeLibrary.getRuntimeCheats().isNotEmpty()
|
||||||
updateShowStatsOverlay()
|
updateShowStatsOverlay()
|
||||||
updateSocOverlay()
|
updateSocOverlay()
|
||||||
|
|
||||||
@@ -987,6 +996,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|||||||
}
|
}
|
||||||
emulationViewModel.isEmulationStopping.collect(viewLifecycleOwner) {
|
emulationViewModel.isEmulationStopping.collect(viewLifecycleOwner) {
|
||||||
if (it) {
|
if (it) {
|
||||||
|
binding.inGameMenu.menu.findItem(R.id.menu_cheats)?.isVisible = false
|
||||||
binding.loadingText.setText(R.string.shutting_down)
|
binding.loadingText.setText(R.string.shutting_down)
|
||||||
ViewUtils.showView(binding.loadingIndicator)
|
ViewUtils.showView(binding.loadingIndicator)
|
||||||
ViewUtils.hideView(binding.inputContainer)
|
ViewUtils.hideView(binding.inputContainer)
|
||||||
@@ -1119,6 +1129,45 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|||||||
NativePostProcessing.persist()
|
NativePostProcessing.persist()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun showRuntimeCheatDialog() {
|
||||||
|
val cheats = NativeLibrary.getRuntimeCheats()
|
||||||
|
if (cheats.isEmpty()) return
|
||||||
|
|
||||||
|
val names = cheats.map { it.name.ifEmpty { getString(R.string.unnamed_cheat) } }.toTypedArray()
|
||||||
|
lateinit var dialog: androidx.appcompat.app.AlertDialog
|
||||||
|
dialog = MaterialAlertDialogBuilder(requireContext())
|
||||||
|
.setTitle(R.string.cheats)
|
||||||
|
.setMultiChoiceItems(names, cheats.map { it.enabled }.toBooleanArray()) { _, which, enabled ->
|
||||||
|
if (cheats[which].isMaster) {
|
||||||
|
dialog.listView.setItemChecked(which, true)
|
||||||
|
} else if (!NativeLibrary.setRuntimeCheatEnabled(cheats[which].id, enabled)) {
|
||||||
|
dialog.listView.setItemChecked(which, !enabled)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.setNegativeButton(R.string.disable_all_cheats) { _, _ ->
|
||||||
|
cheats.forEach {
|
||||||
|
if (!it.isMaster) NativeLibrary.setRuntimeCheatEnabled(it.id, false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.setNeutralButton(R.string.enable_all_cheats) { _, _ ->
|
||||||
|
cheats.forEach {
|
||||||
|
if (!it.isMaster) NativeLibrary.setRuntimeCheatEnabled(it.id, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.setPositiveButton(R.string.done, null)
|
||||||
|
.create()
|
||||||
|
dialog.setOnShowListener {
|
||||||
|
val listView = dialog.listView
|
||||||
|
fun updateMasterVisuals() = repeat(listView.childCount) { index ->
|
||||||
|
listView.getChildAt(index).alpha =
|
||||||
|
if (cheats[listView.firstVisiblePosition + index].isMaster) 0.38f else 1f
|
||||||
|
}
|
||||||
|
listView.setOnScrollChangeListener { _, _, _, _, _ -> updateMasterVisuals() }
|
||||||
|
updateMasterVisuals()
|
||||||
|
}
|
||||||
|
dialog.show()
|
||||||
|
}
|
||||||
|
|
||||||
private fun addQuickSettings() {
|
private fun addQuickSettings() {
|
||||||
binding.quickSettingsSheet.apply {
|
binding.quickSettingsSheet.apply {
|
||||||
val container = binding.quickSettingsSheet.findViewById<ViewGroup>(R.id.quick_settings_container)
|
val container = binding.quickSettingsSheet.findViewById<ViewGroup>(R.id.quick_settings_container)
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class Game(
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val extensions: Set<String> = HashSet(
|
val extensions: Set<String> = HashSet(
|
||||||
listOf("xci", "nsp", "nca", "nro")
|
listOf("xci", "nsp", "nca", "nro", "nsz", "xcz")
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ object GameHelper {
|
|||||||
|
|
||||||
// File extensions considered as external content, buuut should
|
// File extensions considered as external content, buuut should
|
||||||
// be done better imo.
|
// be done better imo.
|
||||||
private val externalContentExtensions = setOf("nsp", "xci")
|
private val externalContentExtensions = setOf("nsp", "xci", "nsz", "xcz")
|
||||||
|
|
||||||
private fun scanContentContainersRecursive(
|
private fun scanContentContainersRecursive(
|
||||||
files: Array<MinimalDocumentFile>,
|
files: Array<MinimalDocumentFile>,
|
||||||
|
|||||||
@@ -76,7 +76,9 @@ jboolean Java_org_yuzu_yuzu_1emu_utils_GameMetadata_getIsValid(JNIEnv* env, jobj
|
|||||||
auto const file_type = loader->GetFileType();
|
auto const file_type = loader->GetFileType();
|
||||||
if (file_type == Loader::FileType::Unknown || file_type == Loader::FileType::Error)
|
if (file_type == Loader::FileType::Unknown || file_type == Loader::FileType::Error)
|
||||||
return false;
|
return false;
|
||||||
if ((file_type == Loader::FileType::NSP || file_type == Loader::FileType::XCI) && !Loader::IsBootableGameContainer(file, file_type))
|
if ((file_type == Loader::FileType::NSP || file_type == Loader::FileType::XCI ||
|
||||||
|
file_type == Loader::FileType::NSZ || file_type == Loader::FileType::XCZ) &&
|
||||||
|
!Loader::IsBootableGameContainer(file, file_type))
|
||||||
return false;
|
return false;
|
||||||
u64 program_id = 0;
|
u64 program_id = 0;
|
||||||
return loader->ReadProgramId(program_id) == Loader::ResultStatus::Success;
|
return loader->ReadProgramId(program_id) == Loader::ResultStatus::Success;
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ extern "C" {
|
|||||||
#include "core/file_sys/submission_package.h"
|
#include "core/file_sys/submission_package.h"
|
||||||
#include "core/file_sys/vfs/vfs.h"
|
#include "core/file_sys/vfs/vfs.h"
|
||||||
#include "core/file_sys/vfs/vfs_real.h"
|
#include "core/file_sys/vfs/vfs_real.h"
|
||||||
|
#include "core/memory/dmnt_cheat_types.h"
|
||||||
#include "core/frontend/applets/cabinet.h"
|
#include "core/frontend/applets/cabinet.h"
|
||||||
#include "core/frontend/applets/controller.h"
|
#include "core/frontend/applets/controller.h"
|
||||||
#include "core/frontend/applets/error.h"
|
#include "core/frontend/applets/error.h"
|
||||||
@@ -946,6 +947,31 @@ jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_isPaused(JNIEnv* env, jclass claz
|
|||||||
return static_cast<jboolean>(EmulationSession::GetInstance().IsPaused());
|
return static_cast<jboolean>(EmulationSession::GetInstance().IsPaused());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jobjectArray Java_org_yuzu_yuzu_1emu_NativeLibrary_getRuntimeCheats(JNIEnv* env, jclass clazz) {
|
||||||
|
const auto cheats = EmulationSession::GetInstance().System().GetRuntimeCheats();
|
||||||
|
const auto runtime_cheat_class = env->FindClass("org/yuzu/yuzu_emu/NativeLibrary$RuntimeCheat");
|
||||||
|
const auto constructor = env->GetMethodID(runtime_cheat_class, "<init>", "(ILjava/lang/String;ZZ)V");
|
||||||
|
auto result = env->NewObjectArray(static_cast<jsize>(cheats.size()), runtime_cheat_class, nullptr);
|
||||||
|
for (jsize i = 0; i < static_cast<jsize>(cheats.size()); ++i) {
|
||||||
|
const auto& cheat = cheats[i];
|
||||||
|
const auto name = Common::Android::ToJString(env, cheat.name);
|
||||||
|
const auto item = env->NewObject(runtime_cheat_class, constructor, static_cast<jint>(cheat.id), name,
|
||||||
|
static_cast<jboolean>(cheat.enabled),
|
||||||
|
static_cast<jboolean>(cheat.is_master));
|
||||||
|
env->SetObjectArrayElement(result, i, item);
|
||||||
|
env->DeleteLocalRef(name);
|
||||||
|
env->DeleteLocalRef(item);
|
||||||
|
}
|
||||||
|
env->DeleteLocalRef(runtime_cheat_class);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_setRuntimeCheatEnabled(JNIEnv* env, jclass clazz,
|
||||||
|
jint id, jboolean enabled) {
|
||||||
|
return static_cast<jboolean>(EmulationSession::GetInstance().System().SetCheatEnabled(
|
||||||
|
static_cast<u32>(id), static_cast<bool>(enabled)));
|
||||||
|
}
|
||||||
|
|
||||||
jbyteArray Java_org_yuzu_yuzu_1emu_NativeLibrary_getAppletCaptureBuffer(JNIEnv* env, jclass clazz) {
|
jbyteArray Java_org_yuzu_yuzu_1emu_NativeLibrary_getAppletCaptureBuffer(JNIEnv* env, jclass clazz) {
|
||||||
using namespace VideoCore::Capture;
|
using namespace VideoCore::Capture;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
|
android:viewportWidth="212"
|
||||||
|
android:viewportHeight="212"
|
||||||
|
android:width="212dp"
|
||||||
|
android:height="212dp">
|
||||||
|
<group
|
||||||
|
android:translateX="6"
|
||||||
|
android:translateY="6">
|
||||||
|
<path
|
||||||
|
android:pathData="M58 168v-98a50 50 0 0 1 50 -50h20"
|
||||||
|
android:strokeColor="#FFFFFF"
|
||||||
|
android:strokeWidth="25" />
|
||||||
|
<path
|
||||||
|
android:pathData="M58 168v-30a50 50 0 0 1 50 -50h20"
|
||||||
|
android:strokeColor="#FFFFFF"
|
||||||
|
android:strokeWidth="25" />
|
||||||
|
<path
|
||||||
|
android:pathData="M160 20A18 18 0 0 1 124 20A18 18 0 0 1 160 20Z"
|
||||||
|
android:strokeColor="#FFFFFF"
|
||||||
|
android:strokeWidth="15" />
|
||||||
|
<path
|
||||||
|
android:pathData="M160 88A18 18 0 0 1 124 88A18 18 0 0 1 160 88Z"
|
||||||
|
android:strokeColor="#FFFFFF"
|
||||||
|
android:strokeWidth="15" />
|
||||||
|
<path
|
||||||
|
android:pathData="M76 180A18 18 0 0 1 40 180A18 18 0 0 1 76 180Z"
|
||||||
|
android:strokeColor="#FFFFFF"
|
||||||
|
android:strokeWidth="15" />
|
||||||
|
</group>
|
||||||
|
</vector>
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="98dp"
|
|
||||||
android:height="96dp"
|
|
||||||
android:viewportWidth="98"
|
|
||||||
android:viewportHeight="96">
|
|
||||||
<path
|
|
||||||
android:fillColor="?attr/colorControlNormal"
|
|
||||||
android:fillType="evenOdd"
|
|
||||||
android:pathData="M48.854,0C21.839,0 0,22 0,49.217c0,21.756 13.993,40.172 33.405,46.69 2.427,0.49 3.316,-1.059 3.316,-2.362 0,-1.141 -0.08,-5.052 -0.08,-9.127 -13.59,2.934 -16.42,-5.867 -16.42,-5.867 -2.184,-5.704 -5.42,-7.17 -5.42,-7.17 -4.448,-3.015 0.324,-3.015 0.324,-3.015 4.934,0.326 7.523,5.052 7.523,5.052 4.367,7.496 11.404,5.378 14.235,4.074 0.404,-3.178 1.699,-5.378 3.074,-6.6 -10.839,-1.141 -22.243,-5.378 -22.243,-24.283 0,-5.378 1.94,-9.778 5.014,-13.2 -0.485,-1.222 -2.184,-6.275 0.486,-13.038 0,0 4.125,-1.304 13.426,5.052a46.97,46.97 0,0 1,12.214 -1.63c4.125,0 8.33,0.571 12.213,1.63 9.302,-6.356 13.427,-5.052 13.427,-5.052 2.67,6.763 0.97,11.816 0.485,13.038 3.155,3.422 5.015,7.822 5.015,13.2 0,18.905 -11.404,23.06 -22.324,24.283 1.78,1.548 3.316,4.481 3.316,9.126 0,6.6 -0.08,11.897 -0.08,13.526 0,1.304 0.89,2.853 3.316,2.364 19.412,-6.52 33.405,-24.935 33.405,-46.691C97.707,22 75.788,0 48.854,0z" />
|
|
||||||
</vector>
|
|
||||||
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 56 KiB |
@@ -250,7 +250,7 @@
|
|||||||
style="@style/EdenButton.Secondary"
|
style="@style/EdenButton.Secondary"
|
||||||
android:layout_width="56dp"
|
android:layout_width="56dp"
|
||||||
android:layout_height="56dp"
|
android:layout_height="56dp"
|
||||||
app:icon="@drawable/ic_github"
|
app:icon="@drawable/ic_forgejo"
|
||||||
app:iconGravity="textStart"
|
app:iconGravity="textStart"
|
||||||
app:iconSize="24dp"
|
app:iconSize="24dp"
|
||||||
app:iconPadding="0dp" />
|
app:iconPadding="0dp" />
|
||||||
|
|||||||
@@ -259,7 +259,7 @@
|
|||||||
android:layout_height="56dp"
|
android:layout_height="56dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
app:icon="@drawable/ic_github"
|
app:icon="@drawable/ic_forgejo"
|
||||||
app:iconSize="24dp"
|
app:iconSize="24dp"
|
||||||
app:iconGravity="textStart"
|
app:iconGravity="textStart"
|
||||||
app:iconPadding="0dp"
|
app:iconPadding="0dp"
|
||||||
|
|||||||
@@ -43,6 +43,10 @@
|
|||||||
android:icon="@drawable/ic_nfc"
|
android:icon="@drawable/ic_nfc"
|
||||||
android:title="@string/load_amiibo" />
|
android:title="@string/load_amiibo" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_cheats"
|
||||||
|
android:icon="@drawable/ic_code"
|
||||||
|
android:title="@string/cheats" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_overlay_controls"
|
android:id="@+id/menu_overlay_controls"
|
||||||
|
|||||||
@@ -587,8 +587,6 @@
|
|||||||
<string name="fast_gpu_time_description">يجعل اللعبة تعتقد أن عمل وحدة معالجة الرسومات ينتهي بشكل أسرع مما هو عليه في الواقع، لذلك تتوقف عن خفض الدقة ومسافة العرض لتتناسب مع سرعات جهاز Switch.</string>
|
<string name="fast_gpu_time_description">يجعل اللعبة تعتقد أن عمل وحدة معالجة الرسومات ينتهي بشكل أسرع مما هو عليه في الواقع، لذلك تتوقف عن خفض الدقة ومسافة العرض لتتناسب مع سرعات جهاز Switch.</string>
|
||||||
<string name="skip_cpu_inner_invalidation">تخطي إبطال صلاحية وحدة المعالجة المركزية الداخلية</string>
|
<string name="skip_cpu_inner_invalidation">تخطي إبطال صلاحية وحدة المعالجة المركزية الداخلية</string>
|
||||||
<string name="skip_cpu_inner_invalidation_description">يتخطى بعض عمليات إبطال ذاكرة التخزين المؤقتة من جانب وحدة المعالجة المركزية أثناء تحديثات الذاكرة، مما يقلل من استخدام وحدة المعالجة المركزية ويحسن أداءها. قد يتسبب ذلك في حدوث أعطال أو تعطل في بعض الألعاب.</string>
|
<string name="skip_cpu_inner_invalidation_description">يتخطى بعض عمليات إبطال ذاكرة التخزين المؤقتة من جانب وحدة المعالجة المركزية أثناء تحديثات الذاكرة، مما يقلل من استخدام وحدة المعالجة المركزية ويحسن أداءها. قد يتسبب ذلك في حدوث أعطال أو تعطل في بعض الألعاب.</string>
|
||||||
<string name="nce_invalidation_gpu_readback">إعادة قراءة وحدة معالجة الرسومات قبل إبطال صلاحية NCE</string>
|
|
||||||
<string name="nce_invalidation_gpu_readback_description">إصلاح مؤقت. يعالج مشكلة تعطل لعبة Ender Magnolia (وغيرها من ألعاب UE). قد يؤدي إلى انخفاض في الأداء. يجري العمل على تحسينه.</string>
|
|
||||||
<string name="fix_bloom_effects">إصلاح تأثيرات التوهج</string>
|
<string name="fix_bloom_effects">إصلاح تأثيرات التوهج</string>
|
||||||
<string name="fix_bloom_effects_description">يقلل من ضبابية التوهج في LA/EOW (Adreno A6XX - A7XX/ Turnip)، ويزيل التوهج في Burnout. تحذير: قد يسبب تشوهات رسومية في ألعاب أخرى.</string>
|
<string name="fix_bloom_effects_description">يقلل من ضبابية التوهج في LA/EOW (Adreno A6XX - A7XX/ Turnip)، ويزيل التوهج في Burnout. تحذير: قد يسبب تشوهات رسومية في ألعاب أخرى.</string>
|
||||||
<string name="emulate_bgr565">محاكاة BGR565</string>
|
<string name="emulate_bgr565">محاكاة BGR565</string>
|
||||||
|
|||||||
@@ -577,8 +577,6 @@
|
|||||||
<string name="fast_gpu_time_description">讓遊戲誤以為 GPU 工作能更快完成,避免遊戲為了配合 Switch 的時脈而降低解析度與渲染距離</string>
|
<string name="fast_gpu_time_description">讓遊戲誤以為 GPU 工作能更快完成,避免遊戲為了配合 Switch 的時脈而降低解析度與渲染距離</string>
|
||||||
<string name="skip_cpu_inner_invalidation">跳過 CPU 內部失效處理</string>
|
<string name="skip_cpu_inner_invalidation">跳過 CPU 內部失效處理</string>
|
||||||
<string name="skip_cpu_inner_invalidation_description">在記憶體更新期間跳過某些 CPU 端快取的失效處理,減少 CPU 使用率並提高其性能。可能會導致某些遊戲出現故障或當機</string>
|
<string name="skip_cpu_inner_invalidation_description">在記憶體更新期間跳過某些 CPU 端快取的失效處理,減少 CPU 使用率並提高其性能。可能會導致某些遊戲出現故障或當機</string>
|
||||||
<string name="nce_invalidation_gpu_readback">在 NCE 無效化前進行 GPU 回讀</string>
|
|
||||||
<string name="nce_invalidation_gpu_readback_description">(暫時性功能)修復 \"終結者瑪格諾莉亞:霧中綻放\" 及其它使用虛幻引擎之遊戲中的當機問題,可能會降低效能。此功能正在改善中</string>
|
|
||||||
<string name="fix_bloom_effects">修正光暈特效</string>
|
<string name="fix_bloom_effects">修正光暈特效</string>
|
||||||
<string name="fix_bloom_effects_description">在 \"薩爾達傳說:織夢島\" 和 \"薩爾達傳說:智慧的再現\" 中減少光暈模糊的問題並移除 \"橫衝直撞:狂飆樂園重製版\" 中的光暈效果(適用於 Adreno A6XX - A7XX/ Turnip)。警告:可能會在其它遊戲中導致圖形異常</string>
|
<string name="fix_bloom_effects_description">在 \"薩爾達傳說:織夢島\" 和 \"薩爾達傳說:智慧的再現\" 中減少光暈模糊的問題並移除 \"橫衝直撞:狂飆樂園重製版\" 中的光暈效果(適用於 Adreno A6XX - A7XX/ Turnip)。警告:可能會在其它遊戲中導致圖形異常</string>
|
||||||
<string name="emulate_bgr565">模擬 BGR565</string>
|
<string name="emulate_bgr565">模擬 BGR565</string>
|
||||||
|
|||||||
@@ -593,10 +593,8 @@
|
|||||||
<string name="fast_gpu_time_description">Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch\'s clocks.</string>
|
<string name="fast_gpu_time_description">Makes the game believe GPU work finishes faster than it does, so it stops lowering resolution and render distance to fit the Switch\'s clocks.</string>
|
||||||
<string name="skip_cpu_inner_invalidation">Skip CPU Inner Invalidation</string>
|
<string name="skip_cpu_inner_invalidation">Skip CPU Inner Invalidation</string>
|
||||||
<string name="skip_cpu_inner_invalidation_description">Skips certain CPU-side cache invalidations during memory updates, reducing CPU usage and improving it\'s performance. This may cause glitches or crashes on some games.</string>
|
<string name="skip_cpu_inner_invalidation_description">Skips certain CPU-side cache invalidations during memory updates, reducing CPU usage and improving it\'s performance. This may cause glitches or crashes on some games.</string>
|
||||||
<string name="nce_invalidation_gpu_readback">GPU Readback Before NCE Invalidation</string>
|
|
||||||
<string name="nce_invalidation_gpu_readback_description">Temporary. Fix Ender Magnolia (and other UE titles) crashes. May reduce performance. Improvement in progress.</string>
|
|
||||||
<string name="fix_bloom_effects">Fix Bloom Effects</string>
|
<string name="fix_bloom_effects">Fix Bloom Effects</string>
|
||||||
<string name="fix_bloom_effects_description">Reduces bloom blur in LA/EOW (Adreno A6XX - A7XX/ Turnip), removes bloom in Burnout. Warning: may cause graphical artifacts in other games.</string>
|
<string name="fix_bloom_effects_description">Removes bloom in Burnout.</string>
|
||||||
<string name="emulate_bgr565">Emulate BGR565</string>
|
<string name="emulate_bgr565">Emulate BGR565</string>
|
||||||
<string name="emulate_bgr565_description">Fixes problems with inverted colors in games or strange artifacts or strange shadows.</string>
|
<string name="emulate_bgr565_description">Fixes problems with inverted colors in games or strange artifacts or strange shadows.</string>
|
||||||
<string name="rescale_hack">Enable Legacy Rescale Pass</string>
|
<string name="rescale_hack">Enable Legacy Rescale Pass</string>
|
||||||
@@ -842,6 +840,12 @@
|
|||||||
<string name="preferences_graphics">Graphics</string>
|
<string name="preferences_graphics">Graphics</string>
|
||||||
<string name="preferences_graphics_description">Accuracy level, resolution, shader cache</string>
|
<string name="preferences_graphics_description">Accuracy level, resolution, shader cache</string>
|
||||||
<string name="quick_settings">Quick Settings</string>
|
<string name="quick_settings">Quick Settings</string>
|
||||||
|
<string name="cheats">Cheats</string>
|
||||||
|
<string name="enable_all_cheats">Enable All Cheats</string>
|
||||||
|
<string name="disable_all_cheats">Disable All Cheats</string>
|
||||||
|
<string name="unnamed_cheat">Unnamed Cheat</string>
|
||||||
|
<string name="enable_cheats_by_default">Enable cheats by default</string>
|
||||||
|
<string name="enable_cheats_by_default_description">Enable regular cheats when a game starts</string>
|
||||||
<string name="enable_quick_settings">Enable Quick Settings</string>
|
<string name="enable_quick_settings">Enable Quick Settings</string>
|
||||||
<string name="enable_quick_settings_description">Allow access to quick settings menu via swipe and menu button</string>
|
<string name="enable_quick_settings_description">Allow access to quick settings menu via swipe and menu button</string>
|
||||||
<string name="preferences_audio">Audio</string>
|
<string name="preferences_audio">Audio</string>
|
||||||
|
|||||||
@@ -418,6 +418,10 @@ void SetGlobalFilter(const Filter& filter) {
|
|||||||
logging_instance->filter = filter;
|
logging_instance->filter = filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsMessageEnabled(Class log_class, Level log_level) {
|
||||||
|
return logging_instance && logging_instance->filter.CheckMessage(log_class, log_level);
|
||||||
|
}
|
||||||
|
|
||||||
void SetColorConsoleBackendEnabled(bool enabled) {
|
void SetColorConsoleBackendEnabled(bool enabled) {
|
||||||
if (logging_instance)
|
if (logging_instance)
|
||||||
logging_instance->color_console_backend.enabled = enabled;
|
logging_instance->color_console_backend.enabled = enabled;
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ void Stop();
|
|||||||
|
|
||||||
/// The global filter will prevent any messages from even being processed if they are filtered.
|
/// The global filter will prevent any messages from even being processed if they are filtered.
|
||||||
void SetGlobalFilter(const Filter& filter);
|
void SetGlobalFilter(const Filter& filter);
|
||||||
|
[[nodiscard]] bool IsMessageEnabled(Class log_class, Level log_level);
|
||||||
void SetColorConsoleBackendEnabled(bool enabled);
|
void SetColorConsoleBackendEnabled(bool enabled);
|
||||||
|
|
||||||
} // namespace Common::Log
|
} // namespace Common::Log
|
||||||
|
|||||||
@@ -247,6 +247,7 @@ struct Values {
|
|||||||
|
|
||||||
SwitchableSetting<bool> sync_core_speed{linkage, false, "sync_core_speed", Category::Core,
|
SwitchableSetting<bool> sync_core_speed{linkage, false, "sync_core_speed", Category::Core,
|
||||||
Specialization::Default};
|
Specialization::Default};
|
||||||
|
SwitchableSetting<bool> enable_cheats_by_default{linkage, true, "enable_cheats_by_default", Category::Core};
|
||||||
|
|
||||||
// Cpu
|
// Cpu
|
||||||
SwitchableSetting<CpuBackend, true> cpu_backend{linkage,
|
SwitchableSetting<CpuBackend, true> cpu_backend{linkage,
|
||||||
@@ -639,8 +640,6 @@ struct Values {
|
|||||||
Specialization::Default,
|
Specialization::Default,
|
||||||
true,
|
true,
|
||||||
true};
|
true};
|
||||||
SwitchableSetting<bool> nce_invalidation_gpu_readback{
|
|
||||||
linkage, false, "nce_invalidation_gpu_readback", Category::RendererHacks};
|
|
||||||
SwitchableSetting<bool> async_presentation{linkage,
|
SwitchableSetting<bool> async_presentation{linkage,
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
true,
|
true,
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
@@ -46,4 +49,10 @@ std::vector<u8> DecompressDataZSTD(std::span<const u8> compressed) {
|
|||||||
return decompressed;
|
return decompressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::size_t DecompressDataZSTD(std::span<const u8> compressed, std::span<u8> output) {
|
||||||
|
const std::size_t result =
|
||||||
|
ZSTD_decompress(output.data(), output.size(), compressed.data(), compressed.size());
|
||||||
|
return ZSTD_isError(result) ? 0 : result;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Common::Compression
|
} // namespace Common::Compression
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
@@ -42,4 +45,15 @@ namespace Common::Compression {
|
|||||||
*/
|
*/
|
||||||
[[nodiscard]] std::vector<u8> DecompressDataZSTD(std::span<const u8> compressed);
|
[[nodiscard]] std::vector<u8> DecompressDataZSTD(std::span<const u8> compressed);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decompresses a single Zstandard frame into a caller-provided buffer of known size.
|
||||||
|
*
|
||||||
|
* @param compressed the compressed source memory region.
|
||||||
|
* @param output the destination buffer. Its size is the maximum number of bytes to write.
|
||||||
|
*
|
||||||
|
* @return the number of bytes written, or 0 if the frame is invalid or doesn't fit. An empty
|
||||||
|
* frame also returns 0.
|
||||||
|
*/
|
||||||
|
[[nodiscard]] std::size_t DecompressDataZSTD(std::span<const u8> compressed, std::span<u8> output);
|
||||||
|
|
||||||
} // namespace Common::Compression
|
} // namespace Common::Compression
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ add_library(core STATIC
|
|||||||
crypto/encryption_layer.h
|
crypto/encryption_layer.h
|
||||||
crypto/key_manager.cpp
|
crypto/key_manager.cpp
|
||||||
crypto/key_manager.h
|
crypto/key_manager.h
|
||||||
|
crypto/ncz_decompressor.cpp
|
||||||
|
crypto/ncz_decompressor.h
|
||||||
crypto/partition_data_manager.cpp
|
crypto/partition_data_manager.cpp
|
||||||
crypto/partition_data_manager.h
|
crypto/partition_data_manager.h
|
||||||
crypto/xts_encryption_layer.cpp
|
crypto/xts_encryption_layer.cpp
|
||||||
|
|||||||
@@ -369,8 +369,8 @@ void ArmNce::SetContext(const Kernel::Svc::ThreadContext& ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ArmNce::SignalInterrupt(Kernel::KThread* thread) {
|
void ArmNce::SignalInterrupt(Kernel::KThread* thread) {
|
||||||
// Add break loop condition.
|
constexpr u64 break_loop = static_cast<u64>(HaltReason::BreakLoop);
|
||||||
m_guest_ctx.esr_el1.fetch_or(static_cast<u64>(HaltReason::BreakLoop));
|
if ((m_guest_ctx.esr_el1.fetch_or(break_loop) & break_loop) != 0) return;
|
||||||
|
|
||||||
auto* params = &thread->GetNativeExecutionParameters();
|
auto* params = &thread->GetNativeExecutionParameters();
|
||||||
LockThreadParameters(params);
|
LockThreadParameters(params);
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <unordered_map>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "game_settings.h"
|
#include "game_settings.h"
|
||||||
@@ -249,30 +248,12 @@ struct System::Impl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotifyNVDECChannelOpen(u64 process_id) {
|
void SetNVDECActive(bool is_nvdec_active) {
|
||||||
std::scoped_lock lock{nvdec_active_mutex};
|
nvdec_active = is_nvdec_active;
|
||||||
++nvdec_active_channels[process_id];
|
|
||||||
}
|
|
||||||
|
|
||||||
void NotifyNVDECChannelClose(u64 process_id) {
|
|
||||||
std::scoped_lock lock{nvdec_active_mutex};
|
|
||||||
const auto it = nvdec_active_channels.find(process_id);
|
|
||||||
if (it == nvdec_active_channels.end()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (--it->second == 0) {
|
|
||||||
nvdec_active_channels.erase(it);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetNVDECActive() {
|
bool GetNVDECActive() {
|
||||||
std::scoped_lock lock{nvdec_active_mutex};
|
return nvdec_active;
|
||||||
return !nvdec_active_channels.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsNVDECActiveForProcess(u64 process_id) {
|
|
||||||
std::scoped_lock lock{nvdec_active_mutex};
|
|
||||||
return nvdec_active_channels.contains(process_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitializeDebugger(System& system, u16 port) {
|
void InitializeDebugger(System& system, u16 port) {
|
||||||
@@ -528,8 +509,6 @@ struct System::Impl {
|
|||||||
|
|
||||||
mutable std::mutex suspend_guard;
|
mutable std::mutex suspend_guard;
|
||||||
std::mutex general_channel_mutex;
|
std::mutex general_channel_mutex;
|
||||||
std::mutex nvdec_active_mutex;
|
|
||||||
std::unordered_map<u64, u32> nvdec_active_channels;
|
|
||||||
std::atomic_bool is_paused{};
|
std::atomic_bool is_paused{};
|
||||||
std::atomic_bool is_shutting_down{};
|
std::atomic_bool is_shutting_down{};
|
||||||
std::atomic_bool is_powered_on{};
|
std::atomic_bool is_powered_on{};
|
||||||
@@ -537,6 +516,7 @@ struct System::Impl {
|
|||||||
bool extended_memory_layout : 1 = false;
|
bool extended_memory_layout : 1 = false;
|
||||||
bool exit_locked : 1 = false;
|
bool exit_locked : 1 = false;
|
||||||
bool exit_requested : 1 = false;
|
bool exit_requested : 1 = false;
|
||||||
|
bool nvdec_active : 1 = false;
|
||||||
|
|
||||||
void EnsureGeneralChannelInitialized(System& system) {
|
void EnsureGeneralChannelInitialized(System& system) {
|
||||||
if (!general_channel_event) {
|
if (!general_channel_event) {
|
||||||
@@ -600,22 +580,14 @@ void System::UnstallApplication() {
|
|||||||
impl->UnstallApplication();
|
impl->UnstallApplication();
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::NotifyNVDECChannelOpen(u64 process_id) {
|
void System::SetNVDECActive(bool is_nvdec_active) {
|
||||||
impl->NotifyNVDECChannelOpen(process_id);
|
impl->SetNVDECActive(is_nvdec_active);
|
||||||
}
|
|
||||||
|
|
||||||
void System::NotifyNVDECChannelClose(u64 process_id) {
|
|
||||||
impl->NotifyNVDECChannelClose(process_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool System::GetNVDECActive() {
|
bool System::GetNVDECActive() {
|
||||||
return impl->GetNVDECActive();
|
return impl->GetNVDECActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool System::IsNVDECActiveForProcess(u64 process_id) {
|
|
||||||
return impl->IsNVDECActiveForProcess(process_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void System::InitializeDebugger() {
|
void System::InitializeDebugger() {
|
||||||
impl->InitializeDebugger(*this, Settings::values.gdbstub_port.GetValue());
|
impl->InitializeDebugger(*this, Settings::values.gdbstub_port.GetValue());
|
||||||
}
|
}
|
||||||
@@ -814,6 +786,17 @@ void System::RegisterCheatList(const std::vector<Memory::CheatEntry>& list,
|
|||||||
impl->cheat_engine->SetMainMemoryParameters(main_region_begin, main_region_size);
|
impl->cheat_engine->SetMainMemoryParameters(main_region_begin, main_region_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<Memory::RuntimeCheatInfo> System::GetRuntimeCheats() const {
|
||||||
|
if (!impl->cheat_engine) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
return impl->cheat_engine->GetCheats();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool System::SetCheatEnabled(u32 cheat_id, bool enabled) {
|
||||||
|
return impl->cheat_engine && impl->cheat_engine->SetCheatEnabled(cheat_id, enabled);
|
||||||
|
}
|
||||||
|
|
||||||
void System::SetFrontendAppletSet(Service::AM::Frontend::FrontendAppletSet&& set) {
|
void System::SetFrontendAppletSet(Service::AM::Frontend::FrontendAppletSet&& set) {
|
||||||
impl->frontend_applets.SetFrontendAppletSet(std::move(set));
|
impl->frontend_applets.SetFrontendAppletSet(std::move(set));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ enum class ResultStatus : u16;
|
|||||||
|
|
||||||
namespace Core::Memory {
|
namespace Core::Memory {
|
||||||
struct CheatEntry;
|
struct CheatEntry;
|
||||||
|
struct RuntimeCheatInfo;
|
||||||
class Memory;
|
class Memory;
|
||||||
} // namespace Core::Memory
|
} // namespace Core::Memory
|
||||||
|
|
||||||
@@ -191,10 +192,8 @@ public:
|
|||||||
std::unique_lock<std::mutex> StallApplication();
|
std::unique_lock<std::mutex> StallApplication();
|
||||||
void UnstallApplication();
|
void UnstallApplication();
|
||||||
|
|
||||||
void NotifyNVDECChannelOpen(u64 process_id);
|
void SetNVDECActive(bool is_nvdec_active);
|
||||||
void NotifyNVDECChannelClose(u64 process_id);
|
|
||||||
[[nodiscard]] bool GetNVDECActive();
|
[[nodiscard]] bool GetNVDECActive();
|
||||||
[[nodiscard]] bool IsNVDECActiveForProcess(u64 process_id);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the debugger.
|
* Initialize the debugger.
|
||||||
@@ -344,6 +343,8 @@ public:
|
|||||||
void RegisterCheatList(const std::vector<Memory::CheatEntry>& list,
|
void RegisterCheatList(const std::vector<Memory::CheatEntry>& list,
|
||||||
const std::array<u8, 0x20>& build_id, u64 main_region_begin,
|
const std::array<u8, 0x20>& build_id, u64 main_region_begin,
|
||||||
u64 main_region_size);
|
u64 main_region_size);
|
||||||
|
[[nodiscard]] std::vector<Memory::RuntimeCheatInfo> GetRuntimeCheats() const;
|
||||||
|
bool SetCheatEnabled(u32 cheat_id, bool enabled);
|
||||||
|
|
||||||
void SetFrontendAppletSet(Service::AM::Frontend::FrontendAppletSet&& set);
|
void SetFrontendAppletSet(Service::AM::Frontend::FrontendAppletSet&& set);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,472 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <array>
|
||||||
|
#include <cstring>
|
||||||
|
#include <memory>
|
||||||
|
#include <mutex>
|
||||||
|
#include <optional>
|
||||||
|
#include <span>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include <zstd.h>
|
||||||
|
|
||||||
|
#include "common/common_types.h"
|
||||||
|
#include "common/logging.h"
|
||||||
|
#include "common/zstd_compression.h"
|
||||||
|
#include "core/crypto/aes_util.h"
|
||||||
|
#include "core/crypto/key_manager.h"
|
||||||
|
#include "core/crypto/ncz_decompressor.h"
|
||||||
|
#include "core/file_sys/vfs/vfs.h"
|
||||||
|
|
||||||
|
namespace Core::Crypto {
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
constexpr u64 HeaderSize = 0x4000;
|
||||||
|
constexpr std::size_t SectionWire = 0x40;
|
||||||
|
constexpr std::size_t BlockFixed = 0x18;
|
||||||
|
constexpr std::size_t Chunk = 0x100000;
|
||||||
|
// Upper bound on NCZ section entries (64 bytes each, so the table is at most 4 MiB). A base NCA
|
||||||
|
// has a handful of sections, but nsz stores an update's patch (BKTR) data one entry per
|
||||||
|
// subsection, which is thousands of them.
|
||||||
|
constexpr u64 MaxSectionCount = 0x10000;
|
||||||
|
constexpr std::array<u8, 8> SectionsMagic{'N', 'C', 'Z', 'S', 'E', 'C', 'T', 'N'};
|
||||||
|
constexpr std::array<u8, 8> BlockMagic{'N', 'C', 'Z', 'B', 'L', 'O', 'C', 'K'};
|
||||||
|
|
||||||
|
struct Section {
|
||||||
|
s64 offset, size;
|
||||||
|
u64 crypto_type;
|
||||||
|
Key128 key, counter;
|
||||||
|
bool Ctr() const { return crypto_type == 3 || crypto_type == 4; }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct BlockHeader {
|
||||||
|
u32 exponent;
|
||||||
|
u64 decompressed_size;
|
||||||
|
std::vector<u32> sizes;
|
||||||
|
};
|
||||||
|
|
||||||
|
u64 Le(const u8* p, std::size_t n) {
|
||||||
|
u64 v = 0;
|
||||||
|
for (std::size_t i = n; i-- > 0;) v = (v << 8) | p[i];
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mirrors nsz AESCTR.seek(): upper 8 bytes = stored counter, lower 8 = absolute NCA offset / 16.
|
||||||
|
void SetIv(Key128& iv, const Key128& base, u64 off) {
|
||||||
|
iv = base;
|
||||||
|
u64 blk = off >> 4;
|
||||||
|
for (std::size_t i = 0; i < 8; ++i) { iv[15 - i] = static_cast<u8>(blk & 0xFF); blk >>= 8; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse header + section table + optional block header. Returns payload_start.
|
||||||
|
std::optional<std::pair<std::vector<Section>, std::optional<BlockHeader>>> ParseHeader(
|
||||||
|
const FileSys::VirtualFile& f, u64& payload_start) {
|
||||||
|
const u64 fsize = f->GetSize();
|
||||||
|
if (fsize < HeaderSize + 16) return std::nullopt;
|
||||||
|
|
||||||
|
const auto head = f->ReadBytes(16, HeaderSize);
|
||||||
|
if (head.size() != 16 || !std::equal(head.begin(), head.begin() + 8, SectionsMagic.begin()))
|
||||||
|
return std::nullopt;
|
||||||
|
const u64 count = Le(head.data() + 8, 8);
|
||||||
|
if (count == 0 || count > MaxSectionCount || count * SectionWire > fsize - HeaderSize - 16)
|
||||||
|
return std::nullopt;
|
||||||
|
|
||||||
|
const auto table = f->ReadBytes(count * SectionWire, HeaderSize + 16);
|
||||||
|
if (table.size() != count * SectionWire) return std::nullopt;
|
||||||
|
|
||||||
|
std::vector<Section> sections;
|
||||||
|
sections.reserve(count + 1);
|
||||||
|
for (u64 i = 0; i < count; ++i) {
|
||||||
|
const u8* e = table.data() + i * SectionWire;
|
||||||
|
Section s{};
|
||||||
|
s.offset = static_cast<s64>(Le(e, 8));
|
||||||
|
s.size = static_cast<s64>(Le(e + 8, 8));
|
||||||
|
s.crypto_type = Le(e + 16, 8);
|
||||||
|
std::memcpy(s.key.data(), e + 32, 16);
|
||||||
|
std::memcpy(s.counter.data(), e + 48, 16);
|
||||||
|
sections.push_back(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
const u64 block_start = HeaderSize + 16 + count * SectionWire;
|
||||||
|
const auto fixed = f->ReadBytes(BlockFixed, block_start);
|
||||||
|
std::optional<BlockHeader> bh;
|
||||||
|
if (fixed.size() == BlockFixed &&
|
||||||
|
std::equal(fixed.begin(), fixed.begin() + 8, BlockMagic.begin())) {
|
||||||
|
BlockHeader b{};
|
||||||
|
b.exponent = fixed[11];
|
||||||
|
const s32 n = static_cast<s32>(Le(fixed.data() + 12, 4));
|
||||||
|
if (n <= 0) return std::nullopt;
|
||||||
|
b.decompressed_size = Le(fixed.data() + 16, 8);
|
||||||
|
const auto sizes = f->ReadBytes(static_cast<u64>(n) * 4, block_start + BlockFixed);
|
||||||
|
if (sizes.size() != static_cast<u64>(n) * 4) return std::nullopt;
|
||||||
|
b.sizes.resize(n);
|
||||||
|
for (s32 i = 0; i < n; ++i) b.sizes[i] = static_cast<u32>(Le(sizes.data() + i * 4, 4));
|
||||||
|
payload_start = block_start + BlockFixed + static_cast<u64>(n) * 4;
|
||||||
|
bh = std::move(b);
|
||||||
|
} else {
|
||||||
|
payload_start = block_start;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sections.empty() && sections[0].offset > static_cast<s64>(HeaderSize)) {
|
||||||
|
Section fake{};
|
||||||
|
fake.offset = static_cast<s64>(HeaderSize);
|
||||||
|
fake.size = sections[0].offset - static_cast<s64>(HeaderSize);
|
||||||
|
sections.insert(sections.begin(), fake);
|
||||||
|
}
|
||||||
|
return std::make_pair(std::move(sections), std::move(bh));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sequential reader over independently-compressed blocks. Uses a direct-mapped cache (like
|
||||||
|
// NCZVirtualFile) instead of an LRU list: block_index % CacheSlots picks the slot, so a hit is
|
||||||
|
// O(1). Reuses one ZSTD_DCtx for the lifetime of the reader.
|
||||||
|
class BlockReader {
|
||||||
|
public:
|
||||||
|
static constexpr std::size_t CacheSlots = 32;
|
||||||
|
|
||||||
|
BlockReader(FileSys::VirtualFile f, const BlockHeader& bh, u64 payload_start)
|
||||||
|
: source{std::move(f)}, block_size{1ULL << bh.exponent}, sizes{bh.sizes},
|
||||||
|
decompressed_size{bh.decompressed_size} {
|
||||||
|
if (bh.exponent < 14 || bh.exponent > 32 || sizes.empty())
|
||||||
|
throw std::runtime_error("bad NCZBLOCK header");
|
||||||
|
u64 off = payload_start;
|
||||||
|
offsets.reserve(sizes.size());
|
||||||
|
for (u32 s : sizes) { offsets.push_back(off); off += s; }
|
||||||
|
dctx = ZSTD_createDCtx();
|
||||||
|
if (dctx == nullptr) throw std::runtime_error("ZSTD_createDCtx failed");
|
||||||
|
cache.resize(CacheSlots);
|
||||||
|
for (auto& slot : cache) slot.id = ~0ULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
~BlockReader() {
|
||||||
|
if (dctx != nullptr) ZSTD_freeDCtx(dctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockReader(const BlockReader&) = delete;
|
||||||
|
BlockReader& operator=(const BlockReader&) = delete;
|
||||||
|
|
||||||
|
std::size_t ReadAt(u64 position, std::span<u8> out) {
|
||||||
|
std::size_t done = 0;
|
||||||
|
while (done < out.size() && position < decompressed_size) {
|
||||||
|
const u64 id = position / block_size;
|
||||||
|
if (id >= sizes.size()) break;
|
||||||
|
const std::vector<u8>* block = GetBlock(id);
|
||||||
|
if (block == nullptr) break;
|
||||||
|
const u64 in = position - id * block_size;
|
||||||
|
if (in >= block->size()) break;
|
||||||
|
const std::size_t n = static_cast<std::size_t>(
|
||||||
|
std::min<u64>(out.size() - done, block->size() - in));
|
||||||
|
std::memcpy(out.data() + done, block->data() + in, n);
|
||||||
|
done += n;
|
||||||
|
position += n;
|
||||||
|
}
|
||||||
|
return done;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
struct Slot {
|
||||||
|
u64 id = ~0ULL;
|
||||||
|
std::vector<u8> data;
|
||||||
|
};
|
||||||
|
|
||||||
|
const std::vector<u8>* GetBlock(u64 id) {
|
||||||
|
Slot& slot = cache[id % CacheSlots];
|
||||||
|
if (slot.id == id) {
|
||||||
|
return &slot.data; // O(1) hit
|
||||||
|
}
|
||||||
|
std::vector<u8> buffer;
|
||||||
|
buffer.swap(slot.data); // reuse existing allocation
|
||||||
|
if (!DecodeBlock(id, buffer)) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
slot.data = std::move(buffer);
|
||||||
|
slot.id = id;
|
||||||
|
return &slot.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DecodeBlock(u64 id, std::vector<u8>& buffer) {
|
||||||
|
u64 want = block_size;
|
||||||
|
if (id + 1 == sizes.size()) {
|
||||||
|
const u64 rem = decompressed_size % block_size;
|
||||||
|
if (rem > 0) want = rem; // avoid the 0-size bug from the original nsz
|
||||||
|
}
|
||||||
|
try { buffer.resize(static_cast<std::size_t>(want)); }
|
||||||
|
catch (const std::bad_alloc&) { return false; }
|
||||||
|
const u32 csize = sizes[id];
|
||||||
|
if (csize < want) {
|
||||||
|
const auto comp = source->ReadBytes(csize, offsets[id]);
|
||||||
|
if (comp.size() != csize) return false;
|
||||||
|
const std::size_t res = ZSTD_decompressDCtx(
|
||||||
|
dctx, buffer.data(), buffer.size(), comp.data(), comp.size());
|
||||||
|
if (ZSTD_isError(res) || res != want) {
|
||||||
|
LOG_ERROR(Crypto, "Failed to decompress NCZBLOCK block {}: {}", id,
|
||||||
|
ZSTD_isError(res) ? ZSTD_getErrorName(res) : "size mismatch");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if (source->Read(buffer.data(), buffer.size(), offsets[id]) != buffer.size()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
FileSys::VirtualFile source;
|
||||||
|
u64 block_size;
|
||||||
|
std::vector<u64> offsets;
|
||||||
|
std::vector<u32> sizes;
|
||||||
|
u64 decompressed_size;
|
||||||
|
ZSTD_DCtx* dctx = nullptr;
|
||||||
|
std::vector<Slot> cache; // direct-mapped, CacheSlots entries
|
||||||
|
};
|
||||||
|
|
||||||
|
class BlockNczFile final : public FileSys::VfsFile {
|
||||||
|
public:
|
||||||
|
BlockNczFile(std::string name_, std::vector<u8> hdr_, std::vector<Section> sections_,
|
||||||
|
std::unique_ptr<BlockReader> body_)
|
||||||
|
: name{std::move(name_)}, hdr{std::move(hdr_)}, sections{std::move(sections_)},
|
||||||
|
body{std::move(body_)} {
|
||||||
|
nca_size = HeaderSize;
|
||||||
|
for (const auto& s : sections)
|
||||||
|
nca_size = std::max<u64>(nca_size, static_cast<u64>(s.offset + s.size));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string GetName() const override { return name; }
|
||||||
|
std::size_t GetSize() const override { return static_cast<std::size_t>(nca_size); }
|
||||||
|
bool Resize(std::size_t) override { return false; }
|
||||||
|
FileSys::VirtualDir GetContainingDirectory() const override { return nullptr; }
|
||||||
|
bool IsWritable() const override { return false; }
|
||||||
|
bool IsReadable() const override { return true; }
|
||||||
|
|
||||||
|
// NCZ stores CTR sections decrypted; this file serves them as-is, and NcaFileSystemDriver
|
||||||
|
// skips its AES layers because of this flag.
|
||||||
|
bool HasDecryptedSections() const override { return true; }
|
||||||
|
|
||||||
|
std::size_t Read(u8* data, std::size_t len, std::size_t off) const override {
|
||||||
|
if (off >= nca_size) return 0;
|
||||||
|
len = static_cast<std::size_t>(std::min<u64>(len, nca_size - off));
|
||||||
|
const u64 end = off + len;
|
||||||
|
u64 pos = off;
|
||||||
|
if (pos < HeaderSize) {
|
||||||
|
const u64 n = std::min<u64>(end, HeaderSize) - pos;
|
||||||
|
std::memcpy(data, hdr.data() + pos, static_cast<std::size_t>(n));
|
||||||
|
pos += n;
|
||||||
|
}
|
||||||
|
std::scoped_lock lock{mutex};
|
||||||
|
// Sections are sorted by offset; find the first one whose stop > pos.
|
||||||
|
auto it = std::lower_bound(
|
||||||
|
sections.begin(), sections.end(), pos, [](const Section& s, u64 p) {
|
||||||
|
const u64 b = std::max<u64>(static_cast<u64>(s.offset), HeaderSize);
|
||||||
|
const u64 e = std::max<u64>(static_cast<u64>(s.offset) + static_cast<u64>(s.size), b);
|
||||||
|
return e <= p;
|
||||||
|
});
|
||||||
|
for (; it != sections.end() && pos < end; ++it) {
|
||||||
|
const auto& s = *it;
|
||||||
|
const u64 begin = std::max<u64>(static_cast<u64>(s.offset), HeaderSize);
|
||||||
|
const u64 stop = std::max<u64>(static_cast<u64>(s.offset + s.size), begin);
|
||||||
|
if (stop <= pos) continue;
|
||||||
|
if (pos < begin) {
|
||||||
|
const u64 g = std::min(end, begin);
|
||||||
|
std::memset(data + (pos - off), 0, static_cast<std::size_t>(g - pos));
|
||||||
|
pos = g;
|
||||||
|
if (pos >= end) break;
|
||||||
|
}
|
||||||
|
const u64 pe = std::min(end, stop);
|
||||||
|
const std::span<u8> piece(data + (pos - off), static_cast<std::size_t>(pe - pos));
|
||||||
|
if (body->ReadAt(pos - HeaderSize, piece) != piece.size())
|
||||||
|
return static_cast<std::size_t>(pos - off);
|
||||||
|
// No CTR here: NCZ body is already decrypted, and NcaFileSystemDriver skips AES.
|
||||||
|
pos = pe;
|
||||||
|
}
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::size_t Write(const u8*, std::size_t, std::size_t) override { return 0; }
|
||||||
|
bool Rename(std::string_view) override { return false; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
const std::string name;
|
||||||
|
const std::vector<u8> hdr;
|
||||||
|
const std::vector<Section> sections;
|
||||||
|
const std::unique_ptr<BlockReader> body;
|
||||||
|
mutable std::mutex mutex;
|
||||||
|
u64 nca_size{};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Solid NCZ: one zstd stream over the whole body. Decoded incrementally into memory, up to the
|
||||||
|
// requested offset, so sequential install reads are O(n) instead of O(n^2).
|
||||||
|
class SolidNczFile final : public FileSys::VfsFile {
|
||||||
|
public:
|
||||||
|
SolidNczFile(std::string name_, FileSys::VirtualFile source_,
|
||||||
|
std::vector<Section> sections_, u64 payload_start_)
|
||||||
|
: name{std::move(name_)}, source{std::move(source_)}, sections{std::move(sections_)},
|
||||||
|
payload_start{payload_start_} {
|
||||||
|
const auto raw_header = source->ReadBytes(HeaderSize, 0);
|
||||||
|
data.assign(raw_header.begin(), raw_header.end());
|
||||||
|
frontier = HeaderSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
~SolidNczFile() override {
|
||||||
|
if (stream != nullptr) ZSTD_freeDStream(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string GetName() const override { return name; }
|
||||||
|
std::size_t GetSize() const override {
|
||||||
|
u64 size = HeaderSize;
|
||||||
|
for (const auto& s : sections)
|
||||||
|
size = std::max<u64>(size, static_cast<u64>(s.offset + s.size));
|
||||||
|
return static_cast<std::size_t>(size);
|
||||||
|
}
|
||||||
|
bool Resize(std::size_t) override { return false; }
|
||||||
|
FileSys::VirtualDir GetContainingDirectory() const override { return nullptr; }
|
||||||
|
bool IsWritable() const override { return false; }
|
||||||
|
bool IsReadable() const override { return true; }
|
||||||
|
|
||||||
|
std::size_t Read(u8* out, std::size_t len, std::size_t off) const override {
|
||||||
|
std::scoped_lock lock{mutex};
|
||||||
|
const u64 nca_size = GetSize();
|
||||||
|
if (off >= nca_size) return 0;
|
||||||
|
len = static_cast<std::size_t>(std::min<u64>(len, nca_size - off));
|
||||||
|
const u64 needed = off + len;
|
||||||
|
if (needed > frontier && !DecodeTo(needed)) return 0;
|
||||||
|
std::memcpy(out, data.data() + off, len);
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::size_t Write(const u8*, std::size_t, std::size_t) override { return 0; }
|
||||||
|
bool Rename(std::string_view) override { return false; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool DecodeTo(u64 needed) const {
|
||||||
|
if (stream == nullptr) {
|
||||||
|
stream = ZSTD_createDStream();
|
||||||
|
if (stream == nullptr) return false;
|
||||||
|
ZSTD_DCtx_setParameter(stream, ZSTD_d_windowLogMax, 31);
|
||||||
|
read_pos = payload_start;
|
||||||
|
}
|
||||||
|
|
||||||
|
const u64 file_size = source->GetSize();
|
||||||
|
std::vector<u8> out_buf(Chunk);
|
||||||
|
|
||||||
|
std::size_t index = 0;
|
||||||
|
for (; index < sections.size(); ++index) {
|
||||||
|
const auto& s = sections[index];
|
||||||
|
const u64 begin = std::max<u64>(static_cast<u64>(s.offset), HeaderSize);
|
||||||
|
const u64 end = std::max<u64>(static_cast<u64>(s.offset) + static_cast<u64>(s.size),
|
||||||
|
begin);
|
||||||
|
if (end > frontier) break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; index < sections.size() && frontier < needed; ++index) {
|
||||||
|
const auto& s = sections[index];
|
||||||
|
const u64 begin = std::max<u64>(static_cast<u64>(s.offset), HeaderSize);
|
||||||
|
const u64 end = std::max<u64>(static_cast<u64>(s.offset) + static_cast<u64>(s.size),
|
||||||
|
begin);
|
||||||
|
if (end <= frontier) continue;
|
||||||
|
u64 pos = std::max<u64>(begin, frontier);
|
||||||
|
|
||||||
|
std::optional<AESCipher<Key128>> cipher;
|
||||||
|
if (s.Ctr()) cipher.emplace(s.key, Mode::CTR);
|
||||||
|
|
||||||
|
while (pos < end && frontier < needed) {
|
||||||
|
const u64 want = std::min<u64>(end - pos, out_buf.size());
|
||||||
|
std::size_t produced = 0;
|
||||||
|
while (produced < want) {
|
||||||
|
if (in.pos >= in.size) {
|
||||||
|
const u64 remaining = file_size - read_pos;
|
||||||
|
const std::size_t chunk = static_cast<std::size_t>(
|
||||||
|
std::min<u64>(Chunk, remaining));
|
||||||
|
if (chunk == 0) { LOG_ERROR(Crypto, "Solid NCZ: truncated"); return false; }
|
||||||
|
const auto bytes = source->ReadBytes(chunk, read_pos);
|
||||||
|
if (bytes.empty()) { LOG_ERROR(Crypto, "Solid NCZ: truncated"); return false; }
|
||||||
|
read_pos += bytes.size();
|
||||||
|
in_buf.assign(bytes.begin(), bytes.end());
|
||||||
|
in.src = in_buf.data();
|
||||||
|
in.size = in_buf.size();
|
||||||
|
in.pos = 0;
|
||||||
|
}
|
||||||
|
ZSTD_outBuffer outb{out_buf.data() + produced, want - produced, 0};
|
||||||
|
const std::size_t res = ZSTD_decompressStream(stream, &outb, &in);
|
||||||
|
if (ZSTD_isError(res)) {
|
||||||
|
LOG_ERROR(Crypto, "Solid NCZ: zstd error");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
produced += outb.pos;
|
||||||
|
}
|
||||||
|
if (cipher) {
|
||||||
|
Key128 iv{};
|
||||||
|
SetIv(iv, s.counter, pos);
|
||||||
|
cipher->SetIV(iv);
|
||||||
|
cipher->Transcode(out_buf.data(), produced, out_buf.data(), Op::Encrypt);
|
||||||
|
}
|
||||||
|
data.insert(data.end(), out_buf.begin(), out_buf.begin() + produced);
|
||||||
|
pos += produced;
|
||||||
|
frontier = pos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return frontier >= needed;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string name;
|
||||||
|
const FileSys::VirtualFile source;
|
||||||
|
const std::vector<Section> sections;
|
||||||
|
const u64 payload_start;
|
||||||
|
mutable std::mutex mutex;
|
||||||
|
mutable std::vector<u8> data;
|
||||||
|
mutable ZSTD_DStream* stream = nullptr;
|
||||||
|
mutable u64 read_pos = 0;
|
||||||
|
mutable u64 frontier = 0;
|
||||||
|
mutable std::vector<u8> in_buf;
|
||||||
|
mutable ZSTD_inBuffer in{nullptr, 0, 0};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Shared opener: block path always; solid only when allow_solid is true.
|
||||||
|
FileSys::VirtualFile OpenNcz(const FileSys::VirtualFile& f, std::string_view name,
|
||||||
|
bool allow_solid) {
|
||||||
|
if (!f) return nullptr;
|
||||||
|
u64 ps = 0;
|
||||||
|
auto parsed = ParseHeader(f, ps);
|
||||||
|
if (!parsed) return nullptr;
|
||||||
|
auto& [sections, block] = *parsed;
|
||||||
|
|
||||||
|
if (block) {
|
||||||
|
auto hdr = f->ReadBytes(HeaderSize, 0);
|
||||||
|
if (hdr.size() != HeaderSize) return nullptr;
|
||||||
|
std::unique_ptr<BlockReader> body;
|
||||||
|
try { body = std::make_unique<BlockReader>(f, *block, ps); }
|
||||||
|
catch (const std::exception& e) {
|
||||||
|
LOG_ERROR(Crypto, "Failed to open NCZBLOCK: {}", e.what());
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return std::make_shared<BlockNczFile>(std::string{name}, std::move(hdr),
|
||||||
|
std::move(sections), std::move(body));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (allow_solid) {
|
||||||
|
return std::make_shared<SolidNczFile>(std::string{name}, f, std::move(sections), ps);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_DEBUG(Crypto, "Solid NCZ {} skipped (only NCZBLOCK is supported for play)", name);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // Anonymous namespace
|
||||||
|
|
||||||
|
bool IsBlockCompressedNCZ(const FileSys::VirtualFile& f) {
|
||||||
|
if (!f) return false;
|
||||||
|
u64 ps = 0;
|
||||||
|
const auto p = ParseHeader(f, ps);
|
||||||
|
return p && p->second.has_value();
|
||||||
|
}
|
||||||
|
|
||||||
|
FileSys::VirtualFile DecompressNCZ(const FileSys::VirtualFile& f, std::string_view name) {
|
||||||
|
return OpenNcz(f, name, /*allow_solid=*/false);
|
||||||
|
}
|
||||||
|
|
||||||
|
FileSys::VirtualFile DecompressNCZForInstall(const FileSys::VirtualFile& f,
|
||||||
|
std::string_view name) {
|
||||||
|
return OpenNcz(f, name, /*allow_solid=*/true);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Core::Crypto
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
|
#include "core/file_sys/vfs/vfs_types.h"
|
||||||
|
|
||||||
|
namespace Core::Crypto {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens an NCZBLOCK-compressed NCA (nsz -B / .xcz block format) as a VirtualFile backed by
|
||||||
|
* on-demand block decoding. Nothing is written to disk; each read decodes only the blocks it
|
||||||
|
* covers and re-encrypts CTR sections. Solid NCZ is not supported.
|
||||||
|
*
|
||||||
|
* @param ncz_file The raw NCZ payload (e.g. "<id>.ncz" entry from an NSZ/XCZ PFS0).
|
||||||
|
* @param output_name Name to give the returned VirtualFile (e.g. "<id>.nca").
|
||||||
|
*
|
||||||
|
* @return a VirtualFile for the NCA, or nullptr if the NCZ is malformed or not NCZBLOCK.
|
||||||
|
*/
|
||||||
|
[[nodiscard]] FileSys::VirtualFile DecompressNCZ(const FileSys::VirtualFile& ncz_file,
|
||||||
|
std::string_view output_name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the given file is an NCZ payload in block-compressed (NCZBLOCK) form,
|
||||||
|
* i.e. one that DecompressNCZ() can open. Solid NCZ returns false.
|
||||||
|
*/
|
||||||
|
[[nodiscard]] bool IsBlockCompressedNCZ(const FileSys::VirtualFile& ncz_file);
|
||||||
|
|
||||||
|
// Install to NAND: same as DecompressNCZ, but solid NCZ is decoded on demand too.
|
||||||
|
[[nodiscard]] FileSys::VirtualFile DecompressNCZForInstall(
|
||||||
|
const FileSys::VirtualFile& ncz_file, std::string_view output_name);
|
||||||
|
|
||||||
|
} // namespace Core::Crypto
|
||||||
@@ -45,6 +45,7 @@ NCA::NCA(VirtualFile file_, const NCA* base_nca, bool allow_missing_base)
|
|||||||
// Ensure we have the proper key area keys to continue.
|
// Ensure we have the proper key area keys to continue.
|
||||||
const u8 master_key_id = MasterKeyIdForKeyGeneration(reader->GetKeyGeneration());
|
const u8 master_key_id = MasterKeyIdForKeyGeneration(reader->GetKeyGeneration());
|
||||||
if (!keys.HasKey(Core::Crypto::S128KeyType::KeyArea, master_key_id, reader->GetKeyIndex())) {
|
if (!keys.HasKey(Core::Crypto::S128KeyType::KeyArea, master_key_id, reader->GetKeyIndex())) {
|
||||||
|
LOG_ERROR(Loader, "Cannot decrypt {}: keys for gen 0x{:02X}+ required.", file->GetName(), reader->GetKeyGeneration());
|
||||||
status = Loader::ResultStatus::ErrorMissingKeyAreaKey;
|
status = Loader::ResultStatus::ErrorMissingKeyAreaKey;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
@@ -143,20 +146,16 @@ public:
|
|||||||
return m_str;
|
return m_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr size_t GetLength() const {
|
size_t GetLength() const {
|
||||||
if (std::is_constant_evaluated()) {
|
return std::strlen(this->GetString());
|
||||||
return Strlen(this->GetString());
|
|
||||||
} else {
|
|
||||||
return std::strlen(this->GetString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool IsEmpty() const {
|
constexpr bool IsEmpty() const {
|
||||||
return *m_str == '\x00';
|
return *m_str == '\x00';
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool IsMatchHead(const char* p, size_t len) const {
|
bool IsMatchHead(const char* p, size_t len) const {
|
||||||
return Strncmp(this->GetString(), p, len) == 0;
|
return std::strncmp(this->GetString(), p, len) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Initialize(const Path& rhs) {
|
Result Initialize(const Path& rhs) {
|
||||||
@@ -169,7 +168,7 @@ public:
|
|||||||
R_TRY(this->Preallocate(len + 1));
|
R_TRY(this->Preallocate(len + 1));
|
||||||
|
|
||||||
// Copy the path
|
// Copy the path
|
||||||
const size_t copied = Strlcpy<char>(m_write_buffer.Get(), rhs.GetString(), len + 1);
|
const size_t copied = strlcpy(m_write_buffer.Get(), rhs.GetString(), len + 1);
|
||||||
R_UNLESS(copied == len, ResultUnexpectedInPathA);
|
R_UNLESS(copied == len, ResultUnexpectedInPathA);
|
||||||
|
|
||||||
// Set normalized
|
// Set normalized
|
||||||
@@ -331,14 +330,14 @@ public:
|
|||||||
// Get our write buffer
|
// Get our write buffer
|
||||||
auto* dst = m_write_buffer.Get();
|
auto* dst = m_write_buffer.Get();
|
||||||
if (old_write_buffer.Get() != nullptr && cur_len > 0) {
|
if (old_write_buffer.Get() != nullptr && cur_len > 0) {
|
||||||
Strlcpy<char>(dst, old_write_buffer.Get(), cur_len + 1);
|
strlcpy(dst, old_write_buffer.Get(), cur_len + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add separator
|
// Add separator
|
||||||
dst[cur_len] = '/';
|
dst[cur_len] = '/';
|
||||||
|
|
||||||
// Copy the child path
|
// Copy the child path
|
||||||
const size_t copied = Strlcpy<char>(dst + cur_len + 1, c, child_len + 1);
|
const size_t copied = strlcpy(dst + cur_len + 1, c, child_len + 1);
|
||||||
R_UNLESS(copied == child_len, ResultUnexpectedInPathA);
|
R_UNLESS(copied == child_len, ResultUnexpectedInPathA);
|
||||||
|
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
@@ -375,7 +374,7 @@ public:
|
|||||||
if (m_write_buffer.Get() == nullptr) {
|
if (m_write_buffer.Get() == nullptr) {
|
||||||
if (const auto len = std::strlen(m_str); len > 0) {
|
if (const auto len = std::strlen(m_str); len > 0) {
|
||||||
R_TRY(this->Preallocate(len));
|
R_TRY(this->Preallocate(len));
|
||||||
Strlcpy<char>(m_write_buffer.Get(), m_str, len + 1);
|
strlcpy(m_write_buffer.Get(), m_str, len + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,7 +496,7 @@ private:
|
|||||||
R_TRY(this->Preallocate(size + 1));
|
R_TRY(this->Preallocate(size + 1));
|
||||||
|
|
||||||
// Copy the path
|
// Copy the path
|
||||||
const size_t copied = Strlcpy<char>(m_write_buffer.Get(), path, size + 1);
|
const size_t copied = strlcpy(m_write_buffer.Get(), path, size + 1);
|
||||||
R_UNLESS(copied >= size, ResultUnexpectedInPathA);
|
R_UNLESS(copied >= size, ResultUnexpectedInPathA);
|
||||||
} else {
|
} else {
|
||||||
// We can just clear the buffer
|
// We can just clear the buffer
|
||||||
|
|||||||
@@ -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 2024 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
@@ -1217,7 +1217,7 @@ public:
|
|||||||
replaced_src = static_cast<char*>(Allocate(replaced_src_len));
|
replaced_src = static_cast<char*>(Allocate(replaced_src_len));
|
||||||
}
|
}
|
||||||
|
|
||||||
Strlcpy<char>(replaced_src, src, replaced_src_len);
|
strlcpy(replaced_src, src, replaced_src_len);
|
||||||
|
|
||||||
Replace(replaced_src, replaced_src_len, AlternateDirectorySeparator,
|
Replace(replaced_src, replaced_src_len, AlternateDirectorySeparator,
|
||||||
DirectorySeparator);
|
DirectorySeparator);
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
@@ -7,85 +10,6 @@
|
|||||||
|
|
||||||
namespace FileSys {
|
namespace FileSys {
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
constexpr int Strlen(const T* str) {
|
|
||||||
ASSERT(str != nullptr);
|
|
||||||
|
|
||||||
int length = 0;
|
|
||||||
while (*str++) {
|
|
||||||
++length;
|
|
||||||
}
|
|
||||||
|
|
||||||
return length;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
constexpr int Strnlen(const T* str, std::size_t count) {
|
|
||||||
return Strnlen(str, static_cast<int>(count));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
constexpr int Strnlen(const T* str, int count) {
|
|
||||||
ASSERT(str != nullptr);
|
|
||||||
ASSERT(count >= 0);
|
|
||||||
|
|
||||||
int length = 0;
|
|
||||||
while (count-- && *str++) {
|
|
||||||
++length;
|
|
||||||
}
|
|
||||||
|
|
||||||
return length;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
constexpr int Strncmp(const T* lhs, const T* rhs, std::size_t count) {
|
|
||||||
return Strncmp(lhs, rhs, static_cast<int>(count));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
constexpr int Strncmp(const T* lhs, const T* rhs, int count) {
|
|
||||||
ASSERT(lhs != nullptr);
|
|
||||||
ASSERT(rhs != nullptr);
|
|
||||||
ASSERT(count >= 0);
|
|
||||||
|
|
||||||
if (count == 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
T l, r;
|
|
||||||
do {
|
|
||||||
l = *(lhs++);
|
|
||||||
r = *(rhs++);
|
|
||||||
} while (l && (l == r) && (--count));
|
|
||||||
|
|
||||||
return l - r;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
static constexpr int Strlcpy(T* dst, const T* src, std::size_t count) {
|
|
||||||
return Strlcpy<T>(dst, src, static_cast<int>(count));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
static constexpr int Strlcpy(T* dst, const T* src, int count) {
|
|
||||||
ASSERT(dst != nullptr);
|
|
||||||
ASSERT(src != nullptr);
|
|
||||||
|
|
||||||
const T* cur = src;
|
|
||||||
if (count > 0) {
|
|
||||||
while ((--count) && *cur) {
|
|
||||||
*(dst++) = *(cur++);
|
|
||||||
}
|
|
||||||
*dst = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (*cur) {
|
|
||||||
cur++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return static_cast<int>(cur - src);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum CharacterEncodingResult {
|
enum CharacterEncodingResult {
|
||||||
CharacterEncodingResult_Success = 0,
|
CharacterEncodingResult_Success = 0,
|
||||||
CharacterEncodingResult_InsufficientLength = 1,
|
CharacterEncodingResult_InsufficientLength = 1,
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -93,6 +93,11 @@ Result NcaFileSystemDriver::OpenStorageImpl(VirtualFile* out, NcaFsHeaderReader*
|
|||||||
// Initialize our header reader for the fs index.
|
// Initialize our header reader for the fs index.
|
||||||
R_TRY(out_header_reader->Initialize(*m_reader, fs_index));
|
R_TRY(out_header_reader->Initialize(*m_reader, fs_index));
|
||||||
|
|
||||||
|
// NCZ files serve already-decrypted body data (CTR sections are stored decrypted).
|
||||||
|
// Skip the AES layers so we don't decrypt plaintext twice.
|
||||||
|
const bool is_pre_decrypted =
|
||||||
|
m_reader->GetStorage() && m_reader->GetStorage()->HasDecryptedSections();
|
||||||
|
|
||||||
// Declare the storage we're opening.
|
// Declare the storage we're opening.
|
||||||
VirtualFile storage;
|
VirtualFile storage;
|
||||||
|
|
||||||
@@ -158,7 +163,7 @@ Result NcaFileSystemDriver::OpenStorageImpl(VirtualFile* out, NcaFsHeaderReader*
|
|||||||
out_header_reader->GetPatchMetaDataHashDataInfo()));
|
out_header_reader->GetPatchMetaDataHashDataInfo()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (patch_info.HasAesCtrExTable()) {
|
if (patch_info.HasAesCtrExTable() && !is_pre_decrypted) {
|
||||||
// Check the encryption type.
|
// Check the encryption type.
|
||||||
ASSERT(out_header_reader->GetEncryptionType() == NcaFsHeader::EncryptionType::None ||
|
ASSERT(out_header_reader->GetEncryptionType() == NcaFsHeader::EncryptionType::None ||
|
||||||
out_header_reader->GetEncryptionType() == NcaFsHeader::EncryptionType::AesCtrEx ||
|
out_header_reader->GetEncryptionType() == NcaFsHeader::EncryptionType::AesCtrEx ||
|
||||||
@@ -196,32 +201,34 @@ Result NcaFileSystemDriver::OpenStorageImpl(VirtualFile* out, NcaFsHeaderReader*
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Create the appropriate storage for the encryption type.
|
// Create the appropriate storage for the encryption type.
|
||||||
switch (out_header_reader->GetEncryptionType()) {
|
if (!is_pre_decrypted) {
|
||||||
case NcaFsHeader::EncryptionType::None:
|
switch (out_header_reader->GetEncryptionType()) {
|
||||||
// If there's no encryption, use the base storage we made previously.
|
case NcaFsHeader::EncryptionType::None:
|
||||||
break;
|
// If there's no encryption, use the base storage we made previously.
|
||||||
case NcaFsHeader::EncryptionType::AesXts:
|
break;
|
||||||
R_TRY(this->CreateAesXtsStorage(std::addressof(storage), std::move(storage),
|
case NcaFsHeader::EncryptionType::AesXts:
|
||||||
fs_data_offset));
|
R_TRY(this->CreateAesXtsStorage(std::addressof(storage), std::move(storage),
|
||||||
break;
|
fs_data_offset));
|
||||||
case NcaFsHeader::EncryptionType::AesCtr:
|
break;
|
||||||
R_TRY(this->CreateAesCtrStorage(std::addressof(storage), std::move(storage),
|
case NcaFsHeader::EncryptionType::AesCtr:
|
||||||
fs_data_offset, out_header_reader->GetAesCtrUpperIv(),
|
R_TRY(this->CreateAesCtrStorage(std::addressof(storage), std::move(storage),
|
||||||
AlignmentStorageRequirement::None));
|
fs_data_offset, out_header_reader->GetAesCtrUpperIv(),
|
||||||
break;
|
AlignmentStorageRequirement::None));
|
||||||
case NcaFsHeader::EncryptionType::AesCtrSkipLayerHash: {
|
break;
|
||||||
// Create the aes ctr storage.
|
case NcaFsHeader::EncryptionType::AesCtrSkipLayerHash: {
|
||||||
VirtualFile aes_ctr_storage;
|
// Create the aes ctr storage.
|
||||||
R_TRY(this->CreateAesCtrStorage(std::addressof(aes_ctr_storage), storage,
|
VirtualFile aes_ctr_storage;
|
||||||
fs_data_offset, out_header_reader->GetAesCtrUpperIv(),
|
R_TRY(this->CreateAesCtrStorage(std::addressof(aes_ctr_storage), storage,
|
||||||
AlignmentStorageRequirement::None));
|
fs_data_offset, out_header_reader->GetAesCtrUpperIv(),
|
||||||
|
AlignmentStorageRequirement::None));
|
||||||
|
|
||||||
// Create region switch storage.
|
// Create region switch storage.
|
||||||
R_TRY(this->CreateRegionSwitchStorage(std::addressof(storage), out_header_reader,
|
R_TRY(this->CreateRegionSwitchStorage(std::addressof(storage), out_header_reader,
|
||||||
std::move(storage), std::move(aes_ctr_storage)));
|
std::move(storage), std::move(aes_ctr_storage)));
|
||||||
} break;
|
} break;
|
||||||
default:
|
default:
|
||||||
R_THROW(ResultInvalidNcaFsHeaderEncryptionType);
|
R_THROW(ResultInvalidNcaFsHeaderEncryptionType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Potentially save storages to our context.
|
// Potentially save storages to our context.
|
||||||
@@ -382,21 +389,25 @@ Result NcaFileSystemDriver::OpenIndirectableStorageAsOriginal(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the appropriate storage for the encryption type.
|
// Create the appropriate storage for the encryption type.
|
||||||
switch (header_reader->GetEncryptionType()) {
|
const bool is_pre_decrypted =
|
||||||
case NcaFsHeader::EncryptionType::None:
|
m_reader->GetStorage() && m_reader->GetStorage()->HasDecryptedSections();
|
||||||
// If there's no encryption, use the base storage we made previously.
|
if (!is_pre_decrypted) {
|
||||||
break;
|
switch (header_reader->GetEncryptionType()) {
|
||||||
case NcaFsHeader::EncryptionType::AesXts:
|
case NcaFsHeader::EncryptionType::None:
|
||||||
R_TRY(
|
// If there's no encryption, use the base storage we made previously.
|
||||||
this->CreateAesXtsStorage(std::addressof(storage), std::move(storage), fs_data_offset));
|
break;
|
||||||
break;
|
case NcaFsHeader::EncryptionType::AesXts:
|
||||||
case NcaFsHeader::EncryptionType::AesCtr:
|
R_TRY(this->CreateAesXtsStorage(std::addressof(storage), std::move(storage),
|
||||||
R_TRY(this->CreateAesCtrStorage(std::addressof(storage), std::move(storage), fs_data_offset,
|
fs_data_offset));
|
||||||
header_reader->GetAesCtrUpperIv(),
|
break;
|
||||||
AlignmentStorageRequirement::CacheBlockSize));
|
case NcaFsHeader::EncryptionType::AesCtr:
|
||||||
break;
|
R_TRY(this->CreateAesCtrStorage(std::addressof(storage), std::move(storage),
|
||||||
default:
|
fs_data_offset, header_reader->GetAesCtrUpperIv(),
|
||||||
R_THROW(ResultInvalidNcaFsHeaderEncryptionType);
|
AlignmentStorageRequirement::CacheBlockSize));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
R_THROW(ResultInvalidNcaFsHeaderEncryptionType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set output storage.
|
// Set output storage.
|
||||||
@@ -432,6 +443,11 @@ Result NcaFileSystemDriver::CreateAesCtrStorage(
|
|||||||
ASSERT(out != nullptr);
|
ASSERT(out != nullptr);
|
||||||
ASSERT(base_storage != nullptr);
|
ASSERT(base_storage != nullptr);
|
||||||
|
|
||||||
|
if (m_reader->GetStorage() && m_reader->GetStorage()->HasDecryptedSections()) {
|
||||||
|
*out = std::move(base_storage);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
// Create the iv.
|
// Create the iv.
|
||||||
std::array<u8, AesCtrStorage::IvSize> iv{};
|
std::array<u8, AesCtrStorage::IvSize> iv{};
|
||||||
AesCtrStorage::MakeIv(iv.data(), sizeof(iv), upper_iv.value, offset);
|
AesCtrStorage::MakeIv(iv.data(), sizeof(iv), upper_iv.value, offset);
|
||||||
@@ -469,6 +485,11 @@ Result NcaFileSystemDriver::CreateAesXtsStorage(VirtualFile* out, VirtualFile ba
|
|||||||
ASSERT(out != nullptr);
|
ASSERT(out != nullptr);
|
||||||
ASSERT(base_storage != nullptr);
|
ASSERT(base_storage != nullptr);
|
||||||
|
|
||||||
|
if (m_reader->GetStorage() && m_reader->GetStorage()->HasDecryptedSections()) {
|
||||||
|
*out = std::move(base_storage);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
// Create the iv.
|
// Create the iv.
|
||||||
std::array<u8, AesXtsStorage::IvSize> iv{};
|
std::array<u8, AesXtsStorage::IvSize> iv{};
|
||||||
AesXtsStorage::MakeAesXtsIv(iv.data(), sizeof(iv), offset, NcaHeader::XtsBlockSize);
|
AesXtsStorage::MakeAesXtsIv(iv.data(), sizeof(iv), offset, NcaHeader::XtsBlockSize);
|
||||||
@@ -809,6 +830,12 @@ Result NcaFileSystemDriver::CreateAesCtrExStorageMetaStorage(
|
|||||||
// Validate preconditions.
|
// Validate preconditions.
|
||||||
ASSERT(out != nullptr);
|
ASSERT(out != nullptr);
|
||||||
ASSERT(base_storage != nullptr);
|
ASSERT(base_storage != nullptr);
|
||||||
|
|
||||||
|
if (m_reader->GetStorage() && m_reader->GetStorage()->HasDecryptedSections()) {
|
||||||
|
*out = std::move(base_storage);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
ASSERT(encryption_type == NcaFsHeader::EncryptionType::None ||
|
ASSERT(encryption_type == NcaFsHeader::EncryptionType::None ||
|
||||||
encryption_type == NcaFsHeader::EncryptionType::AesCtrEx ||
|
encryption_type == NcaFsHeader::EncryptionType::AesCtrEx ||
|
||||||
encryption_type == NcaFsHeader::EncryptionType::AesCtrExSkipLayerHash);
|
encryption_type == NcaFsHeader::EncryptionType::AesCtrExSkipLayerHash);
|
||||||
@@ -871,6 +898,11 @@ Result NcaFileSystemDriver::CreateAesCtrExStorage(
|
|||||||
ASSERT(meta_storage != nullptr);
|
ASSERT(meta_storage != nullptr);
|
||||||
ASSERT(patch_info.HasAesCtrExTable());
|
ASSERT(patch_info.HasAesCtrExTable());
|
||||||
|
|
||||||
|
if (m_reader->GetStorage() && m_reader->GetStorage()->HasDecryptedSections()) {
|
||||||
|
*out = std::move(base_storage);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
// Read the bucket tree header.
|
// Read the bucket tree header.
|
||||||
BucketTree::Header header;
|
BucketTree::Header header;
|
||||||
std::memcpy(std::addressof(header), patch_info.aes_ctr_ex_header.data(), sizeof(header));
|
std::memcpy(std::addressof(header), patch_info.aes_ctr_ex_header.data(), sizeof(header));
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ public:
|
|||||||
const NcaCompressionConfiguration& compression_cfg);
|
const NcaCompressionConfiguration& compression_cfg);
|
||||||
|
|
||||||
VirtualFile GetSharedBodyStorage();
|
VirtualFile GetSharedBodyStorage();
|
||||||
|
VirtualFile GetStorage() const { return m_body_storage; }
|
||||||
u32 GetMagic() const;
|
u32 GetMagic() const;
|
||||||
NcaHeader::DistributionType GetDistributionType() const;
|
NcaHeader::DistributionType GetDistributionType() const;
|
||||||
NcaHeader::ContentType GetContentType() const;
|
NcaHeader::ContentType GetContentType() const;
|
||||||
|
|||||||
@@ -503,10 +503,11 @@ std::vector<Core::Memory::CheatEntry> PatchManager::CreateCheatList(const BuildI
|
|||||||
for (const auto& subdir : patch_dirs) {
|
for (const auto& subdir : patch_dirs) {
|
||||||
if (std::find(disabled.cbegin(), disabled.cend(), subdir->GetName()) == disabled.cend()) {
|
if (std::find(disabled.cbegin(), disabled.cend(), subdir->GetName()) == disabled.cend()) {
|
||||||
if (auto cheats_dir = FindSubdirectoryCaseless(subdir, "cheats"); cheats_dir != nullptr) {
|
if (auto cheats_dir = FindSubdirectoryCaseless(subdir, "cheats"); cheats_dir != nullptr) {
|
||||||
if (auto const res = ReadCheatFileFromFolder(title_id, build_id_, cheats_dir, true))
|
if (auto const res = ReadCheatFileFromFolder(title_id, build_id_, cheats_dir, true)) {
|
||||||
std::copy(res->begin(), res->end(), std::back_inserter(out));
|
|
||||||
if (auto const res = ReadCheatFileFromFolder(title_id, build_id_, cheats_dir, false))
|
|
||||||
std::copy(res->begin(), res->end(), std::back_inserter(out));
|
std::copy(res->begin(), res->end(), std::back_inserter(out));
|
||||||
|
} else if (auto const lower_res = ReadCheatFileFromFolder(title_id, build_id_, cheats_dir, false)) {
|
||||||
|
std::copy(lower_res->begin(), lower_res->end(), std::back_inserter(out));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "common/random.h"
|
#include "common/random.h"
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
#include "core/crypto/key_manager.h"
|
#include "core/crypto/key_manager.h"
|
||||||
|
#include "core/crypto/ncz_decompressor.h"
|
||||||
#include "core/file_sys/card_image.h"
|
#include "core/file_sys/card_image.h"
|
||||||
#include "core/file_sys/common_funcs.h"
|
#include "core/file_sys/common_funcs.h"
|
||||||
#include "core/file_sys/content_archive.h"
|
#include "core/file_sys/content_archive.h"
|
||||||
@@ -158,6 +159,25 @@ static std::shared_ptr<NSP> OpenContainerAsNsp(const VirtualFile& file, Loader::
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Checks that every .ncz entry in the container is NCZBLOCK. Solid NCZ has no random access,
|
||||||
|
// and the whole point of this build is to reject it at scan time so such files never appear
|
||||||
|
// in the game list. Containers without any .ncz (plain NSP/XCI) pass through.
|
||||||
|
static bool ContainerIsFullyBlockCompressed(const std::shared_ptr<NSP>& nsp) {
|
||||||
|
if (!nsp) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (const auto& entry : nsp->GetFiles()) {
|
||||||
|
const auto name = entry->GetName();
|
||||||
|
if (name.size() < 4 || name.substr(name.size() - 4) != ".ncz") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!Core::Crypto::IsBlockCompressedNCZ(entry)) {
|
||||||
|
return false; // solid NCZ -> reject the whole container
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true; // no .ncz at all, or all block-compressed
|
||||||
|
}
|
||||||
|
|
||||||
template <typename Callback>
|
template <typename Callback>
|
||||||
bool ForEachContainerEntry(const std::shared_ptr<NSP>& nsp, bool only_content,
|
bool ForEachContainerEntry(const std::shared_ptr<NSP>& nsp, bool only_content,
|
||||||
std::optional<u64> base_program_id, Callback&& on_entry) {
|
std::optional<u64> base_program_id, Callback&& on_entry) {
|
||||||
@@ -811,7 +831,14 @@ std::vector<ContentProviderEntry> RegisteredCache::ListEntriesFilter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static std::shared_ptr<NCA> GetNCAFromNSPForID(const NSP& nsp, const NcaID& id) {
|
static std::shared_ptr<NCA> GetNCAFromNSPForID(const NSP& nsp, const NcaID& id) {
|
||||||
auto file = nsp.GetFile(fmt::format("{}.nca", Common::HexToString(id, false)));
|
const auto id_string = Common::HexToString(id, false);
|
||||||
|
auto file = nsp.GetFile(fmt::format("{}.nca", id_string));
|
||||||
|
if (file == nullptr) {
|
||||||
|
if (auto ncz_file = nsp.GetFile(fmt::format("{}.ncz", id_string))) {
|
||||||
|
file = Core::Crypto::DecompressNCZForInstall(
|
||||||
|
ncz_file, fmt::format("{}.nca", id_string));
|
||||||
|
}
|
||||||
|
}
|
||||||
if (file == nullptr) {
|
if (file == nullptr) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@@ -1273,6 +1300,12 @@ bool ManualContentProvider::AddEntriesFromContainer(VirtualFile file, bool only_
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reject solid NCZ (.nsz without -B): only block-compressed NCZ is supported.
|
||||||
|
if (!ContainerIsFullyBlockCompressed(nsp)) {
|
||||||
|
LOG_DEBUG(Service_FS, "Skipping solid-compressed container: {}", file->GetName());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return ForEachContainerEntry(
|
return ForEachContainerEntry(
|
||||||
nsp, only_content, base_program_id,
|
nsp, only_content, base_program_id,
|
||||||
[this](TitleType title_type, ContentRecordType content_type, u64 title_id,
|
[this](TitleType title_type, ContentRecordType content_type, u64 title_id,
|
||||||
@@ -1415,8 +1448,9 @@ void ExternalContentProvider::ScanDirectory(const VirtualDir& dir) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const auto extension = Common::ToLower(filename.substr(dot_pos + 1));
|
const auto extension = Common::ToLower(filename.substr(dot_pos + 1));
|
||||||
|
// .xcz is an XCI container, but its updates only work through the NSP/PFS0 path
|
||||||
if (extension == "nsp") {
|
// (DecompressNCZ), not ProcessXCI. So route .xcz here on purpose.
|
||||||
|
if (extension == "nsp" || extension == "nsz" || extension == "xcz") {
|
||||||
ProcessNSP(file);
|
ProcessNSP(file);
|
||||||
} else if (extension == "xci") {
|
} else if (extension == "xci") {
|
||||||
ProcessXCI(file);
|
ProcessXCI(file);
|
||||||
@@ -1434,6 +1468,12 @@ void ExternalContentProvider::ProcessNSP(const VirtualFile& file) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reject solid NCZ (.nsz without -B): Eden only supports block-compressed NCZ.
|
||||||
|
if (!ContainerIsFullyBlockCompressed(nsp)) {
|
||||||
|
LOG_DEBUG(Service_FS, "Skipping solid-compressed container: {}", file->GetName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
LOG_DEBUG(Service_FS, "Processing NSP file: {}", file->GetName());
|
LOG_DEBUG(Service_FS, "Processing NSP file: {}", file->GetName());
|
||||||
AddExternalEntriesFromContainer(nsp, entries, versions, multi_version_entries);
|
AddExternalEntriesFromContainer(nsp, entries, versions, multi_version_entries);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "common/hex_util.h"
|
#include "common/hex_util.h"
|
||||||
#include "common/logging.h"
|
#include "common/logging.h"
|
||||||
#include "core/crypto/key_manager.h"
|
#include "core/crypto/key_manager.h"
|
||||||
|
#include "core/crypto/ncz_decompressor.h"
|
||||||
#include "core/file_sys/common_funcs.h"
|
#include "core/file_sys/common_funcs.h"
|
||||||
#include "core/file_sys/content_archive.h"
|
#include "core/file_sys/content_archive.h"
|
||||||
#include "core/file_sys/nca_metadata.h"
|
#include "core/file_sys/nca_metadata.h"
|
||||||
@@ -246,6 +247,17 @@ void NSP::ReadNCAs(const std::vector<VirtualFile>& files) {
|
|||||||
const auto id_string = Common::HexToString(rec.nca_id, false);
|
const auto id_string = Common::HexToString(rec.nca_id, false);
|
||||||
auto next_file = pfs->GetFile(fmt::format("{}.nca", id_string));
|
auto next_file = pfs->GetFile(fmt::format("{}.nca", id_string));
|
||||||
|
|
||||||
|
if (next_file == nullptr) {
|
||||||
|
auto ncz_file = pfs->GetFile(fmt::format("{}.ncz", id_string));
|
||||||
|
if (ncz_file != nullptr) {
|
||||||
|
next_file = Core::Crypto::DecompressNCZ(ncz_file, fmt::format("{}.nca", id_string));
|
||||||
|
if (next_file == nullptr) {
|
||||||
|
LOG_DEBUG(Service_FS, "Skipping solid or unsupported NCZ content {}.ncz", id_string);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (next_file == nullptr) {
|
if (next_file == nullptr) {
|
||||||
if (rec.type != ContentRecordType::DeltaFragment) {
|
if (rec.type != ContentRecordType::DeltaFragment) {
|
||||||
LOG_WARNING(Service_FS,
|
LOG_WARNING(Service_FS,
|
||||||
|
|||||||
@@ -112,6 +112,9 @@ public:
|
|||||||
// Returns whether or not the file can be read from.
|
// Returns whether or not the file can be read from.
|
||||||
virtual bool IsReadable() const = 0;
|
virtual bool IsReadable() const = 0;
|
||||||
|
|
||||||
|
// Returns true if this file serves NCA body data that is already decrypted (e.g. NCZ).
|
||||||
|
virtual bool HasDecryptedSections() const { return false; }
|
||||||
|
|
||||||
// The primary method of reading from the file. Reads length bytes into data starting at offset
|
// The primary method of reading from the file. Reads length bytes into data starting at offset
|
||||||
// into file. Returns number of bytes successfully read.
|
// into file. Returns number of bytes successfully read.
|
||||||
virtual std::size_t Read(u8* data, std::size_t length, std::size_t offset = 0) const = 0;
|
virtual std::size_t Read(u8* data, std::size_t length, std::size_t offset = 0) const = 0;
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
@@ -37,6 +40,10 @@ public:
|
|||||||
|
|
||||||
std::size_t GetOffset() const;
|
std::size_t GetOffset() const;
|
||||||
|
|
||||||
|
bool HasDecryptedSections() const override {
|
||||||
|
return file && file->HasDecryptedSections();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::size_t TrimToFit(std::size_t r_size, std::size_t r_offset) const;
|
std::size_t TrimToFit(std::size_t r_size, std::size_t r_offset) const;
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,10 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <chrono>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
#include "core/file_sys/errors.h"
|
#include "core/file_sys/errors.h"
|
||||||
#include "core/hle/service/cmif_serialization.h"
|
#include "core/hle/service/cmif_serialization.h"
|
||||||
#include "core/hle/service/filesystem/fsp/fs_i_storage.h"
|
#include "core/hle/service/filesystem/fsp/fs_i_storage.h"
|
||||||
@@ -31,6 +35,14 @@ Result IStorage::Read(
|
|||||||
R_UNLESS(length >= 0, FileSys::ResultInvalidSize);
|
R_UNLESS(length >= 0, FileSys::ResultInvalidSize);
|
||||||
R_UNLESS(offset >= 0, FileSys::ResultInvalidOffset);
|
R_UNLESS(offset >= 0, FileSys::ResultInvalidOffset);
|
||||||
|
|
||||||
|
const auto now = std::chrono::steady_clock::now();
|
||||||
|
if (now < next_read_tick) {
|
||||||
|
std::this_thread::sleep_for(next_read_tick - now);
|
||||||
|
}
|
||||||
|
next_read_tick = std::chrono::steady_clock::now() +
|
||||||
|
std::chrono::nanoseconds{std::min(length, MaxChargedReadSize) *
|
||||||
|
1'000'000'000 / ReadBytesPerSecond};
|
||||||
|
|
||||||
// Read the data from the Storage backend
|
// Read the data from the Storage backend
|
||||||
backend->Read(out_bytes.data(), length, offset);
|
backend->Read(out_bytes.data(), length, offset);
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
#include "core/file_sys/vfs/vfs.h"
|
#include "core/file_sys/vfs/vfs.h"
|
||||||
#include "core/hle/service/cmif_types.h"
|
#include "core/hle/service/cmif_types.h"
|
||||||
#include "core/hle/service/filesystem/filesystem.h"
|
#include "core/hle/service/filesystem/filesystem.h"
|
||||||
@@ -20,6 +22,10 @@ public:
|
|||||||
private:
|
private:
|
||||||
FileSys::VirtualFile backend;
|
FileSys::VirtualFile backend;
|
||||||
|
|
||||||
|
static constexpr s64 ReadBytesPerSecond = 40'000'000;
|
||||||
|
static constexpr s64 MaxChargedReadSize = 64 * 1024;
|
||||||
|
std::chrono::steady_clock::time_point next_read_tick{};
|
||||||
|
|
||||||
Result Read(
|
Result Read(
|
||||||
OutBuffer<BufferAttr_HipcMapAlias | BufferAttr_HipcMapTransferAllowsNonSecure> out_bytes,
|
OutBuffer<BufferAttr_HipcMapAlias | BufferAttr_HipcMapTransferAllowsNonSecure> out_bytes,
|
||||||
s64 offset, s64 length);
|
s64 offset, s64 length);
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/logging.h"
|
#include "common/logging.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/hle/kernel/k_process.h"
|
|
||||||
#include "core/hle/service/nvdrv/core/container.h"
|
#include "core/hle/service/nvdrv/core/container.h"
|
||||||
#include "core/hle/service/nvdrv/devices/ioctl_serialization.h"
|
#include "core/hle/service/nvdrv/devices/ioctl_serialization.h"
|
||||||
#include "core/hle/service/nvdrv/devices/nvhost_nvdec.h"
|
#include "core/hle/service/nvdrv/devices/nvhost_nvdec.h"
|
||||||
@@ -72,23 +71,17 @@ NvResult nvhost_nvdec::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> in
|
|||||||
|
|
||||||
void nvhost_nvdec::OnOpen(NvCore::SessionId session_id, DeviceFD fd) {
|
void nvhost_nvdec::OnOpen(NvCore::SessionId session_id, DeviceFD fd) {
|
||||||
LOG_INFO(Service_NVDRV, "NVDEC video stream started");
|
LOG_INFO(Service_NVDRV, "NVDEC video stream started");
|
||||||
|
system.SetNVDECActive(true);
|
||||||
sessions[fd] = session_id;
|
sessions[fd] = session_id;
|
||||||
if (const auto* session = core.GetSession(session_id);
|
|
||||||
session != nullptr && session->process != nullptr) {
|
|
||||||
system.NotifyNVDECChannelOpen(session->process->GetId());
|
|
||||||
}
|
|
||||||
host1x.StartDevice(fd, Tegra::Host1x::ChannelType::NvDec, channel_syncpoint);
|
host1x.StartDevice(fd, Tegra::Host1x::ChannelType::NvDec, channel_syncpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nvhost_nvdec::OnClose(DeviceFD fd) {
|
void nvhost_nvdec::OnClose(DeviceFD fd) {
|
||||||
LOG_INFO(Service_NVDRV, "NVDEC video stream ended");
|
LOG_INFO(Service_NVDRV, "NVDEC video stream ended");
|
||||||
host1x.StopDevice(fd, Tegra::Host1x::ChannelType::NvDec);
|
host1x.StopDevice(fd, Tegra::Host1x::ChannelType::NvDec);
|
||||||
|
system.SetNVDECActive(false);
|
||||||
auto it = sessions.find(fd);
|
auto it = sessions.find(fd);
|
||||||
if (it != sessions.end()) {
|
if (it != sessions.end()) {
|
||||||
if (const auto* session = core.GetSession(it->second);
|
|
||||||
session != nullptr && session->process != nullptr) {
|
|
||||||
system.NotifyNVDECChannelClose(session->process->GetId());
|
|
||||||
}
|
|
||||||
sessions.erase(it);
|
sessions.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,16 +4,12 @@
|
|||||||
// 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
|
||||||
|
|
||||||
#include <chrono>
|
|
||||||
#include <fmt/ranges.h>
|
#include <fmt/ranges.h>
|
||||||
#include <string_view>
|
|
||||||
#include <thread>
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/logging.h"
|
#include "common/logging.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/hle/ipc.h"
|
#include "core/hle/ipc.h"
|
||||||
#include "core/hle/kernel/k_process.h"
|
|
||||||
#include "core/hle/kernel/kernel.h"
|
#include "core/hle/kernel/kernel.h"
|
||||||
#include "core/hle/service/ipc_helpers.h"
|
#include "core/hle/service/ipc_helpers.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
@@ -37,7 +33,6 @@ ServiceFrameworkBase::ServiceFrameworkBase(Core::System& system_, const char* se
|
|||||||
: SessionRequestHandler(system_.Kernel(), service_name_)
|
: SessionRequestHandler(system_.Kernel(), service_name_)
|
||||||
, system{system_}
|
, system{system_}
|
||||||
, service_name{service_name_}
|
, service_name{service_name_}
|
||||||
, is_i_storage{std::string_view{service_name_} == "IStorage"}
|
|
||||||
, handler_invoker{handler_invoker_}
|
, handler_invoker{handler_invoker_}
|
||||||
, max_sessions{max_sessions_}
|
, max_sessions{max_sessions_}
|
||||||
{}
|
{}
|
||||||
@@ -82,22 +77,13 @@ void ServiceFrameworkBase::ReportUnimplementedFunction(HLERequestContext& ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ServiceFrameworkBase::InvokeRequest(HLERequestContext& ctx) {
|
void ServiceFrameworkBase::InvokeRequest(HLERequestContext& ctx) {
|
||||||
const auto command = ctx.GetCommand();
|
auto it = handlers.find(ctx.GetCommand());
|
||||||
auto it = handlers.find(command);
|
|
||||||
const bool is_cmd_read = command == 0;
|
|
||||||
FunctionInfoBase const* info = it == handlers.end() ? nullptr : &it->second;
|
FunctionInfoBase const* info = it == handlers.end() ? nullptr : &it->second;
|
||||||
if (info == nullptr || info->handler_callback == nullptr)
|
if (info == nullptr || info->handler_callback == nullptr)
|
||||||
return ReportUnimplementedFunction(ctx, info);
|
return ReportUnimplementedFunction(ctx, info);
|
||||||
|
|
||||||
LOG_TRACE(Service, "{}", MakeFunctionString(info->name, GetServiceName(), ctx.CommandBuffer()));
|
LOG_TRACE(Service, "{}", MakeFunctionString(info->name, GetServiceName(), ctx.CommandBuffer()));
|
||||||
handler_invoker(this, info->handler_callback, ctx);
|
handler_invoker(this, info->handler_callback, ctx);
|
||||||
|
|
||||||
if (is_i_storage && is_cmd_read) {
|
|
||||||
const auto* const process = ctx.GetThread().GetOwnerProcess();
|
|
||||||
if (process != nullptr && system.IsNVDECActiveForProcess(process->GetId())) {
|
|
||||||
std::this_thread::sleep_for(std::chrono::microseconds{600});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServiceFrameworkBase::InvokeRequestTipc(HLERequestContext& ctx) {
|
void ServiceFrameworkBase::InvokeRequestTipc(HLERequestContext& ctx) {
|
||||||
|
|||||||
@@ -107,8 +107,6 @@ protected:
|
|||||||
Core::System& system;
|
Core::System& system;
|
||||||
/// Identifier string used to connect to the service.
|
/// Identifier string used to connect to the service.
|
||||||
const char* service_name;
|
const char* service_name;
|
||||||
/// Whether this is the IStorage service.
|
|
||||||
const bool is_i_storage;
|
|
||||||
/// Function used to safely up-cast pointers to the derived class before invoking a handler.
|
/// Function used to safely up-cast pointers to the derived class before invoking a handler.
|
||||||
InvokerFn* handler_invoker;
|
InvokerFn* handler_invoker;
|
||||||
/// Maximum number of concurrent sessions that this service can handle.
|
/// Maximum number of concurrent sessions that this service can handle.
|
||||||
|
|||||||
@@ -82,23 +82,27 @@ std::shared_ptr<FileSys::NSP> OpenContainerAsNsp(FileSys::VirtualFile file, File
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == FileType::NSP) {
|
if (type == FileType::NSP || type == FileType::NSZ) {
|
||||||
auto nsp = std::make_shared<FileSys::NSP>(file, program_id, program_index);
|
auto nsp = std::make_shared<FileSys::NSP>(file, program_id, program_index);
|
||||||
return nsp->GetStatus() == ResultStatus::Success ? nsp : nullptr;
|
return nsp->GetStatus() == ResultStatus::Success ? nsp : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == FileType::XCI) {
|
if (type == FileType::XCI || type == FileType::XCZ) {
|
||||||
FileSys::XCI xci{file, program_id, program_index};
|
FileSys::XCI xci{file, program_id, program_index};
|
||||||
if (xci.GetStatus() != ResultStatus::Success) {
|
if (xci.GetStatus() == ResultStatus::Success) {
|
||||||
return nullptr;
|
auto secure_nsp = xci.GetSecurePartitionNSP();
|
||||||
|
if (secure_nsp != nullptr && secure_nsp->GetStatus() == ResultStatus::Success) {
|
||||||
|
return secure_nsp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto secure_nsp = xci.GetSecurePartitionNSP();
|
// PFS0-shaped .xcz (NSZ-style container) does not parse as XCI; fall back to NSP.
|
||||||
if (secure_nsp == nullptr || secure_nsp->GetStatus() != ResultStatus::Success) {
|
if (type == FileType::XCZ) {
|
||||||
return nullptr;
|
auto nsp = std::make_shared<FileSys::NSP>(file, program_id, program_index);
|
||||||
|
return nsp->GetStatus() == ResultStatus::Success ? nsp : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return secure_nsp;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -144,7 +148,8 @@ FileType IdentifyFile(FileSys::VirtualFile file) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool IsContainerType(FileType type) {
|
bool IsContainerType(FileType type) {
|
||||||
return type == FileType::NSP || type == FileType::XCI;
|
return type == FileType::NSP || type == FileType::NSZ || type == FileType::XCI ||
|
||||||
|
type == FileType::XCZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsBootableGameContainer(FileSys::VirtualFile file, FileType type, u64 program_id,
|
bool IsBootableGameContainer(FileSys::VirtualFile file, FileType type, u64 program_id,
|
||||||
@@ -180,8 +185,12 @@ FileType GuessFromFilename(const std::string& name) {
|
|||||||
return FileType::NCA;
|
return FileType::NCA;
|
||||||
else if (extension == "xci")
|
else if (extension == "xci")
|
||||||
return FileType::XCI;
|
return FileType::XCI;
|
||||||
|
else if (extension == "xcz")
|
||||||
|
return FileType::XCZ;
|
||||||
else if (extension == "nsp")
|
else if (extension == "nsp")
|
||||||
return FileType::NSP;
|
return FileType::NSP;
|
||||||
|
else if (extension == "nsz")
|
||||||
|
return FileType::NSZ;
|
||||||
else if (extension == "kip")
|
else if (extension == "kip")
|
||||||
return FileType::KIP;
|
return FileType::KIP;
|
||||||
return FileType::Unknown;
|
return FileType::Unknown;
|
||||||
@@ -197,10 +206,14 @@ std::string GetFileTypeString(FileType type) {
|
|||||||
return "NCA";
|
return "NCA";
|
||||||
case FileType::XCI:
|
case FileType::XCI:
|
||||||
return "XCI";
|
return "XCI";
|
||||||
|
case FileType::XCZ:
|
||||||
|
return "XCZ";
|
||||||
case FileType::NAX:
|
case FileType::NAX:
|
||||||
return "NAX";
|
return "NAX";
|
||||||
case FileType::NSP:
|
case FileType::NSP:
|
||||||
return "NSP";
|
return "NSP";
|
||||||
|
case FileType::NSZ:
|
||||||
|
return "NSZ";
|
||||||
case FileType::KIP:
|
case FileType::KIP:
|
||||||
return "KIP";
|
return "KIP";
|
||||||
case FileType::DeconstructedRomDirectory:
|
case FileType::DeconstructedRomDirectory:
|
||||||
@@ -326,12 +339,29 @@ static std::unique_ptr<AppLoader> GetFileLoader(Core::System& system, FileSys::V
|
|||||||
system.GetContentProvider(), program_id,
|
system.GetContentProvider(), program_id,
|
||||||
program_index);
|
program_index);
|
||||||
|
|
||||||
|
// NCZ-compressed XCI container. XCI-shaped .xcz goes to the XCI loader, while
|
||||||
|
// PFS0-shaped (NSZ-style) .xcz containers fall back to the NSP loader.
|
||||||
|
case FileType::XCZ: {
|
||||||
|
FileSys::XCI probe{file, program_id, program_index};
|
||||||
|
if (probe.GetStatus() == ResultStatus::Success &&
|
||||||
|
probe.GetSecurePartitionNSP() != nullptr) {
|
||||||
|
return std::make_unique<AppLoader_XCI>(std::move(file),
|
||||||
|
system.GetFileSystemController(),
|
||||||
|
system.GetContentProvider(), program_id,
|
||||||
|
program_index);
|
||||||
|
}
|
||||||
|
return std::make_unique<AppLoader_NSP>(std::move(file), system.GetFileSystemController(),
|
||||||
|
system.GetContentProvider(), program_id,
|
||||||
|
program_index);
|
||||||
|
}
|
||||||
|
|
||||||
// NX NAX (NintendoAesXts) file format.
|
// NX NAX (NintendoAesXts) file format.
|
||||||
case FileType::NAX:
|
case FileType::NAX:
|
||||||
return std::make_unique<AppLoader_NAX>(std::move(file));
|
return std::make_unique<AppLoader_NAX>(std::move(file));
|
||||||
|
|
||||||
// NX NSP (Nintendo Submission Package) file format
|
// NX NSP (Nintendo Submission Package) file format
|
||||||
case FileType::NSP:
|
case FileType::NSP:
|
||||||
|
case FileType::NSZ:
|
||||||
return std::make_unique<AppLoader_NSP>(std::move(file), system.GetFileSystemController(),
|
return std::make_unique<AppLoader_NSP>(std::move(file), system.GetFileSystemController(),
|
||||||
system.GetContentProvider(), program_id,
|
system.GetContentProvider(), program_id,
|
||||||
program_index);
|
program_index);
|
||||||
|
|||||||
@@ -42,7 +42,9 @@ enum class FileType {
|
|||||||
NRO,
|
NRO,
|
||||||
NCA,
|
NCA,
|
||||||
NSP,
|
NSP,
|
||||||
|
NSZ,
|
||||||
XCI,
|
XCI,
|
||||||
|
XCZ,
|
||||||
NAX,
|
NAX,
|
||||||
KIP,
|
KIP,
|
||||||
DeconstructedRomDirectory,
|
DeconstructedRomDirectory,
|
||||||
|
|||||||
@@ -56,6 +56,17 @@ AppLoader_NSP::AppLoader_NSP(FileSys::VirtualFile file_,
|
|||||||
AppLoader_NSP::~AppLoader_NSP() = default;
|
AppLoader_NSP::~AppLoader_NSP() = default;
|
||||||
|
|
||||||
FileType AppLoader_NSP::IdentifyType(const FileSys::VirtualFile& nsp_file) {
|
FileType AppLoader_NSP::IdentifyType(const FileSys::VirtualFile& nsp_file) {
|
||||||
|
// .nsz is NSP-compatible; return NSZ so the game list shows the right type.
|
||||||
|
if (nsp_file->GetName().ends_with(".nsz")) {
|
||||||
|
return FileType::NSZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// PFS0-shaped .xcz containers are handled by this loader too; report XCZ so the game
|
||||||
|
// list does not show them as NSP. XCI-shaped .xcz is identified by AppLoader_XCI.
|
||||||
|
if (nsp_file->GetName().ends_with(".xcz")) {
|
||||||
|
return FileType::XCZ;
|
||||||
|
}
|
||||||
|
|
||||||
const FileSys::NSP nsp(nsp_file);
|
const FileSys::NSP nsp(nsp_file);
|
||||||
|
|
||||||
if (nsp.GetStatus() != ResultStatus::Success) {
|
if (nsp.GetStatus() != ResultStatus::Success) {
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ FileType AppLoader_XCI::IdentifyType(const FileSys::VirtualFile& xci_file) {
|
|||||||
// Identify XCI as a valid container even when it does not include a bootable Program NCA.
|
// Identify XCI as a valid container even when it does not include a bootable Program NCA.
|
||||||
// Bootability is handled by AppLoader_XCI::Load().
|
// Bootability is handled by AppLoader_XCI::Load().
|
||||||
if (xci.GetSecurePartitionNSP() != nullptr) {
|
if (xci.GetSecurePartitionNSP() != nullptr) {
|
||||||
return FileType::XCI;
|
return xci_file->GetName().ends_with(".xcz") ? FileType::XCZ
|
||||||
|
: FileType::XCI;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FileType::Error;
|
return FileType::Error;
|
||||||
|
|||||||
@@ -757,7 +757,7 @@ struct Memory::Impl {
|
|||||||
};
|
};
|
||||||
auto& gpu = system.GPU();
|
auto& gpu = system.GPU();
|
||||||
gpu_device_memory->ApplyOpOnPointer(
|
gpu_device_memory->ApplyOpOnPointer(
|
||||||
p, scratch_buffers[core], [&](DAddr address) { gpu.InvalidateRegion(address, size, true); });
|
p, scratch_buffers[core], [&](DAddr address) { gpu.InvalidateRegion(address, size); });
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::System& system;
|
Core::System& system;
|
||||||
|
|||||||
@@ -4,8 +4,11 @@
|
|||||||
// 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
|
||||||
|
|
||||||
|
#include <cctype>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
#include "common/hex_util.h"
|
#include "common/hex_util.h"
|
||||||
|
#include "common/logging.h"
|
||||||
|
#include "common/settings.h"
|
||||||
#include "common/swap.h"
|
#include "common/swap.h"
|
||||||
#include "core/arm/debug.h"
|
#include "core/arm/debug.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
@@ -28,11 +31,11 @@ constexpr auto CHEAT_ENGINE_NS = std::chrono::nanoseconds{1000000000 / 12};
|
|||||||
std::string_view ExtractName(std::size_t& out_name_size, std::string_view data,
|
std::string_view ExtractName(std::size_t& out_name_size, std::string_view data,
|
||||||
std::size_t start_index, char match) {
|
std::size_t start_index, char match) {
|
||||||
auto end_index = start_index;
|
auto end_index = start_index;
|
||||||
while (data[end_index] != match) {
|
while (end_index < data.size() && data[end_index] != match) {
|
||||||
++end_index;
|
++end_index;
|
||||||
if (end_index > data.size()) {
|
}
|
||||||
return {};
|
if (end_index == data.size()) {
|
||||||
}
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
out_name_size = end_index - start_index;
|
out_name_size = end_index - start_index;
|
||||||
@@ -130,6 +133,11 @@ void StandardVmCallbacks::CommandLog(std::string_view data) {
|
|||||||
data.back() == '\n' ? data.substr(0, data.size() - 1) : data);
|
data.back() == '\n' ? data.substr(0, data.size() - 1) : data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool StandardVmCallbacks::IsCommandLogEnabled() const {
|
||||||
|
return Common::Log::IsMessageEnabled(Common::Log::Class::CheatEngine,
|
||||||
|
Common::Log::Level::Debug);
|
||||||
|
}
|
||||||
|
|
||||||
bool StandardVmCallbacks::IsAddressInRange(VAddr in) const {
|
bool StandardVmCallbacks::IsAddressInRange(VAddr in) const {
|
||||||
if ((in < metadata.main_nso_extents.base ||
|
if ((in < metadata.main_nso_extents.base ||
|
||||||
in >= metadata.main_nso_extents.base + metadata.main_nso_extents.size) &&
|
in >= metadata.main_nso_extents.base + metadata.main_nso_extents.size) &&
|
||||||
@@ -166,8 +174,9 @@ std::vector<CheatEntry> TextCheatParser::Parse(std::string_view data) const {
|
|||||||
|
|
||||||
if (data[i] == '{') {
|
if (data[i] == '{') {
|
||||||
current_entry = 0;
|
current_entry = 0;
|
||||||
|
out[*current_entry].is_master = true;
|
||||||
|
|
||||||
if (out[*current_entry].definition.num_opcodes > 0) {
|
if (!out[*current_entry].definition.opcodes.empty()) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,32 +212,33 @@ std::vector<CheatEntry> TextCheatParser::Parse(std::string_view data) const {
|
|||||||
'\0';
|
'\0';
|
||||||
|
|
||||||
i += name_size + 1;
|
i += name_size + 1;
|
||||||
} else if (::isxdigit(data[i])) {
|
} else if (std::isxdigit(static_cast<unsigned char>(data[i]))) {
|
||||||
if (!current_entry || out[*current_entry].definition.num_opcodes >=
|
if (!current_entry || data.size() - i < 8) {
|
||||||
out[*current_entry].definition.opcodes.size()) {
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto hex = std::string(data.substr(i, 8));
|
const auto hex = std::string(data.substr(i, 8));
|
||||||
if (!std::all_of(hex.begin(), hex.end(), ::isxdigit)) {
|
if (!std::all_of(hex.begin(), hex.end(), [](char value) {
|
||||||
|
return std::isxdigit(static_cast<unsigned char>(value));
|
||||||
|
})) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto value = static_cast<u32>(std::strtoul(hex.c_str(), nullptr, 0x10));
|
const auto value = static_cast<u32>(std::strtoul(hex.c_str(), nullptr, 0x10));
|
||||||
out[*current_entry].definition.opcodes[out[*current_entry].definition.num_opcodes++] =
|
out[*current_entry].definition.opcodes.push_back(value);
|
||||||
value;
|
|
||||||
|
|
||||||
i += 8;
|
i += 7;
|
||||||
} else {
|
} else {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out[0].enabled = out[0].definition.num_opcodes > 0;
|
out[0].enabled = out[0].is_master && !out[0].definition.opcodes.empty();
|
||||||
out[0].cheat_id = 0;
|
out[0].cheat_id = 0;
|
||||||
|
|
||||||
for (u32 i = 1; i < out.size(); ++i) {
|
for (u32 i = 1; i < out.size(); ++i) {
|
||||||
out[i].enabled = out[i].definition.num_opcodes > 0;
|
out[i].enabled = Settings::values.enable_cheats_by_default.GetValue() &&
|
||||||
|
!out[i].definition.opcodes.empty();
|
||||||
out[i].cheat_id = i;
|
out[i].cheat_id = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,6 +250,10 @@ CheatEngine::CheatEngine(System& system_, std::vector<CheatEntry> cheats_,
|
|||||||
: vm{std::make_unique<StandardVmCallbacks>(system_, metadata)},
|
: vm{std::make_unique<StandardVmCallbacks>(system_, metadata)},
|
||||||
cheats(std::move(cheats_)), core_timing{system_.CoreTiming()}, system{system_} {
|
cheats(std::move(cheats_)), core_timing{system_.CoreTiming()}, system{system_} {
|
||||||
metadata.main_nso_build_id = build_id_;
|
metadata.main_nso_build_id = build_id_;
|
||||||
|
for (u32 i = 0; i < cheats.size(); ++i) {
|
||||||
|
cheats[i].cheat_id = i;
|
||||||
|
cheats[i].enabled = cheats[i].is_master || cheats[i].enabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CheatEngine::~CheatEngine() {
|
CheatEngine::~CheatEngine() {
|
||||||
@@ -286,12 +300,56 @@ void CheatEngine::SetMainMemoryParameters(VAddr main_region_begin, u64 main_regi
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CheatEngine::Reload(std::vector<CheatEntry> reload_cheats) {
|
void CheatEngine::Reload(std::vector<CheatEntry> reload_cheats) {
|
||||||
cheats = std::move(reload_cheats);
|
{
|
||||||
is_pending_reload.exchange(true);
|
std::scoped_lock lock{cheats_mutex};
|
||||||
|
cheats = std::move(reload_cheats);
|
||||||
|
for (u32 i = 0; i < cheats.size(); ++i) {
|
||||||
|
cheats[i].cheat_id = i;
|
||||||
|
cheats[i].enabled = cheats[i].is_master || cheats[i].enabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
is_pending_reload.store(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<RuntimeCheatInfo> CheatEngine::GetCheats() const {
|
||||||
|
std::scoped_lock lock{cheats_mutex};
|
||||||
|
std::vector<RuntimeCheatInfo> result;
|
||||||
|
result.reserve(cheats.size());
|
||||||
|
for (const auto& cheat : cheats) {
|
||||||
|
if (cheat.definition.opcodes.empty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
result.push_back({
|
||||||
|
.id = cheat.cheat_id,
|
||||||
|
.name = cheat.definition.readable_name.data(),
|
||||||
|
.enabled = cheat.enabled || cheat.is_master,
|
||||||
|
.is_master = cheat.is_master,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CheatEngine::SetCheatEnabled(u32 cheat_id, bool enabled) {
|
||||||
|
std::scoped_lock lock{cheats_mutex};
|
||||||
|
const auto entry = std::find_if(cheats.begin(), cheats.end(), [cheat_id](const auto& cheat) {
|
||||||
|
return cheat.cheat_id == cheat_id && !cheat.definition.opcodes.empty();
|
||||||
|
});
|
||||||
|
if (entry == cheats.end()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (entry->is_master) {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
if (entry->enabled != enabled) {
|
||||||
|
entry->enabled = enabled;
|
||||||
|
is_pending_reload.store(true);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheatEngine::FrameCallback(std::chrono::nanoseconds ns_late) {
|
void CheatEngine::FrameCallback(std::chrono::nanoseconds ns_late) {
|
||||||
if (is_pending_reload.exchange(false)) {
|
if (is_pending_reload.exchange(false)) {
|
||||||
|
std::scoped_lock lock{cheats_mutex};
|
||||||
vm.LoadProgram(cheats);
|
vm.LoadProgram(cheats);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <mutex>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/memory/dmnt_cheat_types.h"
|
#include "core/memory/dmnt_cheat_types.h"
|
||||||
@@ -41,6 +42,7 @@ public:
|
|||||||
void ResumeProcess() override;
|
void ResumeProcess() override;
|
||||||
void DebugLog(u8 id, u64 value) override;
|
void DebugLog(u8 id, u64 value) override;
|
||||||
void CommandLog(std::string_view data) override;
|
void CommandLog(std::string_view data) override;
|
||||||
|
[[nodiscard]] bool IsCommandLogEnabled() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool IsAddressInRange(VAddr address) const;
|
bool IsAddressInRange(VAddr address) const;
|
||||||
@@ -81,6 +83,8 @@ public:
|
|||||||
void SetMainMemoryParameters(VAddr main_region_begin, u64 main_region_size);
|
void SetMainMemoryParameters(VAddr main_region_begin, u64 main_region_size);
|
||||||
|
|
||||||
void Reload(std::vector<CheatEntry> reload_cheats);
|
void Reload(std::vector<CheatEntry> reload_cheats);
|
||||||
|
[[nodiscard]] std::vector<RuntimeCheatInfo> GetCheats() const;
|
||||||
|
bool SetCheatEnabled(u32 cheat_id, bool enabled);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void FrameCallback(std::chrono::nanoseconds ns_late);
|
void FrameCallback(std::chrono::nanoseconds ns_late);
|
||||||
@@ -89,6 +93,7 @@ private:
|
|||||||
CheatProcessMetadata metadata;
|
CheatProcessMetadata metadata;
|
||||||
|
|
||||||
std::vector<CheatEntry> cheats;
|
std::vector<CheatEntry> cheats;
|
||||||
|
mutable std::mutex cheats_mutex;
|
||||||
std::atomic_bool is_pending_reload{false};
|
std::atomic_bool is_pending_reload{false};
|
||||||
|
|
||||||
std::shared_ptr<Core::Timing::EventType> event;
|
std::shared_ptr<Core::Timing::EventType> event;
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
|
||||||
namespace Core::Memory {
|
namespace Core::Memory {
|
||||||
@@ -24,14 +30,21 @@ struct CheatProcessMetadata {
|
|||||||
|
|
||||||
struct CheatDefinition {
|
struct CheatDefinition {
|
||||||
std::array<char, 0x40> readable_name{};
|
std::array<char, 0x40> readable_name{};
|
||||||
u32 num_opcodes{};
|
std::vector<u32> opcodes;
|
||||||
std::array<u32, 0x100> opcodes{};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CheatEntry {
|
struct CheatEntry {
|
||||||
bool enabled{};
|
bool enabled{};
|
||||||
|
bool is_master{};
|
||||||
u32 cheat_id{};
|
u32 cheat_id{};
|
||||||
CheatDefinition definition{};
|
CheatDefinition definition{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct RuntimeCheatInfo {
|
||||||
|
u32 id{};
|
||||||
|
std::string name;
|
||||||
|
bool enabled{};
|
||||||
|
bool is_master{};
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace Core::Memory
|
} // namespace Core::Memory
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
@@ -233,7 +236,7 @@ bool DmntCheatVm::DecodeNextOpcode(CheatVmOpcode& out) {
|
|||||||
|
|
||||||
// Helper function for getting instruction dwords.
|
// Helper function for getting instruction dwords.
|
||||||
const auto GetNextDword = [&] {
|
const auto GetNextDword = [&] {
|
||||||
if (instruction_ptr >= num_opcodes) {
|
if (instruction_ptr >= program.size()) {
|
||||||
valid = false;
|
valid = false;
|
||||||
return static_cast<u32>(0);
|
return static_cast<u32>(0);
|
||||||
}
|
}
|
||||||
@@ -709,20 +712,20 @@ void DmntCheatVm::ResetState() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool DmntCheatVm::LoadProgram(const std::vector<CheatEntry>& entries) {
|
bool DmntCheatVm::LoadProgram(const std::vector<CheatEntry>& entries) {
|
||||||
// Reset opcode count.
|
program.clear();
|
||||||
num_opcodes = 0;
|
|
||||||
|
|
||||||
for (std::size_t i = 0; i < entries.size(); i++) {
|
std::size_t program_size{};
|
||||||
if (entries[i].enabled) {
|
for (const auto& entry : entries) {
|
||||||
// Bounds check.
|
if (entry.enabled || entry.is_master) {
|
||||||
if (entries[i].definition.num_opcodes + num_opcodes > MaximumProgramOpcodeCount) {
|
program_size += entry.definition.opcodes.size();
|
||||||
num_opcodes = 0;
|
}
|
||||||
return false;
|
}
|
||||||
}
|
program.reserve(program_size);
|
||||||
|
|
||||||
for (std::size_t n = 0; n < entries[i].definition.num_opcodes; n++) {
|
for (const auto& entry : entries) {
|
||||||
program[num_opcodes++] = entries[i].definition.opcodes[n];
|
if (entry.enabled || entry.is_master) {
|
||||||
}
|
program.insert(program.end(), entry.definition.opcodes.begin(),
|
||||||
|
entry.definition.opcodes.end());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -735,27 +738,35 @@ void DmntCheatVm::Execute(const CheatProcessMetadata& metadata) {
|
|||||||
// Get Keys down.
|
// Get Keys down.
|
||||||
u64 kDown = callbacks->HidKeysDown();
|
u64 kDown = callbacks->HidKeysDown();
|
||||||
|
|
||||||
callbacks->CommandLog("Started VM execution.");
|
const bool command_log_enabled = callbacks->IsCommandLogEnabled();
|
||||||
callbacks->CommandLog(fmt::format("Main NSO: {:012X}", metadata.main_nso_extents.base));
|
if (command_log_enabled) {
|
||||||
callbacks->CommandLog(fmt::format("Heap: {:012X}", metadata.main_nso_extents.base));
|
callbacks->CommandLog("Started VM execution.");
|
||||||
callbacks->CommandLog(fmt::format("Keys Down: {:08X}", static_cast<u32>(kDown & 0x0FFFFFFF)));
|
callbacks->CommandLog(fmt::format("Main NSO: {:012X}", metadata.main_nso_extents.base));
|
||||||
|
callbacks->CommandLog(fmt::format("Heap: {:012X}", metadata.main_nso_extents.base));
|
||||||
|
callbacks->CommandLog(
|
||||||
|
fmt::format("Keys Down: {:08X}", static_cast<u32>(kDown & 0x0FFFFFFF)));
|
||||||
|
}
|
||||||
|
|
||||||
// Clear VM state.
|
// Clear VM state.
|
||||||
ResetState();
|
ResetState();
|
||||||
|
|
||||||
// Loop until program finishes.
|
// Loop until program finishes.
|
||||||
while (DecodeNextOpcode(cur_opcode)) {
|
while (DecodeNextOpcode(cur_opcode)) {
|
||||||
callbacks->CommandLog(
|
if (command_log_enabled) {
|
||||||
fmt::format("Instruction Ptr: {:04X}", static_cast<u32>(instruction_ptr)));
|
callbacks->CommandLog(
|
||||||
|
fmt::format("Instruction Ptr: {:04X}", static_cast<u32>(instruction_ptr)));
|
||||||
|
|
||||||
for (std::size_t i = 0; i < NumRegisters; i++) {
|
for (std::size_t i = 0; i < NumRegisters; i++) {
|
||||||
callbacks->CommandLog(fmt::format("Registers[{:02X}]: {:016X}", i, registers[i]));
|
callbacks->CommandLog(fmt::format("Registers[{:02X}]: {:016X}", i,
|
||||||
}
|
registers[i]));
|
||||||
|
}
|
||||||
|
|
||||||
for (std::size_t i = 0; i < NumRegisters; i++) {
|
for (std::size_t i = 0; i < NumRegisters; i++) {
|
||||||
callbacks->CommandLog(fmt::format("SavedRegs[{:02X}]: {:016X}", i, saved_values[i]));
|
callbacks->CommandLog(fmt::format("SavedRegs[{:02X}]: {:016X}", i,
|
||||||
|
saved_values[i]));
|
||||||
|
}
|
||||||
|
LogOpcode(cur_opcode);
|
||||||
}
|
}
|
||||||
LogOpcode(cur_opcode);
|
|
||||||
|
|
||||||
// Increment conditional depth, if relevant.
|
// Increment conditional depth, if relevant.
|
||||||
if (cur_opcode.begin_conditional_block) {
|
if (cur_opcode.begin_conditional_block) {
|
||||||
|
|||||||
@@ -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 2019 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
||||||
@@ -281,9 +281,9 @@ public:
|
|||||||
|
|
||||||
virtual void DebugLog(u8 id, u64 value) = 0;
|
virtual void DebugLog(u8 id, u64 value) = 0;
|
||||||
virtual void CommandLog(std::string_view data) = 0;
|
virtual void CommandLog(std::string_view data) = 0;
|
||||||
|
[[nodiscard]] virtual bool IsCommandLogEnabled() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr std::size_t MaximumProgramOpcodeCount = 0x400;
|
|
||||||
static constexpr std::size_t NumRegisters = 0x10;
|
static constexpr std::size_t NumRegisters = 0x10;
|
||||||
static constexpr std::size_t NumReadableStaticRegisters = 0x80;
|
static constexpr std::size_t NumReadableStaticRegisters = 0x80;
|
||||||
static constexpr std::size_t NumWritableStaticRegisters = 0x80;
|
static constexpr std::size_t NumWritableStaticRegisters = 0x80;
|
||||||
@@ -294,7 +294,7 @@ public:
|
|||||||
~DmntCheatVm();
|
~DmntCheatVm();
|
||||||
|
|
||||||
std::size_t GetProgramSize() const {
|
std::size_t GetProgramSize() const {
|
||||||
return this->num_opcodes;
|
return program.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LoadProgram(const std::vector<CheatEntry>& cheats);
|
bool LoadProgram(const std::vector<CheatEntry>& cheats);
|
||||||
@@ -303,11 +303,10 @@ public:
|
|||||||
private:
|
private:
|
||||||
std::unique_ptr<Callbacks> callbacks;
|
std::unique_ptr<Callbacks> callbacks;
|
||||||
|
|
||||||
std::size_t num_opcodes = 0;
|
|
||||||
std::size_t instruction_ptr = 0;
|
std::size_t instruction_ptr = 0;
|
||||||
std::size_t condition_depth = 0;
|
std::size_t condition_depth = 0;
|
||||||
bool decode_success = false;
|
bool decode_success = false;
|
||||||
std::array<u32, MaximumProgramOpcodeCount> program{};
|
std::vector<u32> program;
|
||||||
std::array<u64, NumRegisters> registers{};
|
std::array<u64, NumRegisters> registers{};
|
||||||
std::array<u64, NumRegisters> saved_values{};
|
std::array<u64, NumRegisters> saved_values{};
|
||||||
std::array<u64, NumStaticRegisters> static_registers{};
|
std::array<u64, NumStaticRegisters> static_registers{};
|
||||||
|
|||||||
@@ -11,34 +11,15 @@ set(dynarmic_VERSION ${dynarmic_VERSION_MAJOR}.${dynarmic_VERSION_MINOR}.${dynar
|
|||||||
|
|
||||||
project(dynarmic LANGUAGES C CXX ASM VERSION ${dynarmic_VERSION})
|
project(dynarmic LANGUAGES C CXX ASM VERSION ${dynarmic_VERSION})
|
||||||
|
|
||||||
# Determine if we're built as a subproject (using add_subdirectory)
|
|
||||||
# or if this is the master project.
|
|
||||||
set(MASTER_PROJECT OFF)
|
|
||||||
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
|
||||||
set(MASTER_PROJECT ON)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (MASTER_PROJECT)
|
|
||||||
include(CTest)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Dynarmic project options
|
|
||||||
option(DYNARMIC_ENABLE_CPU_FEATURE_DETECTION "Turning this off causes dynarmic to assume the host CPU doesn't support anything later than SSE3" ON)
|
|
||||||
|
|
||||||
if (OPENBSD OR DRAGONFLY OR NETBSD)
|
if (OPENBSD OR DRAGONFLY OR NETBSD)
|
||||||
set(REQUIRE_WX ON)
|
set(REQUIRE_WX ON)
|
||||||
else()
|
else()
|
||||||
set(REQUIRE_WX OFF)
|
set(REQUIRE_WX OFF)
|
||||||
endif()
|
endif()
|
||||||
option(DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT "Enables support for systems that require W^X" ${REQUIRE_WX})
|
option(DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT "Enables support for systems that require W^X" ${REQUIRE_WX})
|
||||||
|
|
||||||
option(DYNARMIC_IGNORE_ASSERTS "Ignore asserts" ON)
|
|
||||||
option(DYNARMIC_TESTS_USE_UNICORN "Enable fuzzing tests against unicorn" OFF)
|
option(DYNARMIC_TESTS_USE_UNICORN "Enable fuzzing tests against unicorn" OFF)
|
||||||
CMAKE_DEPENDENT_OPTION(DYNARMIC_USE_LLVM "Support disassembly of jitted x86_64 code using LLVM" OFF "NOT YUZU_DISABLE_LLVM" OFF)
|
CMAKE_DEPENDENT_OPTION(DYNARMIC_USE_LLVM "Support disassembly of jitted x86_64 code using LLVM" OFF "NOT YUZU_DISABLE_LLVM" OFF)
|
||||||
|
|
||||||
option(DYNARMIC_INSTALL "Install dynarmic headers and CMake files" OFF)
|
|
||||||
option(DYNARMIC_USE_BUNDLED_EXTERNALS "Use all bundled externals (useful when e.g. cross-compiling)" OFF)
|
|
||||||
|
|
||||||
# Set hard requirements for C++
|
# Set hard requirements for C++
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
@@ -88,7 +69,7 @@ if (MSVC)
|
|||||||
-Wno-missing-braces)
|
-Wno-missing-braces)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
set(DYNARMIC_CXX_FLAGS
|
list(APPEND DYNARMIC_CXX_FLAGS
|
||||||
-Wall
|
-Wall
|
||||||
-Wextra
|
-Wextra
|
||||||
-Wcast-qual
|
-Wcast-qual
|
||||||
@@ -103,37 +84,35 @@ else()
|
|||||||
# to Address& after first checking isMEM(), and that code is inlined in a situation where
|
# to Address& after first checking isMEM(), and that code is inlined in a situation where
|
||||||
# GCC knows that the variable is actually a Reg64. isMEM() will never return true for a
|
# GCC knows that the variable is actually a Reg64. isMEM() will never return true for a
|
||||||
# Reg64, but GCC doesn't know that.
|
# Reg64, but GCC doesn't know that.
|
||||||
list(APPEND DYNARMIC_CXX_FLAGS -Wno-array-bounds)
|
list(APPEND DYNARMIC_CXX_FLAGS
|
||||||
list(APPEND DYNARMIC_CXX_FLAGS -Wstack-usage=4096)
|
-Wno-array-bounds
|
||||||
|
-Wstack-usage=4096)
|
||||||
endif()
|
endif()
|
||||||
if (CXX_CLANG)
|
if (CXX_CLANG)
|
||||||
# Bracket depth determines maximum size of a fold expression in Clang since 9c9974c3ccb6.
|
list(APPEND DYNARMIC_CXX_FLAGS
|
||||||
# And this in turns limits the size of a std::array.
|
# Bracket depth determines maximum size of a fold expression in Clang since 9c9974c3ccb6.
|
||||||
list(APPEND DYNARMIC_CXX_FLAGS -fbracket-depth=1024)
|
# And this in turns limits the size of a std::array.
|
||||||
# Clang mistakenly blames CMake for using unused arguments during compilation
|
-fbracket-depth=1024
|
||||||
list(APPEND DYNARMIC_CXX_FLAGS -Wno-unused-command-line-argument)
|
# Clang mistakenly blames CMake for using unused arguments during compilation
|
||||||
|
-Wno-unused-command-line-argument)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT Boost_FOUND)
|
if (NOT Boost_FOUND)
|
||||||
find_package(Boost 1.57 REQUIRED)
|
find_package(Boost 1.57 REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(fmt 8 CONFIG)
|
find_package(fmt 8 CONFIG)
|
||||||
|
|
||||||
if ("arm64" IN_LIST ARCHITECTURE OR DYNARMIC_TESTS)
|
if (ARCHITECTURE_arm64)
|
||||||
find_package(oaknut 2.0.1 CONFIG)
|
find_package(oaknut 2.0.1 CONFIG)
|
||||||
endif()
|
endif()
|
||||||
|
if (ARCHITECTURE_riscv64)
|
||||||
if ("riscv64" IN_LIST ARCHITECTURE)
|
|
||||||
find_package(biscuit 0.9.1 REQUIRED)
|
find_package(biscuit 0.9.1 REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
if (ARCHITECTURE_loongarch64)
|
||||||
if ("loongarch64" IN_LIST ARCHITECTURE)
|
|
||||||
find_package(lagoon REQUIRED)
|
find_package(lagoon REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
if (ARCHITECTURE_x86_64)
|
||||||
if ("x86_64" IN_LIST ARCHITECTURE)
|
|
||||||
find_package(xbyak 7 CONFIG)
|
find_package(xbyak 7 CONFIG)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -142,44 +121,12 @@ if (DYNARMIC_USE_LLVM)
|
|||||||
separate_arguments(LLVM_DEFINITIONS)
|
separate_arguments(LLVM_DEFINITIONS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Dynarmic project files
|
||||||
|
add_subdirectory(src/dynarmic)
|
||||||
if (DYNARMIC_TESTS)
|
if (DYNARMIC_TESTS)
|
||||||
find_package(Catch2 3 CONFIG)
|
find_package(Catch2 3 CONFIG)
|
||||||
if (DYNARMIC_TESTS_USE_UNICORN)
|
if (DYNARMIC_TESTS_USE_UNICORN)
|
||||||
find_package(Unicorn REQUIRED)
|
find_package(Unicorn REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
|
|
||||||
# Dynarmic project files
|
|
||||||
add_subdirectory(src/dynarmic)
|
|
||||||
if (DYNARMIC_TESTS)
|
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#
|
|
||||||
# Install
|
|
||||||
#
|
|
||||||
if (DYNARMIC_INSTALL)
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
include(CMakePackageConfigHelpers)
|
|
||||||
|
|
||||||
install(TARGETS dynarmic EXPORT dynarmicTargets)
|
|
||||||
install(EXPORT dynarmicTargets
|
|
||||||
NAMESPACE dynarmic::
|
|
||||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/dynarmic"
|
|
||||||
)
|
|
||||||
|
|
||||||
configure_package_config_file(CMakeModules/dynarmicConfig.cmake.in
|
|
||||||
dynarmicConfig.cmake
|
|
||||||
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/dynarmic"
|
|
||||||
)
|
|
||||||
write_basic_package_version_file(dynarmicConfigVersion.cmake
|
|
||||||
COMPATIBILITY SameMajorVersion
|
|
||||||
)
|
|
||||||
install(FILES
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/dynarmicConfig.cmake"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/dynarmicConfigVersion.cmake"
|
|
||||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/dynarmic"
|
|
||||||
)
|
|
||||||
|
|
||||||
install(DIRECTORY src/dynarmic TYPE INCLUDE FILES_MATCHING PATTERN "*.h")
|
|
||||||
endif()
|
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
function(target_architecture_specific_sources project arch)
|
|
||||||
if (NOT MULTIARCH_BUILD)
|
|
||||||
target_sources("${project}" PRIVATE ${ARGN})
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
foreach(input_file IN LISTS ARGN)
|
|
||||||
if(input_file MATCHES ".cpp$")
|
|
||||||
if(NOT IS_ABSOLUTE ${input_file})
|
|
||||||
set(input_file "${CMAKE_CURRENT_SOURCE_DIR}/${input_file}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(output_file "${CMAKE_CURRENT_BINARY_DIR}/arch_gen/${input_file}")
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT "${output_file}"
|
|
||||||
COMMAND ${CMAKE_COMMAND} "-Darch=${arch}"
|
|
||||||
"-Dinput_file=${input_file}"
|
|
||||||
"-Doutput_file=${output_file}"
|
|
||||||
-P "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/impl/TargetArchitectureSpecificSourcesWrapFile.cmake"
|
|
||||||
DEPENDS "${input_file}"
|
|
||||||
VERBATIM
|
|
||||||
)
|
|
||||||
target_sources(${project} PRIVATE "${output_file}")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
endfunction()
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
@PACKAGE_INIT@
|
|
||||||
|
|
||||||
include(CMakeFindDependencyMacro)
|
|
||||||
|
|
||||||
set(ARCHITECTURE "@ARCHITECTURE@")
|
|
||||||
|
|
||||||
if (NOT @BUILD_SHARED_LIBS@)
|
|
||||||
find_dependency(Boost 1.57)
|
|
||||||
find_dependency(fmt 9)
|
|
||||||
find_dependency(mcl 0.1.12 EXACT)
|
|
||||||
|
|
||||||
if ("arm64" IN_LIST ARCHITECTURE)
|
|
||||||
find_dependency(oaknut 2.0.1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if ("riscv" IN_LIST ARCHITECTURE)
|
|
||||||
find_dependency(biscuit 0.9.1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if ("x86_64" IN_LIST ARCHITECTURE)
|
|
||||||
find_dependency(xbyak 7)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (@DYNARMIC_USE_LLVM@)
|
|
||||||
find_dependency(LLVM)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
|
|
||||||
|
|
||||||
check_required_components(@PROJECT_NAME@)
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
# SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
string(TOUPPER "${arch}" arch)
|
|
||||||
file(READ "${input_file}" f_contents)
|
|
||||||
file(WRITE "${output_file}" "#if defined(ARCHITECTURE_${arch})\n${f_contents}\n#endif\n")
|
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
# SPDX-FileCopyrightText: Copyright 2026 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
|
||||||
include(TargetArchitectureSpecificSources)
|
|
||||||
|
|
||||||
add_library(dynarmic STATIC
|
add_library(dynarmic STATIC
|
||||||
mcl/bit.hpp
|
mcl/bit.hpp
|
||||||
mcl/function_info.hpp
|
mcl/function_info.hpp
|
||||||
@@ -135,7 +133,7 @@ add_library(dynarmic STATIC
|
|||||||
interface/A64/config.h
|
interface/A64/config.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if ("x86_64" IN_LIST ARCHITECTURE)
|
if (ARCHITECTURE_x86_64)
|
||||||
# Newer versions of xbyak (>= 7.25.0) have stricter checks that currently
|
# Newer versions of xbyak (>= 7.25.0) have stricter checks that currently
|
||||||
# fail in dynarmic
|
# fail in dynarmic
|
||||||
target_compile_definitions(dynarmic PRIVATE XBYAK_STRICT_CHECK_MEM_REG_SIZE=0)
|
target_compile_definitions(dynarmic PRIVATE XBYAK_STRICT_CHECK_MEM_REG_SIZE=0)
|
||||||
@@ -143,7 +141,7 @@ if ("x86_64" IN_LIST ARCHITECTURE)
|
|||||||
target_compile_definitions(dynarmic PRIVATE XBYAK_OLD_DISP_CHECK=1)
|
target_compile_definitions(dynarmic PRIVATE XBYAK_OLD_DISP_CHECK=1)
|
||||||
target_link_libraries(dynarmic PRIVATE xbyak::xbyak)
|
target_link_libraries(dynarmic PRIVATE xbyak::xbyak)
|
||||||
|
|
||||||
target_architecture_specific_sources(dynarmic "x86_64"
|
target_sources(dynarmic PRIVATE
|
||||||
backend/x64/abi.cpp
|
backend/x64/abi.cpp
|
||||||
backend/x64/abi.h
|
backend/x64/abi.h
|
||||||
backend/x64/block_of_code.cpp
|
backend/x64/block_of_code.cpp
|
||||||
@@ -201,10 +199,10 @@ if ("x86_64" IN_LIST ARCHITECTURE)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if ("arm64" IN_LIST ARCHITECTURE)
|
if (ARCHITECTURE_arm64)
|
||||||
target_link_libraries(dynarmic PRIVATE merry::oaknut)
|
target_link_libraries(dynarmic PRIVATE merry::oaknut)
|
||||||
|
|
||||||
target_architecture_specific_sources(dynarmic "arm64"
|
target_sources(dynarmic PRIVATE
|
||||||
backend/arm64/a32_jitstate.cpp
|
backend/arm64/a32_jitstate.cpp
|
||||||
backend/arm64/a32_jitstate.h
|
backend/arm64/a32_jitstate.h
|
||||||
backend/arm64/a64_jitstate.h
|
backend/arm64/a64_jitstate.h
|
||||||
@@ -255,7 +253,7 @@ if ("arm64" IN_LIST ARCHITECTURE)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if ("riscv64" IN_LIST ARCHITECTURE)
|
if (ARCHITECTURE_riscv64)
|
||||||
target_link_libraries(dynarmic PRIVATE biscuit::biscuit)
|
target_link_libraries(dynarmic PRIVATE biscuit::biscuit)
|
||||||
|
|
||||||
target_sources(dynarmic PRIVATE
|
target_sources(dynarmic PRIVATE
|
||||||
@@ -295,7 +293,7 @@ if ("riscv64" IN_LIST ARCHITECTURE)
|
|||||||
message(WARNING "TODO: Incomplete frontend for this host architecture")
|
message(WARNING "TODO: Incomplete frontend for this host architecture")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if ("loongarch64" IN_LIST ARCHITECTURE)
|
if (ARCHITECTURE_loongarch64)
|
||||||
target_link_libraries(dynarmic PRIVATE lagoon::lagoon)
|
target_link_libraries(dynarmic PRIVATE lagoon::lagoon)
|
||||||
|
|
||||||
target_sources(dynarmic PRIVATE
|
target_sources(dynarmic PRIVATE
|
||||||
@@ -400,15 +398,9 @@ if (DYNARMIC_USE_LLVM)
|
|||||||
target_compile_definitions(dynarmic PRIVATE DYNARMIC_USE_LLVM=1 ${LLVM_DEFINITIONS})
|
target_compile_definitions(dynarmic PRIVATE DYNARMIC_USE_LLVM=1 ${LLVM_DEFINITIONS})
|
||||||
llvm_config(dynarmic USE_SHARED armdesc armdisassembler aarch64desc aarch64disassembler x86desc x86disassembler)
|
llvm_config(dynarmic USE_SHARED armdesc armdisassembler aarch64desc aarch64disassembler x86desc x86disassembler)
|
||||||
endif()
|
endif()
|
||||||
if (DYNARMIC_ENABLE_CPU_FEATURE_DETECTION)
|
|
||||||
target_compile_definitions(dynarmic PRIVATE DYNARMIC_ENABLE_CPU_FEATURE_DETECTION=1)
|
|
||||||
endif()
|
|
||||||
if (DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT)
|
if (DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT)
|
||||||
target_compile_definitions(dynarmic PRIVATE DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT=1)
|
target_compile_definitions(dynarmic PRIVATE DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT=1)
|
||||||
endif()
|
endif()
|
||||||
if (DYNARMIC_IGNORE_ASSERTS)
|
|
||||||
target_compile_definitions(dynarmic PRIVATE MCL_IGNORE_ASSERTS=1)
|
|
||||||
endif()
|
|
||||||
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
target_compile_definitions(dynarmic PRIVATE FMT_USE_WINDOWS_H=0)
|
target_compile_definitions(dynarmic PRIVATE FMT_USE_WINDOWS_H=0)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -197,15 +197,15 @@ void EmitA32Terminal(biscuit::Assembler& as, EmitContext& ctx, IR::Term::CheckHa
|
|||||||
|
|
||||||
void EmitA32LeafTerminal(biscuit::Assembler& as, EmitContext& ctx, IR::Term::LeafTerminal terminal, IR::LocationDescriptor initial_location, bool is_single_step) {
|
void EmitA32LeafTerminal(biscuit::Assembler& as, EmitContext& ctx, IR::Term::LeafTerminal terminal, IR::LocationDescriptor initial_location, bool is_single_step) {
|
||||||
if (auto const x = std::get_if<IR::Term::ReturnToDispatch>(&terminal))
|
if (auto const x = std::get_if<IR::Term::ReturnToDispatch>(&terminal))
|
||||||
return EmitA32LeafTerminal(as, ctx, *x, initial_location, is_single_step);
|
return EmitA32Terminal(as, ctx, *x, initial_location, is_single_step);
|
||||||
if (auto const x = std::get_if<IR::Term::LinkBlock>(&terminal))
|
if (auto const x = std::get_if<IR::Term::LinkBlock>(&terminal))
|
||||||
return EmitA32LeafTerminal(as, ctx, *x, initial_location, is_single_step);
|
return EmitA32Terminal(as, ctx, *x, initial_location, is_single_step);
|
||||||
if (auto const x = std::get_if<IR::Term::LinkBlockFast>(&terminal))
|
if (auto const x = std::get_if<IR::Term::LinkBlockFast>(&terminal))
|
||||||
return EmitA32LeafTerminal(as, ctx, *x, initial_location, is_single_step);
|
return EmitA32Terminal(as, ctx, *x, initial_location, is_single_step);
|
||||||
if (auto const x = std::get_if<IR::Term::PopRSBHint>(&terminal))
|
if (auto const x = std::get_if<IR::Term::PopRSBHint>(&terminal))
|
||||||
return EmitA32LeafTerminal(as, ctx, *x, initial_location, is_single_step);
|
return EmitA32Terminal(as, ctx, *x, initial_location, is_single_step);
|
||||||
if (auto const x = std::get_if<IR::Term::FastDispatchHint>(&terminal))
|
if (auto const x = std::get_if<IR::Term::FastDispatchHint>(&terminal))
|
||||||
return EmitA32LeafTerminal(as, ctx, *x, initial_location, is_single_step);
|
return EmitA32Terminal(as, ctx, *x, initial_location, is_single_step);
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,6 @@ void ProtectMemory(const void* base, size_t size, bool is_executable) {
|
|||||||
|
|
||||||
static const HostFeature features = []() {
|
static const HostFeature features = []() {
|
||||||
HostFeature f{};
|
HostFeature f{};
|
||||||
#ifdef DYNARMIC_ENABLE_CPU_FEATURE_DETECTION
|
|
||||||
using Cpu = Xbyak::util::Cpu;
|
using Cpu = Xbyak::util::Cpu;
|
||||||
Xbyak::util::Cpu cpu_info{};
|
Xbyak::util::Cpu cpu_info{};
|
||||||
if (cpu_info.has(Cpu::tSSSE3)) f |= HostFeature::SSSE3;
|
if (cpu_info.has(Cpu::tSSSE3)) f |= HostFeature::SSSE3;
|
||||||
@@ -121,7 +120,6 @@ static const HostFeature features = []() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return f;
|
return f;
|
||||||
#endif
|
|
||||||
}();
|
}();
|
||||||
HostFeature GetHostFeatures() {
|
HostFeature GetHostFeatures() {
|
||||||
return features;
|
return features;
|
||||||
|
|||||||
@@ -7,34 +7,27 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <cassert>
|
||||||
#include "common/assert.h"
|
|
||||||
|
|
||||||
#include "dynarmic/backend/x64/block_of_code.h"
|
#include "dynarmic/backend/x64/block_of_code.h"
|
||||||
#include "dynarmic/backend/x64/constant_pool.h"
|
#include "dynarmic/backend/x64/constant_pool.h"
|
||||||
|
|
||||||
namespace Dynarmic::Backend::X64 {
|
namespace Dynarmic::Backend::X64 {
|
||||||
|
|
||||||
ConstantPool::ConstantPool(BlockOfCode& code, size_t size)
|
ConstantPool::ConstantPool(BlockOfCode& code, size_t size) noexcept {
|
||||||
: insertion_point(0)
|
auto const align_size = 64; //always align to cacheline
|
||||||
{
|
code.EnsureMemoryCommitted(2 * align_size + size);
|
||||||
code.EnsureMemoryCommitted(align_size + size);
|
|
||||||
code.int3();
|
|
||||||
code.align(align_size);
|
code.align(align_size);
|
||||||
pool = std::span<ConstantT>(reinterpret_cast<ConstantT*>(code.AllocateFromCodeSpace(size)), size / align_size);
|
pool = std::span<u128>(static_cast<u128*>(code.AllocateFromCodeSpace(size)), size / sizeof(u128));
|
||||||
}
|
}
|
||||||
|
|
||||||
Xbyak::Address ConstantPool::GetConstant(BlockOfCode& code, const Xbyak::AddressFrame& frame, u64 lower, u64 upper) {
|
Xbyak::Address ConstantPool::GetConstant(BlockOfCode& code, const Xbyak::AddressFrame& frame, u64 lo, u64 hi) noexcept {
|
||||||
const auto constant = ConstantT(lower, upper);
|
// offset grows iff new constant is added
|
||||||
auto it = constant_info.find(constant);
|
auto const key = std::make_pair(lo, hi);
|
||||||
if (it == constant_info.end()) {
|
auto const val = u32(constant_info.size());
|
||||||
ASSERT(insertion_point < pool.size());
|
auto const [it, _] = constant_info.insert({key, val});
|
||||||
ConstantT& target_constant = pool[insertion_point];
|
// if it != constant_info.end(): assume(pool[it->second] == c);
|
||||||
target_constant = constant;
|
pool[it->second] = u128{lo, hi};
|
||||||
it = constant_info.insert({constant, &target_constant}).first;
|
return frame[code.rip + std::addressof(pool[it->second])];
|
||||||
++insertion_point;
|
|
||||||
}
|
|
||||||
return frame[code.rip + it->second];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Dynarmic::Backend::X64
|
} // namespace Dynarmic::Backend::X64
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <span>
|
#include <span>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <boost/functional/hash.hpp>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/container/unordered_map.h"
|
#include "common/container/unordered_map.h"
|
||||||
@@ -21,31 +22,17 @@ namespace Dynarmic::Backend::X64 {
|
|||||||
|
|
||||||
class BlockOfCode;
|
class BlockOfCode;
|
||||||
|
|
||||||
/// ConstantPool allocates a block of memory from BlockOfCode.
|
/// @brief ConstantPool allocates a block of memory from BlockOfCode.
|
||||||
/// It places constants into this block of memory, returning the address
|
/// It places constants into this block of memory, returning the address
|
||||||
/// of the memory location where the constant is placed. If the constant
|
/// of the memory location where the constant is placed. If the constant
|
||||||
/// already exists, its memory location is reused.
|
/// already exists, its memory location is reused.
|
||||||
class ConstantPool final {
|
class ConstantPool final {
|
||||||
public:
|
public:
|
||||||
ConstantPool(BlockOfCode& code, size_t size);
|
ConstantPool(BlockOfCode& code, size_t size) noexcept;
|
||||||
|
Xbyak::Address GetConstant(BlockOfCode& code, const Xbyak::AddressFrame& frame, u64 lower, u64 upper = 0) noexcept;
|
||||||
Xbyak::Address GetConstant(BlockOfCode& code, const Xbyak::AddressFrame& frame, u64 lower, u64 upper = 0);
|
// key = identity hash, value = offset from pool.data()
|
||||||
|
::Common::unordered_map<std::pair<u64, u64>, u32, boost::hash<std::pair<u64, u64>>> constant_info;
|
||||||
private:
|
std::span<u128> pool;
|
||||||
static constexpr size_t align_size = 16; // bytes
|
|
||||||
|
|
||||||
using ConstantT = std::pair<u64, u64>;
|
|
||||||
static_assert(sizeof(ConstantT) == align_size);
|
|
||||||
|
|
||||||
struct ConstantHash {
|
|
||||||
std::size_t operator()(const ConstantT& constant) const noexcept {
|
|
||||||
return constant.first ^ std::rotl<u64>(constant.second, 1);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
::Common::unordered_map<ConstantT, void*, ConstantHash> constant_info;
|
|
||||||
std::span<ConstantT> pool;
|
|
||||||
std::size_t insertion_point;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Dynarmic::Backend::X64
|
} // namespace Dynarmic::Backend::X64
|
||||||
|
|||||||
@@ -275,6 +275,7 @@ const void* EmitReadMemoryMov(BlockOfCode& code, int value_idx, const Xbyak::Reg
|
|||||||
code.xadd(qword[addr], Xbyak::Reg64(value_idx));
|
code.xadd(qword[addr], Xbyak::Reg64(value_idx));
|
||||||
break;
|
break;
|
||||||
case 128:
|
case 128:
|
||||||
|
ASSERT(Xbyak::Xmm(value_idx) != xmm0);
|
||||||
code.lock();
|
code.lock();
|
||||||
code.cmpxchg16b(xword[addr]);
|
code.cmpxchg16b(xword[addr]);
|
||||||
if (code.HasHostFeature(HostFeature::SSE41)) {
|
if (code.HasHostFeature(HostFeature::SSE41)) {
|
||||||
|
|||||||
@@ -6226,9 +6226,7 @@ void EmitX64::EmitVectorZeroExtend64(EmitContext& ctx, IR::Inst* inst) {
|
|||||||
void EmitX64::EmitVectorZeroUpper(EmitContext& ctx, IR::Inst* inst) {
|
void EmitX64::EmitVectorZeroUpper(EmitContext& ctx, IR::Inst* inst) {
|
||||||
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
||||||
auto const a = ctx.reg_alloc.UseScratchXmm(code, args[0]);
|
auto const a = ctx.reg_alloc.UseScratchXmm(code, args[0]);
|
||||||
|
|
||||||
code.movq(a, a); // TODO: !IsLastUse
|
code.movq(a, a); // TODO: !IsLastUse
|
||||||
|
|
||||||
ctx.reg_alloc.DefineValue(code, inst, a);
|
ctx.reg_alloc.DefineValue(code, inst, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,12 +14,6 @@
|
|||||||
#include "dynarmic/backend/x64/hostloc.h"
|
#include "dynarmic/backend/x64/hostloc.h"
|
||||||
#include "dynarmic/common/spin_lock.h"
|
#include "dynarmic/common/spin_lock.h"
|
||||||
|
|
||||||
#ifdef DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT
|
|
||||||
static const auto default_cg_mode = Xbyak::DontSetProtectRWE;
|
|
||||||
#else
|
|
||||||
static const auto default_cg_mode = nullptr; //Allow RWE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace Dynarmic {
|
namespace Dynarmic {
|
||||||
|
|
||||||
void EmitSpinLockLock(Xbyak::CodeGenerator& code, Xbyak::Reg64 ptr, Xbyak::Reg32 tmp, bool waitpkg) {
|
void EmitSpinLockLock(Xbyak::CodeGenerator& code, Xbyak::Reg64 ptr, Xbyak::Reg32 tmp, bool waitpkg) {
|
||||||
@@ -78,7 +72,13 @@ namespace {
|
|||||||
struct SpinLockImpl {
|
struct SpinLockImpl {
|
||||||
void Initialize() noexcept;
|
void Initialize() noexcept;
|
||||||
static void GlobalInitialize() noexcept;
|
static void GlobalInitialize() noexcept;
|
||||||
Xbyak::CodeGenerator code = Xbyak::CodeGenerator(4096, default_cg_mode);
|
Xbyak::CodeGenerator code = Xbyak::CodeGenerator(4096
|
||||||
|
#ifdef DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT
|
||||||
|
, Xbyak::DontSetProtectRWE
|
||||||
|
#else
|
||||||
|
, nullptr //Allow RWE
|
||||||
|
#endif
|
||||||
|
);
|
||||||
void (*lock)(volatile int*) = nullptr;
|
void (*lock)(volatile int*) = nullptr;
|
||||||
void (*unlock)(volatile int*) = nullptr;
|
void (*unlock)(volatile int*) = nullptr;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ struct detail {
|
|||||||
shifts[arg_index] = bit_position;
|
shifts[arg_index] = bit_position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if !defined(DYNARMIC_IGNORE_ASSERTS) && !defined(__ANDROID__)
|
#if !defined(__ANDROID__)
|
||||||
// Avoids a MSVC ICE, and avoids Android NDK issue.
|
// Avoids a MSVC ICE, and avoids Android NDK issue.
|
||||||
DEBUG_ASSERT(std::all_of(masks.begin(), masks.end(), [](auto m) { return m != 0; }));
|
DEBUG_ASSERT(std::all_of(masks.begin(), masks.end(), [](auto m) { return m != 0; }));
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2632,3 +2632,66 @@ TEST_CASE("A64: Rounding", "[a64]") {
|
|||||||
CHECK(jit.GetVector(5) == Vector{0x4000000040000000, 0x4000000040000000});
|
CHECK(jit.GetVector(5) == Vector{0x4000000040000000, 0x4000000040000000});
|
||||||
CHECK(jit.GetVector(6) == Vector{0x4000000040000000, 0x4000000040000000});
|
CHECK(jit.GetVector(6) == Vector{0x4000000040000000, 0x4000000040000000});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("A64: SM4", "[a64]") {
|
||||||
|
A64TestEnv env;
|
||||||
|
A64::UserConfig jit_user_config{};
|
||||||
|
jit_user_config.callbacks = &env;
|
||||||
|
A64::Jit jit{jit_user_config};
|
||||||
|
|
||||||
|
oaknut::VectorCodeGenerator code{env.code_mem, nullptr};
|
||||||
|
|
||||||
|
code.SM4EKEY(V4.S4(), V0.S4(), V1.S4());
|
||||||
|
code.SM4E(V5.S4(), V0.S4(), V1.S4());
|
||||||
|
|
||||||
|
jit.SetPC(0);
|
||||||
|
jit.SetVector(0, {0xefcdab8967452301, 0x1032547698badcfe});
|
||||||
|
jit.SetVector(1, {0xefcdab8967452301, 0x1032547698badcfe});
|
||||||
|
env.ticks_left = env.code_mem.size();
|
||||||
|
CheckedRun([&]() { jit.Run(); });
|
||||||
|
|
||||||
|
CHECK(jit.GetVector(4) == Vector{0x486a0c2e00224466, 0x5c7e183a62402604});
|
||||||
|
CHECK(jit.GetVector(5) == Vector{0xc2e086a43c1e785a, 0xd7f593b104264062});
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("A64: SM3", "[a64]") {
|
||||||
|
A64TestEnv env;
|
||||||
|
A64::UserConfig jit_user_config{};
|
||||||
|
jit_user_config.callbacks = &env;
|
||||||
|
SECTION("SM3SS1") {
|
||||||
|
A64::Jit jit{jit_user_config};
|
||||||
|
oaknut::VectorCodeGenerator code{env.code_mem, nullptr};
|
||||||
|
code.SM3SS1(V0.S4(), V0.S4(), V1.S4(), V2.S4());
|
||||||
|
jit.SetPC(0);
|
||||||
|
jit.SetVector(0, {0xec4aff517369c667, 0x46e3fbf2abbacd29});
|
||||||
|
jit.SetVector(1, {0x8de7e81bf854c27c, 0x9ac99f33632e5a76});
|
||||||
|
jit.SetVector(2, {0x5aa35831b70d3266, 0xd45ee95817055d25});
|
||||||
|
env.ticks_left = env.code_mem.size();
|
||||||
|
CheckedRun([&]() { jit.Run(); });
|
||||||
|
CHECK(jit.GetVector(0) == Vector{0x0000000000000000, 0x73d67cd700000000});
|
||||||
|
}
|
||||||
|
SECTION("SM3PARTW1") {
|
||||||
|
A64::Jit jit{jit_user_config};
|
||||||
|
oaknut::VectorCodeGenerator code{env.code_mem, nullptr};
|
||||||
|
code.SM3PARTW1(V0.S4(), V0.S4(), V1.S4(), V2.S4());
|
||||||
|
jit.SetPC(0);
|
||||||
|
jit.SetVector(0, {0xec4aff517369c667, 0x46e3fbf2abbacd29});
|
||||||
|
jit.SetVector(1, {0x8de7e81bf854c27c, 0x9ac99f33632e5a76});
|
||||||
|
jit.SetVector(2, {0x5aa35831b70d3266, 0xd45ee95817055d25});
|
||||||
|
env.ticks_left = env.code_mem.size();
|
||||||
|
CheckedRun([&]() { jit.Run(); });
|
||||||
|
CHECK(jit.GetVector(0) == Vector{0x653c64995693280c, 0xabcc7db97adebf12});
|
||||||
|
}
|
||||||
|
SECTION("SM3PARTW2") {
|
||||||
|
A64::Jit jit{jit_user_config};
|
||||||
|
oaknut::VectorCodeGenerator code{env.code_mem, nullptr};
|
||||||
|
code.SM3PARTW2(V0.S4(), V0.S4(), V1.S4(), V2.S4());
|
||||||
|
jit.SetPC(0);
|
||||||
|
jit.SetVector(0, {0xec4aff517369c667, 0x46e3fbf2abbacd29});
|
||||||
|
jit.SetVector(1, {0x8de7e81bf854c27c, 0x9ac99f33632e5a76});
|
||||||
|
jit.SetVector(2, {0x5aa35831b70d3266, 0xd45ee95817055d25});
|
||||||
|
env.ticks_left = env.code_mem.size();
|
||||||
|
CheckedRun([&]() { jit.Run(); });
|
||||||
|
CHECK(jit.GetVector(0) == Vector{0x30010fe70da43740, 0x6702425b4a3a05d4});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
# SPDX-FileCopyrightText: Copyright 2026 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
|
||||||
include(TargetArchitectureSpecificSources)
|
|
||||||
|
|
||||||
add_executable(dynarmic_tests
|
add_executable(dynarmic_tests
|
||||||
fp/FPToFixed.cpp
|
fp/FPToFixed.cpp
|
||||||
fp/FPValue.cpp
|
fp/FPValue.cpp
|
||||||
@@ -44,13 +42,13 @@ if (DYNARMIC_TESTS_USE_UNICORN)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if ("riscv" IN_LIST ARCHITECTURE)
|
if (ARCHITECTURE_riscv64)
|
||||||
target_link_libraries(dynarmic_tests PRIVATE biscuit::biscuit)
|
target_link_libraries(dynarmic_tests PRIVATE biscuit::biscuit)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if ("x86_64" IN_LIST ARCHITECTURE)
|
if (ARCHITECTURE_x86_64)
|
||||||
target_link_libraries(dynarmic_tests PRIVATE xbyak::xbyak)
|
target_link_libraries(dynarmic_tests PRIVATE xbyak::xbyak)
|
||||||
target_architecture_specific_sources(dynarmic_tests "x86_64"
|
target_sources(dynarmic_tests PRIVATE
|
||||||
x64_cpu_info.cpp
|
x64_cpu_info.cpp
|
||||||
native/preserve_xmm.cpp
|
native/preserve_xmm.cpp
|
||||||
)
|
)
|
||||||
|
|||||||