Compare commits

..

116 Commits

Author SHA1 Message Date
bunnei
781c85b951 hle: service: sm: Remove redundant session reservation, etc.
- We were double-reserving, causing us to run out of sessions in Pokemon Sword & Shield.
2021-06-10 11:34:41 -07:00
bunnei
fa8a0065ca hle: service: Increase arbitrary max sessions limit.
- Pokemon Sword/Shield are still hitting this for some reason, causing an svcBreak.
2021-06-10 00:08:09 -07:00
bunnei
74f0087bfa Merge pull request #6441 from bunnei/fix-session-handler
hle: kernel: KServerSession: Fix client disconnected.
2021-06-09 22:53:25 -07:00
bunnei
b259e95c09 hle: kernel: KClientPort: Add an assert for session count.
- Prevents us from over decrementing num_sessions.
2021-06-09 22:36:42 -07:00
bunnei
ec5674a6ad hle: service: sm: Fix GetService setup of session & port. 2021-06-09 22:29:18 -07:00
bunnei
2aa6a8d889 hle: service: Use correct size for ServerSessionCountMax. 2021-06-09 22:04:36 -07:00
bunnei
b2971b48ed hle: kernel: KServerSession: Fix client disconnected.
- Prevents a cloned session's handler from being overwritten by another disconnected session.
- Fixes session handler nullptr asserts with Pokemon Sword & Shield.
2021-06-09 21:37:11 -07:00
Ameer J
86d832ab9a Merge pull request #6439 from lat9nq/ci-no-7z
ci: common: Remove 7z packaging
2021-06-09 19:47:08 -04:00
Mai M
61c7a81ec8 Merge pull request #6440 from bunnei/cancel-synch
kernel: svc: Add missing error check to CancelSynchronization.
2021-06-09 19:08:36 -04:00
lat9nq
fbad68de0f ci: windows: Compress using xz
Use XZ instead of gzip for packing. Should save about 10 MB.
2021-06-09 18:54:23 -04:00
bunnei
c63ea608aa kernel: svc: Add missing error check to CancelSynchronization.
- Avoids a potential crash if the handle is invalid, and also makes this code accurate to real kernel behavior.
2021-06-09 15:24:46 -07:00
lat9nq
6eeb532c96 ci: common: Remove 7z packaging
Removes the 7z from being package during CI, as only .tar.xz preserves
information needed on Linux, and otherwise is just extremely redundant
to package in addition to the .tar.xz.  This affects Linux releases and
PR-verify artifacts only. MSVC releases do not use this script to my
knowledge.
2021-06-09 17:16:29 -04:00
Mai M
5857067a18 Merge pull request #6436 from liushuyu/master
src/common/CMakeLists.txt: fix variable escaping
2021-06-09 15:38:56 -04:00
bunnei
2d32fc2318 hle: service: Increase arbitrary max sessions limit.
- Pokemon Sword/Shield are still hitting this for some reason, causing an svcBreak.
2021-06-09 11:59:34 -07:00
bunnei
75a4ac12c6 Merge pull request #6413 from Kewlan/limitable_input_dialog_limit
limitable_input_dialog: Implement character limiter
2021-06-09 11:55:36 -07:00
liushuyu
eb9deffab6 src/common/CMakeLists.txt: fix variable escaping 2021-06-09 02:20:55 -06:00
Morph
15483c07c6 Merge pull request #6435 from lioncash/nodisc2
common/fs/path_util: Remove [[nodiscard]] from function with void return
2021-06-09 02:44:41 -04:00
bunnei
f9c3e2e872 Merge pull request #6434 from lioncash/tcontext
configure_ui: Add translation context for file-scope strings
2021-06-08 19:36:44 -07:00
bunnei
3c621d37f0 Merge pull request #6428 from bunnei/service-thread-crash-fix
hle: kernel: Remove service thread manager and use weak_ptr.
2021-06-08 16:43:55 -07:00
Lioncash
dd8577e91d common/fs/path_util: Remove [[nodiscard]] from function with void return
We can't make use of the return value here, since we don't a return
value to work with.
2021-06-08 19:36:09 -04:00
Lioncash
b3eb08254b configure_ui: Add translation context for file-scope strings
Allows for these strings to show up in the translation files.
2021-06-08 19:33:23 -04:00
Mai M
f09c9b5fcc Merge pull request #6426 from lat9nq/context-menu-start
yuzu qt: Start games from context menu
2021-06-08 17:09:25 -04:00
bunnei
b8fb9b3f11 hle: kernel: KServerSession: Work-around scenario where session is closed too early. 2021-06-08 13:39:20 -07:00
bunnei
08d798b6fe hle: kernel: hle_ipc: Ensure SessionRequestHandler is valid. 2021-06-07 21:55:37 -07:00
bunnei
3b5673daca Merge pull request #6412 from clementgallet/yuzu-cmd-window-gl
yuzu-cmd: Fix OpenGL rendering
2021-06-07 21:12:17 -07:00
bunnei
a493ab2678 hle: kernel: Remove service thread manager and use weak_ptr.
- We no longer need to queue up service threads to be destroyed.
- Fixes a race condition where a thread could be destroyed too early, which caused a crash in Pokemon Sword/Shield.
2021-06-07 21:10:51 -07:00
lat9nq
5ac018d1df yuzu qt: Start games from context menu
This connects the BootGame function to the context menu. In addition,
there is an option to boot without using the custom configuration.
2021-06-07 20:27:51 -04:00
bunnei
df91c9f5e6 Merge pull request #6410 from lat9nq/avoid-oob
decoders: Avoid out-of-bounds access
2021-06-07 10:51:17 -07:00
bunnei
28eb8c83d4 Merge pull request #6414 from bunnei/fix-service-threads
hle: kernel: Refactor to allocate a ServiceThread per service handler.
2021-06-06 22:52:07 -07:00
bunnei
9db569b2d9 hle: kernel: KServerSession: Use ASSERT_MSG where appropriate. 2021-06-06 22:09:25 -07:00
bunnei
ada4242c01 hle: kernel: k_server_session: Return service thread by strong pointer. 2021-06-06 17:54:06 -07:00
bunnei
93f93cb8bc hle: kernel: k_server_session: Ensure service thread is valid before dereference. 2021-06-06 17:03:36 -07:00
bunnei
afd0e2eb0b Merge pull request #6400 from ameerj/disable-uniform-simplify
buffer_cache: Simplify uniform disabling logic
2021-06-06 15:42:20 -07:00
bunnei
384cbe3829 hle: kernel: hle_ipc: Use default destructor for SessionRequestManager. 2021-06-06 15:41:16 -07:00
bunnei
6119836795 hle: kernel: KAutoObjectWithListContainer: Use boost::instrusive::rbtree.
- Fixes some crashes introduced by our common intrusive red/black tree impl.
2021-06-06 15:39:11 -07:00
Kewlan
058196a089 limitable_input_dialog: Implement character limiter
When using GetText() you can now choose what set of characters the user can't enter.
2021-06-06 09:07:55 +02:00
Morph
31dac5d95f Merge pull request #6415 from lioncash/res-nodisc
result: Add [[nodiscard]] specifiers where applicable
2021-06-06 00:52:36 -04:00
Rodrigo Locatti
1bccbc424c Merge pull request #6416 from ReinUsesLisp/update-dynarmic
externals: Update dynarmic
2021-06-05 17:35:54 -03:00
ReinUsesLisp
71a3c60d95 externals: Update dynarmic 2021-06-05 15:24:12 -03:00
Clément Gallet
2e1c58b905 Avoid -Wshadow warning
Co-authored-by: Mai M. <mathew1800@gmail.com>
2021-06-05 18:43:10 +02:00
Lioncash
25b73e135f result: Add [[nodiscard]] specifiers where applicable
The result code classes are used quite extensively throughout both the
kernel and service HLE code. We can mark these member functions as
[[nodiscard]] to prevent a few logic bugs from slipping through.
2021-06-05 06:09:07 -04:00
bunnei
fefc76e5da Merge pull request #6362 from lat9nq/reset-to-defaults
yuzu qt: Add settings reset button to general configuration
2021-06-04 21:07:39 -07:00
Mai M
07f6646f7f Merge pull request #6411 from clementgallet/yuzu-cmd-touch-button
yuzu-cmd: Add touch_from_button in config file
2021-06-04 23:21:29 -04:00
bunnei
27ce97fd42 hle: kernel: Refactor to allocate a ServiceThread per service handler.
- Previously, we would allocate a thread per session, which adds new threads on CloneCurrentObject.
- This results in race conditions with N sessions queuing requests to the same service interface.
- Fixes Pokken Tournament DX crashes/softlocks, which were regressed by #6347.
2021-06-04 19:26:48 -07:00
Clément Gallet
9ff8504452 yuzu-cmd: Fix OpenGL rendering 2021-06-04 11:39:04 +02:00
lat9nq
287a0f72a5 decoders: Break instead of continue
continue causes a memory leak in A Hat in Time.
2021-06-04 05:12:14 -04:00
lat9nq
1feefabeba decoders: Avoid out-of-bounds access
This is not a real fix, so assert here and continue before crashing.
2021-06-04 05:03:54 -04:00
bunnei
c8b3d92836 Merge pull request #6392 from german77/controller-widget
settings: Disable controller preview if controller is not active
2021-06-04 00:40:04 -07:00
bunnei
1d1f616063 Merge pull request #6389 from german77/Analog_button_fix
input_common: Analog button, use time based position
2021-06-03 21:06:38 -07:00
Maide
cb5fe12ee1 [game_list] Correct light theme loading (#6408)
Correct light theme loading

The setLayout call in game list instantiation will call resizing signals with default values in light theme, which was then being erroneously saved. setLayout doesn't seem to call resizing for any other theme, so I'm not sure why that happens.
2021-06-03 19:07:38 -04:00
Clément Gallet
166f5d1612 yuzu-cmd: Add touch_from_button in config file 2021-06-04 00:58:35 +02:00
bunnei
e4fed17f59 Merge pull request #6402 from Kelebek1/UI
game_list: Stop the columns resizing on NAND install
2021-06-03 00:24:45 -07:00
bunnei
5a6d002bf0 Merge pull request #6404 from lat9nq/revert_views
yuzu qt: Revert some usages of string_view
2021-06-02 22:11:35 -07:00
bunnei
395cc0c32f Merge pull request #6405 from Morph1984/result-success
fsp-srv: Replace one last instance of RESULT_SUCCESS
2021-06-02 19:20:24 -07:00
Morph
b840dd9af8 fsp-srv: Replace one last instance of RESULT_SUCCESS 2021-06-02 21:40:14 -04:00
Chloe
c4c256f56a fspsrv: Implement DisableAutoSaveDataCreation (#6355)
- Used by Mii Edit
2021-06-02 17:46:29 -07:00
lat9nq
c41451af75 yuzu qt: Revert some usages of string_view
Causes a heap-use-after free reported by AddressSanitizer. This makes
use of std::filesystem::path, but due to that we have to use their
string() function which may not work for all characters.
2021-06-02 19:50:20 -04:00
bunnei
4ea171fa5e Merge pull request #6308 from Morph1984/result
general: Replace RESULT_NAME with ResultName
2021-06-02 15:29:09 -07:00
bunnei
d6006e9a3f Merge pull request #6403 from Kewlan/game-list-for-loop-optimization
game_list: Minor for loop optimizations
2021-06-02 15:27:54 -07:00
Kewlan
65d42a428f game_list: Minor for loop optimizations
There's no need to check the first and last rows since they'll always be the Favorites and AddDir rows.
Also change the name of the clear_all variable for consistency.
2021-06-02 16:19:55 +02:00
Kelebek1
04e52ffed0 Stop the columns resizing on NAND install 2021-06-02 06:27:08 +01:00
Morph
a0e4c2e1fc general: Replace RESULT_UNKNOWN with ResultUnknown
Transition to PascalCase for result names.
2021-06-02 00:39:27 -04:00
Morph
12c1766997 general: Replace RESULT_SUCCESS with ResultSuccess
Transition to PascalCase for result names.
2021-06-02 00:39:27 -04:00
Morph
377cd301b3 Merge pull request #6395 from lioncash/result-move
common_funcs: Move R_ macros to result.h
2021-06-02 00:34:48 -04:00
Mai M
50866199a4 Merge pull request #6397 from Morph1984/fs_util
common: fs: fs_util: Add more string conversion functions
2021-06-02 00:28:34 -04:00
Morph
dba7bcd489 common: fs: fs_util: Move PathToUTF8String to fs_util 2021-06-02 00:26:26 -04:00
Morph
a1eeb9908d common: fs: fs_util: Add more string conversion functions 2021-06-02 00:26:26 -04:00
bunnei
91f559a71f Merge pull request #6361 from lat9nq/per-hb-cfg
yuzu qt: Handle per-game configs for title id 0
2021-06-01 17:24:08 -07:00
lat9nq
c17e1bd7a8 yuzu qt: Use lambda and std::function for reset callback
Also makes use of std::move, and performs a clang-format cleanup.

This addresses review comments.

Co-authored-by: LC <mathew1800@gmail.com>
2021-06-01 17:22:06 -04:00
lat9nq
4a3d57e469 yuzu: Add settings reset button to general configuration
Builds on german77's work to reset all settings back to their defaults.
This include UISettings and Settings values structs, but does not affect
save profiles, input profiles, and game directories.

This works from a button input in configure_general. When activated, it
calls a callback to close the whole configure dialog, then GMainWindow
deletes the old configuration, both on disk and in memory, and
reinitalizes a new one. It also resets a portion of the UI and calls the
telemetry window prompt.
2021-06-01 17:22:04 -04:00
fearlessTobi
8aeb425669 configuration: Initial work to reset all settings
This commit does not compile.

Initial work to add and connect a Reset to Defaults button to the
configure_general tab.

Co-authored-by: german77 <juangerman-13@hotmail.com>
2021-06-01 17:09:33 -04:00
ameerj
859ba21f6d buffer_cache: Simplify uniform disabling logic 2021-06-01 13:26:58 -04:00
Morph
65b389da70 Merge pull request #6396 from lat9nq/mingw-sdl-fix
externals: Use defaults for building SDL2 on WIN32
2021-06-01 04:14:08 -04:00
bunnei
348ca07e0d Merge pull request #6318 from german77/dualJoycon
input_common: Add dual joycon support
2021-06-01 00:51:00 -07:00
bunnei
0a6f685ad0 Merge pull request #6367 from ReinUsesLisp/vma-host
vulkan_memory_allocator: Allow textures to be allocated in host memory
2021-05-31 23:35:11 -07:00
Lioncash
3aed797466 common_funcs: Move R_ macros to result.h
These macros all interact with the result code type, so they should
ideally be within this file as well, so all the common_funcs machinery
doesn't need to be pulled in just to use them.
2021-05-31 16:41:00 -04:00
lat9nq
185e405bc1 externals: Use defaults for building SDL2 on WIN32
Whatever those settings do breaks controller detection on Windows, at
least with the MinGW container. If-guard it against WIN32 and just let
SDL2 configure using its defaults, aside from static linking.
2021-05-31 15:26:25 -04:00
Ameer J
519ddfae04 Merge pull request #6394 from lat9nq/mingw-fix
externals: libusb: Use autotools for MinGW
2021-05-31 14:28:56 -04:00
lat9nq
1914a1d21c externals: libusb: Use autotools for MinGW
After updating to 1.0.24, MinGW fails to build libusb as a result of
numerous errors. So we build libusb their way and let them update the
nontrivial stuff.

This only applies to MinGW: the old path is still in use for Linux
toolchains as well as MSVC.

This will dynamically link libusb, since I hit build errors with the old
way we used to resolve the conflict with SDL2.
2021-05-31 13:57:06 -04:00
bunnei
f34176996e Merge pull request #6385 from degasus/save_memory_access
core/memory: Check our memory fallbacks for out-of-bound behavior.
2021-05-30 23:21:39 -07:00
german77
ac48e059bc settings: Disable controller preview if controller is not active 2021-05-30 10:57:20 -05:00
bunnei
95f45112e9 Merge pull request #6344 from german77/update-libusb
Update libusb to 1.0.24
2021-05-30 01:36:46 -07:00
bunnei
a5ebba7e36 Merge pull request #6377 from lioncash/point
common: Extract Point struct into common
2021-05-30 01:35:26 -07:00
bunnei
a6cfc73cb2 Merge pull request #6387 from lioncash/class-token
k_class_token: Use variable templates where applicable
2021-05-29 23:55:17 -07:00
bunnei
90c3dd300f Merge pull request #6386 from bunnei/shutdown-fix
video_core: gpu: WaitFence: Do not block threads during shutdown.
2021-05-29 23:52:52 -07:00
bunnei
f072f48806 ci: build-msvc: Remove CMake install step.
- This is breaking our build pipelines with Zydis (dynarmic dependency).
2021-05-29 22:49:02 -07:00
german77
a323bc5af8 input_common: Analog button, use time based position instead of frequent updates 2021-05-30 00:13:51 -05:00
Mai M
2069430baa Merge pull request #6374 from Morph1984/swkbd-textcheck-encoding
applets/swkbd: Only read the text check message on Failure/Confirm
2021-05-29 23:34:40 -04:00
Mai M
fc708b396b Merge pull request #6364 from german77/stub-lp2p
ldn: Add and stub lp2p:sys lp2p:app INetworkServiceMonitor INetworkService

Mario Kart Live: Home Circuit needs lp2p:sys lp2p:app INetworkServiceMonitor INetworkService to be able to progress.

Note: The game still fails to boot from unimplemented LDN and BSD services.
2021-05-29 23:33:57 -04:00
bunnei
e41c8b6780 Merge pull request #6379 from degasus/update_dynarmic
externals: Update dynarmic.
2021-05-29 03:15:13 -07:00
Lioncash
646622ccd4 k_class_token: Use variable templates where applicable
Same behavior, less code.
2021-05-29 05:25:34 -04:00
bunnei
c7c4ef9d43 Merge pull request #6384 from lioncash/virtual
kernel: Add missing override specifiers
2021-05-29 02:11:40 -07:00
bunnei
cdabc9064b Merge pull request #6382 from lioncash/null
k_thread: Move dereference after null check in Initialize()
2021-05-29 01:17:28 -07:00
bunnei
8592f8a2b4 video_core: gpu: WaitFence: Do not block threads during shutdown.
- Fixes a hang on shutdown when NVFlinger thread is waiting on a syncpoint that will never occur.
- Commonly observed when stopping emulation in Super Mario Odyssey.
2021-05-29 01:06:04 -07:00
Markus Wick
42a7c5d017 core/memory: Check our memory fallbacks for out-of-bound behavior.
This makes it by far harder to crash yuzu.

Also implement the 48bit masking of AARCH64 while touching this code.
2021-05-29 09:28:26 +02:00
bunnei
5388e6db84 Merge pull request #6373 from bunnei/use-slabheap-tls
hle: kernel: KSlabHeap: Allow host or guest allocations.
2021-05-29 00:17:24 -07:00
Mai M
38dbe57797 Merge pull request #6383 from degasus/fix_gcc_warnings
Fix two GCC 11 warnings: Unneeded copies.
2021-05-29 03:08:11 -04:00
Markus Wick
ddb186e61d core/arm_interface: Improve the performance of memory fallbacks.
We just create one memory subsystem. This is a constant all the time.
So there is no need to call the non-inlined parent.Memory() helper on every callback.
2021-05-29 09:02:19 +02:00
Markus Wick
5a8cd1b118 Fix two GCC 11 warnings: Unneeded copies.
std::move created an unneeded copy.
iterating without reference also created copies.
2021-05-29 08:57:44 +02:00
Markus Wick
d2d7a5060f externals: Update dynarmic.
The new version supports fastmem on a64.
2021-05-29 08:53:01 +02:00
Lioncash
16ff0161b3 k_thread: Move dereference after null check in Initialize()
Prevents a -Wnonnull warning on GCC.
2021-05-29 00:31:38 -04:00
bunnei
420b1f89d3 Merge pull request #6371 from degasus/drop_ExceptionalExit
core/arm_interface: Call SVC after end of dynarmic block.
2021-05-28 17:45:05 -07:00
bunnei
ee099b2697 hle: kernel: KSlabHeap: Allow host or guest allocations.
- Use host allocations for kernel memory, as this is not properly emulated yet.
- Use guest allocations for TLS, as this needs to be backed by DeviceMemory.
2021-05-28 17:42:41 -07:00
bunnei
945effcc75 Merge pull request #6356 from ogniK5377/ApplyNpadSystemCommonPolicy
hid: ApplyNpadSystemCommonPolicy
2021-05-28 10:05:20 -07:00
Lioncash
5554de3933 touchscreen: Make use of common point struct 2021-05-28 08:15:22 -04:00
Lioncash
8171ad65cd common: Extract point into a common struct
This is generic enough that it can be moved into the Common class for
reuse.
2021-05-28 08:12:49 -04:00
Morph
c68255f70f applets/swkbd: Make use of std::move where applicable
Avoids redundant string copies
2021-05-27 23:45:56 -04:00
Morph
247cd92216 applets/swkbd: Only read the text check message on Failure/Confirm
Applications may leave this region of memory uninitialized when the text check result is not either Failure or Confirm.
Attempting to read uninitialized memory may cause an exception within the UTF16 to UTF8 string converter.
Fix this by only reading the text check message on Failure or Confirm.
2021-05-27 23:45:56 -04:00
Markus Wick
3d2e80daed core/arm_interface: Call SVC after end of dynarmic block.
So we can modify all of dynarmic states within SVC without ExceptionalExit.

Especially as the ExceptionalExit hack is dropped on upstream dynarmic.
2021-05-27 23:23:23 +02:00
ReinUsesLisp
19454e71d8 vulkan_memory_allocator: Allow textures to be allocated in host memory
Allow Vulkan's allocator to use host memory when there's no more device
local memory. This delays OOM, but it will eventually still happen.
2021-05-27 05:50:48 -03:00
german77
65e20f424a ldn: Add and stub lp2p:sys lp2p:app INetworkServiceMonitor INetworkService 2021-05-26 10:06:00 -05:00
lat9nq
bc38d4c81b yuzu qt: Restore const qualifiers
This addresses review comments.

Co-authored-by: LC <mathew1800@gmail.com>
2021-05-25 21:39:57 -04:00
lat9nq
cfb9bcbe42 yuzu qt: Handle per-game configs for title id 0
Currently with programs that have a 0 title id, yuzu loads the custom
configuration 0000000000000000.ini for per-game configs. This is not
ideal since many homebrews share this id. Instead for these programs, we
load a config that is simply the file name and `.ini` appended to it.
2021-05-25 20:10:41 -04:00
Chloe Marcec
db7abfecdd hid: ApplyNpadSystemCommonPolicy
We already do this specifically for homebrew, so we can keep it stubbed out for the time being
2021-05-24 15:07:47 +10:00
german77
ea4b7226a6 input_common: Add dual joycon support 2021-05-22 18:40:53 -05:00
german77
3a6e2922a2 Update libusb to 1.0.24 2021-05-20 22:10:48 -05:00
209 changed files with 2985 additions and 1804 deletions

View File

@@ -9,11 +9,5 @@ cp "${REV_NAME}-source.tar.xz" "$DIR_NAME"
tar $COMPRESSION_FLAGS "$ARCHIVE_NAME" "$DIR_NAME"
mv "$DIR_NAME" $RELEASE_NAME
mv "${REV_NAME}-source.tar.xz" $RELEASE_NAME
7z a "$REV_NAME.7z" $RELEASE_NAME
# move the compiled archive into the artifacts directory to be uploaded by travis releases
mv "$ARCHIVE_NAME" "${ARTIFACTS_DIR}/"
mv "$REV_NAME.7z" "${ARTIFACTS_DIR}/"

View File

@@ -47,3 +47,6 @@ python3 .ci/scripts/windows/scan_dll.py package/imageformats/*.dll "package/"
EXTERNALS_PATH="$(pwd)/build/externals"
FFMPEG_DLL_PATH="$(find ${EXTERNALS_PATH} -maxdepth 1 -type d | grep ffmpeg)/bin"
find ${FFMPEG_DLL_PATH} -type f -regex ".*\.dll" -exec cp -v {} package/ ';'
# copy libraries from yuzu.exe path
find "$(pwd)/build/bin/" -type f -regex ".*\.dll" -exec cp -v {} package/ ';'

View File

@@ -3,8 +3,8 @@
. .ci/scripts/common/pre-upload.sh
REV_NAME="yuzu-windows-mingw-${GITDATE}-${GITREV}"
ARCHIVE_NAME="${REV_NAME}.tar.gz"
COMPRESSION_FLAGS="-czvf"
ARCHIVE_NAME="${REV_NAME}.tar.xz"
COMPRESSION_FLAGS="-cJvf"
if [ "${RELEASE_NAME}" = "mainline" ]; then
DIR_NAME="${REV_NAME}"

View File

@@ -8,7 +8,7 @@ steps:
displayName: 'Install vulkan-sdk'
- script: python -m pip install --upgrade pip conan
displayName: 'Install conan'
- script: refreshenv && mkdir build && cd build && cmake -G "Visual Studio 16 2019" -A x64 -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_SDL2=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DUSE_DISCORD_PRESENCE=ON -DENABLE_QT_TRANSLATION=ON -DDISPLAY_VERSION=${{ parameters['version'] }} .. && cmake --install . --config Release && cd ..
- script: refreshenv && mkdir build && cd build && cmake -G "Visual Studio 16 2019" -A x64 -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_SDL2=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DUSE_DISCORD_PRESENCE=ON -DENABLE_QT_TRANSLATION=ON -DDISPLAY_VERSION=${{ parameters['version'] }} -DCMAKE_BUILD_TYPE=Release .. && cd ..
displayName: 'Configure CMake'
- task: MSBuild@1
displayName: 'Build'

View File

@@ -426,7 +426,7 @@ if(NOT APPLE)
endif()
if (NOT LIBUSB_FOUND)
add_subdirectory(externals/libusb)
set(LIBUSB_INCLUDE_DIR "")
set(LIBUSB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/externals/libusb/libusb/libusb")
set(LIBUSB_LIBRARIES usb)
endif()

View File

@@ -47,19 +47,21 @@ target_include_directories(unicorn-headers INTERFACE ./unicorn/include)
# SDL2
if (NOT SDL2_FOUND AND ENABLE_SDL2)
# Yuzu itself needs: Events Joystick Haptic Sensor Timers
# Yuzu-cmd also needs: Video (depends on Loadso/Dlopen)
set(SDL_UNUSED_SUBSYSTEMS
Atomic Audio Render Power Threads
File CPUinfo Filesystem Locale)
foreach(_SUB ${SDL_UNUSED_SUBSYSTEMS})
string(TOUPPER ${_SUB} _OPT)
option(SDL_${_OPT} "" OFF)
endforeach()
if (NOT WIN32)
# Yuzu itself needs: Events Joystick Haptic Sensor Timers
# Yuzu-cmd also needs: Video (depends on Loadso/Dlopen)
set(SDL_UNUSED_SUBSYSTEMS
Atomic Audio Render Power Threads
File CPUinfo Filesystem Locale)
foreach(_SUB ${SDL_UNUSED_SUBSYSTEMS})
string(TOUPPER ${_SUB} _OPT)
option(SDL_${_OPT} "" OFF)
endforeach()
option(HIDAPI "" ON)
endif()
set(SDL_STATIC ON)
set(SDL_SHARED OFF)
option(HIDAPI "" ON)
add_subdirectory(SDL EXCLUDE_FROM_ALL)
add_library(SDL2 ALIAS SDL2-static)

View File

@@ -1,155 +1,239 @@
# Ensure libusb compiles with UTF-8 encoding on MSVC
if(MSVC)
add_compile_options(/utf-8)
endif()
if (MINGW)
# The MinGW toolchain for some reason doesn't work with this CMakeLists file after updating to
# 1.0.24, so we do it the old-fashioned way for now. We may want to move native Linux toolchains
# to here, too (TODO lat9nq?).
add_library(usb STATIC EXCLUDE_FROM_ALL
libusb/libusb/core.c
libusb/libusb/core.c
libusb/libusb/descriptor.c
libusb/libusb/hotplug.c
libusb/libusb/io.c
libusb/libusb/strerror.c
libusb/libusb/sync.c
)
set_target_properties(usb PROPERTIES VERSION 1.0.23)
if(WIN32)
target_include_directories(usb
BEFORE
PUBLIC
libusb/libusb
set(LIBUSB_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/libusb")
set(LIBUSB_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libusb")
# Workarounds for MSYS/MinGW
if (MSYS)
# CMake on Windows passes `C:/`, but we need `/C/` or `/c/` to use `configure`
string(REPLACE ":/" "/" LIBUSB_SRC_DIR "${LIBUSB_SRC_DIR}")
set(LIBUSB_SRC_DIR "/${LIBUSB_SRC_DIR}")
PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}"
)
if (NOT MINGW)
target_include_directories(usb BEFORE PRIVATE libusb/msvc)
# And now that we are using /C/ for srcdir but everything else is using C:/, we need to
# compile everything in the source directory, else `configure` won't think the build
# environment is sane.
set(LIBUSB_PREFIX "${LIBUSB_SRC_DIR}")
endif()
# Works around other libraries providing their own definition of USB GUIDs (e.g. SDL2)
target_compile_definitions(usb PRIVATE "-DGUID_DEVINTERFACE_USB_DEVICE=(GUID){ 0xA5DCBF10, 0x6530, 0x11D2, {0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED}}")
else()
target_include_directories(usb
# turns out other projects also have "config.h", so make sure the
# LibUSB one comes first
BEFORE
set(LIBUSB_CONFIGURE "${LIBUSB_SRC_DIR}/configure")
set(LIBUSB_MAKEFILE "${LIBUSB_PREFIX}/Makefile")
set(LIBUSB_LIBRARY "${LIBUSB_PREFIX}/libusb/.libs/libusb-1.0.dll.a")
set(LIBUSB_SHARED_LIBRARY "${LIBUSB_PREFIX}/libusb/.libs/libusb-1.0.dll")
set(LIBUSB_SHARED_LIBRARY_DEST "${CMAKE_BINARY_DIR}/bin/libusb-1.0.dll")
PUBLIC
libusb/libusb
# Causes "externals/libusb/libusb/libusb/os/windows_winusb.c:1427:2: error: conversion to non-scalar type requested", so cannot statically link it for now.
# set(LIBUSB_CFLAGS "-DGUID_DEVINTERFACE_USB_DEVICE=\\(GUID\\){0xA5DCBF10,0x6530,0x11D2,{0x90,0x1F,0x00,0xC0,0x4F,0xB9,0x51,0xED}}")
PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}"
)
endif()
make_directory("${LIBUSB_PREFIX}")
if(WIN32 OR CYGWIN)
target_sources(usb PRIVATE
libusb/libusb/os/threads_windows.c
libusb/libusb/os/windows_winusb.c
libusb/libusb/os/windows_usbdk.c
libusb/libusb/os/windows_nt_common.c
add_custom_command(
OUTPUT
"${LIBUSB_LIBRARY}"
COMMAND
make
WORKING_DIRECTORY
"${LIBUSB_PREFIX}"
)
set(OS_WINDOWS TRUE)
elseif(APPLE)
target_sources(usb PRIVATE
libusb/libusb/os/darwin_usb.c
# We may use this path for other GNU toolchains, so put all of the MinGW-specific stuff here
if (MINGW)
set(LIBUSB_CONFIGURE_ARGS --host=x86_64-w64-mingw32 --build=x86_64-windows)
endif()
add_custom_command(
OUTPUT
"${LIBUSB_MAKEFILE}"
COMMAND
# /bin/env
# CFLAGS="${LIBUSB_CFLAGS}"
/bin/sh "${LIBUSB_CONFIGURE}"
${LIBUSB_CONFIGURE_ARGS}
--srcdir="${LIBUSB_SRC_DIR}"
WORKING_DIRECTORY
"${LIBUSB_PREFIX}"
)
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
find_library(IOKIT_LIBRARY IOKit)
find_library(OBJC_LIBRARY objc)
target_link_libraries(usb PRIVATE
${COREFOUNDATION_LIBRARY}
${IOKIT_LIBRARY}
${OBJC_LIBRARY}
add_custom_command(
OUTPUT
"${LIBUSB_CONFIGURE}"
COMMAND
/bin/sh "${LIBUSB_SRC_DIR}/bootstrap.sh"
WORKING_DIRECTORY
"${LIBUSB_SRC_DIR}"
)
set(OS_DARWIN TRUE)
elseif(ANDROID)
target_sources(usb PRIVATE
libusb/libusb/os/linux_usbfs.c
libusb/libusb/os/linux_netlink.c
add_custom_command(
OUTPUT
"${LIBUSB_SHARED_LIBRARY_DEST}"
COMMAND
/bin/cp "${LIBUSB_SHARED_LIBRARY}" "${LIBUSB_SHARED_LIBRARY_DEST}"
)
find_library(LOG_LIBRARY log)
target_link_libraries(usb PRIVATE ${LOG_LIBRARY})
set(OS_LINUX TRUE)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_sources(usb PRIVATE
libusb/libusb/os/linux_usbfs.c
add_custom_target(usb-bootstrap ALL DEPENDS "${LIBUSB_CONFIGURE}")
add_custom_target(usb-configure ALL DEPENDS "${LIBUSB_MAKEFILE}" usb-bootstrap)
add_custom_target(usb-build ALL DEPENDS "${LIBUSB_LIBRARY}" usb-configure)
# Workaround since static linking didn't work out -- We need to copy the DLL to the bin directory
add_custom_target(usb-copy ALL DEPENDS "${LIBUSB_SHARED_LIBRARY_DEST}" usb-build)
# Make `usb` alias to LIBUSB_LIBRARY
add_library(usb INTERFACE)
target_link_libraries(usb INTERFACE "${LIBUSB_LIBRARY}")
else() # MINGW
# Ensure libusb compiles with UTF-8 encoding on MSVC
if(MSVC)
add_compile_options(/utf-8)
endif()
add_library(usb STATIC EXCLUDE_FROM_ALL
libusb/libusb/core.c
libusb/libusb/core.c
libusb/libusb/descriptor.c
libusb/libusb/hotplug.c
libusb/libusb/io.c
libusb/libusb/strerror.c
libusb/libusb/sync.c
)
find_package(Libudev)
if(LIBUDEV_FOUND)
target_sources(usb PRIVATE
libusb/libusb/os/linux_udev.c
set_target_properties(usb PROPERTIES VERSION 1.0.24)
if(WIN32)
target_include_directories(usb
BEFORE
PUBLIC
libusb/libusb
PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}"
)
target_link_libraries(usb PRIVATE "${LIBUDEV_LIBRARIES}")
target_include_directories(usb PRIVATE "${LIBUDEV_INCLUDE_DIR}")
set(HAVE_LIBUDEV TRUE)
set(USE_UDEV TRUE)
if (NOT MINGW)
target_include_directories(usb BEFORE PRIVATE libusb/msvc)
endif()
# Works around other libraries providing their own definition of USB GUIDs (e.g. SDL2)
target_compile_definitions(usb PRIVATE "-DGUID_DEVINTERFACE_USB_DEVICE=(GUID){ 0xA5DCBF10, 0x6530, 0x11D2, {0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED}}")
else()
target_include_directories(usb
# turns out other projects also have "config.h", so make sure the
# LibUSB one comes first
BEFORE
PUBLIC
libusb/libusb
PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}"
)
endif()
if(WIN32 OR CYGWIN)
target_sources(usb PRIVATE
libusb/libusb/os/threads_windows.c
libusb/libusb/os/windows_winusb.c
libusb/libusb/os/windows_usbdk.c
libusb/libusb/os/windows_common.c
)
set(OS_WINDOWS TRUE)
elseif(APPLE)
target_sources(usb PRIVATE
libusb/libusb/os/darwin_usb.c
)
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
find_library(IOKIT_LIBRARY IOKit)
find_library(OBJC_LIBRARY objc)
target_link_libraries(usb PRIVATE
${COREFOUNDATION_LIBRARY}
${IOKIT_LIBRARY}
${OBJC_LIBRARY}
)
set(OS_DARWIN TRUE)
elseif(ANDROID)
target_sources(usb PRIVATE
libusb/libusb/os/linux_usbfs.c
libusb/libusb/os/linux_netlink.c
)
find_library(LOG_LIBRARY log)
target_link_libraries(usb PRIVATE ${LOG_LIBRARY})
set(OS_LINUX TRUE)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_sources(usb PRIVATE
libusb/libusb/os/linux_usbfs.c
)
find_package(Libudev)
if(LIBUDEV_FOUND)
target_sources(usb PRIVATE
libusb/libusb/os/linux_udev.c
)
target_link_libraries(usb PRIVATE "${LIBUDEV_LIBRARIES}")
target_include_directories(usb PRIVATE "${LIBUDEV_INCLUDE_DIR}")
set(HAVE_LIBUDEV TRUE)
set(USE_UDEV TRUE)
else()
target_sources(usb PRIVATE
libusb/libusb/os/linux_netlink.c
)
endif()
set(OS_LINUX TRUE)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
target_sources(usb PRIVATE
libusb/libusb/os/netbsd_usb.c
)
set(OS_NETBSD TRUE)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
target_sources(usb PRIVATE
libusb/libusb/os/openbsd_usb.c
)
set(OS_OPENBSD TRUE)
endif()
set(OS_LINUX TRUE)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
target_sources(usb PRIVATE
libusb/libusb/os/netbsd_usb.c
)
set(OS_NETBSD TRUE)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
target_sources(usb PRIVATE
libusb/libusb/os/openbsd_usb.c
)
set(OS_OPENBSD TRUE)
endif()
if(UNIX)
target_sources(usb PRIVATE
libusb/libusb/os/poll_posix.c
libusb/libusb/os/threads_posix.c
)
find_package(Threads REQUIRED)
if(THREADS_HAVE_PTHREAD_ARG)
target_compile_options(usb PUBLIC "-pthread")
if(UNIX)
target_sources(usb PRIVATE
libusb/libusb/os/events_posix.c
libusb/libusb/os/threads_posix.c
)
find_package(Threads REQUIRED)
if(THREADS_HAVE_PTHREAD_ARG)
target_compile_options(usb PUBLIC "-pthread")
endif()
if(CMAKE_THREAD_LIBS_INIT)
target_link_libraries(usb PRIVATE "${CMAKE_THREAD_LIBS_INIT}")
endif()
set(THREADS_POSIX TRUE)
elseif(WIN32)
target_sources(usb PRIVATE
libusb/libusb/os/events_windows.c
libusb/libusb/os/threads_windows.c
)
endif()
if(CMAKE_THREAD_LIBS_INIT)
target_link_libraries(usb PRIVATE "${CMAKE_THREAD_LIBS_INIT}")
include(CheckFunctionExists)
include(CheckIncludeFiles)
include(CheckTypeSize)
check_include_files(asm/types.h HAVE_ASM_TYPES_H)
check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
check_include_files(linux/filter.h HAVE_LINUX_FILTER_H)
check_include_files(linux/netlink.h HAVE_LINUX_NETLINK_H)
check_include_files(poll.h HAVE_POLL_H)
check_include_files(signal.h HAVE_SIGNAL_H)
check_include_files(strings.h HAVE_STRINGS_H)
check_type_size("struct timespec" STRUCT_TIMESPEC)
check_function_exists(syslog HAVE_SYSLOG_FUNC)
check_include_files(syslog.h HAVE_SYSLOG_H)
check_include_files(sys/socket.h HAVE_SYS_SOCKET_H)
check_include_files(sys/time.h HAVE_SYS_TIME_H)
check_include_files(sys/types.h HAVE_SYS_TYPES_H)
set(CMAKE_EXTRA_INCLUDE_FILES poll.h)
check_type_size("nfds_t" nfds_t)
unset(CMAKE_EXTRA_INCLUDE_FILES)
if(HAVE_NFDS_T)
set(POLL_NFDS_TYPE "nfds_t")
else()
set(POLL_NFDS_TYPE "unsigned int")
endif()
set(THREADS_POSIX TRUE)
elseif(WIN32)
target_sources(usb PRIVATE
libusb/libusb/os/poll_windows.c
libusb/libusb/os/threads_windows.c
)
endif()
include(CheckFunctionExists)
include(CheckIncludeFiles)
include(CheckTypeSize)
check_include_files(asm/types.h HAVE_ASM_TYPES_H)
check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
check_include_files(linux/filter.h HAVE_LINUX_FILTER_H)
check_include_files(linux/netlink.h HAVE_LINUX_NETLINK_H)
check_include_files(poll.h HAVE_POLL_H)
check_include_files(signal.h HAVE_SIGNAL_H)
check_include_files(strings.h HAVE_STRINGS_H)
check_type_size("struct timespec" STRUCT_TIMESPEC)
check_function_exists(syslog HAVE_SYSLOG_FUNC)
check_include_files(syslog.h HAVE_SYSLOG_H)
check_include_files(sys/socket.h HAVE_SYS_SOCKET_H)
check_include_files(sys/time.h HAVE_SYS_TIME_H)
check_include_files(sys/types.h HAVE_SYS_TYPES_H)
set(CMAKE_EXTRA_INCLUDE_FILES poll.h)
check_type_size("nfds_t" nfds_t)
unset(CMAKE_EXTRA_INCLUDE_FILES)
if(HAVE_NFDS_T)
set(POLL_NFDS_TYPE "nfds_t")
else()
set(POLL_NFDS_TYPE "unsigned int")
endif()
check_include_files(sys/timerfd.h USBI_TIMERFD_AVAILABLE)
check_include_files(sys/timerfd.h USBI_TIMERFD_AVAILABLE)
configure_file(config.h.in config.h)
configure_file(config.h.in config.h)
endif() # MINGW

View File

@@ -197,7 +197,7 @@ ResultCode AudioRenderer::UpdateAudioRenderer(const std::vector<u8>& input_param
ReleaseAndQueueBuffers();
return RESULT_SUCCESS;
return ResultSuccess;
}
void AudioRenderer::QueueMixedBuffer(Buffer::Tag tag) {

View File

@@ -407,7 +407,7 @@ ResultCode InfoUpdater::UpdateMixes(MixContext& mix_context, std::size_t mix_buf
// TODO(ogniK): Sort when splitter is suppoorted
return RESULT_SUCCESS;
return ResultSuccess;
}
bool InfoUpdater::UpdateSinks(SinkContext& sink_context) {

View File

@@ -21,14 +21,14 @@ find_package(Git QUIET)
add_custom_command(OUTPUT scm_rev.cpp
COMMAND ${CMAKE_COMMAND}
-DSRC_DIR="${CMAKE_SOURCE_DIR}"
-DBUILD_REPOSITORY="${BUILD_REPOSITORY}"
-DTITLE_BAR_FORMAT_IDLE="${TITLE_BAR_FORMAT_IDLE}"
-DTITLE_BAR_FORMAT_RUNNING="${TITLE_BAR_FORMAT_RUNNING}"
-DBUILD_TAG="${BUILD_TAG}"
-DBUILD_ID="${DISPLAY_VERSION}"
-DGIT_EXECUTABLE="${GIT_EXECUTABLE}"
-P "${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake"
-DSRC_DIR=${CMAKE_SOURCE_DIR}
-DBUILD_REPOSITORY=${BUILD_REPOSITORY}
-DTITLE_BAR_FORMAT_IDLE=${TITLE_BAR_FORMAT_IDLE}
-DTITLE_BAR_FORMAT_RUNNING=${TITLE_BAR_FORMAT_RUNNING}
-DBUILD_TAG=${BUILD_TAG}
-DBUILD_ID=${DISPLAY_VERSION}
-DGIT_EXECUTABLE=${GIT_EXECUTABLE}
-P ${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake
DEPENDS
# WARNING! It was too much work to try and make a common location for this list,
# so if you need to change it, please update CMakeModules/GenerateSCMRev.cmake as well
@@ -92,6 +92,7 @@ add_custom_command(OUTPUT scm_rev.cpp
"${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.h"
# technically we should regenerate if the git version changed, but its not worth the effort imo
"${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake"
VERBATIM
)
add_library(common STATIC
@@ -154,6 +155,7 @@ add_library(common STATIC
param_package.cpp
param_package.h
parent_of_member.h
point.h
quaternion.h
ring_buffer.h
scm_rev.cpp

View File

@@ -97,17 +97,6 @@ __declspec(dllimport) void __stdcall DebugBreak(void);
return static_cast<T>(key) == 0; \
}
/// Evaluates a boolean expression, and returns a result unless that expression is true.
#define R_UNLESS(expr, res) \
{ \
if (!(expr)) { \
if (res.IsError()) { \
LOG_ERROR(Kernel, "Failed with result: {}", res.raw); \
} \
return res; \
} \
}
#define YUZU_NON_COPYABLE(cls) \
cls(const cls&) = delete; \
cls& operator=(const cls&) = delete
@@ -116,20 +105,6 @@ __declspec(dllimport) void __stdcall DebugBreak(void);
cls(cls&&) = delete; \
cls& operator=(cls&&) = delete
#define R_SUCCEEDED(res) (res.IsSuccess())
/// Evaluates an expression that returns a result, and returns the result if it would fail.
#define R_TRY(res_expr) \
{ \
const auto _tmp_r_try_rc = (res_expr); \
if (_tmp_r_try_rc.IsError()) { \
return _tmp_r_try_rc; \
} \
}
/// Evaluates a boolean expression, and succeeds if that expression is true.
#define R_SUCCEED_IF(expr) R_UNLESS(!(expr), RESULT_SUCCESS)
namespace Common {
[[nodiscard]] constexpr u32 MakeMagic(char a, char b, char c, char d) {

View File

@@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <algorithm>
#include "common/fs/fs_util.h"
namespace Common::FS {
@@ -10,4 +12,16 @@ std::u8string ToU8String(std::string_view utf8_string) {
return std::u8string{utf8_string.begin(), utf8_string.end()};
}
std::u8string BufferToU8String(std::span<const u8> buffer) {
return std::u8string{buffer.begin(), std::ranges::find(buffer, u8{0})};
}
std::string ToUTF8String(std::u8string_view u8_string) {
return std::string{u8_string.begin(), u8_string.end()};
}
std::string PathToUTF8String(const std::filesystem::path& path) {
return ToUTF8String(path.u8string());
}
} // namespace Common::FS

View File

@@ -5,9 +5,13 @@
#pragma once
#include <concepts>
#include <filesystem>
#include <span>
#include <string>
#include <string_view>
#include "common/common_types.h"
namespace Common::FS {
template <typename T>
@@ -22,4 +26,33 @@ concept IsChar = std::same_as<T, char>;
*/
[[nodiscard]] std::u8string ToU8String(std::string_view utf8_string);
/**
* Converts a buffer of bytes to a UTF8-encoded std::u8string.
* This converts from the start of the buffer until the first encountered null-terminator.
* If no null-terminator is found, this converts the entire buffer instead.
*
* @param buffer Buffer of bytes
*
* @returns UTF-8 encoded std::u8string.
*/
[[nodiscard]] std::u8string BufferToU8String(std::span<const u8> buffer);
/**
* Converts a std::u8string or std::u8string_view to a UTF-8 encoded std::string.
*
* @param u8_string UTF-8 encoded u8string
*
* @returns UTF-8 encoded std::string.
*/
[[nodiscard]] std::string ToUTF8String(std::u8string_view u8_string);
/**
* Converts a filesystem path to a UTF-8 encoded std::string.
*
* @param path Filesystem path
*
* @returns UTF-8 encoded std::string.
*/
[[nodiscard]] std::string PathToUTF8String(const std::filesystem::path& path);
} // namespace Common::FS

View File

@@ -129,12 +129,6 @@ private:
std::unordered_map<YuzuPath, fs::path> yuzu_paths;
};
std::string PathToUTF8String(const fs::path& path) {
const auto utf8_string = path.u8string();
return std::string{utf8_string.begin(), utf8_string.end()};
}
bool ValidatePath(const fs::path& path) {
if (path.empty()) {
LOG_ERROR(Common_Filesystem, "Input path is empty, path={}", PathToUTF8String(path));

View File

@@ -25,15 +25,6 @@ enum class YuzuPath {
ShaderDir, // Where shaders are stored.
};
/**
* Converts a filesystem path to a UTF-8 encoded std::string.
*
* @param path Filesystem path
*
* @returns UTF-8 encoded std::string.
*/
[[nodiscard]] std::string PathToUTF8String(const std::filesystem::path& path);
/**
* Validates a given path.
*
@@ -218,7 +209,7 @@ void SetYuzuPath(YuzuPath yuzu_path, const std::filesystem::path& new_path);
#ifdef _WIN32
template <typename Path>
[[nodiscard]] void SetYuzuPath(YuzuPath yuzu_path, const Path& new_path) {
void SetYuzuPath(YuzuPath yuzu_path, const Path& new_path) {
if constexpr (IsChar<typename Path::value_type>) {
SetYuzuPath(yuzu_path, ToU8String(new_path));
} else {

View File

@@ -14,6 +14,7 @@ void PageTable::Resize(size_t address_space_width_in_bits, size_t page_size_in_b
const size_t num_page_table_entries{1ULL << (address_space_width_in_bits - page_size_in_bits)};
pointers.resize(num_page_table_entries);
backing_addr.resize(num_page_table_entries);
current_address_space_width_in_bits = address_space_width_in_bits;
}
} // namespace Common

View File

@@ -98,6 +98,10 @@ struct PageTable {
*/
void Resize(size_t address_space_width_in_bits, size_t page_size_in_bits);
size_t GetAddressSpaceBits() const {
return current_address_space_width_in_bits;
}
/**
* Vector of memory pointers backing each page. An entry can only be non-null if the
* corresponding attribute element is of type `Memory`.
@@ -105,6 +109,8 @@ struct PageTable {
VirtualBuffer<PageInfo> pointers;
VirtualBuffer<u64> backing_addr;
size_t current_address_space_width_in_bits;
};
} // namespace Common

57
src/common/point.h Normal file
View File

@@ -0,0 +1,57 @@
// Copyright 2021 yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <type_traits>
namespace Common {
// Represents a point within a 2D space.
template <typename T>
struct Point {
static_assert(std::is_arithmetic_v<T>, "T must be an arithmetic type!");
T x{};
T y{};
#define ARITHMETIC_OP(op, compound_op) \
friend constexpr Point operator op(const Point& lhs, const Point& rhs) noexcept { \
return { \
.x = static_cast<T>(lhs.x op rhs.x), \
.y = static_cast<T>(lhs.y op rhs.y), \
}; \
} \
friend constexpr Point operator op(const Point& lhs, T value) noexcept { \
return { \
.x = static_cast<T>(lhs.x op value), \
.y = static_cast<T>(lhs.y op value), \
}; \
} \
friend constexpr Point operator op(T value, const Point& rhs) noexcept { \
return { \
.x = static_cast<T>(value op rhs.x), \
.y = static_cast<T>(value op rhs.y), \
}; \
} \
friend constexpr Point& operator compound_op(Point& lhs, const Point& rhs) noexcept { \
lhs.x = static_cast<T>(lhs.x op rhs.x); \
lhs.y = static_cast<T>(lhs.y op rhs.y); \
return lhs; \
} \
friend constexpr Point& operator compound_op(Point& lhs, T value) noexcept { \
lhs.x = static_cast<T>(lhs.x op value); \
lhs.y = static_cast<T>(lhs.y op value); \
return lhs; \
}
ARITHMETIC_OP(+, +=)
ARITHMETIC_OP(-, -=)
ARITHMETIC_OP(*, *=)
ARITHMETIC_OP(/, /=)
#undef ARITHMETIC_OP
friend constexpr bool operator==(const Point&, const Point&) = default;
};
} // namespace Common

View File

@@ -65,9 +65,6 @@ public:
/// Step CPU by one instruction
virtual void Step() = 0;
/// Exits execution from a callback, the callback must rewind the stack
virtual void ExceptionalExit() = 0;
/// Clear all instruction cache
virtual void ClearInstructionCache() = 0;

View File

@@ -4,9 +4,9 @@
#include <cinttypes>
#include <memory>
#include <dynarmic/A32/a32.h>
#include <dynarmic/A32/config.h>
#include <dynarmic/A32/context.h>
#include <dynarmic/interface/A32/a32.h>
#include <dynarmic/interface/A32/config.h>
#include <dynarmic/interface/A32/context.h>
#include "common/assert.h"
#include "common/logging/log.h"
#include "common/page_table.h"
@@ -24,45 +24,46 @@ namespace Core {
class DynarmicCallbacks32 : public Dynarmic::A32::UserCallbacks {
public:
explicit DynarmicCallbacks32(ARM_Dynarmic_32& parent_) : parent{parent_} {}
explicit DynarmicCallbacks32(ARM_Dynarmic_32& parent_)
: parent{parent_}, memory(parent.system.Memory()) {}
u8 MemoryRead8(u32 vaddr) override {
return parent.system.Memory().Read8(vaddr);
return memory.Read8(vaddr);
}
u16 MemoryRead16(u32 vaddr) override {
return parent.system.Memory().Read16(vaddr);
return memory.Read16(vaddr);
}
u32 MemoryRead32(u32 vaddr) override {
return parent.system.Memory().Read32(vaddr);
return memory.Read32(vaddr);
}
u64 MemoryRead64(u32 vaddr) override {
return parent.system.Memory().Read64(vaddr);
return memory.Read64(vaddr);
}
void MemoryWrite8(u32 vaddr, u8 value) override {
parent.system.Memory().Write8(vaddr, value);
memory.Write8(vaddr, value);
}
void MemoryWrite16(u32 vaddr, u16 value) override {
parent.system.Memory().Write16(vaddr, value);
memory.Write16(vaddr, value);
}
void MemoryWrite32(u32 vaddr, u32 value) override {
parent.system.Memory().Write32(vaddr, value);
memory.Write32(vaddr, value);
}
void MemoryWrite64(u32 vaddr, u64 value) override {
parent.system.Memory().Write64(vaddr, value);
memory.Write64(vaddr, value);
}
bool MemoryWriteExclusive8(u32 vaddr, u8 value, u8 expected) override {
return parent.system.Memory().WriteExclusive8(vaddr, value, expected);
return memory.WriteExclusive8(vaddr, value, expected);
}
bool MemoryWriteExclusive16(u32 vaddr, u16 value, u16 expected) override {
return parent.system.Memory().WriteExclusive16(vaddr, value, expected);
return memory.WriteExclusive16(vaddr, value, expected);
}
bool MemoryWriteExclusive32(u32 vaddr, u32 value, u32 expected) override {
return parent.system.Memory().WriteExclusive32(vaddr, value, expected);
return memory.WriteExclusive32(vaddr, value, expected);
}
bool MemoryWriteExclusive64(u32 vaddr, u64 value, u64 expected) override {
return parent.system.Memory().WriteExclusive64(vaddr, value, expected);
return memory.WriteExclusive64(vaddr, value, expected);
}
void InterpreterFallback(u32 pc, std::size_t num_instructions) override {
@@ -78,7 +79,9 @@ public:
}
void CallSVC(u32 swi) override {
Kernel::Svc::Call(parent.system, swi);
parent.svc_called = true;
parent.svc_swi = swi;
parent.jit->HaltExecution();
}
void AddTicks(u64 ticks) override {
@@ -110,6 +113,7 @@ public:
}
ARM_Dynarmic_32& parent;
Core::Memory::Memory& memory;
std::size_t num_interpreted_instructions{};
static constexpr u64 minimum_run_cycles = 1000U;
};
@@ -187,11 +191,17 @@ std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable*
}
void ARM_Dynarmic_32::Run() {
jit->Run();
}
void ARM_Dynarmic_32::ExceptionalExit() {
jit->ExceptionalExit();
while (true) {
jit->Run();
if (!svc_called) {
break;
}
svc_called = false;
Kernel::Svc::Call(system, svc_swi);
if (shutdown) {
break;
}
}
}
void ARM_Dynarmic_32::Step() {
@@ -275,6 +285,7 @@ void ARM_Dynarmic_32::LoadContext(const ThreadContext32& ctx) {
void ARM_Dynarmic_32::PrepareReschedule() {
jit->HaltExecution();
shutdown = true;
}
void ARM_Dynarmic_32::ClearInstructionCache() {

View File

@@ -7,9 +7,9 @@
#include <memory>
#include <unordered_map>
#include <dynarmic/A32/a32.h>
#include <dynarmic/A64/a64.h>
#include <dynarmic/exclusive_monitor.h>
#include <dynarmic/interface/A32/a32.h>
#include <dynarmic/interface/A64/a64.h>
#include <dynarmic/interface/exclusive_monitor.h>
#include "common/common_types.h"
#include "common/hash.h"
#include "core/arm/arm_interface.h"
@@ -42,7 +42,6 @@ public:
u32 GetPSTATE() const override;
void SetPSTATE(u32 pstate) override;
void Run() override;
void ExceptionalExit() override;
void Step() override;
VAddr GetTlsAddress() const override;
void SetTlsAddress(VAddr address) override;
@@ -82,6 +81,12 @@ private:
std::size_t core_index;
DynarmicExclusiveMonitor& exclusive_monitor;
std::shared_ptr<Dynarmic::A32::Jit> jit;
// SVC callback
u32 svc_swi{};
bool svc_called{};
bool shutdown{};
};
} // namespace Core

View File

@@ -4,8 +4,8 @@
#include <cinttypes>
#include <memory>
#include <dynarmic/A64/a64.h>
#include <dynarmic/A64/config.h>
#include <dynarmic/interface/A64/a64.h>
#include <dynarmic/interface/A64/config.h>
#include "common/assert.h"
#include "common/logging/log.h"
#include "common/page_table.h"
@@ -27,57 +27,56 @@ using Vector = Dynarmic::A64::Vector;
class DynarmicCallbacks64 : public Dynarmic::A64::UserCallbacks {
public:
explicit DynarmicCallbacks64(ARM_Dynarmic_64& parent_) : parent{parent_} {}
explicit DynarmicCallbacks64(ARM_Dynarmic_64& parent_)
: parent{parent_}, memory(parent.system.Memory()) {}
u8 MemoryRead8(u64 vaddr) override {
return parent.system.Memory().Read8(vaddr);
return memory.Read8(vaddr);
}
u16 MemoryRead16(u64 vaddr) override {
return parent.system.Memory().Read16(vaddr);
return memory.Read16(vaddr);
}
u32 MemoryRead32(u64 vaddr) override {
return parent.system.Memory().Read32(vaddr);
return memory.Read32(vaddr);
}
u64 MemoryRead64(u64 vaddr) override {
return parent.system.Memory().Read64(vaddr);
return memory.Read64(vaddr);
}
Vector MemoryRead128(u64 vaddr) override {
auto& memory = parent.system.Memory();
return {memory.Read64(vaddr), memory.Read64(vaddr + 8)};
}
void MemoryWrite8(u64 vaddr, u8 value) override {
parent.system.Memory().Write8(vaddr, value);
memory.Write8(vaddr, value);
}
void MemoryWrite16(u64 vaddr, u16 value) override {
parent.system.Memory().Write16(vaddr, value);
memory.Write16(vaddr, value);
}
void MemoryWrite32(u64 vaddr, u32 value) override {
parent.system.Memory().Write32(vaddr, value);
memory.Write32(vaddr, value);
}
void MemoryWrite64(u64 vaddr, u64 value) override {
parent.system.Memory().Write64(vaddr, value);
memory.Write64(vaddr, value);
}
void MemoryWrite128(u64 vaddr, Vector value) override {
auto& memory = parent.system.Memory();
memory.Write64(vaddr, value[0]);
memory.Write64(vaddr + 8, value[1]);
}
bool MemoryWriteExclusive8(u64 vaddr, std::uint8_t value, std::uint8_t expected) override {
return parent.system.Memory().WriteExclusive8(vaddr, value, expected);
return memory.WriteExclusive8(vaddr, value, expected);
}
bool MemoryWriteExclusive16(u64 vaddr, std::uint16_t value, std::uint16_t expected) override {
return parent.system.Memory().WriteExclusive16(vaddr, value, expected);
return memory.WriteExclusive16(vaddr, value, expected);
}
bool MemoryWriteExclusive32(u64 vaddr, std::uint32_t value, std::uint32_t expected) override {
return parent.system.Memory().WriteExclusive32(vaddr, value, expected);
return memory.WriteExclusive32(vaddr, value, expected);
}
bool MemoryWriteExclusive64(u64 vaddr, std::uint64_t value, std::uint64_t expected) override {
return parent.system.Memory().WriteExclusive64(vaddr, value, expected);
return memory.WriteExclusive64(vaddr, value, expected);
}
bool MemoryWriteExclusive128(u64 vaddr, Vector value, Vector expected) override {
return parent.system.Memory().WriteExclusive128(vaddr, value, expected);
return memory.WriteExclusive128(vaddr, value, expected);
}
void InterpreterFallback(u64 pc, std::size_t num_instructions) override {
@@ -102,7 +101,9 @@ public:
}
void CallSVC(u32 swi) override {
Kernel::Svc::Call(parent.system, swi);
parent.svc_called = true;
parent.svc_swi = swi;
parent.jit->HaltExecution();
}
void AddTicks(u64 ticks) override {
@@ -137,6 +138,7 @@ public:
}
ARM_Dynarmic_64& parent;
Core::Memory::Memory& memory;
u64 tpidrro_el0 = 0;
u64 tpidr_el0 = 0;
static constexpr u64 minimum_run_cycles = 1000U;
@@ -227,11 +229,17 @@ std::shared_ptr<Dynarmic::A64::Jit> ARM_Dynarmic_64::MakeJit(Common::PageTable*
}
void ARM_Dynarmic_64::Run() {
jit->Run();
}
void ARM_Dynarmic_64::ExceptionalExit() {
jit->ExceptionalExit();
while (true) {
jit->Run();
if (!svc_called) {
break;
}
svc_called = false;
Kernel::Svc::Call(system, svc_swi);
if (shutdown) {
break;
}
}
}
void ARM_Dynarmic_64::Step() {
@@ -320,6 +328,7 @@ void ARM_Dynarmic_64::LoadContext(const ThreadContext64& ctx) {
void ARM_Dynarmic_64::PrepareReschedule() {
jit->HaltExecution();
shutdown = true;
}
void ARM_Dynarmic_64::ClearInstructionCache() {

View File

@@ -7,7 +7,7 @@
#include <memory>
#include <unordered_map>
#include <dynarmic/A64/a64.h>
#include <dynarmic/interface/A64/a64.h>
#include "common/common_types.h"
#include "common/hash.h"
#include "core/arm/arm_interface.h"
@@ -40,7 +40,6 @@ public:
void SetPSTATE(u32 pstate) override;
void Run() override;
void Step() override;
void ExceptionalExit() override;
VAddr GetTlsAddress() const override;
void SetTlsAddress(VAddr address) override;
void SetTPIDR_EL0(u64 value) override;
@@ -75,6 +74,12 @@ private:
DynarmicExclusiveMonitor& exclusive_monitor;
std::shared_ptr<Dynarmic::A64::Jit> jit;
// SVC callback
u32 svc_swi{};
bool svc_called{};
bool shutdown{};
};
} // namespace Core

View File

@@ -7,7 +7,7 @@
#include <memory>
#include <optional>
#include <dynarmic/A32/coprocessor.h>
#include <dynarmic/interface/A32/coprocessor.h>
#include "common/common_types.h"
namespace Core {

View File

@@ -7,7 +7,7 @@
#include <memory>
#include <unordered_map>
#include <dynarmic/exclusive_monitor.h>
#include <dynarmic/interface/exclusive_monitor.h>
#include "common/common_types.h"
#include "core/arm/dynarmic/arm_dynarmic_32.h"

View File

@@ -53,7 +53,7 @@ ResultVal<VirtualFile> RomFSFactory::OpenPatchedRomFS(u64 title_id, ContentRecor
if (nca == nullptr) {
// TODO: Find the right error code to use here
return RESULT_UNKNOWN;
return ResultUnknown;
}
const PatchManager patch_manager{title_id, filesystem_controller, content_provider};
@@ -74,13 +74,13 @@ ResultVal<VirtualFile> RomFSFactory::Open(u64 title_id, StorageId storage,
const std::shared_ptr<NCA> res = GetEntry(title_id, storage, type);
if (res == nullptr) {
// TODO(DarkLordZach): Find the right error code to use here
return RESULT_UNKNOWN;
return ResultUnknown;
}
const auto romfs = res->GetRomFS();
if (romfs == nullptr) {
// TODO(DarkLordZach): Find the right error code to use here
return RESULT_UNKNOWN;
return ResultUnknown;
}
return MakeResult<VirtualFile>(romfs);

View File

@@ -91,7 +91,7 @@ ResultVal<VirtualDir> SaveDataFactory::Create(SaveDataSpaceId space,
// Return an error if the save data doesn't actually exist.
if (out == nullptr) {
// TODO(DarkLordZach): Find out correct error code.
return RESULT_UNKNOWN;
return ResultUnknown;
}
return MakeResult<VirtualDir>(std::move(out));
@@ -105,14 +105,14 @@ ResultVal<VirtualDir> SaveDataFactory::Open(SaveDataSpaceId space,
auto out = dir->GetDirectoryRelative(save_directory);
if (out == nullptr && ShouldSaveDataBeAutomaticallyCreated(space, meta)) {
if (out == nullptr && (ShouldSaveDataBeAutomaticallyCreated(space, meta) && auto_create)) {
return Create(space, meta);
}
// Return an error if the save data doesn't actually exist.
if (out == nullptr) {
// TODO(Subv): Find out correct error code.
return RESULT_UNKNOWN;
return ResultUnknown;
}
return MakeResult<VirtualDir>(std::move(out));
@@ -199,4 +199,8 @@ void SaveDataFactory::WriteSaveDataSize(SaveDataType type, u64 title_id, u128 us
size_file->WriteObject(new_value);
}
void SaveDataFactory::SetAutoCreate(bool state) {
auto_create = state;
}
} // namespace FileSys

View File

@@ -104,9 +104,12 @@ public:
void WriteSaveDataSize(SaveDataType type, u64 title_id, u128 user_id,
SaveDataSize new_value) const;
void SetAutoCreate(bool state);
private:
VirtualDir dir;
Core::System& system;
bool auto_create{true};
};
} // namespace FileSys

View File

@@ -27,6 +27,10 @@ struct AnalogProperties {
float range;
float threshold;
};
template <typename StatusType>
struct InputCallback {
std::function<void(StatusType)> on_change;
};
/// An abstract class template for an input device (a button, an analog input, etc.).
template <typename StatusType>
@@ -50,6 +54,17 @@ public:
[[maybe_unused]] f32 freq_high) const {
return {};
}
void SetCallback(InputCallback<StatusType> callback_) {
callback = std::move(callback_);
}
void TriggerOnChange() {
if (callback.on_change) {
callback.on_change(GetStatus());
}
}
private:
InputCallback<StatusType> callback;
};
/// An abstract class template for a factory that can create input devices.

View File

@@ -30,16 +30,38 @@
namespace Kernel {
SessionRequestHandler::SessionRequestHandler() = default;
SessionRequestHandler::SessionRequestHandler(KernelCore& kernel_, const char* service_name_)
: kernel{kernel_}, service_thread{kernel.CreateServiceThread(service_name_)} {}
SessionRequestHandler::~SessionRequestHandler() = default;
SessionRequestHandler::~SessionRequestHandler() {
kernel.ReleaseServiceThread(service_thread);
}
SessionRequestManager::SessionRequestManager(KernelCore& kernel_) : kernel{kernel_} {}
SessionRequestManager::~SessionRequestManager() = default;
bool SessionRequestManager::HasSessionRequestHandler(const HLERequestContext& context) const {
if (IsDomain() && context.HasDomainMessageHeader()) {
const auto& message_header = context.GetDomainMessageHeader();
const auto object_id = message_header.object_id;
if (object_id > DomainHandlerCount()) {
LOG_CRITICAL(IPC, "object_id {} is too big!", object_id);
return false;
}
return DomainHandler(object_id - 1) != nullptr;
} else {
return session_handler != nullptr;
}
}
void SessionRequestHandler::ClientConnected(KServerSession* session) {
session->SetSessionHandler(shared_from_this());
session->ClientConnected(shared_from_this());
}
void SessionRequestHandler::ClientDisconnected(KServerSession* session) {
session->SetSessionHandler(nullptr);
session->ClientDisconnected();
}
HLERequestContext::HLERequestContext(KernelCore& kernel_, Core::Memory::Memory& memory_,
@@ -169,12 +191,12 @@ ResultCode HLERequestContext::PopulateFromIncomingCommandBuffer(const KHandleTab
if (command_header->IsCloseCommand()) {
// Close does not populate the rest of the IPC header
return RESULT_SUCCESS;
return ResultSuccess;
}
std::copy_n(src_cmdbuf, IPC::COMMAND_BUFFER_LENGTH, cmd_buf.begin());
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(KThread& requesting_thread) {
@@ -216,7 +238,7 @@ ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(KThread& requesting_t
memory.WriteBlock(owner_process, requesting_thread.GetTLSAddress(), cmd_buf.data(),
write_size * sizeof(u32));
return RESULT_SUCCESS;
return ResultSuccess;
}
std::vector<u8> HLERequestContext::ReadBuffer(std::size_t buffer_index) const {

View File

@@ -46,6 +46,7 @@ class KThread;
class KReadableEvent;
class KSession;
class KWritableEvent;
class ServiceThread;
enum class ThreadWakeupReason;
@@ -56,7 +57,7 @@ enum class ThreadWakeupReason;
*/
class SessionRequestHandler : public std::enable_shared_from_this<SessionRequestHandler> {
public:
SessionRequestHandler();
SessionRequestHandler(KernelCore& kernel, const char* service_name_);
virtual ~SessionRequestHandler();
/**
@@ -83,6 +84,14 @@ public:
* @param server_session ServerSession associated with the connection.
*/
void ClientDisconnected(KServerSession* session);
std::weak_ptr<ServiceThread> GetServiceThread() const {
return service_thread;
}
protected:
KernelCore& kernel;
std::weak_ptr<ServiceThread> service_thread;
};
using SessionRequestHandlerPtr = std::shared_ptr<SessionRequestHandler>;
@@ -94,7 +103,8 @@ using SessionRequestHandlerPtr = std::shared_ptr<SessionRequestHandler>;
*/
class SessionRequestManager final {
public:
SessionRequestManager() = default;
explicit SessionRequestManager(KernelCore& kernel);
~SessionRequestManager();
bool IsDomain() const {
return is_domain;
@@ -142,10 +152,19 @@ public:
session_handler = std::move(handler);
}
std::weak_ptr<ServiceThread> GetServiceThread() const {
return session_handler->GetServiceThread();
}
bool HasSessionRequestHandler(const HLERequestContext& context) const;
private:
bool is_domain{};
SessionRequestHandlerPtr session_handler;
std::vector<SessionRequestHandlerPtr> domain_handlers;
private:
KernelCore& kernel;
};
/**

View File

@@ -97,7 +97,7 @@ ResultCode KAddressArbiter::Signal(VAddr addr, s32 count) {
while ((it != thread_tree.end()) && (count <= 0 || num_waiters < count) &&
(it->GetAddressArbiterKey() == addr)) {
KThread* target_thread = std::addressof(*it);
target_thread->SetSyncedObject(nullptr, RESULT_SUCCESS);
target_thread->SetSyncedObject(nullptr, ResultSuccess);
ASSERT(target_thread->IsWaitingForAddressArbiter());
target_thread->Wakeup();
@@ -107,7 +107,7 @@ ResultCode KAddressArbiter::Signal(VAddr addr, s32 count) {
++num_waiters;
}
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KAddressArbiter::SignalAndIncrementIfEqual(VAddr addr, s32 value, s32 count) {
@@ -130,7 +130,7 @@ ResultCode KAddressArbiter::SignalAndIncrementIfEqual(VAddr addr, s32 value, s32
while ((it != thread_tree.end()) && (count <= 0 || num_waiters < count) &&
(it->GetAddressArbiterKey() == addr)) {
KThread* target_thread = std::addressof(*it);
target_thread->SetSyncedObject(nullptr, RESULT_SUCCESS);
target_thread->SetSyncedObject(nullptr, ResultSuccess);
ASSERT(target_thread->IsWaitingForAddressArbiter());
target_thread->Wakeup();
@@ -140,7 +140,7 @@ ResultCode KAddressArbiter::SignalAndIncrementIfEqual(VAddr addr, s32 value, s32
++num_waiters;
}
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KAddressArbiter::SignalAndModifyByWaitingCountIfEqual(VAddr addr, s32 value, s32 count) {
@@ -198,7 +198,7 @@ ResultCode KAddressArbiter::SignalAndModifyByWaitingCountIfEqual(VAddr addr, s32
while ((it != thread_tree.end()) && (count <= 0 || num_waiters < count) &&
(it->GetAddressArbiterKey() == addr)) {
KThread* target_thread = std::addressof(*it);
target_thread->SetSyncedObject(nullptr, RESULT_SUCCESS);
target_thread->SetSyncedObject(nullptr, ResultSuccess);
ASSERT(target_thread->IsWaitingForAddressArbiter());
target_thread->Wakeup();
@@ -208,7 +208,7 @@ ResultCode KAddressArbiter::SignalAndModifyByWaitingCountIfEqual(VAddr addr, s32
++num_waiters;
}
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KAddressArbiter::WaitIfLessThan(VAddr addr, s32 value, bool decrement, s64 timeout) {

View File

@@ -37,7 +37,7 @@ public:
return SignalAndModifyByWaitingCountIfEqual(addr, value, count);
}
UNREACHABLE();
return RESULT_UNKNOWN;
return ResultUnknown;
}
[[nodiscard]] ResultCode WaitForAddress(VAddr addr, Svc::ArbitrationType type, s32 value,
@@ -51,7 +51,7 @@ public:
return WaitIfEqual(addr, value, timeout);
}
UNREACHABLE();
return RESULT_UNKNOWN;
return ResultUnknown;
}
private:

View File

@@ -7,10 +7,11 @@
#include <atomic>
#include <string>
#include <boost/intrusive/rbtree.hpp>
#include "common/assert.h"
#include "common/common_funcs.h"
#include "common/common_types.h"
#include "common/intrusive_red_black_tree.h"
#include "core/hle/kernel/k_class_token.h"
namespace Kernel {
@@ -175,7 +176,7 @@ private:
class KAutoObjectWithListContainer;
class KAutoObjectWithList : public KAutoObject {
class KAutoObjectWithList : public KAutoObject, public boost::intrusive::set_base_hook<> {
public:
explicit KAutoObjectWithList(KernelCore& kernel_) : KAutoObject(kernel_) {}
@@ -192,6 +193,10 @@ public:
}
}
friend bool operator<(const KAutoObjectWithList& left, const KAutoObjectWithList& right) {
return &left < &right;
}
public:
virtual u64 GetId() const {
return reinterpret_cast<u64>(this);
@@ -203,8 +208,6 @@ public:
private:
friend class KAutoObjectWithListContainer;
Common::IntrusiveRedBlackTreeNode list_node;
};
template <typename T>

View File

@@ -9,13 +9,13 @@ namespace Kernel {
void KAutoObjectWithListContainer::Register(KAutoObjectWithList* obj) {
KScopedLightLock lk(m_lock);
m_object_list.insert(*obj);
m_object_list.insert_unique(*obj);
}
void KAutoObjectWithListContainer::Unregister(KAutoObjectWithList* obj) {
KScopedLightLock lk(m_lock);
m_object_list.erase(m_object_list.iterator_to(*obj));
m_object_list.erase(*obj);
}
size_t KAutoObjectWithListContainer::GetOwnedCount(KProcess* owner) {

View File

@@ -6,6 +6,8 @@
#include <atomic>
#include <boost/intrusive/rbtree.hpp>
#include "common/assert.h"
#include "common/common_funcs.h"
#include "common/common_types.h"
@@ -23,8 +25,7 @@ class KAutoObjectWithListContainer {
YUZU_NON_MOVEABLE(KAutoObjectWithListContainer);
public:
using ListType = Common::IntrusiveRedBlackTreeMemberTraits<
&KAutoObjectWithList::list_node>::TreeType<KAutoObjectWithList>;
using ListType = boost::intrusive::rbtree<KAutoObjectWithList>;
public:
class ListAccessor : public KScopedLightLock {

View File

@@ -84,50 +84,43 @@ static_assert(ClassToken<KTransferMemory> == ((0b10010001 << 8) | ClassToken<KAu
// Ensure that the token hierarchy reflects the class hierarchy.
// Base classes.
static_assert(!std::is_final<KSynchronizationObject>::value &&
std::is_base_of<KAutoObject, KSynchronizationObject>::value);
static_assert(!std::is_final<KReadableEvent>::value &&
std::is_base_of<KSynchronizationObject, KReadableEvent>::value);
static_assert(!std::is_final_v<KSynchronizationObject> &&
std::is_base_of_v<KAutoObject, KSynchronizationObject>);
static_assert(!std::is_final_v<KReadableEvent> &&
std::is_base_of_v<KSynchronizationObject, KReadableEvent>);
// Final classes
// static_assert(std::is_final<KInterruptEvent>::value &&
// std::is_base_of<KReadableEvent, KInterruptEvent>::value);
// static_assert(std::is_final<KDebug>::value &&
// std::is_base_of<KSynchronizationObject, KDebug>::value);
static_assert(std::is_final<KThread>::value &&
std::is_base_of<KSynchronizationObject, KThread>::value);
static_assert(std::is_final<KServerPort>::value &&
std::is_base_of<KSynchronizationObject, KServerPort>::value);
static_assert(std::is_final<KServerSession>::value &&
std::is_base_of<KSynchronizationObject, KServerSession>::value);
static_assert(std::is_final<KClientPort>::value &&
std::is_base_of<KSynchronizationObject, KClientPort>::value);
static_assert(std::is_final<KClientSession>::value &&
std::is_base_of<KAutoObject, KClientSession>::value);
static_assert(std::is_final<KProcess>::value &&
std::is_base_of<KSynchronizationObject, KProcess>::value);
static_assert(std::is_final<KResourceLimit>::value &&
std::is_base_of<KAutoObject, KResourceLimit>::value);
// static_assert(std::is_final<KLightSession>::value &&
// std::is_base_of<KAutoObject, KLightSession>::value);
static_assert(std::is_final<KPort>::value && std::is_base_of<KAutoObject, KPort>::value);
static_assert(std::is_final<KSession>::value && std::is_base_of<KAutoObject, KSession>::value);
static_assert(std::is_final<KSharedMemory>::value &&
std::is_base_of<KAutoObject, KSharedMemory>::value);
static_assert(std::is_final<KEvent>::value && std::is_base_of<KAutoObject, KEvent>::value);
static_assert(std::is_final<KWritableEvent>::value &&
std::is_base_of<KAutoObject, KWritableEvent>::value);
// static_assert(std::is_final<KLightClientSession>::value &&
// std::is_base_of<KAutoObject, KLightClientSession>::value);
// static_assert(std::is_final<KLightServerSession>::value &&
// std::is_base_of<KAutoObject, KLightServerSession>::value);
static_assert(std::is_final<KTransferMemory>::value &&
std::is_base_of<KAutoObject, KTransferMemory>::value);
// static_assert(std::is_final<KDeviceAddressSpace>::value &&
// std::is_base_of<KAutoObject, KDeviceAddressSpace>::value);
// static_assert(std::is_final<KSessionRequest>::value &&
// std::is_base_of<KAutoObject, KSessionRequest>::value);
// static_assert(std::is_final<KCodeMemory>::value &&
// std::is_base_of<KAutoObject, KCodeMemory>::value);
// static_assert(std::is_final_v<KInterruptEvent> &&
// std::is_base_of_v<KReadableEvent, KInterruptEvent>);
// static_assert(std::is_final_v<KDebug> &&
// std::is_base_of_v<KSynchronizationObject, KDebug>);
static_assert(std::is_final_v<KThread> && std::is_base_of_v<KSynchronizationObject, KThread>);
static_assert(std::is_final_v<KServerPort> &&
std::is_base_of_v<KSynchronizationObject, KServerPort>);
static_assert(std::is_final_v<KServerSession> &&
std::is_base_of_v<KSynchronizationObject, KServerSession>);
static_assert(std::is_final_v<KClientPort> &&
std::is_base_of_v<KSynchronizationObject, KClientPort>);
static_assert(std::is_final_v<KClientSession> && std::is_base_of_v<KAutoObject, KClientSession>);
static_assert(std::is_final_v<KProcess> && std::is_base_of_v<KSynchronizationObject, KProcess>);
static_assert(std::is_final_v<KResourceLimit> && std::is_base_of_v<KAutoObject, KResourceLimit>);
// static_assert(std::is_final_v<KLightSession> &&
// std::is_base_of_v<KAutoObject, KLightSession>);
static_assert(std::is_final_v<KPort> && std::is_base_of_v<KAutoObject, KPort>);
static_assert(std::is_final_v<KSession> && std::is_base_of_v<KAutoObject, KSession>);
static_assert(std::is_final_v<KSharedMemory> && std::is_base_of_v<KAutoObject, KSharedMemory>);
static_assert(std::is_final_v<KEvent> && std::is_base_of_v<KAutoObject, KEvent>);
static_assert(std::is_final_v<KWritableEvent> && std::is_base_of_v<KAutoObject, KWritableEvent>);
// static_assert(std::is_final_v<KLightClientSession> &&
// std::is_base_of_v<KAutoObject, KLightClientSession>);
// static_assert(std::is_final_v<KLightServerSession> &&
// std::is_base_of_v<KAutoObject, KLightServerSession>);
static_assert(std::is_final_v<KTransferMemory> && std::is_base_of_v<KAutoObject, KTransferMemory>);
// static_assert(std::is_final_v<KDeviceAddressSpace> &&
// std::is_base_of_v<KAutoObject, KDeviceAddressSpace>);
// static_assert(std::is_final_v<KSessionRequest> &&
// std::is_base_of_v<KAutoObject, KSessionRequest>);
// static_assert(std::is_final_v<KCodeMemory> &&
// std::is_base_of_v<KAutoObject, KCodeMemory>);
} // namespace Kernel

View File

@@ -16,11 +16,11 @@ namespace Kernel {
KClientPort::KClientPort(KernelCore& kernel_) : KSynchronizationObject{kernel_} {}
KClientPort::~KClientPort() = default;
void KClientPort::Initialize(KPort* parent_, s32 max_sessions_, std::string&& name_) {
void KClientPort::Initialize(KPort* parent_port_, s32 max_sessions_, std::string&& name_) {
// Set member variables.
num_sessions = 0;
peak_sessions = 0;
parent = parent_;
parent = parent_port_;
max_sessions = max_sessions_;
name = std::move(name_);
}
@@ -28,6 +28,9 @@ void KClientPort::Initialize(KPort* parent_, s32 max_sessions_, std::string&& na
void KClientPort::OnSessionFinalized() {
KScopedSchedulerLock sl{kernel};
// This might happen if a session was improperly used with this port.
ASSERT_MSG(num_sessions > 0, "num_sessions is invalid");
const auto prev = num_sessions--;
if (prev == max_sessions) {
this->NotifyAvailable();
@@ -56,7 +59,8 @@ bool KClientPort::IsSignaled() const {
return num_sessions < max_sessions;
}
ResultCode KClientPort::CreateSession(KClientSession** out) {
ResultCode KClientPort::CreateSession(KClientSession** out,
std::shared_ptr<SessionRequestManager> session_manager) {
// Reserve a new session from the resource limit.
KScopedResourceReservation session_reservation(kernel.CurrentProcess()->GetResourceLimit(),
LimitableResource::Sessions);
@@ -65,7 +69,7 @@ ResultCode KClientPort::CreateSession(KClientSession** out) {
// Update the session counts.
{
// Atomically increment the number of sessions.
s32 new_sessions;
s32 new_sessions{};
{
const auto max = max_sessions;
auto cur_sessions = num_sessions.load(std::memory_order_acquire);
@@ -101,7 +105,7 @@ ResultCode KClientPort::CreateSession(KClientSession** out) {
}
// Initialize the session.
session->Initialize(this, parent->GetName());
session->Initialize(this, parent->GetName(), session_manager);
// Commit the session reservation.
session_reservation.Commit();
@@ -119,7 +123,7 @@ ResultCode KClientPort::CreateSession(KClientSession** out) {
// We succeeded, so set the output.
session_guard.Cancel();
*out = std::addressof(session->GetClientSession());
return RESULT_SUCCESS;
return ResultSuccess;
}
} // namespace Kernel

View File

@@ -16,6 +16,7 @@ namespace Kernel {
class KClientSession;
class KernelCore;
class KPort;
class SessionRequestManager;
class KClientPort final : public KSynchronizationObject {
KERNEL_AUTOOBJECT_TRAITS(KClientPort, KSynchronizationObject);
@@ -52,7 +53,8 @@ public:
void Destroy() override;
bool IsSignaled() const override;
ResultCode CreateSession(KClientSession** out);
ResultCode CreateSession(KClientSession** out,
std::shared_ptr<SessionRequestManager> session_manager = nullptr);
private:
std::atomic<s32> num_sessions{};

View File

@@ -36,9 +36,9 @@ public:
explicit KClientSession(KernelCore& kernel_);
~KClientSession() override;
void Initialize(KSession* parent_, std::string&& name_) {
void Initialize(KSession* parent_session_, std::string&& name_) {
// Set member variables.
parent = parent_;
parent = parent_session_;
name = std::move(name_);
}

View File

@@ -86,7 +86,7 @@ ResultCode KConditionVariable::SignalToAddress(VAddr addr) {
next_value |= Svc::HandleWaitMask;
}
next_owner_thread->SetSyncedObject(nullptr, RESULT_SUCCESS);
next_owner_thread->SetSyncedObject(nullptr, ResultSuccess);
next_owner_thread->Wakeup();
}
@@ -100,7 +100,7 @@ ResultCode KConditionVariable::SignalToAddress(VAddr addr) {
}
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KConditionVariable::WaitForAddress(Handle handle, VAddr addr, u32 value) {
@@ -112,7 +112,7 @@ ResultCode KConditionVariable::WaitForAddress(Handle handle, VAddr addr, u32 val
ASSERT(owner_thread.IsNull());
{
KScopedSchedulerLock sl(kernel);
cur_thread->SetSyncedObject(nullptr, RESULT_SUCCESS);
cur_thread->SetSyncedObject(nullptr, ResultSuccess);
// Check if the thread should terminate.
R_UNLESS(!cur_thread->IsTerminationRequested(), ResultTerminationRequested);
@@ -124,7 +124,7 @@ ResultCode KConditionVariable::WaitForAddress(Handle handle, VAddr addr, u32 val
ResultInvalidCurrentMemory);
// If the tag isn't the handle (with wait mask), we're done.
R_UNLESS(test_tag == (handle | Svc::HandleWaitMask), RESULT_SUCCESS);
R_UNLESS(test_tag == (handle | Svc::HandleWaitMask), ResultSuccess);
// Get the lock owner thread.
owner_thread =
@@ -181,7 +181,7 @@ KThread* KConditionVariable::SignalImpl(KThread* thread) {
if (can_access) {
if (prev_tag == Svc::InvalidHandle) {
// If nobody held the lock previously, we're all good.
thread->SetSyncedObject(nullptr, RESULT_SUCCESS);
thread->SetSyncedObject(nullptr, ResultSuccess);
thread->Wakeup();
} else {
// Get the previous owner.
@@ -292,7 +292,7 @@ ResultCode KConditionVariable::Wait(VAddr addr, u64 key, u32 value, s64 timeout)
}
// Wake up the next owner.
next_owner_thread->SetSyncedObject(nullptr, RESULT_SUCCESS);
next_owner_thread->SetSyncedObject(nullptr, ResultSuccess);
next_owner_thread->Wakeup();
}

View File

@@ -25,7 +25,7 @@ ResultCode KHandleTable::Finalize() {
}
}
return RESULT_SUCCESS;
return ResultSuccess;
}
bool KHandleTable::Remove(Handle handle) {
@@ -79,7 +79,7 @@ ResultCode KHandleTable::Add(Handle* out_handle, KAutoObject* obj, u16 type) {
*out_handle = EncodeHandle(static_cast<u16>(index), linear_id);
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KHandleTable::Reserve(Handle* out_handle) {
@@ -89,7 +89,7 @@ ResultCode KHandleTable::Reserve(Handle* out_handle) {
R_UNLESS(m_count < m_table_size, ResultOutOfHandles);
*out_handle = EncodeHandle(static_cast<u16>(this->AllocateEntry()), this->AllocateLinearId());
return RESULT_SUCCESS;
return ResultSuccess;
}
void KHandleTable::Unreserve(Handle handle) {

View File

@@ -50,7 +50,7 @@ public:
m_free_head_index = i;
}
return RESULT_SUCCESS;
return ResultSuccess;
}
size_t GetTableSize() const {

View File

@@ -86,7 +86,7 @@ ResultCode KMemoryManager::Allocate(KPageLinkedList& page_list, std::size_t num_
// Early return if we're allocating no pages
if (num_pages == 0) {
return RESULT_SUCCESS;
return ResultSuccess;
}
// Lock the pool that we're allocating from
@@ -146,14 +146,14 @@ ResultCode KMemoryManager::Allocate(KPageLinkedList& page_list, std::size_t num_
// We succeeded!
group_guard.Cancel();
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KMemoryManager::Free(KPageLinkedList& page_list, std::size_t num_pages, Pool pool,
Direction dir) {
// Early return if we're freeing no pages
if (!num_pages) {
return RESULT_SUCCESS;
return ResultSuccess;
}
// Lock the pool that we're freeing from
@@ -170,7 +170,7 @@ ResultCode KMemoryManager::Free(KPageLinkedList& page_list, std::size_t num_page
chosen_manager.Free(it.GetAddress(), min_num_pages);
}
return RESULT_SUCCESS;
return ResultSuccess;
}
std::size_t KMemoryManager::Impl::CalculateManagementOverheadSize(std::size_t region_size) {

View File

@@ -71,7 +71,7 @@ public:
ResultCode AddBlock(u64 address, u64 num_pages) {
if (!num_pages) {
return RESULT_SUCCESS;
return ResultSuccess;
}
if (!nodes.empty()) {
const auto node = nodes.back();
@@ -82,7 +82,7 @@ public:
}
}
nodes.push_back({address, num_pages});
return RESULT_SUCCESS;
return ResultSuccess;
}
private:

View File

@@ -292,7 +292,7 @@ ResultCode KPageTable::MapProcessCode(VAddr addr, std::size_t num_pages, KMemory
block_manager->Update(addr, num_pages, state, perm);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::MapProcessCodeMemory(VAddr dst_addr, VAddr src_addr, std::size_t size) {
@@ -329,14 +329,14 @@ ResultCode KPageTable::MapProcessCodeMemory(VAddr dst_addr, VAddr src_addr, std:
KMemoryAttribute::Locked);
block_manager->Update(dst_addr, num_pages, KMemoryState::AliasCode);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::UnmapProcessCodeMemory(VAddr dst_addr, VAddr src_addr, std::size_t size) {
std::lock_guard lock{page_table_lock};
if (!size) {
return RESULT_SUCCESS;
return ResultSuccess;
}
const std::size_t num_pages{size / PageSize};
@@ -360,7 +360,7 @@ ResultCode KPageTable::UnmapProcessCodeMemory(VAddr dst_addr, VAddr src_addr, st
block_manager->Update(src_addr, num_pages, KMemoryState::Normal,
KMemoryPermission::ReadAndWrite);
return RESULT_SUCCESS;
return ResultSuccess;
}
void KPageTable::MapPhysicalMemory(KPageLinkedList& page_linked_list, VAddr start, VAddr end) {
@@ -408,7 +408,7 @@ ResultCode KPageTable::MapPhysicalMemory(VAddr addr, std::size_t size) {
});
if (mapped_size == size) {
return RESULT_SUCCESS;
return ResultSuccess;
}
const std::size_t remaining_size{size - mapped_size};
@@ -440,14 +440,14 @@ ResultCode KPageTable::MapPhysicalMemory(VAddr addr, std::size_t size) {
KMemoryAttribute::None, KMemoryState::Normal,
KMemoryPermission::ReadAndWrite, KMemoryAttribute::None);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::UnmapPhysicalMemory(VAddr addr, std::size_t size) {
std::lock_guard lock{page_table_lock};
const VAddr end_addr{addr + size};
ResultCode result{RESULT_SUCCESS};
ResultCode result{ResultSuccess};
std::size_t mapped_size{};
// Verify that the region can be unmapped
@@ -468,7 +468,7 @@ ResultCode KPageTable::UnmapPhysicalMemory(VAddr addr, std::size_t size) {
}
if (!mapped_size) {
return RESULT_SUCCESS;
return ResultSuccess;
}
CASCADE_CODE(UnmapMemory(addr, size));
@@ -477,14 +477,14 @@ ResultCode KPageTable::UnmapPhysicalMemory(VAddr addr, std::size_t size) {
process->GetResourceLimit()->Release(LimitableResource::PhysicalMemory, mapped_size);
physical_memory_usage -= mapped_size;
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::UnmapMemory(VAddr addr, std::size_t size) {
std::lock_guard lock{page_table_lock};
const VAddr end_addr{addr + size};
ResultCode result{RESULT_SUCCESS};
ResultCode result{ResultSuccess};
KPageLinkedList page_linked_list;
// Unmap each region within the range
@@ -513,7 +513,7 @@ ResultCode KPageTable::UnmapMemory(VAddr addr, std::size_t size) {
block_manager->Update(addr, num_pages, KMemoryState::Free);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::Map(VAddr dst_addr, VAddr src_addr, std::size_t size) {
@@ -552,7 +552,7 @@ ResultCode KPageTable::Map(VAddr dst_addr, VAddr src_addr, std::size_t size) {
block_manager->Update(dst_addr, num_pages, KMemoryState::Stack,
KMemoryPermission::ReadAndWrite);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::Unmap(VAddr dst_addr, VAddr src_addr, std::size_t size) {
@@ -594,7 +594,7 @@ ResultCode KPageTable::Unmap(VAddr dst_addr, VAddr src_addr, std::size_t size) {
block_manager->Update(src_addr, num_pages, src_state, KMemoryPermission::ReadAndWrite);
block_manager->Update(dst_addr, num_pages, KMemoryState::Free);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::MapPages(VAddr addr, const KPageLinkedList& page_linked_list,
@@ -616,7 +616,7 @@ ResultCode KPageTable::MapPages(VAddr addr, const KPageLinkedList& page_linked_l
cur_addr += node.GetNumPages() * PageSize;
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::MapPages(VAddr addr, KPageLinkedList& page_linked_list, KMemoryState state,
@@ -638,7 +638,7 @@ ResultCode KPageTable::MapPages(VAddr addr, KPageLinkedList& page_linked_list, K
block_manager->Update(addr, num_pages, state, perm);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::UnmapPages(VAddr addr, const KPageLinkedList& page_linked_list) {
@@ -655,7 +655,7 @@ ResultCode KPageTable::UnmapPages(VAddr addr, const KPageLinkedList& page_linked
cur_addr += node.GetNumPages() * PageSize;
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::UnmapPages(VAddr addr, KPageLinkedList& page_linked_list,
@@ -677,7 +677,7 @@ ResultCode KPageTable::UnmapPages(VAddr addr, KPageLinkedList& page_linked_list,
block_manager->Update(addr, num_pages, state, KMemoryPermission::None);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::SetCodeMemoryPermission(VAddr addr, std::size_t size,
@@ -708,7 +708,7 @@ ResultCode KPageTable::SetCodeMemoryPermission(VAddr addr, std::size_t size,
// Return early if there is nothing to change
if (state == prev_state && perm == prev_perm) {
return RESULT_SUCCESS;
return ResultSuccess;
}
if ((prev_perm & KMemoryPermission::Execute) != (perm & KMemoryPermission::Execute)) {
@@ -725,7 +725,7 @@ ResultCode KPageTable::SetCodeMemoryPermission(VAddr addr, std::size_t size,
block_manager->Update(addr, num_pages, state, perm);
return RESULT_SUCCESS;
return ResultSuccess;
}
KMemoryInfo KPageTable::QueryInfoImpl(VAddr addr) {
@@ -758,7 +758,7 @@ ResultCode KPageTable::ReserveTransferMemory(VAddr addr, std::size_t size, KMemo
block_manager->Update(addr, size / PageSize, state, perm, attribute | KMemoryAttribute::Locked);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::ResetTransferMemory(VAddr addr, std::size_t size) {
@@ -775,7 +775,7 @@ ResultCode KPageTable::ResetTransferMemory(VAddr addr, std::size_t size) {
block_manager->Update(addr, size / PageSize, state, KMemoryPermission::ReadAndWrite);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::SetMemoryAttribute(VAddr addr, std::size_t size, KMemoryAttribute mask,
@@ -797,13 +797,13 @@ ResultCode KPageTable::SetMemoryAttribute(VAddr addr, std::size_t size, KMemoryA
block_manager->Update(addr, size / PageSize, state, perm, attribute);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::SetHeapCapacity(std::size_t new_heap_capacity) {
std::lock_guard lock{page_table_lock};
heap_capacity = new_heap_capacity;
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultVal<VAddr> KPageTable::SetHeapSize(std::size_t size) {
@@ -911,7 +911,7 @@ ResultCode KPageTable::LockForDeviceAddressSpace(VAddr addr, std::size_t size) {
},
perm);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::UnlockForDeviceAddressSpace(VAddr addr, std::size_t size) {
@@ -934,13 +934,13 @@ ResultCode KPageTable::UnlockForDeviceAddressSpace(VAddr addr, std::size_t size)
},
perm);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::InitializeMemoryLayout(VAddr start, VAddr end) {
block_manager = std::make_unique<KMemoryBlockManager>(start, end);
return RESULT_SUCCESS;
return ResultSuccess;
}
bool KPageTable::IsRegionMapped(VAddr address, u64 size) {
@@ -1006,7 +1006,7 @@ ResultCode KPageTable::Operate(VAddr addr, std::size_t num_pages, const KPageLin
addr += size;
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::Operate(VAddr addr, std::size_t num_pages, KMemoryPermission perm,
@@ -1033,7 +1033,7 @@ ResultCode KPageTable::Operate(VAddr addr, std::size_t num_pages, KMemoryPermiss
default:
UNREACHABLE();
}
return RESULT_SUCCESS;
return ResultSuccess;
}
constexpr VAddr KPageTable::GetRegionAddress(KMemoryState state) const {
@@ -1164,7 +1164,7 @@ constexpr ResultCode KPageTable::CheckMemoryState(const KMemoryInfo& info, KMemo
return ResultInvalidCurrentMemory;
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::CheckMemoryState(KMemoryState* out_state, KMemoryPermission* out_perm,
@@ -1223,7 +1223,7 @@ ResultCode KPageTable::CheckMemoryState(KMemoryState* out_state, KMemoryPermissi
*out_attr = first_attr & static_cast<KMemoryAttribute>(~ignore_attr);
}
return RESULT_SUCCESS;
return ResultSuccess;
}
} // namespace Kernel

View File

@@ -59,7 +59,7 @@ ResultCode KPort::EnqueueSession(KServerSession* session) {
server.EnqueueSession(session);
server.GetSessionRequestHandler()->ClientConnected(server.AcceptSession());
return RESULT_SUCCESS;
return ResultSuccess;
}
} // namespace Kernel

View File

@@ -142,7 +142,7 @@ ResultCode KProcess::Initialize(KProcess* process, Core::System& system, std::st
// Open a reference to the resource limit.
process->resource_limit->Open();
return RESULT_SUCCESS;
return ResultSuccess;
}
KResourceLimit* KProcess::GetResourceLimit() const {
@@ -258,7 +258,7 @@ ResultCode KProcess::AddSharedMemory(KSharedMemory* shmem, [[maybe_unused]] VAdd
// Open a reference to the shared memory.
shmem->Open();
return RESULT_SUCCESS;
return ResultSuccess;
}
void KProcess::RemoveSharedMemory(KSharedMemory* shmem, [[maybe_unused]] VAddr address,
@@ -291,7 +291,7 @@ ResultCode KProcess::Reset() {
// Clear signaled.
is_signaled = false;
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KProcess::LoadFromMetadata(const FileSys::ProgramMetadata& metadata,
@@ -524,7 +524,7 @@ ResultCode KProcess::AllocateMainThreadStack(std::size_t stack_size) {
main_thread_stack_top += main_thread_stack_size;
return RESULT_SUCCESS;
return ResultSuccess;
}
} // namespace Kernel

View File

@@ -310,7 +310,7 @@ public:
*
* @param metadata The provided metadata to load process specific info from.
*
* @returns RESULT_SUCCESS if all relevant metadata was able to be
* @returns ResultSuccess if all relevant metadata was able to be
* loaded and parsed. Otherwise, an error code is returned.
*/
ResultCode LoadFromMetadata(const FileSys::ProgramMetadata& metadata, std::size_t code_size);

View File

@@ -36,13 +36,13 @@ ResultCode KReadableEvent::Signal() {
NotifyAvailable();
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KReadableEvent::Clear() {
Reset();
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KReadableEvent::Reset() {
@@ -53,7 +53,7 @@ ResultCode KReadableEvent::Reset() {
}
is_signaled = false;
return RESULT_SUCCESS;
return ResultSuccess;
}
} // namespace Kernel

View File

@@ -21,9 +21,9 @@ public:
explicit KReadableEvent(KernelCore& kernel_);
~KReadableEvent() override;
void Initialize(KEvent* parent_, std::string&& name_) {
void Initialize(KEvent* parent_event_, std::string&& name_) {
is_signaled = false;
parent = parent_;
parent = parent_event_;
name = std::move(name_);
}

View File

@@ -80,7 +80,7 @@ ResultCode KResourceLimit::SetLimitValue(LimitableResource which, s64 value) {
limit_values[index] = value;
return RESULT_SUCCESS;
return ResultSuccess;
}
bool KResourceLimit::Reserve(LimitableResource which, s64 value) {

View File

@@ -659,7 +659,6 @@ void KScheduler::Unload(KThread* thread) {
if (thread) {
if (thread->IsCallingSvc()) {
system.ArmInterface(core_id).ExceptionalExit();
thread->ClearIsCallingSvc();
}
if (!thread->IsTerminationRequested()) {

View File

@@ -17,9 +17,9 @@ namespace Kernel {
KServerPort::KServerPort(KernelCore& kernel_) : KSynchronizationObject{kernel_} {}
KServerPort::~KServerPort() = default;
void KServerPort::Initialize(KPort* parent_, std::string&& name_) {
void KServerPort::Initialize(KPort* parent_port_, std::string&& name_) {
// Set member variables.
parent = parent_;
parent = parent_port_;
name = std::move(name_);
}

View File

@@ -29,7 +29,7 @@ public:
explicit KServerPort(KernelCore& kernel_);
~KServerPort() override;
void Initialize(KPort* parent_, std::string&& name_);
void Initialize(KPort* parent_port_, std::string&& name_);
/// Whether or not this server port has an HLE handler available.
bool HasSessionRequestHandler() const {

View File

@@ -8,13 +8,16 @@
#include "common/assert.h"
#include "common/common_types.h"
#include "common/logging/log.h"
#include "common/scope_exit.h"
#include "core/core_timing.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/hle_ipc.h"
#include "core/hle/kernel/k_client_port.h"
#include "core/hle/kernel/k_handle_table.h"
#include "core/hle/kernel/k_port.h"
#include "core/hle/kernel/k_process.h"
#include "core/hle/kernel/k_scheduler.h"
#include "core/hle/kernel/k_server_port.h"
#include "core/hle/kernel/k_server_session.h"
#include "core/hle/kernel/k_session.h"
#include "core/hle/kernel/k_thread.h"
@@ -23,18 +26,21 @@
namespace Kernel {
KServerSession::KServerSession(KernelCore& kernel_)
: KSynchronizationObject{kernel_}, manager{std::make_shared<SessionRequestManager>()} {}
KServerSession::KServerSession(KernelCore& kernel_) : KSynchronizationObject{kernel_} {}
KServerSession::~KServerSession() {
kernel.ReleaseServiceThread(service_thread);
}
KServerSession::~KServerSession() {}
void KServerSession::Initialize(KSession* parent_, std::string&& name_) {
void KServerSession::Initialize(KSession* parent_session_, std::string&& name_,
std::shared_ptr<SessionRequestManager> manager_) {
// Set member variables.
parent = parent_;
parent = parent_session_;
name = std::move(name_);
service_thread = kernel.CreateServiceThread(name);
if (manager_) {
manager = manager_;
} else {
manager = std::make_shared<SessionRequestManager>(kernel);
}
}
void KServerSession::Destroy() {
@@ -71,7 +77,7 @@ std::size_t KServerSession::NumDomainRequestHandlers() const {
ResultCode KServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& context) {
if (!context.HasDomainMessageHeader()) {
return RESULT_SUCCESS;
return ResultSuccess;
}
// Set domain handlers in HLE context, used for domain objects (IPC interfaces) as inputs
@@ -88,7 +94,7 @@ ResultCode KServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& co
"to {} needed to return a new interface!",
object_id, name);
UNREACHABLE();
return RESULT_SUCCESS; // Ignore error if asserts are off
return ResultSuccess; // Ignore error if asserts are off
}
return manager->DomainHandler(object_id - 1)->HandleSyncRequest(*this, context);
@@ -98,14 +104,14 @@ ResultCode KServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& co
manager->CloseDomainHandler(object_id - 1);
IPC::ResponseBuilder rb{context, 2};
rb.Push(RESULT_SUCCESS);
return RESULT_SUCCESS;
rb.Push(ResultSuccess);
return ResultSuccess;
}
}
LOG_CRITICAL(IPC, "Unknown domain command={}", domain_message_header.command.Value());
ASSERT(false);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KServerSession::QueueSyncRequest(KThread* thread, Core::Memory::Memory& memory) {
@@ -114,23 +120,46 @@ ResultCode KServerSession::QueueSyncRequest(KThread* thread, Core::Memory::Memor
context->PopulateFromIncomingCommandBuffer(kernel.CurrentProcess()->GetHandleTable(), cmd_buf);
if (auto strong_ptr = service_thread.lock()) {
strong_ptr->QueueSyncRequest(*parent, std::move(context));
return RESULT_SUCCESS;
// In the event that something fails here, stub a result to prevent the game from crashing.
// This is a work-around in the event that somehow we process a service request after the
// session has been closed by the game. This has been observed to happen rarely in Pokemon
// Sword/Shield and is likely a result of us using host threads/scheduling for services.
// TODO(bunnei): Find a better solution here.
auto error_guard = SCOPE_GUARD({ CompleteSyncRequest(*context); });
// Ensure we have a session request handler
if (manager->HasSessionRequestHandler(*context)) {
if (auto strong_ptr = manager->GetServiceThread().lock()) {
strong_ptr->QueueSyncRequest(*parent, std::move(context));
// We succeeded.
error_guard.Cancel();
} else {
ASSERT_MSG(false, "strong_ptr is nullptr!");
}
} else {
ASSERT_MSG(false, "handler is invalid!");
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KServerSession::CompleteSyncRequest(HLERequestContext& context) {
ResultCode result = RESULT_SUCCESS;
ResultCode result = ResultSuccess;
// If the session has been converted to a domain, handle the domain request
if (IsDomain() && context.HasDomainMessageHeader()) {
result = HandleDomainSyncRequest(context);
// If there is no domain header, the regular session handler is used
} else if (manager->HasSessionHandler()) {
// If this ServerSession has an associated HLE handler, forward the request to it.
result = manager->SessionHandler().HandleSyncRequest(*this, context);
if (manager->HasSessionRequestHandler(context)) {
if (IsDomain() && context.HasDomainMessageHeader()) {
result = HandleDomainSyncRequest(context);
// If there is no domain header, the regular session handler is used
} else if (manager->HasSessionHandler()) {
// If this ServerSession has an associated HLE handler, forward the request to it.
result = manager->SessionHandler().HandleSyncRequest(*this, context);
}
} else {
ASSERT_MSG(false, "Session handler is invalid, stubbing response!");
IPC::ResponseBuilder rb(context, 2);
rb.Push(ResultSuccess);
}
if (convert_to_domain) {

View File

@@ -32,6 +32,7 @@ class HLERequestContext;
class KernelCore;
class KSession;
class SessionRequestHandler;
class SessionRequestManager;
class KThread;
class KServerSession final : public KSynchronizationObject,
@@ -46,7 +47,8 @@ public:
void Destroy() override;
void Initialize(KSession* parent_, std::string&& name_);
void Initialize(KSession* parent_session_, std::string&& name_,
std::shared_ptr<SessionRequestManager> manager_);
KSession* GetParent() {
return parent;
@@ -60,15 +62,14 @@ public:
void OnClientClosed();
/**
* Sets the HLE handler for the session. This handler will be called to service IPC requests
* instead of the regular IPC machinery. (The regular IPC machinery is currently not
* implemented.)
*/
void SetSessionHandler(SessionRequestHandlerPtr handler) {
void ClientConnected(SessionRequestHandlerPtr handler) {
manager->SetSessionHandler(std::move(handler));
}
void ClientDisconnected() {
manager = nullptr;
}
/**
* Handle a sync request from the emulated application.
*
@@ -104,16 +105,6 @@ public:
return manager;
}
/// Gets the session request manager, which forwards requests to the underlying service
const std::shared_ptr<SessionRequestManager>& GetSessionRequestManager() const {
return manager;
}
/// Sets the session request manager, which forwards requests to the underlying service
void SetSessionRequestManager(std::shared_ptr<SessionRequestManager> manager_) {
manager = std::move(manager_);
}
private:
/// Queues a sync request from the emulated application.
ResultCode QueueSyncRequest(KThread* thread, Core::Memory::Memory& memory);
@@ -131,9 +122,6 @@ private:
/// When set to True, converts the session to a domain at the end of the command
bool convert_to_domain{};
/// Thread to dispatch service requests
std::weak_ptr<ServiceThread> service_thread;
/// KSession that owns this KServerSession
KSession* parent{};
};

View File

@@ -15,7 +15,8 @@ KSession::KSession(KernelCore& kernel_)
: KAutoObjectWithSlabHeapAndContainer{kernel_}, server{kernel_}, client{kernel_} {}
KSession::~KSession() = default;
void KSession::Initialize(KClientPort* port_, const std::string& name_) {
void KSession::Initialize(KClientPort* port_, const std::string& name_,
std::shared_ptr<SessionRequestManager> manager_) {
// Increment reference count.
// Because reference count is one on creation, this will result
// in a reference count of two. Thus, when both server and client are closed
@@ -27,7 +28,7 @@ void KSession::Initialize(KClientPort* port_, const std::string& name_) {
KAutoObject::Create(std::addressof(client));
// Initialize our sub sessions.
server.Initialize(this, name_ + ":Server");
server.Initialize(this, name_ + ":Server", manager_);
client.Initialize(this, name_ + ":Client");
// Set state and name.

View File

@@ -13,6 +13,8 @@
namespace Kernel {
class SessionRequestManager;
class KSession final : public KAutoObjectWithSlabHeapAndContainer<KSession, KAutoObjectWithList> {
KERNEL_AUTOOBJECT_TRAITS(KSession, KAutoObject);
@@ -20,7 +22,8 @@ public:
explicit KSession(KernelCore& kernel_);
~KSession() override;
void Initialize(KClientPort* port_, const std::string& name_);
void Initialize(KClientPort* port_, const std::string& name_,
std::shared_ptr<SessionRequestManager> manager_ = nullptr);
void Finalize() override;

View File

@@ -55,7 +55,7 @@ ResultCode KSharedMemory::Initialize(Core::DeviceMemory& device_memory_, KProces
// Clear all pages in the memory.
std::memset(device_memory_.GetPointer(physical_address_), 0, size_);
return RESULT_SUCCESS;
return ResultSuccess;
}
void KSharedMemory::Finalize() {

View File

@@ -4,34 +4,213 @@
#pragma once
#include <atomic>
#include "common/assert.h"
#include "common/common_types.h"
namespace Kernel {
class KernelCore;
/// This is a placeholder class to manage slab heaps for kernel objects. For now, we just allocate
/// these with new/delete, but this can be re-implemented later to allocate these in emulated
/// memory.
namespace impl {
class KSlabHeapImpl final : NonCopyable {
public:
struct Node {
Node* next{};
};
constexpr KSlabHeapImpl() = default;
void Initialize(std::size_t size) {
ASSERT(head == nullptr);
obj_size = size;
}
constexpr std::size_t GetObjectSize() const {
return obj_size;
}
Node* GetHead() const {
return head;
}
void* Allocate() {
Node* ret = head.load();
do {
if (ret == nullptr) {
break;
}
} while (!head.compare_exchange_weak(ret, ret->next));
return ret;
}
void Free(void* obj) {
Node* node = static_cast<Node*>(obj);
Node* cur_head = head.load();
do {
node->next = cur_head;
} while (!head.compare_exchange_weak(cur_head, node));
}
private:
std::atomic<Node*> head{};
std::size_t obj_size{};
};
} // namespace impl
class KSlabHeapBase : NonCopyable {
public:
constexpr KSlabHeapBase() = default;
constexpr bool Contains(uintptr_t addr) const {
return start <= addr && addr < end;
}
constexpr std::size_t GetSlabHeapSize() const {
return (end - start) / GetObjectSize();
}
constexpr std::size_t GetObjectSize() const {
return impl.GetObjectSize();
}
constexpr uintptr_t GetSlabHeapAddress() const {
return start;
}
std::size_t GetObjectIndexImpl(const void* obj) const {
return (reinterpret_cast<uintptr_t>(obj) - start) / GetObjectSize();
}
std::size_t GetPeakIndex() const {
return GetObjectIndexImpl(reinterpret_cast<const void*>(peak));
}
void* AllocateImpl() {
return impl.Allocate();
}
void FreeImpl(void* obj) {
// Don't allow freeing an object that wasn't allocated from this heap
ASSERT(Contains(reinterpret_cast<uintptr_t>(obj)));
impl.Free(obj);
}
void InitializeImpl(std::size_t obj_size, void* memory, std::size_t memory_size) {
// Ensure we don't initialize a slab using null memory
ASSERT(memory != nullptr);
// Initialize the base allocator
impl.Initialize(obj_size);
// Set our tracking variables
const std::size_t num_obj = (memory_size / obj_size);
start = reinterpret_cast<uintptr_t>(memory);
end = start + num_obj * obj_size;
peak = start;
// Free the objects
u8* cur = reinterpret_cast<u8*>(end);
for (std::size_t i{}; i < num_obj; i++) {
cur -= obj_size;
impl.Free(cur);
}
}
private:
using Impl = impl::KSlabHeapImpl;
Impl impl;
uintptr_t peak{};
uintptr_t start{};
uintptr_t end{};
};
template <typename T>
class KSlabHeap final : NonCopyable {
class KSlabHeap final : public KSlabHeapBase {
public:
KSlabHeap() = default;
enum class AllocationType {
Host,
Guest,
};
void Initialize([[maybe_unused]] void* memory, [[maybe_unused]] std::size_t memory_size) {
// Placeholder that should initialize the backing slab heap implementation.
explicit constexpr KSlabHeap(AllocationType allocation_type_ = AllocationType::Host)
: KSlabHeapBase(), allocation_type{allocation_type_} {}
void Initialize(void* memory, std::size_t memory_size) {
if (allocation_type == AllocationType::Guest) {
InitializeImpl(sizeof(T), memory, memory_size);
}
}
T* Allocate() {
return new T();
switch (allocation_type) {
case AllocationType::Host:
// Fallback for cases where we do not yet support allocating guest memory from the slab
// heap, such as for kernel memory regions.
return new T;
case AllocationType::Guest:
T* obj = static_cast<T*>(AllocateImpl());
if (obj != nullptr) {
new (obj) T();
}
return obj;
}
UNREACHABLE_MSG("Invalid AllocationType {}", allocation_type);
return nullptr;
}
T* AllocateWithKernel(KernelCore& kernel) {
return new T(kernel);
switch (allocation_type) {
case AllocationType::Host:
// Fallback for cases where we do not yet support allocating guest memory from the slab
// heap, such as for kernel memory regions.
return new T(kernel);
case AllocationType::Guest:
T* obj = static_cast<T*>(AllocateImpl());
if (obj != nullptr) {
new (obj) T(kernel);
}
return obj;
}
UNREACHABLE_MSG("Invalid AllocationType {}", allocation_type);
return nullptr;
}
void Free(T* obj) {
delete obj;
switch (allocation_type) {
case AllocationType::Host:
// Fallback for cases where we do not yet support allocating guest memory from the slab
// heap, such as for kernel memory regions.
delete obj;
return;
case AllocationType::Guest:
FreeImpl(obj);
return;
}
UNREACHABLE_MSG("Invalid AllocationType {}", allocation_type);
}
constexpr std::size_t GetObjectIndex(const T* obj) const {
return GetObjectIndexImpl(obj);
}
private:
const AllocationType allocation_type;
};
} // namespace Kernel

View File

@@ -38,7 +38,7 @@ ResultCode KSynchronizationObject::Wait(KernelCore& kernel_ctx, s32* out_index,
if (objects[i]->IsSignaled()) {
*out_index = i;
slp.CancelSleep();
return RESULT_SUCCESS;
return ResultSuccess;
}
}
@@ -97,7 +97,7 @@ ResultCode KSynchronizationObject::Wait(KernelCore& kernel_ctx, s32* out_index,
kernel_ctx.TimeManager().UnscheduleTimeEvent(thread);
// Get the wait result.
ResultCode wait_result{RESULT_SUCCESS};
ResultCode wait_result{ResultSuccess};
s32 sync_index = -1;
{
KScopedSchedulerLock lock(kernel_ctx);

View File

@@ -43,7 +43,7 @@ protected:
void NotifyAvailable(ResultCode result);
void NotifyAvailable() {
return this->NotifyAvailable(RESULT_SUCCESS);
return this->NotifyAvailable(ResultSuccess);
}
private:

View File

@@ -168,13 +168,13 @@ ResultCode KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_s
std::memset(static_cast<void*>(std::addressof(GetStackParameters())), 0,
sizeof(StackParameters));
// Setup the TLS, if needed.
if (type == ThreadType::User) {
tls_address = owner->CreateTLSRegion();
}
// Set parent, if relevant.
if (owner != nullptr) {
// Setup the TLS, if needed.
if (type == ThreadType::User) {
tls_address = owner->CreateTLSRegion();
}
parent = owner;
parent->Open();
parent->IncrementThreadCount();
@@ -205,7 +205,7 @@ ResultCode KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_s
}
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KThread::InitializeThread(KThread* thread, KThreadFunction func, uintptr_t arg,
@@ -219,7 +219,7 @@ ResultCode KThread::InitializeThread(KThread* thread, KThreadFunction func, uint
thread->host_context =
std::make_shared<Common::Fiber>(std::move(init_func), init_func_parameter);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KThread::InitializeDummyThread(KThread* thread) {
@@ -460,7 +460,7 @@ ResultCode KThread::GetCoreMask(s32* out_ideal_core, u64* out_affinity_mask) {
*out_ideal_core = virtual_ideal_core_id;
*out_affinity_mask = virtual_affinity_mask;
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KThread::GetPhysicalCoreMask(s32* out_ideal_core, u64* out_affinity_mask) {
@@ -476,7 +476,7 @@ ResultCode KThread::GetPhysicalCoreMask(s32* out_ideal_core, u64* out_affinity_m
*out_affinity_mask = original_physical_affinity_mask.GetAffinityMask();
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KThread::SetCoreMask(s32 cpu_core_id, u64 v_affinity_mask) {
@@ -599,7 +599,7 @@ ResultCode KThread::SetCoreMask(s32 cpu_core_id, u64 v_affinity_mask) {
}
}
return RESULT_SUCCESS;
return ResultSuccess;
}
void KThread::SetBasePriority(s32 value) {
@@ -778,7 +778,7 @@ ResultCode KThread::SetActivity(Svc::ThreadActivity activity) {
}
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KThread::GetThreadContext3(std::vector<u8>& out) {
@@ -813,7 +813,7 @@ ResultCode KThread::GetThreadContext3(std::vector<u8>& out) {
}
}
return RESULT_SUCCESS;
return ResultSuccess;
}
void KThread::AddWaiterImpl(KThread* thread) {
@@ -970,7 +970,7 @@ ResultCode KThread::Run() {
// Set our state and finish.
SetState(ThreadState::Runnable);
return RESULT_SUCCESS;
return ResultSuccess;
}
}
@@ -1020,7 +1020,7 @@ ResultCode KThread::Sleep(s64 timeout) {
// Cancel the timer.
kernel.TimeManager().UnscheduleTimeEvent(this);
return RESULT_SUCCESS;
return ResultSuccess;
}
void KThread::SetState(ThreadState state) {

View File

@@ -684,7 +684,7 @@ private:
u32 address_key_value{};
u32 suspend_request_flags{};
u32 suspend_allowed_flags{};
ResultCode wait_result{RESULT_SUCCESS};
ResultCode wait_result{ResultSuccess};
s32 base_priority{};
s32 physical_ideal_core_id{};
s32 virtual_ideal_core_id{};

View File

@@ -28,7 +28,7 @@ ResultCode KTransferMemory::Initialize(VAddr address_, std::size_t size_,
size = size_;
is_initialized = true;
return RESULT_SUCCESS;
return ResultSuccess;
}
void KTransferMemory::Finalize() {

View File

@@ -13,8 +13,8 @@ KWritableEvent::KWritableEvent(KernelCore& kernel_)
KWritableEvent::~KWritableEvent() = default;
void KWritableEvent::Initialize(KEvent* parent_, std::string&& name_) {
parent = parent_;
void KWritableEvent::Initialize(KEvent* parent_event_, std::string&& name_) {
parent = parent_event_;
name = std::move(name_);
parent->GetReadableEvent().Open();
}

View File

@@ -63,8 +63,6 @@ struct KernelCore::Impl {
global_scheduler_context = std::make_unique<Kernel::GlobalSchedulerContext>(kernel);
global_handle_table = std::make_unique<Kernel::KHandleTable>(kernel);
service_thread_manager =
std::make_unique<Common::ThreadWorker>(1, "yuzu:ServiceThreadManager");
is_phantom_mode_for_singlecore = false;
InitializePhysicalCores();
@@ -96,7 +94,6 @@ struct KernelCore::Impl {
process_list.clear();
// Ensures all service threads gracefully shutdown
service_thread_manager.reset();
service_threads.clear();
next_object_id = 0;
@@ -258,7 +255,7 @@ struct KernelCore::Impl {
KAutoObject::Create(thread.get());
ASSERT(KThread::InitializeDummyThread(thread.get()).IsSuccess());
thread->SetName(fmt::format("DummyThread:{}", GetHostThreadId()));
return std::move(thread);
return thread;
};
thread_local auto thread = make_thread();
@@ -620,7 +617,8 @@ struct KernelCore::Impl {
void InitializePageSlab() {
// Allocate slab heaps
user_slab_heap_pages = std::make_unique<KSlabHeap<Page>>();
user_slab_heap_pages =
std::make_unique<KSlabHeap<Page>>(KSlabHeap<Page>::AllocationType::Guest);
// TODO(ameerj): This should be derived, not hardcoded within the kernel
constexpr u64 user_slab_heap_size{0x3de000};
@@ -679,10 +677,6 @@ struct KernelCore::Impl {
// Threads used for services
std::unordered_set<std::shared_ptr<Kernel::ServiceThread>> service_threads;
// Service threads are managed by a worker thread, so that a calling service thread can queue up
// the release of itself
std::unique_ptr<Common::ThreadWorker> service_thread_manager;
std::array<KThread*, Core::Hardware::NUM_CPU_CORES> suspend_threads;
std::array<Core::CPUInterruptHandler, Core::Hardware::NUM_CPU_CORES> interrupts{};
std::array<std::unique_ptr<Kernel::KScheduler>, Core::Hardware::NUM_CPU_CORES> schedulers{};
@@ -985,17 +979,14 @@ void KernelCore::ExitSVCProfile() {
std::weak_ptr<Kernel::ServiceThread> KernelCore::CreateServiceThread(const std::string& name) {
auto service_thread = std::make_shared<Kernel::ServiceThread>(*this, 1, name);
impl->service_thread_manager->QueueWork(
[this, service_thread] { impl->service_threads.emplace(service_thread); });
impl->service_threads.emplace(service_thread);
return service_thread;
}
void KernelCore::ReleaseServiceThread(std::weak_ptr<Kernel::ServiceThread> service_thread) {
impl->service_thread_manager->QueueWork([this, service_thread] {
if (auto strong_ptr = service_thread.lock()) {
impl->service_threads.erase(strong_ptr);
}
});
if (auto strong_ptr = service_thread.lock()) {
impl->service_threads.erase(strong_ptr);
}
}
Init::KSlabResourceCounts& KernelCore::SlabResourceCounts() {

View File

@@ -153,7 +153,7 @@ ResultCode ProcessCapabilities::ParseCapabilities(const u32* capabilities,
}
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode ProcessCapabilities::ParseSingleFlagCapability(u32& set_flags, u32& set_svc_bits,
@@ -167,7 +167,7 @@ ResultCode ProcessCapabilities::ParseSingleFlagCapability(u32& set_flags, u32& s
// Bail early on ignorable entries, as one would expect,
// ignorable descriptors can be ignored.
if (type == CapabilityType::Ignorable) {
return RESULT_SUCCESS;
return ResultSuccess;
}
// Ensure that the give flag hasn't already been initialized before.
@@ -264,7 +264,7 @@ ResultCode ProcessCapabilities::HandlePriorityCoreNumFlags(u32 flags) {
core_mask = make_mask(core_num_min, core_num_max);
priority_mask = make_mask(priority_min, priority_max);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode ProcessCapabilities::HandleSyscallFlags(u32& set_svc_bits, u32 flags) {
@@ -288,23 +288,23 @@ ResultCode ProcessCapabilities::HandleSyscallFlags(u32& set_svc_bits, u32 flags)
svc_capabilities[svc_number] = true;
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode ProcessCapabilities::HandleMapPhysicalFlags(u32 flags, u32 size_flags,
KPageTable& page_table) {
// TODO(Lioncache): Implement once the memory manager can handle this.
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode ProcessCapabilities::HandleMapIOFlags(u32 flags, KPageTable& page_table) {
// TODO(Lioncache): Implement once the memory manager can handle this.
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode ProcessCapabilities::HandleMapRegionFlags(u32 flags, KPageTable& page_table) {
// TODO(Lioncache): Implement once the memory manager can handle this.
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode ProcessCapabilities::HandleInterruptFlags(u32 flags) {
@@ -331,7 +331,7 @@ ResultCode ProcessCapabilities::HandleInterruptFlags(u32 flags) {
interrupt_capabilities[interrupt] = true;
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode ProcessCapabilities::HandleProgramTypeFlags(u32 flags) {
@@ -342,7 +342,7 @@ ResultCode ProcessCapabilities::HandleProgramTypeFlags(u32 flags) {
}
program_type = static_cast<ProgramType>((flags >> 14) & 0b111);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode ProcessCapabilities::HandleKernelVersionFlags(u32 flags) {
@@ -362,7 +362,7 @@ ResultCode ProcessCapabilities::HandleKernelVersionFlags(u32 flags) {
}
kernel_version = flags;
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode ProcessCapabilities::HandleHandleTableFlags(u32 flags) {
@@ -373,7 +373,7 @@ ResultCode ProcessCapabilities::HandleHandleTableFlags(u32 flags) {
}
handle_table_size = static_cast<s32>((flags >> 16) & 0x3FF);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode ProcessCapabilities::HandleDebugFlags(u32 flags) {
@@ -385,7 +385,7 @@ ResultCode ProcessCapabilities::HandleDebugFlags(u32 flags) {
is_debuggable = (flags & 0x20000) != 0;
can_force_debug = (flags & 0x40000) != 0;
return RESULT_SUCCESS;
return ResultSuccess;
}
} // namespace Kernel

View File

@@ -84,7 +84,7 @@ public:
/// @param page_table The memory manager to use for handling any mapping-related
/// operations (such as mapping IO memory, etc).
///
/// @returns RESULT_SUCCESS if this capabilities instance was able to be initialized,
/// @returns ResultSuccess if this capabilities instance was able to be initialized,
/// otherwise, an error code upon failure.
///
ResultCode InitializeForKernelProcess(const u32* capabilities, std::size_t num_capabilities,
@@ -97,7 +97,7 @@ public:
/// @param page_table The memory manager to use for handling any mapping-related
/// operations (such as mapping IO memory, etc).
///
/// @returns RESULT_SUCCESS if this capabilities instance was able to be initialized,
/// @returns ResultSuccess if this capabilities instance was able to be initialized,
/// otherwise, an error code upon failure.
///
ResultCode InitializeForUserProcess(const u32* capabilities, std::size_t num_capabilities,
@@ -184,7 +184,7 @@ private:
/// @param page_table The memory manager that will perform any memory
/// mapping if necessary.
///
/// @return RESULT_SUCCESS if no errors occur, otherwise an error code.
/// @return ResultSuccess if no errors occur, otherwise an error code.
///
ResultCode ParseCapabilities(const u32* capabilities, std::size_t num_capabilities,
KPageTable& page_table);
@@ -199,7 +199,7 @@ private:
/// @param page_table The memory manager that will perform any memory
/// mapping if necessary.
///
/// @return RESULT_SUCCESS if no errors occurred, otherwise an error code.
/// @return ResultSuccess if no errors occurred, otherwise an error code.
///
ResultCode ParseSingleFlagCapability(u32& set_flags, u32& set_svc_bits, u32 flag,
KPageTable& page_table);

View File

@@ -132,7 +132,7 @@ ResultCode MapUnmapMemorySanityChecks(const KPageTable& manager, VAddr dst_addr,
return ResultInvalidMemoryRegion;
}
return RESULT_SUCCESS;
return ResultSuccess;
}
enum class ResourceLimitValueType {
@@ -164,7 +164,7 @@ static ResultCode SetHeapSize(Core::System& system, VAddr* heap_addr, u64 heap_s
CASCADE_RESULT(*heap_addr, page_table.SetHeapSize(heap_size));
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode SetHeapSize32(Core::System& system, u32* heap_addr, u32 heap_size) {
@@ -305,7 +305,7 @@ static ResultCode ConnectToNamedPort(Core::System& system, Handle* out, VAddr po
// We succeeded.
handle_guard.Cancel();
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode ConnectToNamedPort32(Core::System& system, Handle* out_handle,
@@ -349,7 +349,7 @@ static ResultCode GetThreadId(Core::System& system, u64* out_thread_id, Handle t
// Get the thread's id.
*out_thread_id = thread->GetId();
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode GetThreadId32(Core::System& system, u32* out_thread_id_low,
@@ -449,12 +449,12 @@ static ResultCode CancelSynchronization(Core::System& system, Handle handle) {
// Get the thread from its handle.
KScopedAutoObject thread =
system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(
static_cast<Handle>(handle));
system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(handle);
R_UNLESS(thread.IsNotNull(), ResultInvalidHandle);
// Cancel the thread's wait.
thread->WaitCancel();
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode CancelSynchronization32(Core::System& system, Handle handle) {
@@ -715,76 +715,76 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle
switch (info_id_type) {
case GetInfoType::AllowedCPUCoreMask:
*result = process->GetCoreMask();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::AllowedThreadPriorityMask:
*result = process->GetPriorityMask();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::MapRegionBaseAddr:
*result = process->PageTable().GetAliasRegionStart();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::MapRegionSize:
*result = process->PageTable().GetAliasRegionSize();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::HeapRegionBaseAddr:
*result = process->PageTable().GetHeapRegionStart();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::HeapRegionSize:
*result = process->PageTable().GetHeapRegionSize();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::ASLRRegionBaseAddr:
*result = process->PageTable().GetAliasCodeRegionStart();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::ASLRRegionSize:
*result = process->PageTable().GetAliasCodeRegionSize();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::StackRegionBaseAddr:
*result = process->PageTable().GetStackRegionStart();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::StackRegionSize:
*result = process->PageTable().GetStackRegionSize();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::TotalPhysicalMemoryAvailable:
*result = process->GetTotalPhysicalMemoryAvailable();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::TotalPhysicalMemoryUsed:
*result = process->GetTotalPhysicalMemoryUsed();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::SystemResourceSize:
*result = process->GetSystemResourceSize();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::SystemResourceUsage:
LOG_WARNING(Kernel_SVC, "(STUBBED) Attempted to query system resource usage");
*result = process->GetSystemResourceUsage();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::TitleId:
*result = process->GetTitleID();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::UserExceptionContextAddr:
*result = process->GetTLSRegionAddress();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::TotalPhysicalMemoryAvailableWithoutSystemResource:
*result = process->GetTotalPhysicalMemoryAvailableWithoutSystemResource();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::TotalPhysicalMemoryUsedWithoutSystemResource:
*result = process->GetTotalPhysicalMemoryUsedWithoutSystemResource();
return RESULT_SUCCESS;
return ResultSuccess;
default:
break;
@@ -796,7 +796,7 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle
case GetInfoType::IsCurrentProcessBeingDebugged:
*result = 0;
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::RegisterResourceLimit: {
if (handle != 0) {
@@ -816,14 +816,14 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle
if (!resource_limit) {
*result = Svc::InvalidHandle;
// Yes, the kernel considers this a successful operation.
return RESULT_SUCCESS;
return ResultSuccess;
}
Handle resource_handle{};
R_TRY(handle_table.Add(&resource_handle, resource_limit));
*result = resource_handle;
return RESULT_SUCCESS;
return ResultSuccess;
}
case GetInfoType::RandomEntropy:
@@ -840,13 +840,13 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle
}
*result = system.Kernel().CurrentProcess()->GetRandomEntropy(info_sub_id);
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::PrivilegedProcessId:
LOG_WARNING(Kernel_SVC,
"(STUBBED) Attempted to query privileged process id bounds, returned 0");
*result = 0;
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::ThreadTickCount: {
constexpr u64 num_cpus = 4;
@@ -881,7 +881,7 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle
}
*result = out_ticks;
return RESULT_SUCCESS;
return ResultSuccess;
}
default:
@@ -1034,7 +1034,7 @@ static ResultCode SetThreadActivity(Core::System& system, Handle thread_handle,
// Set the activity.
R_TRY(thread->SetActivity(thread_activity));
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode SetThreadActivity32(Core::System& system, Handle thread_handle,
@@ -1094,10 +1094,10 @@ static ResultCode GetThreadContext(Core::System& system, VAddr out_context, Hand
// Copy the thread context to user space.
system.Memory().WriteBlock(out_context, context.data(), context.size());
return RESULT_SUCCESS;
return ResultSuccess;
}
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode GetThreadContext32(Core::System& system, u32 out_context, Handle thread_handle) {
@@ -1115,7 +1115,7 @@ static ResultCode GetThreadPriority(Core::System& system, u32* out_priority, Han
// Get the thread's priority.
*out_priority = thread->GetPriority();
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode GetThreadPriority32(Core::System& system, u32* out_priority, Handle handle) {
@@ -1138,7 +1138,7 @@ static ResultCode SetThreadPriority(Core::System& system, Handle thread_handle,
// Set the thread priority.
thread->SetBasePriority(priority);
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode SetThreadPriority32(Core::System& system, Handle thread_handle, u32 priority) {
@@ -1207,7 +1207,7 @@ static ResultCode MapSharedMemory(Core::System& system, Handle shmem_handle, VAd
// We succeeded.
guard.Cancel();
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode MapSharedMemory32(Core::System& system, Handle shmem_handle, u32 address,
@@ -1240,7 +1240,7 @@ static ResultCode UnmapSharedMemory(Core::System& system, Handle shmem_handle, V
// Remove the shared memory from the process.
process.RemoveSharedMemory(shmem.GetPointerUnsafe(), address, size);
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode UnmapSharedMemory32(Core::System& system, Handle shmem_handle, u32 address,
@@ -1276,7 +1276,7 @@ static ResultCode QueryProcessMemory(Core::System& system, VAddr memory_info_add
// Page info appears to be currently unused by the kernel and is always set to zero.
memory.Write32(page_info_address, 0);
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode QueryMemory(Core::System& system, VAddr memory_info_address,
@@ -1524,7 +1524,7 @@ static ResultCode CreateThread(Core::System& system, Handle* out_handle, VAddr e
// Add the thread to the handle table.
R_TRY(process.GetHandleTable().Add(out_handle, thread));
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode CreateThread32(Core::System& system, Handle* out_handle, u32 priority,
@@ -1547,7 +1547,7 @@ static ResultCode StartThread(Core::System& system, Handle thread_handle) {
// If we succeeded, persist a reference to the thread.
thread->Open();
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode StartThread32(Core::System& system, Handle thread_handle) {
@@ -1796,7 +1796,7 @@ static ResultCode CloseHandle(Core::System& system, Handle handle) {
R_UNLESS(system.Kernel().CurrentProcess()->GetHandleTable().Remove(handle),
ResultInvalidHandle);
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode CloseHandle32(Core::System& system, Handle handle) {
@@ -1891,7 +1891,7 @@ static ResultCode CreateTransferMemory(Core::System& system, Handle* out, VAddr
// Add the transfer memory to the handle table.
R_TRY(handle_table.Add(out, trmem));
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode CreateTransferMemory32(Core::System& system, Handle* out, u32 address, u32 size,
@@ -1911,7 +1911,7 @@ static ResultCode GetThreadCoreMask(Core::System& system, Handle thread_handle,
// Get the core mask.
R_TRY(thread->GetCoreMask(out_core_id, out_affinity_mask));
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode GetThreadCoreMask32(Core::System& system, Handle thread_handle, s32* out_core_id,
@@ -1952,7 +1952,7 @@ static ResultCode SetThreadCoreMask(Core::System& system, Handle thread_handle,
// Set the core mask.
R_TRY(thread->SetCoreMask(core_id, affinity_mask));
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode SetThreadCoreMask32(Core::System& system, Handle thread_handle, s32 core_id,
@@ -2051,7 +2051,7 @@ static ResultCode CreateEvent(Core::System& system, Handle* out_write, Handle* o
// We succeeded.
handle_guard.Cancel();
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode CreateEvent32(Core::System& system, Handle* out_write, Handle* out_read) {
@@ -2081,7 +2081,7 @@ static ResultCode GetProcessInfo(Core::System& system, u64* out, Handle process_
}
*out = static_cast<u64>(process->GetStatus());
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode CreateResourceLimit(Core::System& system, Handle* out_handle) {
@@ -2104,7 +2104,7 @@ static ResultCode CreateResourceLimit(Core::System& system, Handle* out_handle)
// Add the limit to the handle table.
R_TRY(kernel.CurrentProcess()->GetHandleTable().Add(out_handle, resource_limit));
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode GetResourceLimitLimitValue(Core::System& system, u64* out_limit_value,
@@ -2125,7 +2125,7 @@ static ResultCode GetResourceLimitLimitValue(Core::System& system, u64* out_limi
// Get the limit value.
*out_limit_value = resource_limit->GetLimitValue(which);
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode GetResourceLimitCurrentValue(Core::System& system, u64* out_current_value,
@@ -2146,7 +2146,7 @@ static ResultCode GetResourceLimitCurrentValue(Core::System& system, u64* out_cu
// Get the current value.
*out_current_value = resource_limit->GetCurrentValue(which);
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode SetResourceLimitLimitValue(Core::System& system, Handle resource_limit_handle,
@@ -2166,7 +2166,7 @@ static ResultCode SetResourceLimitLimitValue(Core::System& system, Handle resour
// Set the limit value.
R_TRY(resource_limit->SetLimitValue(which, limit_value));
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode GetProcessList(Core::System& system, u32* out_num_processes,
@@ -2203,7 +2203,7 @@ static ResultCode GetProcessList(Core::System& system, u32* out_num_processes,
}
*out_num_processes = static_cast<u32>(num_processes);
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode GetThreadList(Core::System& system, u32* out_num_threads, VAddr out_thread_ids,
@@ -2243,7 +2243,7 @@ static ResultCode GetThreadList(Core::System& system, u32* out_num_threads, VAdd
}
*out_num_threads = static_cast<u32>(num_threads);
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode FlushProcessDataCache32([[maybe_unused]] Core::System& system,
@@ -2253,7 +2253,7 @@ static ResultCode FlushProcessDataCache32([[maybe_unused]] Core::System& system,
// as all emulation is done in the same cache level in host architecture, thus data cache
// does not need flushing.
LOG_DEBUG(Kernel_SVC, "called");
return RESULT_SUCCESS;
return ResultSuccess;
}
namespace {

View File

@@ -124,27 +124,27 @@ union ResultCode {
constexpr ResultCode(ErrorModule module_, u32 description_)
: raw(module.FormatValue(module_) | description.FormatValue(description_)) {}
constexpr bool IsSuccess() const {
[[nodiscard]] constexpr bool IsSuccess() const {
return raw == 0;
}
constexpr bool IsError() const {
return raw != 0;
[[nodiscard]] constexpr bool IsError() const {
return !IsSuccess();
}
};
constexpr bool operator==(const ResultCode& a, const ResultCode& b) {
[[nodiscard]] constexpr bool operator==(const ResultCode& a, const ResultCode& b) {
return a.raw == b.raw;
}
constexpr bool operator!=(const ResultCode& a, const ResultCode& b) {
return a.raw != b.raw;
[[nodiscard]] constexpr bool operator!=(const ResultCode& a, const ResultCode& b) {
return !operator==(a, b);
}
// Convenience functions for creating some common kinds of errors:
/// The default success `ResultCode`.
constexpr ResultCode RESULT_SUCCESS(0);
constexpr ResultCode ResultSuccess(0);
/**
* Placeholder result code used for unknown error codes.
@@ -152,7 +152,7 @@ constexpr ResultCode RESULT_SUCCESS(0);
* @note This should only be used when a particular error code
* is not known yet.
*/
constexpr ResultCode RESULT_UNKNOWN(UINT32_MAX);
constexpr ResultCode ResultUnknown(UINT32_MAX);
/**
* This is an optional value type. It holds a `ResultCode` and, if that code is a success code,
@@ -191,7 +191,7 @@ class ResultVal {
public:
/// Constructs an empty `ResultVal` with the given error code. The code must not be a success
/// code.
ResultVal(ResultCode error_code = RESULT_UNKNOWN) : result_code(error_code) {
ResultVal(ResultCode error_code = ResultUnknown) : result_code(error_code) {
ASSERT(error_code.IsError());
}
@@ -200,7 +200,7 @@ public:
* specify the success code. `success_code` must not be an error code.
*/
template <typename... Args>
static ResultVal WithCode(ResultCode success_code, Args&&... args) {
[[nodiscard]] static ResultVal WithCode(ResultCode success_code, Args&&... args) {
ResultVal<T> result;
result.emplace(success_code, std::forward<Args>(args)...);
return result;
@@ -259,49 +259,49 @@ public:
}
/// Returns true if the `ResultVal` contains an error code and no value.
bool empty() const {
[[nodiscard]] bool empty() const {
return result_code.IsError();
}
/// Returns true if the `ResultVal` contains a return value.
bool Succeeded() const {
[[nodiscard]] bool Succeeded() const {
return result_code.IsSuccess();
}
/// Returns true if the `ResultVal` contains an error code and no value.
bool Failed() const {
[[nodiscard]] bool Failed() const {
return empty();
}
ResultCode Code() const {
[[nodiscard]] ResultCode Code() const {
return result_code;
}
const T& operator*() const {
[[nodiscard]] const T& operator*() const {
return object;
}
T& operator*() {
[[nodiscard]] T& operator*() {
return object;
}
const T* operator->() const {
[[nodiscard]] const T* operator->() const {
return &object;
}
T* operator->() {
[[nodiscard]] T* operator->() {
return &object;
}
/// Returns the value contained in this `ResultVal`, or the supplied default if it is missing.
template <typename U>
T ValueOr(U&& value) const {
[[nodiscard]] T ValueOr(U&& value) const {
return !empty() ? object : std::move(value);
}
/// Asserts that the result succeeded and returns a reference to it.
T& Unwrap() & {
[[nodiscard]] T& Unwrap() & {
ASSERT_MSG(Succeeded(), "Tried to Unwrap empty ResultVal");
return **this;
}
T&& Unwrap() && {
[[nodiscard]] T&& Unwrap() && {
ASSERT_MSG(Succeeded(), "Tried to Unwrap empty ResultVal");
return std::move(**this);
}
@@ -320,8 +320,8 @@ private:
* `T` with and creates a success `ResultVal` contained the constructed value.
*/
template <typename T, typename... Args>
ResultVal<T> MakeResult(Args&&... args) {
return ResultVal<T>::WithCode(RESULT_SUCCESS, std::forward<Args>(args)...);
[[nodiscard]] ResultVal<T> MakeResult(Args&&... args) {
return ResultVal<T>::WithCode(ResultSuccess, std::forward<Args>(args)...);
}
/**
@@ -329,9 +329,8 @@ ResultVal<T> MakeResult(Args&&... args) {
* copy or move constructing.
*/
template <typename Arg>
ResultVal<std::remove_reference_t<Arg>> MakeResult(Arg&& arg) {
return ResultVal<std::remove_reference_t<Arg>>::WithCode(RESULT_SUCCESS,
std::forward<Arg>(arg));
[[nodiscard]] ResultVal<std::remove_reference_t<Arg>> MakeResult(Arg&& arg) {
return ResultVal<std::remove_reference_t<Arg>>::WithCode(ResultSuccess, std::forward<Arg>(arg));
}
/**
@@ -358,3 +357,28 @@ ResultVal<std::remove_reference_t<Arg>> MakeResult(Arg&& arg) {
return CONCAT2(check_result_L, __LINE__); \
} \
} while (false)
#define R_SUCCEEDED(res) (res.IsSuccess())
/// Evaluates a boolean expression, and succeeds if that expression is true.
#define R_SUCCEED_IF(expr) R_UNLESS(!(expr), ResultSuccess)
/// Evaluates a boolean expression, and returns a result unless that expression is true.
#define R_UNLESS(expr, res) \
{ \
if (!(expr)) { \
if (res.IsError()) { \
LOG_ERROR(Kernel, "Failed with result: {}", res.raw); \
} \
return res; \
} \
}
/// Evaluates an expression that returns a result, and returns the result if it would fail.
#define R_TRY(res_expr) \
{ \
const auto _tmp_r_try_rc = (res_expr); \
if (_tmp_r_try_rc.IsError()) { \
return _tmp_r_try_rc; \
} \
}

View File

@@ -298,13 +298,13 @@ protected:
if (profile_manager.GetProfileBaseAndData(user_id, profile_base, data)) {
ctx.WriteBuffer(data);
IPC::ResponseBuilder rb{ctx, 16};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushRaw(profile_base);
} else {
LOG_ERROR(Service_ACC, "Failed to get profile base and data for user={}",
user_id.Format());
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_UNKNOWN); // TODO(ogniK): Get actual error code
rb.Push(ResultUnknown); // TODO(ogniK): Get actual error code
}
}
@@ -313,12 +313,12 @@ protected:
ProfileBase profile_base{};
if (profile_manager.GetProfileBase(user_id, profile_base)) {
IPC::ResponseBuilder rb{ctx, 16};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushRaw(profile_base);
} else {
LOG_ERROR(Service_ACC, "Failed to get profile base for user={}", user_id.Format());
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_UNKNOWN); // TODO(ogniK): Get actual error code
rb.Push(ResultUnknown); // TODO(ogniK): Get actual error code
}
}
@@ -326,7 +326,7 @@ protected:
LOG_DEBUG(Service_ACC, "called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
const Common::FS::IOFile image(GetImagePath(user_id), Common::FS::FileAccessMode::Read,
Common::FS::FileType::BinaryFile);
@@ -352,7 +352,7 @@ protected:
void GetImageSize(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_ACC, "called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
const Common::FS::IOFile image(GetImagePath(user_id), Common::FS::FileAccessMode::Read,
Common::FS::FileType::BinaryFile);
@@ -395,7 +395,7 @@ protected:
}
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void StoreWithImage(Kernel::HLERequestContext& ctx) {
@@ -433,7 +433,7 @@ protected:
}
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
ProfileManager& profile_manager;
@@ -528,7 +528,7 @@ private:
void CheckAvailability(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_ACC, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(false); // TODO: Check when this is supposed to return true and when not
}
@@ -536,7 +536,7 @@ private:
LOG_DEBUG(Service_ACC, "called");
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushRaw<u64>(user_id.GetNintendoID());
}
@@ -552,14 +552,14 @@ private:
}
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushRaw<u64>(user_id.GetNintendoID());
}
void StoreOpenContext(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_ACC, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
Common::UUID user_id{Common::INVALID_UUID};
@@ -655,7 +655,7 @@ public:
void Module::Interface::GetUserCount(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_ACC, "called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push<u32>(static_cast<u32>(profile_manager->GetUserCount()));
}
@@ -665,7 +665,7 @@ void Module::Interface::GetUserExistence(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_ACC, "called user_id={}", user_id.Format());
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(profile_manager->UserExists(user_id));
}
@@ -673,20 +673,20 @@ void Module::Interface::ListAllUsers(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_ACC, "called");
ctx.WriteBuffer(profile_manager->GetAllUsers());
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void Module::Interface::ListOpenUsers(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_ACC, "called");
ctx.WriteBuffer(profile_manager->GetOpenUsers());
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void Module::Interface::GetLastOpenedUser(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_ACC, "called");
IPC::ResponseBuilder rb{ctx, 6};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushRaw<Common::UUID>(profile_manager->GetLastOpenedUser());
}
@@ -696,14 +696,14 @@ void Module::Interface::GetProfile(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_ACC, "called user_id={}", user_id.Format());
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IProfile>(system, user_id, *profile_manager);
}
void Module::Interface::IsUserRegistrationRequestPermitted(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_ACC, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(profile_manager->CanSystemRegisterUser());
}
@@ -761,13 +761,13 @@ ResultCode Module::Interface::InitializeApplicationInfoBase() {
LOG_WARNING(Service_ACC, "ApplicationInfo init required");
// TODO(ogniK): Actual initalization here
return RESULT_SUCCESS;
return ResultSuccess;
}
void Module::Interface::GetBaasAccountManagerForApplication(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_ACC, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IManagerForApplication>(system, profile_manager->GetLastOpenedUser());
}
@@ -794,7 +794,7 @@ void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx
}
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(is_locked);
}
@@ -805,7 +805,7 @@ void Module::Interface::GetProfileEditor(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_ACC, "called, user_id={}", user_id.Format());
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IProfileEditor>(system, user_id, *profile_manager);
}
@@ -817,7 +817,7 @@ void Module::Interface::ListQualifiedUsers(Kernel::HLERequestContext& ctx) {
// the game regardless of parental control settings.
ctx.WriteBuffer(profile_manager->GetAllUsers());
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void Module::Interface::LoadOpenContext(Kernel::HLERequestContext& ctx) {
@@ -827,7 +827,7 @@ void Module::Interface::LoadOpenContext(Kernel::HLERequestContext& ctx) {
// This command is used concurrently with ListOpenContextStoredUsers
// TODO: Find the differences between this and GetBaasAccountManagerForApplication
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IManagerForApplication>(system, profile_manager->GetLastOpenedUser());
}
@@ -837,7 +837,7 @@ void Module::Interface::ListOpenContextStoredUsers(Kernel::HLERequestContext& ct
// TODO(ogniK): Handle open contexts
ctx.WriteBuffer(profile_manager->GetOpenUsers());
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void Module::Interface::StoreSaveDataThumbnailApplication(Kernel::HLERequestContext& ctx) {
@@ -886,7 +886,7 @@ void Module::Interface::StoreSaveDataThumbnail(Kernel::HLERequestContext& ctx,
}
// TODO(ogniK): Construct save data thumbnail
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx) {
@@ -895,7 +895,7 @@ void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContex
// access to use the network or not by the looks of it
IPC::ResponseBuilder rb{ctx, 6};
if (profile_manager->GetUserCount() != 1) {
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushRaw<u128>(Common::INVALID_UUID);
return;
}
@@ -903,13 +903,13 @@ void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContex
const auto user_list = profile_manager->GetAllUsers();
if (std::all_of(user_list.begin(), user_list.end(),
[](const auto& user) { return user.uuid == Common::INVALID_UUID; })) {
rb.Push(RESULT_UNKNOWN); // TODO(ogniK): Find the correct error code
rb.Push(ResultUnknown); // TODO(ogniK): Find the correct error code
rb.PushRaw<u128>(Common::INVALID_UUID);
return;
}
// Select the first user we have
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushRaw<u128>(profile_manager->GetUser(0)->uuid);
}

View File

@@ -91,7 +91,7 @@ ResultCode ProfileManager::AddUser(const ProfileInfo& user) {
if (!AddToProfiles(user)) {
return ERROR_TOO_MANY_USERS;
}
return RESULT_SUCCESS;
return ResultSuccess;
}
/// Create a new user on the system. If the uuid of the user already exists, the user is not

View File

@@ -91,14 +91,14 @@ void IWindowController::GetAppletResourceUserId(Kernel::HLERequestContext& ctx)
LOG_DEBUG(Service_AM, "called. Process ID=0x{:016X}", process_id);
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push<u64>(process_id);
}
void IWindowController::AcquireForegroundRights(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
IAudioController::IAudioController(Core::System& system_)
@@ -132,20 +132,20 @@ void IAudioController::SetExpectedMasterVolume(Kernel::HLERequestContext& ctx) {
std::clamp(library_applet_volume_tmp, min_allowed_volume, max_allowed_volume);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void IAudioController::GetMainAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "called. main_applet_volume={}", main_applet_volume);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(main_applet_volume);
}
void IAudioController::GetLibraryAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "called. library_applet_volume={}", library_applet_volume);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(library_applet_volume);
}
@@ -166,7 +166,7 @@ void IAudioController::ChangeMainAppletMasterVolume(Kernel::HLERequestContext& c
fade_time_ns = std::chrono::nanoseconds{parameters.fade_time_ns};
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void IAudioController::SetTransparentAudioRate(Kernel::HLERequestContext& ctx) {
@@ -180,7 +180,7 @@ void IAudioController::SetTransparentAudioRate(Kernel::HLERequestContext& ctx) {
std::clamp(transparent_volume_rate_tmp, min_allowed_volume, max_allowed_volume);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
IDisplayController::IDisplayController(Core::System& system_)
@@ -332,7 +332,7 @@ void ISelfController::Exit(Kernel::HLERequestContext& ctx) {
system.Shutdown();
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void ISelfController::LockExit(Kernel::HLERequestContext& ctx) {
@@ -341,7 +341,7 @@ void ISelfController::LockExit(Kernel::HLERequestContext& ctx) {
system.SetExitLock(true);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void ISelfController::UnlockExit(Kernel::HLERequestContext& ctx) {
@@ -350,7 +350,7 @@ void ISelfController::UnlockExit(Kernel::HLERequestContext& ctx) {
system.SetExitLock(false);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void ISelfController::EnterFatalSection(Kernel::HLERequestContext& ctx) {
@@ -358,7 +358,7 @@ void ISelfController::EnterFatalSection(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "called. Num fatal sections entered: {}", num_fatal_sections_entered);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void ISelfController::LeaveFatalSection(Kernel::HLERequestContext& ctx) {
@@ -374,7 +374,7 @@ void ISelfController::LeaveFatalSection(Kernel::HLERequestContext& ctx) {
--num_fatal_sections_entered;
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void ISelfController::GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx) {
@@ -383,7 +383,7 @@ void ISelfController::GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext&
launchable_event.GetWritableEvent().Signal();
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushCopyObjects(launchable_event.GetReadableEvent());
}
@@ -395,7 +395,7 @@ void ISelfController::SetScreenShotPermission(Kernel::HLERequestContext& ctx) {
screenshot_permission = permission;
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void ISelfController::SetOperationModeChangedNotification(Kernel::HLERequestContext& ctx) {
@@ -405,7 +405,7 @@ void ISelfController::SetOperationModeChangedNotification(Kernel::HLERequestCont
LOG_WARNING(Service_AM, "(STUBBED) called flag={}", flag);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void ISelfController::SetPerformanceModeChangedNotification(Kernel::HLERequestContext& ctx) {
@@ -415,7 +415,7 @@ void ISelfController::SetPerformanceModeChangedNotification(Kernel::HLERequestCo
LOG_WARNING(Service_AM, "(STUBBED) called flag={}", flag);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void ISelfController::SetFocusHandlingMode(Kernel::HLERequestContext& ctx) {
@@ -434,14 +434,14 @@ void ISelfController::SetFocusHandlingMode(Kernel::HLERequestContext& ctx) {
flags.unknown0, flags.unknown1, flags.unknown2);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void ISelfController::SetRestartMessageEnabled(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void ISelfController::SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext& ctx) {
@@ -453,14 +453,14 @@ void ISelfController::SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext&
LOG_WARNING(Service_AM, "(STUBBED) called enabled={}", enabled);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void ISelfController::SetAlbumImageOrientation(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void ISelfController::CreateManagedDisplayLayer(Kernel::HLERequestContext& ctx) {
@@ -472,7 +472,7 @@ void ISelfController::CreateManagedDisplayLayer(Kernel::HLERequestContext& ctx)
const auto layer_id = nvflinger.CreateLayer(*display_id);
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(*layer_id);
}
@@ -490,7 +490,7 @@ void ISelfController::CreateManagedDisplaySeparableLayer(Kernel::HLERequestConte
const auto layer_id = nvflinger.CreateLayer(*display_id);
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(*layer_id);
}
@@ -498,7 +498,7 @@ void ISelfController::SetHandlesRequestToDisplay(Kernel::HLERequestContext& ctx)
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void ISelfController::SetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx) {
@@ -508,14 +508,14 @@ void ISelfController::SetIdleTimeDetectionExtension(Kernel::HLERequestContext& c
idle_time_detection_extension);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void ISelfController::GetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push<u32>(idle_time_detection_extension);
}
@@ -536,14 +536,14 @@ void ISelfController::SetAutoSleepDisabled(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "called. is_auto_sleep_disabled={}", is_auto_sleep_disabled);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void ISelfController::IsAutoSleepDisabled(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "called.");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(is_auto_sleep_disabled);
}
@@ -554,7 +554,7 @@ void ISelfController::GetAccumulatedSuspendedTickValue(Kernel::HLERequestContext
// where the game was suspended. Since Yuzu doesn't implement game suspension, this command
// can just always return 0 ticks.
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push<u64>(0);
}
@@ -562,7 +562,7 @@ void ISelfController::GetAccumulatedSuspendedTickChangedEvent(Kernel::HLERequest
LOG_DEBUG(Service_AM, "called.");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushCopyObjects(accumulated_suspended_tick_changed_event.GetReadableEvent());
}
@@ -578,7 +578,7 @@ void ISelfController::SetAlbumImageTakenNotificationEnabled(Kernel::HLERequestCo
album_image_taken_notification_enabled);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
AppletMessageQueue::AppletMessageQueue(Kernel::KernelCore& kernel)
@@ -704,7 +704,7 @@ void ICommonStateGetter::GetBootMode(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push<u8>(static_cast<u8>(Service::PM::SystemBootMode::Normal)); // Normal boot mode
}
@@ -712,7 +712,7 @@ void ICommonStateGetter::GetEventHandle(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushCopyObjects(msg_queue->GetMessageReceiveEvent());
}
@@ -729,7 +729,7 @@ void ICommonStateGetter::ReceiveMessage(Kernel::HLERequestContext& ctx) {
return;
}
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushEnum<AppletMessageQueue::AppletMessage>(message);
}
@@ -737,7 +737,7 @@ void ICommonStateGetter::GetCurrentFocusState(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(static_cast<u8>(FocusState::InFocus));
}
@@ -745,7 +745,7 @@ void ICommonStateGetter::IsVrModeEnabled(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(vr_mode_state);
}
@@ -756,7 +756,7 @@ void ICommonStateGetter::SetVrModeEnabled(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "VR Mode is {}", vr_mode_state ? "on" : "off");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void ICommonStateGetter::SetLcdBacklighOffEnabled(Kernel::HLERequestContext& ctx) {
@@ -767,28 +767,28 @@ void ICommonStateGetter::SetLcdBacklighOffEnabled(Kernel::HLERequestContext& ctx
is_lcd_backlight_off_enabled);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void ICommonStateGetter::BeginVrModeEx(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void ICommonStateGetter::EndVrModeEx(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushCopyObjects(msg_queue->GetOperationModeChangedEvent());
}
@@ -796,7 +796,7 @@ void ICommonStateGetter::GetDefaultDisplayResolution(Kernel::HLERequestContext&
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
if (Settings::values.use_docked_mode.GetValue()) {
rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedWidth) *
@@ -826,7 +826,7 @@ void ICommonStateGetter::SetRequestExitToLibraryAppletAtExecuteNextProgramEnable
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
IStorageImpl::~IStorageImpl() = default;
@@ -875,7 +875,7 @@ void IStorage::Open(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IStorageAccessor>(system, *this);
}
@@ -884,7 +884,7 @@ void ICommonStateGetter::GetOperationMode(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "called, use_docked_mode={}", use_docked_mode);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(static_cast<u8>(use_docked_mode ? OperationMode::Docked : OperationMode::Handheld));
}
@@ -892,7 +892,7 @@ void ICommonStateGetter::GetPerformanceMode(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushEnum(system.GetAPMController().GetCurrentPerformanceMode());
}
@@ -932,7 +932,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushCopyObjects(applet->GetBroker().GetStateChangedEvent());
}
@@ -940,7 +940,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push<u32>(applet->TransactionComplete());
}
@@ -955,7 +955,7 @@ private:
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void Start(Kernel::HLERequestContext& ctx) {
@@ -967,7 +967,7 @@ private:
applet->Execute();
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void PushInData(Kernel::HLERequestContext& ctx) {
@@ -977,7 +977,7 @@ private:
applet->GetBroker().PushNormalDataFromGame(rp.PopIpcInterface<IStorage>());
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void PopOutData(Kernel::HLERequestContext& ctx) {
@@ -993,7 +993,7 @@ private:
}
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IStorage>(std::move(storage));
}
@@ -1008,7 +1008,7 @@ private:
applet->Execute();
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void PopInteractiveOutData(Kernel::HLERequestContext& ctx) {
@@ -1024,7 +1024,7 @@ private:
}
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IStorage>(std::move(storage));
}
@@ -1032,7 +1032,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushCopyObjects(applet->GetBroker().GetNormalDataEvent());
}
@@ -1040,7 +1040,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushCopyObjects(applet->GetBroker().GetInteractiveDataEvent());
}
@@ -1052,7 +1052,7 @@ private:
constexpr u64 handle = 0xdeadbeef;
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(handle);
}
@@ -1079,7 +1079,7 @@ void IStorageAccessor::GetSize(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(static_cast<u64>(backing.GetSize()));
}
@@ -1105,7 +1105,7 @@ void IStorageAccessor::Write(Kernel::HLERequestContext& ctx) {
std::memcpy(backing.GetData().data() + offset, data.data(), size);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void IStorageAccessor::Read(Kernel::HLERequestContext& ctx) {
@@ -1128,7 +1128,7 @@ void IStorageAccessor::Read(Kernel::HLERequestContext& ctx) {
ctx.WriteBuffer(backing.GetData().data() + offset, size);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
ILibraryAppletCreator::ILibraryAppletCreator(Core::System& system_)
@@ -1162,13 +1162,13 @@ void ILibraryAppletCreator::CreateLibraryApplet(Kernel::HLERequestContext& ctx)
LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", applet_id);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_UNKNOWN);
rb.Push(ResultUnknown);
return;
}
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<ILibraryAppletAccessor>(system, applet);
}
@@ -1182,14 +1182,14 @@ void ILibraryAppletCreator::CreateStorage(Kernel::HLERequestContext& ctx) {
if (size <= 0) {
LOG_ERROR(Service_AM, "size is less than or equal to 0");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_UNKNOWN);
rb.Push(ResultUnknown);
return;
}
std::vector<u8> buffer(size);
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IStorage>(system, std::move(buffer));
}
@@ -1210,7 +1210,7 @@ void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContex
if (parameters.size <= 0) {
LOG_ERROR(Service_AM, "size is less than or equal to 0");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_UNKNOWN);
rb.Push(ResultUnknown);
return;
}
@@ -1220,7 +1220,7 @@ void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContex
if (transfer_mem.IsNull()) {
LOG_ERROR(Service_AM, "transfer_mem is a nullptr for handle={:08X}", handle);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_UNKNOWN);
rb.Push(ResultUnknown);
return;
}
@@ -1229,7 +1229,7 @@ void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContex
std::vector<u8> memory{mem_begin, mem_end};
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IStorage>(system, std::move(memory));
}
@@ -1244,7 +1244,7 @@ void ILibraryAppletCreator::CreateHandleStorage(Kernel::HLERequestContext& ctx)
if (size <= 0) {
LOG_ERROR(Service_AM, "size is less than or equal to 0");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_UNKNOWN);
rb.Push(ResultUnknown);
return;
}
@@ -1254,7 +1254,7 @@ void ILibraryAppletCreator::CreateHandleStorage(Kernel::HLERequestContext& ctx)
if (transfer_mem.IsNull()) {
LOG_ERROR(Service_AM, "transfer_mem is a nullptr for handle={:08X}", handle);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_UNKNOWN);
rb.Push(ResultUnknown);
return;
}
@@ -1263,7 +1263,7 @@ void ILibraryAppletCreator::CreateHandleStorage(Kernel::HLERequestContext& ctx)
std::vector<u8> memory{mem_begin, mem_end};
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IStorage>(system, std::move(memory));
}
@@ -1355,7 +1355,7 @@ void IApplicationFunctions::EnableApplicationCrashReport(Kernel::HLERequestConte
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void IApplicationFunctions::InitializeApplicationCopyrightFrameBuffer(
@@ -1363,14 +1363,14 @@ void IApplicationFunctions::InitializeApplicationCopyrightFrameBuffer(
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void IApplicationFunctions::SetApplicationCopyrightImage(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void IApplicationFunctions::SetApplicationCopyrightVisibility(Kernel::HLERequestContext& ctx) {
@@ -1380,7 +1380,7 @@ void IApplicationFunctions::SetApplicationCopyrightVisibility(Kernel::HLERequest
LOG_WARNING(Service_AM, "(STUBBED) called, is_visible={}", is_visible);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void IApplicationFunctions::BeginBlockingHomeButtonShortAndLongPressed(
@@ -1388,7 +1388,7 @@ void IApplicationFunctions::BeginBlockingHomeButtonShortAndLongPressed(
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void IApplicationFunctions::EndBlockingHomeButtonShortAndLongPressed(
@@ -1396,21 +1396,21 @@ void IApplicationFunctions::EndBlockingHomeButtonShortAndLongPressed(
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void IApplicationFunctions::BeginBlockingHomeButton(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void IApplicationFunctions::EndBlockingHomeButton(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) {
@@ -1430,7 +1430,7 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) {
auto data = backend->GetLaunchParameter({system.CurrentProcess()->GetTitleID(), build_id});
if (data.has_value()) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IStorage>(system, std::move(*data));
launch_popped_application_specific = true;
return;
@@ -1449,7 +1449,7 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
std::vector<u8> buffer(sizeof(LaunchParameterAccountPreselectedUser));
std::memcpy(buffer.data(), &params, buffer.size());
@@ -1469,7 +1469,7 @@ void IApplicationFunctions::CreateApplicationAndRequestToStartForQuest(
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void IApplicationFunctions::EnsureSaveData(Kernel::HLERequestContext& ctx) {
@@ -1500,7 +1500,7 @@ void IApplicationFunctions::SetTerminateResult(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called, result=0x{:08X}", result);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) {
@@ -1533,7 +1533,7 @@ void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) {
}
IPC::ResponseBuilder rb{ctx, 6};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushRaw(version_string);
}
@@ -1589,7 +1589,7 @@ void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "got desired_language={:016X}", *res_code);
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(*res_code);
}
@@ -1599,7 +1599,7 @@ void IApplicationFunctions::IsGamePlayRecordingSupported(Kernel::HLERequestConte
constexpr bool gameplay_recording_supported = false;
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(gameplay_recording_supported);
}
@@ -1607,21 +1607,21 @@ void IApplicationFunctions::InitializeGamePlayRecording(Kernel::HLERequestContex
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void IApplicationFunctions::SetGamePlayRecordingState(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void IApplicationFunctions::NotifyRunning(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push<u8>(0); // Unknown, seems to be ignored by official processes
}
@@ -1629,7 +1629,7 @@ void IApplicationFunctions::GetPseudoDeviceId(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 6};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
// Returns a 128-bit UUID
rb.Push<u64>(0);
@@ -1657,7 +1657,7 @@ void IApplicationFunctions::ExtendSaveData(Kernel::HLERequestContext& ctx) {
type, system.CurrentProcess()->GetTitleID(), user_id, {new_normal_size, new_journal_size});
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
// The following value is used upon failure to help the system recover.
// Since we always succeed, this should be 0.
@@ -1681,7 +1681,7 @@ void IApplicationFunctions::GetSaveDataSize(Kernel::HLERequestContext& ctx) {
type, system.CurrentProcess()->GetTitleID(), user_id);
IPC::ResponseBuilder rb{ctx, 6};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(size.normal);
rb.Push(size.journal);
}
@@ -1690,7 +1690,7 @@ void IApplicationFunctions::QueryApplicationPlayStatistics(Kernel::HLERequestCon
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push<u32>(0);
}
@@ -1698,7 +1698,7 @@ void IApplicationFunctions::QueryApplicationPlayStatisticsByUid(Kernel::HLEReque
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push<u32>(0);
}
@@ -1711,7 +1711,7 @@ void IApplicationFunctions::ExecuteProgram(Kernel::HLERequestContext& ctx) {
const auto program_index = rp.Pop<u64>();
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
system.ExecuteProgram(program_index);
}
@@ -1720,21 +1720,21 @@ void IApplicationFunctions::ClearUserChannel(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void IApplicationFunctions::UnpopToUserChannel(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void IApplicationFunctions::GetPreviousProgramIndex(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push<s32>(previous_program_index);
}
@@ -1742,7 +1742,7 @@ void IApplicationFunctions::GetGpuErrorDetectedSystemEvent(Kernel::HLERequestCon
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushCopyObjects(gpu_error_detected_event.GetReadableEvent());
}
@@ -1750,7 +1750,7 @@ void IApplicationFunctions::GetFriendInvitationStorageChannelEvent(Kernel::HLERe
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushCopyObjects(friend_invitation_storage_channel_event.GetReadableEvent());
}
@@ -1766,7 +1766,7 @@ void IApplicationFunctions::GetHealthWarningDisappearedSystemEvent(Kernel::HLERe
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushCopyObjects(health_warning_disappeared_system_event.GetReadableEvent());
}
@@ -1817,14 +1817,14 @@ void IHomeMenuFunctions::RequestToGetForeground(Kernel::HLERequestContext& ctx)
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void IHomeMenuFunctions::GetPopFromGeneralChannelEvent(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushCopyObjects(pop_from_general_channel_event.GetReadableEvent());
}

View File

@@ -41,7 +41,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<ICommonStateGetter>(system, msg_queue);
}
@@ -49,7 +49,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<ISelfController>(system, nvflinger);
}
@@ -57,7 +57,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IWindowController>(system);
}
@@ -65,7 +65,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IAudioController>(system);
}
@@ -73,7 +73,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IDisplayController>(system);
}
@@ -81,7 +81,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IProcessWindingController>(system);
}
@@ -89,7 +89,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IDebugFunctions>(system);
}
@@ -97,7 +97,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<ILibraryAppletCreator>(system);
}
@@ -105,7 +105,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IApplicationFunctions>(system);
}
@@ -145,7 +145,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<ICommonStateGetter>(system, msg_queue);
}
@@ -153,7 +153,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<ISelfController>(system, nvflinger);
}
@@ -161,7 +161,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IWindowController>(system);
}
@@ -169,7 +169,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IAudioController>(system);
}
@@ -177,7 +177,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IDisplayController>(system);
}
@@ -185,7 +185,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IDebugFunctions>(system);
}
@@ -193,7 +193,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<ILibraryAppletCreator>(system);
}
@@ -201,7 +201,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IHomeMenuFunctions>(system);
}
@@ -209,7 +209,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IGlobalStateController>(system);
}
@@ -217,7 +217,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IApplicationCreator>(system);
}
@@ -229,7 +229,7 @@ void AppletAE::OpenSystemAppletProxy(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<ISystemAppletProxy>(nvflinger, msg_queue, system);
}
@@ -237,7 +237,7 @@ void AppletAE::OpenLibraryAppletProxy(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger, msg_queue, system);
}
@@ -245,7 +245,7 @@ void AppletAE::OpenLibraryAppletProxyOld(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger, msg_queue, system);
}

View File

@@ -39,7 +39,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IAudioController>(system);
}
@@ -47,7 +47,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IDisplayController>(system);
}
@@ -55,7 +55,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IDebugFunctions>(system);
}
@@ -63,7 +63,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IWindowController>(system);
}
@@ -71,7 +71,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<ISelfController>(system, nvflinger);
}
@@ -79,7 +79,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<ICommonStateGetter>(system, msg_queue);
}
@@ -87,7 +87,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<ILibraryAppletCreator>(system);
}
@@ -95,7 +95,7 @@ private:
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IApplicationFunctions>(system);
}
@@ -107,7 +107,7 @@ void AppletOE::OpenApplicationProxy(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IApplicationProxy>(nvflinger, msg_queue, system);
}

View File

@@ -129,7 +129,7 @@ private:
ControllerSupportArgNew controller_user_arg_new;
ControllerUpdateFirmwareArg controller_update_arg;
bool complete{false};
ResultCode status{RESULT_SUCCESS};
ResultCode status{ResultSuccess};
bool is_single_mode{false};
std::vector<u8> out_data;
};

View File

@@ -135,7 +135,7 @@ bool Error::TransactionComplete() const {
}
ResultCode Error::GetStatus() const {
return RESULT_SUCCESS;
return ResultSuccess;
}
void Error::ExecuteInteractive() {

View File

@@ -42,7 +42,7 @@ private:
union ErrorArguments;
const Core::Frontend::ErrorApplet& frontend;
ResultCode error_code = RESULT_SUCCESS;
ResultCode error_code = ResultSuccess;
ErrorAppletMode mode = ErrorAppletMode::ShowError;
std::unique_ptr<ErrorArguments> args;

View File

@@ -76,7 +76,7 @@ bool Auth::TransactionComplete() const {
}
ResultCode Auth::GetStatus() const {
return successful ? RESULT_SUCCESS : ERROR_INVALID_PIN;
return successful ? ResultSuccess : ERROR_INVALID_PIN;
}
void Auth::ExecuteInteractive() {
@@ -175,7 +175,7 @@ bool PhotoViewer::TransactionComplete() const {
}
ResultCode PhotoViewer::GetStatus() const {
return RESULT_SUCCESS;
return ResultSuccess;
}
void PhotoViewer::ExecuteInteractive() {
@@ -229,7 +229,7 @@ bool StubApplet::TransactionComplete() const {
ResultCode StubApplet::GetStatus() const {
LOG_WARNING(Service_AM, "called (STUBBED)");
return RESULT_SUCCESS;
return ResultSuccess;
}
void StubApplet::ExecuteInteractive() {

View File

@@ -23,7 +23,7 @@ ProfileSelect::~ProfileSelect() = default;
void ProfileSelect::Initialize() {
complete = false;
status = RESULT_SUCCESS;
status = ResultSuccess;
final_data.clear();
Applet::Initialize();

View File

@@ -51,7 +51,7 @@ private:
UserSelectionConfig config;
bool complete = false;
ResultCode status = RESULT_SUCCESS;
ResultCode status = ResultSuccess;
std::vector<u8> final_data;
Core::System& system;
};

View File

@@ -273,8 +273,13 @@ void SoftwareKeyboard::ProcessTextCheck() {
std::memcpy(&swkbd_text_check, text_check_data.data(), sizeof(SwkbdTextCheck));
std::u16string text_check_message = Common::UTF16StringFromFixedZeroTerminatedBuffer(
swkbd_text_check.text_check_message.data(), swkbd_text_check.text_check_message.size());
std::u16string text_check_message =
swkbd_text_check.text_check_result == SwkbdTextCheckResult::Failure ||
swkbd_text_check.text_check_result == SwkbdTextCheckResult::Confirm
? Common::UTF16StringFromFixedZeroTerminatedBuffer(
swkbd_text_check.text_check_message.data(),
swkbd_text_check.text_check_message.size())
: u"";
LOG_INFO(Service_AM, "\nTextCheckResult: {}\nTextCheckMessage: {}",
GetTextCheckResultName(swkbd_text_check.text_check_result),
@@ -285,10 +290,10 @@ void SoftwareKeyboard::ProcessTextCheck() {
SubmitNormalOutputAndExit(SwkbdResult::Ok, current_text);
break;
case SwkbdTextCheckResult::Failure:
ShowTextCheckDialog(SwkbdTextCheckResult::Failure, text_check_message);
ShowTextCheckDialog(SwkbdTextCheckResult::Failure, std::move(text_check_message));
break;
case SwkbdTextCheckResult::Confirm:
ShowTextCheckDialog(SwkbdTextCheckResult::Confirm, text_check_message);
ShowTextCheckDialog(SwkbdTextCheckResult::Confirm, std::move(text_check_message));
break;
case SwkbdTextCheckResult::Silent:
default:
@@ -482,7 +487,7 @@ void SoftwareKeyboard::InitializeFrontendKeyboard() {
max_text_length <= 32 ? SwkbdTextDrawType::Line : SwkbdTextDrawType::Box;
Core::Frontend::KeyboardInitializeParameters initialize_parameters{
.ok_text{ok_text},
.ok_text{std::move(ok_text)},
.header_text{},
.sub_text{},
.guide_text{},
@@ -558,10 +563,10 @@ void SoftwareKeyboard::InitializeFrontendKeyboard() {
: false;
Core::Frontend::KeyboardInitializeParameters initialize_parameters{
.ok_text{ok_text},
.header_text{header_text},
.sub_text{sub_text},
.guide_text{guide_text},
.ok_text{std::move(ok_text)},
.header_text{std::move(header_text)},
.sub_text{std::move(sub_text)},
.guide_text{std::move(guide_text)},
.initial_text{initial_text},
.max_text_length{max_text_length},
.min_text_length{min_text_length},
@@ -590,7 +595,7 @@ void SoftwareKeyboard::ShowNormalKeyboard() {
void SoftwareKeyboard::ShowTextCheckDialog(SwkbdTextCheckResult text_check_result,
std::u16string text_check_message) {
frontend.ShowTextCheckDialog(text_check_result, text_check_message);
frontend.ShowTextCheckDialog(text_check_result, std::move(text_check_message));
}
void SoftwareKeyboard::ShowInlineKeyboard() {
@@ -653,7 +658,7 @@ void SoftwareKeyboard::InlineTextChanged() {
void SoftwareKeyboard::ExitKeyboard() {
complete = true;
status = RESULT_SUCCESS;
status = ResultSuccess;
frontend.ExitKeyboard();

View File

@@ -160,7 +160,7 @@ private:
bool is_background{false};
bool complete{false};
ResultCode status{RESULT_SUCCESS};
ResultCode status{ResultSuccess};
};
} // namespace Service::AM::Applets

View File

@@ -68,7 +68,7 @@ private:
const Core::Frontend::WebBrowserApplet& frontend;
bool complete{false};
ResultCode status{RESULT_SUCCESS};
ResultCode status{ResultSuccess};
WebAppletVersion web_applet_version{};
WebArgHeader web_arg_header{};

View File

@@ -76,7 +76,7 @@ private:
LOG_WARNING(Service_AOC, "(STUBBED) called, unknown_1={}", unknown_1);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void SetDeliveryTarget(Kernel::HLERequestContext& ctx) {
@@ -88,14 +88,14 @@ private:
LOG_WARNING(Service_AOC, "(STUBBED) called, unknown_1={}", unknown_1);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void GetPurchasedEventReadableHandle(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AOC, "called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushCopyObjects(purchased_event.GetReadableEvent());
}
@@ -144,7 +144,7 @@ void AOC_U::CountAddOnContent(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AOC, "called. process_id={}", params.process_id);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
const auto current = system.CurrentProcess()->GetTitleID();
@@ -190,7 +190,7 @@ void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) {
if (out.size() < offset) {
IPC::ResponseBuilder rb{ctx, 2};
// TODO(DarkLordZach): Find the correct error code.
rb.Push(RESULT_UNKNOWN);
rb.Push(ResultUnknown);
return;
}
@@ -201,7 +201,7 @@ void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) {
ctx.WriteBuffer(out);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(out_count);
}
@@ -217,7 +217,7 @@ void AOC_U::GetAddOnContentBaseId(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AOC, "called. process_id={}", params.process_id);
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
const auto title_id = system.CurrentProcess()->GetTitleID();
const FileSys::PatchManager pm{title_id, system.GetFileSystemController(),
@@ -246,14 +246,14 @@ void AOC_U::PrepareAddOnContent(Kernel::HLERequestContext& ctx) {
process_id);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void AOC_U::GetAddOnContentListChangedEvent(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AOC, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushCopyObjects(aoc_change_event.GetReadableEvent());
}
@@ -261,7 +261,7 @@ void AOC_U::CreateEcPurchasedEventManager(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AOC, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IPurchaseEventManager>(system);
}
@@ -269,7 +269,7 @@ void AOC_U::CreatePermanentEcPurchasedEventManager(Kernel::HLERequestContext& ct
LOG_WARNING(Service_AOC, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IPurchaseEventManager>(system);
}

View File

@@ -33,7 +33,7 @@ private:
controller.SetPerformanceConfiguration(mode, config);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void GetPerformanceConfiguration(Kernel::HLERequestContext& ctx) {
@@ -43,7 +43,7 @@ private:
LOG_DEBUG(Service_APM, "called mode={}", mode);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushEnum(controller.GetCurrentPerformanceConfiguration(mode));
}
@@ -67,7 +67,7 @@ void APM::OpenSession(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_APM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<ISession>(system, controller);
}
@@ -82,7 +82,7 @@ void APM::IsCpuOverclockEnabled(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_APM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(false);
}
@@ -110,7 +110,7 @@ void APM_Sys::GetPerformanceEvent(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_APM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<ISession>(system, controller);
}
@@ -123,14 +123,14 @@ void APM_Sys::SetCpuBoostMode(Kernel::HLERequestContext& ctx) {
controller.SetFromCpuBoostMode(mode);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void APM_Sys::GetCurrentPerformanceConfiguration(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_APM, "called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushEnum(
controller.GetCurrentPerformanceConfiguration(controller.GetCurrentPerformanceMode()));
}

View File

@@ -57,7 +57,7 @@ void AudCtl::GetTargetVolumeMin(Kernel::HLERequestContext& ctx) {
constexpr s32 target_min_volume = 0;
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(target_min_volume);
}
@@ -69,7 +69,7 @@ void AudCtl::GetTargetVolumeMax(Kernel::HLERequestContext& ctx) {
constexpr s32 target_max_volume = 15;
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(target_max_volume);
}

View File

@@ -70,7 +70,7 @@ void AudInU::ListAudioIns(Kernel::HLERequestContext& ctx) {
ctx.WriteBuffer(device_names);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(static_cast<u32>(device_names.size()));
}
@@ -82,7 +82,7 @@ void AudInU::ListAudioInsAutoFiltered(Kernel::HLERequestContext& ctx) {
// device listing just omits the default input device
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(static_cast<u32>(device_count));
}
@@ -94,7 +94,7 @@ void AudInU::OpenInOutImpl(Kernel::HLERequestContext& ctx) {
params.state = State::Started;
IPC::ResponseBuilder rb{ctx, 6, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushRaw<AudInOutParams>(params);
rb.PushIpcInterface<IAudioIn>(system);
}

View File

@@ -91,7 +91,7 @@ private:
LOG_DEBUG(Service_Audio, "called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(static_cast<u32>(stream->IsPlaying() ? AudioState::Started : AudioState::Stopped));
}
@@ -107,7 +107,7 @@ private:
audio_core.StartStream(stream);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void StopAudioOut(Kernel::HLERequestContext& ctx) {
@@ -118,14 +118,14 @@ private:
}
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void RegisterBufferEvent(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_Audio, "called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushCopyObjects(buffer_event.GetReadableEvent());
}
@@ -150,7 +150,7 @@ private:
}
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void GetReleasedAudioOutBufferImpl(Kernel::HLERequestContext& ctx) {
@@ -164,7 +164,7 @@ private:
ctx.WriteBuffer(tags);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push<u32>(static_cast<u32>(released_buffers.size()));
}
@@ -174,7 +174,7 @@ private:
IPC::RequestParser rp{ctx};
const u64 tag{rp.Pop<u64>()};
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(stream->ContainsBuffer(tag));
}
@@ -182,7 +182,7 @@ private:
LOG_DEBUG(Service_Audio, "called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(static_cast<u32>(stream->GetQueueSize()));
}
@@ -190,7 +190,7 @@ private:
LOG_DEBUG(Service_Audio, "called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(stream->Flush());
}
@@ -202,14 +202,14 @@ private:
stream->SetVolume(volume);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void GetAudioOutVolume(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_Audio, "called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(stream->GetVolume());
}
@@ -246,7 +246,7 @@ void AudOutU::ListAudioOutsImpl(Kernel::HLERequestContext& ctx) {
ctx.WriteBuffer(DefaultDevice);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push<u32>(1); // Amount of audio devices
}
@@ -279,7 +279,7 @@ void AudOutU::OpenAudioOutImpl(Kernel::HLERequestContext& ctx) {
system, params, *audio_core, std::move(device_name), std::move(unique_name));
IPC::ResponseBuilder rb{ctx, 6, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push<u32>(DefaultSampleRate);
rb.Push<u32>(params.channel_count);
rb.Push<u32>(static_cast<u32>(AudioCore::Codec::PcmFormat::Int16));

View File

@@ -65,7 +65,7 @@ private:
LOG_DEBUG(Service_Audio, "called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push<u32>(renderer->GetSampleRate());
}
@@ -73,7 +73,7 @@ private:
LOG_DEBUG(Service_Audio, "called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push<u32>(renderer->GetSampleCount());
}
@@ -81,7 +81,7 @@ private:
LOG_DEBUG(Service_Audio, "called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push<u32>(static_cast<u32>(renderer->GetStreamState()));
}
@@ -89,7 +89,7 @@ private:
LOG_DEBUG(Service_Audio, "called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push<u32>(renderer->GetMixBufferCount());
}
@@ -112,7 +112,7 @@ private:
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void Stop(Kernel::HLERequestContext& ctx) {
@@ -120,14 +120,14 @@ private:
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void QuerySystemEvent(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_Audio, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushCopyObjects(system_event.GetReadableEvent());
}
@@ -140,14 +140,14 @@ private:
ASSERT(rendering_time_limit_percent <= 100);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void GetRenderingTimeLimit(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_Audio, "called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(rendering_time_limit_percent);
}
@@ -230,7 +230,7 @@ private:
ctx.WriteBuffer(name_buffer);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(static_cast<u32>(name_buffer.size()));
}
@@ -244,7 +244,7 @@ private:
LOG_WARNING(Service_Audio, "(STUBBED) called. name={}, volume={}", name, volume);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void GetAudioDeviceOutputVolume(Kernel::HLERequestContext& ctx) {
@@ -254,7 +254,7 @@ private:
LOG_WARNING(Service_Audio, "(STUBBED) called. name={}", name);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(1.0f);
}
@@ -270,7 +270,7 @@ private:
ctx.WriteBuffer(out_device_name);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void QueryAudioDeviceSystemEvent(Kernel::HLERequestContext& ctx) {
@@ -279,7 +279,7 @@ private:
buffer_event.GetWritableEvent().Signal();
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushCopyObjects(buffer_event.GetReadableEvent());
}
@@ -287,7 +287,7 @@ private:
LOG_WARNING(Service_Audio, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push<u32>(1);
}
@@ -296,7 +296,7 @@ private:
LOG_WARNING(Service_Audio, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushCopyObjects(buffer_event.GetReadableEvent());
}
@@ -304,7 +304,7 @@ private:
LOG_DEBUG(Service_Audio, "called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushCopyObjects(buffer_event.GetReadableEvent());
}
@@ -636,7 +636,7 @@ void AudRenU::GetAudioRendererWorkBufferSize(Kernel::HLERequestContext& ctx) {
size = Common::AlignUp(size, 4096);
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push<u64>(size);
LOG_DEBUG(Service_Audio, "buffer_size=0x{:X}", size);
@@ -651,7 +651,7 @@ void AudRenU::GetAudioDeviceService(Kernel::HLERequestContext& ctx) {
// Revisionless variant of GetAudioDeviceServiceWithRevisionInfo that
// always assumes the initial release revision (REV1).
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IAudioDevice>(system, buffer_event, Common::MakeMagic('R', 'E', 'V', '1'));
}
@@ -673,7 +673,7 @@ void AudRenU::GetAudioDeviceServiceWithRevisionInfo(Kernel::HLERequestContext& c
LOG_DEBUG(Service_Audio, "called. revision={:08X}, aruid={:016X}", revision, aruid);
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IAudioDevice>(system, buffer_event, revision);
}
@@ -682,7 +682,7 @@ void AudRenU::OpenAudioRendererImpl(Kernel::HLERequestContext& ctx) {
const auto params = rp.PopRaw<AudioCommon::AudioRendererParameter>();
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IAudioRenderer>(system, params, audren_instance_count++);
}

View File

@@ -80,13 +80,13 @@ private:
LOG_ERROR(Audio, "Failed to decode opus data");
IPC::ResponseBuilder rb{ctx, 2};
// TODO(ogniK): Use correct error code
rb.Push(RESULT_UNKNOWN);
rb.Push(ResultUnknown);
return;
}
const u32 param_size = performance != nullptr ? 6 : 4;
IPC::ResponseBuilder rb{ctx, param_size};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push<u32>(consumed);
rb.Push<u32>(sample_count);
if (performance) {
@@ -249,7 +249,7 @@ void HwOpus::GetWorkBufferSize(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Audio, "worker_buffer_sz={}", worker_buffer_sz);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push<u32>(worker_buffer_sz);
}
@@ -281,12 +281,12 @@ void HwOpus::OpenOpusDecoder(Kernel::HLERequestContext& ctx) {
LOG_ERROR(Audio, "Failed to create Opus decoder (error={}).", error);
IPC::ResponseBuilder rb{ctx, 2};
// TODO(ogniK): Use correct error code
rb.Push(RESULT_UNKNOWN);
rb.Push(ResultUnknown);
return;
}
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IHardwareOpusDecoderManager>(
system, OpusDecoderState{std::move(decoder), sample_rate, channel_count});
}

View File

@@ -106,7 +106,7 @@ bool NullBackend::Synchronize(TitleIDVersion title, ProgressServiceBackend& prog
LOG_DEBUG(Service_BCAT, "called, title_id={:016X}, build_id={:016X}", title.title_id,
title.build_id);
progress.FinishDownload(RESULT_SUCCESS);
progress.FinishDownload(ResultSuccess);
return true;
}
@@ -115,7 +115,7 @@ bool NullBackend::SynchronizeDirectory(TitleIDVersion title, std::string name,
LOG_DEBUG(Service_BCAT, "called, title_id={:016X}, build_id={:016X}, name={}", title.title_id,
title.build_id, name);
progress.FinishDownload(RESULT_SUCCESS);
progress.FinishDownload(ResultSuccess);
return true;
}

View File

@@ -51,7 +51,7 @@ struct DeliveryCacheProgressImpl {
};
Status status;
ResultCode result = RESULT_SUCCESS;
ResultCode result = ResultSuccess;
DirectoryName current_directory;
FileName current_file;
s64 current_downloaded_bytes; ///< Bytes downloaded on current file.

View File

@@ -121,7 +121,7 @@ void HandleDownloadDisplayResult(const AM::Applets::AppletManager& applet_manage
const auto& frontend{applet_manager.GetAppletFrontendSet()};
frontend.error->ShowCustomErrorText(
RESULT_UNKNOWN, "There was an error while attempting to use Boxcat.",
ResultUnknown, "There was an error while attempting to use Boxcat.",
DOWNLOAD_RESULT_LOG_MESSAGES[static_cast<std::size_t>(res)], [] {});
}
@@ -300,7 +300,7 @@ void SynchronizeInternal(AM::Applets::AppletManager& applet_manager, DirectoryGe
const auto dir = dir_getter(title.title_id);
if (dir)
progress.SetTotalSize(dir->GetSize());
progress.FinishDownload(RESULT_SUCCESS);
progress.FinishDownload(ResultSuccess);
return;
}
@@ -383,7 +383,7 @@ void SynchronizeInternal(AM::Applets::AppletManager& applet_manager, DirectoryGe
}
}
progress.FinishDownload(RESULT_SUCCESS);
progress.FinishDownload(ResultSuccess);
}
bool Boxcat::Synchronize(TitleIDVersion title, ProgressServiceBackend& progress) {

View File

@@ -106,7 +106,7 @@ private:
LOG_DEBUG(Service_BCAT, "called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushCopyObjects(event);
}
@@ -116,7 +116,7 @@ private:
ctx.WriteBuffer(impl);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
Kernel::KReadableEvent& event;
@@ -185,7 +185,7 @@ private:
GetProgressBackend(SyncType::Normal));
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface(CreateProgressService(SyncType::Normal));
}
@@ -202,7 +202,7 @@ private:
name, GetProgressBackend(SyncType::Directory));
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface(CreateProgressService(SyncType::Directory));
}
@@ -235,7 +235,7 @@ private:
backend.SetPassphrase(title_id, passphrase);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void ClearDeliveryCacheStorage(Kernel::HLERequestContext& ctx) {
@@ -259,7 +259,7 @@ private:
}
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
ProgressServiceBackend& GetProgressBackend(SyncType type) {
@@ -278,7 +278,7 @@ void Module::Interface::CreateBcatService(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_BCAT, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IBcatService>(system, *backend);
}
@@ -340,7 +340,7 @@ private:
}
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void Read(Kernel::HLERequestContext& ctx) {
@@ -362,7 +362,7 @@ private:
ctx.WriteBuffer(buffer);
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push<u64>(buffer.size());
}
@@ -376,7 +376,7 @@ private:
}
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push<u64>(current_file->GetSize());
}
@@ -390,7 +390,7 @@ private:
}
IPC::ResponseBuilder rb{ctx, 6};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushRaw(DigestFile(current_file));
}
@@ -443,7 +443,7 @@ private:
}
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
}
void Read(Kernel::HLERequestContext& ctx) {
@@ -472,7 +472,7 @@ private:
ctx.WriteBuffer(entries);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(static_cast<u32>(write_size * sizeof(DeliveryCacheDirectoryEntry)));
}
@@ -489,7 +489,7 @@ private:
const auto files = current_dir->GetFiles();
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(static_cast<u32>(files.size()));
}
@@ -524,7 +524,7 @@ private:
LOG_DEBUG(Service_BCAT, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IDeliveryCacheFileService>(system, root);
}
@@ -532,7 +532,7 @@ private:
LOG_DEBUG(Service_BCAT, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IDeliveryCacheDirectoryService>(system, root);
}
@@ -546,7 +546,7 @@ private:
next_read_index += size;
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.Push(static_cast<u32>(size));
}
@@ -560,7 +560,7 @@ void Module::Interface::CreateDeliveryCacheStorageService(Kernel::HLERequestCont
const auto title_id = system.CurrentProcess()->GetTitleID();
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IDeliveryCacheStorageService>(system, fsc.GetBCATDirectory(title_id));
}
@@ -572,7 +572,7 @@ void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId(
LOG_DEBUG(Service_BCAT, "called, title_id={:016X}", title_id);
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushIpcInterface<IDeliveryCacheStorageService>(system, fsc.GetBCATDirectory(title_id));
}

View File

@@ -44,7 +44,7 @@ private:
LOG_WARNING(Service_BTM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS);
rb.Push(ResultSuccess);
rb.PushCopyObjects(register_event.GetReadableEvent());
}

Some files were not shown because too many files have changed in this diff Show More