Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Saving files...an extension that cant be open...  (Read 1890 times)

0 Members and 1 Guest are viewing this topic.
Saving files...an extension that cant be open...
« on: May 05, 2007, 07:50:21 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 640
well when saving files, you can easily edit the file by opening and changing the variables and have everything, that would be like cheating xD
is there an extension that you can save and cant be open or have access to cheat?
Logged
This is an english website, please speak it.
l0l wut? o_0
Re: Saving files...an extension that cant be ope...
« Reply #1 on: May 05, 2007, 10:56:22 pm »
  • MetalRidley was here
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 235
You can't lock a file, but you can encrypt them to make it harder to edit. It won't make it impossible, but I highly doubt anyone would really care enough to try breaking it (unless they were doing it for fun or something).
Here's an article from GameDev-
http://www.gamedev.net/reference/articles/article1602.asp

It's not for GameMaker but you can get some concepts from it :)
Logged



THE MUSIC IS REVERSIBLE, BUT TIME IS NOT. TURN BACK... turn back... turn back...
Re: Saving files...an extension that cant be ope...
« Reply #2 on: May 05, 2007, 11:07:41 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
You could save it to a system file if you want, they can't be opened outside of DOS. Its not perfect but it would be a deterent, you could also encode it to the logged in user so no other user  on the computer can use it (check WinAPI for this one) and you could even layer encryption on top of all that.

Mostly though thats all overkill, its best to just save it in a propriatary binary format which will deter most script kiddies, but one way or another if someone wants to edit it they will find a way.
« Last Edit: May 05, 2007, 11:09:30 pm by Infinitus »
Logged
Re: Saving files...an extension that cant be ope...
« Reply #3 on: May 05, 2007, 11:52:54 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 640
That sounds like a lot of work...
Nevermind I just tried something stupid and it seems like it works.
I made the savefile be saved as ".gif" as an image.
Then tried editing the variables and values and load it, an error comes up when the file is edited...I guess I'll keep it this way.
Thanks guys! ^^
Logged
This is an english website, please speak it.
l0l wut? o_0
Re: Saving files...an extension that cant be ope...
« Reply #4 on: May 06, 2007, 12:12:04 am »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
Not really ^.^, C# has a function called SetFileAttribute that allows to to save files as system ones, and I'm pretty sure the WinAPI has a similar one to.

And the gif thing is probably just because the encoding has been changed, it would be no problem for someone to edit it.
Logged
Re: Saving files...an extension that cant be ope...
« Reply #5 on: May 06, 2007, 12:13:11 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 640
wait...I'm good at gamemaker but outside that I dont really know or ever been interested learning anything else.
C# can be use with gamemaker?...
Logged
This is an english website, please speak it.
l0l wut? o_0
Re: Saving files...an extension that cant be ope...
« Reply #6 on: May 06, 2007, 12:16:17 am »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
No ... Sorry for some reason I believed you were using C++, however you should still be able to import the winAPI function for setting file attributes.
Logged
Re: Saving files...an extension that cant be ope...
« Reply #7 on: May 06, 2007, 01:22:41 am »
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 4588
Just make a dll that does it for you.

Eh, but for the easy way, just get an encryption dll from GMC and use it.
Logged
the a o d c
Re: Saving files...an extension that cant be ope...
« Reply #8 on: May 06, 2007, 02:10:27 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1635
Just to put a word in, there is no way you'll really be able to deter people who seriously want to heck - it's inevitable. Just a simple xor encryption would be enough to put off the average user, but don't expect to keep out people who really want the save information.

AoDC's approach is the same as mine.
Logged
Re: Saving files...an extension that cant be ope...
« Reply #9 on: May 06, 2007, 08:22:05 am »
  • IBV
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Female
  • Posts: 1075
Why not let people cheat if they want to? o_O
Logged
My signature is empty.
Re: Saving files...an extension that cant be ope...
« Reply #10 on: May 06, 2007, 09:17:25 am »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3374
saving as a .gif file wouldn't do much, I don't think. for anyone to heck all they would have to do is change it to a .txt or similar.
Why not let people cheat if they want to? o_O
I don't see the point in cheating, it ruins all the fun, and a lot of the time the story.
Logged
Quote from: Jason
Your community is a bunch of stuck up turds.
Re: Saving files...an extension that cant be ope...
« Reply #11 on: May 06, 2007, 04:24:03 pm »
  • MetalRidley was here
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 235
They wouldn't even have to change it. It doesn't open if they double click because whatever default picture editor program they have tries opening it, but of course it can't. All they would have to do is right-click and go to 'Open With..' and pick notepad.
Just to put a word in, there is no way you'll really be able to deter people who seriously want to heck - it's inevitable. Just a simple xor encryption would be enough to put off the average user, but don't expect to keep out people who really want the save information.

AoDC's approach is the same as mine.
There was a good XOR article on GameDev, too.
Logged



THE MUSIC IS REVERSIBLE, BUT TIME IS NOT. TURN BACK... turn back... turn back...
Re: Saving files...an extension that cant be ope...
« Reply #12 on: May 06, 2007, 04:57:27 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
If you want an XOr encryption routine, I wrote one in GML (*shudder* Horrible, horrible, horrible) for Retro a while ago, just go ask him.
« Last Edit: May 06, 2007, 05:43:11 pm by Infinitus »
Logged
Re: Saving files...an extension that cant be ope...
« Reply #13 on: May 06, 2007, 05:20:07 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1635
I wrote one in GM too (*cheer*), if you want to see it.

Crap, I think I still have the script - gotta check my backup HD.
Logged
Re: Saving files...an extension that cant be ope...
« Reply #14 on: May 06, 2007, 06:12:33 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 640
saving as a .gif file wouldn't do much, I don't think. for anyone to heck all they would have to do is change it to a .txt or similar.
Not really.
The Load system loads only the .gif if its .txt it wont open it.
I tried editing the .gif with notepad already and when you load it it shows an error.

I wrote one in GM too (*cheer*), if you want to see it.

!@#$%, I think I still have the script - gotta check my backup HD.
That'll be great!
Logged
This is an english website, please speak it.
l0l wut? o_0
Re: Saving files...an extension that cant be ope...
« Reply #15 on: May 06, 2007, 06:18:53 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
You could always create a checksum of the file and test it before opening it to make sure nobday has modified it, that would be pretty easy.
Logged

rogueyoshi

Re: Saving files...an extension that cant be ope...
« Reply #16 on: May 12, 2007, 07:51:45 am »
Code: [Select]
// ==== FUNCTION ====================================================================
// scrEncryptFile(Input, Output, Signature)
// ==================================================================================
// Encrypts a file using a string driven encryption signature. Works perfectly and
// does the job ^^

    var _InputStream, _OutputStream, _Signature, _Character;   
 
    // ------------------------------------------------------------------------------

    // Workaround. If output file doesn't exist, create
    if (file_exists(argument1) == false) {
        _OutputStream   = file_text_open_write(argument1);
        file_text_close(_OutputStream);
    }

    // Open streams
    _InputStream    = file_bin_open(argument0, 0);      // Input file
    _OutputStream   = file_bin_open(argument1, 1);      // Output file
    _Signature      = argument2;                        // Signature
   
    // ------------------------------------------------------------------------------

    _Character = 0;
    while(file_bin_position(_InputStream) < file_bin_size(_InputStream)) {
        file_bin_write_byte(_OutputStream, file_bin_read_byte(_InputStream)^ord(string_char_at(_Signature,1+_Character)));
        _Character = (_Character+1) mod string_length(_Signature);
    }

    // ------------------------------------------------------------------------------
    // Close files, and we're done.
    file_bin_close(_InputStream);
    file_bin_close(_OutputStream);
notes:
  • Input (argument0) and Output(argument1) are strings containing the file path.
  • Signature (argument2) is a string. This is used for the actual encryption.
  • This can obviously be used to decrypt as well as encrypt; just use the same Signature when loading.
  • By using this script you agree to give credit to the genius that made this, Damizean.

back to random lurking for me.
« Last Edit: May 12, 2007, 07:55:20 am by rogueyoshi »
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.244 seconds with 72 queries.