72 Commits

Author SHA1 Message Date
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
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
TuxSH
5a83a46423
Merge pull request #1349 from leoetlino/bps
loader: Add support for BPS patches
2020-04-16 23:35:14 +02:00
TuxSH
55d51217d8 Fix hex parsing in patcher.c (langemu). Fixes #1375
Thanks @Lizardon1
2020-04-15 22:28:38 +01:00
Léo Lam
8233d4e226 loader: Add support for BPS patches
The BPS format allows distributing patches that are smaller and that do
not contain copyrighted content if data is relocated
(unlike non-trivial IPS patches).

This is essential for games such as Majora's Mask 3D that have three
barely different code revisions. Supporting all three versions would
demand an unreasonable amount of work; with BPS patches only one
version has to be supported.

The patcher is written in C++ in order to make it possible to share the
implementation with Citra and because a C version would be a lot more
ugly and tedious to write. The patcher is non-intrusive for the rest of
the codebase and self-contained so hopefully that isn't an issue.

This adds roughly ~0x500 bytes of code to the loader sysmodule.
Code looks reasonably optimised (in IDA). Tested and works on an o3DS.
2019-12-21 18:32:18 +01:00
Léo Lam
c3b97999f5 loader: Fix boolean logic error 2019-07-07 15:06:15 +02:00
TuxSH
c913de1e67 Fix layeredfs, fix #1280 #1275 #1262 & others 2019-07-03 22:19:38 +02:00
TuxSH
4285736286 fix layeredfs regression 2019-04-21 12:15:50 +02:00
TuxSH
687dfddd9f HBLDR_DebugNextApplicationByForce changes 2019-04-19 00:37:20 +02:00
TuxSH
0b33134f6c Loader services refactor 2019-04-18 19:48:01 +02:00
TuxSH
ef034a87d4 revert fsldr change, fix null deref in pm 2019-03-29 22:40:54 +01:00
TuxSH
e688ec9257 move patches to pm 2019-03-29 19:07:24 +01:00
TuxSH
e57abad52f ctrulib changes 2019-03-29 00:09:59 +01:00
TuxSH
d28e961adc Use <string.h> & <3ds/exheader.h>, fix some bugs, etc.
also fix all warnings and use -Werror
2019-03-15 23:03:23 +01:00
TuxSH
4b40dd52f4 Give a proper build system for each sysmodule, k11ext, arm11.
Previously, these Makefiles didn't correctly track header changes.
The project doesn't build as a whole, future commits will fix it.
2019-03-15 23:03:19 +01:00
TuxSH
6bd7070d38 Do the same for romfs redit => get rid of armips; update README.md 2019-03-15 23:03:18 +01:00
Aurora Wright
53622d777b Fix https://github.com/AuroraWright/Luma3DS/issues/1095 and https://github.com/AuroraWright/Luma3DS/issues/1118 2018-08-21 18:57:45 +02:00
Mikaela RJ Szekely
93561003e8 Implement #989: Add configurable splash duration 2017-12-28 21:50:06 -05:00
TuxSH
22a8661fe1 Always patch FS and P9, remove SM service checks 2017-11-02 21:52:14 +01:00
Aurora Wright
76f057dafb Remove friends patch as it's useless 2017-10-05 18:45:06 +02:00
Aurora Wright
f46773ba64 Stub isTitleAllowed 2017-09-20 01:36:02 +02:00
Aurora Wright
f67d333457 Update fpdver 2017-09-19 14:46:42 +02:00
Aurora Wright
13317b9548 Change ntrboot behavior, turn Luma into a chainloader when used as ntrboot FIRM as it can not be functional, disable FIRM protection when ran from ntrboot B9S 2017-08-20 16:08:54 +02:00
Aurora Wright
36c1da1d61 Add mention of exheaders in the Enable game patching description 2017-08-07 21:20:08 +02:00