Vandepad / sdl-mame-wii

Automatically exported from code.google.com/p/sdl-mame-wii
0 stars 0 forks source link

Memory problems and possible solution! ;) #26

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello Toad King! :)

As you already know, some roms like "mpang", "dstlk", "nwarr", etc fail to load 
correctly because of memory problems... :(
In "errors.txt" messages like this one appear:
Failed to allocate 16777216 bytes (src/emu/drawgfx.c:175)

I understand that this happens because of the memory limitations of the Wii: 
there are only 19MB available for applications in the MEM1 (1T-SRAM) area.

But aren't you forgetting about the 64MB of memory in the MEM2 (GDDR3 RAM) 
area? ;)
http://wiibrew.org/wiki/Memory_Map
http://wiibrew.org/wiki/Hardware/Main_Memory

Quoting...
"During normal operation, IOS reserves the upper 12-16MB of MEM2 for its own 
use; the rest can freely be used for code or data by running PPC code."

So, isn't there a way to take advantage of that extra available memory?
And since the errors occur in "drawgfx.c" I guess it could even be used to 
store graphics data! :P

Could this be done? ;)

Original issue reported on code.google.com by francisc...@gmail.com on 14 Apr 2011 at 5:31

GoogleCodeExporter commented 8 years ago
Seeing as nearly all homebrew runs on top of an IOS, I can't free that memory 
to use because it's already being used by the IOS and I think that's also where 
all the graphics RAM/framebuffers are. I'm not even sure there's a way to free 
a part of that for use.

Basically, the only way to expand the RAM the program can use is through a swap 
file on a USB device (probably a hard drive, unless you like your SD card/USB 
flash disk being thrashed by constant read/writes), similar to the way the old 
Linux-based port of SDL MAME on the Wii worked. That may or may not be done.

Original comment by baby.lueshi@gmail.com on 14 Apr 2011 at 7:41

GoogleCodeExporter commented 8 years ago
Yes, I agree! I do not think a swap file in SD or USB is a good idea either! :/

But anyway, I don't know all the internal details, but I think you should 
definitely take a look at these files from the source code of this nice 
homebrew called "WiiXplorer" here: ;)
http://code.google.com/p/wiixplorer/source/browse/trunk/source/Memory/

Quoting from the comments in the source...
"The app has now about 30-40% more memory available (~15 MB in mem1 and ~52 MB 
in mem2)"
Is this enough for you? ;)

Original comment by francisc...@gmail.com on 14 Apr 2011 at 11:18

GoogleCodeExporter commented 8 years ago
Oh, and as an alternative, you might also find useful the files 
"mem2_manager.*" from the WiiMC project source code:
> http://code.google.com/p/wiimc/source/browse/trunk/source/utils/
;)

Original comment by francisc...@gmail.com on 14 Apr 2011 at 11:28

GoogleCodeExporter commented 8 years ago
The WiiFlow project also has some open-source MEM2 stuff you can use:
http://code.google.com/p/wiiflow/source/browse/trunk/source/memory/

Any progress on trying this extra memory trick? ;)

Original comment by francisc...@gmail.com on 12 Jul 2011 at 9:55