Hello!
I am new here, but definitely not new to Gamemaker. I hope this is an okay place to ask this question. It is directly related to your extension (which is a pretty cool piece of work, by the way).
So I programmed an updater/launcher in Gamemaker for Windows that downloads the executable file for my game and saves it to the launcher's dedicated app data folder. I then execute the program with your extension. The problem comes when there are multiple users on the system. The process all works flawlessly on the primary user account, but then when the secondary user uses the launcher, it downloads just fine, but will not execute the program.
Here is the code that defines the folder's location:
Code:
globalvar place;
place = environment_get_variable("LOCALAPPDATA") + "\Updater";
"Updater" being the name of the launcher I have created. I've tried using "game_save_id", "working_directory", and "program_directory". The latter two do not work and the first yields the same result.
Here is the code that downloads the file. This code works perfectly no matter the user account. I'm just including it to give you an idea of what's going on here:
Code:
size = ds_map_find_value(async_load,"contentLength");
progress = ds_map_find_value(async_load,"sizeDownloaded");
if (perc < 100)
perc = round((progress/size)*100)
if (ds_map_find_value(async_load, "id") == async_ini)
{
var status = ds_map_find_value(async_load,"status");
if (status == 0 && statussss < 2)
{
statussss = 3;
ini_open("localversion.ini");
ini_write_real('version','number',ver);
ini_close();
statussss = 4;
instance_create(x,y,o_Launch);
}
}
Finally, here is the code that launches the game (the game executable being called "GunCave.exe"):
Code:
timer++;
if (timer >= 30*60)
{
if (file_exists(place+"\GunCave.exe"))
{
o_Updater.neednew = 6;
if (timer >= 33*60)
{
ExecuteShell(place+"\GunCave.exe", true);
game_end();
}
}
else
{
o_Updater.neednew = 7;
if (timer >= 33*60)
{
game_end();
}
}
}
This is where the problem lies. This code works on the primary user account, but not on the secondary account. On the primary account, it successfully launches my game and then closes the launcher once the game is closed. On the secondary account, the game fails to launch and the launcher closes.
I know I've read places that have discouraged making a launcher in Gamemaker, but I was able to create and get it to work, up until this issue. I hope someone can help me.
Thanks in advance,
~Gravityhamster