 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
PosX100
Joined: 15 Aug 2007 Posts: 98
|
Posted: Tue Dec 09, 2008 7:13 am Post subject: A.T.L(AnyType C library)(updated to v1.3 Final) |
|
|
The last few days i've been working on a cool(imho) idea that i had.
I wanted to create an easy to use & fast library that could
handle any given variable type(and files) without having to
write down a bunch of arrays(or LLs) for every single type.
That's how i actually started working on this project...
While i was working on it , i decided to add more cool
features , like , dumping the whole memory that the library
handles , in a compatible(by the library) package file,
with the ability to load it back(whole memory) or just
a specific entry(yes,it can be used even as a packer).
After many hours of work(Well,not that many :-P),the library
is able to perform the following tasks:
v1.0:
| Code: |
+It does everything as fast as possible
+Any compatible type can be added(structures/ints/void pointers/char pointers/floats/quads(doubles))
+Any file can be easily imported as an entry(weee,you can code your own custom loaders for your game resources easily)
+Save the whole memory into a file(ATL PACKAGE)
+Load memory from ATL PACKAGE
+Load specific memory section from ATL PACKAGE
+Entries are hashed
+Detailed allocated memory information
|
edit
What's new in v1.1:
| Code: |
+ Updated ATL to 1.1
+ Replaced std io with native SceIo funcs
+ Fixed a small bug that could cause a memory leak when packing an external file
+ Added VFPU memcpy support(see header) ( [b]RAPHAEL'S IMPLEMENTATION[/b] )
+ Added the ability to change hash's seed value
+ Added entry reference counting
+ Added the ability to find the most "popular" node(ref'd most)
+ Added the ability to generate custom hash from a given string
+ Core functions which take as argument the hash ID of each node have been also added
(yes , in combination with custom hash function you can create your own hash table
to optimize a bit the process)
+ Added 6 new demo examples.
|
v1.2|F|
| Code: |
-Updated core functions to ensure that the library will never
"hang" ,... even if used really bad.
+Added the ability to extract packed external file sources/registered types
to a single file.
+Added "atlGetAllocatedEntries" which returns the total
of allocated entries.
-Updated header.
-Updated common\*.h & added a proper function to handle input for the demo code samples.
-Updated atlRemoveEntry() to handle some special cases
+Added a new demo("demo samples\Unpacking data to external file sources").
|
v.1.3F
| Code: |
-Updated header
-Added a new demo( "Importing external sources to an existing ATL package" )
+You can now import external file sources to an existing package
without having to load it.
With this update , you can pack unlimited ammount of files , since you
don't have to bother about the available memory limit.
+Some final code optimizations
|
About the release:
The first public release comes with 6 demos , and
all the required files to use the library(the header & the lib file).
Some demo examples , to get an idea :
1.
| Code: |
//Import external file source
atlInit(ATL_ENABLE_LOGGING);
atlAddEntryFromExternalSource("DEMO_TEXT.txt","text");
printf("----PACKED FILE----\n");
printf("%s \n : %d bytes\n",
(char*)atlFindEntry("text")->type,
atlFindEntry("text")->type_size);
printf("----PACKED FILE----\n");
atlShutdown();
|
2.
| Code: |
//Packing & accessing a custom vertex structure
atlInit(ATL_ENABLE_LOGGING);
struct Vertex* v1 = malloc(sizeof(struct Vertex));
v1->x = v1->y = v1->z = 255.0f;
atlAddEntry("vertex",//entry name(Will be hashed)
ATL_CAST_ENTRY(v1) ,//cast entry
sizeof(struct Vertex));//size in bytes
free(v1);
//test entry
printf("Vert size : %d bytes \n",atlFindEntry("vertex")->type_size);
struct Vertex* v2 = atlFindEntry("vertex")->type;
printf("x = %f \n",v2->x);
printf("y = %f \n",v2->y);
printf("z = %f \n",v2->z);
//endOfStory()
atlShutdown();
|
3.
| Code: |
//packing an integer type
atlInit(ATL_ENABLE_LOGGING);
int a = 9999999;
atlAddEntry("int_a",//entry name
atlIntToPtr(a), // int -> pointer
ATL_MAX_NUMERICAL_TYPE_DIGITS+1);//size
//print the results
printf("%d : %d bytes\n",
atlPtrToInt(atlFindEntry("int_a")->type),//grab entry & convert ptr -> int
atlFindEntry("int_a")->type_size);
atlShutdown();
|
Closing up
That's pretty much everything i had to say.
If you test the library , and find any bugs , please report them right here.
(I've been very careful with this project,but you never really know if something
bad is in the code,SO...lawl).
___Download ATL v1.3F:
http://www.sendspace.com/file/s9l3a4
Last edited by PosX100 on Mon Dec 29, 2008 10:01 pm; edited 11 times in total |
|
| Back to top |
|
 |
PosX100
Joined: 15 Aug 2007 Posts: 98
|
Posted: Wed Dec 10, 2008 6:22 am Post subject: |
|
|
I have just updated the library.
What's new in v1.1:
| Code: |
+ Updated ATL to 1.1
+ Replaced std io with native SceIo funcs
+ Fixed a small bug that could cause a memory leak when packing an external file
+ Added VFPU memcpy support(see header) ( [b]RAPHAEL'S IMPLEMENTATION[/b] )
+ Added the ability to change hash's seed value
+ Added entry reference counting
+ Added the ability to find the most "popular" node(ref'd most)
+ Added the ability to generate custom hash from a given string
+ Core functions which take as argument the hash ID of each node have been also added
(yes , in combination with custom hash function you can create your own hash table
to optimize a bit the process)
+ Added 6 new demo examples.
|
For more , just check out the header...
___Download ATL:
-->
Last edited by PosX100 on Tue Dec 16, 2008 5:33 am; edited 1 time in total |
|
| Back to top |
|
 |
PosX100
Joined: 15 Aug 2007 Posts: 98
|
Posted: Tue Dec 16, 2008 5:29 am Post subject: Re: A.T.L(AnyType C library)(updated to v1.2 Final) |
|
|
ATL v1.2 final is now available.
v1.2F changelog:
| Code: |
-Updated core functions to ensure that the library will never
"hang" ,... even if used really bad.
+Added the ability to extract packed external file sources/registered types
to a single file.
+Added "atlGetAllocatedEntries" which returns the total
of allocated entries.
-Updated header.
-Updated common\*.h & added a proper function to handle input for the demo code samples.
-Updated atlRemoveEntry() to handle some special cases
+Added a new demo("demo samples\Unpacking data to external file sources").
|
A small sample showing-off the ability to pack/unpack any type easily
(Note:"ATL" doesn't really "understand" the difference between each type,so,you can
unpack any registered type/file source without limitations):
| Code: |
...init code
atlAddEntryFromExternalSource("DEMO_TEXT.txt","text");
printf("----PACKED FILE----\n");
printf("%s \n : %d bytes\n",(char*)atlFindEntry("text")->type,atlFindEntry("text")->type_size);
printf("----PACKED FILE----\n");
printf("\n Extracting packed entry to \"DEMO_EXTRACTED.txt\" \n");
atlExtractEntryToExternalSource("text","DEMO_EXTRACTED.txt");
...shutdown
___Download ATL v1.2:
----
|
PS:
This is the final public release , ... unless there's a real reason
to update the library.
Last edited by PosX100 on Mon Dec 29, 2008 9:18 pm; edited 2 times in total |
|
| Back to top |
|
 |
coolkehon
Joined: 20 Oct 2008 Posts: 355
|
Posted: Sat Dec 27, 2008 4:50 am Post subject: |
|
|
| very helpful if i forget to add you into references for my project let me know |
|
| Back to top |
|
 |
NoEffex
Joined: 27 Nov 2008 Posts: 108
|
Posted: Sat Dec 27, 2008 6:30 am Post subject: |
|
|
Does it compress files? This is a pretty neat library, btw. _________________ Programming with:
Geany + Latest PSPSDK from svn |
|
| Back to top |
|
 |
PosX100
Joined: 15 Aug 2007 Posts: 98
|
Posted: Sat Dec 27, 2008 5:54 pm Post subject: |
|
|
| NoEffex wrote: | | Does it compress files? |
Nope , it doesn't compress anything.
Just packs each entry(any registered type --doesn't have to be a file--) to an optimal format so they can be accessed as fast as possible. |
|
| Back to top |
|
 |
PosX100
Joined: 15 Aug 2007 Posts: 98
|
Posted: Mon Dec 29, 2008 9:15 pm Post subject: |
|
|
A new update is available...
v.1.3F
| Code: |
-Updated header
-Added a new demo( "Importing external sources to an existing ATL package" )
+You can now import external file sources to an existing package
without having to load it.
With this update , you can pack unlimited ammount of files , since you
don't have to bother about the available memory limit.
+Some final code optimizations
|
As you can see , you can now import external sources to an existing
package without having to load it , and then modify it & rebuild it.
This is the new function:
| Code: |
//Imports an external file source to an existing package without having to load it back.
//Param src : the source file to be imported
//Param dst : destination (existing)package
//Param mode : available modes : ATL_BUFFER and ATL_STREAM .
//Set mode to stream when you have really large files to import...it doesn't require
//any memory at all , but of course , its much slower than buffered mode.
void atlImportSourceToMemoryFile(const char* src,const char* dst,const int mode);
|
To import a file , is extremely easy.All you have to do , is:
| Code: |
atlImportSourceToMemoryFile("the\\file.ext","package.ext",ATL_BUFFER);
|
OR , for really large files:
| Code: |
atlImportSourceToMemoryFile("the\\file.ext","package.ext",ATL_STREAM);
|
__Download ATL 1.3F:
http://www.sendspace.com/file/s9l3a4 |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|