Homebrew Unable to load any current emulator as an extlink module

lifehackerhansol

i write working(?) code
OP
Member
Joined
Oct 2, 2021
Messages
468
Trophies
0
XP
1,441
Country
Canada
The title is slightly misleading. Because common emulators do argument-based launch via argv, I thought I'd try to create an extlink -> argv app as a simple way to do this in Moonshell.

Trying to do this compiled with latest devkitARM refuses to work properly. It would just freeze at a white screen and do nothing afterwards.

Currently I have this: https://github.com/lifehackerhansol/extlink2argv

It compiles fine, and I think it also runs fine on its own? But when moonshell tries to launch it as an extlink module the console is stuck on a white screen.

Has anyone worked with extlink before, and could perhaps poke me in the right direction?

EDIT: I took a guess and attempted using only 0x200 as header size, as that was how it used to compile way back when. This did not work.

I should also note that any compiled with latest devkitARM did not work as reset_mse either. It refused to boot, kept getting stuck at a white screen. It would be a pain in the ass if I had to downgrade devkitARM to make this work...

EDIT 2: Perhaps the issue is that arm9 entry address requires to be set at 0x02000000. However ndstool flat-out refuses to set it there, always adding 0x800. I would have asked this on devkitPro's GitHub but I am blocked on their organization due to some other petty reason.

EDIT 3: 0x02000000 is not the solution. Why does it refuse to run?
 
Last edited by lifehackerhansol,

lifehackerhansol

i write working(?) code
OP
Member
Joined
Oct 2, 2021
Messages
468
Trophies
0
XP
1,441
Country
Canada
I've found the issue:

Moonshell 2, upon launching any homebrew, will write 32KB of DLDI data into the binary, regardless of whether the size is 32KB or not.

libnds, as of commit https://github.com/devkitPro/libnds/commit/c9668aa8f47bd41400f485b8a9a728b517a1174d, has reduced it to 16KB. Binaries as a result are corrupted upon loading into memory as Moonshell 2 overwrites 16KB of data after the 16KB of actual DLDI space.

As a result, I forked libnds, then made a wrapper that parses extlink data to argv, so that any modern homebrew can be bootstrapped this way: https://github.com/lifehackerhansol/extlink2argv

None of the memory address relocation were necessary, it just needed 32KB of space that modern homebrew don't have anymore.
 
  • Like
Reactions: banjo2

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Veho @ Veho: The cybertruck is a death trap.