Help Creating a library for a virtual disk
Help Creating a library for a virtual disk
i wanna create a virtual hard drive / database i guess that has a folder struct and holds files and i can access them by folder how would i go about doing this got any suggestions
-
- Posts: 388
- Joined: Tue Aug 12, 2008 12:46 am
You can use my library(ATL - http://forums.ps2dev.org/viewtopic.php?t=11390 -) , it does what you want , plus many more.
Here's an example how to pack/stream entries:
__
Loading whole package:
Or loading(streaming) specific entry:
Usage:
Here's an example how to pack/stream entries:
__
Code: Select all
void pack() // used by the packer application
{
//init
atlInit(ATL_ENABLE_LOGGING|ATL_ENABLE_OPTIMIZED_VFPU_MEMCPY);
//packing
atlAddEntryFromExternalSource("data\\hero.tga","data\\hero.tga");
atlAddEntryFromExternalSource("data\\hero1.tga","data\\hero1.tga");
atlAddEntryFromExternalSource("data\\hero2.tga","data\\hero2.tga");
//creating the package
atlSaveMemoryToFile("memory.bin");
//cya
atlShutdown();
}
Code: Select all
atlLoadMemoryFromFile("memory.bin");
Code: Select all
atlLoadSpecificEntryFromMemoryFile("memory.bin","data\\hero.tga");
Code: Select all
ATL_NODE* node = atlFindEntry("data\\hero.tga");
SomeImage* img = someFunctionThatTakesAsParamABuffer(node->type,node->type_size);
so can this pull one data from the .bin file instead of all because i dont want to load all of the data just what i need to conserve memory i saw the function but that is what it does right
edit:
what if i want to add some data or modify data without accessing pulling / opening the entire memory.bin to memory will that work like if i want to add
dummy.bin (5000kb) + dummy2.bin(10000kb) + dummy3.bin (25mb) that will overload the memory so does it load all of them to memory then write or stream it to memory from the existing files
edit:
what if i want to add some data or modify data without accessing pulling / opening the entire memory.bin to memory will that work like if i want to add
dummy.bin (5000kb) + dummy2.bin(10000kb) + dummy3.bin (25mb) that will overload the memory so does it load all of them to memory then write or stream it to memory from the existing files
Yes,it is possible...so can this pull one data from the .bin file instead of all because i dont want to load all of the data just what i need to conserve memory i saw the function but that is what it does right
See my previous post(@ "loading(streaming) specific entry").
I don't quite get your question , but , if you're asking if its possibleedit:
what if i want to add some data or modify data without accessing pulling / opening the entire memory.bin to memory will that work like if i want to add
dummy.bin (5000kb) + dummy2.bin(10000kb) + dummy3.bin (25mb) that will overload the memory so does it load all of them to memory then write or stream it to memory from the existing files
to modify a package , then the answer is "YES".
You can replace/add/delete an entry & then rebuild the package...
-
- Posts: 388
- Joined: Tue Aug 12, 2008 12:46 am
He asking will a large size overload the memory.
It really shouldnt, but it might go slow when reading the data.
My library that packs, and unpack read as :
header
custom hash/checksum
size[of each file]
blocks of data[of each file]
total size
encrypted sha1 hash
The total size that can be hold is 512 mb. It reads at a 512kbps(on psp slim) and can hold 500 files or more
Now, PosX has a much better lib. Nice job again.
It really shouldnt, but it might go slow when reading the data.
My library that packs, and unpack read as :
header
custom hash/checksum
size[of each file]
blocks of data[of each file]
total size
encrypted sha1 hash
The total size that can be hold is 512 mb. It reads at a 512kbps(on psp slim) and can hold 500 files or more
Now, PosX has a much better lib. Nice job again.
No , currently there is no way to pack a new file(in existing package) without loading the whole package(i might add this feature soon though).what if i want to add some data or modify data without accessing pulling / opening the entire memory.bin to memory will that work like if i want to add
dummy.bin (5000kb) + dummy2.bin(10000kb) + dummy3.bin (25mb) that will overload the memory so does it load all of them to memory then write or stream it to memory from the existing files
Anyway , if you want to stream a specific entry , just use this :
Code: Select all
atlLoadSpecificEntryFromMemoryFile( package source , entry name )
coolkehon wrote:cool thanks for the update now one more thing can i also remove entries from an existing package and add just a variable / void * data to package
No , you can not remove an entry without re-compiling the whole package(or , loading it back in memory,remove/replace an entry , then rebuild the package) ,cool thanks for the update now one more thing can i also remove entries from an existing package and add just a variable / void * data to package
because it requires full-rebuilding of the entire
package structure :).
Just create more than 1 package for everything that you really need.
Eg :
For SFX , create a package named "sfx.bin" , For gfx , "gfx.bin" ,or
create "session" packages , eg :"gameplay_lvl0_p0_.bin" and load only what
you really need.
Now , you're asking how to import a native packed type
into an existing package , well , yes , it is possible(a hack-ish way):
Code: Select all
add entry nat_type
extract entry @nat_type , some_filename.some_ext
import source some_filename.some_ext, some_package.some_ext
remove extracted file some_filename.some_ext
Code: Select all
load memory
modify entries
save memory
In some later release , i might add full entry streaming support(using a pre-compiled static stream table).