![]() |
|
Game Updater |
ImLeftFooted
Member #3,935
October 2003
![]() |
Whats the best way to do this on windows? Do I have to use CreateProcess and then quit the game? How do i detect when the game has actually shut down so i can delete / modify the executable? Could I just download an updater executable, do a system("updater.exe"); and then quit? How do I get the system call to not block? Anybody done this sort of thing before? |
ixilom
Member #7,167
April 2006
![]() |
Because I'm lazy I'd just tell the user to run updater.exe manually ___________________________________________ |
Wetimer
Member #1,622
November 2001
|
My suggestion: Have two exes. If you download an update, the game.exe stores the update in the current directory and then exits. My suggestion would be that the update is a zip file. Front does something like this: while(1) { RunGame(); if(UpdateIsWaiting()) InstallUpdate()) else break; } Also, you probably want shellexecute over system. System may produce a "dos" box with bad side effects. <code>if(Windows.State = Crash) Computer.halt();</code> |
miran
Member #2,407
June 2002
|
What about if front.exe is to be updated? -- |
wiseguy
Member #44
April 2000
![]() |
You need to spawn the updater as an atexit, setting your program to not wait for a return...I knew how to do this back in DOS but haven't used spawn for a long time (not sure how the allegro one is set up) |
Wetimer
Member #1,622
November 2001
|
The theory would be that front is simple enough that you won't need to update it. Otherwise, shellexecute should do what you want. <code>if(Windows.State = Crash) Computer.halt();</code> |
clovekx
Member #3,479
April 2003
![]() |
I see no problem erasing the .exe while it's still running. It wont actually be erased until the program ends. --- |
ImLeftFooted
Member #3,935
October 2003
![]() |
Quote: I see no problem erasing the .exe while it's still running. It wont actually be erased until the program ends. My understanding is that Windows puts a 'lock' on the file and the operation just fails. [edit] My ideas so far are:
|
clovekx
Member #3,479
April 2003
![]() |
and what about using exec? That will replace the process with another so you can download updater and then use something like exec("updater.exe") --- |
ImLeftFooted
Member #3,935
October 2003
![]() |
I can't find any documentation on an exec command for windows. |
X-G
Member #856
December 2000
![]() |
exec is POSIX. -- |
Billybob
Member #3,136
January 2003
|
kentl
Member #2,905
November 2002
|
I haven't been following the discussion, so this might have been suggested already. But what about having a small file gamename.exe which only executes (when the user starts the game) gamename<versionnr>.exe and exists immediately without waiting for a return value. Then that file could be overwritten by the updater telling it to run the new version next time. And the next time the game is executed the new version does some cleaning. |
ImLeftFooted
Member #3,935
October 2003
![]() |
Thanks for all the help. Gonna re-open this thread when it comes closer to time for me to actually make the updater, but now I got most of my theories down P.S. |
|