Small cleanup to properly use library paths
This commit is contained in:
parent
6da094d837
commit
458bf30b4e
|
@ -4,13 +4,13 @@
|
|||
[ext_resource path="res://scripts/OptionPanel.gd" type="Script" id=2]
|
||||
[ext_resource path="res://default.theme" type="Theme" id=3]
|
||||
|
||||
[sub_resource type="DynamicFont" id=3]
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 24
|
||||
outline_size = 1
|
||||
outline_color = Color( 0, 0, 0, 1 )
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[sub_resource type="GDScript" id=4]
|
||||
[sub_resource type="GDScript" id=2]
|
||||
script/source = "extends Label
|
||||
|
||||
var fps: float = 0.0
|
||||
|
@ -22,7 +22,7 @@ func _process(delta):
|
|||
update()
|
||||
"
|
||||
|
||||
[sub_resource type="GDScript" id=5]
|
||||
[sub_resource type="GDScript" id=3]
|
||||
script/source = "extends Label
|
||||
|
||||
var audio_latency: float = 0.0
|
||||
|
@ -52,19 +52,20 @@ __meta__ = {
|
|||
}
|
||||
|
||||
[node name="lbl_fps" type="Label" parent="."]
|
||||
margin_right = 267.0
|
||||
margin_right = 300.0
|
||||
margin_bottom = 34.0
|
||||
custom_fonts/font = SubResource( 3 )
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "FPS: "
|
||||
script = SubResource( 4 )
|
||||
script = SubResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||
margin_top = 38.0
|
||||
margin_right = 267.0
|
||||
margin_bottom = 626.0
|
||||
margin_right = 300.0
|
||||
margin_bottom = 638.0
|
||||
rect_min_size = Vector2( 300, 600 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
@ -72,22 +73,22 @@ __meta__ = {
|
|||
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"]
|
||||
margin_left = 7.0
|
||||
margin_top = 7.0
|
||||
margin_right = 260.0
|
||||
margin_bottom = 581.0
|
||||
margin_right = 293.0
|
||||
margin_bottom = 593.0
|
||||
|
||||
[node name="cb_qsettings" type="CheckBox" parent="PanelContainer/VBoxContainer"]
|
||||
margin_right = 253.0
|
||||
margin_right = 286.0
|
||||
margin_bottom = 31.0
|
||||
pressed = true
|
||||
text = "Quick Settings"
|
||||
|
||||
[node name="vbox_qsettings" type="VBoxContainer" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 35.0
|
||||
margin_right = 253.0
|
||||
margin_right = 286.0
|
||||
margin_bottom = 279.0
|
||||
|
||||
[node name="hbox_language" type="HBoxContainer" parent="PanelContainer/VBoxContainer/vbox_qsettings"]
|
||||
margin_right = 253.0
|
||||
margin_right = 286.0
|
||||
margin_bottom = 29.0
|
||||
custom_constants/separation = 12
|
||||
|
||||
|
@ -102,7 +103,7 @@ __meta__ = {
|
|||
|
||||
[node name="btn_language" type="OptionButton" parent="PanelContainer/VBoxContainer/vbox_qsettings/hbox_language"]
|
||||
margin_left = 87.0
|
||||
margin_right = 253.0
|
||||
margin_right = 286.0
|
||||
margin_bottom = 29.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Native"
|
||||
|
@ -115,7 +116,7 @@ __meta__ = {
|
|||
|
||||
[node name="lbl_volume" type="Label" parent="PanelContainer/VBoxContainer/vbox_qsettings"]
|
||||
margin_top = 33.0
|
||||
margin_right = 253.0
|
||||
margin_right = 286.0
|
||||
margin_bottom = 56.0
|
||||
text = "Main Volume"
|
||||
__meta__ = {
|
||||
|
@ -124,7 +125,7 @@ __meta__ = {
|
|||
|
||||
[node name="sl_volume" type="HSlider" parent="PanelContainer/VBoxContainer/vbox_qsettings"]
|
||||
margin_top = 60.0
|
||||
margin_right = 253.0
|
||||
margin_right = 286.0
|
||||
margin_bottom = 76.0
|
||||
min_value = -40.0
|
||||
max_value = 0.0
|
||||
|
@ -136,7 +137,7 @@ __meta__ = {
|
|||
|
||||
[node name="lbl_vol_music" type="Label" parent="PanelContainer/VBoxContainer/vbox_qsettings"]
|
||||
margin_top = 80.0
|
||||
margin_right = 253.0
|
||||
margin_right = 286.0
|
||||
margin_bottom = 103.0
|
||||
text = "Music Volume"
|
||||
__meta__ = {
|
||||
|
@ -145,7 +146,7 @@ __meta__ = {
|
|||
|
||||
[node name="sl_vol_music" type="HSlider" parent="PanelContainer/VBoxContainer/vbox_qsettings"]
|
||||
margin_top = 107.0
|
||||
margin_right = 253.0
|
||||
margin_right = 286.0
|
||||
margin_bottom = 123.0
|
||||
min_value = -20.0
|
||||
max_value = 0.0
|
||||
|
@ -158,7 +159,7 @@ __meta__ = {
|
|||
|
||||
[node name="lbl_vol_sfx" type="Label" parent="PanelContainer/VBoxContainer/vbox_qsettings"]
|
||||
margin_top = 127.0
|
||||
margin_right = 253.0
|
||||
margin_right = 286.0
|
||||
margin_bottom = 150.0
|
||||
text = "Feedback Volume"
|
||||
__meta__ = {
|
||||
|
@ -167,7 +168,7 @@ __meta__ = {
|
|||
|
||||
[node name="sl_vol_sfx" type="HSlider" parent="PanelContainer/VBoxContainer/vbox_qsettings"]
|
||||
margin_top = 154.0
|
||||
margin_right = 253.0
|
||||
margin_right = 286.0
|
||||
margin_bottom = 170.0
|
||||
min_value = -40.0
|
||||
max_value = 0.0
|
||||
|
@ -179,7 +180,7 @@ __meta__ = {
|
|||
|
||||
[node name="lbl_screenfilter" type="Label" parent="PanelContainer/VBoxContainer/vbox_qsettings"]
|
||||
margin_top = 174.0
|
||||
margin_right = 253.0
|
||||
margin_right = 286.0
|
||||
margin_bottom = 197.0
|
||||
text = "Background Video Darkening"
|
||||
__meta__ = {
|
||||
|
@ -188,7 +189,7 @@ __meta__ = {
|
|||
|
||||
[node name="sl_screenfilter" type="HSlider" parent="PanelContainer/VBoxContainer/vbox_qsettings"]
|
||||
margin_top = 201.0
|
||||
margin_right = 253.0
|
||||
margin_right = 286.0
|
||||
margin_bottom = 217.0
|
||||
max_value = 1.0
|
||||
step = 0.02
|
||||
|
@ -201,36 +202,36 @@ __meta__ = {
|
|||
|
||||
[node name="lbl_audiolatency" type="Label" parent="PanelContainer/VBoxContainer/vbox_qsettings"]
|
||||
margin_top = 221.0
|
||||
margin_right = 253.0
|
||||
margin_right = 286.0
|
||||
margin_bottom = 244.0
|
||||
text = "Audio Latency: "
|
||||
script = SubResource( 5 )
|
||||
script = SubResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 283.0
|
||||
margin_right = 253.0
|
||||
margin_right = 286.0
|
||||
margin_bottom = 287.0
|
||||
|
||||
[node name="cb_graphics" type="CheckBox" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 291.0
|
||||
margin_right = 253.0
|
||||
margin_right = 286.0
|
||||
margin_bottom = 322.0
|
||||
text = "Graphics"
|
||||
|
||||
[node name="vbox_graphics" type="VBoxContainer" parent="PanelContainer/VBoxContainer"]
|
||||
visible = false
|
||||
margin_top = 326.0
|
||||
margin_right = 281.0
|
||||
margin_right = 286.0
|
||||
margin_bottom = 433.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="hbox" type="HBoxContainer" parent="PanelContainer/VBoxContainer/vbox_graphics"]
|
||||
margin_right = 281.0
|
||||
margin_right = 286.0
|
||||
margin_bottom = 40.0
|
||||
|
||||
[node name="btn_vsync" type="CheckButton" parent="PanelContainer/VBoxContainer/vbox_graphics/hbox"]
|
||||
|
@ -254,7 +255,7 @@ __meta__ = {
|
|||
|
||||
[node name="lbl_subsampling" type="Label" parent="PanelContainer/VBoxContainer/vbox_graphics"]
|
||||
margin_top = 44.0
|
||||
margin_right = 281.0
|
||||
margin_right = 286.0
|
||||
margin_bottom = 67.0
|
||||
size_flags_vertical = 0
|
||||
text = "Subsampling (X, Y)"
|
||||
|
@ -264,7 +265,7 @@ __meta__ = {
|
|||
|
||||
[node name="sl_SSX" type="HSlider" parent="PanelContainer/VBoxContainer/vbox_graphics"]
|
||||
margin_top = 71.0
|
||||
margin_right = 281.0
|
||||
margin_right = 286.0
|
||||
margin_bottom = 87.0
|
||||
size_flags_vertical = 1
|
||||
min_value = 0.1
|
||||
|
@ -279,7 +280,7 @@ __meta__ = {
|
|||
|
||||
[node name="sl_SSY" type="HSlider" parent="PanelContainer/VBoxContainer/vbox_graphics"]
|
||||
margin_top = 91.0
|
||||
margin_right = 281.0
|
||||
margin_right = 286.0
|
||||
margin_bottom = 107.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
@ -296,15 +297,15 @@ __meta__ = {
|
|||
|
||||
[node name="HSeparator2" type="HSeparator" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 326.0
|
||||
margin_right = 253.0
|
||||
margin_right = 286.0
|
||||
margin_bottom = 330.0
|
||||
|
||||
[node name="VidTextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer" groups=[
|
||||
"VideoTexRects",
|
||||
]]
|
||||
margin_top = 334.0
|
||||
margin_right = 253.0
|
||||
margin_bottom = 574.0
|
||||
margin_right = 286.0
|
||||
margin_bottom = 586.0
|
||||
rect_min_size = Vector2( 240, 240 )
|
||||
size_flags_horizontal = 7
|
||||
size_flags_vertical = 7
|
||||
|
|
|
@ -22,9 +22,10 @@ rect_min_size = Vector2( 1080, 0 )
|
|||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -254.0
|
||||
margin_left = 0.0
|
||||
margin_right = 0.0
|
||||
margin_bottom = 0.0
|
||||
grow_horizontal = 0
|
||||
|
||||
[node name="TouchInput" type="Control" parent="."]
|
||||
margin_right = 40.0
|
||||
|
|
|
@ -14,7 +14,7 @@ const ERROR_CODES := [
|
|||
]
|
||||
|
||||
var userroot := OS.get_user_data_dir().rstrip('/')+'/' if OS.get_name() != 'Android' else '/storage/emulated/0/RhythmGame/'
|
||||
var PATHS := PoolStringArray([userroot, '/media/fridge-q/Games/Other/maimai Finale/decoded/RhythmGameCharts/slow_userdir/']) # Temporary hardcoded testing
|
||||
var PATHS := PoolStringArray([userroot, '/media/fridge-q/Games/RTG/slow_userdir/']) # Temporary hardcoded testing
|
||||
# The following would probably work. One huge caveat is that permission needs to be manually granted by the user in app settings as we can't use OS.request_permission('WRITE_EXTERNAL_STORAGE')
|
||||
# '/storage/emulated/0/Android/data/au.ufeff.rhythmgame/'
|
||||
# '/sdcard/Android/data/au.ufeff.rhythmgame/'
|
||||
|
@ -81,72 +81,74 @@ func find_by_extensions(array, extensions=null) -> Dictionary:
|
|||
const default_difficulty_keys = ['Z', 'B', 'A', 'E', 'M', 'R']
|
||||
func scan_library():
|
||||
print('Scanning library')
|
||||
var rootdir = userroot + 'songs'
|
||||
var dir = Directory.new()
|
||||
var err = dir.make_dir_recursive(rootdir)
|
||||
if err != OK:
|
||||
print_debug('An error occurred while trying to create the songs directory: ', err)
|
||||
return err
|
||||
|
||||
var songslist = directory_list(rootdir, false)
|
||||
if songslist.err != OK:
|
||||
print('An error occurred when trying to access the songs directory: ', songslist.err)
|
||||
return songslist.err
|
||||
|
||||
var song_defs = {}
|
||||
var collections = {}
|
||||
var genres = {}
|
||||
dir.open(rootdir)
|
||||
for folder in songslist.folders:
|
||||
var full_folder := '%s/%s' % [rootdir, folder]
|
||||
|
||||
if dir.file_exists(folder + '/song.json'):
|
||||
# Our format
|
||||
song_defs[folder] = FileLoader.load_folder(full_folder)
|
||||
print('Loaded song directory: %s' % folder)
|
||||
if song_defs[folder]['genre'] in genres:
|
||||
genres[song_defs[folder]['genre']].append(folder)
|
||||
else:
|
||||
genres[song_defs[folder]['genre']] = [folder]
|
||||
if typeof(song_defs[folder]['chart_difficulties']) == TYPE_ARRAY:
|
||||
var diffs = song_defs[folder]['chart_difficulties']
|
||||
var chart_difficulties = {}
|
||||
for i in min(len(diffs), len(default_difficulty_keys)):
|
||||
chart_difficulties[default_difficulty_keys[i]] = diffs[i]
|
||||
song_defs[folder]['chart_difficulties'] = chart_difficulties
|
||||
for root in PATHS:
|
||||
var rootdir = root + 'songs'
|
||||
var dir = Directory.new()
|
||||
var err = dir.make_dir_recursive(rootdir)
|
||||
if err != OK:
|
||||
print_debug('An error occurred while trying to create the songs directory: ', err)
|
||||
return err
|
||||
|
||||
elif dir.file_exists(folder + '/collection.json'):
|
||||
var collection = FileLoader.load_folder(full_folder, 'collection')
|
||||
collections[folder] = collection
|
||||
var base_dict = {'filepath': folder+'/'} # Top level of the collection dict contains defaults for every song in it
|
||||
for key in collection.keys():
|
||||
if key != 'songs':
|
||||
base_dict[key] = collection[key]
|
||||
for song_key in collection['songs'].keys():
|
||||
var song_dict = collection['songs'][song_key]
|
||||
var song_def = base_dict.duplicate()
|
||||
for key in song_dict.keys():
|
||||
song_def[key] = song_dict[key]
|
||||
Library.add_song(song_key, song_def)
|
||||
# Legacy compat stuff
|
||||
song_defs[song_key] = song_def
|
||||
if song_defs[song_key]['genre'] in genres:
|
||||
genres[song_defs[song_key]['genre']].append(song_key)
|
||||
var songslist = directory_list(rootdir, false)
|
||||
if songslist.err != OK:
|
||||
print('An error occurred when trying to access the songs directory: ', songslist.err)
|
||||
return songslist.err
|
||||
|
||||
dir.open(rootdir)
|
||||
for folder in songslist.folders:
|
||||
var full_folder := '%s/%s' % [rootdir, folder]
|
||||
|
||||
if dir.file_exists(folder + '/song.json'):
|
||||
# Our format
|
||||
song_defs[folder] = FileLoader.load_folder(full_folder)
|
||||
print('Loaded song directory: %s' % folder)
|
||||
if song_defs[folder]['genre'] in genres:
|
||||
genres[song_defs[folder]['genre']].append(folder)
|
||||
else:
|
||||
genres[song_defs[song_key]['genre']] = [song_key]
|
||||
genres[song_defs[folder]['genre']] = [folder]
|
||||
if typeof(song_defs[folder]['chart_difficulties']) == TYPE_ARRAY:
|
||||
var diffs = song_defs[folder]['chart_difficulties']
|
||||
var chart_difficulties = {}
|
||||
for i in min(len(diffs), len(default_difficulty_keys)):
|
||||
chart_difficulties[default_difficulty_keys[i]] = diffs[i]
|
||||
song_defs[folder]['chart_difficulties'] = chart_difficulties
|
||||
|
||||
elif dir.file_exists(folder + '/collection.json'):
|
||||
var collection = FileLoader.load_folder(full_folder, 'collection')
|
||||
collections[folder] = collection
|
||||
var base_dict = {'filepath': folder+'/'} # Top level of the collection dict contains defaults for every song in it
|
||||
for key in collection.keys():
|
||||
if key != 'songs':
|
||||
base_dict[key] = collection[key]
|
||||
for song_key in collection['songs'].keys():
|
||||
var song_dict = collection['songs'][song_key]
|
||||
var song_def = base_dict.duplicate()
|
||||
for key in song_dict.keys():
|
||||
song_def[key] = song_dict[key]
|
||||
Library.add_song(song_key, song_def)
|
||||
# Legacy compat stuff
|
||||
song_defs[song_key] = song_def
|
||||
if song_defs[song_key]['genre'] in genres:
|
||||
genres[song_defs[song_key]['genre']].append(song_key)
|
||||
else:
|
||||
genres[song_defs[song_key]['genre']] = [song_key]
|
||||
|
||||
else:
|
||||
var files_by_ext = find_by_extensions(directory_list(full_folder, false).files)
|
||||
if 'sm' in files_by_ext:
|
||||
var sm_filename = files_by_ext['sm'][0]
|
||||
print(sm_filename)
|
||||
var thing = SM.load_file(full_folder + '/' + sm_filename)
|
||||
print(thing)
|
||||
pass
|
||||
else:
|
||||
print('Found non-song directory: ' + folder)
|
||||
for file in songslist.files:
|
||||
print('Found file: ' + file)
|
||||
var files_by_ext = find_by_extensions(directory_list(full_folder, false).files)
|
||||
if 'sm' in files_by_ext:
|
||||
var sm_filename = files_by_ext['sm'][0]
|
||||
print(sm_filename)
|
||||
var thing = SM.load_file(full_folder + '/' + sm_filename)
|
||||
print(thing)
|
||||
pass
|
||||
else:
|
||||
print('Found non-song directory: ' + folder)
|
||||
for file in songslist.files:
|
||||
print('Found file: ' + file)
|
||||
|
||||
return {song_defs=song_defs, genres=genres}
|
||||
|
||||
|
|
Loading…
Reference in New Issue