Gamebase.dll (AES/Rijndael)
by Thomas Bang · in Torque Game Builder · 05/08/2008 (3:31 pm) · 10 replies
Hi
Today i created a dll (via Delphi) to expand Torque's possibilities. I'm new to TGB and TGE... so i dont know if some functions already exists.
What can this DLL do for you? You can save/load some values of your game to/from a crypted file.
Example:
%firstText = "I love Torque";
%secondText = "I love it to write DLLs";
%thirdText = "I know Delphi much better than C/C++";
%password = "Deborah Marshall";
Now we can save these Strings to a crypted file:
dw_createFile(0); // you can create up to 10 (0-9) different Stringlists -> it has nothing to do with the number of lines!!!
echo(dw_getLineCount(0)); // Parameter: StringListID
// you get "0"
dw_writeLine(0,0,%password,%firstText); // Parameter: StringListID, LineNumber, Password, your Text
dw_writeLine(0,1,%password,%secondText);
dw_writeLine(0,2,%password,%thirdText);
echo(dw_getLineCount(0)); // Parameter: StringListID
// you get "3"
dw_saveFile(0,"save.txt"); // Parameter: StringListID, Filename
------------------------------
Load the File and read the Lines
dw_createFile(0); // Parameter: StringListID
dw_openFile(0,"save.txt"); // Parameter: StringListID, Filename
echo(dw_readLine(0,0,%password)); // Parameter: StringListID, LineNumber, Password
// "I love Torque"
echo(dw_readLine(0,1,%password));
// "I love it to write DLLs"
echo(dw_readLine(0,2,%password));
// "I know Delphi much better than C/C++"
There is also a function called dw_deleteLine(StringListID, LineNumber);
I think you know what you can do with this function. ;-)
Load "save.txt" in a text editor and you will see only thrash. ;-)
The file is crypted with AES/Rijndael.
Tomorrow i will write a complete documentation.
If you can't wait... here are all necessary files you need to try this DLL (copy the DLL to the same folder where your exe-file is).
www.darkware.de/torque_gamebase_dll.zip
OK... this is my first DLL for Torque. Please try the functions and give me feedback.
What i have to do:
- expand the Parameter "filename"
Currently the files are saved/loaded in/from the same folder where the executable and the dll are.
In the next version you can specify a different folder like
dw_saveFile(0,"currentdir\\gamesave\\savedata.sav");
or
dw_saveFile(0,"C:\\mySaveFiles\\savedata.sav");
Something like this.
- some more functions like...
... copy, rename, delete, remove folders/files
... create folders
... and so on
Do you have some ideas? Wishes?
Please let me know what you want.
Greetings
Thomas Bang
Germany
Today i created a dll (via Delphi) to expand Torque's possibilities. I'm new to TGB and TGE... so i dont know if some functions already exists.
What can this DLL do for you? You can save/load some values of your game to/from a crypted file.
Example:
%firstText = "I love Torque";
%secondText = "I love it to write DLLs";
%thirdText = "I know Delphi much better than C/C++";
%password = "Deborah Marshall";
Now we can save these Strings to a crypted file:
dw_createFile(0); // you can create up to 10 (0-9) different Stringlists -> it has nothing to do with the number of lines!!!
echo(dw_getLineCount(0)); // Parameter: StringListID
// you get "0"
dw_writeLine(0,0,%password,%firstText); // Parameter: StringListID, LineNumber, Password, your Text
dw_writeLine(0,1,%password,%secondText);
dw_writeLine(0,2,%password,%thirdText);
echo(dw_getLineCount(0)); // Parameter: StringListID
// you get "3"
dw_saveFile(0,"save.txt"); // Parameter: StringListID, Filename
------------------------------
Load the File and read the Lines
dw_createFile(0); // Parameter: StringListID
dw_openFile(0,"save.txt"); // Parameter: StringListID, Filename
echo(dw_readLine(0,0,%password)); // Parameter: StringListID, LineNumber, Password
// "I love Torque"
echo(dw_readLine(0,1,%password));
// "I love it to write DLLs"
echo(dw_readLine(0,2,%password));
// "I know Delphi much better than C/C++"
There is also a function called dw_deleteLine(StringListID, LineNumber);
I think you know what you can do with this function. ;-)
Load "save.txt" in a text editor and you will see only thrash. ;-)
The file is crypted with AES/Rijndael.
Tomorrow i will write a complete documentation.
If you can't wait... here are all necessary files you need to try this DLL (copy the DLL to the same folder where your exe-file is).
www.darkware.de/torque_gamebase_dll.zip
OK... this is my first DLL for Torque. Please try the functions and give me feedback.
What i have to do:
- expand the Parameter "filename"
Currently the files are saved/loaded in/from the same folder where the executable and the dll are.
In the next version you can specify a different folder like
dw_saveFile(0,"currentdir\\gamesave\\savedata.sav");
or
dw_saveFile(0,"C:\\mySaveFiles\\savedata.sav");
Something like this.
- some more functions like...
... copy, rename, delete, remove folders/files
... create folders
... and so on
Do you have some ideas? Wishes?
Please let me know what you want.
Greetings
Thomas Bang
Germany
#2
05/09/2008 (1:54 am)
Mail sent...
#4
Now you can crypt/decrypt text if you have your own load/save-functions.
And you can search files in a specified folder with more than one search-mask.
Documentation modified !!!
See Blog at www.garagegames.com/blogs/88487/14715
05/10/2008 (6:41 am)
New functions are available. Now you can crypt/decrypt text if you have your own load/save-functions.
And you can search files in a specified folder with more than one search-mask.
Documentation modified !!!
See Blog at www.garagegames.com/blogs/88487/14715
#5
05/10/2008 (8:22 am)
Looks very interesting. Thanks for sharing this with everyone!
#6
05/13/2008 (1:27 pm)
Looks useful, Thomas. I can't wait to incorporate it, my friend.
#7
05/15/2008 (12:29 am)
Great work! I will use this for savegame files so players can't cheat.
#8
There is a new version available.
05/15/2008 (2:08 am)
Please look at my blog http://www.garagegames.com/blogs/88487/14715There is a new version available.
#9
Filesystem:
dw_searchFoldersInFolder
dw_getSearchFolder
dw_renameFile
dw_deleteFile
dw_createFolder
dw_removeFolder
dw_copyFileToFolder
Registry:
dw_regReadText
dw_regWriteText
Frequencies: (set the frequency you want for your game)
dw_getAllowedFreq
dw_getDesktopFreq
dw_setFreq
Documentation modified. See blog: www.garagegames.com/blogs/88487/14715
05/17/2008 (6:16 am)
New functions are available. Filesystem:
dw_searchFoldersInFolder
dw_getSearchFolder
dw_renameFile
dw_deleteFile
dw_createFolder
dw_removeFolder
dw_copyFileToFolder
Registry:
dw_regReadText
dw_regWriteText
Frequencies: (set the frequency you want for your game)
dw_getAllowedFreq
dw_getDesktopFreq
dw_setFreq
Documentation modified. See blog: www.garagegames.com/blogs/88487/14715
#10
05/20/2008 (11:38 am)
Great work man!... really handy DLL you got there.
Associate Phillip O'Shea
Violent Tulip
Phil