Jump to content


Photo

Libpyramidgm- Helpful C++ Functions For Game Maker


  • Please log in to reply
37 replies to this topic

#1 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 13 April 2008 - 06:38 PM

libpyramidGM
A dll of helpful c++ functions for Game Maker.
Current features...
  • File2Gml (DPACK) {NOTE: SMALL FILES ONLY}
  • Crc32 Calculator (CRC32)
  • Common Dialog Box Library (GMDLG) {NOTE: I DID NOT MAKE THIS CAMZMAC DID}
  • Windows Interface (GUI)
  • SHA1/MD5 (HASH)
  • Zip/Unzip Functions (ZIP)
  • Blowfish Key/XOR Encryption (PCRYPT)
  • ...more coming soon!

Sample Code!
//Start up the variables
var s1, s2, f, b, key, oldwd, h1, h2, h3, h4, buf1, buf2;
key="secure";

//Start up the dll
libpyramidGM_init();
GUI_show_message("start");
GUI_make_window("Test Window!", 64, 48);
GUI_show_message(GUI_make_window_notepad("Notepad test", 640, 480, "TEST : Hello World!"));
GUI_show_message(GUI_get_string("Enter a string...", 300, 300, "TEST : Hello World!"));
directory_create2("dir");

//Package PCRYPT
make_text_file("test.txt", "Hello World!");
PCRYPT_makeKeys("liblibpyramidGM.a", "test_PRIKEY.txt", "test_PUBKEY.txt", key);
PCRYPT_combineKeys("test_COMKEY.txt", "test_PRIKEY.txt", "test_PUBKEY.txt", key);
PCRYPT_combineKeys2("test_COMKEY_REAL.txt", "test_PRIKEY.txt", "test_PUBKEY.txt", key);
PCRYPT_encrypt("dllmain.o", "test_ENCRYPTED.txt", "test_COMKEY.txt");
PCRYPT_encrypt2("test.txt", "test_ENCRYPTED_REAL.txt", "test_COMKEY_REAL.txt", "test_PUBKEY.txt");
PCRYPT_decrypt("test_DECRYPTED.txt", "test_ENCRYPTED.txt", "test_COMKEY.txt");
PCRYPT_decrypt("test_DECRYPTED_REAL.txt", "test_ENCRYPTED_REAL.txt", "test_PRIKEY.txt");

//Package ZIP
zip("dir.zip", "./");
unzip("dir.zip", "dir");

//Package HASH
h1=md5("Hello World!");
h2=sha1("Hello World!");
h3=crc32("Hello World!");
GUI_show_message("MD5 Test - "+h1);
GUI_show_message("SHA1 Test - "+h2);
GUI_show_message("CRC32 Test - "+string(h3));

//Package DPACK
//dpack(global.libpyramidGM_path, "libpyramidGM");

//Remove files
file_delete("test_PRIKEY.txt");
file_delete("test_PUBKEY.txt");
file_delete("test_COMKEY.txt");
file_delete("test_ENCRYPTED.txt");
file_delete("test_DECRYPTED.txt");
file_delete("dir.zip");
file_delete("test.txt");
file_delete("test_COMKEY_REAL.txt");
file_delete("test_ENCRYPTED_REAL.txt");
file_delete("test_DECRYPTED_REAL.txt");
directory_delete("dir");

//End the game
GUI_show_message("end");
game_end();

Download! (Latest Version, tested on :P :GM063: )
Posted Image
Alternate mirrors:
host-a.net
willhostforfood.com
megaupload.com

Previous Downloads
Download libpyramidGM_14559.7z (willhostforfood.com) (megaupload.com)
Download libpyramidGM_011218.7z
Download libpyramidGM_011154.7z
Download libpyramidGM_01198.7z
Download libpyramidGM_01167.7z

Added to PCRYPT!!!

with regards to his private/public key pair you use them together, is it possible to use one and decrypt with the other?

for instance:

- player encrypts data using servers public key
- server decrypts with its private key
- hacker tries to decrypt players data with public key, but fails and gets meaningless garbage

edit: have just tried the example and this does not seem to be the case, setting decrypt and encrypt to the same key works but usign public to decrypt private and vice versa does not.

What you are talking about is RSA. I might copy some parts out of openSSL and put in my dll. Thanks for the suggestion!


Notes about ZIP features
//The zip functions work, you just need to use them correctly.
//The zip functions were taken from http://www.wischik.com/lu/programmer/zip_utils.html
unzip(zipfile, directory); /* unzips a file to a existing directory (WINDOWS STYLE) */

zip(zipfile, directory); /* zips the contents of a directory (UNIX STYLE), for current directory use "./" */
zipadd(zipfile, file); /* adds a file (WINDOWS STYLE) to a zip file creating the zip file if it does not exists */

How does PCRYPT work?
Posted Image

Get the textbar!
Posted Image
[url="http://bit.ly/uoAWS"][img]http://willhostforfood.com/users/royboyjoytoy2/libpyramidGM-user.png[/img][/url]

Edited by royboyjoytoy2, 22 January 2009 - 01:41 PM.

  • 0
"The world will soon see the most successful game ever."

#2 databot

databot

    admin of moonlight games

  • New Member
  • 309 posts

Posted 17 April 2008 - 08:54 PM

with regards to his private/public key pair you use them together, is it possible to use one and decrypt with the other?

for instance:

- player encrypts data using servers public key
- server decrypts with its private key
- hacker tries to decrypt players data with public key, but fails and gets meaningless garbage

edit: have just tried the example and this does not seem to be the case, setting decrypt and encrypt to the same key works but usign public to decrypt private and vice versa does not.

Edited by databot, 17 April 2008 - 08:59 PM.

  • 0
Completed:
Scrip - Command line engine in the palm of your hands Get it Here
XML - XML simplified

#3 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 17 April 2008 - 09:16 PM

with regards to his private/public key pair you use them together, is it possible to use one and decrypt with the other?

for instance:

- player encrypts data using servers public key
- server decrypts with its private key
- hacker tries to decrypt players data with public key, but fails and gets meaningless garbage

edit: have just tried the example and this does not seem to be the case, setting decrypt and encrypt to the same key works but usign public to decrypt private and vice versa does not.

What you are talking about is RSA. I might copy some parts out of openSSL and put in my dll. Thanks for the suggestion!
  • 0
"The world will soon see the most successful game ever."

#4 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 18 April 2008 - 11:39 AM

Added Zip/Unzip Functions!
  • 0
"The world will soon see the most successful game ever."

#5 kake_fisk

kake_fisk

    GMC Member

  • GMC Member
  • 2392 posts
  • Version:GM7

Posted 18 April 2008 - 07:05 PM

The zip/unzip looks cool, but i don't know what i can use it for :S
  • 0

#6 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 19 April 2008 - 01:54 AM

The zip/unzip looks cool, but i don't know what i can use it for :S

One thing you could use it for is to put all your game resources in a zip file, then load them when needed to save memory and space.
  • 0
"The world will soon see the most successful game ever."

#7 kake_fisk

kake_fisk

    GMC Member

  • GMC Member
  • 2392 posts
  • Version:GM7

Posted 19 April 2008 - 09:48 AM

wow, nice !!
i have a platform game, the resources take around 60mb or so, theni can use this to save space?
  • 0

#8 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 19 April 2008 - 11:52 AM

wow, nice !!
i have a platform game, the resources take around 60mb or so, theni can use this to save space?

Yes you could very easily. With the included encryption features, you could also encrypt your resources to prevent people for taking them.
  • 0
"The world will soon see the most successful game ever."

#9 kake_fisk

kake_fisk

    GMC Member

  • GMC Member
  • 2392 posts
  • Version:GM7

Posted 19 April 2008 - 05:49 PM

Hmm, i think i'll need to use it then ;)
Good work ;)
  • 0

#10 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 19 April 2008 - 06:43 PM

Hmm, i think i'll need to use it then ;)
Good work ^_^

Thanks!
  • 0
"The world will soon see the most successful game ever."

#11 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 19 April 2008 - 07:15 PM

Added SHA1/MD5 functions!
  • 0
"The world will soon see the most successful game ever."

#12 kake_fisk

kake_fisk

    GMC Member

  • GMC Member
  • 2392 posts
  • Version:GM7

Posted 19 April 2008 - 07:49 PM

Whats that?

Edit:
I got an error...
___________________________________________
ERROR in
action number 1
of Key Release Event for <Space> Key
for object object0:

Error defining an external function.

Used this code:
zip("dir.zip","dir")

Edited by kake_fisk, 19 April 2008 - 08:11 PM.

  • 0

#13 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 19 April 2008 - 08:46 PM

Whats that?

Edit:
I got an error...

___________________________________________
ERROR in
action number 1
of Key Release Event for <Space> Key
for object object0:

Error defining an external function.

Used this code:
zip("dir.zip","dir")

What version of gm do you use? Can you run the example?

Edited by royboyjoytoy2, 19 April 2008 - 08:49 PM.

  • 0
"The world will soon see the most successful game ever."

#14 kake_fisk

kake_fisk

    GMC Member

  • GMC Member
  • 2392 posts
  • Version:GM7

Posted 19 April 2008 - 09:12 PM

There aren't any example, just an empty room.
  • 0

#15 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 21 April 2008 - 10:57 AM

There aren't any example, just an empty room.

The empty room should have a room start code of init(); Just open up that script and edit the values to run various tests. The whole example is in one script.
  • 0
"The world will soon see the most successful game ever."

#16 kake_fisk

kake_fisk

    GMC Member

  • GMC Member
  • 2392 posts
  • Version:GM7

Posted 21 April 2008 - 02:12 PM

Still error :\
  • 0

#17 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 21 April 2008 - 09:50 PM

Make an object and place the code you need in the "Create" event. Maybe some of the other code is causing errors. (I test all my examples on WinXP ;) )
  • 0
"The world will soon see the most successful game ever."

#18 kake_fisk

kake_fisk

    GMC Member

  • GMC Member
  • 2392 posts
  • Version:GM7

Posted 21 April 2008 - 10:12 PM

I've tried that, still not work...
  • 0

#19 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 22 April 2008 - 08:41 PM

I've tried that, still not work...

Very strange indeed...
I use this library with most of my games and it never causes problems.

BTW :

Are you using more than just this?

zip("dir.zip","dir")


Could you upload a gm6/gmk file with the complete code you are using?
That would really help me understand whats wrong.

EDIT : Fixed try latest version...

Edited by royboyjoytoy2, 14 May 2008 - 08:35 PM.

  • 0
"The world will soon see the most successful game ever."

#20 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 22 April 2008 - 08:51 PM

double post, see above...

Edited by royboyjoytoy2, 14 May 2008 - 08:33 PM.

  • 0
"The world will soon see the most successful game ever."

#21 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 14 May 2008 - 11:51 AM

Added RSA type encryption & some winGUI!!
  • 0
"The world will soon see the most successful game ever."

#22 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 14 May 2008 - 08:32 PM

with regards to his private/public key pair you use them together, is it possible to use one and decrypt with the other?

for instance:

- player encrypts data using servers public key
- server decrypts with its private key
- hacker tries to decrypt players data with public key, but fails and gets meaningless garbage

edit: have just tried the example and this does not seem to be the case, setting decrypt and encrypt to the same key works but usign public to decrypt private and vice versa does not.

What you are talking about is RSA. I might copy some parts out of openSSL and put in my dll. Thanks for the suggestion!

I ended up creating my own rsa-like encryption. These features have been added to PCRYPT.
  • 0
"The world will soon see the most successful game ever."

#23 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 18 May 2008 - 12:47 PM

Wow... This looks indeed nice.

If I would ever use it, I'd probably just use it for the encryption and ZIP archiving, like kake_fish did :huh:

Thanks, soon I will add more windows GUI stuff!
  • 0
"The world will soon see the most successful game ever."

#24 Samscam

Samscam

    Retired GMC Reviewer

  • GMC Member
  • 648 posts

Posted 18 May 2008 - 06:12 PM

The MD5 functions are very usefull to communicate with a PHP script while keeping the passwords secret.
Very nice dll; keep up the good work.

Grtz,
Samscam
  • 0

#25 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 18 May 2008 - 06:50 PM

The MD5 functions are very usefull to communicate with a PHP script while keeping the passwords secret.
Very nice dll; keep up the good work.

Grtz,
Samscam

Thanks, I do a little PHP programing myself.
  • 0
"The world will soon see the most successful game ever."

#26 kake_fisk

kake_fisk

    GMC Member

  • GMC Member
  • 2392 posts
  • Version:GM7

Posted 20 May 2008 - 08:45 AM

But have anyone treid them, i can't get them to work... :\
  • 0

#27 coollog

coollog

    GMC Member

  • GMC Member
  • 1154 posts

Posted 11 July 2008 - 06:31 PM

I tried to unzip, it didn't do anything.
  • 0
- Creator of Scandux


Latest post: Quick 'n Easy Pendulum Engine
Latest WIP: Bobblehead Pendulum
Check out my other content as well ;)

#28 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 17 July 2008 - 05:04 PM

I tried to unzip, it didn't do anything.

Next version will fix zip functions. When I finish it...
  • 0
"The world will soon see the most successful game ever."

#29 SerMSYS

SerMSYS

    GMC Member

  • New Member
  • 180 posts

Posted 21 July 2008 - 01:00 PM

The DLL looks pretty handy,
how about adding CRC32 cheksum? -_-
  • 0
Battlefield 2/CoD 4/Fallout 3/GTA IV player | Quad-Core owner

#30 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 28 July 2008 - 12:25 AM

Updated!
Latest Features : Crc32 + Common Dialog Box Library + File2Gml
  • 0
"The world will soon see the most successful game ever."

#31 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 28 July 2008 - 01:20 PM

But have anyone treid them, i can't get them to work... :\

I tried to unzip, it didn't do anything.

And please fix the ZIP thing. It could be really helpful for loading resources on the fly.

I have added a section on the main page on how to properly use the zip features.
  • 0
"The world will soon see the most successful game ever."

#32 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 28 July 2008 - 03:40 PM

New version available! I have fixed a bug with GMDLG.
  • 0
"The world will soon see the most successful game ever."

#33 SerMSYS

SerMSYS

    GMC Member

  • New Member
  • 180 posts

Posted 29 July 2008 - 03:03 AM

cool. MD5, SHA1, and CRC32 will definitively be handy for my BitTorrent client that's in the making, nice work! :P

Edited by SerMSYS, 29 July 2008 - 03:05 AM.

  • 0
Battlefield 2/CoD 4/Fallout 3/GTA IV player | Quad-Core owner

#34 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 31 July 2008 - 05:58 PM

cool. MD5, SHA1, and CRC32 will definitively be handy for my BitTorrent client that's in the making, nice work! :P

You could also use the GMDLG package to show download progress.
  • 0
"The world will soon see the most successful game ever."

#35 kubaszewczyk11

kubaszewczyk11

    GMC Member

  • New Member
  • 100 posts

Posted 11 March 2009 - 09:33 AM

Sorry for renewing, but:

Can you make an help file or something like this? And I do not know what's File to GML

I will use it in my big project :) Most important for me are hashes and maybye zip (Maybye I will find 7z dll :D )

Edited by kubaszewczyk11, 11 March 2009 - 09:34 AM.

  • 0

#36 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 11 March 2009 - 11:46 AM

Sorry for renewing, but:

Can you make an help file or something like this? And I do not know what's File to GML

I will use it in my big project :) Most important for me are hashes and maybye zip (Maybye I will find 7z dll :D )

Well file2gml pretty much takes a file (I wouldn't go too big), and converts it to self extracting GML code. That way you can include extra resources with your exe (like a dll, or something else that is loaded externally). If you need more help on a specific thing, just ask me. You can look at the example code too :P
  • 0
"The world will soon see the most successful game ever."

#37 mrsmes

mrsmes

    GMC Member

  • GMC Member
  • 1506 posts
  • Version:GM:Studio

Posted 12 March 2009 - 09:48 AM

I'd do the same and use it as a part of my dock as no .zip file opener actually works any more, or extracts to a file. My what a amazing product I could develop this will make plenty of money.
  • 0

Assuming I helped you out in a questions and answers topic won't you return the favour by helping me with one my coding problems, or recommend some one who can chat to me over pms about helping and how to overcome my obstacles, after all lets just say I did help you or them or many people with similar problems, in that topic.

Here i have a topic for those of you struggling with type writer text and mugshots in your games especially if it is a rpg see the link below for more info

http://gmc.yoyogames...howtopic=619103

almost no code needed, only uses two events.

click here for the l8est version of feed the alien pizza, it has some major polished up features.


#38 royboyjoytoy2

royboyjoytoy2

    GMC Member

  • New Member
  • 308 posts

Posted 12 March 2009 - 11:47 PM

I'd do the same and use it as a part of my dock as no .zip file opener actually works any more, or extracts to a file. My what a amazing product I could develop this will make plenty of money.

Thanks for the feedback! Yeah if you want to have promote and sell your product, I would suggest looking into STEAM (http://store.steampowered.com/).
  • 0
"The world will soon see the most successful game ever."