@@ -15,9 +15,9 @@ function control_create() {
1515 // Window
1616 #macro NOT_RUN_FROM_IDE !string_count (" GMS2TEMP" , get_execution_command ()) // THIS CONSTANT IS A REVERSE BOOLEAN (0 is from IDE)
1717 // show_message(get_execution_command() + "IDE: " + string(NOT_RUN_FROM_IDE))
18- p_num = parameter_count ()
19- isplayer = (check_args (" -player" ))
20- filenamearg = check_args ()
18+ p_num = parameter_count ();
19+ isplayer = (check_args (" -player" ));
20+ filenamearg = check_args ();
2121 for (var i = 0 ; i < p_num; i += 1 ) {
2222 if (parameter_string (i) = " -player" || parameter_string (i) == " --protocol-launcher" ) isplayer = 1
2323 }
@@ -28,8 +28,10 @@ function control_create() {
2828 if (!isplayer) server_socket = network_create_server (network_socket_tcp, 30010 , 1 )
2929 client_socket = -1
3030 if (server_socket < 0 && !isplayer) {port_taken = 1 ; client_socket = network_create_socket (network_socket_tcp)}
31- if (parameter_count () > 0 ) {
32- if (filenamearg != " " && (filename_ext (filenamearg) = " .mid" || filename_ext (filenamearg) = " .midi" || filename_ext (filenamearg) = " .schematic" || filename_ext (filenamearg) = " .nbs" || filename_ext (filenamearg) = " .zip" )) {
31+ if (p_num > 0 ) {
32+ if (filenamearg != " " && (string_lower (filename_ext (filenamearg)) == " .mid" || string_lower (filename_ext (filenamearg)) == " .midi" ||
33+ string_lower (filename_ext (filenamearg)) == " .schematic" || string_lower (filename_ext (filenamearg)) == " .nbs" ||
34+ string_lower (filename_ext (filenamearg)) == " .zip" )) {
3335 if (port_taken) {
3436 network_connect (client_socket, " 127.0.0.1" , 30010 )
3537 var temp_buffer = buffer_create (0 , buffer_grow, 1 )
@@ -176,7 +178,6 @@ function control_create() {
176178 fullscreen = 0
177179 autosave = 0
178180 autosavemins = 10
179- tonextsave = 0
180181 backupmins = 1
181182 tonextbackup = 0
182183 language = 1 * (os_get_language () = " zh" && os_get_region () = " CN" )
@@ -573,6 +574,7 @@ function control_create() {
573574 // Settings
574575 if (!check_args (" --prefreset" )) load_settings ()
575576 if (os_type = os_macosx) macos_enable_system_settings_menu ()
577+ tonextsave = autosave ? autosavemins : 0 ; // Defining autosavemins here to avoid the autosave when the first song is loaded after open the game.
576578 menu_macos_init ()
577579 switch (language) {
578580 default :
@@ -693,12 +695,15 @@ function control_create() {
693695 // }
694696
695697 if (os_type = os_macosx && macos_url_pending_count () > 0 ) {
696- var temp_url = macos_url_take_pending ()
698+ var temp_url = macos_url_take_pending ();
697699 if (string_count (" nbs://" , temp_url) = 0 ) {
698- var file = string_replace_all (temp_url, " file://" , " " )
699- if (file != " " && (filename_ext (file) = " .mid" || filename_ext (file) = " .midi" || filename_ext (file) = " .schematic" || filename_ext (file) = " .nbs" || filename_ext (file) = " .zip" )) {
700- songs[song].filename = file
701- load_song (file, 0 , 1 , 1 )
700+ var file = string_replace_all (temp_url, " file://" , " " );
701+ if (file != " " &&
702+ (string_lower (filename_ext (file)) == " .mid" || string_lower (filename_ext (file)) == " .midi" || string_lower (filename_ext (file)) == " .schematic" ||
703+ string_lower (filename_ext (file)) == " .nbs" || string_lower (filename_ext (file)) == " .zip" )) {
704+ songs[song].filename = file;
705+ songs[song].file_ext = file_ext;
706+ load_song (file, 0 , 1 , 1 );
702707 }
703708 } else {
704709 isplayer = 1
@@ -781,9 +786,12 @@ function control_create() {
781786 download_song_start (download_url)
782787 }
783788 // Open song
784- if (os_type != os_macosx && parameter_count () > 0 ) {
785- songs[song].filename = filenamearg
786- if (songs[song].filename != " " && (filename_ext (songs[song].filename ) = " .mid" || filename_ext (songs[song].filename ) = " .midi" || filename_ext (songs[song].filename ) = " .schematic" || filename_ext (songs[song].filename ) = " .nbs" || filename_ext (songs[song].filename ) = " .zip" )) {
789+ if (os_type != os_macosx && p_num > 0 ) {
790+ songs[song].filename = filenamearg;
791+ if (songs[song].filename != " " &&
792+ (string_lower (filename_ext (songs[song].filename )) == " .mid" || string_lower (filename_ext (songs[song].filename )) == " .midi" ||
793+ string_lower (filename_ext (songs[song].filename )) == " .schematic" || string_lower (filename_ext (songs[song].filename )) == " .nbs" ||
794+ string_lower (filename_ext (songs[song].filename )) == " .zip" )) {
787795 if (!port_taken) {
788796 load_song (songs[song].filename , 0 , 1 , 1 )
789797 }
0 commit comments