Commit graph

7512 commits

Author SHA1 Message Date
bunnei cb7f2e5616 hle: kernel: Initialize preemption task after schedulers.
- Fixes a startup crash that occurs if CoreTiming tries to preempt before kernel initialization completes.
2021-03-27 10:04:13 -07:00
Morph 3b98fab850 service: friend: Change logging class from ACC to Friend 2021-03-27 11:11:07 -04:00
Narr the Reg 7c26a9aefe HID: Initialize correctly the gesture finger_id and filter invalid results 2021-03-26 11:13:18 -06:00
Chloe Marcec 99fdfa1fcd nvdrv: Pass device fd and handle device create methods for device opening and closing
We pass the fd to the ioctl as well as alert the device when it's opened or closed to allow for fd unique actions to take place
2021-03-25 12:56:42 +11:00
bunnei 65774084fd
Merge pull request #6101 from ogniK5377/alloc-as-ex
nvdrv: Change InitializeEx to AllocAsEx
2021-03-24 17:37:01 -07:00
MerryMage 52dae41d7f arm_dynarmic: Always have a 'valid' jit instance 2021-03-24 18:47:17 +00:00
Chloe Marcec 875183e7c5 nvdrv: Change InitializeEx to AllocAsEx
Wee also report the correct "big page size" now in GetVARegions & fix up the struct for IoctlAllocAsEx
2021-03-22 19:59:30 +11:00
bunnei a35717b245 core: arm_dynarmic: Ensure JIT state is saved/restored on page table changes.
- We re-create the JIT here without preserving any state.
2021-03-21 15:25:25 -07:00
bunnei 2e85ee250d
Merge pull request #6052 from Morph1984/vi-getindirectlayerimagemap
IApplicationDisplayService: Stub GetIndirectLayerImageMap
2021-03-19 22:59:25 -07:00
bunnei cb48ed2e1a
Merge pull request #6056 from zkitX/spl-updates
service: Refactor spl
2021-03-18 15:49:41 -07:00
Morph ec514a4d1b IApplicationDisplayService: Stub GetIndirectLayerImageMap
Used by games invoking the inline software keyboard such as GNOSIA
2021-03-17 03:25:12 -04:00
bunnei e1f7938a3b
Merge pull request #6070 from Morph1984/sysver-11.0.1
system_version: Update to 11.0.1
2021-03-16 18:13:12 -07:00
Morph 8441094ba3 bsd: Avoid writing empty buffers
Silences log spam on empty buffer writes
2021-03-16 12:50:44 -04:00
bunnei 0687a8370d
Merge pull request #6069 from Morph1984/ngWord
system_archive: Update NgWord archive version
2021-03-15 15:44:04 -07:00
Morph 824e53149d system_version: Update to 11.0.1 2021-03-14 08:47:36 -04:00
Morph 9761618a8d system_archive: Update NgWord archive version 2021-03-14 08:33:48 -04:00
bunnei d3a4a192fe
Merge pull request #6054 from Morph1984/time-GetClockSnapshot
time: Assign the current time point to the ClockSnapshot
2021-03-13 23:15:54 -08:00
zkitx 4439801c0f
Fix casing on DeallocateAesKeySlot 2021-03-11 02:46:22 -05:00
zkitx ad653550eb
Update SPL to fit N's service refactor (4.0.0+) which split into new services. 2021-03-11 02:36:48 -05:00
Morph 87cfe5b1da time: Fix CalculateSpanBetween implementation
CalculateSpanBetween passes in the ClockSnapshots through 2 input buffers and not as raw arguments. Fix this by reading the 2 input buffers instead of popping raw arguments.

Partially fixes Super Smash Bros. Ultimate's Spirit Board
2021-03-10 11:42:59 -05:00
Morph 2490ffbbce time: Assign the current time point to the ClockSnapshot
Fixes the timer in Super Smash Bros Ultimate's Spirit Board.
2021-03-10 11:40:51 -05:00
bunnei 8f7eb194af common: Fiber: use a reference for YieldTo.
- Fixes another small leak.
2021-03-07 13:46:53 -08:00
bunnei 47af34003b hle: kernel: KThread: Rework dummy threads & fix memory leak.
- Dummy threads are created on thread local storage for all host threads.
- Fixes a leak by removing creation of fibers, which are not applicable here.
2021-03-05 17:10:57 -08:00
bunnei a5ab85ac37
Revert "core: Switch to unique_ptr for usage of Common::Fiber." 2021-03-05 17:08:17 -08:00
bunnei 9d010be483
Merge pull request #6034 from Morph1984/mbedtls
externals: Update mbedtls to 2.16.9
2021-03-05 15:48:28 -08:00
bunnei 34a3ee1631
Merge pull request #6006 from bunnei/fiber-unique-ptr
core: Switch to unique_ptr for usage of Common::Fiber.
2021-03-04 23:59:06 -08:00
Morph 96c9e67b1b aes_util: Remove malformed mbedtls_cipher_finish function call 2021-03-05 02:05:05 -05:00
bunnei f8bfec3109
Merge pull request #5815 from comex/net-error-reform
Network error handling reform
2021-03-02 17:08:47 -08:00
bunnei 925671071c core: Shutdown: Move kernel cleanup to later in shutdown.
- Fixes a shutdown crash due to a race condition with GPU still accessing memory.
2021-03-01 21:42:06 -08:00
comex 2910aa77b2 [network] Error handling reform
`network.cpp` has several error paths which either:
- report "Unhandled host socket error=n" and return `SUCCESS`, or
- switch on a few possible errors, log them, and translate them to
  Errno; the same switch statement is copied and pasted in multiple
  places in the code

Convert these paths to use a helper function `GetAndLogLastError`, which
is roughly the equivalent of one of the switch statements, but:
- handling more cases (both ones that were already in `Errno`, and a few
  more I added), and
- using OS functions to convert the error to a string when logging, so
  it'll describe the error even if it's not one of the ones in the
  switch statement.
  - To handle this, refactor the logic in `GetLastErrorMsg` to expose a
    new function `NativeErrorToString` which takes the error number
    explicitly as an argument.  And improve the Windows version a bit.

Also, add a test which exercises two random error paths.
2021-02-28 17:25:31 -05:00
bunnei 9e9341f4b4
Merge pull request #6007 from bunnei/ldn-error
core: hle: ldn: Error out on call to Initialization.
2021-02-28 13:34:20 -08:00
Morph ee9ebeeb80
Merge pull request #5276 from german77/gestures
HID: Implement gestures
2021-02-27 22:18:41 -05:00
german e895ab7d6f Implements touch, pan, pinch and rotation gestures 2021-02-27 19:54:42 -06:00
bunnei ab65cb499d core: hle: ldn: Error out on call to Initialization.
- Since we do not emulate LDN, returning an error here makes more sense.
2021-02-27 11:59:29 -08:00
bunnei 51fb0a6f96 core: Switch to unique_ptr for usage of Common::Fiber.
- With using unique_ptr instead of shared_ptr, we have more explicit ownership of the context.
- Fixes a memory leak due to circular reference of the shared pointer.
2021-02-27 11:56:04 -08:00
bunnei 09f7c355c6
Merge pull request #5953 from bunnei/memory-refactor-1
Kernel Rework: Memory updates and refactoring (Part 1)
2021-02-27 12:48:35 -07:00
bunnei bfa1644464
Merge pull request #5944 from Morph1984/gc-vibrations
hid: Implement GameCube Controller Vibrations
2021-02-26 19:10:36 -07:00
Morph ec19a85890 hid: Implement GameCube Controller Vibrations
Implements both SendVibrationGcErmCommand and GetActualVibrationGcErmCommand, and modifies GetVibrationDeviceInfo to account for additional controllers.
2021-02-21 10:32:59 -05:00
Morph 3de8e7a8f2 acc: Stub GetNintendoAccountUserResourceCacheForApplication
This command returns a Nintendo Account ID and writes 2 output buffers. The first output buffer is a NasUserBaseForApplication and the second output buffer is currently empty.

Used by:
- Pokken Tournament DX
- Super Smash Bros. Ultimate
- Super Nintendo Entertainment System - Nintendo Switch Online
- Mario Kart 8 Deluxe
2021-02-21 10:29:25 -05:00
ameerj 8e4c9c9852 kernel: Fix resource release exception on exit
After rewriting the resource limit, objects releasing reserved resources require a live kernel instance.
This commit fixes exceptions that occur due to the kernel being destroyed before some objects released their resources, allowing for a graceful exit.
2021-02-20 20:51:11 -05:00
bunnei 93e20867b0 hle: kernel: Migrate PageHeap/PageTable to KPageHeap/KPageTable. 2021-02-18 16:16:25 -08:00
bunnei b1e27890e8 hle: kernel: Migrate MemoryManager to KMemoryManager. 2021-02-18 16:16:25 -08:00
bunnei 93109c870e hle: kernel: Migrate PageLinkedList to KPageLinkedList. 2021-02-18 16:16:25 -08:00
bunnei 65e0178cc0 hle: kernel: Migrate to KMemoryBlock, KMemoryBlockManager, and others. 2021-02-18 16:16:25 -08:00
bunnei 9e520e8f12 hle: kernel: Migrate SlabHeap to KSlabHeap. 2021-02-18 16:16:25 -08:00
bunnei 1d162f28d1 hle: kernel: Migrate MemoryLayout to KMemoryLayout. 2021-02-18 16:16:25 -08:00
bunnei 7ed5dd0d62 hle: kernel: Migrate AddressSpaceInfo to KAddressSpaceInfo. 2021-02-18 16:16:25 -08:00
bunnei 701ef616b2 hle: kernel: memory_manager: Rename AllocateContinuous to AllocateContinuous. 2021-02-18 16:16:24 -08:00
bunnei f7a008d77f hle: kernel: KSystemControl does not belong in Memory namespace. 2021-02-18 16:16:24 -08:00
bunnei 6a19086001 hle: kernel: memory: PageHeap: Migrate to KPageBitmap class. 2021-02-18 16:16:24 -08:00
bunnei a02566136c hle: kernel: Add KPageBitmap class. 2021-02-18 16:16:24 -08:00
bunnei e7c33d1ad6 hle: kernel: system_control: Add function GenerateRandomU64. 2021-02-18 16:16:24 -08:00
bunnei 6da91da08e hle: kernel: Add KSpinLock implementation. 2021-02-18 16:16:24 -08:00
bunnei 24e1e17a8a core: memory: Add templated GetPointer methods. 2021-02-18 16:16:24 -08:00
bunnei 0d62f30b00 hle: kernel: Rename SharedMemory to KSharedMemory. 2021-02-18 16:16:12 -08:00
bunnei 9cae3e6e90
Merge pull request #4973 from ameerj/nvdec-opt
nvdec: Reuse allocated buffers and general cleanup
2021-02-18 15:12:07 -08:00
bunnei f3345e84ad core: core_timing_util: Optimize core timing math.
- Avoids a lot of unnecessary 128-bit math for imperceptible accuracy.
2021-02-15 14:54:06 -08:00
LC ed543c4d5c
Merge pull request #5939 from Morph1984/web_types
core/CMakeLists: Add web_types.h
2021-02-15 14:02:10 -05:00
bunnei b53b50adec
Merge pull request #4940 from german77/nativeGC
HID: Implement GC controller in game
2021-02-15 10:32:19 -08:00
Morph 48cfc47050 core/CMakeLists: Add web_types.h 2021-02-15 09:40:30 -05:00
bunnei d9a8060ce3 hle: service: ldn: IUserLocalCommunicationService: Improve the stub. 2021-02-13 21:45:09 -08:00
bunnei 51c13606d6 hle: service: ldn: IUserLocalCommunicationService: Indicate that LDN is disabled.
- Fixes crash on Pokemon Sword/Shield when pressing 'Y'.
2021-02-13 20:11:26 -08:00
bunnei d25011c92f hle: service: am: IStorageAccessor: Fix out of bounds error handling. 2021-02-13 20:11:26 -08:00
ameerj 3c37d66c28 Address PR feedback
Co-Authored-By: LC <712067+lioncash@users.noreply.github.com>
2021-02-13 13:07:56 -05:00
ameerj ac265a72ce nvdec cleanup 2021-02-13 13:07:31 -05:00
ameerj ec9b6641b1 kernel: More accurately reserve and release resources 2021-02-12 19:05:24 -05:00
ameerj 5fa6b15215 kernel: KScopedReservation implementation
This implements KScopedReservation, allowing resource limit reservations to be more HW accurate, and release upon failure without requiring too many conditionals.
2021-02-12 18:57:34 -05:00
Chloe 37939482fb
kernel: Unify result codes (#5890)
* kernel: Unify result codes

Drop the usage of ERR_NAME convention in kernel for ResultName. Removed seperation between svc_results.h & errors.h as we mainly include both most of the time anyways.

* oops

* rename errors to svc_results
2021-02-12 15:43:01 -08:00
bunnei a0379c2db5
Merge pull request #5902 from lioncash/core-warn
core: Silence various warnings on Clang 12
2021-02-11 18:57:23 -08:00
bunnei e53b6ecc76
Merge pull request #5869 from german77/mousePanning
input_common: Add mouse panning
2021-02-11 09:58:23 -08:00
Morph 886043a6d2 software_keyboard: Implement Finalize request command 2021-02-10 21:42:49 -05:00
lat9nq 68f718943e core: Add -fsized-dealloction as a Clang flag
Prevents a operator delete error when compiling with Clang 11.
2021-02-09 21:27:12 -05:00
Lioncash 0cd40fb523 bsd: Remove usage of optional emplace() with no arguments
Clang 12 currently falls over in the face of this.
2021-02-09 17:50:29 -05:00
Lioncash 1dab8acf5f am/controller: Remove [[fallthrough]] from unreachable path
Prevents warnings on clang 12. This path is reachable on other
variations of the build that disable the unreachable macro.
2021-02-09 17:44:14 -05:00
Lioncash d64ba58759 nfp: Correct uninitialized size being used within GetTagInfo()
We were previously the name of the object being initialized within its
own initializer, which results in uninitialized data being read.
2021-02-09 17:42:02 -05:00
bunnei 1b730827dd
Merge pull request #5892 from german77/backup
olsc: Stub GetSaveDataBackupSetting
2021-02-08 17:48:52 -08:00
bunnei 7666c0994c
Merge pull request #5868 from german77/HandheldFix
Prevent over scheduling audio events and add motion update unschedule event
2021-02-08 11:33:53 -08:00
german a994a40467 hid: Implement GC controller 2021-02-07 22:59:46 -06:00
bunnei 0896089092
Merge pull request #5339 from german77/interactive
Settings: Make settings controller image change with controller input
2021-02-07 20:53:46 -08:00
german 3f9eb56972 olsc: Stub GetSaveDataBackupSetting 2021-02-07 22:32:13 -06:00
german 52b79ac009 Add mouse panning 2021-02-07 20:31:58 -06:00
Chloe d0a760a34a
Merge pull request #5872 from lioncash/svc-error
svc: Provide more detailed error logs for svc functions
2021-02-08 12:27:36 +11:00
bunnei 230e71b255
Merge pull request #5887 from ogniK5377/lm-fix
lm: Fix ReadLeb128
2021-02-07 10:25:56 -08:00
Morph 458be11f93
Merge pull request #5878 from aleasto/master
pl_u: Fix read out of bounds
2021-02-07 22:20:47 +08:00
Chloe Marcec 9d5a56a40b lm: Fix ReadLeb128
Fixes assertion on Bloodstained Ritual of the Night.

We would over read sometimes, this is fixed by checking if the top bit is set in the first iteration. We also lock the loop off to be only the max size of the type we can fit. Finally we changed an incorrect print of "DEBUG" to "TRACE" to reflect the proper log severity
2021-02-07 23:52:56 +11:00
bunnei 9078f4a9c7
Merge pull request #5871 from lioncash/address-arb
k_address_arbiter: Minor cleanup
2021-02-06 13:05:19 -08:00
Alessandro Astone 32d9a83f8e pl_u: Fix read out of bounds 2021-02-06 18:44:01 +01:00
german 481cd86722 Make settings controller image change with controller input 2021-02-06 09:43:41 -06:00
bunnei 61bf850f3d
Merge pull request #5326 from german77/hidUpdate1
HID: Update the HID service to match more closely to switchbrew part 1
2021-02-06 02:40:11 -08:00
Lioncash 40ab2b9348 k_address_arbiter: Unfold R_UNLESS macros
Allows for more descriptive error messages and also doesn't hide
control-path exit returns from the reader.
2021-02-06 04:08:27 -05:00
Lioncash b8fc74d74d k_address_arbiter: Remove unnecessary usages of std::addressof
This is a useful function in a generic context or with types that
overload unary operator&. However, primitives and pointers will never do
this, so we can opt for a more straightforward syntax.
2021-02-06 04:06:33 -05:00
Lioncash 7b9c58880f k_address_arbiter: Remove dead code
This code is never used, so we can remove it. It's in version control,
so it can always be brought back when needed.
2021-02-06 04:06:33 -05:00
Lioncash 75a60a6e22 svc: Provide more detailed error logs for svc functions
Allows SVC calls to have much more informative information during error
cases. This also doesn't hide control flow returns from the reader.
2021-02-06 02:03:40 -05:00
bunnei 1498a7c9a8
Merge pull request #5862 from bunnei/kevent
Kernel Rework: Refactor KEvent/KReadableEvent/KWritableEvent
2021-02-05 23:00:43 -08:00
bunnei 3a804752cb
Merge pull request #5875 from lioncash/identifier
k_priority_queue: Minor cleanup
2021-02-05 17:02:13 -08:00
bunnei ea4f62615e hle: kernel: Drop R_UNLESS_NOLOG in favor of expanded if-statement. 2021-02-05 14:03:36 -08:00
bunnei 546af64340 hle: kernel: KAddressArbiter: Remove noisy error log. 2021-02-05 14:03:36 -08:00
bunnei eba3c59a61 hle: kernel: svc: Cleanup KEvent/KReadableEvent/KWritableEvent SVCs. 2021-02-05 14:03:36 -08:00
bunnei ff3c7c068b hle: kernel: Reimplement KReadableEvent and KWritableEvent. 2021-02-05 14:03:32 -08:00
bunnei 6bf80dfee0 hle: kernel: Implement KEvent. 2021-02-05 14:00:36 -08:00