This implement `GetRegionCode` accordingly to RE. I've added a setting in the GUI and a field in the Configuration file with a way to update the Configuration file if needed.
REV8 only added changes on performance buffer and wavebuffer dsp command
generation.
As we don't support any of those, we can just increment the revision
number for now.
* Implement Jump Table for Native Calls
NOTE: this slows down rejit considerably! Not recommended to be used
without codegen optimisation or AOT.
- Does not work on Linux
- A32 needs an additional commit.
* A32 Support
(WIP)
* Actually write Direct Call pointers to the table
That would help.
* Direct Calls: Rather than returning to the translator, attempt to keep within the native stack frame.
A return to the translator can still happen, but only by exceptionally
bubbling up to it.
Also:
- Always translate lowCq as a function. Faster interop with the direct
jumps, and this will be useful in future if we want to do speculative
translation.
- Tail Call Detection: after the decoding stage, detect if we do a tail
call, and avoid translating into it. Detected if a jump is made to an
address outwith the contiguous sequence of blocks surrounding the entry
point. The goal is to reduce code touched by jit and rejit.
* A32 Support
* Use smaller max function size for lowCq, fix exceptional returns
When a return has an unexpected value and there is no code block
following this one, we now return the value rather than continuing.
* CompareAndSwap (buggy)
* Ensure CompareAndSwap does not get optimized away.
* Use CompareAndSwap to make the dynamic table thread safe.
* Tail call for linux, throw on too many arguments.
* Combine CompareAndSwap 128 and 32/64.
They emit different IR instructions since their PreAllocator behaviour
is different, but now they just have one function on EmitterContext.
* Fix issues separating from optimisations.
* Use a stub to find and execute missing functions.
This allows us to skip doing many runtime comparisons and branches, and reduces the amount of code we need to emit significantly.
For the indirect call table, this stub also does the work of moving in the highCq address to the table when one is found.
* Make Jump Tables and Jit Cache dynmically resize
Reserve virtual memory, commit as needed.
* Move TailCallRemover to its own class.
* Multithreaded Translation (based on heuristic)
A poor one, at that. Need to get core count for a better one, which
means a lot of OS specific garbage.
* Better priority management for background threads.
* Bound core limit a bit more
Past a certain point the load is not paralellizable and starts stealing from the main thread. Likely due to GC, memory, heap allocation thread contention. Reduce by one core til optimisations come to improve the situation.
* Fix memory management on linux.
* Temporary solution to some sync problems.
This will make sure threads exit correctly, most of the time. There is a potential race where setting the sync counter to 0 does nothing (counter stays at what it was before, thread could take too long to exit), but we need to find a better way to do this anyways. Synchronization frequency has been tightened as we never enter blockwise segments of code. Essentially this means, check every x functions or loop iterations, before lowcq blocks existed and were worth just as much. Ideally it should be done in a better way, since functions can be anywhere from 1 to 5000 instructions. (maybe based on host timer, or an interrupt flag from a scheduler thread)
* Address feedback minus CompareAndSwap change.
* Use default ReservedRegion granularity.
* Merge CompareAndSwap with its V128 variant.
* We already got the source, no need to do it again.
* Make sure all background translation threads exit.
* Fix CompareAndSwap128
Detection criteria was a bit scuffed.
* Address Comments.
* Implement some calls of ISelfController
This PR implement some calls of ISelfController:
- EnterFatalSection
- LeaveFatalSection
- GetAccumulatedSuspendedTickValue (close#937)
According to RE of the 8.1.0 am service.
* thread safe increment/decrement
* Fix thread safe
* remove unused using
* Implement mii:u and mii:e entirely
Co-authored-by: AcK77 <Acoustik666@gmail.com>
This commit implement the mii service accurately.
This is based on Ac_k work but was polished and updated to 7.x.
Please note that the following calls are partially implemented:
- Convert: Used to convert from old console format (Wii/Wii U/3ds)
- Import and Export: this is shouldn't be accesible in production mode.
* Remove some debug leftovers
* Make it possible to load an arbitrary mii database from a Switch
* Address gdk's comments
* Reduce visibility of all the Mii code
* Address Ac_K's comments
* Remove the StructLayout of DatabaseSessionMetadata
* Add a missing line return in DatabaseSessionMetadata
* Misc fixes and style changes
* Fix some issues from last commit
* Fix database server metadata UpdateCounter in MarkDirty (Thanks Moose for the catch)
* MountCounter should only be incremented when no error is reported
* Fix FixDatabase
Co-authored-by: Alex Barney <thealexbarney@gmail.com>
* Implement GetCurrentIpConfigInfo
This is needed by Rocket League.
Also fix GetCurrentIpConfigInfo to not return ipv6 addresses
* Address Ac_K comment
* Stub the application copyright framebuffer api
As we currently don't support multi layers on vi/nvnflinger, this PR
implement a stub of this API.
* Address Cyuubi's comments
* Add IPC checks and comments for future reversing
Co-authored-by: Ac_K <Acoustik666@gmail.com>
Co-authored-by: Ac_K <Acoustik666@gmail.com>
* Fix a crash when closing the main Ui
Also make sure to dispose the OpenAL context to not leak memory when
unloading the emulation context.
* Improve keys and 'game already running' dialogs
* Make sure to dispose the page table and ThreadContext
Less memory leaks!
* Fix tests
* Address gdk's comments
* Implement IDeliveryCacheProgressService in bcat
This stub IDeliveryCacheProgressService IPC interface as we don't plan
to support cache delivery.
* Address jd's comments
* Address jd's comment correctly
* Address gdk's comments
* Fix inconsistencies with UserId
The account user id isn't an UUID. This PR adds a new UserId type with
the correct value ordering to avoid mismatch with LibHac's Uid. This also fix
an hardcoded value of the UserId.
As the userid has been invalid for quite some time (and to avoid forcing
users to their recreate saves), the userid has been changed to "00000000000000010000000000000000".
Also implement a stub for IApplicationFunctions::GetSaveDataSize. (see
the sources for the reason)
Fix#626
* Address jd's & Ac_k's comments
* Fix application list
* Convert file extensions to lowercase before comparing
* AcK's requested changes
* fixed bug found by gdkchan's requested changes
* Account for mismatch between LibHac.TitleLanguage and ...System.Language
* prepo IPrepoService accurate parsing for report
I've found they use msgpack for the report, so I've added a nuget package and deserialize the report in the right way.
Close#838
* jD requested changes
* Change nuget to MsgPack.Cli
* Use var instead of explicit cast
* Keep the GUI alive when closing a game
Make HLE.Switch init when starting a game and dispose it when closing
the GlScreen.
This also make HLE in charge of disposing the audio and gpu backend.
* Address Ac_k's comments
* Make sure to dispose the Discord module and use GTK quit method
Also update Discord Precense when closing a game.
* Make sure to dispose MainWindow
* Address gdk's comments
* Remove redundant modulo on wave buffer index
This is already performed by SetBufferIndex
* Correct typo in UpdateDataHeader
MixeSize -> MixSize
* Remove unused variable in audren
'volume' was unused and 'voice.Volume' was used instead so remove 'volume'
* Update to LibHac 0.8.2
This brings support for temporary savedata, ignores case in key names when loading from a file, and prints the rights ID correctly when missing a title key.
* Auto-format IFileSystemProxy
* Fix race condition in ContentManager
This fix a race condition happening since #791 when trying to load a
game via command line.
* Address gdk's comments
* Ensure to dispose the FileStream and not the IStorage
* firmware installer
* Add directory installation option and fix 9.x support for directory
* Fix missing system font error while installing for the first time
* Address code style comments
* Create and use InvalidFirmwarePackageException
* Fix LDj3SNuD's comments
* addressed alex's comments
* add label to status bar to show current firmware version
Co-authored-by: Thog <thog@protonmail.com>
* Use savedata FS commands from LibHac
* Add EnsureSaveData. Use ApplicationControlProperty struct
* Add a function to migrate to the new directory layout
* LibHac update
* Change backup structure
* Don't create UI files in the save path
* Update RyuFs paths
* Add GetProgramIndexForAccessLog
Ryujinx only runs one program at a time, so always return values reflecting that
* Load control NCA when loading from an NSP
* Skip over UI stats when exiting
* Set TitleName and TitleId in more cases. Fix TitleID naming style
* Completely comment out GUI play stats code
* rebase
* Update LibHac
* Update LibHac
* Revert UI changes
* Do migration automatically at startup
* Rename RyuFs directory to Ryujinx
* Update RyuFs text
* Store savedata paths in the GUI
* Make "Open Save Directory" work
* Use a dummy NACP in EnsureSaveData if one is not loaded
* Remove manual migration button
* Respond to feedback
* Don't read the installer config to get a version string
* Delete nuget.config
* Exclude 'sdcard' and 'bis' during migration
Co-authored-by: Thog <thog@protonmail.com>
* Make HLE disposable safely
This fix the oldest issue with the HLE code: the kernel side
disposability.
Changelog:
- Implement KProcess::UnpauseAndTerminateAllThreadsExcept, KThread::Terminate, KThread::TerminateCurrentProcess, KThread::PrepareForTermiation and the svc post handler accurately.
- Implement svcTerminateProcess and svcExitProcess. (both untested)
- Fix KHandleTable::Destroy not decrementing refcount of all objects stored in the table.
- Spawn a custom KProcess with the maximum priority to terminate every guest KProcess. (terminating kernel emulation safely)
- General system stability improvements to enhance the user's experience.
* Fix a typo in a comment in KProcess.cs
* Address gdk's comments