Pixel-Composer/objects/o_main/Other_2.gml

92 lines
2.1 KiB
Text
Raw Normal View History

2022-01-13 11:24:03 +07:00
/// @description main directory, parameter
2023-03-13 16:45:56 +07:00
//print("===== Game Start Begin =====");
2023-03-07 20:29:47 +07:00
2022-01-13 11:24:03 +07:00
#region directory
globalvar DIRECTORY;
2023-03-07 20:29:47 +07:00
DIRECTORY = "";
if(OS == os_windows)
2023-03-08 18:14:01 +07:00
DIRECTORY = environment_get_variable("userprofile") + "/AppData/Local/PixelComposer/";
2023-03-22 14:29:29 +07:00
else if(OS == os_macosx) {
var home_dir = environment_get_variable("HOME");
if(string(home_dir) == "0")
log_message("DIRECTORY", "Directory not found.");
else
DIRECTORY = string(home_dir) + "/PixelComposer/";
}
2023-03-23 12:57:31 +07:00
show_debug_message("Current working directory: " + string(DIRECTORY));
2023-03-22 14:29:29 +07:00
2022-11-22 20:25:39 +07:00
if(!directory_exists(DIRECTORY))
directory_create(DIRECTORY);
2022-12-21 08:30:23 +07:00
if(!directory_exists(DIRECTORY + "temp"))
directory_create(DIRECTORY + "temp");
2023-02-14 08:51:14 +07:00
METADATA = __getdefaultMetaData();
2023-03-22 14:29:29 +07:00
PREF_LOAD();
log_clear();
2022-01-13 11:24:03 +07:00
log_newline();
log_message("SESSION", "Begin");
log_message("DIRECTORY", DIRECTORY);
2023-02-14 08:51:14 +07:00
2023-03-07 20:29:47 +07:00
window_set_showborder(false);
2023-03-28 11:58:28 +07:00
__initSurfaceFormat();
2023-02-14 08:51:14 +07:00
__initLocale();
2023-03-21 09:01:53 +07:00
__initTheme();
2022-12-10 11:06:01 +07:00
__initCollection();
2022-09-27 11:37:28 +07:00
__initAssets();
2022-12-10 11:06:01 +07:00
__initPresets();
2022-12-16 15:18:09 +07:00
__initFontFolder();
2023-01-04 08:30:04 +07:00
__initLua();
2023-03-21 09:01:53 +07:00
__initNodeData();
__initNodes();
2023-02-14 08:51:14 +07:00
__initSteamUGC();
2022-11-22 20:25:39 +07:00
2023-03-22 14:29:29 +07:00
PREF_APPLY();
2023-02-15 16:04:49 +07:00
loadFonts();
loadGraphic(PREF_MAP[? "theme"]);
loadColor(PREF_MAP[? "theme"]);
2022-11-22 20:25:39 +07:00
setPanel();
2023-02-14 08:51:14 +07:00
if(file_exists("icon.png"))
file_copy("icon.png", DIRECTORY + "icon.png");
environment_set_variable("IMGUI_DIALOG_WIDTH", string(800));
2023-02-14 13:37:13 +07:00
var cmd = ".pxc=\"" + string(program_directory) + "PixelComposer.exe\"";
execute_shell("assoc", cmd);
2023-04-09 21:24:16 +02:00
2023-02-14 13:37:13 +07:00
var cmd = ".pxcc=\"" + string(program_directory) + "PixelComposer.exe\"";
execute_shell("assoc", cmd);
2022-01-13 11:24:03 +07:00
#endregion
#region parameter
alarm[1] = 2;
2023-02-14 08:51:14 +07:00
2022-01-13 11:24:03 +07:00
if(parameter_count() > 1) {
var path = parameter_string(1);
2023-02-14 08:51:14 +07:00
if(path == "--crashed") {
2023-04-09 21:24:16 +02:00
if(PREF_MAP[? "show_crash_dialog"])
dialogCall(o_dialog_crashed);
2023-02-14 08:51:14 +07:00
} else {
path = string_replace_all(path, "\n", "");
path = string_replace_all(path, "\"", "");
2022-11-21 12:38:44 +07:00
2023-02-14 08:51:14 +07:00
if(file_exists(path) && filename_ext(path) == ".pxc") {
file_open_parameter = path;
alarm[2] = 3;
2022-11-21 12:38:44 +07:00
2023-02-14 08:51:14 +07:00
directory_set_current_working(DIRECTORY);
}
2022-01-13 11:24:03 +07:00
}
}
2023-02-14 08:51:14 +07:00
#endregion
#region lua
lua_error_handler = _lua_error;
2023-03-07 20:29:47 +07:00
#endregion
2023-03-13 16:45:56 +07:00
//print("===== Game Start End =====");