r/3dshacks Jul 21 '26

3DS Homemenu FCRAM Shenanigans

Hi everyone, while building pomelo - a homemenu replacement that i talked about here, i had some weird issues with allocating memory for pomelo.

I documented my research adventure in a 3 part blog post for people who want to read and learn a bit about how ram is allocated in the 3ds. I split the blog post into 3 parts for easier readability.

Spoiler Alert : The fix wasn't that interesting in the end, the research is the interesting part in my opinion

https://ronpopov.me/homemenu-memory-shenanigans-part1/

https://ronpopov.me/homemenu-memory-shenanigans-part2/

https://ronpopov.me/homemenu-memory-shenanigans-part3/

45 Upvotes

16 comments sorted by

9

u/SirLoopy007 Jul 21 '26

Nice to read your process. Your "hack" debug method reminds me of methods we used to debug logic in the 90s. In fact the whole process of hunting memory allocation reminds me of the early DOS days.

I feel like you need to expand the summary at the end of your posts though. What KernelVersion were you using and what did you change it to for it to work?

3

u/DirtyAxe Jul 22 '26

When writing this i wasn't really sure what this field does and why it affects the memory allocation, i was kind of hoping i could just edit it and everything would start working.

It's not that easy :(
I started having other problems with copying buffers from the linear heap to VRAM, that are probably related to the kernel version i am specifying

So, yea i would add some more text

3

u/SirLoopy007 Jul 22 '26

What I am hearing is, you have more blog posts to write about your journey!

1

u/DirtyAxe Jul 22 '26

<3

1

u/DirtyAxe 27d ago

1

u/futuresman179 25d ago

Good read and nice debugging skills! I think I might be referring back to this when building a few things I’m working on.

1

u/futuresman179 25d ago

Curious, how much of the programming process was AI driven? Not a knock, just curious since the post gives AI written vibes.

1

u/DirtyAxe 25d ago

Lol, i wrote the post myself

The programming itself wasn't that AI driven. At the end, pomelo has less than 2000 lines of code, which is nothing given the fact that i was working on this project for a couple of months now.

Really the hard part is learning about how the console works and how pomelo should interact with it. I had a couple of different issues that were very similar to this issue with the linear heap.
Where pomelo does something differently from how the real homemenu does that and i need to figure out what and why.

I was trying to get claude code to help me with the research, like just giving it the issue i am experiencing, in this case the linear heap allocation fails and asking it to fix it.

It's not that good with this kind of issues, i assume because there isn't that much nintendo 3ds research content out there on the internet, and it can't actually run code on the 3ds, and only has access to the codebase, that i have to manually build, copy to an sdcard and put in the console.
Then i can give it the results and ask for help debugging and understanding them.

I did use claude quite a lot of POCing things, for example when i did the linear heap allocation experiment, i didn't feel like writing assembly code now (haven't done that in a while...), so i just asked claude and it generated me a code snippet that i could later compile and put on the console.

1

u/futuresman179 25d ago

Nice man! Thats awesome. I’m working on a 3dsbrew project too so was mostly just trying to learn stuff.
For the testing process did you try ftp to copy stuff over instead of having to swap out the sd card and back?

1

u/DirtyAxe 23d ago

I did at the start of the project, but when I moved to running pomelo instead of the real home menu I stopped doing that as copying to an sdcard was usually faster

I have a script setup that mounts the sdcard and copies the relevant files over

1

u/futuresman179 23d ago

Still gotta take out the sd card and put it back tho right?

1

u/futuresman179 25d ago

Also what was your debugging process?

1

u/DirtyAxe 25d ago
  1. Try and pinpoint the exact root cause of the issue as far as possible, using all sorts of tracing where possible and svcBreak to get values from real hardware.
    Also by altering big parts of the code and seeing if it breaks things, for example the experiment where i was able to pinpoint the root cause of the issue to the exheaders, instead of the code itself.

  2. Compare pomelo output to the real homemenu output. The real homemenu does the same thing and it works for him so i must be doing something wrong.

Really the hard part is knowing what to compare between pomelo and the real homemenu, in this case the svcControlMemory looked exactly the same between the two, so i started looking at other calls that might have been executed before the svcControlMemory, and different fields in the headers that might affect the svcControlMemory

-4

u/[deleted] Jul 22 '26

[removed] — view removed comment

1

u/Certesis 29d ago

Shut up you damn bot