diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000..787a5dc03 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,135 @@ + + +# AGENTS.md — sharpemu-mac + +## 1. What this is +macOS fork of the SharpEmu PS5 emulator: C#/.NET 10 (SDK `10.0.103`, `global.json`), Metal-only GPU backend, Avalonia GUI. +Guest x86-64 code runs natively, so the main process is `osx-x64` under Rosetta 2 (Rosetta ends after macOS 27); the +Metal GPU host is a separate native `osx-arm64` process (`src/SharpEmu.GpuHost`, default on, `SHARPEMU_GPU_PROCESS=0` off). +Apple silicon only. `origin` = github sharpemu/sharpemu-mac (PRs, CI, releases); `upstream` = sharpemu/sharpemu +(merged in, never rebased). Integration branch: `origin/main`; always `git fetch origin` and base new work on it. + +## 2. Map +- `src/graphics/SharpEmu.Gpu.Metal/V2/` — Metal V2 backend: image cache, render host, guest memory windows, presenter. +- `src/SharpEmu.ShaderCompiler.Metal/` — RDNA2 (Gen5) → MSL translator (`Gen5MslTranslator.*.cs`, `Templates/`). +- `src/SharpEmu.ShaderCompiler/` — shared shader decoder, IR, resource tracking/`ResourceMaterializer`. +- `src/SharpEmu.Libs/Gpu/` — shared GPU engine: `GpuCommands` (PM4 interpreter), `Rendering`, `Pipelines`, `Images`, `Scheduling`. +- `src/SharpEmu.Libs/` (other dirs) — HLE libraries (Kernel, Agc, VideoOut, Audio…). `src/SharpEmu.HLE/` — guest memory, `PageGuard`. +- `src/SharpEmu.Core/` — loader, guest patchers, spin-nap (`Loader/`), CPU direct execution (`Cpu/`). +- `src/SharpEmu.GpuHost|GpuSplit|GpuRemote/` — two-process split. `src/platforms/macos/` — host memory, input, x64 execution. +- `src/SharpEmu.CLI/` — the one executable (CLI + GUI); `src/SharpEmu.GUI/` — Avalonia launcher. +- `src/graphics/SharpEmu.Gpu.Vulkan/` — upstream backend, not in the macOS build; semantic reference only. +- `tests/` — .NET suites (table in `docs/macos/testing.md`); `tests/scripts/` — Python build-tool tests. +- `tools/re/` — static analysis of PS5 ELFs (README); `tools/SharpEmu.Tools.ShaderDump/` — shader corpus replay. +- `scripts/macos/` — build, game harness, metrics; `scripts/mac/sync-upstream.sh` — upstream merge. +- `docs/macos/` — building, running, configuration, Metal backend, testing, troubleshooting. Read before guessing. +- `artifacts/` (git-ignored) — `bin/ obj/`, `macos/SharpEmu.app`, `runs/`, `reference//`, `re/`, `saves/ds-golden/`, `data-root/`. + +## 3. Build, test, run +```sh +dotnet restore SharpEmu.slnx +dotnet build SharpEmu.slnx -c Release # add -p:SharpEmuBuildProfile= for a private bin/obj +dotnet test SharpEmu.slnx -c Release # filter: --filter "FullyQualifiedName~" +SHARPEMU_TEST_REQUIRE_DEVICE=1 dotnet test tests/SharpEmu.Gpu.Metal.Tests -c Release +SHARPEMU_TEST_REQUIRE_DEVICE=1 dotnet test tests/SharpEmu.ShaderCompiler.Metal.Tests -c Release +python3 -m unittest discover -s tests/scripts -v +uvx reuse lint # REUSE compliance, first CI step +scripts/macos/build-app.sh # -> artifacts/macos/SharpEmu.app (SHARPEMU_OUTPUT_DIR must be absolute) +``` +- Without `SHARPEMU_TEST_REQUIRE_DEVICE=1` device tests skip and count as passed. Set it only for the Metal projects + (on Libs it runs Vulkan device tests that fail on macOS by design). +- Parallel-safe: builds/tests in separate worktrees (each has its own `artifacts/`), as many as cores and memory + allow. Not safe: any build or test while a game is being measured, two device-test runs at once (shared Metal + device; flakes under load), two games. +- Durations: `ShaderCompiler.Tests` reruns ~4-13 s; the first game run after `build-app.sh` is cold (shader prewarm + 46-114 s), discard it. Full-build and full-suite times are not recorded. + +## 4. Running games +- Static analysis, offline tests and batched changes come first; run games last, sparingly, to test a stated + hypothesis or measure a finished batch. Static tools: `tools/re/` (flattened DS ELF at `artifacts/re/ds/eboot.elf`), + `r2`, shader corpus replay (`SHARPEMU_SHADER_CORPUS_DIR=`, then + `dotnet run -c Release --project tools/SharpEmu.Tools.ShaderDump -- corpus --metal`). +- One run: `SHARPEMU_GAMES_DIR= scripts/macos/run-game.sh [keyplan] [ENV=VALUE ...]`. + Aliases: `ds` PPSA01342, `sh` PPSA10112 (Silent Hill The Short Message), `gta` PPSA04264, `poppy` PPSA18454, + `quake` PPSA01880, `superl` PPSA06084, `oregon` PPSA19244, `void` PPSA03061, `sarah` PPSA02929. + A `.zar` or eboot path works in place of an alias. Caps: 150 s; 600 with `SHARPEMU_GAME_ENTRY_RUN=1`; + 2400 with `SHARPEMU_GAME_SESSION_RUN=1`. Keyplan syntax: `scripts/macos/input-plan.py`. +- Lock: the script takes `~/.sharpemu/gamelock` (`SHARPEMU_GAME_LOCK`; `$SHARPEMU_COMPAT_DIR/.gamelock` if set) + through a FIFO ticket queue in `.queue`, waits for no other SharpEmu process and for load below + `SHARPEMU_MAX_LOAD` (default CPU count, up to 30 min). Never bypass it, never run two games, never SIGKILL a + running game (linked to IOGPU kernel panics), never launch with `launchctl submit` (it relaunches forever). +- Output: `artifacts/runs/--/`: `game.log`, `game.tlog`, `frame-times.txt`, `footprint.log`, + `system-mem.log`, `result.txt`, `run.env`, `guest.pid`, `shot-*.png` (only with `SHARPEMU_WINID` set + to the game window id). Each checkout uses its own `artifacts/data-root`. +- Demon's Souls: `scripts/macos/games/ds.sh [seconds] [ingame|full|walk|title|boot] [ENV=VALUE ...]` → `metrics.md` + per run (golden save `artifacts/saves/ds-golden`). `SHARPEMU_DS_*` plan knobs must be exported, not passed as args. + Smoke set: `scripts/macos/regress.sh ` (sarah quake void oregon). SH bench: `scripts/macos/perf-bench.sh`. +- Reference frames: `artifacts/reference//`, captured from real-hardware footage (yt-dlp is allowed). +- Reliable fps: load average <10 and ≥30% free memory before start; no builds, tests or other agents + running; Activity Monitor closed. Same build/scenario/segment for before and after; ≥3 runs per arm, ABBA order or + in-run toggles; DS noise is ±5%. Read fps from gameplay screenshots (menus render at 60). GTA: check Graphics Mode. + +## 5. Project rules +- Fix root causes in generic emulation. No title-keyed or per-game hacks (title-gated patches already in + `src/SharpEmu.Core/Loader/` are not a precedent). Why: CONTRIBUTING; hacks hide the real bug in other games. +- No silent fallbacks: refuse loudly (log + counter or fatal) instead of guessing. Why: guesses hid bugs for days. +- macOS build stays Metal/AppKit only: no Vulkan, MoltenVK, SDL (the output policy fails the build). Avalonia is fine. +- Rendering must be correct at any fps and match reference frames; a perf change that alters the image is a + regression. Check full-size screenshots of every run before quoting numbers. +- Batch related changes, test once across the affected games plus the smoke set. Why: game runs are serialized. +- Defaults on: safe fixes need no switch; experimental ones ship default-on with a `SHARPEMU_*=0` off-switch. +- Verify NIDs/exports against the SDK and game imports; never invent an export. AnyPS5/Kyty are GPL: semantics only. +- Keep CI green: before push run `uvx reuse lint`, Release build, full test; new files need an SPDX header or a + `REUSE.toml` entry; watch `gh run list -R sharpemu/sharpemu-mac --branch ` after pushing. +- Never `pgrep -f ` in a command that contains that text; wait on PIDs or files instead. +- Disk: worktrees cost ~3 GB plus build output. Under 40 GB free (`df -h /System/Volumes/Data`) prune finished + worktrees and their `artifacts/{bin,obj,profiles}` first. +- Do not switch the branch of a checkout another session may be using; work in your own worktree. + +## 6. Waiting on long jobs +- Do not block an agent turn on a job longer than about 4 minutes. Start long jobs in the background with output to + a log, then either return the PID and log path to the caller and end, or check at intervals of 4 minutes or less. +```sh +mkdir -p artifacts/agent-logs +nohup dotnet build SharpEmu.slnx -c Release > artifacts/agent-logs/build-.log 2>&1 & echo $! > artifacts/agent-logs/build-.pid +kill -0 "$(cat artifacts/agent-logs/build-.pid)" 2>/dev/null && echo running; tail -5 artifacts/agent-logs/build-.log +``` +- Game runs can queue behind the lock for 30+ minutes: start `run-game.sh`/`ds.sh` the same way, report the tag, and + let the caller read `artifacts/runs/*-/result.txt` and `metrics.md` later. +- CI: `gh run list -R sharpemu/sharpemu-mac --branch --limit 3`, then + `gh run watch -R sharpemu/sharpemu-mac --exit-status > artifacts/agent-logs/ci-.log 2>&1 &`. + +## 7. Investigation ledgers +- One file per topic, `ledger-.md`, kept outside the tracked tree so every worktree shares it. Your local + agent notes say where they live on your machine; if you have none, agree a location before a long investigation. +- Read the topic's ledger before starting, especially **Ruled out**: do not re-test a ruled-out hypothesis without + new evidence. Append before finishing; create `ledger-.md` with the same sections for a new topic. +- Sections: Status (2-3 lines, current truth), Confirmed, Ruled out, Open leads, Branches/commits, Log. +- Entry: `- YYYY-MM-DD → ; evidence: ; `. + Add a dated one-liner to Log (newest first) and update Status if the truth changed. + +## 8. Worktrees and merging +- Create, from the main checkout: `git fetch origin`, then `git worktree add ../ -b origin/main`. + Harness-created worktrees (`.claude/worktrees/`) also start at `origin/main`. +- Reset a reused worktree only when `git status --porcelain` is empty: `git fetch origin && git reset --hard origin/main`. +- Branch names: `fix/`, `perf/`, `feat/`, `diag/`, `chore/`, `followup/`, `test/`; upstream merges `sync/upstream-` + via `scripts/mac/sync-upstream.sh`. Commit subjects start with a tag: `[GPU]`, `[Metal]`, `[Shader]`, `[Tests]`… +- A worktree app re-prewarms shaders against other builds; for side builds use `SHARPEMU_SHADER_PREWARM=0`. +- Merge verified work into main regularly through a PR to `sharpemu/sharpemu-mac` `main`, using the mandatory + template (`.github/pull_request_template.md`). Before merging: REUSE lint, Release build, full test, device tests for + backend changes, Python tests, and screenshot checks of the affected games plus `regress.sh`. +- Before removing a worktree: copy needed run dirs out, check that no local script references its path, then + `git worktree remove `. + +## 9. Closing report +Every agent ends with this, even when stopped early: +``` +Verdict: fixed | partial | not found +Branch + commit: (pushed? merged?) +Evidence: before/after numbers from the same scenario and build setup (run dirs), or test output, or frame comparison +Ruled out: , also appended to the ledger +Next step: +``` diff --git a/Directory.Build.props b/Directory.Build.props index 655c3052d..029baf638 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -9,7 +9,7 @@ SPDX-License-Identifier: GPL-2.0-or-later enable enable true - 0.0.7-pulse + 0.0.8-ember $(SharpEmuVersion) + diff --git a/LICENSES/GPL-3.0-or-later.txt b/LICENSES/GPL-3.0-or-later.txt new file mode 100644 index 000000000..f6cdd22a6 --- /dev/null +++ b/LICENSES/GPL-3.0-or-later.txt @@ -0,0 +1,232 @@ +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright © 2007 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for software and other kinds of works. + +The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. + +Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. + +Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and modification follow. + +TERMS AND CONDITIONS + +0. Definitions. + +“This License” refers to version 3 of the GNU General Public License. + +“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. + +“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations. + +To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work. + +A “covered work” means either the unmodified Program or a work based on the Program. + +To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. + +To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. + +1. Source Code. +The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work. + +A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. + +The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. + +The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. + +The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same work. + +2. Basic Permissions. +All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. +No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. + +When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. + +4. Conveying Verbatim Copies. +You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. +You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”. + + c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. + +A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. + +6. Conveying Non-Source Forms. +You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: + + a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. + + d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. + +A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. + +“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. + +If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). + +The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. + +7. Additional Terms. +“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or authors of the material; or + + e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. + +All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. + +8. Termination. +You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). + +However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. + +Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. + +9. Acceptance Not Required for Having Copies. +You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. +Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. + +An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. + +11. Patents. +A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”. + +A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. + +In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. + +If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. + +A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. +If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. + +13. Use with the GNU Affero General Public License. +Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. + +14. Revised Versions of this License. +The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. + +Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. + +15. Disclaimer of Warranty. +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. +If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”. + +You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . + +The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . diff --git a/docs/macos/configuration.md b/docs/macos/configuration.md index 4d22fb1e5..b66e14eb6 100644 --- a/docs/macos/configuration.md +++ b/docs/macos/configuration.md @@ -45,6 +45,17 @@ them for measurements or to isolate a problem. | `SHARPEMU_FLIP_AHEAD` | off | Experimental. `1` tells the game a GPU flip is done once the flip is recorded and the flip before it has really finished on the GPU, instead of when the frame is shown, so the game can build its next frame while the GPU draws this one (at most one flip ahead). Each such frame is copied in the GPU stream into a presenter-owned texture (up to 7 textures the size of the display buffer), so what is shown is unchanged; a flip whose frame cannot be copied keeps the usual timing, and the refusal is logged once. Pacing, interrupts and labels are unchanged. Counters: `[VIDEOOUT][FLIP-AHEAD]` and the `flip_copy*` fields of `[METAL-PRESENT]`. | | `SHARPEMU_METAL_V2_PRESENT_SNAPSHOT` | on | `0` presents a flipped display buffer directly instead of a copy of it. By default each flip's frame is copied in the GPU stream, at the flip, into a presenter-owned texture (one blit per flip; up to 7 textures the size of the display buffer, 4 in use on a 60 fps title), so a game that starts drawing its next frame into the buffer still on screen cannot show a half-drawn (black) frame. A frame that cannot be copied is presented directly and the refusal is logged once. | +## Input, audio and in-game overlays + +| Variable | Default | Effect | +| --- | --- | --- | +| `SHARPEMU_DUALSENSE_AUDIO` | on | With exactly one DualSense connected, the pad speaker and the vibration actuators play through the controller: over USB as its 4-channel CoreAudio device, over Bluetooth as HID output reports with Opus audio. With none or several connected the pad speaker plays on the Mac's output and vibration ports drive rumble. `0` never opens the controller stream. | +| `SHARPEMU_HAPTIC_RUMBLE_GAIN` | `1` | Gain applied to rumble made from vibration-port audio (timed, 250 ms after the last sample). `0` turns that rumble off. | +| `SHARPEMU_UI_PALETTE` | launcher theme | Colour palette of the in-game overlays (on-screen keyboard, save data list, notifications). The launcher sets it from its theme. | +| `SHARPEMU_UI_LANGUAGE` | launcher language | Language of the in-game overlays; the launcher also passes the translated strings in `SHARPEMU_UI_STRINGS`. | +| `SHARPEMU_DEFAULT_PROFILE` | launcher setting | Text the IME dialog offers when the title gives none. Set from the launcher's default profile name. | +| `SHARPEMU_IME_AUTOFILL` | off | `1` finishes an IME dialog with the title's own text instead of opening the on-screen keyboard. `SHARPEMU_IME_DEFAULT_TEXT` does the same with the given text. | + ## Metal memory | Variable | Default | Effect | @@ -54,6 +65,8 @@ them for measurements or to isolate a problem. | `SHARPEMU_METAL_V2_IMAGE_BUDGET_MB` | computed | Fixed byte budget for the detiled image cache, at least 256. By default the budget follows the memory the host has free. | | `SHARPEMU_METAL_V2_SINGLE_COPY` | on | `0` never releases guest memory that a clean texture's Metal copy duplicates. Requires the chunked guest backing. | | `SHARPEMU_METAL_V2_WHOLE_STALE_RELOAD` | on | `0` restores the old refusal: a GPU-written image whose every byte an alias has since written keeps its older texels instead of reloading them, and writes them back over the alias's bytes. For A/B comparisons only. | +| `SHARPEMU_METAL_V2_SAMPLED_DEPTH_CLEAR` | on | A one-layer, one-level depth surface sampled while its HTILE holds a pending clear reads the cleared value: the sample clears depth (stencil untouched) and consumes the clear (upstream cb790c35e). `0` samples the stale depth bytes. | +| `SHARPEMU_METAL_V2_FRAME_ALIASES` | on | An overlapping alias that the current frame or each of the two frames before it used stays cached when an overlap would release it, instead of being written back and rebuilt from guest memory every frame (upstream c30081163). Before the first presented frame the older 32-submission rule applies. `0` uses that rule throughout. | | `SHARPEMU_METAL_V2_PARTIAL_MIP_CHAINS` | on | A streamed texture whose T# starts past mip 0 is described from that level (upstream's resident-mip textures, `ImageDescription.FirstLevel`). The image cache looks it up as its whole chain and, while the guest has not mapped that chain, never holds or reads a level before the binding's base level, whatever `SHARPEMU_METAL_V2_BASE_LEVEL` says. Image uploads read guest bytes as upstream does: every byte must be mapped (or partially resident PRT/AMM memory), else the GPU stops with `Could not read the mapped guest image backing`; `SHARPEMU_IMAGE_BACKING_HOLES=1` reads unmapped pages after a mapped first page as zero instead. `0` keeps whole-chain requests and reads image bytes as a binding does (the readable prefix, zeros after it). | | `SHARPEMU_METAL_V2_BINDLESS_UNMAPPED_NULL` | on | A bindless texture table entry whose image's first byte the guest has not mapped binds the null texture and is looked up again at every bind until the memory is mapped, as the Vulkan bindless heap skips such a record. The counter `BindlessUnmappedEntries` counts them. `0` uploads the entry, which stops the GPU with `Could not read the mapped guest image backing` unless the bytes are partially resident PRT/AMM memory. | | `SHARPEMU_MANAGED_WRITE_LEASE_GATE` | on | An emulator write into guest GPU memory takes the managed-write lease (`GuestWriteReservations`) only after a backend that makes GPU claims has registered. The Vulkan buffer cache registers when it is built; the Metal backend makes no claims, so on macOS a managed write marks its pages before and after the copy, as before the lease existed. `0` makes every managed write take the lease, as upstream does. | @@ -140,6 +153,10 @@ undoes an optimization to isolate a miscompile: | `SHARPEMU_METAL_V2_DYNAMIC_STENCIL_OPS` | on | A draw's stencil operations and compare functions come from its own dynamic state, not from the draw its pipeline was first built for. `0` takes them from the pipeline again. | | `SHARPEMU_DRAW_REPLAY` | on | A draw that repeats the command-thread item before it in all but its user data (same programs, descriptor words, vertex input and targets) binds what that draw bound, with its own user data patched into the push data, instead of preparing and binding again (`MetalRenderHost.Replay.cs`). The host refuses, and the draw takes the full path, when anything that binding stood on has moved: the command buffer, the render pass, the image cache's binding epoch or image set, a read-only buffer's or vertex stream's read-binding memo answer, or the stage object. Draws with written buffers, storage images, movie planes, bindless tables, device addresses or per-draw argument fields are never captured. The `[METAL-V2][TBDR]` line reports the engine's `draw_replays` / `replay_miss` and the host's `replay_host=(draws,captured,capture_refused=[...],miss=[...])`. Needs the command thread (`SHARPEMU_METAL_V2_COMMAND_THREAD`, on). `0` binds every draw in full. | | `SHARPEMU_DISPATCH_REPLAY` | on | The same for a compute dispatch that repeats the one before it in all but its user data and thread limits: its shader data is built again from its own snapshot, and a dispatch that writes takes its buffers' whole binding chain again (a range other than the captured one rewrites the argument buffer, counted as `rebound`). Reported as `dispatch_replay_host=(...)` on the same line. `0` binds every dispatch in full. | +| `SHARPEMU_METAL_V2_TABLE_REPLAY` | on | A replayed dispatch of a program that reads a flattened resource table may carry a new table: the host rewrites the argument buffer with the new table instead of binding the dispatch in full (upstream c30081163). Counted as `table=` in `dispatch_replay_host`. `0` binds such dispatches in full. | +| `SHARPEMU_METAL_V2_INDEXED_RUNS` | on | A run of up to 32 indexed draws that differ only in their index offsets is encoded with the bindings of its first draw where every stage can share them (upstream's indexed draw runs). Runs are refused while predication or an occlusion query is open. Counted as `indexed_runs=(taken,draws,shared_stages,refused_stages)` on the `[METAL-V2][TBDR]` line. `0` records each draw on its own. | +| `SHARPEMU_DEFERRED_DISPATCH_RUNS` | on | Upstream's deferred dispatch runs and their worker threads. Hosts that defer whole work items, Metal among them, never create them; the switch matters only for hosts that record on workers. `0` turns them off everywhere. | +| `SHARPEMU_COMPUTE_TICKETS` | on | Upstream's worker rebinds for direct dispatches ahead of the command thread (`verify` checks each ticket against the command thread's own rebind). Like deferred runs they are not created for hosts that defer whole work. `0` turns them off. | | `SHARPEMU_POSTED_WORD_COPY` | on | A bounded word-copy kernel whose source is final and whose destination holds no image or surface metadata is taken out of the dispatch path at its place in the stream. The counter line reports `word_copy=[posted=...,unsupported=...,image=...,busy=...,host_store=...]`. `0` runs every such kernel as a dispatch. | | `SHARPEMU_METAL_V2_POSTED_WORD_COPY_HOST_STORE` | on | How a posted word copy is applied. Upstream's Vulkan host stores the words on the host, which is sound there because GPU readers take a copy of their bytes when recorded. Metal reads guest memory in place, so the store is taken only when no recorded or submitted GPU work remains (`host_store`); otherwise the copy is refused as `busy` and runs as its dispatch, which readers read through as a pending copy. `0` posts every copy as a held command-processor write instead, which costs Demon's Souls about 20 ms a frame. | | `SHARPEMU_METAL_V2_CONCURRENT_OVERLAY_READS` | on | A look-ahead resolution, and the render thread's clean read, take words a pending command-processor write still owes from that write's overlay when it covers them whole, instead of abandoning the resolution or waiting for the GPU. Counted as `concurrent_overlay_reads` and `clean_overlay_reads`. `0` abandons and waits as before. | diff --git a/docs/macos/split-protocol.md b/docs/macos/split-protocol.md index 756732fcc..1af13a2eb 100644 --- a/docs/macos/split-protocol.md +++ b/docs/macos/split-protocol.md @@ -31,7 +31,8 @@ page watches 100-2600/s (batch); submissions 30 and 200-350/s; SubmitDone/flips All records are little-endian blittable structs (`GpuSplitMessages.cs`) on the transport rings; synchronous calls use `SyncCallTable` both ways: A → B (`SyncCalls`, signal-safe on the A side) and B → A (`ReverseSyncCalls`, ordinary B -threads). Add new kinds at the end of the enums; bump `GpuRemoteProtocol.Version` (now 7). +threads). Add new kinds at the end of the enums; bump `GpuRemoteProtocol.Version` (now 10; the history is in its +remarks). Revision 7 combines frame-boundary messages, input-change/display reservations and the pending-writeback page summary. Independent revisions 4, 5 and 6 are rejected @@ -56,8 +57,9 @@ fused program. | `CpuWrite` | address, size | A managed write that has landed, only for ranges the GPU-interest summary marks. B calls its stores' `MarkCpuWriteLanded` in ring order, before any later submission. | | `ShaderHeader` | codeAddress, headerAddress | Mirrors `AgcExports._shaderHeadersByCode` into B (lookups stay local in B). | | `FusedProgram` | entry, entryHeader, continuation, continuationHeader (zeros: unregistered) | Mirrors `Gen5ShaderTranslator`'s fused-program registry, which B's command streams read, keyed by B's address space. | -| `Control` | EnsureStarted(w,h), HideSplashScreen, RequestClose, CountShaderCompilation | One-way calls of `IGuestGpuBackend`. RequestClose also requests B's session shutdown. | +| `Control` | EnsureStarted(w,h), HideSplashScreen, RequestClose, CountShaderCompilation, TextInput(on) | One-way calls of `IGuestGpuBackend`. RequestClose also requests B's session shutdown. TextInput follows A's `SystemDialogInput.WantsText` (the IME keyboard is up): B's window then turns key presses into typed text. | | `HostFrame` | width, height, total, offset + piece | `Submit` of a CPU frame (splash, video), in pieces of 256 KiB written back to back. | +| `OverlayLayer` | id, visible, revision, surface size, place, size, total, offset + piece | An in-game overlay layer (IME keyboard, save data list) A painted for B's drawable (`SplitOverlayLayerSender`), in pieces of 256 KiB written back to back; visible 0 hides it. B's presenter draws it over every frame (`RemoteOverlayLayers` is its `OverlayLayerOutput.Source`). | | `GamepadOutput` | rumble, trigger rumble, adaptive triggers, lightbar | To the pad, which lives with B's window. | | `VideoOptions` | window options | Options configured after the start. | | `FrameBoundary` | ticket | The ordering half of a split `SubmitDone` (`BeginSubmitDone`): B queues the boundary behind the submissions before it and keeps its wait for `WaitFrameBoundary`. A sends it under its submission gate and waits after releasing it. | @@ -88,7 +90,8 @@ many, so they come after A's earlier records. | `ProtectRequest` | sequence, address, size, guest access, access, flags | B's `PageGuard` (watch arm/drop, ledger changes). A applies it at once on its inbound thread (`TryApplyDerivedProtection`, skipping memory A no longer registers) and raises the shared protection counter (below). A request that takes rights away waits in B until it is applied; one that gives them back does not (the fault path waits instead). | | `Interrupt` | eventId, contextId | `EndOfPipeEvents.Deliver` in A, for an interrupt raised on B's ring thread. Elsewhere interrupts are calls (below). | | `FlipEvent` | kind, flipRequestId | Flip steps sent from B's ring thread (a refused `FlipRequest`). Elsewhere flip steps are calls (below). | -| `VideoOutNotice` | kind, text | CancelOutstandingFlips, PresentationWindowClosed, ReportPresentedFrame, SelectedGpuName. | +| `VideoOutNotice` | kind, text | CancelOutstandingFlips, PresentationWindowClosed, ReportPresentedFrame, SelectedGpuName, TypedText (`SystemDialogInput.OnText` in A). | +| `OverlaySurface` | width, height | B's drawable size, at the start and on every change: A paints the overlay layers for it. | | `Input` | focus, pressed keys, gamepad state and name | B polls its `HostWindowInput` every 4 ms and sends it when it changed; A applies it to its own `HostWindowInput`. | A's inbound thread applies protections itself and hands everything else to an event thread, in order, so a slow event diff --git a/docs/sharpemu-gui-undocumented-env-vars.md b/docs/sharpemu-gui-undocumented-env-vars.md index d7d5ed7c8..ed17eacf2 100644 --- a/docs/sharpemu-gui-undocumented-env-vars.md +++ b/docs/sharpemu-gui-undocumented-env-vars.md @@ -285,6 +285,7 @@ These variables apply to the controller and input libraries. | `SHARPEMU_BTHID_EVENT_CODE` | number (decimal or `0x` hex) | Sets the event code of the synthetic Bluetooth HID callback event. The default is 0. It has an effect only with `SHARPEMU_BTHID_FIRE_CALLBACK=1`. | `BluetoothHidExports.cs` | | `SHARPEMU_BTHID_EVENT_SIZE` | number (bytes, decimal or `0x` hex) | Sets the size of the zeroed event structure for the synthetic Bluetooth HID callback. The default is 256. It has an effect only with `SHARPEMU_BTHID_FIRE_CALLBACK=1`. | `BluetoothHidExports.cs` | | `SHARPEMU_BTHID_FIRE_CALLBACK` | `1` | Calls the registered Bluetooth HID guest callback one time with a zeroed event structure. The call occurs at the first `sceBluetoothHidRegisterDevice`. The default is off. | `BluetoothHidExports.cs` | +| `SHARPEMU_IME_AUTOFILL` | `1` | Skips the on-screen keyboard of `sceImeDialogInit` and fills the game's text buffer at once with its existing text, or with `SHARPEMU_DEFAULT_PROFILE` (default `Sharp`) when it is empty. The default opens the keyboard. | `ImeDialogExports.cs` | ## Memory and CPU diff --git a/src/SharpEmu.Application/ApplicationSettings.cs b/src/SharpEmu.Application/ApplicationSettings.cs index bfd1246c1..aaf201ec9 100644 --- a/src/SharpEmu.Application/ApplicationSettings.cs +++ b/src/SharpEmu.Application/ApplicationSettings.cs @@ -45,6 +45,9 @@ public sealed class ApplicationSettings public string GnmTrophyKey { get; set; } = string.Empty; + /// The on-screen keyboard's default text (a game asking for a name); machine-wide. + public string DefaultProfile { get; set; } = "Sharp"; + public string LibraryLayout { get; set; } = "Carousel"; /// Cover size in the grid view, as a multiple of the size that fits the window. @@ -133,6 +136,7 @@ public static ApplicationSettings NormalizeFromJson(string json) settings.GameFolders = FilterNullOrEmpty(settings.GameFolders); settings.ExcludedGames = FilterNullOrEmpty(settings.ExcludedGames); settings.Language ??= "en"; + settings.DefaultProfile = NormalizeDefaultProfile(settings.DefaultProfile); settings.GnmTrophyKey = TryNormalizeTrophyKey(settings.GnmTrophyKey, out var trophyKey) ? trophyKey : string.Empty; settings.DiscordClientId ??= "1525606762248540221"; @@ -207,6 +211,12 @@ private static bool TryNormalizeTrophyKey(string? key, out string normalized) return normalized.Length == 0 || normalized.Length == 32 && normalized.All(char.IsAsciiHexDigit); } + public static string NormalizeDefaultProfile(string? value) + { + var trimmed = value?.Trim(); + return string.IsNullOrEmpty(trimmed) ? "Sharp" : trimmed; + } + internal static string NormalizeChoice(string? value, string fallback, params string[] choices) => choices.Prepend(fallback).FirstOrDefault( choice => string.Equals(choice, value, StringComparison.OrdinalIgnoreCase)) ?? fallback; diff --git a/src/SharpEmu.Application/Languages/ar.json b/src/SharpEmu.Application/Languages/ar.json index da7c7bf94..4d761f0b1 100644 --- a/src/SharpEmu.Application/Languages/ar.json +++ b/src/SharpEmu.Application/Languages/ar.json @@ -97,6 +97,22 @@ "LibraryMenu.Volume": "مستوى الصوت", "LibraryMenu.AddGames": "إضافة ألعاب", "LibraryMenu.AddFolder": "إضافة مجلد…", + "Library.Pkg.Install": "تثبيت PKG…", + "Library.Pkg.Heading": "جارٍ تثبيت {0}", + "Library.Pkg.Explanation": "يفك هذا الإجراء ضغط ملف PKG المزيف في مجلد لعبة يشغّله SharpEmu مثل أي لعبة أخرى. تستغرق الحزم الكبيرة وقتاً وتحتاج إلى مساحة قرص خالية للعبة بأكملها.", + "Library.Pkg.Preparing": "جارٍ قراءة الحزمة…", + "Library.Pkg.Progress": "{0} / {1} غيغابايت ({2}%)", + "Library.Pkg.Cancelling": "جارٍ الإلغاء…", + "Library.Pkg.Failed": "فشل التثبيت: {0}", + "Library.Pkg.SkippedNotGame": "تم تخطي {0}: حزم التحديثات والمحتوى الإضافي (DLC) غير مدعومة بعد ({1}).", + "Library.Pkg.AlreadyInstalled": "تم تخطي {0}: مثبّتة بالفعل في {1}.", + "Library.Pkg.ConfirmTitle": "تثبيت ملفات PKG؟", + "Library.Pkg.ConfirmMessage": "تم العثور على {0} من ملفات PKG في هذا المجلد. هل تريد تثبيتها الآن؟ يتطلب ذلك {1} غيغابايت من المساحة الخالية.", + "Library.Pkg.ConfirmInstall": "تثبيت", + "Library.Pkg.ConfirmSkip": "ليس الآن", + "Dialog.OpenPkg": "اختر ملف PKG لتثبيته", + "Dialog.PkgFiles": "حزم PS4/PS5", + "Dialog.ChoosePkgInstallFolder": "اختر مكان تثبيت اللعبة", "Hero.GameSettings": "إعدادات اللعبة", "Hero.Console": "وحدة التحكم", "Hint.LibraryMenu": "قائمة المكتبة", @@ -369,6 +385,34 @@ "Trophies.Sort.Name": "أ–ي", "Trophies.SearchWatermark": "ابحث عن لعبة", "Trophies.NoMatch": "لا توجد لعبة تطابق بحثك.", + "Overlay.SaveData.Title": "البيانات المحفوظة", + "Overlay.SaveData.Caption.Load": "اختر البيانات المحفوظة التي تريد تحميلها.", + "Overlay.SaveData.Caption.Save": "اختر مكان الحفظ.", + "Overlay.SaveData.Caption.Delete": "اختر البيانات المحفوظة التي تريد حذفها.", + "Overlay.SaveData.Caption.Other": "اختر البيانات المحفوظة.", + "Overlay.SaveData.Select": "تحديد", + "Overlay.SaveData.Back": "رجوع", + "Overlay.SaveData.Move": "تنقّل", + "Overlay.SaveData.Delete": "حذف", + "Overlay.SaveData.Cancel": "إلغاء", + "Overlay.SaveData.NewItem": "بيانات محفوظة جديدة", + "Overlay.SaveData.NewItemDetail": "أنشئ حفظًا جديدًا في خانة فارغة.", + "Overlay.SaveData.LastSaved": "آخر حفظ", + "Overlay.SaveData.Size": "الحجم", + "Overlay.SaveData.ConfirmDelete": "هل تريد حذف هذه البيانات المحفوظة؟", + "Overlay.SaveData.ConfirmDeleteNote": "لا يمكن استعادة البيانات المحفوظة المحذوفة.", + "Overlay.SaveData.InUse": "هذه البيانات المحفوظة قيد الاستخدام ولا يمكن حذفها.", + "Overlay.Ime.Title": "أدخل النص", + "Overlay.Ime.Done": "تم", + "Overlay.Ime.Send": "إرسال", + "Overlay.Ime.Search": "بحث", + "Overlay.Ime.Go": "انتقال", + "Overlay.Ime.Close": "إغلاق", + "Overlay.Ime.Delete": "حذف", + "Overlay.Ime.Space": "مسافة", + "Overlay.Ime.Cursor": "المؤشر", + "Overlay.Ime.Select": "تحديد", + "Overlay.Ime.Type": "اكتب باستخدام لوحة المفاتيح", "Library.Context.Patches": "التعديلات", "Library.Patches.Empty": "لم يتم العثور على تعديلات لهذا الإصدار من اللعبة", "Library.Patches.OpenFolder": "فتح مجلد التعديلات", diff --git a/src/SharpEmu.Application/Languages/az.json b/src/SharpEmu.Application/Languages/az.json index 69ba72f00..85ecd942e 100644 --- a/src/SharpEmu.Application/Languages/az.json +++ b/src/SharpEmu.Application/Languages/az.json @@ -39,6 +39,22 @@ "LibraryMenu.Volume": "Səs səviyyəsi", "LibraryMenu.AddGames": "Oyun əlavə et", "LibraryMenu.AddFolder": "Qovluq əlavə et…", + "Library.Pkg.Install": "PKG quraşdır…", + "Library.Pkg.Heading": "{0} quraşdırılır", + "Library.Pkg.Explanation": "Bu əməliyyat saxta PKG-ni SharpEmu-nun digərləri kimi işlətdiyi oyun qovluğuna açır. Böyük paketlər xeyli vaxt aparır və bütün oyun üçün boş disk sahəsi tələb edir.", + "Library.Pkg.Preparing": "Paket oxunur…", + "Library.Pkg.Progress": "{0} / {1} GB ({2}%)", + "Library.Pkg.Cancelling": "Ləğv edilir…", + "Library.Pkg.Failed": "Quraşdırma uğursuz oldu: {0}", + "Library.Pkg.SkippedNotGame": "{0} atlandı: yamaq və DLC paketləri hələ dəstəklənmir ({1}).", + "Library.Pkg.AlreadyInstalled": "{0} atlandı: artıq {1} qovluğunda quraşdırılıb.", + "Library.Pkg.ConfirmTitle": "PKG faylları quraşdırılsın?", + "Library.Pkg.ConfirmMessage": "Bu qovluqda {0} PKG faylı tapıldı. İndi quraşdırılsın? Bunun üçün {1} GB boş yer lazımdır.", + "Library.Pkg.ConfirmInstall": "Quraşdır", + "Library.Pkg.ConfirmSkip": "İndi yox", + "Dialog.OpenPkg": "Quraşdırılacaq PKG-ni seçin", + "Dialog.PkgFiles": "PS4/PS5 paketləri", + "Dialog.ChoosePkgInstallFolder": "Oyunun quraşdırılacağı yeri seçin", "Hero.GameSettings": "Oyun ayarları", "Hero.Console": "Konsol", "Hint.LibraryMenu": "Kitabxana menyusu", @@ -372,6 +388,34 @@ "Trophies.Sort.Name": "A–Z", "Trophies.SearchWatermark": "Oyun axtar", "Trophies.NoMatch": "Axtarışınıza uyğun oyun tapılmadı.", + "Overlay.SaveData.Title": "Yadda saxlanılmış məlumatlar", + "Overlay.SaveData.Caption.Load": "Yükləmək üçün yadda saxlanılmış məlumatı seçin.", + "Overlay.SaveData.Caption.Save": "Yadda saxlanacaq yeri seçin.", + "Overlay.SaveData.Caption.Delete": "Silmək üçün yadda saxlanılmış məlumatı seçin.", + "Overlay.SaveData.Caption.Other": "Yadda saxlanılmış məlumatı seçin.", + "Overlay.SaveData.Select": "Seç", + "Overlay.SaveData.Back": "Geri", + "Overlay.SaveData.Move": "Hərəkət", + "Overlay.SaveData.Delete": "Sil", + "Overlay.SaveData.Cancel": "Ləğv et", + "Overlay.SaveData.NewItem": "Yeni yadda saxlanılmış məlumat", + "Overlay.SaveData.NewItemDetail": "Boş yerdə yeni qeyd yaradın.", + "Overlay.SaveData.LastSaved": "Son yadda saxlama", + "Overlay.SaveData.Size": "Ölçü", + "Overlay.SaveData.ConfirmDelete": "Bu yadda saxlanılmış məlumat silinsin?", + "Overlay.SaveData.ConfirmDeleteNote": "Silinmiş yadda saxlanılmış məlumatlar bərpa edilə bilməz.", + "Overlay.SaveData.InUse": "Bu yadda saxlanılmış məlumat istifadədədir və silinə bilməz.", + "Overlay.Ime.Title": "Mətn daxil edin", + "Overlay.Ime.Done": "Hazırdır", + "Overlay.Ime.Send": "Göndər", + "Overlay.Ime.Search": "Axtar", + "Overlay.Ime.Go": "Keç", + "Overlay.Ime.Close": "Bağla", + "Overlay.Ime.Delete": "Sil", + "Overlay.Ime.Space": "Boşluq", + "Overlay.Ime.Cursor": "Kursor", + "Overlay.Ime.Select": "Seç", + "Overlay.Ime.Type": "Klaviatura ilə yazın", "Library.Context.Patches": "Yamalar", "Library.Patches.Empty": "Oyunun bu versiyası üçün yama tapılmadı", "Library.Patches.OpenFolder": "Yamalar qovluğunu aç", diff --git a/src/SharpEmu.Application/Languages/br.json b/src/SharpEmu.Application/Languages/br.json index 8d55cd7e6..a8de9c1d3 100644 --- a/src/SharpEmu.Application/Languages/br.json +++ b/src/SharpEmu.Application/Languages/br.json @@ -97,6 +97,22 @@ "LibraryMenu.Volume": "Volume", "LibraryMenu.AddGames": "Adicionar jogos", "LibraryMenu.AddFolder": "Adicionar pasta…", + "Library.Pkg.Install": "Instalar PKG…", + "Library.Pkg.Heading": "Instalando {0}", + "Library.Pkg.Explanation": "Isso extrai o PKG falso para uma pasta de jogo que o SharpEmu executa como qualquer outra. Pacotes grandes demoram e precisam de espaço livre em disco para o jogo inteiro.", + "Library.Pkg.Preparing": "Lendo o pacote…", + "Library.Pkg.Progress": "{0} / {1} GB ({2}%)", + "Library.Pkg.Cancelling": "Cancelando…", + "Library.Pkg.Failed": "Falha na instalação: {0}", + "Library.Pkg.SkippedNotGame": "{0} ignorado: pacotes de patch e DLC ainda não são suportados ({1}).", + "Library.Pkg.AlreadyInstalled": "{0} ignorado: já instalado em {1}.", + "Library.Pkg.ConfirmTitle": "Instalar arquivos PKG?", + "Library.Pkg.ConfirmMessage": "{0} arquivo(s) PKG encontrado(s) nesta pasta. Instalar agora? Isso exige {1} GB de espaço livre.", + "Library.Pkg.ConfirmInstall": "Instalar", + "Library.Pkg.ConfirmSkip": "Agora não", + "Dialog.OpenPkg": "Escolha um PKG para instalar", + "Dialog.PkgFiles": "Pacotes de PS4/PS5", + "Dialog.ChoosePkgInstallFolder": "Escolha onde instalar o jogo", "Hero.GameSettings": "Configurações do jogo", "Hero.Console": "Console", "Hint.LibraryMenu": "Menu da biblioteca", @@ -369,6 +385,34 @@ "Trophies.Sort.Name": "A–Z", "Trophies.SearchWatermark": "Pesquisar jogos", "Trophies.NoMatch": "Nenhum jogo corresponde à sua pesquisa.", + "Overlay.SaveData.Title": "Dados salvos", + "Overlay.SaveData.Caption.Load": "Selecione os dados salvos para carregar.", + "Overlay.SaveData.Caption.Save": "Selecione onde salvar.", + "Overlay.SaveData.Caption.Delete": "Selecione os dados salvos para excluir.", + "Overlay.SaveData.Caption.Other": "Selecione dados salvos.", + "Overlay.SaveData.Select": "Selecionar", + "Overlay.SaveData.Back": "Voltar", + "Overlay.SaveData.Move": "Mover", + "Overlay.SaveData.Delete": "Excluir", + "Overlay.SaveData.Cancel": "Cancelar", + "Overlay.SaveData.NewItem": "Novos dados salvos", + "Overlay.SaveData.NewItemDetail": "Crie um novo salvamento em um espaço livre.", + "Overlay.SaveData.LastSaved": "Último salvamento", + "Overlay.SaveData.Size": "Tamanho", + "Overlay.SaveData.ConfirmDelete": "Excluir estes dados salvos?", + "Overlay.SaveData.ConfirmDeleteNote": "Dados salvos excluídos não podem ser restaurados.", + "Overlay.SaveData.InUse": "Estes dados salvos estão em uso e não podem ser excluídos.", + "Overlay.Ime.Title": "Digitar texto", + "Overlay.Ime.Done": "Concluído", + "Overlay.Ime.Send": "Enviar", + "Overlay.Ime.Search": "Pesquisar", + "Overlay.Ime.Go": "Ir", + "Overlay.Ime.Close": "Fechar", + "Overlay.Ime.Delete": "Excluir", + "Overlay.Ime.Space": "Espaço", + "Overlay.Ime.Cursor": "Cursor", + "Overlay.Ime.Select": "Selecionar", + "Overlay.Ime.Type": "Digite com o teclado", "Library.Context.Patches": "Patches", "Library.Patches.Empty": "Nenhum patch encontrado para esta versão do jogo", "Library.Patches.OpenFolder": "Abrir pasta de patches", diff --git a/src/SharpEmu.Application/Languages/de.json b/src/SharpEmu.Application/Languages/de.json index 8cbb53397..168426a9a 100644 --- a/src/SharpEmu.Application/Languages/de.json +++ b/src/SharpEmu.Application/Languages/de.json @@ -97,6 +97,22 @@ "LibraryMenu.Volume": "Lautstärke", "LibraryMenu.AddGames": "Spiele hinzufügen", "LibraryMenu.AddFolder": "Ordner hinzufügen…", + "Library.Pkg.Install": "PKG installieren…", + "Library.Pkg.Heading": "{0} wird installiert", + "Library.Pkg.Explanation": "Dadurch wird das gefälschte PKG in einen Spielordner entpackt, den SharpEmu wie jeden anderen startet. Große Pakete brauchen etwas Zeit und freien Speicherplatz für das gesamte Spiel.", + "Library.Pkg.Preparing": "Paket wird gelesen…", + "Library.Pkg.Progress": "{0} / {1} GB ({2}%)", + "Library.Pkg.Cancelling": "Wird abgebrochen…", + "Library.Pkg.Failed": "Installation fehlgeschlagen: {0}", + "Library.Pkg.SkippedNotGame": "{0} übersprungen: Patches und DLC-Pakete werden noch nicht unterstützt ({1}).", + "Library.Pkg.AlreadyInstalled": "{0} übersprungen: bereits in {1} installiert.", + "Library.Pkg.ConfirmTitle": "PKG-Dateien installieren?", + "Library.Pkg.ConfirmMessage": "{0} PKG-Datei(en) in diesem Ordner gefunden. Jetzt installieren? Dafür werden {1} GB freier Speicherplatz benötigt.", + "Library.Pkg.ConfirmInstall": "Installieren", + "Library.Pkg.ConfirmSkip": "Nicht jetzt", + "Dialog.OpenPkg": "PKG zum Installieren auswählen", + "Dialog.PkgFiles": "PS4/PS5-Pakete", + "Dialog.ChoosePkgInstallFolder": "Wähle, wo das Spiel installiert werden soll", "Hero.GameSettings": "Spieleinstellungen", "Hero.Console": "Konsole", "Hint.LibraryMenu": "Bibliotheksmenü", @@ -369,6 +385,34 @@ "Trophies.Sort.Name": "A–Z", "Trophies.SearchWatermark": "Spiele suchen", "Trophies.NoMatch": "Kein Spiel passt zu deiner Suche.", + "Overlay.SaveData.Title": "Gespeicherte Daten", + "Overlay.SaveData.Caption.Load": "Wähle die gespeicherten Daten zum Laden aus.", + "Overlay.SaveData.Caption.Save": "Wähle aus, wo gespeichert werden soll.", + "Overlay.SaveData.Caption.Delete": "Wähle die zu löschenden gespeicherten Daten aus.", + "Overlay.SaveData.Caption.Other": "Wähle gespeicherte Daten aus.", + "Overlay.SaveData.Select": "Auswählen", + "Overlay.SaveData.Back": "Zurück", + "Overlay.SaveData.Move": "Bewegen", + "Overlay.SaveData.Delete": "Löschen", + "Overlay.SaveData.Cancel": "Abbrechen", + "Overlay.SaveData.NewItem": "Neue gespeicherte Daten", + "Overlay.SaveData.NewItemDetail": "Einen neuen Spielstand auf einem freien Platz anlegen.", + "Overlay.SaveData.LastSaved": "Zuletzt gespeichert", + "Overlay.SaveData.Size": "Größe", + "Overlay.SaveData.ConfirmDelete": "Diese gespeicherten Daten löschen?", + "Overlay.SaveData.ConfirmDeleteNote": "Gelöschte gespeicherte Daten können nicht wiederhergestellt werden.", + "Overlay.SaveData.InUse": "Diese gespeicherten Daten werden verwendet und können nicht gelöscht werden.", + "Overlay.Ime.Title": "Text eingeben", + "Overlay.Ime.Done": "Fertig", + "Overlay.Ime.Send": "Senden", + "Overlay.Ime.Search": "Suchen", + "Overlay.Ime.Go": "Los", + "Overlay.Ime.Close": "Schließen", + "Overlay.Ime.Delete": "Löschen", + "Overlay.Ime.Space": "Leertaste", + "Overlay.Ime.Cursor": "Cursor", + "Overlay.Ime.Select": "Auswählen", + "Overlay.Ime.Type": "Mit der Tastatur tippen", "Library.Context.Patches": "Patches", "Library.Patches.Empty": "Keine Patches für diese Spielversion gefunden", "Library.Patches.OpenFolder": "Patch-Ordner öffnen", diff --git a/src/SharpEmu.Application/Languages/dk.json b/src/SharpEmu.Application/Languages/dk.json index 897139c3b..5a7435195 100644 --- a/src/SharpEmu.Application/Languages/dk.json +++ b/src/SharpEmu.Application/Languages/dk.json @@ -97,6 +97,22 @@ "LibraryMenu.Volume": "Lydstyrke", "LibraryMenu.AddGames": "Tilføj spil", "LibraryMenu.AddFolder": "Tilføj mappe…", + "Library.Pkg.Install": "Installer PKG…", + "Library.Pkg.Heading": "Installerer {0}", + "Library.Pkg.Explanation": "Dette udpakker den falske PKG til en spilmappe, som SharpEmu kører som alle andre. Store pakker tager tid og kræver ledig diskplads til hele spillet.", + "Library.Pkg.Preparing": "Læser pakken…", + "Library.Pkg.Progress": "{0} / {1} GB ({2}%)", + "Library.Pkg.Cancelling": "Annullerer…", + "Library.Pkg.Failed": "Installationen mislykkedes: {0}", + "Library.Pkg.SkippedNotGame": "{0} sprunget over: patch- og DLC-pakker understøttes endnu ikke ({1}).", + "Library.Pkg.AlreadyInstalled": "{0} sprunget over: allerede installeret i {1}.", + "Library.Pkg.ConfirmTitle": "Installer PKG-filer?", + "Library.Pkg.ConfirmMessage": "Fandt {0} PKG-fil(er) i denne mappe. Vil du installere dem nu? Det kræver {1} GB ledig plads.", + "Library.Pkg.ConfirmInstall": "Installer", + "Library.Pkg.ConfirmSkip": "Ikke nu", + "Dialog.OpenPkg": "Vælg en PKG der skal installeres", + "Dialog.PkgFiles": "PS4/PS5-pakker", + "Dialog.ChoosePkgInstallFolder": "Vælg hvor spillet skal installeres", "Hero.GameSettings": "Spilindstillinger", "Hero.Console": "Konsol", "Hint.LibraryMenu": "Biblioteksmenu", @@ -369,6 +385,34 @@ "Trophies.Sort.Name": "A–Z", "Trophies.SearchWatermark": "Søg efter spil", "Trophies.NoMatch": "Intet spil matcher din søgning.", + "Overlay.SaveData.Title": "Gemte data", + "Overlay.SaveData.Caption.Load": "Vælg de gemte data, der skal indlæses.", + "Overlay.SaveData.Caption.Save": "Vælg, hvor der skal gemmes.", + "Overlay.SaveData.Caption.Delete": "Vælg de gemte data, der skal slettes.", + "Overlay.SaveData.Caption.Other": "Vælg gemte data.", + "Overlay.SaveData.Select": "Vælg", + "Overlay.SaveData.Back": "Tilbage", + "Overlay.SaveData.Move": "Naviger", + "Overlay.SaveData.Delete": "Slet", + "Overlay.SaveData.Cancel": "Annuller", + "Overlay.SaveData.NewItem": "Nye gemte data", + "Overlay.SaveData.NewItemDetail": "Opret en ny gemning på en ledig plads.", + "Overlay.SaveData.LastSaved": "Sidst gemt", + "Overlay.SaveData.Size": "Størrelse", + "Overlay.SaveData.ConfirmDelete": "Vil du slette disse gemte data?", + "Overlay.SaveData.ConfirmDeleteNote": "Slettede gemte data kan ikke gendannes.", + "Overlay.SaveData.InUse": "Disse gemte data er i brug og kan ikke slettes.", + "Overlay.Ime.Title": "Indtast tekst", + "Overlay.Ime.Done": "Færdig", + "Overlay.Ime.Send": "Send", + "Overlay.Ime.Search": "Søg", + "Overlay.Ime.Go": "Gå", + "Overlay.Ime.Close": "Luk", + "Overlay.Ime.Delete": "Slet", + "Overlay.Ime.Space": "Mellemrum", + "Overlay.Ime.Cursor": "Markør", + "Overlay.Ime.Select": "Vælg", + "Overlay.Ime.Type": "Skriv med dit tastatur", "Library.Context.Patches": "Patches", "Library.Patches.Empty": "Ingen patches fundet til denne spilversion", "Library.Patches.OpenFolder": "Åbn patchmappe", diff --git a/src/SharpEmu.Application/Languages/ee.json b/src/SharpEmu.Application/Languages/ee.json index e84f22cad..6d70ccd20 100644 --- a/src/SharpEmu.Application/Languages/ee.json +++ b/src/SharpEmu.Application/Languages/ee.json @@ -97,6 +97,22 @@ "LibraryMenu.Volume": "Helitugevus", "LibraryMenu.AddGames": "Lisa mänge", "LibraryMenu.AddFolder": "Lisa kaust…", + "Library.Pkg.Install": "Installi PKG…", + "Library.Pkg.Heading": "Installin {0}", + "Library.Pkg.Explanation": "See pakib võlts-PKG lahti mängukausta, mida SharpEmu käivitab nagu iga teist. Suured paketid võtavad aega ja vajavad vaba kettaruumi kogu mängu jaoks.", + "Library.Pkg.Preparing": "Paketi lugemine…", + "Library.Pkg.Progress": "{0} / {1} GB ({2}%)", + "Library.Pkg.Cancelling": "Tühistamine…", + "Library.Pkg.Failed": "Installimine ebaõnnestus: {0}", + "Library.Pkg.SkippedNotGame": "{0} jäeti vahele: paigad ja DLC-paketid ei ole veel toetatud ({1}).", + "Library.Pkg.AlreadyInstalled": "{0} jäeti vahele: juba installitud kausta {1}.", + "Library.Pkg.ConfirmTitle": "Kas installida PKG-failid?", + "Library.Pkg.ConfirmMessage": "Sellest kaustast leiti {0} PKG-faili. Kas installida need nüüd? See vajab {1} GB vaba ruumi.", + "Library.Pkg.ConfirmInstall": "Installi", + "Library.Pkg.ConfirmSkip": "Mitte praegu", + "Dialog.OpenPkg": "Vali installitav PKG", + "Dialog.PkgFiles": "PS4/PS5 paketid", + "Dialog.ChoosePkgInstallFolder": "Vali, kuhu mäng installida", "Hero.GameSettings": "Mängu seaded", "Hero.Console": "Konsool", "Hint.LibraryMenu": "Teegi menüü", @@ -371,6 +387,34 @@ "Trophies.Sort.Name": "A–Z", "Trophies.SearchWatermark": "Otsi mänge", "Trophies.NoMatch": "Sinu otsingule ei vasta ükski mäng.", + "Overlay.SaveData.Title": "Salvestatud andmed", + "Overlay.SaveData.Caption.Load": "Vali laaditavad salvestatud andmed.", + "Overlay.SaveData.Caption.Save": "Vali, kuhu salvestada.", + "Overlay.SaveData.Caption.Delete": "Vali kustutatavad salvestatud andmed.", + "Overlay.SaveData.Caption.Other": "Vali salvestatud andmed.", + "Overlay.SaveData.Select": "Vali", + "Overlay.SaveData.Back": "Tagasi", + "Overlay.SaveData.Move": "Liigu", + "Overlay.SaveData.Delete": "Kustuta", + "Overlay.SaveData.Cancel": "Tühista", + "Overlay.SaveData.NewItem": "Uued salvestatud andmed", + "Overlay.SaveData.NewItemDetail": "Loo vabasse pesasse uus salvestus.", + "Overlay.SaveData.LastSaved": "Viimati salvestatud", + "Overlay.SaveData.Size": "Suurus", + "Overlay.SaveData.ConfirmDelete": "Kas kustutada need salvestatud andmed?", + "Overlay.SaveData.ConfirmDeleteNote": "Kustutatud salvestatud andmeid ei saa taastada.", + "Overlay.SaveData.InUse": "Need salvestatud andmed on kasutusel ja neid ei saa kustutada.", + "Overlay.Ime.Title": "Sisesta tekst", + "Overlay.Ime.Done": "Valmis", + "Overlay.Ime.Send": "Saada", + "Overlay.Ime.Search": "Otsi", + "Overlay.Ime.Go": "Mine", + "Overlay.Ime.Close": "Sulge", + "Overlay.Ime.Delete": "Kustuta", + "Overlay.Ime.Space": "Tühik", + "Overlay.Ime.Cursor": "Kursor", + "Overlay.Ime.Select": "Vali", + "Overlay.Ime.Type": "Kirjuta klaviatuuriga", "Library.Context.Patches": "Paigad", "Library.Patches.Empty": "Sellele mänguversioonile ei leitud paiku", "Library.Patches.OpenFolder": "Ava paikade kaust", diff --git a/src/SharpEmu.Application/Languages/en.json b/src/SharpEmu.Application/Languages/en.json index c5eb1b687..1531efdad 100644 --- a/src/SharpEmu.Application/Languages/en.json +++ b/src/SharpEmu.Application/Languages/en.json @@ -96,6 +96,22 @@ "LibraryMenu.Volume": "Volume", "LibraryMenu.AddGames": "Add games", "LibraryMenu.AddFolder": "Add folder…", + "Library.Pkg.Install": "Install PKG…", + "Library.Pkg.Heading": "Installing {0}", + "Library.Pkg.Explanation": "This unpacks the fake PKG into a game folder that SharpEmu runs like any other. Large packages take a while and need free disk space for the whole game.", + "Library.Pkg.Preparing": "Reading the package…", + "Library.Pkg.Progress": "{0} / {1} GB ({2}%)", + "Library.Pkg.Cancelling": "Cancelling…", + "Library.Pkg.Failed": "Installing failed: {0}", + "Library.Pkg.SkippedNotGame": "Skipped {0}: patches and DLC packages are not supported yet ({1}).", + "Library.Pkg.AlreadyInstalled": "Skipped {0}: already installed in {1}.", + "Library.Pkg.ConfirmTitle": "Install PKG files?", + "Library.Pkg.ConfirmMessage": "Found {0} PKG file(s) in this folder. Install them now? This needs {1} GB of free space.", + "Library.Pkg.ConfirmInstall": "Install", + "Library.Pkg.ConfirmSkip": "Not now", + "Dialog.OpenPkg": "Choose a PKG to install", + "Dialog.PkgFiles": "PS4 and PS5 packages", + "Dialog.ChoosePkgInstallFolder": "Choose where to install the game", "Hero.GameSettings": "Game settings", "Hero.Console": "Console", "Hint.LibraryMenu": "Library menu", @@ -406,6 +422,34 @@ "Trophies.Sort.Name": "A–Z", "Trophies.SearchWatermark": "Search games", "Trophies.NoMatch": "No game matches your search.", + "Overlay.SaveData.Title": "Saved Data", + "Overlay.SaveData.Caption.Load": "Select the saved data to load.", + "Overlay.SaveData.Caption.Save": "Select where to save.", + "Overlay.SaveData.Caption.Delete": "Select the saved data to delete.", + "Overlay.SaveData.Caption.Other": "Select saved data.", + "Overlay.SaveData.Select": "Select", + "Overlay.SaveData.Back": "Back", + "Overlay.SaveData.Move": "Move", + "Overlay.SaveData.Delete": "Delete", + "Overlay.SaveData.Cancel": "Cancel", + "Overlay.SaveData.NewItem": "New Saved Data", + "Overlay.SaveData.NewItemDetail": "Create a new save in an empty slot.", + "Overlay.SaveData.LastSaved": "Last saved", + "Overlay.SaveData.Size": "Size", + "Overlay.SaveData.ConfirmDelete": "Delete this saved data?", + "Overlay.SaveData.ConfirmDeleteNote": "Deleted saved data can't be restored.", + "Overlay.SaveData.InUse": "This saved data is in use and can't be deleted.", + "Overlay.Ime.Title": "Enter text", + "Overlay.Ime.Done": "Done", + "Overlay.Ime.Send": "Send", + "Overlay.Ime.Search": "Search", + "Overlay.Ime.Go": "Go", + "Overlay.Ime.Close": "Close", + "Overlay.Ime.Delete": "Delete", + "Overlay.Ime.Space": "Space", + "Overlay.Ime.Cursor": "Cursor", + "Overlay.Ime.Select": "Select", + "Overlay.Ime.Type": "Type with your keyboard", "Library.Context.Patches": "Patches", "Library.Patches.Empty": "No patches found for this game version", "Library.Patches.OpenFolder": "Open patches folder", diff --git a/src/SharpEmu.Application/Languages/es.json b/src/SharpEmu.Application/Languages/es.json index b90e56a6a..6a66c4529 100644 --- a/src/SharpEmu.Application/Languages/es.json +++ b/src/SharpEmu.Application/Languages/es.json @@ -97,6 +97,22 @@ "LibraryMenu.Volume": "Volumen", "LibraryMenu.AddGames": "Añadir juegos", "LibraryMenu.AddFolder": "Añadir carpeta…", + "Library.Pkg.Install": "Instalar PKG…", + "Library.Pkg.Heading": "Instalando {0}", + "Library.Pkg.Explanation": "Esto descomprime el PKG falso en una carpeta de juego que SharpEmu ejecuta como cualquier otra. Los paquetes grandes tardan y necesitan espacio libre en disco para todo el juego.", + "Library.Pkg.Preparing": "Leyendo el paquete…", + "Library.Pkg.Progress": "{0} / {1} GB ({2}%)", + "Library.Pkg.Cancelling": "Cancelando…", + "Library.Pkg.Failed": "Error al instalar: {0}", + "Library.Pkg.SkippedNotGame": "{0} omitido: los paquetes de parches y DLC aún no son compatibles ({1}).", + "Library.Pkg.AlreadyInstalled": "{0} omitido: ya está instalado en {1}.", + "Library.Pkg.ConfirmTitle": "¿Instalar archivos PKG?", + "Library.Pkg.ConfirmMessage": "Se encontraron {0} archivo(s) PKG en esta carpeta. ¿Instalarlos ahora? Esto requiere {1} GB de espacio libre.", + "Library.Pkg.ConfirmInstall": "Instalar", + "Library.Pkg.ConfirmSkip": "Ahora no", + "Dialog.OpenPkg": "Elige un PKG para instalar", + "Dialog.PkgFiles": "Paquetes de PS4/PS5", + "Dialog.ChoosePkgInstallFolder": "Elige dónde instalar el juego", "Hero.GameSettings": "Ajustes del juego", "Hero.Console": "Consola", "Hint.LibraryMenu": "Menú de la biblioteca", @@ -369,6 +385,34 @@ "Trophies.Sort.Name": "A–Z", "Trophies.SearchWatermark": "Buscar juegos", "Trophies.NoMatch": "Ningún juego coincide con tu búsqueda.", + "Overlay.SaveData.Title": "Datos guardados", + "Overlay.SaveData.Caption.Load": "Selecciona los datos guardados que quieres cargar.", + "Overlay.SaveData.Caption.Save": "Selecciona dónde guardar.", + "Overlay.SaveData.Caption.Delete": "Selecciona los datos guardados que quieres eliminar.", + "Overlay.SaveData.Caption.Other": "Selecciona datos guardados.", + "Overlay.SaveData.Select": "Seleccionar", + "Overlay.SaveData.Back": "Atrás", + "Overlay.SaveData.Move": "Mover", + "Overlay.SaveData.Delete": "Eliminar", + "Overlay.SaveData.Cancel": "Cancelar", + "Overlay.SaveData.NewItem": "Nuevos datos guardados", + "Overlay.SaveData.NewItemDetail": "Crea una partida guardada nueva en un espacio libre.", + "Overlay.SaveData.LastSaved": "Último guardado", + "Overlay.SaveData.Size": "Tamaño", + "Overlay.SaveData.ConfirmDelete": "¿Eliminar estos datos guardados?", + "Overlay.SaveData.ConfirmDeleteNote": "Los datos guardados eliminados no se pueden recuperar.", + "Overlay.SaveData.InUse": "Estos datos guardados están en uso y no se pueden eliminar.", + "Overlay.Ime.Title": "Introducir texto", + "Overlay.Ime.Done": "Hecho", + "Overlay.Ime.Send": "Enviar", + "Overlay.Ime.Search": "Buscar", + "Overlay.Ime.Go": "Ir", + "Overlay.Ime.Close": "Cerrar", + "Overlay.Ime.Delete": "Eliminar", + "Overlay.Ime.Space": "Espacio", + "Overlay.Ime.Cursor": "Cursor", + "Overlay.Ime.Select": "Seleccionar", + "Overlay.Ime.Type": "Escribe con el teclado", "Library.Context.Patches": "Parches", "Library.Patches.Empty": "No se encontraron parches para esta versión del juego", "Library.Patches.OpenFolder": "Abrir carpeta de parches", diff --git a/src/SharpEmu.Application/Languages/fr.json b/src/SharpEmu.Application/Languages/fr.json index a729956e2..d5188bcf4 100644 --- a/src/SharpEmu.Application/Languages/fr.json +++ b/src/SharpEmu.Application/Languages/fr.json @@ -97,6 +97,22 @@ "LibraryMenu.Volume": "Volume", "LibraryMenu.AddGames": "Ajouter des jeux", "LibraryMenu.AddFolder": "Ajouter un dossier…", + "Library.Pkg.Install": "Installer un PKG…", + "Library.Pkg.Heading": "Installation de {0}", + "Library.Pkg.Explanation": "Cette action décompresse le faux PKG dans un dossier de jeu que SharpEmu lance comme n’importe quel autre. Les gros paquets prennent du temps et nécessitent assez d’espace disque pour tout le jeu.", + "Library.Pkg.Preparing": "Lecture du paquet…", + "Library.Pkg.Progress": "{0} / {1} Go ({2} %)", + "Library.Pkg.Cancelling": "Annulation…", + "Library.Pkg.Failed": "Échec de l’installation : {0}", + "Library.Pkg.SkippedNotGame": "{0} ignoré : les paquets de correctif et de DLC ne sont pas encore pris en charge ({1}).", + "Library.Pkg.AlreadyInstalled": "{0} ignoré : déjà installé dans {1}.", + "Library.Pkg.ConfirmTitle": "Installer les fichiers PKG ?", + "Library.Pkg.ConfirmMessage": "{0} fichier(s) PKG trouvé(s) dans ce dossier. Les installer maintenant ? Cela nécessite {1} Go d’espace libre.", + "Library.Pkg.ConfirmInstall": "Installer", + "Library.Pkg.ConfirmSkip": "Pas maintenant", + "Dialog.OpenPkg": "Choisir un PKG à installer", + "Dialog.PkgFiles": "Paquets PS4/PS5", + "Dialog.ChoosePkgInstallFolder": "Choisir où installer le jeu", "Hero.GameSettings": "Paramètres du jeu", "Hero.Console": "Console", "Hint.LibraryMenu": "Menu de la bibliothèque", @@ -372,6 +388,34 @@ "Trophies.Sort.Name": "A–Z", "Trophies.SearchWatermark": "Rechercher un jeu", "Trophies.NoMatch": "Aucun jeu ne correspond à votre recherche.", + "Overlay.SaveData.Title": "Données sauvegardées", + "Overlay.SaveData.Caption.Load": "Sélectionnez les données sauvegardées à charger.", + "Overlay.SaveData.Caption.Save": "Sélectionnez l’emplacement de la sauvegarde.", + "Overlay.SaveData.Caption.Delete": "Sélectionnez les données sauvegardées à supprimer.", + "Overlay.SaveData.Caption.Other": "Sélectionnez des données sauvegardées.", + "Overlay.SaveData.Select": "Sélectionner", + "Overlay.SaveData.Back": "Retour", + "Overlay.SaveData.Move": "Naviguer", + "Overlay.SaveData.Delete": "Supprimer", + "Overlay.SaveData.Cancel": "Annuler", + "Overlay.SaveData.NewItem": "Nouvelles données sauvegardées", + "Overlay.SaveData.NewItemDetail": "Créer une nouvelle sauvegarde dans un emplacement libre.", + "Overlay.SaveData.LastSaved": "Dernière sauvegarde", + "Overlay.SaveData.Size": "Taille", + "Overlay.SaveData.ConfirmDelete": "Supprimer ces données sauvegardées ?", + "Overlay.SaveData.ConfirmDeleteNote": "Les données sauvegardées supprimées ne peuvent pas être restaurées.", + "Overlay.SaveData.InUse": "Ces données sauvegardées sont en cours d’utilisation et ne peuvent pas être supprimées.", + "Overlay.Ime.Title": "Saisir du texte", + "Overlay.Ime.Done": "Terminé", + "Overlay.Ime.Send": "Envoyer", + "Overlay.Ime.Search": "Rechercher", + "Overlay.Ime.Go": "OK", + "Overlay.Ime.Close": "Fermer", + "Overlay.Ime.Delete": "Supprimer", + "Overlay.Ime.Space": "Espace", + "Overlay.Ime.Cursor": "Curseur", + "Overlay.Ime.Select": "Sélectionner", + "Overlay.Ime.Type": "Tapez avec votre clavier", "Library.Context.Patches": "Correctifs", "Library.Patches.Empty": "Aucun correctif trouvé pour cette version du jeu", "Library.Patches.OpenFolder": "Ouvrir le dossier des correctifs", diff --git a/src/SharpEmu.Application/Languages/hu.json b/src/SharpEmu.Application/Languages/hu.json index 6614770b0..020343e3e 100644 --- a/src/SharpEmu.Application/Languages/hu.json +++ b/src/SharpEmu.Application/Languages/hu.json @@ -97,6 +97,22 @@ "LibraryMenu.Volume": "Hangerő", "LibraryMenu.AddGames": "Játékok hozzáadása", "LibraryMenu.AddFolder": "Mappa hozzáadása…", + "Library.Pkg.Install": "PKG telepítése…", + "Library.Pkg.Heading": "{0} telepítése", + "Library.Pkg.Explanation": "Ez kicsomagolja a hamis PKG-t egy játékmappába, amelyet a SharpEmu úgy futtat, mint bármelyik másikat. A nagy csomagok sokáig tartanak, és a teljes játékhoz elegendő szabad lemezterület kell.", + "Library.Pkg.Preparing": "Csomag olvasása…", + "Library.Pkg.Progress": "{0} / {1} GB ({2}%)", + "Library.Pkg.Cancelling": "Megszakítás…", + "Library.Pkg.Failed": "A telepítés sikertelen: {0}", + "Library.Pkg.SkippedNotGame": "{0} kihagyva: a javítócsomagok és a DLC-csomagok még nem támogatottak ({1}).", + "Library.Pkg.AlreadyInstalled": "{0} kihagyva: már telepítve van ide: {1}.", + "Library.Pkg.ConfirmTitle": "Telepíti a PKG-fájlokat?", + "Library.Pkg.ConfirmMessage": "{0} PKG-fájl található ebben a mappában. Telepíti őket most? Ehhez {1} GB szabad hely szükséges.", + "Library.Pkg.ConfirmInstall": "Telepítés", + "Library.Pkg.ConfirmSkip": "Most nem", + "Dialog.OpenPkg": "Válassza ki a telepítendő PKG-t", + "Dialog.PkgFiles": "PS4/PS5-csomagok", + "Dialog.ChoosePkgInstallFolder": "Válassza ki, hová települjön a játék", "Hero.GameSettings": "Játékbeállítások", "Hero.Console": "Konzol", "Hint.LibraryMenu": "Könyvtár menü", @@ -369,6 +385,34 @@ "Trophies.Sort.Name": "A–Z", "Trophies.SearchWatermark": "Játékok keresése", "Trophies.NoMatch": "Nincs a keresésnek megfelelő játék.", + "Overlay.SaveData.Title": "Mentett adatok", + "Overlay.SaveData.Caption.Load": "Válaszd ki a betöltendő mentett adatot.", + "Overlay.SaveData.Caption.Save": "Válaszd ki a mentés helyét.", + "Overlay.SaveData.Caption.Delete": "Válaszd ki a törlendő mentett adatot.", + "Overlay.SaveData.Caption.Other": "Válassz mentett adatot.", + "Overlay.SaveData.Select": "Kiválasztás", + "Overlay.SaveData.Back": "Vissza", + "Overlay.SaveData.Move": "Mozgás", + "Overlay.SaveData.Delete": "Törlés", + "Overlay.SaveData.Cancel": "Mégse", + "Overlay.SaveData.NewItem": "Új mentett adat", + "Overlay.SaveData.NewItemDetail": "Új mentés létrehozása egy üres helyen.", + "Overlay.SaveData.LastSaved": "Utolsó mentés", + "Overlay.SaveData.Size": "Méret", + "Overlay.SaveData.ConfirmDelete": "Törlöd ezt a mentett adatot?", + "Overlay.SaveData.ConfirmDeleteNote": "A törölt mentett adatok nem állíthatók vissza.", + "Overlay.SaveData.InUse": "Ez a mentett adat használatban van, ezért nem törölhető.", + "Overlay.Ime.Title": "Szöveg beírása", + "Overlay.Ime.Done": "Kész", + "Overlay.Ime.Send": "Küldés", + "Overlay.Ime.Search": "Keresés", + "Overlay.Ime.Go": "Ugrás", + "Overlay.Ime.Close": "Bezárás", + "Overlay.Ime.Delete": "Törlés", + "Overlay.Ime.Space": "Szóköz", + "Overlay.Ime.Cursor": "Kurzor", + "Overlay.Ime.Select": "Kiválasztás", + "Overlay.Ime.Type": "Gépelj a billentyűzeteddel", "Library.Context.Patches": "Javítások", "Library.Patches.Empty": "Nem található javítás ehhez a játékverzióhoz", "Library.Patches.OpenFolder": "Javítások mappájának megnyitása", diff --git a/src/SharpEmu.Application/Languages/it.json b/src/SharpEmu.Application/Languages/it.json index 2c6c536b7..49c00f8af 100644 --- a/src/SharpEmu.Application/Languages/it.json +++ b/src/SharpEmu.Application/Languages/it.json @@ -97,6 +97,22 @@ "LibraryMenu.Volume": "Volume", "LibraryMenu.AddGames": "Aggiungi giochi", "LibraryMenu.AddFolder": "Aggiungi cartella…", + "Library.Pkg.Install": "Installa PKG…", + "Library.Pkg.Heading": "Installazione di {0}", + "Library.Pkg.Explanation": "Questa operazione estrae il PKG fittizio in una cartella di gioco che SharpEmu esegue come qualsiasi altra. I pacchetti grandi richiedono tempo e spazio libero su disco per l'intero gioco.", + "Library.Pkg.Preparing": "Lettura del pacchetto…", + "Library.Pkg.Progress": "{0} / {1} GB ({2}%)", + "Library.Pkg.Cancelling": "Annullamento…", + "Library.Pkg.Failed": "Installazione non riuscita: {0}", + "Library.Pkg.SkippedNotGame": "{0} ignorato: i pacchetti di patch e DLC non sono ancora supportati ({1}).", + "Library.Pkg.AlreadyInstalled": "{0} ignorato: già installato in {1}.", + "Library.Pkg.ConfirmTitle": "Installare i file PKG?", + "Library.Pkg.ConfirmMessage": "Trovati {0} file PKG in questa cartella. Installarli ora? Servono {1} GB di spazio libero.", + "Library.Pkg.ConfirmInstall": "Installa", + "Library.Pkg.ConfirmSkip": "Non ora", + "Dialog.OpenPkg": "Scegli un PKG da installare", + "Dialog.PkgFiles": "Pacchetti PS4/PS5", + "Dialog.ChoosePkgInstallFolder": "Scegli dove installare il gioco", "Hero.GameSettings": "Impostazioni del gioco", "Hero.Console": "Console", "Hint.LibraryMenu": "Menu della libreria", @@ -369,6 +385,34 @@ "Trophies.Sort.Name": "A–Z", "Trophies.SearchWatermark": "Cerca giochi", "Trophies.NoMatch": "Nessun gioco corrisponde alla ricerca.", + "Overlay.SaveData.Title": "Dati salvati", + "Overlay.SaveData.Caption.Load": "Seleziona i dati salvati da caricare.", + "Overlay.SaveData.Caption.Save": "Seleziona dove salvare.", + "Overlay.SaveData.Caption.Delete": "Seleziona i dati salvati da eliminare.", + "Overlay.SaveData.Caption.Other": "Seleziona i dati salvati.", + "Overlay.SaveData.Select": "Seleziona", + "Overlay.SaveData.Back": "Indietro", + "Overlay.SaveData.Move": "Sposta", + "Overlay.SaveData.Delete": "Elimina", + "Overlay.SaveData.Cancel": "Annulla", + "Overlay.SaveData.NewItem": "Nuovi dati salvati", + "Overlay.SaveData.NewItemDetail": "Crea un nuovo salvataggio in uno slot libero.", + "Overlay.SaveData.LastSaved": "Ultimo salvataggio", + "Overlay.SaveData.Size": "Dimensione", + "Overlay.SaveData.ConfirmDelete": "Eliminare questi dati salvati?", + "Overlay.SaveData.ConfirmDeleteNote": "I dati salvati eliminati non possono essere ripristinati.", + "Overlay.SaveData.InUse": "Questi dati salvati sono in uso e non possono essere eliminati.", + "Overlay.Ime.Title": "Inserisci testo", + "Overlay.Ime.Done": "Fine", + "Overlay.Ime.Send": "Invia", + "Overlay.Ime.Search": "Cerca", + "Overlay.Ime.Go": "Vai", + "Overlay.Ime.Close": "Chiudi", + "Overlay.Ime.Delete": "Elimina", + "Overlay.Ime.Space": "Spazio", + "Overlay.Ime.Cursor": "Cursore", + "Overlay.Ime.Select": "Seleziona", + "Overlay.Ime.Type": "Scrivi con la tastiera", "Library.Context.Patches": "Patch", "Library.Patches.Empty": "Nessuna patch trovata per questa versione del gioco", "Library.Patches.OpenFolder": "Apri cartella delle patch", diff --git a/src/SharpEmu.Application/Languages/ja.json b/src/SharpEmu.Application/Languages/ja.json index c038ba793..4c28e5fb0 100644 --- a/src/SharpEmu.Application/Languages/ja.json +++ b/src/SharpEmu.Application/Languages/ja.json @@ -97,6 +97,22 @@ "LibraryMenu.Volume": "音量", "LibraryMenu.AddGames": "ゲームを追加", "LibraryMenu.AddFolder": "フォルダーを追加…", + "Library.Pkg.Install": "PKGをインストール…", + "Library.Pkg.Heading": "{0} をインストール中", + "Library.Pkg.Explanation": "偽のPKGをゲームフォルダーに展開します。SharpEmu は他のゲームと同じように実行できます。大きなパッケージは時間がかかり、ゲーム全体のための空きディスク容量が必要です。", + "Library.Pkg.Preparing": "パッケージを読み込み中…", + "Library.Pkg.Progress": "{0} / {1} GB({2}%)", + "Library.Pkg.Cancelling": "キャンセル中…", + "Library.Pkg.Failed": "インストールに失敗しました: {0}", + "Library.Pkg.SkippedNotGame": "{0} をスキップしました: パッチと DLC のパッケージにはまだ対応していません({1})。", + "Library.Pkg.AlreadyInstalled": "{0} をスキップしました: {1} にインストール済みです。", + "Library.Pkg.ConfirmTitle": "PKGファイルをインストールしますか?", + "Library.Pkg.ConfirmMessage": "このフォルダーに PKG ファイルが {0} 個見つかりました。今すぐインストールしますか? {1} GB の空き容量が必要です。", + "Library.Pkg.ConfirmInstall": "インストール", + "Library.Pkg.ConfirmSkip": "今はしない", + "Dialog.OpenPkg": "インストールする PKG を選択", + "Dialog.PkgFiles": "PS4/PS5 パッケージ", + "Dialog.ChoosePkgInstallFolder": "ゲームのインストール先を選択", "Hero.GameSettings": "ゲーム設定", "Hero.Console": "コンソール", "Hint.LibraryMenu": "ライブラリメニュー", @@ -369,6 +385,34 @@ "Trophies.Sort.Name": "A–Z", "Trophies.SearchWatermark": "ゲームを検索", "Trophies.NoMatch": "検索に一致するゲームはありません。", + "Overlay.SaveData.Title": "セーブデータ", + "Overlay.SaveData.Caption.Load": "ロードするセーブデータを選んでください。", + "Overlay.SaveData.Caption.Save": "セーブする場所を選んでください。", + "Overlay.SaveData.Caption.Delete": "削除するセーブデータを選んでください。", + "Overlay.SaveData.Caption.Other": "セーブデータを選んでください。", + "Overlay.SaveData.Select": "決定", + "Overlay.SaveData.Back": "戻る", + "Overlay.SaveData.Move": "移動", + "Overlay.SaveData.Delete": "削除", + "Overlay.SaveData.Cancel": "キャンセル", + "Overlay.SaveData.NewItem": "新しいセーブデータ", + "Overlay.SaveData.NewItemDetail": "空いているスロットに新しくセーブします。", + "Overlay.SaveData.LastSaved": "最終セーブ", + "Overlay.SaveData.Size": "サイズ", + "Overlay.SaveData.ConfirmDelete": "このセーブデータを削除しますか?", + "Overlay.SaveData.ConfirmDeleteNote": "削除したセーブデータは元に戻せません。", + "Overlay.SaveData.InUse": "このセーブデータは使用中のため削除できません。", + "Overlay.Ime.Title": "テキストを入力", + "Overlay.Ime.Done": "決定", + "Overlay.Ime.Send": "送信", + "Overlay.Ime.Search": "検索", + "Overlay.Ime.Go": "移動", + "Overlay.Ime.Close": "閉じる", + "Overlay.Ime.Delete": "削除", + "Overlay.Ime.Space": "スペース", + "Overlay.Ime.Cursor": "カーソル", + "Overlay.Ime.Select": "選択", + "Overlay.Ime.Type": "キーボードで入力", "Library.Context.Patches": "パッチ", "Library.Patches.Empty": "このゲームバージョンに対応するパッチが見つかりません", "Library.Patches.OpenFolder": "パッチフォルダーを開く", diff --git a/src/SharpEmu.Application/Languages/ko.json b/src/SharpEmu.Application/Languages/ko.json index 6843e66df..e3e741bc8 100644 --- a/src/SharpEmu.Application/Languages/ko.json +++ b/src/SharpEmu.Application/Languages/ko.json @@ -97,6 +97,22 @@ "LibraryMenu.Volume": "볼륨", "LibraryMenu.AddGames": "게임 추가", "LibraryMenu.AddFolder": "폴더 추가…", + "Library.Pkg.Install": "PKG 설치…", + "Library.Pkg.Heading": "{0} 설치 중", + "Library.Pkg.Explanation": "가짜 PKG를 게임 폴더에 풀어 SharpEmu가 다른 게임과 똑같이 실행할 수 있게 합니다. 큰 패키지는 시간이 걸리며 게임 전체를 위한 여유 디스크 공간이 필요합니다.", + "Library.Pkg.Preparing": "패키지 읽는 중…", + "Library.Pkg.Progress": "{0} / {1} GB ({2}%)", + "Library.Pkg.Cancelling": "취소 중…", + "Library.Pkg.Failed": "설치 실패: {0}", + "Library.Pkg.SkippedNotGame": "{0} 건너뜀: 패치 및 DLC 패키지는 아직 지원되지 않습니다({1}).", + "Library.Pkg.AlreadyInstalled": "{0} 건너뜀: 이미 {1}에 설치되어 있습니다.", + "Library.Pkg.ConfirmTitle": "PKG 파일을 설치할까요?", + "Library.Pkg.ConfirmMessage": "이 폴더에서 PKG 파일 {0}개를 찾았습니다. 지금 설치할까요? {1} GB의 여유 공간이 필요합니다.", + "Library.Pkg.ConfirmInstall": "설치", + "Library.Pkg.ConfirmSkip": "나중에", + "Dialog.OpenPkg": "설치할 PKG 선택", + "Dialog.PkgFiles": "PS4/PS5 패키지", + "Dialog.ChoosePkgInstallFolder": "게임을 설치할 위치 선택", "Hero.GameSettings": "게임 설정", "Hero.Console": "콘솔", "Hint.LibraryMenu": "라이브러리 메뉴", @@ -369,6 +385,34 @@ "Trophies.Sort.Name": "A–Z", "Trophies.SearchWatermark": "게임 검색", "Trophies.NoMatch": "검색과 일치하는 게임이 없습니다.", + "Overlay.SaveData.Title": "저장 데이터", + "Overlay.SaveData.Caption.Load": "불러올 저장 데이터를 선택하세요.", + "Overlay.SaveData.Caption.Save": "저장할 위치를 선택하세요.", + "Overlay.SaveData.Caption.Delete": "삭제할 저장 데이터를 선택하세요.", + "Overlay.SaveData.Caption.Other": "저장 데이터를 선택하세요.", + "Overlay.SaveData.Select": "선택", + "Overlay.SaveData.Back": "뒤로", + "Overlay.SaveData.Move": "이동", + "Overlay.SaveData.Delete": "삭제", + "Overlay.SaveData.Cancel": "취소", + "Overlay.SaveData.NewItem": "새 저장 데이터", + "Overlay.SaveData.NewItemDetail": "빈 슬롯에 새로 저장합니다.", + "Overlay.SaveData.LastSaved": "마지막 저장", + "Overlay.SaveData.Size": "크기", + "Overlay.SaveData.ConfirmDelete": "이 저장 데이터를 삭제하시겠습니까?", + "Overlay.SaveData.ConfirmDeleteNote": "삭제한 저장 데이터는 복원할 수 없습니다.", + "Overlay.SaveData.InUse": "이 저장 데이터는 사용 중이어서 삭제할 수 없습니다.", + "Overlay.Ime.Title": "텍스트 입력", + "Overlay.Ime.Done": "완료", + "Overlay.Ime.Send": "보내기", + "Overlay.Ime.Search": "검색", + "Overlay.Ime.Go": "이동", + "Overlay.Ime.Close": "닫기", + "Overlay.Ime.Delete": "삭제", + "Overlay.Ime.Space": "스페이스", + "Overlay.Ime.Cursor": "커서", + "Overlay.Ime.Select": "선택", + "Overlay.Ime.Type": "키보드로 입력하세요", "Library.Context.Patches": "패치", "Library.Patches.Empty": "이 게임 버전에 맞는 패치를 찾을 수 없습니다", "Library.Patches.OpenFolder": "패치 폴더 열기", diff --git a/src/SharpEmu.Application/Languages/nl.json b/src/SharpEmu.Application/Languages/nl.json index 1d92748f1..c6145ec21 100644 --- a/src/SharpEmu.Application/Languages/nl.json +++ b/src/SharpEmu.Application/Languages/nl.json @@ -97,6 +97,22 @@ "LibraryMenu.Volume": "Volume", "LibraryMenu.AddGames": "Games toevoegen", "LibraryMenu.AddFolder": "Map toevoegen…", + "Library.Pkg.Install": "PKG installeren…", + "Library.Pkg.Heading": "{0} wordt geïnstalleerd", + "Library.Pkg.Explanation": "Hiermee wordt de nep-PKG uitgepakt in een gamemap die SharpEmu net als elke andere uitvoert. Grote pakketten duren even en hebben vrije schijfruimte nodig voor de hele game.", + "Library.Pkg.Preparing": "Pakket lezen…", + "Library.Pkg.Progress": "{0} / {1} GB ({2}%)", + "Library.Pkg.Cancelling": "Annuleren…", + "Library.Pkg.Failed": "Installeren mislukt: {0}", + "Library.Pkg.SkippedNotGame": "{0} overgeslagen: patch- en DLC-pakketten worden nog niet ondersteund ({1}).", + "Library.Pkg.AlreadyInstalled": "{0} overgeslagen: al geïnstalleerd in {1}.", + "Library.Pkg.ConfirmTitle": "PKG-bestanden installeren?", + "Library.Pkg.ConfirmMessage": "{0} PKG-bestand(en) gevonden in deze map. Nu installeren? Hiervoor is {1} GB vrije ruimte nodig.", + "Library.Pkg.ConfirmInstall": "Installeren", + "Library.Pkg.ConfirmSkip": "Niet nu", + "Dialog.OpenPkg": "Kies een PKG om te installeren", + "Dialog.PkgFiles": "PS4/PS5-pakketten", + "Dialog.ChoosePkgInstallFolder": "Kies waar de game moet worden geïnstalleerd", "Hero.GameSettings": "Game-instellingen", "Hero.Console": "Console", "Hint.LibraryMenu": "Bibliotheekmenu", @@ -369,6 +385,34 @@ "Trophies.Sort.Name": "A–Z", "Trophies.SearchWatermark": "Games zoeken", "Trophies.NoMatch": "Geen game komt overeen met je zoekopdracht.", + "Overlay.SaveData.Title": "Opgeslagen gegevens", + "Overlay.SaveData.Caption.Load": "Selecteer de opgeslagen gegevens om te laden.", + "Overlay.SaveData.Caption.Save": "Selecteer waar je wilt opslaan.", + "Overlay.SaveData.Caption.Delete": "Selecteer de opgeslagen gegevens om te verwijderen.", + "Overlay.SaveData.Caption.Other": "Selecteer opgeslagen gegevens.", + "Overlay.SaveData.Select": "Selecteren", + "Overlay.SaveData.Back": "Terug", + "Overlay.SaveData.Move": "Navigeren", + "Overlay.SaveData.Delete": "Verwijderen", + "Overlay.SaveData.Cancel": "Annuleren", + "Overlay.SaveData.NewItem": "Nieuwe opgeslagen gegevens", + "Overlay.SaveData.NewItemDetail": "Maak een nieuwe opslag op een lege plek.", + "Overlay.SaveData.LastSaved": "Laatst opgeslagen", + "Overlay.SaveData.Size": "Grootte", + "Overlay.SaveData.ConfirmDelete": "Deze opgeslagen gegevens verwijderen?", + "Overlay.SaveData.ConfirmDeleteNote": "Verwijderde opgeslagen gegevens kunnen niet worden hersteld.", + "Overlay.SaveData.InUse": "Deze opgeslagen gegevens zijn in gebruik en kunnen niet worden verwijderd.", + "Overlay.Ime.Title": "Tekst invoeren", + "Overlay.Ime.Done": "Gereed", + "Overlay.Ime.Send": "Verzenden", + "Overlay.Ime.Search": "Zoeken", + "Overlay.Ime.Go": "Ga", + "Overlay.Ime.Close": "Sluiten", + "Overlay.Ime.Delete": "Verwijderen", + "Overlay.Ime.Space": "Spatie", + "Overlay.Ime.Cursor": "Cursor", + "Overlay.Ime.Select": "Selecteren", + "Overlay.Ime.Type": "Typ met je toetsenbord", "Library.Context.Patches": "Patches", "Library.Patches.Empty": "Geen patches gevonden voor deze spelversie", "Library.Patches.OpenFolder": "Patchmap openen", diff --git a/src/SharpEmu.Application/Languages/pl.json b/src/SharpEmu.Application/Languages/pl.json index b99336095..a9b24494a 100644 --- a/src/SharpEmu.Application/Languages/pl.json +++ b/src/SharpEmu.Application/Languages/pl.json @@ -97,6 +97,22 @@ "LibraryMenu.Volume": "Głośność", "LibraryMenu.AddGames": "Dodaj gry", "LibraryMenu.AddFolder": "Dodaj folder…", + "Library.Pkg.Install": "Zainstaluj PKG…", + "Library.Pkg.Heading": "Instalowanie {0}", + "Library.Pkg.Explanation": "To rozpakowuje fałszywy PKG do folderu z grą, który SharpEmu uruchamia jak każdy inny. Duże pakiety trwają dłużej i wymagają wolnego miejsca na dysku na całą grę.", + "Library.Pkg.Preparing": "Odczytywanie pakietu…", + "Library.Pkg.Progress": "{0} / {1} GB ({2}%)", + "Library.Pkg.Cancelling": "Anulowanie…", + "Library.Pkg.Failed": "Instalacja nie powiodła się: {0}", + "Library.Pkg.SkippedNotGame": "Pominięto {0}: pakiety poprawek i DLC nie są jeszcze obsługiwane ({1}).", + "Library.Pkg.AlreadyInstalled": "Pominięto {0}: już zainstalowano w {1}.", + "Library.Pkg.ConfirmTitle": "Zainstalować pliki PKG?", + "Library.Pkg.ConfirmMessage": "Znaleziono plików PKG w tym folderze: {0}. Zainstalować je teraz? Wymaga to {1} GB wolnego miejsca.", + "Library.Pkg.ConfirmInstall": "Zainstaluj", + "Library.Pkg.ConfirmSkip": "Nie teraz", + "Dialog.OpenPkg": "Wybierz PKG do zainstalowania", + "Dialog.PkgFiles": "Pakiety PS4/PS5", + "Dialog.ChoosePkgInstallFolder": "Wybierz, gdzie zainstalować grę", "Hero.GameSettings": "Ustawienia gry", "Hero.Console": "Konsola", "Hint.LibraryMenu": "Menu biblioteki", @@ -371,6 +387,34 @@ "Trophies.Sort.Name": "A–Z", "Trophies.SearchWatermark": "Szukaj gier", "Trophies.NoMatch": "Żadna gra nie pasuje do wyszukiwania.", + "Overlay.SaveData.Title": "Zapisane dane", + "Overlay.SaveData.Caption.Load": "Wybierz zapisane dane do wczytania.", + "Overlay.SaveData.Caption.Save": "Wybierz miejsce zapisu.", + "Overlay.SaveData.Caption.Delete": "Wybierz zapisane dane do usunięcia.", + "Overlay.SaveData.Caption.Other": "Wybierz zapisane dane.", + "Overlay.SaveData.Select": "Wybierz", + "Overlay.SaveData.Back": "Wstecz", + "Overlay.SaveData.Move": "Nawigacja", + "Overlay.SaveData.Delete": "Usuń", + "Overlay.SaveData.Cancel": "Anuluj", + "Overlay.SaveData.NewItem": "Nowe zapisane dane", + "Overlay.SaveData.NewItemDetail": "Utwórz nowy zapis w wolnym miejscu.", + "Overlay.SaveData.LastSaved": "Ostatni zapis", + "Overlay.SaveData.Size": "Rozmiar", + "Overlay.SaveData.ConfirmDelete": "Usunąć te zapisane dane?", + "Overlay.SaveData.ConfirmDeleteNote": "Usuniętych zapisanych danych nie można przywrócić.", + "Overlay.SaveData.InUse": "Te zapisane dane są w użyciu i nie można ich usunąć.", + "Overlay.Ime.Title": "Wprowadź tekst", + "Overlay.Ime.Done": "Gotowe", + "Overlay.Ime.Send": "Wyślij", + "Overlay.Ime.Search": "Szukaj", + "Overlay.Ime.Go": "Przejdź", + "Overlay.Ime.Close": "Zamknij", + "Overlay.Ime.Delete": "Usuń", + "Overlay.Ime.Space": "Spacja", + "Overlay.Ime.Cursor": "Kursor", + "Overlay.Ime.Select": "Wybierz", + "Overlay.Ime.Type": "Pisz na klawiaturze", "Library.Context.Patches": "Łatki", "Library.Patches.Empty": "Nie znaleziono łatek dla tej wersji gry", "Library.Patches.OpenFolder": "Otwórz folder łatek", diff --git a/src/SharpEmu.Application/Languages/pt.json b/src/SharpEmu.Application/Languages/pt.json index 5e5759523..30a1b91ae 100644 --- a/src/SharpEmu.Application/Languages/pt.json +++ b/src/SharpEmu.Application/Languages/pt.json @@ -97,6 +97,22 @@ "LibraryMenu.Volume": "Volume", "LibraryMenu.AddGames": "Adicionar jogos", "LibraryMenu.AddFolder": "Adicionar pasta…", + "Library.Pkg.Install": "Instalar PKG…", + "Library.Pkg.Heading": "A instalar {0}", + "Library.Pkg.Explanation": "Isto extrai o PKG falso para uma pasta de jogo que o SharpEmu executa como qualquer outra. Pacotes grandes demoram e precisam de espaço livre em disco para o jogo todo.", + "Library.Pkg.Preparing": "A ler o pacote…", + "Library.Pkg.Progress": "{0} / {1} GB ({2}%)", + "Library.Pkg.Cancelling": "A cancelar…", + "Library.Pkg.Failed": "Falha na instalação: {0}", + "Library.Pkg.SkippedNotGame": "{0} ignorado: os pacotes de patches e DLC ainda não são suportados ({1}).", + "Library.Pkg.AlreadyInstalled": "{0} ignorado: já instalado em {1}.", + "Library.Pkg.ConfirmTitle": "Instalar ficheiros PKG?", + "Library.Pkg.ConfirmMessage": "Foram encontrados {0} ficheiro(s) PKG nesta pasta. Instalar agora? Isto requer {1} GB de espaço livre.", + "Library.Pkg.ConfirmInstall": "Instalar", + "Library.Pkg.ConfirmSkip": "Agora não", + "Dialog.OpenPkg": "Escolha um PKG para instalar", + "Dialog.PkgFiles": "Pacotes de PS4/PS5", + "Dialog.ChoosePkgInstallFolder": "Escolha onde instalar o jogo", "Hero.GameSettings": "Definições do jogo", "Hero.Console": "Consola", "Hint.LibraryMenu": "Menu da biblioteca", @@ -369,6 +385,34 @@ "Trophies.Sort.Name": "A–Z", "Trophies.SearchWatermark": "Pesquisar jogos", "Trophies.NoMatch": "Nenhum jogo corresponde à tua pesquisa.", + "Overlay.SaveData.Title": "Dados guardados", + "Overlay.SaveData.Caption.Load": "Selecione os dados guardados a carregar.", + "Overlay.SaveData.Caption.Save": "Selecione onde guardar.", + "Overlay.SaveData.Caption.Delete": "Selecione os dados guardados a eliminar.", + "Overlay.SaveData.Caption.Other": "Selecione dados guardados.", + "Overlay.SaveData.Select": "Selecionar", + "Overlay.SaveData.Back": "Voltar", + "Overlay.SaveData.Move": "Mover", + "Overlay.SaveData.Delete": "Eliminar", + "Overlay.SaveData.Cancel": "Cancelar", + "Overlay.SaveData.NewItem": "Novos dados guardados", + "Overlay.SaveData.NewItemDetail": "Crie um novo jogo guardado num espaço livre.", + "Overlay.SaveData.LastSaved": "Última gravação", + "Overlay.SaveData.Size": "Tamanho", + "Overlay.SaveData.ConfirmDelete": "Eliminar estes dados guardados?", + "Overlay.SaveData.ConfirmDeleteNote": "Os dados guardados eliminados não podem ser recuperados.", + "Overlay.SaveData.InUse": "Estes dados guardados estão a ser utilizados e não podem ser eliminados.", + "Overlay.Ime.Title": "Introduzir texto", + "Overlay.Ime.Done": "Concluído", + "Overlay.Ime.Send": "Enviar", + "Overlay.Ime.Search": "Pesquisar", + "Overlay.Ime.Go": "Ir", + "Overlay.Ime.Close": "Fechar", + "Overlay.Ime.Delete": "Eliminar", + "Overlay.Ime.Space": "Espaço", + "Overlay.Ime.Cursor": "Cursor", + "Overlay.Ime.Select": "Selecionar", + "Overlay.Ime.Type": "Escreva com o teclado", "Library.Context.Patches": "Patches", "Library.Patches.Empty": "Não foram encontrados patches para esta versão do jogo", "Library.Patches.OpenFolder": "Abrir pasta de patches", diff --git a/src/SharpEmu.Application/Languages/ru.json b/src/SharpEmu.Application/Languages/ru.json index 4a3f64dcc..21b67888f 100644 --- a/src/SharpEmu.Application/Languages/ru.json +++ b/src/SharpEmu.Application/Languages/ru.json @@ -97,6 +97,22 @@ "LibraryMenu.Volume": "Громкость", "LibraryMenu.AddGames": "Добавить игры", "LibraryMenu.AddFolder": "Добавить папку…", + "Library.Pkg.Install": "Установить PKG…", + "Library.Pkg.Heading": "Установка {0}", + "Library.Pkg.Explanation": "Поддельный PKG будет распакован в папку игры, которую SharpEmu запускает как любую другую. Большие пакеты распаковываются долго и требуют свободного места на диске для всей игры.", + "Library.Pkg.Preparing": "Чтение пакета…", + "Library.Pkg.Progress": "{0} / {1} ГБ ({2}%)", + "Library.Pkg.Cancelling": "Отмена…", + "Library.Pkg.Failed": "Не удалось установить: {0}", + "Library.Pkg.SkippedNotGame": "{0} пропущен: пакеты патчей и DLC пока не поддерживаются ({1}).", + "Library.Pkg.AlreadyInstalled": "{0} пропущен: уже установлен в {1}.", + "Library.Pkg.ConfirmTitle": "Установить файлы PKG?", + "Library.Pkg.ConfirmMessage": "В этой папке найдено файлов PKG: {0}. Установить их сейчас? Потребуется {1} ГБ свободного места.", + "Library.Pkg.ConfirmInstall": "Установить", + "Library.Pkg.ConfirmSkip": "Не сейчас", + "Dialog.OpenPkg": "Выберите PKG для установки", + "Dialog.PkgFiles": "Пакеты PS4/PS5", + "Dialog.ChoosePkgInstallFolder": "Выберите, куда установить игру", "Hero.GameSettings": "Настройки игры", "Hero.Console": "Консоль", "Hint.LibraryMenu": "Меню библиотеки", @@ -369,6 +385,34 @@ "Trophies.Sort.Name": "А–Я", "Trophies.SearchWatermark": "Поиск игр", "Trophies.NoMatch": "Ни одна игра не соответствует запросу.", + "Overlay.SaveData.Title": "Сохраненные данные", + "Overlay.SaveData.Caption.Load": "Выберите сохраненные данные для загрузки.", + "Overlay.SaveData.Caption.Save": "Выберите, куда сохранить.", + "Overlay.SaveData.Caption.Delete": "Выберите сохраненные данные для удаления.", + "Overlay.SaveData.Caption.Other": "Выберите сохраненные данные.", + "Overlay.SaveData.Select": "Выбрать", + "Overlay.SaveData.Back": "Назад", + "Overlay.SaveData.Move": "Перемещение", + "Overlay.SaveData.Delete": "Удалить", + "Overlay.SaveData.Cancel": "Отмена", + "Overlay.SaveData.NewItem": "Новые сохраненные данные", + "Overlay.SaveData.NewItemDetail": "Создать новое сохранение в свободном слоте.", + "Overlay.SaveData.LastSaved": "Последнее сохранение", + "Overlay.SaveData.Size": "Размер", + "Overlay.SaveData.ConfirmDelete": "Удалить эти сохраненные данные?", + "Overlay.SaveData.ConfirmDeleteNote": "Удаленные сохраненные данные нельзя восстановить.", + "Overlay.SaveData.InUse": "Эти сохраненные данные используются, их нельзя удалить.", + "Overlay.Ime.Title": "Введите текст", + "Overlay.Ime.Done": "Готово", + "Overlay.Ime.Send": "Отправить", + "Overlay.Ime.Search": "Поиск", + "Overlay.Ime.Go": "Перейти", + "Overlay.Ime.Close": "Закрыть", + "Overlay.Ime.Delete": "Удалить", + "Overlay.Ime.Space": "Пробел", + "Overlay.Ime.Cursor": "Курсор", + "Overlay.Ime.Select": "Выбрать", + "Overlay.Ime.Type": "Печатайте на клавиатуре", "Library.Context.Patches": "Патчи", "Library.Patches.Empty": "Патчи для этой версии игры не найдены", "Library.Patches.OpenFolder": "Открыть папку патчей", diff --git a/src/SharpEmu.Application/Languages/tr.json b/src/SharpEmu.Application/Languages/tr.json index a92364ce9..a857545d6 100644 --- a/src/SharpEmu.Application/Languages/tr.json +++ b/src/SharpEmu.Application/Languages/tr.json @@ -97,6 +97,22 @@ "LibraryMenu.Volume": "Ses düzeyi", "LibraryMenu.AddGames": "Oyun ekle", "LibraryMenu.AddFolder": "Klasör ekle…", + "Library.Pkg.Install": "PKG yükle…", + "Library.Pkg.Heading": "{0} yükleniyor", + "Library.Pkg.Explanation": "Bu işlem sahte PKG'yi, SharpEmu'nun diğerleri gibi çalıştırdığı bir oyun klasörüne açar. Büyük paketler zaman alır ve tüm oyun için boş disk alanı gerektirir.", + "Library.Pkg.Preparing": "Paket okunuyor…", + "Library.Pkg.Progress": "{0} / {1} GB (%{2})", + "Library.Pkg.Cancelling": "İptal ediliyor…", + "Library.Pkg.Failed": "Yükleme başarısız oldu: {0}", + "Library.Pkg.SkippedNotGame": "{0} atlandı: yama ve DLC paketleri henüz desteklenmiyor ({1}).", + "Library.Pkg.AlreadyInstalled": "{0} atlandı: zaten {1} içinde yüklü.", + "Library.Pkg.ConfirmTitle": "PKG dosyaları yüklensin mi?", + "Library.Pkg.ConfirmMessage": "Bu klasörde {0} PKG dosyası bulundu. Şimdi yüklensin mi? Bunun için {1} GB boş alan gerekir.", + "Library.Pkg.ConfirmInstall": "Yükle", + "Library.Pkg.ConfirmSkip": "Şimdi değil", + "Dialog.OpenPkg": "Yüklenecek PKG'yi seç", + "Dialog.PkgFiles": "PS4/PS5 paketleri", + "Dialog.ChoosePkgInstallFolder": "Oyunun yükleneceği yeri seç", "Hero.GameSettings": "Oyun ayarları", "Hero.Console": "Konsol", "Hint.LibraryMenu": "Kütüphane menüsü", @@ -371,6 +387,34 @@ "Trophies.Sort.Name": "A–Z", "Trophies.SearchWatermark": "Oyun ara", "Trophies.NoMatch": "Aramanızla eşleşen oyun yok.", + "Overlay.SaveData.Title": "Kayıtlı Veriler", + "Overlay.SaveData.Caption.Load": "Yüklenecek kayıtlı veriyi seçin.", + "Overlay.SaveData.Caption.Save": "Kaydedilecek yeri seçin.", + "Overlay.SaveData.Caption.Delete": "Silinecek kayıtlı veriyi seçin.", + "Overlay.SaveData.Caption.Other": "Kayıtlı veri seçin.", + "Overlay.SaveData.Select": "Seç", + "Overlay.SaveData.Back": "Geri", + "Overlay.SaveData.Move": "Gezin", + "Overlay.SaveData.Delete": "Sil", + "Overlay.SaveData.Cancel": "İptal", + "Overlay.SaveData.NewItem": "Yeni Kayıtlı Veri", + "Overlay.SaveData.NewItemDetail": "Boş bir yuvada yeni kayıt oluşturun.", + "Overlay.SaveData.LastSaved": "Son kayıt", + "Overlay.SaveData.Size": "Boyut", + "Overlay.SaveData.ConfirmDelete": "Bu kayıtlı veri silinsin mi?", + "Overlay.SaveData.ConfirmDeleteNote": "Silinen kayıtlı veriler geri getirilemez.", + "Overlay.SaveData.InUse": "Bu kayıtlı veri kullanımda olduğu için silinemiyor.", + "Overlay.Ime.Title": "Metin girin", + "Overlay.Ime.Done": "Bitti", + "Overlay.Ime.Send": "Gönder", + "Overlay.Ime.Search": "Ara", + "Overlay.Ime.Go": "Git", + "Overlay.Ime.Close": "Kapat", + "Overlay.Ime.Delete": "Sil", + "Overlay.Ime.Space": "Boşluk", + "Overlay.Ime.Cursor": "İmleç", + "Overlay.Ime.Select": "Seç", + "Overlay.Ime.Type": "Klavyenizle yazın", "Library.Context.Patches": "Yamalar", "Library.Patches.Empty": "Bu oyun sürümü için yama bulunamadı", "Library.Patches.OpenFolder": "Yama klasörünü aç", diff --git a/src/SharpEmu.Application/Languages/zh.json b/src/SharpEmu.Application/Languages/zh.json index d9fdf003f..2c12c95e8 100644 --- a/src/SharpEmu.Application/Languages/zh.json +++ b/src/SharpEmu.Application/Languages/zh.json @@ -76,13 +76,11 @@ "Overlay.Widget.Add.Desc": "在性能显示上再放一个组件。在游戏中用 F3 移动并调整大小。", "Overlay.Widget.Add.Button": "添加", "Overlay.Group.WidgetSettings": "{0}设置", - "Page.Library": "游戏库", "Page.Options": "设置", "Page.Trophies": "奖杯", "Page.GameCount.One": "1 个游戏", "Page.GameCount.Other": "{0} 个游戏", - "Library.SearchWatermark": "搜索游戏库…", "Library.Versions.Title": "选择版本", "Library.Versions.Description": "已安装多个版本。请选择一个版本以继续。", @@ -94,7 +92,6 @@ "Library.OpenFile": "打开文件…", "Library.View.Grid": "堆叠视图", "Library.View.Carousel": "横排视图", - "Library.Context.Launch": "启动", "Library.Context.Patches": "补丁", "Library.Patches.Empty": "未找到适用于此游戏版本的补丁", @@ -132,7 +129,6 @@ "Library.Context.GameSettings": "游戏设置…", "Library.Context.Remove": "从游戏库中移除", "Library.Context.PackZar": "打包为 .zar…", - "Library.Pack.Title": "打包为 .zar", "Library.Pack.Heading": "正在打包 {0}", "Library.Pack.Explanation": "这会将整个游戏文件夹存储为单个压缩的 .zar 文件。SharpEmu 可直接从中运行游戏而无需解包,通常占用更少的磁盘空间,游戏表现相同。游戏文件夹会被保留;归档写入并校验完成后,您可以选择将其删除。", @@ -150,24 +146,20 @@ "Library.Pack.DoneDeleted": "完成。归档已就绪,游戏文件夹已删除。", "Library.Pack.DeleteSkipped": "完成。由于无法确认归档包含全部文件,游戏文件夹已保留。", "Library.Pack.DeleteFailed": "归档已就绪,但删除游戏文件夹失败:{0}", - "Library.Empty.Title": "您的游戏库是空的", "Library.Empty.Hint": "添加包含游戏的文件夹即可开始使用。", "Library.Empty.SearchTitle": "没有符合搜索条件的游戏", "Library.Empty.SearchHint": "游戏库中没有与“{0}”匹配的内容。", "Library.Empty.AddFolder": "+ 添加游戏文件夹", - "Library.Loading": "正在加载游戏库…", "Library.ScanningFolder": "正在扫描文件夹…", "Library.Stat.Version": "版本", "Library.Stat.Installed": "安装时间", "Library.Stat.TitleId": "标题 ID", "Common.Back": "返回", - "Library.Music.Volume": "标题音乐音量", "Library.Music.Mute": "静音标题音乐", "Library.Music.Unmute": "取消静音标题音乐", - "Options.General": "常规", "Options.Logging": "日志", "Options.Env.Tab": "环境", @@ -193,10 +185,8 @@ "Options.Section.Launcher": "启动器", "Options.Section.Display": "显示", "Options.Graphics": "图形", - "Options.Console.Language.Label": "主机语言", "Options.Console.Language.Desc": "向游戏报告的系统语言。", - "Options.WindowMode.Label": "窗口模式", "Options.WindowMode.Desc": "普通窗口、桌面无边框或独占全屏。", "Options.WindowMode.Windowed": "窗口化", @@ -233,11 +223,8 @@ "Options.Env.BinkPlayback.Host": "主机 (FFmpeg)", "Options.Env.BinkPlayback.Guest": "游戏", "Options.Env.BinkPlayback.Skip": "跳过", - - "Options.Strict.Label": "严格动态库解析", "Options.Strict.Desc": "当导入符号无法解析时,使启动失败。", - "Options.LogLevel.Label": "日志级别", "Options.LogLevel.Desc": "模拟器控制台输出的详细程度。", "Options.LogLevel.Trace": "跟踪", @@ -246,37 +233,27 @@ "Options.LogLevel.Warning": "警告", "Options.LogLevel.Error": "错误", "Options.LogLevel.Critical": "严重", - "Options.TraceImports.Label": "导入跟踪上限", "Options.TraceImports.Desc": "跟踪每个模块的前 N 个导入(0 = 关闭)。", - "Options.CrashDump.Label": "崩溃转储", "Options.CrashDump.Desc": "将崩溃转储保存在运行日志旁(仅限 Windows x64)。转储文件可能很大,并包含隐私数据。", "Options.LogToFile.Label": "记录到文件", "Options.LogToFile.Desc": "将模拟器输出同步写入日志文件。", - "Options.LogFilePath.Label": "日志文件路径", "Options.LogFilePath.Default": "未设置自定义路径 — 日志保存在模拟器旁的 user/logs 中。", "Options.LogFilePath.Select": "选择…", - "Options.OverrideLogFile.Label": "覆盖日志文件", "Options.OverrideLogFile.Desc": "使用确切的文件路径,而不是追加标题 ID 和时间戳。", - "Options.TitleMusic.Label": "标题音乐", "Options.TitleMusic.Desc": "在游戏库中循环播放所选游戏的预览音乐。", - "Options.Discord.Label": "Discord 状态", "Options.Discord.Desc": "在您的 Discord 个人资料中显示正在运行的游戏。", - "Options.Language.Label": "模拟器语言", "Options.Language.Desc": "启动器全局使用的语言。立即生效。", - "Common.On": "开", "Common.Off": "关", "Common.Save": "保存", "Common.Cancel": "取消", - - "Console.Title": "控制台", "Console.SearchWatermark": "搜索...", "Console.AutoScroll": "自动滚动", @@ -284,7 +261,6 @@ "Console.Copy": "复制", "Console.Clear": "清除", "Console.WindowTitle": "SharpEmu 控制台", - "Launch.NoGameSelected": "未选择游戏", "Launch.NoGameHint": "从游戏库中选择一个游戏,或直接打开 eboot.bin。", "Launch.Idle": "空闲", @@ -303,14 +279,12 @@ "Launch.Command": "$ SharpEmu {0}", "Launch.StartFailed": "无法启动模拟器:{0}", "Launch.ProcessExited": "进程已退出,退出码 {0}({1})。", - "Exit.Ok": "正常", "Exit.InvalidArguments": "参数无效", "Exit.EbootNotFound": "未找到 eboot", "Exit.RuntimeException": "运行时异常", "Exit.EmulationError": "模拟错误", "Exit.Unknown": "未知", - "Status.EmulatorLocating": "模拟器:正在查找…", "Status.EmulatorPath": "模拟器:{0}", "Status.EmulatorNotFound": "模拟器:未找到 SharpEmu 可执行文件 — 请先构建 SharpEmu.CLI。", @@ -324,13 +298,10 @@ "Status.Running": "正在运行 {0}", "Status.Stopping": "正在停止…", "Status.Idle": "空闲", - "Clipboard.Path": "路径", "Clipboard.TitleId": "标题 ID", - "Discord.Playing": "正在玩 {0}", "Discord.Browsing": "正在浏览游戏库", - "Dialog.ChooseGameFolder": "选择包含游戏的文件夹", "Dialog.OpenExecutable": "打开要启动的可执行文件", "Dialog.PsExecutables": "PS 可执行文件", @@ -339,7 +310,6 @@ "Dialog.LogFiles": "日志文件", "Dialog.SaveZar": "保存游戏归档", "Dialog.ZarFiles": "游戏归档", - "Options.About": "关于", "About.Github.Label": "GitHub", "About.Github.Desc": "源代码、问题反馈和项目开发。", @@ -349,7 +319,6 @@ "About.Discord.Desc": "加入社区,获取支持并关注开发动态。", "About.GithubButton": "在 GitHub 上参与贡献!", "About.DiscordButton": "加入我们的 Discord!", - "Updater.Auto.Label": "启动时检查更新", "Updater.Auto.Desc": "检查 GitHub,不会延迟启动。", "Updater.Label": "更新", @@ -402,6 +371,34 @@ "Trophies.Sort.Name": "名称", "Trophies.SearchWatermark": "搜索游戏", "Trophies.NoMatch": "没有符合搜索条件的游戏。", + "Overlay.SaveData.Title": "保存数据", + "Overlay.SaveData.Caption.Load": "请选择要读取的保存数据。", + "Overlay.SaveData.Caption.Save": "请选择保存位置。", + "Overlay.SaveData.Caption.Delete": "请选择要删除的保存数据。", + "Overlay.SaveData.Caption.Other": "请选择保存数据。", + "Overlay.SaveData.Select": "确定", + "Overlay.SaveData.Back": "返回", + "Overlay.SaveData.Move": "移动", + "Overlay.SaveData.Delete": "删除", + "Overlay.SaveData.Cancel": "取消", + "Overlay.SaveData.NewItem": "新建保存数据", + "Overlay.SaveData.NewItemDetail": "在空栏位中创建新的存档。", + "Overlay.SaveData.LastSaved": "最后保存", + "Overlay.SaveData.Size": "大小", + "Overlay.SaveData.ConfirmDelete": "要删除此保存数据吗?", + "Overlay.SaveData.ConfirmDeleteNote": "删除的保存数据无法恢复。", + "Overlay.SaveData.InUse": "此保存数据正在使用中,无法删除。", + "Overlay.Ime.Title": "输入文本", + "Overlay.Ime.Done": "完成", + "Overlay.Ime.Send": "发送", + "Overlay.Ime.Search": "搜索", + "Overlay.Ime.Go": "前往", + "Overlay.Ime.Close": "关闭", + "Overlay.Ime.Delete": "删除", + "Overlay.Ime.Space": "空格", + "Overlay.Ime.Cursor": "光标", + "Overlay.Ime.Select": "选择", + "Overlay.Ime.Type": "使用键盘输入", "LibraryMenu.Library": "游戏库", "LibraryMenu.View": "视图", "LibraryMenu.Row": "横排", @@ -410,6 +407,22 @@ "LibraryMenu.Volume": "音量", "LibraryMenu.AddGames": "添加游戏", "LibraryMenu.AddFolder": "添加文件夹…", + "Library.Pkg.Install": "安装 PKG…", + "Library.Pkg.Heading": "正在安装 {0}", + "Library.Pkg.Explanation": "这会把伪造的 PKG 解压到一个游戏文件夹中,SharpEmu 会像运行其他游戏一样运行它。大型包需要较长时间,并且需要足够容纳整个游戏的可用磁盘空间。", + "Library.Pkg.Preparing": "正在读取包…", + "Library.Pkg.Progress": "{0} / {1} GB({2}%)", + "Library.Pkg.Cancelling": "正在取消…", + "Library.Pkg.Failed": "安装失败:{0}", + "Library.Pkg.SkippedNotGame": "已跳过 {0}:暂不支持补丁和 DLC 包({1})。", + "Library.Pkg.AlreadyInstalled": "已跳过 {0}:已安装在 {1}。", + "Library.Pkg.ConfirmTitle": "安装 PKG 文件?", + "Library.Pkg.ConfirmMessage": "在此文件夹中找到 {0} 个 PKG 文件。现在安装吗?这需要 {1} GB 的可用空间。", + "Library.Pkg.ConfirmInstall": "安装", + "Library.Pkg.ConfirmSkip": "暂不", + "Dialog.OpenPkg": "选择要安装的 PKG", + "Dialog.PkgFiles": "PS4/PS5 包", + "Dialog.ChoosePkgInstallFolder": "选择游戏的安装位置", "Hero.GameSettings": "游戏设置", "Hero.Console": "控制台", "Hint.LibraryMenu": "游戏库菜单", diff --git a/src/SharpEmu.Application/LaunchConfiguration.cs b/src/SharpEmu.Application/LaunchConfiguration.cs index 50250728f..698e4c95e 100644 --- a/src/SharpEmu.Application/LaunchConfiguration.cs +++ b/src/SharpEmu.Application/LaunchConfiguration.cs @@ -41,6 +41,9 @@ public LaunchConfiguration WithOneOff(IReadOnlyList? oneOff) => ? this with { CustomEnvironment = CustomEnvironmentVariables.Merge(CustomEnvironment, oneOff) } : this; + /// Default text of the on-screen keyboard; machine-wide, from the launcher settings. + public const string DefaultProfileVariable = "SHARPEMU_DEFAULT_PROFILE"; + // Defaults stay sparse in the settings file, but are explicit at launch so a launcher's // inherited shell variables cannot silently change a game's switches. Null restores an // automatic choice that is computed by the emulator (for example GPU-process availability). diff --git a/src/SharpEmu.Application/LauncherLocalization.cs b/src/SharpEmu.Application/LauncherLocalization.cs index a5498720e..899e273d2 100644 --- a/src/SharpEmu.Application/LauncherLocalization.cs +++ b/src/SharpEmu.Application/LauncherLocalization.cs @@ -74,6 +74,23 @@ public string Get(string key) public string Format(string key, params object?[] args) => string.Format(Get(key), args); + public IReadOnlyDictionary WithPrefix(string prefix) + { + var result = new Dictionary(StringComparer.Ordinal); + foreach (var source in new[] { _fallbackStrings, _strings }) + { + foreach (var (key, value) in source) + { + if (key.StartsWith(prefix, StringComparison.Ordinal)) + { + result[key] = value; + } + } + } + + return result; + } + /// /// Languages available either embedded in the binary or as a loose /// override file, sorted by code. A loose file's declared name wins when diff --git a/src/SharpEmu.Application/SettingsSplitMigration.cs b/src/SharpEmu.Application/SettingsSplitMigration.cs index 8ecfed010..4ed625188 100644 --- a/src/SharpEmu.Application/SettingsSplitMigration.cs +++ b/src/SharpEmu.Application/SettingsSplitMigration.cs @@ -140,7 +140,8 @@ public static PerGameSettings CarriedValues(string legacyGlobalJson) if (legacy.OverlayMode == "TitleBar") legacy.OverlayMode = null; legacy.DisplayIndex = legacy.DisplayIndex is { } displayIndex ? Math.Max(0, displayIndex) : null; legacy.RefreshRate = legacy.RefreshRate is { } refreshRate ? Math.Clamp(refreshRate, 0, 1000) : null; - // Nothing reads SHARPEMU_DEFAULT_PROFILE any more; older files may still carry it. + // SHARPEMU_DEFAULT_PROFILE is the launcher's DefaultProfile setting now, set at every launch; + // an old per-game switch for it must not override that. legacy.EnvironmentToggles?.RemoveAll(entry => string.Equals( EnvironmentOverrides.Name(entry), "SHARPEMU_DEFAULT_PROFILE", diff --git a/src/SharpEmu.CLI/Program.cs b/src/SharpEmu.CLI/Program.cs index 3c3451406..bd4cf9aeb 100644 --- a/src/SharpEmu.CLI/Program.cs +++ b/src/SharpEmu.CLI/Program.cs @@ -185,6 +185,11 @@ private static int Run(string[] args) TryEnableConsoleFileMirror(earlyLogFilePath); } + if (args.Length > 0 && string.Equals(args[0], "--install-pkg", StringComparison.OrdinalIgnoreCase)) + { + return InstallPkg(args); + } + if (!CheckHostArchitecture()) { return 5; @@ -1045,9 +1050,69 @@ private static string QuoteArgument(string argument) return builder.ToString(); } + // --install-pkg [destination]: unpacks a fake PS4 or PS5 package into a game folder (by + // default /) that can then be launched through its eboot.bin. + private static int InstallPkg(string[] args) + { + if (args.Length is < 2 or > 3) + { + Log.Error("Usage: SharpEmu.CLI --install-pkg [destination-folder]"); + return 2; + } + + var pkgPath = Path.GetFullPath(args[1]); + if (!File.Exists(pkgPath)) + { + Log.Error($"Package not found: {pkgPath}"); + return 2; + } + + try + { + using var package = SharpEmu.HLE.FileSystem.Pkg.GamePackage.Open(pkgPath); + if (!package.IsGameApplication) + { + Log.Error($"{Path.GetFileName(pkgPath)} is not a base game (category '{package.Category}'). Patches and DLC packages are not supported yet."); + return 2; + } + + var destination = args.Length == 3 + ? Path.GetFullPath(args[2]) + : Path.Combine( + Path.GetDirectoryName(pkgPath)!, + package.GetFolderName(Path.GetFileNameWithoutExtension(pkgPath))); + Log.Info($"Installing {Path.GetFileName(pkgPath)} ({package.ContentId}) into {destination}"); + + var lastPercent = -1; + var progress = new SynchronousProgress(report => + { + var percent = report.BytesTotal == 0 ? 100 : (int)(report.BytesDone * 100 / report.BytesTotal); + if (percent != lastPercent) + { + lastPercent = percent; + Log.Info($"{percent,3}% {report.BytesDone / (1024.0 * 1024 * 1024):0.00} / {report.BytesTotal / (1024.0 * 1024 * 1024):0.00} GB {report.CurrentFile}"); + } + }); + package.Extract(destination, progress); + Log.Info($"Done. Launch it with: SharpEmu.CLI \"{Path.Combine(destination, "eboot.bin")}\""); + return 0; + } + catch (Exception exception) when (exception is IOException or UnauthorizedAccessException or InvalidDataException) + { + Log.Error($"Installing the package failed: {exception.Message}"); + return 1; + } + } + + private sealed class SynchronousProgress(Action handler) : IProgress + { + public void Report(T value) => handler(value); + } + private static void PrintUsage() { Log.Info("Usage: SharpEmu.CLI [--strict[=on|off]] [--precompile-only] [--shader-prewarm-hold] [--shader-cache=] [--shader-learn=] [--trace-imports[=N]] [--cpu-engine=] [--console=] [--console-language=] [--log-level=] [--log-file[=]] [--no-log-file] [--window-mode=] [--resolution=] [--guest-args=<\"ARGS\">] [--display=] [--refresh-rate=] [--scaling=] [--vsync=] [--hdr=] [--overlay=] [--overlay-mode=] [--overlay-preset=] [--overlay-corner=] [--debug-server[=host:port]] "); + Log.Info("Install a fake PS4 or PS5 package: SharpEmu.CLI --install-pkg [destination-folder]"); Log.Info(@"Example: SharpEmu.CLI --cpu-engine=native --trace-imports=64 --log-level=debug --log-file ""E:\Games\...\eboot.bin"""); Log.Info("Debug server: --debug-server starts a live debug listener (default 127.0.0.1:5714); connect with SharpEmu.DebugClient."); } @@ -1520,6 +1585,15 @@ private static bool TryParseArguments( { Environment.SetEnvironmentVariable(name, value); } + // The launcher's own settings (keyboard default text, overlay theme and language), under + // anything the launcher, a script or the game's custom variables already set. + foreach (var (name, value) in SharpEmu.GUI.EmulatorLaunchVariables.Build(launcher)) + { + if (Environment.GetEnvironmentVariable(name) is null) + { + Environment.SetEnvironmentVariable(name, value); + } + } if (!HasOption(args, "--log-level") && SharpEmuLog.TryParseLevel( Environment.GetEnvironmentVariable("SHARPEMU_LOG_LEVEL") ?? configured.Settings.LogLevel, out var configuredLogLevel)) { diff --git a/src/SharpEmu.Core/Cpu/Native/DirectExecutionBackend.Imports.cs b/src/SharpEmu.Core/Cpu/Native/DirectExecutionBackend.Imports.cs index d514be537..7f388801e 100644 --- a/src/SharpEmu.Core/Cpu/Native/DirectExecutionBackend.Imports.cs +++ b/src/SharpEmu.Core/Cpu/Native/DirectExecutionBackend.Imports.cs @@ -2208,6 +2208,9 @@ nid is "ob5xAW4ln-0" or // strchr "9yDWMxEFdJU" or // strrchr "V++UgBtQhn0" or // sceAgcGetDataPacketPayloadAddress + "d-6uF9sZDIU" or // sceAgcSetCxRegIndirectPatchAddRegisters + "z2duB-hHQSM" or // sceAgcSetShRegIndirectPatchAddRegisters + "vRoArM9zaIk" or // sceAgcSetUcRegIndirectPatchAddRegisters "D9sr1xGUriE" or // sceAgcCreatePrimState: register arguments, guest reads and writes only // Per-frame polls a title runs on every input and playback tick. "h8uongcBNVs" or // sceSystemGestureGetTouchEventsCount @@ -2435,6 +2438,8 @@ private bool IsLeafImport(string nid) "LtTouSCZjHM" or // sceAgcCbNop "k3GhuSNmBLU" or // sceAgcCbDispatch "UZbQjYAwwXM" or // sceAgcCbSetShRegistersDirect + "n2fD4A+pb+g" or // sceAgcCbSetShRegisterRangeDirect + "t1vNu082-jM" or // sceAgcDcbDrawIndexIndirect "JrtiDtKeS38" or // sceAgcAcbResetQueue "cFazmnXpJOE" or // sceAgcAcbEventWrite "KT-hTp-Ch14" or // sceAgcAcbAcquireMem diff --git a/src/SharpEmu.Core/Cpu/Native/DirectExecutionBackend.StackBounds.cs b/src/SharpEmu.Core/Cpu/Native/DirectExecutionBackend.StackBounds.cs index 6cc73e48e..a1e70be41 100644 --- a/src/SharpEmu.Core/Cpu/Native/DirectExecutionBackend.StackBounds.cs +++ b/src/SharpEmu.Core/Cpu/Native/DirectExecutionBackend.StackBounds.cs @@ -11,7 +11,10 @@ namespace SharpEmu.Core.Cpu.Native; // touch it, belong to the per-OS execution integration (W10). public sealed unsafe partial class DirectExecutionBackend { - private const int HostStackStateBytes = 3 * sizeof(ulong); + // The host's stack pointer, its two stack bounds, then its MXCSR and x87 control word. + private const int HostStackStateBytes = 4 * sizeof(ulong); + private const byte HostMxcsrOffset = 3 * sizeof(ulong); + private const byte HostFpuControlWordOffset = HostMxcsrOffset + sizeof(uint); /// /// Bounds of the host mapping holding . diff --git a/src/SharpEmu.Core/Cpu/Native/DirectExecutionBackend.cs b/src/SharpEmu.Core/Cpu/Native/DirectExecutionBackend.cs index 55051cdfe..5e3baaaf7 100644 --- a/src/SharpEmu.Core/Cpu/Native/DirectExecutionBackend.cs +++ b/src/SharpEmu.Core/Cpu/Native/DirectExecutionBackend.cs @@ -730,7 +730,8 @@ private sealed class ExternalGuestThreadState private readonly record struct PendingGuestException( ulong Handler, int ExceptionType, - ulong ExceptionStackBase); + ulong ExceptionStackBase, + GuestExceptionHandlerArguments Arguments); private sealed class GuestContinuationRunner : IDisposable { @@ -2602,7 +2603,7 @@ private unsafe bool TryPrepareGuestContextTransfer( frame[14] = target.R13; frame[15] = target.R14; frame[16] = target.R15; - frame[17] = target.Mxcsr == 0 ? 0x1F80u : target.Mxcsr; + frame[17] = target.Mxcsr == 0 ? CpuContext.InitialMxcsr : target.Mxcsr; frame[18] = target.FpuControlWord == 0 ? 0x037Fu : target.FpuControlWord; frame[19] = target.RestoreFullFpuState ? 1u : 0u; // The TEB stores NT_TIB.StackBase (the high address) at +0x08 and @@ -3230,6 +3231,7 @@ private unsafe nint CreateGuestReturnStub() EmitByte(code, ref offset, 0x20); EmitByte(code, ref offset, 0x49); EmitByte(code, ref offset, 0x89); EmitByte(code, ref offset, 0xC2); // mov r10,rax EmitHostStackBounds(code, ref offset, save: false); + EmitHostFloatingPointControlRestore(code, ref offset); EmitHostNonvolatileXmmRestore(code, ref offset); EmitByte(code, ref offset, 0x41); EmitByte(code, ref offset, 0x5F); EmitByte(code, ref offset, 0x41); EmitByte(code, ref offset, 0x5E); @@ -3447,6 +3449,58 @@ private unsafe static bool TryAllocAt(ulong baseAddress, long signedDelta, nuint return true; } + // Upstream finds the near-entry block from VirtualQuery's free ranges. The macOS host reports + // untracked host memory (runtime heaps, libraries) as free, and a taken hint is relocated far + // away, so the fork keeps the probe above with its reach check; the candidate order is kept + // for a host whose free-range query is exact. + private const ulong AllocationGranularity = 0x10000uL; + + // Returns 64 KiB-aligned addresses where `size` bytes fit inside a free region and inside + // [lowLimit, highLimit), nearest to entryBase first. + internal static List OrderNearEntryCandidates( + IReadOnlyList<(ulong Start, ulong End)> freeRegions, + ulong entryBase, + ulong size, + ulong lowLimit, + ulong highLimit) + { + var candidates = new List<(ulong Distance, ulong Address)>(); + foreach (var (regionStart, regionEnd) in freeRegions) + { + ulong start = (Math.Max(regionStart, lowLimit) + AllocationGranularity - 1) & ~(AllocationGranularity - 1); + ulong end = Math.Min(regionEnd, highLimit); + if (end <= start || end - start < size) + { + continue; + } + + // Candidate above the entry: the lowest aligned address at or after it. + ulong above = (Math.Max(start, entryBase) + AllocationGranularity - 1) & ~(AllocationGranularity - 1); + if (above <= end && end - above >= size) + { + candidates.Add((above - entryBase, above)); + } + + // Candidate below the entry: the highest aligned address whose block ends at or before it. + ulong belowEnd = Math.Min(end, entryBase); + if (belowEnd >= start && belowEnd - start >= size) + { + ulong below = (belowEnd - size) & ~(AllocationGranularity - 1); + if (below >= start) + { + candidates.Add((entryBase - below, below)); + } + } + } + + candidates.Sort(static (left, right) => left.Distance.CompareTo(right.Distance)); + var result = new List(candidates.Count); + foreach (var candidate in candidates) + { + result.Add(candidate.Address); + } + return result; + } internal readonly record struct TlsPatchScanRange(ulong Start, ulong End); private readonly record struct TlsPatchCounts( @@ -3535,16 +3589,21 @@ private unsafe void PatchTlsPatterns() } } + var outOfRange = Volatile.Read(ref _tlsOutOfRangeSites); Console.Error.WriteLine( $"[LOADER][INFO] Patched {counts.Loads} TLS loads, {counts.Stores} TLS stores, " + $"{counts.StackCanaries} stack-canary accesses " + - $"across {scannedRanges} executable range(s), bytes=0x{scannedBytes:X}, reused={reusedRanges}"); + $"across {scannedRanges} executable range(s), bytes=0x{scannedBytes:X}, reused={reusedRanges}, out_of_range={outOfRange}"); if (_tlsLoadsOutOfReach != 0) { Console.Error.WriteLine( $"[LOADER][ERROR] {_tlsLoadsOutOfReach} TLS loads are out of rel32 reach of the TLS handler at " + $"0x{_tlsHandlerAddress:X16} and stay unpatched; each faults on first use."); } + else if (outOfRange > 0) + { + Console.Error.WriteLine($"[LOADER][WARNING] {outOfRange} TLS site(s) are beyond rel32 range of the TLS handler at 0x{_tlsHandlerAddress:X16}."); + } } private unsafe TlsPatchCounts PatchTlsPatternsInRange(ulong rangeStart, ulong rangeEnd) @@ -3754,6 +3813,7 @@ private unsafe bool PatchTlsLoadInstruction(nint address, int instructionLength, if (displacement < int.MinValue || displacement > int.MaxValue) { _tlsLoadsOutOfReach++; + Interlocked.Increment(ref _tlsOutOfRangeSites); return false; } // REX.W keeps retained operand-size prefixes from changing the call width. @@ -3771,6 +3831,9 @@ private unsafe bool PatchTlsLoadInstruction(nint address, int instructionLength, // faults on first use, so any at all is reported with the patch summary. private int _tlsLoadsOutOfReach; + // Every TLS site (load, store helper, patch) left unpatched for rel32 reach. + private int _tlsOutOfRangeSites; + private unsafe nint CreateTlsRegisterLoadHelper(int destinationRegister) { if (_tlsRegisterLoadHelpers[destinationRegister] != 0) @@ -3824,6 +3887,7 @@ private unsafe nint CreateTlsImmediateStoreHelper(int tlsOffset, int immediateVa long num3 = _tlsHandlerAddress - (num + num2 + 4); if (num3 < int.MinValue || num3 > int.MaxValue) { + Interlocked.Increment(ref _tlsOutOfRangeSites); Console.Error.WriteLine($"[LOADER][WARNING] TLS store helper out of rel32 range at 0x{num:X16}"); return 0; } @@ -3876,6 +3940,7 @@ private unsafe bool PatchCallSite(nint address, int instructionLength, nint targ var displacement = (long)target - ((long)address + 5); if (displacement < int.MinValue || displacement > int.MaxValue) { + Interlocked.Increment(ref _tlsOutOfRangeSites); Console.Error.WriteLine($"[LOADER][WARNING] TLS patch out of rel32 range at 0x{address:X16}"); return false; } @@ -5127,7 +5192,7 @@ public bool TryCallGuestContinuation( FsBase = callerContext.FsBase != 0 ? callerContext.FsBase : (continuation.FsBase != 0 ? continuation.FsBase : fallbackTlsBase), GsBase = callerContext.GsBase != 0 ? callerContext.GsBase : (continuation.GsBase != 0 ? continuation.GsBase : fallbackTlsBase), FpuControlWord = continuation.FpuControlWord == 0 ? (ushort)0x037F : continuation.FpuControlWord, - Mxcsr = continuation.Mxcsr == 0 ? 0x1F80u : continuation.Mxcsr, + Mxcsr = continuation.Mxcsr == 0 ? CpuContext.InitialMxcsr : continuation.Mxcsr, }; context[CpuRegister.Rax] = continuation.Rax; @@ -5273,6 +5338,23 @@ public bool TryRaiseGuestException( ulong handler, int exceptionType, out string? error) + { + return TryRaiseGuestException( + callerContext, + threadHandle, + handler, + exceptionType, + GuestExceptionHandlerArguments.Signal, + out error); + } + + public bool TryRaiseGuestException( + CpuContext callerContext, + ulong threadHandle, + ulong handler, + int exceptionType, + GuestExceptionHandlerArguments arguments, + out string? error) { error = null; var logGuestExceptions = string.Equals( @@ -5337,7 +5419,8 @@ public bool TryRaiseGuestException( QueuePendingGuestExceptionLocked(threadHandle, new PendingGuestException( handler, exceptionType, - external.ExceptionStackBase)); + external.ExceptionStackBase, + arguments)); return true; } @@ -5349,7 +5432,8 @@ public bool TryRaiseGuestException( QueuePendingGuestExceptionLocked(threadHandle, new PendingGuestException( handler, exceptionType, - external.ExceptionStackBase)); + external.ExceptionStackBase, + arguments)); if (logGuestExceptions) { Console.Error.WriteLine( @@ -5397,14 +5481,16 @@ public bool TryRaiseGuestException( QueuePendingGuestExceptionLocked(threadHandle, new PendingGuestException( handler, exceptionType, - exceptionStackBase)); + exceptionStackBase, + arguments)); return true; } QueuePendingGuestExceptionLocked(threadHandle, new PendingGuestException( handler, exceptionType, - exceptionStackBase)); + exceptionStackBase, + arguments)); if (logGuestExceptions) { Console.Error.WriteLine( @@ -5524,11 +5610,18 @@ void DeliverException() var deliveryStarted = Stopwatch.GetTimestamp(); try { + ResolveGuestExceptionHandlerArguments( + target.Context, + arguments, + exceptionType, + exceptionContextAddress, + out var handlerArg0, + out var handlerArg1); deliverySucceeded = TryCallGuestFunction( target.Context, handler, - unchecked((ulong)exceptionType), - exceptionContextAddress, + handlerArg0, + handlerArg1, exceptionStackBase + callbackStackOffset, callbackStackSize, $"kernel exception 0x{exceptionType:X2}", @@ -5583,6 +5676,7 @@ void DeliverException() threadHandle, pendingFollowUp.Handler, pendingFollowUp.ExceptionType, + pendingFollowUp.Arguments, out var followUpError)) { Console.Error.WriteLine( @@ -5744,11 +5838,18 @@ private void DeliverPendingGuestExceptionAtSafePoint( var outerPendingBlock = GuestThreadExecution.SuspendPendingBlock(); try { + ResolveGuestExceptionHandlerArguments( + currentContext, + pending.Arguments, + pending.ExceptionType, + exceptionContextAddress, + out var handlerArg0, + out var handlerArg1); if (!TryCallGuestFunction( currentContext, pending.Handler, - unchecked((ulong)pending.ExceptionType), - exceptionContextAddress, + handlerArg0, + handlerArg1, pending.ExceptionStackBase + callbackStackOffset, callbackStackSize, $"kernel exception 0x{pending.ExceptionType:X2} safe point", @@ -5774,6 +5875,29 @@ private void DeliverPendingGuestExceptionAtSafePoint( } } + // A Unity GC suspend callback takes (mcontext, interrupted rsp), where the signal + // convention takes (type, mcontext). The rsp is read back from the context the + // writer just filled in, so both paths agree on the interrupted stack pointer. + internal static void ResolveGuestExceptionHandlerArguments( + CpuContext context, + GuestExceptionHandlerArguments arguments, + int exceptionType, + ulong exceptionContextAddress, + out ulong arg0, + out ulong arg1) + { + if (arguments == GuestExceptionHandlerArguments.UnityGcSuspend) + { + _ = context.TryReadUInt64(exceptionContextAddress + 0xB8, out var interruptedRsp); + arg0 = exceptionContextAddress; + arg1 = interruptedRsp; + return; + } + + arg0 = unchecked((ulong)exceptionType); + arg1 = exceptionContextAddress; + } + private void QueuePendingGuestExceptionLocked( ulong threadHandle, PendingGuestException pending) @@ -6580,6 +6704,7 @@ thread.BlockWaiter is not null && thread.ThreadHandle, pendingException.Handler, pendingException.ExceptionType, + pendingException.Arguments, out var pendingError)) { Console.Error.WriteLine( @@ -6736,7 +6861,7 @@ private static void ApplyGuestContinuation(CpuContext context, GuestCpuContinuat context.FpuControlWord = continuation.FpuControlWord == 0 ? (ushort)0x037F : continuation.FpuControlWord; - context.Mxcsr = continuation.Mxcsr == 0 ? 0x1F80u : continuation.Mxcsr; + context.Mxcsr = continuation.Mxcsr == 0 ? CpuContext.InitialMxcsr : continuation.Mxcsr; } private unsafe GuestNativeCallExitReason ExecuteGuestThreadEntry(CpuContext context, ulong entryPoint, string name, out string? reason) @@ -6812,6 +6937,7 @@ private unsafe GuestNativeCallExitReason ExecuteGuestThreadEntry(CpuContext cont ptr2[offset++] = 73; ptr2[offset++] = 137; ptr2[offset++] = 34; + EmitFloatingPointControlSwitch(ptr2, ref offset, context.Mxcsr, context.FpuControlWord); EmitGuestStackBounds(ptr2, ref offset, context[CpuRegister.Rsp]); ptr2[offset++] = 72; ptr2[offset++] = 184; @@ -6875,6 +7001,7 @@ private unsafe GuestNativeCallExitReason ExecuteGuestThreadEntry(CpuContext cont ptr2[offset++] = 139; ptr2[offset++] = 34; EmitHostStackBounds(ptr2, ref offset, save: false); + EmitHostFloatingPointControlRestore(ptr2, ref offset); EmitHostNonvolatileXmmRestore(ptr2, ref offset); ptr2[offset++] = 65; ptr2[offset++] = 95; @@ -7035,19 +7162,12 @@ private unsafe GuestNativeCallExitReason ExecuteGuestContinuationEntry( emitter.Emit(0x41); emitter.Emit(0x56); // push r14 emitter.Emit(0x41); emitter.Emit(0x57); // push r15 EmitHostNonvolatileXmmSave(ptr2, ref emitter.Offset); + emitter.EmitMovR64Immediate(0x49, 0xBA, hostRspSlot); // mov r10, hostRspSlot + emitter.Emit(0x49); emitter.Emit(0x89); emitter.Emit(0x22); // mov [r10], rsp // Restore the fiber's floating-point control environment before // abandoning the host stack. This path is used when a blocked guest // continuation migrates to another managed worker. - emitter.Emit(0x48); emitter.Emit(0x83); emitter.Emit(0xEC); emitter.Emit(0x08); // sub rsp,8 - emitter.Emit(0xC7); emitter.Emit(0x04); emitter.Emit(0x24); // mov dword [rsp],imm32 - emitter.Emit(context.Mxcsr); - emitter.Emit(0x0F); emitter.Emit(0xAE); emitter.Emit(0x14); emitter.Emit(0x24); // ldmxcsr [rsp] - emitter.Emit(0x66); emitter.Emit(0xC7); emitter.Emit(0x04); emitter.Emit(0x24); // mov word [rsp],imm16 - emitter.Emit(context.FpuControlWord); - emitter.Emit(0xD9); emitter.Emit(0x2C); emitter.Emit(0x24); // fldcw [rsp] - emitter.Emit(0x48); emitter.Emit(0x83); emitter.Emit(0xC4); emitter.Emit(0x08); // add rsp,8 - emitter.EmitMovR64Immediate(0x49, 0xBA, hostRspSlot); // mov r10, hostRspSlot - emitter.Emit(0x49); emitter.Emit(0x89); emitter.Emit(0x22); // mov [r10], rsp + EmitFloatingPointControlSwitch(ptr2, ref emitter.Offset, context.Mxcsr, context.FpuControlWord); EmitGuestStackBounds(ptr2, ref emitter.Offset, context[CpuRegister.Rsp]); emitter.EmitMovR64Immediate(0x48, 0xB8, context[CpuRegister.Rsp]); // mov rax, guest rsp emitter.Emit(0x48); emitter.Emit(0x89); emitter.Emit(0xC4); // mov rsp, rax @@ -7337,6 +7457,9 @@ private unsafe nint GetOrCreateGuestResumeEntryStub() emitter.Emit(0x4C); emitter.Emit(0x8B); emitter.Emit(0x90); // mov r10, [rax+disp32] emitter.Emit((uint)(ResumeFrameHostRspSlotIndex * sizeof(ulong))); emitter.Emit(0x49); emitter.Emit(0x89); emitter.Emit(0x22); // mov [r10], rsp + // Every way back to the host restores the host's MXCSR and x87 control word from the + // block (EmitHostFloatingPointControlRestore); the transfer stub loads the guest's. + EmitHostFloatingPointControlSave(code, ref emitter.Offset); emitter.EmitMovR64Immediate(0x49, 0xBB, (ulong)transferStub); // mov r11, transfer stub emitter.Emit(0x41); emitter.Emit(0xFF); emitter.Emit(0xE3); // jmp r11 Debug.Assert(emitter.Offset <= stubSize, "Guest resume entry stub exceeded its allocation."); @@ -7419,6 +7542,39 @@ private static unsafe void EmitUInt32(byte* code, ref int offset, uint value) offset += sizeof(uint); } + // R10 holds the host state block. The guest starts with its context's MXCSR and x87 control word (a new thread gets + // the console's) instead of the host thread's, which the block keeps for every way back to the host: their control + // bits are callee-saved on the host. + private static unsafe void EmitFloatingPointControlSwitch(byte* code, ref int offset, uint mxcsr, ushort fpuControlWord) + { + ReadOnlySpan save = [0x41, 0x0F, 0xAE, 0x5A, HostMxcsrOffset, 0x41, 0xD9, 0x7A, HostFpuControlWordOffset]; // stmxcsr [r10+24]; fnstcw [r10+28] + foreach (var value in save) EmitByte(code, ref offset, value); + ReadOnlySpan storeMxcsr = [0x48, 0x83, 0xEC, 0x08, 0xC7, 0x04, 0x24]; // sub rsp,8; mov dword [rsp],imm32 + foreach (var value in storeMxcsr) EmitByte(code, ref offset, value); + EmitUInt32(code, ref offset, mxcsr); + ReadOnlySpan storeControlWord = [0x0F, 0xAE, 0x14, 0x24, 0x66, 0xC7, 0x04, 0x24]; // ldmxcsr [rsp]; mov word [rsp],imm16 + foreach (var value in storeControlWord) EmitByte(code, ref offset, value); + EmitByte(code, ref offset, (byte)fpuControlWord); + EmitByte(code, ref offset, (byte)(fpuControlWord >> 8)); + ReadOnlySpan load = [0xD9, 0x2C, 0x24, 0x48, 0x83, 0xC4, 0x08]; // fldcw [rsp]; add rsp,8 + foreach (var value in load) EmitByte(code, ref offset, value); + } + + // R10 holds the host state block. Saves what EmitHostFloatingPointControlRestore loads, for an + // entry that leaves the guest's control words to the transfer frame. + private static unsafe void EmitHostFloatingPointControlSave(byte* code, ref int offset) + { + ReadOnlySpan save = [0x41, 0x0F, 0xAE, 0x5A, HostMxcsrOffset, 0x41, 0xD9, 0x7A, HostFpuControlWordOffset]; // stmxcsr [r10+24]; fnstcw [r10+28] + foreach (var value in save) EmitByte(code, ref offset, value); + } + + // R10 holds the host state block. + private static unsafe void EmitHostFloatingPointControlRestore(byte* code, ref int offset) + { + ReadOnlySpan restore = [0x41, 0x0F, 0xAE, 0x52, HostMxcsrOffset, 0x41, 0xD9, 0x6A, HostFpuControlWordOffset]; // ldmxcsr [r10+24]; fldcw [r10+28] + foreach (var value in restore) EmitByte(code, ref offset, value); + } + private static unsafe void EmitHostNonvolatileXmmSave(byte* code, ref int offset) { EmitByte(code, ref offset, 0x48); @@ -7542,6 +7698,7 @@ private unsafe bool ExecuteEntry(CpuContext context, ulong entryPoint, out Orbis ptr2[num3++] = 73; ptr2[num3++] = 137; ptr2[num3++] = 34; + EmitFloatingPointControlSwitch(ptr2, ref num3, context.Mxcsr, context.FpuControlWord); EmitGuestStackBounds(ptr2, ref num3, context[CpuRegister.Rsp]); ptr2[num3++] = 72; ptr2[num3++] = 184; @@ -7605,6 +7762,7 @@ private unsafe bool ExecuteEntry(CpuContext context, ulong entryPoint, out Orbis ptr2[num3++] = 139; ptr2[num3++] = 34; EmitHostStackBounds(ptr2, ref num3, save: false); + EmitHostFloatingPointControlRestore(ptr2, ref num3); EmitHostNonvolatileXmmRestore(ptr2, ref num3); ptr2[num3++] = 65; ptr2[num3++] = 95; diff --git a/src/SharpEmu.Core/Loader/ParamLoader.cs b/src/SharpEmu.Core/Loader/ParamLoader.cs index a3f7b2e52..1ca55629f 100644 --- a/src/SharpEmu.Core/Loader/ParamLoader.cs +++ b/src/SharpEmu.Core/Loader/ParamLoader.cs @@ -27,21 +27,21 @@ public sealed record Disc(LocalizedParameters? LocalizedParameters); public static class Ps5ParamJsonReader { - public static (string? Title, string? TitleId, string? Version) TryReadPs5Param(IFileSystem fs, string paramJsonPath) + public static (string? Title, string? TitleId, string? Version, string? ConceptId) TryReadPs5Param(IFileSystem fs, string paramJsonPath) { if (!fs.Exists(paramJsonPath)) - return (null, null, null); + return (null, null, null, null); if (!fs.TryReadAllBytes(paramJsonPath, out var data)) - return (null, null, null); + return (null, null, null, null); return TryReadPs5Param(data); } - public static (string? Title, string? TitleId, string? Version) TryReadPs5Param(byte[] data) + public static (string? Title, string? TitleId, string? Version, string? ConceptId) TryReadPs5Param(byte[] data) { if (data == null || data.Length == 0) - return (null, null, null); + return (null, null, null, null); try { @@ -56,14 +56,14 @@ public static (string? Title, string? TitleId, string? Version) TryReadPs5Param( } catch (JsonException) { - return (null, null, null); + return (null, null, null, null); } } - private static (string? Title, string? TitleId, string? Version) TryReadPs5Param(JsonElement root) + private static (string? Title, string? TitleId, string? Version, string? ConceptId) TryReadPs5Param(JsonElement root) { if (root.ValueKind != JsonValueKind.Object) - return (null, null, null); + return (null, null, null, null); // Some dumps' param.json has the content id and no title id field. var titleId = GetString(root, "titleId") ?? TitleIdFromContentId(GetString(root, "contentId")); @@ -75,7 +75,10 @@ private static (string? Title, string? TitleId, string? Version) TryReadPs5Param string? title = ExtractTitleName(root); - return (title, titleId, ver); + // conceptId is shared by every regional release of one game (param.sfo has none). + var conceptId = GetString(root, "conceptId"); + + return (title, titleId, ver, conceptId); } private static string? ExtractTitleName(JsonElement root) diff --git a/src/SharpEmu.Core/Loader/SelfImage.cs b/src/SharpEmu.Core/Loader/SelfImage.cs index 98516af0a..62df9c058 100644 --- a/src/SharpEmu.Core/Loader/SelfImage.cs +++ b/src/SharpEmu.Core/Loader/SelfImage.cs @@ -28,7 +28,8 @@ public SelfImage( uint tlsModuleId = 0, ulong tlsMemorySize = 0, ulong tlsStaticOffset = 0, - IReadOnlyList? importedModuleNames = null) + IReadOnlyList? importedModuleNames = null, + string? conceptId = null) { ArgumentNullException.ThrowIfNull(programHeaders); ArgumentNullException.ThrowIfNull(mappedRegions); @@ -48,6 +49,7 @@ public SelfImage( Title = title; TitleId = titleId; Version = version; + ConceptId = conceptId; TlsModuleId = tlsModuleId; TlsMemorySize = tlsMemorySize; TlsStaticOffset = tlsStaticOffset; @@ -84,6 +86,9 @@ public SelfImage( public string? Version { get; } + /// The PS5 concept id shared by every regional release of the game, when param.json has one. + public string? ConceptId { get; } + public uint TlsModuleId { get; } public ulong TlsMemorySize { get; } diff --git a/src/SharpEmu.Core/Loader/SelfLoader.cs b/src/SharpEmu.Core/Loader/SelfLoader.cs index 24076986e..03c86c0cc 100644 --- a/src/SharpEmu.Core/Loader/SelfLoader.cs +++ b/src/SharpEmu.Core/Loader/SelfLoader.cs @@ -430,10 +430,11 @@ private SelfImage LoadCore( tlsModuleId, tlsInfo.MemorySize, tlsInfo.StaticOffset, - importedModuleNames); + importedModuleNames, + applicationInfo.ConceptId); } - private static (string? Title, string? TitleId, string? Version) TryLoadParamJson( + private static (string? Title, string? TitleId, string? Version, string? ConceptId) TryLoadParamJson( IFileSystem? fs, string? mountRoot, out ulong? flexibleMemorySize) @@ -459,7 +460,7 @@ private static (string? Title, string? TitleId, string? Version) TryLoadParamJso } } - (string? Title, string? TitleId, string? Version) applicationInfo = default; + (string? Title, string? TitleId, string? Version, string? ConceptId) applicationInfo = default; if (foundPath == null) { Console.WriteLine("[LOADER] param.json not found (no root path / unknown layout)."); @@ -489,7 +490,8 @@ private static (string? Title, string? TitleId, string? Version) TryLoadParamJso Console.WriteLine( $"[LOADER] Title: {applicationInfo.Title ?? "(unknown)"}, " + $"TitleId: {applicationInfo.TitleId ?? "(unknown)"}, " + - $"Version: {applicationInfo.Version ?? "(unknown)"}"); + $"Version: {applicationInfo.Version ?? "(unknown)"}, " + + $"ConceptId: {applicationInfo.ConceptId ?? "(unknown)"}"); } return applicationInfo; diff --git a/src/SharpEmu.Core/Memory/PhysicalVirtualMemory.cs b/src/SharpEmu.Core/Memory/PhysicalVirtualMemory.cs index fc3cc1be8..d6e9270c8 100644 --- a/src/SharpEmu.Core/Memory/PhysicalVirtualMemory.cs +++ b/src/SharpEmu.Core/Memory/PhysicalVirtualMemory.cs @@ -399,6 +399,46 @@ public bool TryAllocateAtExact(ulong desiredAddress, ulong size, bool executable return true; } + // Reserves [address, address + size) on the host without committing it and marks the + // reservation as ours, so later fixed allocations can commit sub-ranges inside it while + // unrelated host allocations cannot take the space. Clear() releases it with the other + // granule reservations. Windows only; false when the range is not free at exactly address. + public bool TryReserveOwnedRange(ulong address, ulong size) + { + if (!OperatingSystem.IsWindows() || address == 0 || size == 0 || + (address & (HostAllocationGranularity - 1)) != 0) + { + return false; + } + + var alignedSize = AlignUp(size, HostAllocationGranularity); + _gate.EnterReadLock(); + try + { + lock (_fixedAllocationGate) + { + var reserved = _hostMemory.Reserve(address, alignedSize, HostPageProtection.ReadWrite); + if (reserved == 0) + { + return false; + } + + if (reserved != address) + { + _hostMemory.Free(reserved); + return false; + } + + _fixedGranuleReservationBases.Add(address); + return true; + } + } + finally + { + _gate.ExitReadLock(); + } + } + // Aligned starts of the free host ranges in [low, highExclusive) that can hold size // bytes, from the host's own region map. The ranges are free when listed; another // thread may take one before the caller allocates it. diff --git a/src/SharpEmu.Core/Runtime/SharpEmuRuntime.cs b/src/SharpEmu.Core/Runtime/SharpEmuRuntime.cs index 7b0cb2cb4..40c56c2a5 100644 --- a/src/SharpEmu.Core/Runtime/SharpEmuRuntime.cs +++ b/src/SharpEmu.Core/Runtime/SharpEmuRuntime.cs @@ -201,13 +201,14 @@ public OrbisGen2Result Run(string ebootPath) FiberExports.ResetRuntimeState(); Http2Exports.ResetRuntimeState(); NpAuthExports.ResetRuntimeState(); + AppContentExports.ResetRuntimeState(); NpUniversalDataSystemExports.ResetRuntimeState(); KernelModuleRegistry.Reset(); var image = LoadImage(normalizedEbootPath, _executableRelativePath is null ? null : app0Root); VideoOutExports.ConfigureApplicationInfo(image.Title, image.TitleId, image.Version); KernelMemoryCompatExports.ConfigureApplicationInfo(image.TitleId); + AddcontEntitlements.ConfigureConceptId(image.ConceptId); SaveDataExports.ConfigureApplicationInfo(image.TitleId); - NpEntitlementAccessExports.ConfigureApplicationInfo(image.TitleId); SystemServiceExports.ConfigureApplicationInfo(image.TitleId, _systemLanguage); VideoOutExports.StartPresenter(); _ = RegisterLoadedModule(normalizedEbootPath, image, isMain: true, isSystemModule: false); diff --git a/src/SharpEmu.GUI/Controls/OverlaySurface.cs b/src/SharpEmu.GUI/Controls/OverlaySurface.cs new file mode 100644 index 000000000..42df3ff85 --- /dev/null +++ b/src/SharpEmu.GUI/Controls/OverlaySurface.cs @@ -0,0 +1,58 @@ +// Copyright (C) 2026 SharpEmu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +using Avalonia; +using Avalonia.Controls; +using Avalonia.Media; +using Avalonia.Platform; +using Avalonia.Rendering.SceneGraph; +using Avalonia.Skia; +using SkiaSharp; + +namespace SharpEmu.GUI.Controls; + +internal sealed class OverlaySurface : Control +{ + public Action? Paint { get; set; } + + public override void Render(DrawingContext context) + { + if (Paint is { } paint) + { + context.Custom(new Operation(new Rect(Bounds.Size), paint)); + } + } + + private sealed class Operation(Rect bounds, Action paint) : ICustomDrawOperation + { + public Rect Bounds { get; } = bounds; + + public bool HitTest(Point point) => false; + + public bool Equals(ICustomDrawOperation? other) => false; + + public void Dispose() + { + } + + public void Render(ImmediateDrawingContext context) + { + if (context.TryGetFeature() is not { } feature) + { + return; + } + + using var lease = feature.Lease(); + var canvas = lease.SkCanvas; + var saved = canvas.Save(); + try + { + paint(canvas, Bounds.Size); + } + finally + { + canvas.RestoreToCount(saved); + } + } + } +} diff --git a/src/SharpEmu.GUI/Controls/PadGlyph.cs b/src/SharpEmu.GUI/Controls/PadGlyph.cs index 0b19baf01..8fb1ca82c 100644 --- a/src/SharpEmu.GUI/Controls/PadGlyph.cs +++ b/src/SharpEmu.GUI/Controls/PadGlyph.cs @@ -1,9 +1,11 @@ // Copyright (C) 2026 SharpEmu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +using System.Globalization; using Avalonia; using Avalonia.Controls; using Avalonia.Media; +using SharpEmu.HLE.Host; namespace SharpEmu.GUI.Controls; @@ -16,20 +18,22 @@ internal enum PadSymbol } /// -/// A monochrome PlayStation face-button glyph (cross, circle, triangle, square) drawn as -/// shapes inside a thin ring, so it needs no font and stays crisp at any scale. +/// A monochrome face-button glyph inside a thin ring, using the connected pad's layout. /// internal sealed class PadGlyph : Control { public static readonly StyledProperty SymbolProperty = AvaloniaProperty.Register(nameof(Symbol)); + public static readonly StyledProperty GamepadTypeProperty = + AvaloniaProperty.Register(nameof(GamepadType)); + public static readonly StyledProperty ForegroundProperty = AvaloniaProperty.Register(nameof(Foreground), Brushes.White); static PadGlyph() { - AffectsRender(SymbolProperty, ForegroundProperty); + AffectsRender(SymbolProperty, GamepadTypeProperty, ForegroundProperty); AffectsMeasure(WidthProperty, HeightProperty); WidthProperty.OverrideDefaultValue(28); HeightProperty.OverrideDefaultValue(28); @@ -48,6 +52,22 @@ public IBrush? Foreground set => SetValue(ForegroundProperty, value); } + public HostGamepadType GamepadType + { + get => GetValue(GamepadTypeProperty); + set => SetValue(GamepadTypeProperty, value); + } + + internal static string? GetButtonLetter(PadSymbol symbol, HostGamepadType type) => + type == HostGamepadType.Xbox ? symbol switch + { + PadSymbol.Cross => "A", + PadSymbol.Circle => "B", + PadSymbol.Square => "X", + PadSymbol.Triangle => "Y", + _ => null, + } : null; + public override void Render(DrawingContext context) { var size = Math.Min(Bounds.Width, Bounds.Height); @@ -60,6 +80,14 @@ public override void Render(DrawingContext context) var ring = new Pen(brush, 1.5) { LineCap = PenLineCap.Round }; context.DrawEllipse(null, ring, centre, size / 2 - 1, size / 2 - 1); + if (GetButtonLetter(Symbol, GamepadType) is { } letter) + { + var text = new FormattedText(letter, CultureInfo.InvariantCulture, FlowDirection.LeftToRight, + new Typeface(FontFamily.Default, weight: FontWeight.SemiBold), size * 0.6, brush); + context.DrawText(text, new Point(centre.X - text.Width / 2, centre.Y - text.Height / 2)); + return; + } + // Symbols sit in a box 0.34 of the ring size either side of the centre. var r = size * 0.19; var pen = new Pen(brush, 2) { LineCap = PenLineCap.Round, LineJoin = PenLineJoin.Round }; diff --git a/src/SharpEmu.GUI/EmulatorLaunchVariables.cs b/src/SharpEmu.GUI/EmulatorLaunchVariables.cs new file mode 100644 index 000000000..e31dd1e26 --- /dev/null +++ b/src/SharpEmu.GUI/EmulatorLaunchVariables.cs @@ -0,0 +1,23 @@ +// Copyright (C) 2026 SharpEmu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +using SharpEmu.Libs.Overlay; + +namespace SharpEmu.GUI; + +/// +/// What a game takes from the launcher's own settings rather than its launch configuration: the +/// on-screen keyboard's default text, and the palette, language and strings the in-game overlays +/// (the IME keyboard, the save data list) are drawn with, so they follow the launcher's theme and language. +/// +public static class EmulatorLaunchVariables +{ + public static IReadOnlyDictionary Build(GuiSettings settings) => + new Dictionary(StringComparer.OrdinalIgnoreCase) + { + [LaunchConfiguration.DefaultProfileVariable] = GuiSettings.NormalizeDefaultProfile(settings.DefaultProfile), + [OverlayPalette.EnvironmentVariable] = LauncherThemes.EmulatorPalette(settings), + [OverlayText.LanguageVariable] = EmulatorOverlayText.Language(settings), + [OverlayText.StringsVariable] = EmulatorOverlayText.Strings(settings), + }; +} diff --git a/src/SharpEmu.GUI/EmulatorOverlayText.cs b/src/SharpEmu.GUI/EmulatorOverlayText.cs new file mode 100644 index 000000000..dbbd295f0 --- /dev/null +++ b/src/SharpEmu.GUI/EmulatorOverlayText.cs @@ -0,0 +1,26 @@ +// Copyright (C) 2026 SharpEmu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +using System.Text.Json; +using SharpEmu.Libs.Overlay; + +namespace SharpEmu.GUI; + +internal static class EmulatorOverlayText +{ + public static string Language(GuiSettings settings) => + string.IsNullOrWhiteSpace(settings.Language) ? "en" : settings.Language.Trim(); + + public static string Strings(GuiSettings settings) + { + var localization = new Localization(Localization.LanguagesDirectory); + localization.Load(Language(settings)); + var strings = new Dictionary(localization.WithPrefix(OverlayText.KeyPrefix), StringComparer.Ordinal); + return JsonSerializer.Serialize(strings, EmulatorOverlayTextContext.Default.DictionaryStringString); + } +} + +[System.Text.Json.Serialization.JsonSerializable(typeof(Dictionary))] +internal sealed partial class EmulatorOverlayTextContext : System.Text.Json.Serialization.JsonSerializerContext +{ +} diff --git a/src/SharpEmu.GUI/LauncherThemes.cs b/src/SharpEmu.GUI/LauncherThemes.cs index 7bf1936e3..38f4195dd 100644 --- a/src/SharpEmu.GUI/LauncherThemes.cs +++ b/src/SharpEmu.GUI/LauncherThemes.cs @@ -326,6 +326,49 @@ public static IBrush Brush(string key) => ? brush : Brushes.Transparent; + public static LauncherPalette Resolve(LauncherAppearance appearance) => + AdjustContrast( + IsCustom(appearance.Theme) + ? Derive(appearance.CustomBackground, appearance.CustomAccent) + : Find(appearance.Theme), + appearance.Contrast); + + public static string EmulatorPalette(GuiSettings settings) + { + var palette = Resolve(new LauncherAppearance( + settings.LauncherTheme, + settings.CustomThemeBackground, + settings.CustomThemeAccent, + settings.GlassOpacity, + settings.ThemeContrast)); + return string.Join(',', + palette.Background, palette.Menu, palette.Card, palette.Elevated, palette.RaisedHover, + palette.Text, palette.SecondaryText, palette.Muted, palette.Faint, + palette.Accent, palette.AccentForeground); + } + + public static SharpEmu.Libs.Overlay.OverlayPalette CurrentOverlayPalette() + { + SkiaSharp.SKColor Read(string key, SkiaSharp.SKColor fallback) => + Brush(key) is ISolidColorBrush { Color: var color } + ? new SkiaSharp.SKColor(color.R, color.G, color.B) + : fallback; + + var graphite = SharpEmu.Libs.Overlay.OverlayPalette.Graphite; + return new SharpEmu.Libs.Overlay.OverlayPalette( + Read("BgBrush", graphite.Background), + Read("GameOptionsMenuBrush", graphite.Menu), + Read("CardBrush", graphite.Card), + Read("ElevatedBrush", graphite.Elevated), + Read("RaisedHoverBrush", graphite.Raised), + Read("TextBrush", graphite.Text), + Read("SecondaryTextBrush", graphite.Secondary), + Read("MutedBrush", graphite.Muted), + Read("FaintBrush", graphite.Faint), + Read("AccentBrush", graphite.Accent), + Read("AccentForegroundBrush", graphite.AccentForeground)); + } + public static void Apply(LauncherAppearance appearance) { if (Avalonia.Application.Current is not { } app) @@ -333,11 +376,7 @@ public static void Apply(LauncherAppearance appearance) return; } - var palette = AdjustContrast( - IsCustom(appearance.Theme) - ? Derive(appearance.CustomBackground, appearance.CustomAccent) - : Find(appearance.Theme), - appearance.Contrast); + var palette = Resolve(appearance); var background = Color.Parse(palette.Background); var overlay = Color.Parse(palette.Overlay); var field = Color.Parse(palette.Field); diff --git a/src/SharpEmu.GUI/LibraryMenu.axaml b/src/SharpEmu.GUI/LibraryMenu.axaml index 4748bae50..e2b428368 100644 --- a/src/SharpEmu.GUI/LibraryMenu.axaml +++ b/src/SharpEmu.GUI/LibraryMenu.axaml @@ -89,5 +89,12 @@ SPDX-License-Identifier: GPL-2.0-or-later Text="{Binding [Library.OpenFile], Source={x:Static local:Localization.Instance}}" /> + diff --git a/src/SharpEmu.GUI/Localization.cs b/src/SharpEmu.GUI/Localization.cs index 23f387983..91948f8f5 100644 --- a/src/SharpEmu.GUI/Localization.cs +++ b/src/SharpEmu.GUI/Localization.cs @@ -19,4 +19,5 @@ public event PropertyChangedEventHandler? PropertyChanged public string Format(string key, params object?[] args) => strings.Format(key, args); public List DiscoverLanguages() => strings.DiscoverLanguages(); public void Load(string code) => strings.Load(code); + public IReadOnlyDictionary WithPrefix(string prefix) => strings.WithPrefix(prefix); } diff --git a/src/SharpEmu.GUI/MainWindow.ControllerHints.cs b/src/SharpEmu.GUI/MainWindow.ControllerHints.cs index 29dd9c6d0..f6cfce514 100644 --- a/src/SharpEmu.GUI/MainWindow.ControllerHints.cs +++ b/src/SharpEmu.GUI/MainWindow.ControllerHints.cs @@ -6,11 +6,12 @@ using Avalonia.Layout; using Avalonia.Media; using SharpEmu.GUI.Controls; +using SharpEmu.HLE.Host; namespace SharpEmu.GUI; /// -/// Controller connection state and the PlayStation-style button-hint bar. Hints are shown +/// Controller connection state and the button-hint bar. Hints are shown /// only while a pad is connected and list only the buttons that do something right now. /// public partial class MainWindow @@ -19,6 +20,7 @@ public partial class MainWindow private const double MainContentBottomMargin = 24; private bool _gamepadConnected; + private HostGamepadType _gamepadType; private string? _hintKey; private enum HintContext @@ -33,8 +35,17 @@ private enum HintContext Trophies, } - private void SetGamepadConnected(bool connected) + private void SetGamepadConnected(bool connected, HostGamepadType type = HostGamepadType.Generic) { + if (_gamepadType != type) + { + _gamepadType = type; + var (left, right) = ShoulderHintLabels(type); + ((TextBlock)PageHintL1.Child!).Text = left; + ((TextBlock)PageHintR1.Child!).Text = right; + _hintKey = null; + } + if (connected == _gamepadConnected) { return; @@ -158,18 +169,22 @@ private void RefreshControllerHints() } } - private static StackPanel HintItem(PadSymbol symbol, string label) + private StackPanel HintItem(PadSymbol symbol, string label) { var item = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 10 }; - item.Children.Add(new PadGlyph { Symbol = symbol, VerticalAlignment = VerticalAlignment.Center }); + item.Children.Add(new PadGlyph { Symbol = symbol, GamepadType = _gamepadType, VerticalAlignment = VerticalAlignment.Center }); item.Children.Add(HintLabel(label)); return item; } - private static StackPanel ShoulderHintItem(string label) + internal static (string Left, string Right) ShoulderHintLabels(HostGamepadType type) => + type == HostGamepadType.Xbox ? ("LB", "RB") : ("L1", "R1"); + + private StackPanel ShoulderHintItem(string label) { var item = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 6 }; - foreach (var text in new[] { "L1", "R1" }) + var (left, right) = ShoulderHintLabels(_gamepadType); + foreach (var text in new[] { left, right }) { item.Children.Add(new Border { diff --git a/src/SharpEmu.GUI/MainWindow.LibraryToolbar.cs b/src/SharpEmu.GUI/MainWindow.LibraryToolbar.cs index ed477feb6..99dae602d 100644 --- a/src/SharpEmu.GUI/MainWindow.LibraryToolbar.cs +++ b/src/SharpEmu.GUI/MainWindow.LibraryToolbar.cs @@ -5,6 +5,8 @@ using Avalonia.Animation; using Avalonia.Input; using Avalonia.Media.Transformation; +using Avalonia.Platform.Storage; +using SharpEmu.HLE.FileSystem.Pkg; namespace SharpEmu.GUI; @@ -83,10 +85,300 @@ private void InitializeLibraryToolbar() await OpenFileAsync(); }; + _libraryMenu.InstallPkgButton.Click += async (_, _) => + { + _libraryMenu.Close(); + await InstallPkgAsync(); + }; + PageTabStrip.SizeChanged += (_, _) => MovePageTabThumb(animate: false); UpdateSearchExpanded(); } + // Unpacks a fake .pkg into /, then adds that game folder to the library. + private async Task InstallPkgAsync() + { + var loc = Localization.Instance; + var files = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions + { + Title = loc.Get("Dialog.OpenPkg"), + AllowMultiple = false, + FileTypeFilter = + [ + new FilePickerFileType(loc.Get("Dialog.PkgFiles")) { Patterns = ["*.pkg"] }, + FilePickerFileTypes.All, + ], + }); + var pkgPath = files.FirstOrDefault()?.TryGetLocalPath(); + if (string.IsNullOrEmpty(pkgPath)) + { + return; + } + + if (!TryReadPackageInfo(pkgPath, out var titleId, out var folderName, out var isGame, out var category)) + { + return; + } + + if (!isGame) + { + ReportSkippedNotGame(pkgPath, category); + return; + } + + var folders = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions + { + Title = loc.Get("Dialog.ChoosePkgInstallFolder"), + AllowMultiple = false, + }); + var parent = folders.FirstOrDefault()?.TryGetLocalPath(); + if (string.IsNullOrEmpty(parent)) + { + return; + } + + if (!await InstallPackageIntoAsync(pkgPath, parent, folderName)) + { + return; + } + + await RescanLibraryAsync(addingFolder: true); + } + + // A folder picked by "Add folder" may hold downloaded .pkg files instead of extracted games. + // Walk it recursively with the same depth limit as the library scan, install every package + // under the chosen root (named after the game's title) and let the caller's rescan pick them all + // up. Packages whose game is already extracted anywhere under the root are left alone. + private async Task InstallPackagesInFolderAsync(string folder) + { + string[] packages; + try + { + packages = Directory.EnumerateFiles(folder, "*.pkg", new EnumerationOptions + { + IgnoreInaccessible = true, + RecurseSubdirectories = true, + MaxRecursionDepth = 8, + MatchCasing = MatchCasing.CaseInsensitive, + }).ToArray(); + } + catch (Exception exception) when (exception is IOException or UnauthorizedAccessException) + { + AppendConsoleLine(Localization.Instance.Format("Library.Pkg.Failed", exception.Message), ErrorLineBrush); + return; + } + + var installed = await Task.Run(() => FindInstalledTitles(folder)); + + // Patches and DLC share the base game's title id and the emulator cannot overlay them, so + // only base games are installed. + var installable = new List<(string Path, string FolderName)>(); + foreach (var pkgPath in packages) + { + if (!TryReadPackageInfo(pkgPath, out var titleId, out var folderName, out var isGame, out var category)) + { + continue; + } + + if (!isGame) + { + ReportSkippedNotGame(pkgPath, category); + continue; + } + + // The game may already sit elsewhere under the root (next to its package, or from an + // earlier manual install): installing it again would show two versions. + var key = string.IsNullOrWhiteSpace(titleId) ? Path.GetFileNameWithoutExtension(pkgPath) : titleId; + if (installed.TryGetValue(key, out var existing)) + { + AppendConsoleLine(Localization.Instance.Format("Library.Pkg.AlreadyInstalled", Path.GetFileName(pkgPath), existing), DimLineBrush); + continue; + } + + if (!File.Exists(Path.Combine(Path.Combine(folder, folderName), "eboot.bin"))) + { + installable.Add((pkgPath, folderName)); + installed[key] = Path.Combine(folder, folderName); + } + } + + if (installable.Count == 0) + { + return; + } + + long neededBytes = 0; + await Task.Run(() => + { + foreach (var (pkgPath, _) in installable) + { + try + { + using var package = GamePackage.Open(pkgPath); + neededBytes += package.GetInstalledSize(); + } + catch (Exception exception) when (exception is IOException or UnauthorizedAccessException or InvalidDataException) + { + // The install itself reports the problem; the estimate just misses this package. + } + } + }); + + var confirm = new PkgConfirmDialog( + Localization.Instance.Format( + "Library.Pkg.ConfirmMessage", + installable.Count, + (neededBytes / (1024.0 * 1024 * 1024)).ToString("0.0", System.Globalization.CultureInfo.CurrentCulture))); + if (await Sheets.ShowAsync(confirm) is not true) + { + return; + } + + foreach (var (pkgPath, folderName) in installable) + { + // Cancelling one package stops the batch; later packages stay untouched. + if (!await InstallPackageIntoAsync(pkgPath, folder, folderName)) + { + return; + } + } + } + + // Title id -> folder of every game already extracted under `root` (a folder with eboot.bin and + // sce_sys/param.sfo or param.json), searched as deep as the package scan. + private static Dictionary FindInstalledTitles(string root) + { + var titles = new Dictionary(StringComparer.OrdinalIgnoreCase); + try + { + foreach (var eboot in Directory.EnumerateFiles(root, "eboot.bin", new EnumerationOptions + { + IgnoreInaccessible = true, + RecurseSubdirectories = true, + MaxRecursionDepth = 8, + MatchCasing = MatchCasing.CaseInsensitive, + })) + { + var directory = Path.GetDirectoryName(eboot)!; + if (ReadInstalledTitleId(directory) is { } titleId) + { + titles.TryAdd(titleId, directory); + } + } + } + catch (Exception exception) when (exception is IOException or UnauthorizedAccessException) + { + } + + return titles; + } + + // TITLE_ID of an extracted game: sce_sys/param.sfo for PS4, sce_sys/param.json for PS5. + internal static string? ReadInstalledTitleId(string gameDirectory) + { + var sceSys = Path.Combine(gameDirectory, "sce_sys"); + try + { + var sfoPath = Path.Combine(sceSys, "param.sfo"); + if (File.Exists(sfoPath) && + PkgParamSfo.ReadString(File.ReadAllBytes(sfoPath), "TITLE_ID") is { Length: > 0 } sfoTitleId) + { + return sfoTitleId; + } + + var jsonPath = Path.Combine(sceSys, "param.json"); + if (File.Exists(jsonPath)) + { + using var document = System.Text.Json.JsonDocument.Parse(File.ReadAllBytes(jsonPath)); + if (document.RootElement.ValueKind == System.Text.Json.JsonValueKind.Object && + document.RootElement.TryGetProperty("titleId", out var titleId) && + titleId.ValueKind == System.Text.Json.JsonValueKind.String && + titleId.GetString() is { Length: > 0 } jsonTitleId) + { + return jsonTitleId; + } + } + } + catch (Exception exception) when (exception is IOException or UnauthorizedAccessException or System.Text.Json.JsonException) + { + } + + return null; + } + + private void ReportSkippedNotGame(string pkgPath, string? category) => + AppendConsoleLine( + Localization.Instance.Format("Library.Pkg.SkippedNotGame", Path.GetFileName(pkgPath), category ?? string.Empty), + ErrorLineBrush); + + private bool TryReadPackageInfo(string pkgPath, out string titleId, out string folderName, out bool isGame, out string? category) + { + try + { + using var package = GamePackage.Open(pkgPath); + titleId = package.TitleId; + folderName = package.GetFolderName(Path.GetFileNameWithoutExtension(pkgPath)); + category = package.Category; + isGame = package.IsGameApplication; + return true; + } + catch (Exception exception) when (exception is IOException or UnauthorizedAccessException or InvalidDataException) + { + AppendConsoleLine(Localization.Instance.Format("Library.Pkg.Failed", exception.Message), ErrorLineBrush); + titleId = string.Empty; + folderName = string.Empty; + category = null; + isGame = false; + return false; + } + } + + // Shows the install sheet for one package. The caller owns the library rescan. + private async Task InstallPackageIntoAsync(string pkgPath, string parent, string folderName) + { + var destination = Path.Combine(parent, folderName); + if (!File.Exists(Path.Combine(destination, "eboot.bin"))) + { + var dialog = new PkgInstallDialog(Path.GetFileName(pkgPath), pkgPath, destination); + if (await Sheets.ShowAsync(dialog) is not true) + { + return false; + } + } + + AddInstalledGameToLibrary(destination); + return true; + } + + // Adds only the installed game's folder, not its parent: the parent may hold other games the + // user never added. Nothing changes when a library folder already covers the game. + private void AddInstalledGameToLibrary(string gameFolder) + { + if (IsUnderLibraryFolder(_settings.GameFolders, gameFolder)) + { + return; + } + + _settings.GameFolders.Add(Path.TrimEndingDirectorySeparator(Path.GetFullPath(gameFolder))); + _settings.Save(); + } + + internal static bool IsUnderLibraryFolder(IEnumerable libraryFolders, string path) + { + var target = Path.TrimEndingDirectorySeparator(Path.GetFullPath(path)); + foreach (var folder in libraryFolders) + { + var root = Path.TrimEndingDirectorySeparator(Path.GetFullPath(folder)); + if (string.Equals(target, root, GameLibraryPath.Comparison) || + target.StartsWith(root + Path.DirectorySeparatorChar, GameLibraryPath.Comparison)) + { + return true; + } + } + + return false; + } + private void OpenLibraryMenu() { if (_libraryMenu.IsOpen) diff --git a/src/SharpEmu.GUI/MainWindow.axaml b/src/SharpEmu.GUI/MainWindow.axaml index 3c6193f87..b219b8942 100644 --- a/src/SharpEmu.GUI/MainWindow.axaml +++ b/src/SharpEmu.GUI/MainWindow.axaml @@ -132,7 +132,7 @@ SPDX-License-Identifier: GPL-2.0-or-later @@ -243,6 +243,12 @@ SPDX-License-Identifier: GPL-2.0-or-later + + + + + @@ -1489,6 +1495,16 @@ SPDX-License-Identifier: GPL-2.0-or-later VerticalAlignment="Center" /> + + + + await OnUpdateButtonAsync(); SelectLogFilePathButton.Click += async (_, _) => await SelectLogFilePathAsync(); OpenLogsFolderButton.Click += (_, _) => OpenLogsFolder(); + DefaultProfileBox.TextChanged += (_, _) => + { + _settings.DefaultProfile = GuiSettings.NormalizeDefaultProfile(DefaultProfileBox.Text); + ScheduleSettingsSave(); + }; GnmTrophyKeyBox.TextChanged += (_, _) => { var valid = GnmTrophyPackageReader.TryNormalizeKey(GnmTrophyKeyBox.Text, out var key); @@ -447,6 +452,7 @@ public MainWindow() GameList.AddHandler(ContextRequestedEvent, OnGameContextRequested, RoutingStrategies.Tunnel); AddHandler(KeyDownEvent, OnPreviewKeyDown, RoutingStrategies.Tunnel); CtxLaunch.Click += (_, _) => LaunchSelected(); + CtxLaunchVariables.Click += async (_, _) => await LaunchWithVariablesAsync(); CtxCreateShortcut.Click += async (_, _) => await CreateSelectedGameShortcutAsync(); CtxOpenFolder.Click += (_, _) => OpenSelectedGameFolder(); CtxCopyPath.Click += async (_, _) => await CopySelectedGamePathAsync(); @@ -959,7 +965,7 @@ private void PollGamepad() return; } - SetGamepadConnected(true); + SetGamepadConnected(true, pad.Type); RefreshControllerHints(); if ((pad.Buttons & ~_previousPadButtons) != HostGamepadButtons.None) { @@ -1616,6 +1622,7 @@ private void ApplySettingsToControls() PortableDataToggle.IsChecked = SharpEmu.Logging.SharpEmuPaths.IsPortableMarkerPresent(); GnmTrophyPackageReader.Configure(_settings.GnmTrophyKey); GnmTrophyKeyBox.Text = _settings.GnmTrophyKey; + DefaultProfileBox.Text = _settings.DefaultProfile; UpdateLogFilePathText(); _settingsSaveTimer.Stop(); } @@ -1874,6 +1881,8 @@ private async Task AddFolderAsync() _settings.Save(); } + // A downloaded folder often holds .pkg files rather than an extracted game. + await InstallPackagesInFolderAsync(path); await RescanLibraryAsync(addingFolder: true); } @@ -2433,6 +2442,7 @@ private void OnGameContextRequested(object? sender, ContextRequestedEventArgs e) GameList.SelectedItem = game; CtxLaunch.IsEnabled = !_isRunning; + CtxLaunchVariables.IsEnabled = !_isRunning; CtxCopyTitleId.IsEnabled = game.TitleId is not null; CtxGameSettings.IsEnabled = true; CtxPackZar.IsEnabled = GameVersions.PackableForGame(_allGames, game).Count > 0; @@ -2995,8 +3005,8 @@ private void Launch( StartPendingSession(); } - // The GNM trophy key is a launcher setting rather than a game's; a custom variable that - // names it still wins. + // The GNM trophy key, the keyboard's default text and the overlays' theme and language are + // launcher settings rather than a game's; a custom variable that names one still wins. private IReadOnlyDictionary BuildLaunchEnvironment(LaunchConfiguration configuration) { var environment = new Dictionary( @@ -3005,6 +3015,11 @@ private void Launch( environment.TryAdd( GnmTrophyPackageReader.KeyEnvironmentName, string.IsNullOrEmpty(_settings.GnmTrophyKey) ? null : _settings.GnmTrophyKey); + foreach (var (name, value) in EmulatorLaunchVariables.Build(_settings)) + { + environment.TryAdd(name, value); + } + return environment; } diff --git a/src/SharpEmu.GUI/PkgConfirmDialog.axaml b/src/SharpEmu.GUI/PkgConfirmDialog.axaml new file mode 100644 index 000000000..5fcc368c6 --- /dev/null +++ b/src/SharpEmu.GUI/PkgConfirmDialog.axaml @@ -0,0 +1,30 @@ + + + + + + + + + +