0
0
mirror of https://github.com/Ishan09811/pine.git synced 2025-04-28 09:35:08 +00:00

2134 Commits

Author SHA1 Message Date
Ishan09811
8398baf359
Implement Jit32 (#9)
* Introduce Jit32 and JitCore32 objects

* Initialize JIT when launching 32bit executables

* Introduce kernel objects for 32bit processes

This commit introduces two new kernel thread types, `KNceThread` and `Jit32Thread`.
`KNceThread`s behave like the previous kernel thread object by setting up thread state and jumping into guest code.
`KJit32Thread`s need to run guest code on a `JitCore32` object, so they perform the necessary state setup and then they also setup the jit core for executing guest code. A loop was introduced because jit execution might return when halted, either for an SVC or for preemption. In those cases the thread needs to wait to be scheduled before executing again.

The process object has also been updated to be able to create 32bit threads when running 32bit processes.

Additionally NCE's ThreadContext has been removed from DeviceState, since a thread is not an NCE thread only anymore, and IPC code has been changed to retrieve the tls region from the thread object.

* Introduce a preemption handler for scheduling with JIT

Scheduler initialization has been delayed until process information is available, as it needs to differentiate between 32bit and 64bit processes.

* Support initializing VMM for 32bit address spaces

* Implement GetThreadContext3 SVC for 32bit processes

* Introduce a thread local pointer to the current guest thread

This also gives easier access to the current guest process structure via the thread structure, just like any kernel does for their internal structures.

* Add a signal handler for JIT threads

* Implement coprocessor 15 accesses

* Implement exclusive memory writes and exclusive monitor

* Enable JIT fastmem

* Enable more JIT optimizations and log exceptions

* Fix incorrect logging call in QueryMemory

* Translate guest virtual addresses on direct accesses from SVCs

* Perform TLS page address translation for direct accesses

This allows the IPC code to work without modifications since `KThread::tlsRegion` now stores a host address that can be accessed directly.

* Add Dynarmic as a submodule

* Revert "Perform TLS page address translation for direct accesses"

This reverts commit 2e25b3f7e4f0687b038fa949648c74e3393da006.

* Revert "Translate guest virtual addresses on direct accesses from SVCs"

This reverts commit 7bec4e0902e6dbb6f06a2efac53a1e2127f44068.

* add an option to change cpu backend

* Fix

---------

Co-authored-by: lynxnb <niccolo.betto@gmail.com>
2024-07-23 23:59:15 +05:30
Ishan09811
d68ec66d70
Typo 2024-07-23 00:36:49 +05:30
Ishan09811
0ec8da46c5
missing import 2024-07-22 22:31:43 +05:30
Ishan09811
0ed39a0355
Add edit overlay button in emulation overlay options 2024-07-22 22:13:28 +05:30
Ishan09811
a44cb7ee88
Fix hide invalid files preference title not showing 2024-07-22 16:17:13 +05:30
Ishan09811
cb9bf7c185
Add multiple search location support (#8)
* Add support for multiple search locations

Co-authored-by: hacobotdev <hacobotdev>

* SearchLocationHelper: Use mutableListOf<Uri> and change the return value of the ``getSearchLocations`` function to List<Uri>

* MainViewModel: Modify load rom and check rom hash to accept List uri instead of array uri

* Use SearchLocationHelper when initialising search location first time

* fix search location app bar title
2024-07-22 14:31:56 +05:30
Ishan09811
6806326598
Properly handle save export function (#7) 2024-07-21 22:36:48 +05:30
Ishan09811
373ba24fa3
add more aspect ratios 2024-07-21 15:15:39 +05:30
Ishan09811
5a93c07dd0
Implement dynamic resolution option (#6) 2024-07-21 12:49:47 +05:30
Ishan09811
f7ea5e4f26
Implement thermal indicator (#4) 2024-07-20 23:48:52 +05:30
Ishan09811
8a52a1d3c0
Add Long Click Listener to Remove Firmware in FirmwareImportPreference (#3) 2024-07-19 11:19:28 +05:30
Ishan09811
998b9d1ce0
Typo 2024-07-18 23:54:01 +05:30
Ishan09811
f5b50095da
Add a per-game option to delete the shader cache that has been created during the emulation
Co-authored-by: QuackingCanary <QuackingCanary>
2024-07-18 23:49:54 +05:30
Ishan09811
4a4e9a925c
Initial in-game-menu support (#2) 2024-07-17 22:15:26 +05:30
Ishan09811
ecadc58878
Some basic rebrand (#1) 2024-07-13 18:22:13 +05:30
Ishan09811
36632139b0
singing fixes 2024-07-13 13:13:31 +05:30
Ishan09811
527f53fd01 Update audio-core and shader-compiler submodule 2024-07-12 20:55:30 +05:30
TheASVigilante
3c62a7264c Fix accidental recursion with trap handling 2024-07-11 15:22:33 +05:30
lynxnb
b35e200ab6 Move memory trapping infrastructure outside of NCE 2024-07-11 15:22:10 +05:30
lynxnb
514f5607e6 Move SvcTable definition out of header files 2024-07-11 15:21:45 +05:30
lynxnb
2be8ebddcd Introduce a generic register context for SVCs
`SvcContext` represents a common interface for accessing registers from SVCs, decoupling them from a particular thread context.
2024-07-11 15:21:26 +05:30
lynxnb
136c5b74aa KProcess: correctly handle empty optional chunk 2024-07-11 15:21:04 +05:30
lynxnb
75f8754a2e memory: update KMemory to use guest addresses 2024-07-11 15:20:46 +05:30
lynxnb
c2aa20f38e memory: use guest addresses everywhere
The memory manager has been reworked to handle addresses in the guest address space, and applying an offset to get the address on the host whenever memory needs to be mapped/unmapped/reprotected.
2024-07-11 15:20:28 +05:30
lynxnb
e845ad5924 memory: fix insertion at the beginning of the chunks map
The memory manager was incorrectly inserting chunks when the new chunk was being inserted at the beginning of the chunks map (no previous chunk available). The existing chunk was resized to an empty chunk (correctly), but the new chunk was never inserted because of `std::map::insert` skipping insertion on an already existing key.
This resulted in an empty chunk being left at the beginning of the map, causing infinite loops for code that worked by scanning the chunks map.

Usages of `std::map::operator[]` have also been replaced with the safer `insert_or_assign`.
2024-07-11 15:20:09 +05:30
lynxnb
74bf8ea611 Loader: skip patching non 64-bit executables 2024-07-11 15:19:44 +05:30
lynxnb
f05959f195 Loader: make dynsym handling more generic
dynsym is not hardcoded to handle Elf64_Sym only anymore, and a templated ResolveSymbol function has been introduced to easily support Elf32_Sym lookup in the future.
2024-07-11 15:19:26 +05:30
lynxnb
5e8bd61d6c Move symbol hooking setup code out of loader 2024-07-11 15:18:06 +05:30
lynxnb
77752b45fc Loader: skip patching non 64-bit executables 2024-07-11 14:52:30 +05:30
lynxnb
c91bd07699 Loader: make dynsym handling more generic
dynsym is not hardcoded to handle Elf64_Sym only anymore, and a templated ResolveSymbol function has been introduced to easily support Elf32_Sym lookup in the future.
2024-07-11 14:52:30 +05:30
lynxnb
7941600765 Move symbol hooking setup code out of loader 2024-07-11 14:52:29 +05:30
Ishan09811
6c504d27b3
Fix invalid switch-case syntax resulting from nvdrv macro expansion
Co-authored-by: nickbeth
<nickbeth>
2024-07-11 14:41:36 +05:30
Ishan09811
007f27a039
Fix try-catch in save import
Co-authored-by: PabloG02
<PabloG02>
2024-07-09 14:47:14 +05:30
Ishan09811
93ef1ba967
basic rebrand 2024-07-08 19:56:21 +05:30
Ishan09811
74633ad0e3
Implement info reading from Ro section
Co-authored-by: dima-xd
<dimaxdqwerty@gmail.com>
2024-07-08 01:10:59 +05:30
Ishan09811
ca14586b55
Iterate through siblings without recursion in vfs::TraverseDirectory ( #205) Prevents a stack overflow because of recursion depth.
Co-authored-by: PabloG02
<PabloG02>
2024-07-07 19:40:13 +05:30
Ishan09811
d9ff08273e
fix 2024-07-07 01:32:25 +05:30
Ishan09811
6d20f045a3
Update Dependencies 2024-07-06 16:34:43 +05:30
Ishan09811
eac1506611
disable parallel building + fix some more kotlin compilation errors 2024-07-05 17:11:47 +05:30
Ishan09811
b88bb5150b
fix errors 2024-07-05 13:10:47 +05:30
Ishan09811
13cc2fdcc5
enable build config 2024-07-05 01:04:26 +05:30
Ishan09811
9462e7bb92
Update gradle to 8.6 2024-07-04 20:17:51 +05:30
Ishan09811
069af0df2b Remove the LLVM submodule
Co-authored-by: nickbeth <nickbeth>
2024-07-04 19:47:16 +05:30
Ishan09811
bf56dc4215
Update NDK to 26.1.10909125
Starting from version 26+, the NDK is based on LLVM 17 and comes with Clang 17 featuring full language and library C++20 support.
This means we can get rid of the massive LLVM submodule in the repo, which will be done in a following commit.

Co-authored-by: nickbeth <nickbeth>
2024-07-04 18:15:34 +05:30
Ishan09811
6b752669b2
Remove hasFragileUserData from the app manifest
It was effectively unused, and only caused issues for users, even after proper implementation that enabled it on signed builds only.

Co-authored-by: nickbeth <nickbeth@gmail.com>
2024-07-04 15:11:02 +05:30
Ishan09811
e4ef0c8465
small rebrand 2024-07-04 10:50:52 +05:30
lynxnb
74173a3967 Rework signal handling to remove per-thread handlers
Since the latest Android updates, which most users received in the form of August 2023 security patches, the Android runtime seems to rely on handling SIGSEGV via sigchain while performing JNI calls. We were hooking libc directly to inject our own signal handlers, so that they could run and restore the host TLS since the signal might have been generated in guest code. However, due to how we dispatched signals, the ART handlers were never called and the app crashed whenever a JNI call was made after installing our handlers.

This commit reworks signal handling to remove per-thread handlers. We now make a distinction between guest signals and host signals, and two new functions to set signal handlers have been introduced: `SetGuestSignalHandler` and `SetHostSignalHandler`. This greatly simplifies our signal handling code and allows us to get rid of some thread-local state.

Because of the above distinction, we install a "guest-safe" signal handler only when a guest signal is set. The guest-safe signal handler calls guest handlers only for guest signals, or falls back to the host handler if that's not the case.
Once a guest handler exists for a particular signal, we query libc sigaction as well as the sigchain-hooked sigaction and compare the results, and in case they differ we call sigchain's sigaction so that the host handler is correctly chained, ensuring no host handler can accidentally override the sigchain handler.
2023-11-30 22:45:50 +01:00
lynxnb
644c8f3cd4 Construct queue consumer threads after queues
CommandScheduler and PresentationEngine both constructed the consumer threads before their CircularQueues, this resulted in a data race that would lead to a segfault if the threads were scheduled for execution quickly enough, as they would read uninitialized memory.
2023-11-30 22:45:50 +01:00
PabloG02
b0207ab645 Address feedback 2023-09-21 11:07:48 +02:00
PabloG02
35b90c96a5 Stub ActivateConsoleSixAxisSensor and InitializeSevenSixAxisSensor 2023-09-21 11:07:48 +02:00