Results 1 to 7 of 7

Thread: load files in memory

  1. #1
    farcodev_
    Guest

    load files in memory

    Hi, is anyone know a component (free) which allow to load files in memory and use them after.

    I need to load .3ds object in memory for multiple uses and avoid a lot of i/o on hd

    Thank you !

  2. #2
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Re: load files in memory

    Why can't you just write something small using TStream?
    Jason McMillen
    Pascal Game Development
    Co-Founder





  3. #3

    Re: load files in memory

    More exactly TMemoryStream:

    [code=Pascal]

    FS:= TFileStream.Create(FileName, fmOpenRead);

    Stream:= TMemoryStream.Create;
    Stream.Size:= FS.Size;
    Stream.CopyFrom(FS, FS.Size);
    FS.Free;

    // loaded into memory
    Stream.Position:=0;
    Stream.Read(value, sizeof(Integer));
    ...
    Stream.Free;

    [/code]
    Amnoxx

    Oh, and this code appears to be an approximate replacement for return(random() & 0x01);

    Phoenix Wiki
    http://www.phoenixlib.net/

    Phoenix Forum
    http://www.pascalgamedevelopment.com/viewforum.php?f=71

  4. #4

    Re: load files in memory

    You can use glmodel: http://www.noeska.com/dogl/glModel.aspx
    it can even load .3ds from memorystreams :-) Even when loading a .3ds from file a stream is used and when modifying the mesh it is only changed in memory.
    Only the saving of a .3ds file is a work in progres. But you can save to milkshape ascii and obj even when the file is loaded as an .3ds .
    http://3das.noeska.com - create adventure games without programming

  5. #5
    farcodev_
    Guest

    Re: load files in memory

    First, thank you for all your answers

    About TStreams it's because i never used them But it seems cool since if i remember i can load 3ds file from a stream (i use GLScene with a custom 3ds loader from Dave Gravel), so i'll test that !

    for glmodel i don't know how to use it with GLScene

    Anyway thank you it will save loading time ! (beside to reduce the objects polygons too )

  6. #6
    farcodev_
    Guest

    Re: load files in memory

    yeehaa the custom loader support tstream too, let's the party started !

    Thank you again

  7. #7
    farcodev_
    Guest

    Re: load files in memory

    (useless post sorry i had a problem but i found the solution)

    edit: wow i saved 14 mb of memory by put the xml file containing user's interface texts in memory ! w/o speak of less disk access and a gain in speed

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •