Skip to content

Commit 99b4291

Browse files
committed
Move update check back to the get_update script
1 parent 89ca807 commit 99b4291

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

scripts/control_draw/control_draw.gml

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,26 +1324,10 @@ if (mouse_check_button_released(mb_left)) {
13241324
if (window = w_releasemouse && !mouse_check_button(mb_left)) window = 0
13251325
draw_windows()
13261326

1327-
// Draw update progress
1328-
if (update == 4 or update == 5) {
1327+
// Draw update progress bar
1328+
if (update == 4) {
13291329
window = -1
13301330
draw_loading("Update", "Downloading update...", downloaded_size, total_size)
1331-
if (update == 5) {
1332-
if (file_get_size(update_file) == total_size) {
1333-
update = 1
1334-
show_message("Download complete! Click OK to begin installing the update.")
1335-
// At this point, the game is paused until the user dismisses the message
1336-
ExecuteShell(update_file, false, true)
1337-
game_end()
1338-
} else {
1339-
if (question("Failed to download update. Do you want to open the Note Block Studio website and update manually?", "Failed")) {
1340-
open_url(link_download)
1341-
}
1342-
window = w_greeting
1343-
update_download = -1
1344-
update = 1
1345-
}
1346-
}
13471331
}
13481332

13491333
window_set_cursor(curs)

scripts/get_update/get_update.gml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,25 @@
55
// 0 - success (download complete)
66

77
if (async_load[? "id"] == update_download) {
8-
var http_status = async_load[? "http_status"]
98
var status = async_load[? "status"]
109
if (status == 1) {
1110
downloaded_size = async_load[? "sizeDownloaded"]
1211
total_size = async_load[? "contentLength"]
1312
} else if (status == 0) {
1413
// Download was interrupted, may have been successful or not (if connection was interrupted)
1514
update = 5
15+
if (file_get_size(update_file) == total_size) {
16+
show_message("Download complete! Click OK to begin installing the update.")
17+
// At this point, the game is paused until the user dismisses the message
18+
ExecuteShell(update_file, false, true)
19+
game_end()
20+
} else {
21+
if (question("Failed to download update. Do you want to open the Note Block Studio website and update manually?", "Failed")) {
22+
open_url(link_download)
23+
}
24+
window = w_greeting
25+
update_download = -1
26+
update = 1
27+
}
1628
}
1729
}

0 commit comments

Comments
 (0)