Why SDL can't load an image via wiiload instead of sd card ?

support for the powerpc toolchain
virus7
Posts: 12
Joined: Fri Aug 19, 2011 8:17 am

Why SDL can't load an image via wiiload instead of sd card ?

Post by virus7 » Fri Aug 26, 2011 6:41 am

hi
I'm having a hard time loading an image with the SDL library via wiiload ... but when i put the image on sd card it works well .. so .. is there anyway to load the image using SDL directly form my laptop ( using wiiload ) ?? or the only way is using sd card

this is the code when I use sd card :

Code: Select all

background = SDL_LoadBMP("sd:/apps/SDL/background.bmp");
but when I use this :

Code: Select all

background = SDL_LoadBMP("background.bmp");
it does not work

please help

WinterMute
Site Admin
Posts: 1404
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: Why SDL can't load an image via wiiload instead of sd ca

Post by WinterMute » Fri Aug 26, 2011 1:49 pm

No, currently you can't load files via wiiload other than from the SD card as you've been doing.

I've just modified wiiload so you can set argv0 from the command line though, this will let you change the initial working directory set when the SD card is initialised. You can either build wiiload yourself, it's in SVN at http://devkitpro.svn.sourceforge.net/vi ... i/wiiload/ , or you can grab the builds I've just put up at https://sourceforge.net/projects/devkitpro/files/misc/ . The tarball only has wiiload 0.5.1 binaries for win32 & OSX atm, I didn't have time to build the linux versions. The binaries are still showing as pending atm but should hopefully be live soon.

when you're running the new wiiload just add the path you want as the first parameter after the dol

Code: Select all

wiiload mysdlapp.dol sd:/apps/SDL/mysdlapp.dol
Adding the name of the dol isn't necessary but the trailing slash is.
Help keep devkitPro toolchains free, Donate today

devkitPro IRC support
Personal Blog

virus7
Posts: 12
Joined: Fri Aug 19, 2011 8:17 am

Re: Why SDL can't load an image via wiiload instead of sd ca

Post by virus7 » Sat Aug 27, 2011 1:38 am

thank you so much ... but as you can see .. I'm a totally noob to consoles programming .. so i have one question :
Is the way that you just did to modify wiiload .. is it going to solve my problem ?? if it is ... please can you explain in details a little bit because I really have no idea what you are talking about .

one more question ... what do you think is the most efficient and easiest library to use with wii programming other than SDL ??

WinterMute
Site Admin
Posts: 1404
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: Why SDL can't load an image via wiiload instead of sd ca

Post by WinterMute » Sun Aug 28, 2011 10:58 am

Yes, this mod will solve your problem.

When the wii SDL port starts up the SD card it will attempt to set the working directory using the path it finds in argv[0]. When you run directly from SD card via HBC then that path is set to the path of the dol you just loaded i.e. sd:/apps/SDL/test.dol When running via wiiload argv[0] is normally just set to the name of the dol which leads to the directory being set to sd:/.

What I did allows you to set argv[0] directly so you can effectively specify the working directory your application is in when it starts up. This means you need to have your data files on the SD card already but since these change less often than the code it's much less inconvenient than having to copy the DOL to SD every time you want to test.

Stick with SDL, at least that way you'll learn something useful while you still need "efficient and easy". There are other libraries around but if you attempt to get Wii specific while not really understanding the underlying code then you'll end up extremely frustrated when you start looking at programming other things.
Help keep devkitPro toolchains free, Donate today

devkitPro IRC support
Personal Blog

virus7
Posts: 12
Joined: Fri Aug 19, 2011 8:17 am

Re: Why SDL can't load an image via wiiload instead of sd ca

Post by virus7 » Wed Aug 31, 2011 9:58 am

I know that i'm a pain in the ass but actually all what I need is a well explained steps on what to do with the new WiiLoad that you just made and how to make it work with SDL for loading images directly .

by the way : what do you think in MLib ??

virus7
Posts: 12
Joined: Fri Aug 19, 2011 8:17 am

Re: Why SDL can't load an image via wiiload instead of sd ca

Post by virus7 » Wed Aug 31, 2011 10:17 am

I said that I don't know what to do in the previous post :

- Because I don't know how to set argv0 from the command line ? and what do you mean by that ?

- And I don't know what to do with the files in the second link , where you said that " or you can grab the builds I've just put up at https://sourceforge.net/projects/devkitpro/files/misc/ " . it only contains a source file and a makefile , and I have no idea what the heck to do with them .

- And where can I find this code :

Code: Select all

wiiload mysdlapp.dol sd:/apps/SDL/mysdlapp.dol
thank you so much man :D

WinterMute
Site Admin
Posts: 1404
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: Why SDL can't load an image via wiiload instead of sd ca

Post by WinterMute » Wed Aug 31, 2011 4:20 pm

Most libraries there are out there which claim to make writing Wii games easier are a pile of complete and utter nonsense, generally they should be avoided at all costs. I'm quite reluctant to even recommend SDL but at least with that library you can learn something relatively useful.

You need to download wiiload-0.5.1.tar.bz2, inside that archive are binaries of wilload for OSX and Windows. Replace the wiiload in your devkitPPC/bin folder with the appropriate binary. These binaries will be available inside the next toolchain update.

In the Makefile for your project you should see a line like this :-

Code: Select all

#---------------------------------------------------------------------------------
run:
	wiiload $(TARGET).dol
add something lke sd:/apps/SDL/$(TARGET).dol to the end of that line, it should be the path you used for SDL_LoadBMP originally.

You should then be able to run your code using "make run" from the command line, assuming you have the WIILOAD environment variable set appropriately. You should also be able to add a command to your editor so that it works directly from there.

Unfortunately I really have to say that the whole toolchain setup right now probably isn't suitable for someone who's a complete beginner. You may possibly be better off learning to program SDL on a PC and coming back later when you have more experience and we have some more documentation suitable for beginners.
Help keep devkitPro toolchains free, Donate today

devkitPro IRC support
Personal Blog

virus7
Posts: 12
Joined: Fri Aug 19, 2011 8:17 am

Re: Why SDL can't load an image via wiiload instead of sd ca

Post by virus7 » Wed Aug 31, 2011 6:27 pm

- I replaced the old wiiload 0.5 with the new wiiload 0.5.1

- I set the image in the same file as the template.elf and template.dol

- this is my image load code :

Code: Select all

background = SDL_LoadBMP("texture.bmp");
- this is my makefile code :

Code: Select all

run:
	wiiload $(TARGET).dol texture.bmp
- And finally the result is a nice Black Screen and nothing alse.

- do you have any idea what to do ???

WinterMute
Site Admin
Posts: 1404
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: Why SDL can't load an image via wiiload instead of sd ca

Post by WinterMute » Wed Aug 31, 2011 8:56 pm

No, put the image files on the SD card.

Your original loadBMP command was

Code: Select all

background = SDL_LoadBMP("sd:/apps/SDL/background.bmp");
So, make sure you have the /apps/SDL/ directory on your SD card, place your image files in there and put sd:/apps/SDL/ where you currently have texture.bmp in the makefile. That first parameter is a path, not a file - normally it should be the full path and name of the dol you're executing but obviously in this case we're transferring the dol via wiiload.

Please don't start new threads to ask the same questions, they will be deleted.
Help keep devkitPro toolchains free, Donate today

devkitPro IRC support
Personal Blog

virus7
Posts: 12
Joined: Fri Aug 19, 2011 8:17 am

Re: Why SDL can't load an image via wiiload instead of sd ca

Post by virus7 » Wed Aug 31, 2011 9:59 pm

but you said that you found a solution in post number 4 for loading images directly via wiiload !!! :?: I already know how to load via sd card

anyways thanks man for everything I really appreciate your help ... thanks again

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests