Gamebase.dll (AES/Rijndael)
by Thomas Bang · in Torque Game Engine · 05/08/2008 (3:33 pm) · 15 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
I didn't understand this line. Sorry... :-(
05/09/2008 (12:25 am)
Don't be scared. It was only a example. Nothing more... ;-)Quote:I am easily broken by anyone who can make cookies.
I didn't understand this line. Sorry... :-(
#3
05/09/2008 (12:46 am)
Deborah was just joking. Nice work though.
#4
05/09/2008 (7:36 am)
Many of us are easily broken by cookies. Mmmm. Cookies.
#8
Sounds interesting. I can extract the functions to crypt/decrypt text.
Example:
%crypted_text = dw_crypt( %clear_text, %password);
%clear_text = dw_decrypt( %crypted_text, %password);
Then you could send/receive the crypted text to/from SQLite.
05/10/2008 (3:46 am)
@Matt: Sounds interesting. I can extract the functions to crypt/decrypt text.
Example:
%crypted_text = dw_crypt( %clear_text, %password);
%clear_text = dw_decrypt( %crypted_text, %password);
Then you could send/receive the crypted text to/from SQLite.
#9
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:40 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
#10
05/10/2008 (12:09 pm)
Cool! Haven't had a chance to look at the code yet as I have other things on my palette but sounds very cool.
#11
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:15 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
#12
05/17/2008 (8:47 am)
I'm not sure I follow. What's the reason for Filesystem and Registry calls when these already are available in Torque, and cross-platform at that?
#13
If i create a DLL all functions are not cross-platform because i can not run a DLL at OSX (as far as i know).
Unfortunately a MacPro is too expensive. I would like to play with Apple's XCode2.
05/17/2008 (10:29 am)
I like it to create my own functions with my own workflow. If i create a DLL all functions are not cross-platform because i can not run a DLL at OSX (as far as i know).
Unfortunately a MacPro is too expensive. I would like to play with Apple's XCode2.
#14
05/17/2008 (10:33 am)
Does this work if you have added new classes into the engine? I'm getting an error "Unable to instantiate non-conobject class" for every class I have added. This is happening in the console and the engine code compiles fine. Does anyone know how to fix this?
#15
05/17/2008 (11:58 am)
I solved the problem. I recompiled the engine and everything works now.
Torque 3D Owner Deborah M. Fike
Default Studio Name