globalvar game, proc, pid, ppid, opid,
oenv, senv, newlinesplit, equalssplit;
widget_get_owner(window_handle());
if (os_type == os_windows) {
if (file_exists(working_directory + "data.win")) {
game = working_directory + "data.win";
} else {
game = working_directory +
string_replace_all(game_project_name, "_", " ") + ".win";
}
} else if (os_type == os_macosx) {
game = working_directory + "game.ios";
} else if (os_type == os_linux) {
game = working_directory + "game.unx";
}
pid = pid_from_self(); ppid = ppid_from_self();
proc = 0; global.string_split_list = ds_list_create();
if (string_copy(cmd_from_pid(ppid), 0, 8) == "/bin/sh ") {
ppid = ppid_from_pid(ppid);
}
if (path_from_pid(pid) != path_from_pid(ppid)) {
window_set_position(window_get_x() - (window_get_width() / 2), window_get_y());
environment_set_variable("CURRENT", "PARENT");
process_execute_async(proc, "\"" + path_from_pid(pid) +
"\" -game \"" + game + "\"");
} else {
window_set_position(window_get_x() + (window_get_width() / 2), window_get_y());
environment_set_variable("CURRENT", "CHILD");
}