Pixel-Composer/objects/o_main/Other_2.gml

91 lines
2.1 KiB
Text
Raw Normal View History

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