- Joined
- Apr 19, 2015
- Messages
- 1,023
- Trophies
- 1
- Location
- Stuck in the PowerPC
- Website
- heyquark.com
- XP
- 3,909
- Country
Hey all!
So I've been poking around in the documentation a lot recently and I've ended up with quite a few questions surrounding memory where everything's a but unclear and it seems we've only got vague forum posts to go off. So, I figured I'd throw a list at you all and we'll see how many we can answer ;3
Everything's in relation to 5.5.1 userspace.
Well, here we go!
EDIT: The discussion below has kinda shifted off the topic of these memory questions and onto far more interesting things around 5.5.x homebrew. Here's a funky list.
So I've been poking around in the documentation a lot recently and I've ended up with quite a few questions surrounding memory where everything's a but unclear and it seems we've only got vague forum posts to go off. So, I figured I'd throw a list at you all and we'll see how many we can answer ;3
Everything's in relation to 5.5.1 userspace.
Well, here we go!
- Exactly how much memory is available to us in userspace? How does the ELF loader affect this?
- If the amount of RAM we have is so limited, why can programs like LiteNES declare variables (check out the rom variable) that are so much bigger than what we're meant to have (something like 32MiB from what I read?)
(Q1/2) General consensus so far: There aren't any hard limits defined, just try it and see what sticks
Some of my preliminary investigations seem to point to us having something like 441MB of MEM2 available, please see this post
In regards to the ELF loader; see here
I'm also working on a program that should be able to get us 160ish MB of MEM2. Watch this space.
- Do we get access to MEM2? The Internet Browser has RAMPID 4, so don't we have it aswell?
(Q3) So far, the answer is yes. Use OSAllocFromSystem or set up a memory heap.
- If I just declare a variable with no special allocations or whatever, where does that get put in relation to MEM1/MEM2 etc?
(Q4) Prelim: MEM1.
- How do you use OSAllocFromSystem? What's up with the align variable?
(Q5) See this post.
- Where does OSAllocFromSystem get its RAM from (MEM1/MEM2 etc)?
(Q6) MEM2. Also look at using a heap instead.
- Why should I use OSAllocFromSystem over just a variable declaration?
(Q7) Depends on the variable, normal variable declarations go into MEM1 (quick but small) while proper allocations go into MEM2 (slower but huge)
- Could I theoretically mess with all RAM through poking at its address?
- Why can't I poke at RAM directly even if it's in a section that I am meant to have access to?
- What's up with all the other memory functions? How and why do they work?
EDIT: The discussion below has kinda shifted off the topic of these memory questions and onto far more interesting things around 5.5.x homebrew. Here's a funky list.
Keep in mind that I've stripped out all the technical discussion. X means either 1 or 2 in relation to sndcore libraries.
- Me: We actually have a whole bunch of RAM available [post]
- Dimok: That's not really what matters, the issues surrounding sndcoreX and gx2 are because the browser's already using them [post]
- Me: Since the browser is killed at the start of most homebrew, couldn't we find its old library handles and release them, thus giving us access to said libraries? [post]
- NWPlayer123: Sound1 and Sound2 can't be used at the same time, likely why everyone's having Sound2 issues. Also TCPGecko is far better than RPC since the browser is still running. [post]
- Dimok: Yeah, I suppose releasing the old libs could work. The issue is that the ones we care about have special shutdown functions that MUST be called, and it's unlikely the browser is actually calling them. [post]
- brienj: Since our homebrew is launched through the video player, could that be interfering with soundX? [post]
- Me/NWPlayer123: Probably.
- NWPlayer123: Well, I took apart the code and can confirm that you need to be on the correct CPU in order to shutdown the sound. [post]
- Me: Ooh, that's cool. Where'd you get the code? [post]
- NWPlayer123: Just download it from the NUS and find a plugin for IDA. [post]
- Me: So I managed to call the sound shutdown function correctly, but I still can't make a new instance. [post]
- NWPlayer123: Are you calling it properly? [post]
- Me: Just realized I was calling the wrong sound library. Oops. [post]
- Me: No luck. [post]
- brienj: At least I know I'm not the only one ;3 [post]
Last edited by QuarkTheAwesome,