Re: downloading game levels/files April 19, 2010 11:43AM | Registered: 13 years ago Posts: 18 |
Re: downloading game levels/files April 19, 2010 11:52AM | Registered: 13 years ago Posts: 379 |
I don't see you calling "net_init()" anywhere, so that might be the problem.Quote
yellowstarNo, 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
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.
Re: downloading game levels/files April 19, 2010 01:17PM | Registered: 13 years ago Posts: 121 |
Quote
yellowstar
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.)
Re: downloading game levels/files April 19, 2010 03:30PM | Registered: 13 years ago Posts: 379 |
Whow, my bullshit meter just hit red. Everything you just said is wrong.Quote
LordAshes
I didn't say you could not get binary files via HTTP...of course you can otherwise you would not be able to download all those picture and/or software. What I was saying is that if your webpage is pure text (such as HTML code, a text files, etc) then the response from the server is also in plain text. So you read the response (into, for example, a buffer) and you already have the desired file. However, if the download is binary such as a picture or executable file then it is encoded on the server. Part of the response header indicates the encoding type and the end user must then use that information to decode the downloaded buffer back to the binary file.
This is why, when you install a Web Browser, it offers various plugins for decoding web material. If you don't have the plugin (i.e. the decoder) the encoded data can be downloaded but the Web Browser does not have the instructions on how to re-construct the original file.
Re: downloading game levels/files April 19, 2010 10:42PM | Registered: 14 years ago Posts: 122 |
Re: downloading game levels/files April 20, 2010 03:01AM | Registered: 14 years ago Posts: 444 |
Re: downloading game levels/files April 20, 2010 05:17PM | Registered: 14 years ago Posts: 122 |
Re: downloading game levels/files April 21, 2010 03:09AM | Registered: 14 years ago Posts: 444 |
Re: downloading game levels/files April 21, 2010 03:34AM | Registered: 14 years ago Posts: 188 |
No, yellhttp.c is the source for the library, if_config is called by yellhttptest. That bug was fixed though, IOS rejects IPPROTO_TCP, IPPROTO_IP must be used.Quote
Daid
I don't see you calling "net_init()" anywhere, so that might be the problem.
No, it's not that simple. You'd need to compile it with -fPIC IIRC, as well as other things to compile a dynamically loaded executable. It's much better to use a simple level file instead of an executable level.Quote
g_man
NOTE: a .bin is also called a flat binary.don't quote me on this, but It hink all yopu have to do is copy it to memory and then start execution there, but I would heavily suggest the method above.
Re: downloading game levels/files April 21, 2010 06:05AM | Registered: 14 years ago Posts: 444 |
I was try to get him to stray away from using .bin, because it would be overly complicated and not worth the limited benifits of using a .bin. But I was trying to say that if there isn't a call to run .elf or .dol then it might be easier to run a flat binary. But again I was trying to interate that loading an external executable file was a bad idea.Quote
yellowstarNo, it's not that simple. You'd need to compile it with -fPIC IIRC, as well as other things to compile a dynamically loaded executable. It's much better to use a simple level file instead of an executable level.Quote
g_man
NOTE: a .bin is also called a flat binary.don't quote me on this, but It hink all yopu have to do is copy it to memory and then start execution there, but I would heavily suggest the method above.
Re: downloading game levels/files April 21, 2010 09:47AM | Registered: 14 years ago Posts: 122 |
Quote
yellowstar
dan3008:
Here's some sample C code for loading a simple level from SD. You can adjust it use a buffer from RAM if needed. This reads a binary file. This is for a tiled level, where only one object can be on each tile.
[pastie.org] (pastie is used since the code doesn't display correct here on forums.)
Re: downloading game levels/files April 21, 2010 08:06PM | Registered: 14 years ago Posts: 188 |
Offset 0x0 in the level is the levelwidth, offset 0x4 is the levelheight. 52 would be the level width, and 21 the level height in tiles. Followed by levelwidth*levelheight entries of sLevelObject. Yes, 5 and 6 for obj types, and 11/41 and 11/20 for objects' x/y are correct. newobj is a struct for the object type struct. You could add code to the LoadLevel function to dynamically allocate a buffer for the level, and copy the object structs into that. newobj would be a struct ptr to your unique object struct, if the object type has a unique struct. You only need libfat, fat.h, and stdio.h to use SD. x and y are the tile grid coordinates. x for the first tile in the row would be zero, for the next tile would be one, and so on. Devkitpro has an libfat directory listing example: devkitpro/examples/wii/filesystem/directoryQuote
dan3008
looks good, i just need a coupple of exsplations.
firstly, what format should the .bin take? so would it look like 52 21 5 11 11 6 41 20 ect (where 52 is level hight, 21 is level width, 5 and 6 are object types, 11 and 41 are object x vales and 11 and 20 are object y values.) or should it be diffrent?
secondly, what is newobj->x and y? because i cant see them diclaired anywhere.
thirdly, are level width, hight and object X and Y pixels or grid referance (and if grid refrence what size are the squairs on the grid or is it just made to fill the screen?)
four - what libaries are needed to open/read the .bin files?
Finaly how can i generate an onscreen list of all the .bin files to populate the filename
Re: downloading game levels/files April 22, 2010 12:13AM | Registered: 14 years ago Posts: 122 |
Re: downloading game levels/files April 22, 2010 12:28AM | Registered: 14 years ago Posts: 188 |
Re: downloading game levels/files April 22, 2010 09:18AM | Registered: 14 years ago Posts: 122 |
ah, i get it. well that rather simple. :) so is it the level x and level y values that dertermin the size of a tile? and then the object x and y dertermin which tiel it goes on :) coolio. just one thing i forgot, should the bin file be seperated with spaces/commers or do i need to fill the rest of the bites used for each value with 0's? thanks a millionQuote
yellowstar
If you'd use directory listing code based on the dirent directory listing example, you'd use something like this: LoadLevel(pent->d_name); The size of the tiles in pixels is not defined, it's whatever size you want.
Re: downloading game levels/files April 22, 2010 10:07PM | Registered: 14 years ago Posts: 188 |
levelwidth is the number of tiles in a row for the level, levelheight is the number of tiles in a column for the level. Yeah the obj x/y determine which tile it is located at.Quote
dan3008
ah, i get it. well that rather simple. :) so is it the level x and level y values that dertermin the size of a tile? and then the object x and y dertermin which tiel it goes on :) coolio.
It's binary, not text. If you want to write levels to SD, you could copy the LoadLevel function and name the copy WriteLevel or so, and change the fread calls to fwrite. Then adjust it so it writes a level passed as a parameter.Quote
dan3008
just one thing i forgot, should the bin file be seperated with spaces/commers or do i need to fill the rest of the bites used for each value with 0's? thanks a million
stdio.h is needed for reading/writing files with SD. It has the fopen, fread, close function prototypes, as well as the FILE struct definition.Quote
dan3008
also are you cartain that stdio.h is needed? because i was looking it up and found that Stdio is used for input and output to the "console" but i dont think that needed for this. i could be wrong and have overlooked something. please let me know??
Re: downloading game levels/files April 22, 2010 10:43PM | Registered: 14 years ago Posts: 122 |
Re: downloading game levels/files April 23, 2010 02:13AM | Registered: 14 years ago Posts: 188 |
That code assumes all the tiles are the same size, defined by the size of sLevelObject. This means every time you change the sLevelObject struct you must rewrite/export your levels. Remember this is binary. You can create your levels by either exporting them from your app, or with a hex editor. Not any text editor, this is binary.Quote
dan3008
I just dont get one thing, how does it know where the diffrent values start and end if they can be variable lengh and have no seperator??
Re: downloading game levels/files April 24, 2010 04:13PM | Registered: 14 years ago Posts: 122 |
Re: downloading game levels/files April 24, 2010 06:40PM | Registered: 14 years ago Posts: 188 |