Welcome! Log In Create A New Profile

Advanced

Are SD card and USB HDD interchangeable in HB development

Posted by DRS_ 
Are SD card and USB HDD interchangeable in HB development
August 03, 2012 01:38PM
Hi,

Currently I'm using a SD card to store a Doom 3 PK4 file. However, it takes minutes to just parse the files in the PK4. I know my SDcards only read/write about 100-150 KBytes per second, so I'm wondering if I can easily continue my development using a USB HDD instead of the SD card. My guess is that it will load files much faster then when using SDcard

I currently upload the Doom 3 executable (far from finished ofcourse) to my Wii using Wiiload Java client and the app then opens files from SDcard.

Basically I have the following questions:

* Does lib-ogc support USB HDDs? If so, what version do I need?
* Do I have to change my (hardcoded) file locations? For example, do I need to use a different drive name (i.e. instead of /apps/DoomGX /USB0/apps/DoomGX)

Does anybody use a HDD to develop any apps?

Thanks!

Danny
Re: Are SD card and USB HDD interchangeable in HB development
August 03, 2012 05:41PM
I remember reading you should be using full paths even when loading from SD (sd:/apps/DoomGX).

I would guess standard single-partitioned USB/FAT HDDs are supported with your current setup (usb:/apps/DoomGX). But you should be able to see the problem there: HDDs are more likely to have partitions (some of them formatted as NTFS or extN) so you would need to parse the partition table and act accordingly (adding libntfs and/or libextfs if you want to support those). You obviously need to handle it in code because the average user has no idea of whether his HDD is a standard single-partitioned USB/FAT HDD.

Also, USB2.0 is only "supported" when running on IOS58.

I have never plugged an HDD to WiiMC but I saw there's code to handle all this there. Reading partition table, mapping partitions to usb0, usb1, detecting/guessing loading/saving device, checking the IOS version, etc. That is the code you should be reading if you really think this is needed.
Re: Are SD card and USB HDD interchangeable in HB development
August 03, 2012 07:35PM
From what I've read, I believe if you use "fat:" instead of either "sd:" or "usb:", it'll default to SD and then go to USB is SD isn't present. Not 100% sure. I think if you want to specify which to use though, you use either "sd:" or "usb:", depending which you want to use.
Re: Are SD card and USB HDD interchangeable in HB development
August 03, 2012 08:55PM
I often use relative paths ( data/file.txt ) when publishing my homebrew. So that if the person installed it on a SD or USB HD it will still find the files (and not be trying to load data files from the sd:/ all the time ). The only downfall of this is that when using wiiload the root directory is always "/", so I end up having to use paths like "/app/mygame/data.txt" - EVERYWHERE but this doesn't work in all cases because some add-on libraries (such as Lua) doesn't care about chdir()/current directory when loading includes.
Re: Are SD card and USB HDD interchangeable in HB development
August 03, 2012 10:59PM
Thanks! Useful link. I'm currently on IOS38 (never updated it) so'll try IOS58 on my other wii first:)
Re: Are SD card and USB HDD interchangeable in HB development
August 04, 2012 06:28AM
Re partitions and such: you don't need to worry about that unless you specifically want to support mounting more than one partition at a time or partition types other than FAT (ext2/3, ntfs etc.). Otherwise libfat is able to parse the MBR and mount the first found FAT partition without the need for any extra code.

"fat:", "sd:" and "usb:" are not strict names, they can apply to any device and they are not always setup automatically for you. It mainly depends on how you use libfat:
- fatInitDefault() will attempt to mount the front SD slot, a USB HDD, an SD gecko in slot A, an SD gecko in slot B (in that order) using the device names "sd", "usb", "carda", "cardb". It will also try and parse the first command-line argument passed to your app to detect which device should be the default path (referenced by "/").
- fatInit() works the same way but lets you set how many cache pages each device should get and specify if the default path should be changed.
- fatMountSimple() will let you mount a single device with a given device name. So you could use this to try and mount the sd card using the name "fat", and then only if it failed attempt to mount a USB drive using the same "fat" name. Then you could use "fat:" everywhere in your code without worrying about which device it actually refers to.
- fatMount() is similar to the above but also lets you specify a specific starting sector for the partition, how many cache pages should be used and how many sectors each cache page should have.

Lastly: don't expect USB to perform much better than SD, there's actually not much difference between them unless you've got a really old SD card.
Re: Are SD card and USB HDD interchangeable in HB development
August 10, 2012 12:52PM
Tueidj, thanks man! Do you know any speed numbers on newer SD cards? I'm using a 5 year old 2GB card I guess. The speed I'm currently experiencing is real slow so anything that is faster is appreciated.
Re: Are SD card and USB HDD interchangeable in HB development
January 19, 2013 10:13AM
fatInitDefault seems to work only if the Wii sd card is inserted.

fatInitDefault is always false if I launch the dol file from an USB device and the SD is not inserted.

Is this the correct behaviour?
Re: Are SD card and USB HDD interchangeable in HB development
February 16, 2013 10:04AM
Quote
oibaf
fatInitDefault seems to work only if the Wii sd card is inserted.

fatInitDefault is always false if I launch the dol file from an USB device and the SD is not inserted.

Is this the correct behaviour?
the same here =)
Sorry, only registered users may post in this forum.

Click here to login