binary thing problem

This topic is 4815 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

hi there. it's me again. well, i've exported my 3d data from my 3d modeling program into a binary format. that is, my model became a binary file. then i've created a .bar file, for brew. there is a "binary" type resource. so i've created a binary resource from my binary exported file. all done, the .brx got compiled and all done. then, i read the API reference file from brew sdk to see how can i load resources into my program. and guess what? there is a function called ISHELL_LoadResData. this function takes as it's last parameter a "ResType" one, in wich we specify wich type is the resource we are loading. all ok, "ResType" is an enumeration, but there says that BINARY RESOURCE is CURRENTLY NOT SUPPORTED. so now, what can i do to save the day? how do i know if it works or not, if it is supported or not, and if it isn't, how can i use my exported data into a .bar file, because this is what i want to do. thanks and looking forward to your answers.

Share on other sites
The trick is to use ISHELL_LoadResData(), and specify the data type as RESTYPE_IMAGE. It returns you a pointer to the data block its loaded. The first byte will be the offset that the actual raw data starts at.

So (code from memory so I may have made an API error, the intent should get you where you need to go though):

void * data = ISHELL_LoadResData(myShell, RESOURCE_NAME, RESOURCE_ID, RESTYPE_IMAGE); if (data == NULL)    // problems...byte offset = (byte)(*data);void * rawdata = data + offset;// rawdata nows points to .. er .. the raw data :-)

Alan

Share on other sites
thanks a lot. now i'm gonna try it. but i bet it works. thanks again.

Share on other sites
well, i'm in the "//problems..." category up above :)

Share on other sites
Quote:
 Original post by meeshoowell, i'm in the "//problems..." category up above :)

Did you put the bar file in your application folder ? Did you use the right bar file name and resource id when you call LoadResData ?

Share on other sites
Make sure your project directory doesn't have any capital letters or spaces in it. If I change my directory from myproject to MyProject, files fail to load. Change it back they load again fine.

Alan

Share on other sites
well, i've checked everything, but it still doesn't work. i guess i will use separate files for 3d data, or a single file with multiple models, and i will use the bar file only for images. it doesn't work at all, the loading resource function returns a NULL pointer

Share on other sites
so, i've checked everyting. let's say my project is called xx. in it's folder, i have a file called xx.bar, wich have a binary resource of type bitmap. it compiled ok. now, i write something like:
void * tmp = ISHELL_LoadResData(myshell, "xx.bar", RESID, RESTYPE_IMAGE);
after this call, tmp gets NULL, so it cannot load my image. can anyone tell me why is that happening? i've included the .brh file into my project. it doesn't work even if i include the .bid file too. when i've tried last time, i was trying to fake by loading another type of data like an image. now the data it is a real image wich i intend to use as texture. why it doesn't work? because it looks very simple. i've read into docs how to open files and read from them, a more complicated process than loading resources, and all is working fine. why this doesn't work?

Share on other sites
You need to change RESID, to the actual value, which is given in your resource editor when you compile the resource script. So for instance it would be something like 1001 or somesuch binary ID. Also you need to make certain that you include not only the .bar file in your project in the resources, but also the header file that the resource editor generates, in the headers folder.

• Forum Statistics

• Total Topics
628675
• Total Posts
2984169

• 13
• 12
• 9
• 10
• 9