Skip to content

Commit 03571c5

Browse files
committed
Merge branch 'nbs-version-3' into development
2 parents 5beba9f + e6c04da commit 03571c5

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

scripts/draw_window_update/draw_window_update.gml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ else draw_text(x1 + 8, y1 + 8, "Changelist")
99
draw_set_font(fnt_main)
1010
if (window = w_update) draw_text(x1 + 32, y1 + 32, "Thank you for upgrading to version " + version + "!")
1111
fullstr = ""
12+
fullstr += "Changes in v3.5.2 (2019.08.06):\n* NBS format updated to version 3. Now stores song length again\n\n"
1213
fullstr += "Changes in v3.5.1 (2019.07.14):\n* Fixed MIDI Import crash\n\n"
1314
fullstr += "Changes in v3.5.0 (2019.07.11):\n* Added Stereo.\n* Stereo added to Datapack Export.\n* Improved MIDI import, again.\n* Added settings to enhance performance.\n New sprites for note blocks in the dark theme.\n\n"
1415
fullstr += "Changes in v3.4.0 (2019.05.11):\n* Added dark theme.\n* Datapack export: added option to let nearby players hear your music too.\n* Improved MIDI import.\n* NBS format now stores its version for future proofing. This means that\n songs made here can't be opened in older versions of Note Block Studio.\n\n"

scripts/load_song/load_song.gml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,19 @@ if (file_ext = ".nbs") {
2525
byte2 = buffer_read_byte()
2626

2727
if(byte1 = 0 && byte2 = 0){
28-
song_nbt_version = buffer_read_byte()
29-
if song_nbt_version < nbt_version message("Warning: You are opening an older NBS file. Saving this file will make it incompatible with older Note Block Studio versions.","Warning")
30-
if song_nbt_version > nbt_version message("Warning: You are opening an NBS file created in a later version of Note Block Studio. It may crash when opening.","Warning")
28+
song_nbs_version = buffer_read_byte()
29+
if song_nbs_version < nbs_version message("Warning: You are opening an older NBS file. Saving this file will make it incompatible with older Note Block Studio versions.","Warning")
30+
if song_nbs_version > nbs_version message("Warning: You are opening an NBS file created in a later version of Note Block Studio. It may crash when opening.","Warning")
3131
song_first_custom_index = buffer_read_byte()
3232
custom_index_diff = first_custom_index - song_first_custom_index
33+
34+
//From nbt version 3, we save the song length again
35+
if(song_nbs_version > 3){
36+
buffer_read_short()
37+
}
3338
}else{
3439
message("Warning: You are opening an older NBS file. Saving this file will make it incompatible with older Note Block Studio versions.","Warning")
35-
song_nbt_version = 0
40+
song_nbs_version = 0
3641
custom_index_diff = 0
3742
song_first_custom_index = 0
3843
}
@@ -109,7 +114,7 @@ if (file_ext = ".nbs") {
109114
if (layervol[b] = -1) layervol[b] = 100
110115
layervol[b] = median(0, layervol[b], 100)
111116
if (layervol[b] < 100) realvolume = 1
112-
if song_nbt_version>=2 {
117+
if song_nbs_version>=2 {
113118
layerstereo[b] = buffer_read_byte()
114119
}
115120
else {

scripts/macros/macros.gml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#macro gm_runtime_version "2.1.5.246"
2-
#macro version_date "2019.05.11"
3-
#macro version "3.5.1"
4-
#macro nbt_version 2
2+
#macro version_date "2019.08.06"
3+
#macro version "3.5.2"
4+
#macro nbs_version 3
55

66
#macro link_download "https://github.com/HielkeMinecraft/OpenNoteBlockStudio/releases/latest"
77
#macro link_topic "https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/minecraft-tools/2945101-open-minecraft-note-block-studio"

scripts/save_song/save_song.gml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,16 @@ if (fn = "" || filename_ext(filename) != ".nbs") {
1111
if (selected > 0) selection_place(0)
1212
buffer = buffer_create(8, buffer_grow, 1)
1313

14+
//First 2 bytes 0 to indicate new nbs format
1415
buffer_write_short(0)
15-
buffer_write_byte(nbt_version)
16+
17+
buffer_write_byte(nbs_version)
1618
buffer_write_byte(first_custom_index)
1719

20+
//song length (ticks)
21+
buffer_write_short(enda)
22+
23+
//layer count
1824
buffer_write_short(endb2)
1925

2026
buffer_write_string_int(song_name)

0 commit comments

Comments
 (0)