Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / load binary file

Author
Message
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 4th Aug 2008 17:45
i would like to load a binary file from disk and then get a handle to the file location in mem (to pass to another function).

is this simpler to do with dgdk commands or in c++?

if so can anyone direct me to where i can possibly start?
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 4th Aug 2008 19:03
My opinion is that it's best to do it with the C++ standard library fstream classes. But it largely depends on what kind of data you're reading in, I suppose. Typically, if I'm the one generating the data I encapsulate it in a struct and write it out to the binary file.

That said, it seems that current attempts to accomplish what I used to be able to do easily before are mired by Microsoft's inclination to obfuscate the data type of every argument it puts in Intelisense. I used to be able to point to the data for output using a (void *). Now it seems I'm forced to use a (char *) which doesn't really make sense to me when I'm outputting binary data.

AAR, an extract from a level editor I've been working on. Mind you, the code is a part of a class and thus probably might need some revision for pure procedural use.

Outputting the level, isections is actually an array of structs.


Inputting the data into the same array:



Also, using std:: may require making some adjustments in your project file when generating, IIRC, the program in debug mode.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 4th Aug 2008 19:29
i want to READ music data (mp3/ogg/wav) and then pass the memory pointed to bass.dll audio player.

i don't need to write data or create custom file structures.
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 4th Aug 2008 19:36
If all you have to do is pass the bass.dll a pointer to where it's stored, then you'd probably need to reserve the necessary memory using new char [] then pass the address returned by that function to the read function of an ifstream object that's been opened in ios::binary mode. You'd then pass that to your bass.dll function. There may be a bit of type casting necessary.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office

Login to post a reply

Server time is: 2024-11-20 17:22:53
Your offset time is: 2024-11-20 17:22:53