Welcome! Log In Create A New Profile

Advanced

downloading game levels/files

Posted by dan3008 
downloading game levels/files
April 13, 2010 08:33PM
Hi

I want to know is it possable to make a homebrew game that can access a site like [www.mediafire.com] and present a list of files avalible at that perticular location, download user selected files and save them within a folder on the SD card. I know that sounds simmilar to HBB but there are 2 main diffrences. 1- I want it to download from a normal site not my own server and save within an application folder 2- the downloaded files will be pure C code rather than a .dol/elf.

ok, my other question is after these files have been downloaded is it possable to present a list on screen of these files names and call them up on command to run?

thanks in advance for the help, please feel free to ask any questions.



Edited 1 time(s). Last edit at 04/13/2010 08:40PM by dan3008.
Re: downloading game levels/files
April 13, 2010 11:28PM
yes, it is possible. but parsing a page that you have no control over will lead to big headaches. sites like this have popup ads and stuff like this that you will have to learn to recognize and ignore. and if they ever change the layout / format of the page, you will have to change the way you parse it.

so basically, you can make a fully working program right now. and a month down the road, they can change their layout, and it will kill that part of your program.
Re: downloading game levels/files
April 13, 2010 11:49PM
Ah, how about if i put direct download links onto a sight where i have full control but cant upload files?
Re: downloading game levels/files
April 14, 2010 01:12AM
Ok, so lets say i can work around that, how would i go about getting my program to download the files and save them to the sd????????
Re: downloading game levels/files
April 14, 2010 06:18AM
There are network functions, in libogc, that you can call to basically do socket type communication.

A webserver is just a socket server which responds on a specific port (usually 80 but can be different) and replies with some text messages in response to properly formatted requests from the Client. If the files that you are downloading are not text based you may need to implement some code to convert them from the web encoded format back to their original format. If the web pages that you are downloading are text (including HTML, etc) then you are good to go without conversion.

On Wiibrew.Org there is a sample Web Server (supposedly with source code). Although you need to implement a mini Web Client instead of a Web Server, this source code may be helpful in understanding the Wii based socket functions.
Re: downloading game levels/files
April 14, 2010 04:05PM
thanks i'll take a look see. I'm not grate with C++ so i will probably need some more help. but thats for the opening pointer.
Re: downloading game levels/files
April 14, 2010 05:18PM
Quote
dan3008
I'm not grate with C++
That's not a problem, libogc is coded in C.
Re: downloading game levels/files
April 15, 2010 01:55PM
well, thats good, i a bit better at C. I just assumes all homebrew was C++ because alot of the guides i have looked at are in C++. Thanks. :)
Re: downloading game levels/files
April 15, 2010 05:32PM
Few things about downloading files, there is some http download example code out there. Which works most of the time (but doesn't support chunked encoding, cookies and a few more things that some hosts need)

For GoF I made my own HTTP download class, it's in C++, but not that hard to follow. Sources can be found in my svn: [daid2.mine.nu]

I am attempting mediafire downloads, but it's hard. They use lots and lots of javascript obfuscation, which means you most certainly need a javascript interpreter. I wouldn't recommend trying it unless you have a lot of C experience (And it doesn't sound like you have)
Re: downloading game levels/files
April 18, 2010 11:50AM
Quote
Daid
For GoF I made my own HTTP download class, it's in C++, but not that hard to follow. Sources can be found in my svn: [daid2.mine.nu]
Thanks, i'll take a look.
Quote
Daid
I am attempting mediafire downloads, but it's hard. They use lots and lots of javascript obfuscation, which means you most certainly need a javascript interpreter. I wouldn't recommend trying it unless you have a lot of C experience (And it doesn't sound like you have)

I was actually on about putting direct download links on a home made site that can then be read by the wii. I think that should be easyer than anything else. and the files i want to download will be .c files (i think, need to doubble check that) will that make a diffrence. ad can the wii dynamically load them?
Re: downloading game levels/files
April 18, 2010 01:21PM
Well if they are c files then that means they are text files so it means you should be able to use a regular HTTP GET request for them without having to use any sort of a decoder.

If you were using binary files, such a (compiled c-code) executable or picture files, the files would need to be encoded on the server so that they can be sent in a regular HTTP GET request. This means that the client (the Wii program) would then need a corresponding decoder to convert the files back to their binary format.

The other advantage that you have is if you are looking for downloading the files (and nothing else) you only need to implement the portion of the Web Client program that corresponds to HTTP Get. Assuming the web page does not require any authentication you don't need to implement any of these features. Similarly if the pages are only text then you don't need to implement decoders for various popular file formats.
Re: downloading game levels/files
April 18, 2010 08:46PM
Quote
LordAshes
If you were using binary files, such a (compiled c-code) executable or picture files, the files would need to be encoded on the server so that they can be sent in a regular HTTP GET request. This means that the client (the Wii program) would then need a corresponding decoder to convert the files back to their binary format.
No, you can retrieve binary files with HTTP. Just receive the headers, and when you reach a line/"header" with only "\r\n"(line length less than 3) you reached the end of the headers. Then write the received data that follows the empty line to your file buffer. Here's my HTTP implementation: [code.google.com] This library doesn't work on Wii due to strange unknown networking errors, but it can still be used for reference, etc.(This library works on Linux, Win32, and NDS.)

Quote
dan3008
I was actually on about putting direct download links on a home made site that can then be read by the wii. I think that should be easyer than anything else. and the files i want to download will be .c files (i think, need to doubble check that) will that make a diffrence. ad can the wii dynamically load them?
No, C files must be compiled by a computer, Wii can't directly execute them. Wii homebrew doesn't have shared libraries/dynamically linked libraries.



Edited 1 time(s). Last edit at 04/18/2010 08:50PM by yellowstar.
Re: downloading game levels/files
April 18, 2010 09:18PM
ah, this is going to be harder than i thourght. I just wanted to make a game that had downloadable levels like the Akuen Puzzle Wii game. [www.wiibrew.org] :( Ok, maby heres a solution. Is there a simple way of making the wii create objects based on pixel colour in a Jpeg or PNG image that can be dowloaded? I know that i still have the problem of downloading the image, but thats a start.
Re: downloading game levels/files
April 18, 2010 09:48PM
What I plan on doing for my game is just creating a stucture for my level, which holds all of the information about the level. Then you could download a text file with all of the levels in it and then read the file to get the levels. I hope that made sense, I am typing on an iPod inside a very bumpy bus ride.
Re: downloading game levels/files
April 18, 2010 09:59PM
I'd just load the maps and scripts from SD. Creating a game that downloads maps needs more than just a piece of code; it needs an extra guipart for users entering their connection details, a way to store them, load them, etc.
Re: downloading game levels/files
April 18, 2010 10:17PM
ok, i got an even easyer way of doing what i want to do. Is it ossable to make my app load other precompiled apps (.dol's .elf's) from within a folder on the SD?? because then i can make a .exe that can be run on the PC to collect the compiled items from the site and download selected ones.

then call i would need is a script to call up a list of executables from the specific location on the SD and then call the selected one, and return to the origonal listing app when done. I hope that make sense.

--- Simplified ---

I will need:
1 - code to list .dol's in a specific place on the sd. Any advide on where to look to learn how to do this (or anyone got a snipit of code that will do just that?)
2 - A pice of code to select the executable from the list (i guess what i would need to do is just store the name of the selected executable within a string, however i an unsure how to make the selection)
3 - a way to run the selected executable (pass)
Re: downloading game levels/files
April 18, 2010 10:54PM
Try to look for the source of a dol launcher. Or build it yourself, I think there's something to load elfs and such in libogc if I recall correctly. Just read all the files in the dir and then check for file extensions.
Re: downloading game levels/files
April 18, 2010 11:06PM
i did look but i couldent find a dol launcher with open sauce. will look agaoin though. thanks.
Re: downloading game levels/files
April 19, 2010 12:05AM
ok, i have the source. however like i said i'm not a good programmer. this is a bit advanced for me. is there an easy way of doing it?? probably a silly question but there you go. is there a turorial anywhere on making a homebrew launcher? because i could use that and just addapt it for my specific needs. Thanks

dan.
Re: downloading game levels/files
April 19, 2010 12:59AM
why is downloading dols from the internet any better than downloading your levels as a "level.bin" or something like that and running them all with 1 dol? your exe doodad can download levels in whatever format you want to use. theres no need to make each one a different executable.
Sorry, only registered users may post in this forum.

Click here to login