Archive: Game patch file checking


Game patch file checking
OK, kichick has helped me to start off on IRC the other day..

Now, I am stuck at a task that I am not sure if NSIS is capable of.

I am making a patch for one of my games. I have a demo version of the game, and then I have the full registered version of the game.

I am makin a universal patch for the game that updates all previous versions to the latest.

Here's my problem.

I want the installer to check to see if the user has the demo version installed or the full registered version installed. If they have the demo installed, I want the installer to DISALLOW installation of the patch; and if they do have the full registered version installed, then the installer will continue to patch the game. My reason for this is so that people can't download the demo, and then patch it to get a free full version.

Anyways, kichik said I could do this with the IfFileExists function.

Here's what I want it to do. IfFileExists can check all of the user's disk drives for the file "Final Furlong Demo.exe" or "Final Furlong.exe" and then do the corresponding action, either abort installation or continue.

Is this possible with NSIS or not?

Much thanks goes out to kichik who helped me get started!


You can't do that with IfFileExists command. To acheive that you will have to use these commands: FindFirst, FindNext and FindClose.

Good luck.

Vytautas

P.S. Can you just check to see if the specified file is a demo or not by comparing the file's CRC or something? E.G. Is the game executable for a demo version different from a full version and if so then if you compare the CRC of the demo to the users version and they match then don't install the patch. ;)


OK,

I'm sorry. I forget to say that I am making a patch for the FULL REGISTERED version ONLY. If a person wants to update their version of the demo, they can download a WinZip file for free, since it is the demo.

Can you please outline how I would go about using FindFirst, FindNext, FindClose functions? Maybe a lil example that has to do with my situation?

Sorry, but the NSIS User Guide doesn't explain HOW to use the functions well.

Thanks for the help!


You search for a file using FindFirst, FindNext and FindNext like this. But that's (edit)not(/edit) what you want. You don't want to search the entire hard disk, that would be pointless and time consuming. You want the user to direct you to the directory where the game is installed (in the directory page) and not let the user pass to the next page if that directory doesn't contain "Final Furlong.exe". This you do with IfFileExists. The place you should check in is .onVerifyInstDir or the leave function of the directory page. See Examples\waplugin.nsi for an example usage of .onVerifyInstDir and Examples\LobicLib.nsi for an example of a leave function.


OK,

Thanks kichik.

I went to the link you provided, and copied the COMPLETE EXAMPLE. Changed it to look for my game's EXE.

However, it's not working. For testing, I removed all versions of the game from my computer before running the patch. It didn't seem like it looked for my game's EXE, and it installed with no problems.

What is the problem?

Also, if you find any other problems, make sure and point them out, because I remember seeing a lot more bugs post installation after I ran the test patch.

edited by kichik: attach large scripts next time.


I want to thank sgt-d for helping me with this..

The installer now correctly checks to see if the person has the full version of my game installed. If it doesn't it exits.

sgt-d, you da man!:)


w00t w00t!

glad to hear you got it working!

:)


Do not copy and paste large scripts, attach them. This helps the forum stay clean and easy to read. The forum provides a vast database of questions and answers regarding NSIS, so it's important it stays clean and easy to read so users may easily find the answer they are looking for.