Commit Graph

1205 Commits

Author SHA1 Message Date
lynxnb
c5dde5953a Rework how settings are shared between Kotlin and native side
Settings are now shared to the native side by passing an instance of the Kotlin's `Settings` class. This way the C++ `Settings` class doesn't need to parse the SharedPreferences xml anymore.
2022-07-26 20:16:24 +05:30
lynxnb
4be8b4cf66 Add missing SPDX licence header 2022-07-26 20:16:24 +05:30
lynxnb
365ca66b1b Make integer settings use IntegerListPreference
Avoids unnecessary type casting of setting values and duplication in resource files.
2022-07-26 20:16:24 +05:30
lynxnb
cbc896c8f8 Fix waitForFences crash on Mali drivers
Mali GPU drivers utilize the `ppoll()` syscall inside `waitForFences` which isn't correctly restarted after a signal, which we can receive at any time on a guest thread. This commit fixes that by recursively calling the function on failure till it succeeds or returns an unexpected error.

Co-authored-by: PixelyIon <pixelyion@protonmail.com>
Co-authored-by: Billy Laws <blaws05@gmail.com>
2022-07-14 20:34:16 +02:00
MCredstoner2004
942e22f275 Write ApplicationErrorArg ErrorApplets to log
These applets are used by applications to display a custom error message to the user. Both the error message and the detailed error message are printed to the error log.


Co-authored-by: lynxnb <niccolo.betto@gmail.com>
2022-07-02 09:48:59 +05:30
MCredstoner2004
f9a0394577
Implement Software Keyboard applet
This implements the non-inline version of the Software Keyboard (swkbd) applet, which games use to get text input from the user.
2022-07-01 15:19:53 -05:00
MCredstoner2004
a9ee06914d Add ByteBufferSerializable
This allows sending C-like structs between Kotlin and C++ without struct-specific code
2022-06-30 01:17:32 +05:30
Billy Laws
a0275418d6 Add a single-header linear allocator implementation
This conforms to the C++ 'Allocator' named requirement allowing it to be used with any STL type and allows drastically reducing allocation times in cases which are suited for linear allocation.
2022-06-28 21:33:04 +01:00
Billy Laws
e816256220 Add blend, scissor, viewport and vertex state to shader hash
These caused a ton of additional comparisons in Zelda Link's Awakening as many shaders would have the same hash.
2022-06-28 21:32:59 +01:00
lynxnb
e6cfdeb06a Fix non-indexed quad draws
Certain non-indexed quad draws would mistakenly take the indexed quad path because of the assumption that they would not have a bound index buffer. This resulted in a crash for most games using quads due to a faulty exception `Indexed quad conversion is not supported`, when in fact they were not using indexed quads.

Co-authored-by: PixelyIon <pixelyion@protonmail.com>
Co-authored-by: Billy Laws <blaws05@gmail.com>
2022-06-23 10:57:11 +02:00
lynxnb
8fc3bc75f4 Allow providing an index type to calculate quad conversion buffer size 2022-06-23 00:15:44 +02:00
Billy Laws
7709dc8cf6 Rewrite buffer megabuffering to be per view and more efficient
This commit implements several key optimisations in megabuffering that are all inherently interlinked.
- Megabuffering is moved from per-buffer to per-view copies, this makes megabuffering possible for small views into larger underlying buffers which is often the case with even the simplest of games,
- Megabuffering is no longer the default option, it is only enabled for buffer views that have had inline GPU writes applied to them in the past as that is the only case where they are beneficial. In any other case the cost of copying, even with a 128KiB limit can be significant.
- With both of these changes, there is now possibility for overlapping views where one uses megabuffering and one does not. In order to allow GPU inline writes to work consistently in such cases a system of 'host immutability' has been implemented, when a buffer is marked as host immutable for a given cycle, all writes to the buffer from that point to the point the cycle is signalled will be performed on the GPU, ensuring that the backing contents are correctly sequenced
2022-06-11 17:05:39 +05:30
MCredstoner2004
2e356b8f0b Use spans instead of ptr and size in kernel memory 2022-06-11 17:05:39 +05:30
PixelyIon
e3e92ce1d4 Handle unsigned builds on CI
We don't always have access to CI secrets, such as, when a certain CI action is triggered by a PR from an external repository then it won't have access to secrets and be signed. While we likely will allow for this in the future as all workflows do have to be approved,  it is still important to not crash when keys are unavailable and have a graceful fallback for those situations.
2022-06-11 17:05:39 +05:30
Billy Laws
8689886bbb
Update build tools to 33.0.0 to fix CI
We're never switching to RC build tools again
2022-06-10 00:11:12 +01:00
Billy Laws
22039df301 Transition to std::unordered_set for buffer view tracking
Has the same guarantees of pointer stabilty while also being significantly faster in cases where a buffer has thousands of views. This is the case in RE4 and this change leads to an almost 1000% performance improvement in that game.
2022-06-09 23:52:13 +01:00
Billy Laws
b75a06af1b Support forcing 60Hz display on Xiaomi MIUI
Uses an API found through RE since none of the AOSP APIs work, additionaly the code for setting RR was consolidated to a single function that can be ran after all display updates.
2022-06-09 19:29:18 +01:00
Billy Laws
42c365fe70 Automatically exclude llvm and boost submodules in gradle project
There is a god in this world... his name is bylaws
2022-06-06 23:11:56 +01:00
PixelyIon
a5ca370c36 Implement thread-safe MegaBuffer pool
We currently have a global `MegaBuffer` instance that is shared across all channels, this is very problematic as `MegaBuffer` fundamentally works like a state machine with allocations (especially resetting/freeing) and is thread-specific. Therefore, we now have a pool of several `MegaBuffer`s which is allocated from by the `CommandExecutor` and kept channel specific as a result which also limits its usage to a single thread, this allows for individually resetting or freeing any allocations.
2022-06-05 13:04:40 +05:30
PixelyIon
3e08494146 Minor CommandScheduler refactor
There was a lot of redundant code in the `CommandScheduler` when the same functionality could be achieved with much shorter and cleaner code which this commit fixes. This includes no changes to the user-facing API and does not require any changes on the user side as a result.
2022-06-05 13:04:40 +05:30
Billy Laws
bd99d79b51 OsFileSystem: Close directory after file listing is finished 2022-06-04 21:46:23 +01:00
Billy Laws
4888919515 Stub GetFriendInvitationStorageChannelEvent (0x8C) 2022-06-04 21:45:53 +01:00
Billy Laws
d9f6540831 Fix VFS CreateFile directory creation 2022-06-04 19:19:30 +01:00
Billy Laws
f5bcb40c41 Return number of audio outs in ListAudioOuts 2022-06-04 19:12:37 +01:00
Billy Laws
5d6902b3f8 Stub audin:u 2022-06-04 19:11:57 +01:00
Billy Laws
54999957a2 Remove RGB565 format workaround
Will soon be redundant with new texture manager and is quite hacky so drop it.
2022-06-04 17:49:13 +01:00
Billy Laws
d79832091d Force append slash to directory path in OsFilesystem::CreateDirectory
The recursive path creation algorithm requires this to be the case
2022-06-04 17:44:49 +01:00
Billy Laws
616f7b7826 Correct instanced draw topology changed warning location
Before it would trigger even when the draw had the instanceNext flag set and thus wasn't part of the instanced draw at all.
2022-06-04 17:43:03 +01:00
Billy Laws
deb7a0e22a Implement 5x5 and 10x10 ASTC texture formats 2022-06-04 17:42:37 +01:00
Billy Laws
cc5a3f99c1 Reformat format description file 2022-06-04 17:42:13 +01:00
Billy Laws
a476bbaf4d Add 11_11_10 vertex buffer format 2022-06-04 17:41:10 +01:00
Billy Laws
71c37dd6c4 Add D24X8Unorm depth RT format support 2022-06-04 17:40:49 +01:00
Billy Laws
d3af629b83 Support R32G32B32A32 int RT formats 2022-06-04 17:38:57 +01:00
Billy Laws
0f5f04ade3 Set default surfaceflinger parameters based off of preallocated buffers
Required by resident evil 4 as otherwise Dequeue would fail due to it using BGRA buffers but the default being RGBA.
2022-06-04 16:55:08 +01:00
Billy Laws
106ad597db Support BGRA8888 surfaceflinger format
A swizzle is applied to R8G8B8A8 to transform it to BGRA since BGRA isn't a commonly supported swapchain format on Android.
2022-06-04 16:49:26 +01:00
Billy Laws
2bbeb6b08f Fix OsFileSystem initial directory creation
By passing basePath as an argument the CreateDirectory function did mkdir(basePath+basePath) which is obviously not the intended behaviour, fix this.
2022-06-03 19:33:31 +01:00
Billy Laws
84dec7561c Dont cache rendertarget mappings
Some games remap rendertargets or map them late which would lead to weird graphical bugs or crashes. Drop the caching since VMM lookup is fairly cheap anyway.
2022-06-03 19:31:52 +01:00
Billy Laws
581a016991 Add GuestTexture::GetSize helper function
This code was getting duplicated a bit so commonise into a helper function.
2022-06-03 19:30:54 +01:00
Billy Laws
31d418ad54 Fix 3D semaphore counter type 0 handling
Counter type 0 actually releases the semaphore payload rather than a constant zero as was previously thought. This is required by Skyrim.
2022-06-02 22:03:19 +01:00
Billy Laws
0202bf5531 Add semaphore release debug logs 2022-06-02 22:02:59 +01:00
Billy Laws
55cddc7a66 Update hades 2022-06-02 21:58:30 +01:00
Billy Laws
3736d36b75 Fix KPrivateMemory remap permissions 2022-06-02 18:10:35 +01:00
Billy Laws
389ab0fb50 Add {Map,Unmap}Physical memory debug logs 2022-06-02 18:10:10 +01:00
PixelyIon
2712b3276b Fix incorrect VkBufferImageCopy offset calculations
The `VkBufferImageCopy` offset calculations were wrong inside `CopyIntoStagingBuffer` as it multiplied the mip level's linear size by `levelCount` rather than `layerCount`. This led to substantial UB in games which called this function as it led to an overflow and resulted in writing to other areas of the buffer which caused major issues such as vertex/index buffer corruption and corresponding graphical glitches alongside likely being the cause of some crashes.
2022-06-02 22:14:22 +05:30
PixelyIon
06901ef22a Fix BC7 output swizzling from BGRA to RGBA
BC7 CPU decoding had the red and blue channels swapped around as it outputted a BGRA image after decoding while we expected an RGBA image to be produced. This should fix the colors of certain textures in titles such as Cuphead or Sonic Forces.
2022-06-02 19:48:55 +05:30
Billy Laws
9cb68c31e1 Stub nfp IUser::AttachAvailabilityChangeEvent 2022-06-02 00:04:01 +01:00
Billy Laws
33c9731eca Implement IFileSystem::CreateDirectory 2022-06-02 00:04:01 +01:00
Billy Laws
a09414424b Fix broken VFS directory creation 2022-06-02 00:04:01 +01:00
Billy Laws
3518e04a18 Correct Directory EntryType to be u8 rather than u32 2022-06-02 00:04:01 +01:00
Billy Laws
0c11d9e294 Implement IDirectory::GetEntryCount 2022-06-02 00:04:01 +01:00