1

I've made a Launcher for my game, and the launcher auto-download and patches the game. But, how can I check if the game has been launched by the Launcher? Is there a way to do it without using Command Line Arguments?

Astronavigator
  • 2,021
  • 2
  • 24
  • 45
Thiago Souza
  • 171
  • 3
  • 12
  • you can make launcher to add some kind of log, and then check log file when game starts – Robert Aug 26 '16 at 07:36
  • Interesting question. Surely it is possible, but I think this could be platform specific. – Astronavigator Aug 26 '16 at 07:39
  • Well, if you dont just call "mygame.exe" you can using .net use the exe, and have the main routine do "stuff off dont call me direct" and yet use the classes etc from with in it... maybe. – BugFinder Aug 26 '16 at 07:40

1 Answers1

2

If your launcher is .net application, you can start your application not from command line, but by calling Main() function (from exported class).

If your launcher is not .net application and your application works on Windows only, then you can try to find launcher's window (using FindWindow function) from main application, send message using SendMessage WinApi function, and check result.

These articles might be usefull:

  1. Importing .net classes
  2. Finding windows
  3. Sending messages
  4. Importing dll functions
Community
  • 1
  • 1
Astronavigator
  • 2,021
  • 2
  • 24
  • 45
  • ok, but if someone's else decompile my launcher, he can just make its own and the game will start without problems? and how I can start the game by calling the Main() method? (my game is made in Unity) – Thiago Souza Aug 26 '16 at 20:29
  • @Unity-ThiagoSouza to prevent someone make new launchers you should use obfuscation. To run you `Main()` method from your launcher you should add add reference to your `Game.exe` or `Game.dll` made by unity. After that you can create object of your class (like `MyGameNamespace.MyGameClass`) (if it is not static) and run `Main()` method. – Astronavigator Aug 27 '16 at 09:05