Loading Resources from memory

Miscellaneous Forums/General Discussion/Loading Resources from memory

Does anyone have any code for B3D to load resources such as Models and Textures from a memory bank? There is something in the code archives but it saves the bank to disk and loads from there - I want to remain in memory.

Thanks.

@Filax, MPacker did something like this - perhaps you'd be kind enough to share this with me.

MPacker was written in BlitzMAX.

There is something in the code archives but it saves the bank to disk and loads from there - I want to remain in memory.
Tough luck.

MPacker was written in BlitzMAX.

I don't care if it was written with Alphabetti Spaghetti!

Tough luck.
That's rather defeatest, next you'll be telling me it's not possible to load a dll from memory rather than disk!

No he won't, he'll be sitting in his cooshy arm chair devising his next set of snapneck self gratifying jokes.

Then he'll tell you you can't load a DLL from memory.

Then he'll tell you you can't load a DLL from memory.
Tough :D I'm already doing it :D

has anyone actually seen any FlameDuck code/projects?

noto the next bit.

Indiepath, It's not possible in blitz3D but it is possible in Max :)

Perhaps there is a way using a DLL and modifying blitz internal pointers. i wouldn't know how to do that though.

Hmmnn, okay. I might have to hide the file somewhere for an instant and do it that way.

Unsure of any existing B3d-written code, but doesn't MoleBox do the sort of thing you're asking for?
(it's a commercial (aka, $) packer program which uses a DLL, and it can load encrypted files without needing to write them to disk...might be what yer looking for)

Seeing as it's indiepath, I'm guessing he wants to build this functionality into something he wants to sell. So I don't think molebox is an option?

*shrug*

has anyone actually seen any FlameDuck code/projects?
Yes.

Indiepath, It's not possible in blitz3D but it is possible in Max :)
Thanks for reitterating what I said.

Look my library PackB3DLib a demoversion it is possible to take here: DOWNLOAD

@Maxus, does this do it in Memory?

Loads archive in memory and reads from it after.
The principle of work as in MoleBox, only works on all versions Windows.
All this works without TEMP files, all work is conducted in memory.

I'd be interested in learning how you managed to load from a memory buffer - perhaps you will help me?

There are some ways of loading of model from memory.
1. It is necessary to load model into memory and after it to construct Blitz commands.
2. It is my way. I load model into memory, I put an interceptor on function API Windows and after I give out information Blitz.

Advantages of the second way, you do not need to create long model, simply you take you pack and you load in memory, and from memory you load model standard commands Blitz.

In more detail we can communicate.
My ICQ 331454066

I don't have ICQ, sorry MSN or Skype...

Skype is indiepath.tim

MSN is the same as my email address.

Okay, here's the deal.

- Encrypted stream is downloaded from the internet
- Stream is decrypted into memory (the application will already know what the data is for ie. Texture, Model etc.)
- Model, Texture etc, is loaded from the memory rather than disk.
- Decrypted memory buffer can now be freed.

Models will be of type .b3d, .x, .3ds or .md2

Textures/Images of type .bmp, .png, .jpg

Be nice if you could help Maxus.

There is a problem with models .x they are loaded in Blitz through separate library.

I wonder if it's possible to inject a stream into the Blitz Model loaders.

A little rant...

I wish Mark would add the ability in Blitz3D to load a media resource from a bank. This would allow some very useful things to be achieved, such as the creation of large scale seamless worlds by doing threaded loading of resource files from disk via a dll, and then passing the resource data from the dll to blitz in a memory bank so that blitz could 'load' it from the bank.

Something like that would greatly benefit projects like Realmcrafter, Freeworld online, etc. This would in turn benefit blitz, as these projects are probably going to send a lot of customers blitz's way, particularly when Realmcrafter pro gets released with its sourcecode that will need to be compiled using blitz compilers.

It might be possible to partially achieve threaded loading via a dll now by using custom loaders for converting the loaded data into models, etc, but you can't create boned models using this method, which I know Realmcrafter would require.

Looks like I'll have to write my own custom routines to pull in the necessary files from memory, ho humm, I really wish I did not have to.

Or do it the old Amiga way. Of course there might be other ways of accomplishing it, but here's an example

http://www.ramdisk.tk/

Holy **** that's the answer to my dreams. And it comes with source code!!!

gosh it seems so obvious now I hear it! a RAM disk!

Hmmn, actually it requires drivers and stuff to be loaded which I really do not want. This not what I first thought it was and it's not 95/98 compat.

But a RAM disk must be the way to go, perhaps there is a different way to make a RAM disk, more easily.

I really don't need Directory Structures, Patitioning, Drive Letter assignment, formatting and all that Gumph. I just need a Load from memory function - simple code, low overhead - no additional dlls.

Not many people are going to install a random driver from a games company in order to play the game. not only that, but the driver will be implemented differently depending on windows version.

I had a similar discussion a long time ago, on the B3D forum I think.

See if you call OPENFILE, does that create a temp file? Or does that load straight to memory?

At me is in development PackB3DLib.
Works without temp files, all is loaded by standard commands Blitz, but from archive.
Speed of loading of files on 20 % above than from the Disk.
At present I develop system of anticipatory reading of sectors of the WORLD, for the project VIRTUAL CITY.

PackB3DLib you can look here: http://www.amt-lab.com