101 Commits

Author SHA1 Message Date
CyberYoshi64
a3c5746e06
Add more mountpoint names for LayeredFS updates (#1994)
* Add more mountpoint names for LayeredFS updates

* Move `pat1` to the bottom of the list

* Isolate Mario Kart 7 mountpoint

* Apply suggestions from code review

Co-authored-by: PabloMK7 <hackyglitch2@gmail.com>

---------

Co-authored-by: PabloMK7 <hackyglitch2@gmail.com>
2024-02-02 14:42:57 +01:00
PabloMK7
e2778a45cf Fix macro change in libctru 2023-10-31 18:38:40 +01:00
TuxSH
035c50c625 Fix support for all older versions
- Move emuNAND hook to ITCM, fixing previously untested emuNAND support
  for 5.0 (and possibly more versions). This was a very long-standing
  bug
- Fix booting on versions 4.x to 8.x, and restore full support for 5.x
  to 8.x. All Arm11 custom sysmodules and k11ext have been disabled on
  4.x because the Luma3DS v13.0 changes couldn't be ported (this means
  no Rosalina and no region-free and such, and while I could restore
  some of the functionality, you should just update *after* installing
  Luma, like you've been instructed to)
2023-08-12 18:00:08 +02:00
TuxSH
5989d9d61d hbldr: fix DSPmem cacheability attrib regression 2023-08-10 16:41:40 +02:00
TuxSH
41eccacd51 hbldr: fix DSPmem mapping and give access to all Arm11 IO regs 2023-08-09 23:52:16 +02:00
TuxSH
41edcde5c0 Add enable_dsi_external_filter and allow_updown_leftright_dsi 2023-07-17 01:11:43 +02:00
PabloMK7
c055fb6f5e
Merge 3GX plugin loader fork (#1916)
This commit adds all the changes made to the 3GX plugin loader fork of Luma3DS. The most important features are:

- Add 3GX plugin loader support. New service added to rosalina: plg:ldr
- Add svcControlProcess, svcControlMemoryUnsafe and improve svcMapProcessMemoryEx (breaking change)
- Allow applications to override certain configurations depending on their needs:
    - Disable core2 thread redirection
    - Disable game patching for the next app
    - Force New 3DS speedup
    - Force next application in a specific memory mode
    - Block the opening of the Rosalina menu
- Add GDB commands to list all process handles and catch all SVC (latter is for IDA Pro as gdb client supports it)
- Other changes necessary for plugins to work properly. Please check changed files in this PR for more details. 

---------

Co-authored-by: PabloMK7 <hackyglitch@gmail.com>
Co-authored-by: Nanquitas <nath.doidi@gmail.com>
Co-authored-by: TuxSH <1922548+TuxSH@users.noreply.github.com>
2023-07-14 20:08:07 +02:00
TuxSH
9fa1d42aa8 Loader: make it simpler to load ext. modules by clearing N3DS bit
And also move the location of IPS/BPS patches for (non-KIP) sysmodules
to /luma/sysmodules/<titleId>.<ips/bps> and only require "Load ext
firm/modules" option for it.
2023-07-09 22:00:51 +02:00
TuxSH
5b417189db Remove "Use EmuNAND FIRM with R" option
This is a leftover from the Gateway era that has long lost its utility
and that unnecessarily complicated the code base.

Please just load an external FIRM from SD card if you need something
similar.

Also refactor the multi-EmuNAND code and CTRNAND mounting code.
2023-07-09 00:28:17 +02:00
TuxSH
82d689b485 Fix build issues
Closes #1894
2023-06-16 21:28:08 +02:00
TuxSH
985380c0d8 loader: break when failing to load process (e.g. missing boot.3dsx) 2023-03-27 21:49:00 +02:00
TuxSH
ef1072f996 Add option to force audio routing to speakers, closes #1837
Also refactor ini file a little bit
2023-02-10 01:02:01 +00:00
TuxSH
2e08b7b44f libctru svcCreateCodeSet changes 2023-02-08 18:25:03 +00:00
TuxSH
1d7cca25d1 Fix long-standing bug affecting hbldr TID change option
This was a long-standing bug since Luma3DS v8.0.

If you changed the homebrew title and didn't immediately reboot, then
the ExHeader during termination would not match the ExHeader that was
was used for loading the process, and thus sysmodule process refcounts
would get all messed up.

The obvious solution to this is to ensure no application is running
while changing the hbldr titleID (hence the changes in custom PM).

This was quite possibly one of the cause of homebrew failing to load
when using N3DS H&S.
2023-02-08 16:14:59 +00:00
TuxSH
1888e17b22 Add ability to force routing audio to headphones...
... even when HPs aren't inserted.

This is aimed at people using Bluetooth audio hw mods.

There are some software limitations, please read the INI/option
description.

Closes #1828.
2023-02-08 00:52:57 +00:00
TuxSH
35e6c5ace9 hbldr: fix dependency list (and launch mp)...
Also fix handling of HBLDR_DEFAULT_3DSX_TITLE_NAME, and always display
process creation time in process list on non-release builds.
2023-01-29 19:25:32 +00:00
TuxSH
088cf6b673 hbldr: add act/cecd/friends to deplist
And make WiFi usable earlier when autobooting homebrew
2023-01-25 22:07:21 +00:00
TuxSH
7b97af473a Add ability to redirect app core1 threads to core2
N3DS-only option. See config.ini for details and context. This should
make very demanding games (those which already use 3x clockrate and L2C
by default, like Pokémon US/UM) between 5 to 15% faster. Not widely
tested, and can potentially break some games and other apps.
2023-01-24 22:05:57 +00:00
TuxSH
ceea6afa05 loader: add external CXI loading.
When "load external firms and modules" is enabled, Loader will load the
sysmodule from /luma/sysmodule/<titleid>.cxi (all uppercase, and with
the N3DS title ID bit if relevant) and skip patching. Note that this is
a title ID here, not a process name (unlike what we do for KIPs).

While this is aimed at enabling people to easily load replacements for
official sysmodules, you can load your own custom sysmodules that don't
correspond to anything installed. You can use gdb to do so:

  set remote exec-file <tid>
  run
2023-01-23 19:53:01 +00:00
TuxSH
eb6d8523d1 loader: enable layeredfs+locale emu for all applets
Not tested (except for HM which is known to work).

And restrict code.bin and exheader.bin to when *both* "external firm
and modules" and "game patching" are enabled.
2023-01-22 18:45:47 +00:00
TuxSH
d09bfaf348 hbldr: grant full RW access to DSP RAM
This makes testing custom DSP firmware binaries much easier.
2023-01-07 22:36:01 +00:00
TuxSH
5cdbfab54b Add build options to Makefile
For stuff like testing PASLR, *hax2x, khc3ds, etc.

Also fix a corner-case bug when changing the 3dsx app from itself to
itself, if its TID corresponds to the default.
2023-01-07 15:38:36 +00:00
TuxSH
fe4bb0857b Implement autobooting into homebrew (3DS and DSi modes)
Add config option to autoboot into 3DS and DSi homebrew menu, without
going through Home Menu (nor launching it).

For 3DS homebrew, this requires homebrew built with libctru v2.0.0 or
later (v2.0.0 was released 2.5y ago).

We simulate a "reboot into title" to achieve this. This being said, when
launching stuff like Pokemon US/UM on O3DS, Home Menu reboots into
itself and not the game directly. This will cause Home Menu to crash if
you use this feature and configure it to use a non-default memory layout
(but if you don't, Home Menu will work just fine).
2023-01-03 15:30:07 +01:00
TuxSH
0a6b6865ca loader: always reload ExHeader for hb, after all
Caching exheader for applications launched through Home Menu has very
little benefit, as UnregisterProgram is called a lot, and, for 3DSX,
boot.3dsx/target 3DSX can be changed at any time.
2022-12-29 18:47:43 +01:00
TuxSH
ffbd8554d5 loader: implement PASLR (disabled by default)
Faithfully implement the PASLR algorithm official Loader
uses (it's not very good). Physical address space layout
randomization means that the layout of the pages in physical
memory are randomized, but doens't randomize the virtual addresses.

Also refactor some parts of our Loader impl a little more.
2022-12-29 00:23:45 +01:00
TuxSH
7074ac1166 Move hb:ldr from Rosalina to Loader
Let's not pretend in 2022 that it needed things from rosalina sysmodule
- it did not.

This moves 3DSX loading from Rosalina to Loader, and also removes all
the dependencies Loader had to other Luma3DS components (if kernel ext.
is missing, a default config will be used). This means that, as long as
you replace Loader to the one in here, you will be able to properly load
3DSX files.

Changes:
- hb:ldr is now hosted in loader
- hb:ldr LoadProcess, PatchExHeaderInfo, DebugNextApplicationByForce:
  all removed
- fix a bug where some malformed 3DSX files were not rejected
- grant access to CONFIG11 registers to 3DSX homebrew
- move dirty homebrew chainload (when HM. isn't loaded nor loadable) to
  pm
- pm:dbg (ext.) PrepareToChainloadHomebrew: removed
2022-12-25 23:27:48 +01:00
TuxSH
ea8f9f4667 loader: refactor part around HIO 2022-05-06 19:53:27 +01:00
TuxSH
676bbf0d88 Moved config file to INI, and more
- Add support for saving screen filters color temperature and NTP timezone offset (you still need to go to misc->save config)
- some advanced options moved to "in ini file only"; "patch games" is now enabled by default
- ntp: fix support for UTC+12 to +14
- remove deprecated custom svc 0x2e
2022-03-28 20:30:02 +01:00
TuxSH
44c1711805 Update copyright years 2022-03-13 18:00:00 +00:00
Gabe Cook
fd4d54a2cc Allow patches in the home menu 2022-03-07 22:19:43 +00:00
Kookies
b83a0abb9d
Updated sysmodule Defines for latest libctru (#1669) 2021-08-27 06:46:36 +02:00
PabloMK7
caadb3ae5d
loader: fix fileOpen argument order 2021-06-29 01:20:38 +02:00
TuxSH
50c81f8165 loader: use fsMakePath 2021-04-30 19:01:13 +01:00
TuxSH
883c5e25dd sysmodules: update ifile, process_patches 2021-01-16 21:16:06 +00:00
TuxSH
2fcd2d862d Add small debug helper for sysmodule reimpls 2020-12-07 20:17:30 +00:00
Pixel-Pop
a7ce156f59
Update dlp client region free
Allows all dlp versions to have region free by patching necessary instruction after locating it with pattern.
2020-07-18 15:25:53 -07:00
Pixel-Pop
67ad6d425a
Patch DLP client region check 2020-07-17 14:07:45 -07:00
TuxSH
768e587b76 sysmodules: introduce "luma shared config", rewrite ndmu workaround 2020-07-12 19:36:18 +01:00
Aurora Wright
3a0418e279 loader: revert to use the NS patch due to a Nintendo bug: https://www.3dbrew.org/wiki/NCCH/Extended_Header#Flag1 2020-05-29 23:31:05 +02:00
Aurora Wright
1899bf377b loader: replace NS N3DS CPU patch with exheader override, fix overriding exheader with homebrew 2020-05-29 20:57:05 +02:00
TuxSH
92da214066 loader: add dsp patch for safe_firm 2020-05-02 23:50:04 +01:00
TuxSH
166bdbeb7d Add option to run rosalina on N3DS SAFE_FIRM.
Also enables a qtm error bypass
2020-05-02 23:32:21 +01:00
TuxSH
85cfa5cba6 loader: enable secureinfo patch on safe_firm 2020-05-02 18:26:58 +01:00
TuxSH
c7a3a0278c add quick luma detection getinfo 2020-04-28 10:42:30 +01:00
TuxSH
ced78cb072 use -wrap for exit 2020-04-27 01:07:57 +01:00
TuxSH
f334e3b951 loader/pm: move "force init SD" code to pm. Greatly reduces the number of Arm9 svcBreak with 0xC8804465 2020-04-27 00:47:16 +01:00
TuxSH
eb37ac4142 redefine exit methods for sysmodules. Partially fixes the shutdown issue 2020-04-26 01:50:47 +01:00
TuxSH
31891efbca Current year is 2020 2020-04-25 13:42:10 +01:00
TuxSH
0543c208fd Fix #1375 properly this time
Thanks @muhmuhten
2020-04-24 22:52:05 +01:00
TuxSH
26454dc832 loader/patcher.c: make gcc stop sometimes complaining 2020-04-19 18:03:45 +01:00