On branch feat/godot-configurator

Changes to be committed:
	modified:   tools/configurator/components/bios_check/bios_check.gd
	new file:   tools/configurator/data_list.json
	new file:   tools/configurator/data_list.yml
	modified:   tools/configurator/main.gd
	modified:   tools/configurator/project.godot
	modified:   tools/configurator/res/pixel_ui_theme/RetroDECKTheme.tres
	modified:   tools/configurator/scripts/class_functions.gd
	modified:   tools/configurator/tk_about.gd
This commit is contained in:
monkeyx-net 2024-08-01 11:47:55 +01:00
parent 1dc99e39d3
commit 77eb009fff
8 changed files with 617 additions and 71 deletions

View file

@ -1,6 +1,6 @@
extends Control
var classFunctions: ClassFunctions
var file := FileAccess
var bios_tempfile : String
var command: String = "../../tools/retrodeck_function_wrapper.sh"
@ -16,14 +16,12 @@ func _ready():
if OS.has_environment("XDG_RUNTIME_DIR"):
#temporary hack for Tim
# This uses tempfs system revisit
bios_tempfile = OS.get_environment("XDG_RUNTIME_DIR") + "/godot_temp/godot_bios_files_checked.tmp"
# bios_tempfile = "/var/config/retrodeck/godot/godot_bios_files_checked.tmp"
#bios_tempfile = OS.get_environment("XDG_RUNTIME_DIR") + "/godot_temp/godot_bios_files_checked.tmp"
bios_tempfile = "/var/config/retrodeck/godot/godot_bios_files_checked.tmp"
else:
bios_tempfile = "/var/config/retrodeck/godot/godot_bios_files_checked.tmp"
var table := $Table
classFunctions = ClassFunctions.new()
add_child(classFunctions)
if bios_type == 0: #Basic BIOS button pressed
table.columns = BIOS_COLUMNS_BASIC.size()
@ -48,7 +46,7 @@ func _ready():
else: #Assume advanced BIOS button pressed
var parameters = ["check_bios_files"]
classFunctions.execute_command(command, parameters, false)
class_functions.execute_command(command, parameters, false)
await run_thread_command(command, parameters, console)
#OS.execute("/app/tools/retrodeck_function_wrapper.sh",["check_bios_files"])
@ -65,7 +63,7 @@ func _ready():
table_line.set_custom_color(i,Color(1,1,1,1))
func run_thread_command(command: String, parameters: Array, console: bool) -> void:
var result = await classFunctions.run_command_in_thread(command, parameters, console)
var result = await class_functions.run_command_in_thread(command, parameters, console)
if result != null:
print (result["output"])
print ("Exit Code: " + str(result["exit_code"]))

View file

@ -0,0 +1,333 @@
{
"about_links": [
{
"name": "Website",
"id": "rd_web",
"url": "https://retrodeck.net/",
"description": "Opens the RetroDECK Website in your default browser"
},
{
"name": "Changelog",
"id": "rd_changelog",
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_rd_versions/version-history/",
"description": "Opens the RetroDECK change log in your default browser"
},
{
"name": "Wiki",
"id": "rd_wiki",
"url": "https://retrodeck.readthedocs.io/en/latest/",
"description": "Opens the RetroDECK Wiki in your default browser"
},
{
"name": "Credits",
"id": "rd_credits",
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_credits/donations-licenses/",
"description": "Opens the RetroDECK Credits in your default browser"
},
{
"name": "Donate",
"id": "rd_donate",
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_credits/donations-licenses/",
"description": "Opens Donations page in your default browser"
},
{
"name": "Contact us",
"id": "rd_contactus",
"url": "https://github.com/XargonWan/RetroDECK",
"description": "Opens the RetroDECK contact us section in your default browser"
},
{
"name": "Licences",
"id": "rd_licenses",
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_credits/donations-licenses/",
"description": "Opens the RetroDECK licenses in your default browser"
}
],
"emulators": {
"cemu": {
"name": "Cemu",
"description": "Wii U emulator",
"options": [
{
"resettable": true
}
],
"properties": [
{
"standalone": true
},
{
"abxy_button": {
"status": false
}
}
]
},
"citra": {
"name": "Citra",
"description": "N3DS emulator",
"options": [
{
"resettable": true
}
],
"properties": [
{
"standalone": true
},
{
"abxy_button": {
"status": false
}
}
]
},
"dolphin": {
"name": "Dolphin",
"description": "Wii/GameCube emulator",
"options": [
{
"resettable": true
}
],
"properties": [
{
"standalone": true
},
{
"abxy_button": {
"status": false
}
}
]
},
"duckstation": {
"name": "Duckstation",
"description": "PSX emulator",
"options": [
{
"resettable": true
}
],
"properties": [
{
"standalone": true
},
{
"abxy_button": {
"status": false
}
}
]
},
"gzdoom": {
"name": "GZDoom",
"description": "Doom engine",
"options": [
{
"resettable": true
}
],
"properties": [
{
"standalone": true
},
{
"abxy_button": {
"status": false
}
}
]
},
"mame": {
"name": "MAME",
"description": "Multiple Arcade Machine Emulator",
"options": [
{
"resettable": true
}
],
"properties": [
{
"standalone": true
},
{
"abxy_button": {
"status": false
}
}
]
},
"melonds": {
"name": "MelonDS",
"description": "NDS emulator",
"options": [
{
"resettable": true
}
],
"properties": [
{
"standalone": true
},
{
"abxy_button": {
"status": false
}
}
]
},
"pcsx2": {
"name": "PCSX2",
"description": "PS2 emulator",
"options": [
{
"resettable": true
}
],
"properties": [
{
"standalone": true
},
{
"abxy_button": {
"status": false
}
}
]
},
"ppsspp": {
"name": "PPSSPP",
"description": "PSP emulator",
"options": [
{
"resettable": true
}
],
"properties": [
{
"standalone": true
},
{
"abxy_button": {
"status": false
}
}
]
},
"primehack": {
"name": "Primehack",
"description": "Metroid Prime emulator",
"options": [
{
"resettable": true
}
],
"properties": [
{
"standalone": true
},
{
"abxy_button": {
"status": false
}
}
]
},
"rpcs3": {
"name": "RPCS3",
"description": "PS3 emulator",
"options": [
{
"resettable": true
}
],
"properties": [
{
"standalone": true
},
{
"abxy_button": {
"status": false
}
}
]
},
"ryujinx": {
"name": "Ryujinx",
"description": "Switch emulator",
"options": [
{
"resettable": true
}
],
"properties": [
{
"standalone": true
},
{
"abxy_button": {
"status": false
}
}
]
},
"vita3k": {
"name": "Vita3k",
"description": "PS Vita emulator",
"options": [
{
"resettable": true
}
],
"properties": [
{
"standalone": true
},
{
"abxy_button": {
"status": false
}
}
]
},
"xemu": {
"name": "XEMU",
"description": "XBOX emulator",
"options": [
{
"resettable": true
}
],
"properties": [
{
"standalone": true
},
{
"abxy_button": {
"status": false
}
}
]
},
"yuzu": {
"name": "Yuzu",
"description": "Switch emulator",
"options": [
{
"resettable": true
}
],
"properties": [
{
"standalone": true
},
{
"abxy_button": {
"status": false
}
}
]
}
}
}

View file

@ -0,0 +1,166 @@
about_links:
- name: "Website"
id: rd_web
url: https://retrodeck.net/
description: "Opens the RetroDECK Website in your default browser"
- name: "Changelog"
id: rd_changelog
url: https://retrodeck.readthedocs.io/en/latest/wiki_rd_versions/version-history/
description: "Opens the RetroDECK change log in your default browser"
- name: "Wiki"
id: rd_wiki
url: https://retrodeck.readthedocs.io/en/latest/
description: "Opens the RetroDECK Wiki in your default browser"
- name: "Credits"
id: rd_credits
url: https://retrodeck.readthedocs.io/en/latest/wiki_credits/donations-licenses/
description: "Opens the RetroDECK Credits in your default browser"
- name: "Donate"
id: rd_donate
url: https://retrodeck.readthedocs.io/en/latest/wiki_credits/donations-licenses/
description: "Opens Donations page in your default browser"
- name: "Contact us"
id: rd_contactus
url: https://github.com/XargonWan/RetroDECK
description: "Opens the RetroDECK contact us section in your default browser"
- name: "Licences"
id: rd_licenses
url: https://retrodeck.readthedocs.io/en/latest/wiki_credits/donations-licenses/
description: "Opens the RetroDECK licenses in your default browser"
emulators:
cemu:
name: "Cemu"
description: "Wii U emulator"
options:
- resettable: true
properties:
- standalone: true
- abxy_button:
status: false
citra:
name: "Citra"
description: "N3DS emulator"
options:
- resettable: true
properties:
- standalone: true
- abxy_button:
status: false
dolphin:
name: "Dolphin"
description: "Wii/GameCube emulator"
options:
- resettable: true
properties:
- standalone: true
- abxy_button:
status: false
duckstation:
name: "Duckstation"
description: "PSX emulator"
options:
- resettable: true
properties:
- standalone: true
- abxy_button:
status: false
gzdoom:
name: "GZDoom"
description: "Doom engine"
options:
- resettable: true
properties:
- standalone: true
- abxy_button:
status: false
mame:
name: "MAME"
description: "Multiple Arcade Machine Emulator"
options:
- resettable: true
properties:
- standalone: true
- abxy_button:
status: false
melonds:
name: "MelonDS"
description: "NDS emulator"
options:
- resettable: true
properties:
- standalone: true
- abxy_button:
status: false
pcsx2:
name: "PCSX2"
description: "PS2 emulator"
options:
- resettable: true
properties:
- standalone: true
- abxy_button:
status: false
ppsspp:
name: "PPSSPP"
description: "PSP emulator"
options:
- resettable: true
properties:
- standalone: true
- abxy_button:
status: false
primehack:
name: "Primehack"
description: "Metroid Prime emulator"
options:
- resettable: true
properties:
- standalone: true
- abxy_button:
status: false
rpcs3:
name: "RPCS3"
description: "PS3 emulator"
options:
- resettable: true
properties:
- standalone: true
- abxy_button:
status: false
ryujinx:
name: "Ryujinx"
description: "Switch emulator"
options:
- resettable: true
properties:
- standalone: true
- abxy_button:
status: false
vita3k:
name: "Vita3k"
description: "PS Vita emulator"
options:
- resettable: true
properties:
- standalone: true
- abxy_button:
status: false
xemu:
name: "XEMU"
description: "XBOX emulator"
options:
- resettable: true
properties:
- standalone: true
- abxy_button:
status: false
yuzu:
name: "Yuzu"
description: "Switch emulator"
options:
- resettable: true
properties:
- standalone: true
- abxy_button:
status: false

View file

@ -1,6 +1,5 @@
extends Control
var class_functions: ClassFunctions
var bios_type:int
var status_code_label: Label
@ -18,18 +17,19 @@ var anim_logo: AnimatedSprite2D
var anim_rekku: AnimatedSprite2D
func _ready():
class_functions = ClassFunctions.new()
_get_nodes()
_connect_signals()
_play_main_animations()
var emulator_list = class_functions.get_text_file_from_system_path("../../tools/configurator.sh","sed -n '/local emulator_list=(/,/)/{s/.*local emulator_list=\\(.*\\)/\\1/; /)/q; p}' ","emulist")
print (emulator_list)
#print (emulator_list)
var abxy_button_list = class_functions.get_text_file_from_system_path("/var/config/retrodeck/retrodeck.cfg","sed -n '/\\[abxy_button_swap\\]/,/^$/p' ","normal")
print(abxy_button_list)
#print(abxy_button_list)
var file_path = "res://data_list.json"
var about_links_dict: Dictionary = class_functions.get_about_links_from_file(file_path)
print(about_links_dict)
# set current startup tab to match IDE
tab_container.current_tab = 3
add_child(class_functions) # Needed for threaded results
#add_child(class_functions) # Needed for threaded results Not need autoload?
var children = findElements(self, "Control")
for n: Control in children: #iterate the children
if (n.focus_mode == FOCUS_ALL):

View file

@ -17,6 +17,10 @@ boot_splash/bg_color=Color(0.141176, 0.141176, 0.141176, 0)
boot_splash/show_image=false
config/icon="res://icon.svg"
[autoload]
class_functions="*res://scripts/class_functions.gd"
[display]
window/size/viewport_width=1280

File diff suppressed because one or more lines are too long

View file

@ -52,19 +52,19 @@ func get_text_file_from_system_path(file_path: String, command: String, etype: S
return {}
func parse_imported_string(input_string: String) -> Dictionary:
var result: Dictionary
var current_dict_key: String
var _result: Dictionary
var _current_dict_key: String
var lines = input_string.strip_edges().split("\n", false)
if lines.size() > 0:
lines = lines.slice(1, lines.size()) # Skip the first line
#if lines.size() > 0:
# lines = lines.slice(1, lines.size()) # Skip the first line
for line in lines:
current_dict_key = line
_current_dict_key = line
var parts = line.split("=", false)
if parts.size() == 2:
var key = parts[0]
var value_str = parts[1]
result[key] = {"KEY": key, "Value": value_str}
return result
_result[key] = {"KEY": key, "Value": value_str}
return _result
func parse_file_list(content: String) -> Dictionary:
var file_dict = {}
@ -116,3 +116,47 @@ func _import_data_lists(file_path: String) -> void:
print("URL: " + entry["URL"])
print("Description: " + entry["Description"])
print("---")
func get_about_links_from_file(file_path: String) -> Dictionary:
var about_links_dict = {}
var file = FileAccess.open(file_path, FileAccess.READ)
if file:
var json_string = file.get_as_text()
file.close()
var json = JSON.new()
var parse_result = json.parse(json_string)
print ("RES: %s",parse_result)
if parse_result == OK:
var data = parse_result
print (data)
print("JSON Parse Error: ", json.get_error_message(), " in ", json_string, " at line ", json.get_error_line())
#continue
if parse_result is Dictionary:
if parse_result.has("about_links"):
var about_links = parse_result["about_links"]
about_links_dict = parse_about_links(about_links)
else:
print("Error: 'about_links' key not found in JSON.")
else:
print("Error parsing JSON: %s" % json.error_string)
else:
print("Failed to open file: %s" % file_path)
print (about_links_dict)
return about_links_dict
func parse_about_links(about_links: Array) -> Dictionary:
var about_links_dict = {}
for link in about_links:
about_links_dict[link["id"]] = {
"name": link["name"],
"url": link["url"],
"description": link["description"]
}
return about_links_dict

View file

@ -1,6 +1,6 @@
extends MarginContainer
var class_functions: ClassFunctions
#var class_functions: ClassFunctions
var website_button: Button
var changelog_button: Button
@ -13,8 +13,9 @@ var tk_about: Dictionary
signal signal_theme_changed
func _ready():
class_functions = ClassFunctions.new()
#class_functions._import_data_lists("res://assets/data_lists/tk_about.csv")
#class_functions = ClassFunctions.new()
#tk_about = class_functions._import_data_lists("res://tk_about.txt")
tk_about = class_functions.import_csv_data("tk_about.txt")
_get_nodes()
_connect_signals()
@ -68,10 +69,10 @@ func _connect_signals() -> void:
licenses_button.pressed.connect(_about_button_pressed.bind("rd_licenses"))
func _about_button_pressed(id: String) -> void:
var entry: Dictionary
var entry: Dictionary
match id:
"rd_web":
entry = tk_about[id]
entry = tk_about[id]
OS.shell_open(%website_button.editor_description)
"rd_changelog":
entry = tk_about[id]