mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-22 14:05:39 +00:00
On branch feat/godot-configurator
Changes to be committed: modified: tools/configurator/data_list.json modified: tools/configurator/export/configurator.pck deleted: tools/configurator/export/tk_about.txt modified: tools/configurator/main.gd modified: tools/configurator/project.godot modified: tools/configurator/res/pixel_ui_theme/RetroDECKTheme.tres modified: tools/configurator/scripts/data_handler.gd modified: tools/configurator/scripts/emulator_property.gd modified: tools/configurator/tk_about.gd tools/configurator/export/data_list.json
This commit is contained in:
parent
058fe166c5
commit
ec5059b6ea
|
@ -1,45 +1,50 @@
|
|||
{
|
||||
"about_links": {
|
||||
"rd_web": {
|
||||
"name": "Website",
|
||||
"url": "https://retrodeck.net/",
|
||||
"description": "Opens the RetroDECK Website in your default browser"
|
||||
"example_site": {
|
||||
"description": "An example description.",
|
||||
"name": "Example Site",
|
||||
"url": "https://example.com"
|
||||
},
|
||||
"rd_changelog": {
|
||||
"description": "Opens the RetroDECK change log in your default browser",
|
||||
"name": "Changelog",
|
||||
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_rd_versions/version-history/",
|
||||
"description": "Opens the RetroDECK change log in your default browser"
|
||||
},
|
||||
"rd_wiki":{
|
||||
"name": "Wiki",
|
||||
"url": "https://retrodeck.readthedocs.io/en/latest/",
|
||||
"description": "Opens the RetroDECK Wiki in your default browser"
|
||||
},
|
||||
"rd_credits": {
|
||||
"name": "Credits",
|
||||
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_credits/donations-licenses/",
|
||||
"description": "Opens the RetroDECK Credits in your default browser"
|
||||
},
|
||||
"rd_donate": {
|
||||
"name": "Donate",
|
||||
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_credits/donations-licenses/",
|
||||
"description": "Opens Donations page in your default browser"
|
||||
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_rd_versions/version-history/"
|
||||
},
|
||||
"rd_contactus": {
|
||||
"description": "Opens the RetroDECK contact us section in your default browser",
|
||||
"name": "Contact us",
|
||||
"url": "https://github.com/XargonWan/RetroDECK",
|
||||
"description": "Opens the RetroDECK contact us section in your default browser"
|
||||
"url": "https://github.com/XargonWan/RetroDECK"
|
||||
},
|
||||
"rd_credits": {
|
||||
"description": "Opens the RetroDECK Credits in your default browser",
|
||||
"name": "Credits",
|
||||
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_credits/donations-licenses/"
|
||||
},
|
||||
"rd_donate": {
|
||||
"description": "Opens Donations page in your default browser",
|
||||
"name": "Donate",
|
||||
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_credits/donations-licenses/"
|
||||
},
|
||||
"rd_licenses": {
|
||||
"description": "Opens the RetroDECK licenses in your default browser",
|
||||
"name": "Licences",
|
||||
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_credits/donations-licenses/",
|
||||
"description": "Opens the RetroDECK licenses in your default browser"
|
||||
"url": "https://retrodeck.readthedocs.io/en/latest/wiki_credits/donations-licenses/"
|
||||
},
|
||||
"rd_web": {
|
||||
"description": "Opens the RetroDECK Website in your default browser",
|
||||
"name": "Website",
|
||||
"url": "https://retrodeck.net/"
|
||||
},
|
||||
"rd_wiki": {
|
||||
"description": "Opens the RetroDECK Wiki in your default browser",
|
||||
"name": "Wiki",
|
||||
"url": "https://retrodeck.readthedocs.io/en/latest/"
|
||||
}
|
||||
},
|
||||
"emulators": {
|
||||
"cemu": {
|
||||
"name": "Cemu",
|
||||
"description": "Wii U emulator",
|
||||
"name": "Cemu",
|
||||
"options": [
|
||||
{
|
||||
"resettable": true
|
||||
|
@ -57,8 +62,8 @@
|
|||
]
|
||||
},
|
||||
"citra": {
|
||||
"name": "Citra",
|
||||
"description": "N3DS emulator",
|
||||
"name": "Citra",
|
||||
"options": [
|
||||
{
|
||||
"resettable": true
|
||||
|
@ -76,8 +81,8 @@
|
|||
]
|
||||
},
|
||||
"dolphin": {
|
||||
"name": "Dolphin",
|
||||
"description": "Wii/GameCube emulator",
|
||||
"name": "Dolphin",
|
||||
"options": [
|
||||
{
|
||||
"resettable": true
|
||||
|
@ -95,8 +100,8 @@
|
|||
]
|
||||
},
|
||||
"duckstation": {
|
||||
"name": "Duckstation",
|
||||
"description": "PSX emulator",
|
||||
"name": "Duckstation",
|
||||
"options": [
|
||||
{
|
||||
"resettable": true
|
||||
|
@ -113,9 +118,26 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"example_emulator": {
|
||||
"description": "An example emulator.",
|
||||
"name": "Example Emulator",
|
||||
"options": [
|
||||
{
|
||||
"resettable": true
|
||||
}
|
||||
],
|
||||
"properties": [
|
||||
{
|
||||
"abxy_button": {
|
||||
"status": false
|
||||
},
|
||||
"standalone": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"gzdoom": {
|
||||
"name": "GZDoom",
|
||||
"description": "Doom engine",
|
||||
"name": "GZDoom",
|
||||
"options": [
|
||||
{
|
||||
"resettable": true
|
||||
|
@ -133,8 +155,8 @@
|
|||
]
|
||||
},
|
||||
"mame": {
|
||||
"name": "MAME",
|
||||
"description": "Multiple Arcade Machine Emulator",
|
||||
"name": "MAME",
|
||||
"options": [
|
||||
{
|
||||
"resettable": true
|
||||
|
@ -152,8 +174,8 @@
|
|||
]
|
||||
},
|
||||
"melonds": {
|
||||
"name": "MelonDS",
|
||||
"description": "NDS emulator",
|
||||
"name": "MelonDS",
|
||||
"options": [
|
||||
{
|
||||
"resettable": true
|
||||
|
@ -171,8 +193,8 @@
|
|||
]
|
||||
},
|
||||
"pcsx2": {
|
||||
"name": "PCSX2",
|
||||
"description": "PS2 emulator",
|
||||
"name": "PCSX2",
|
||||
"options": [
|
||||
{
|
||||
"resettable": true
|
||||
|
@ -190,8 +212,8 @@
|
|||
]
|
||||
},
|
||||
"ppsspp": {
|
||||
"name": "PPSSPP",
|
||||
"description": "PSP emulator",
|
||||
"name": "PPSSPP",
|
||||
"options": [
|
||||
{
|
||||
"resettable": true
|
||||
|
@ -209,8 +231,8 @@
|
|||
]
|
||||
},
|
||||
"primehack": {
|
||||
"name": "Primehack",
|
||||
"description": "Metroid Prime emulator",
|
||||
"name": "Primehack",
|
||||
"options": [
|
||||
{
|
||||
"resettable": true
|
||||
|
@ -228,8 +250,8 @@
|
|||
]
|
||||
},
|
||||
"rpcs3": {
|
||||
"name": "RPCS3",
|
||||
"description": "PS3 emulator",
|
||||
"name": "RPCS3",
|
||||
"options": [
|
||||
{
|
||||
"resettable": true
|
||||
|
@ -247,8 +269,8 @@
|
|||
]
|
||||
},
|
||||
"ryujinx": {
|
||||
"name": "Ryujinx",
|
||||
"description": "Switch emulator",
|
||||
"name": "Ryujinx",
|
||||
"options": [
|
||||
{
|
||||
"resettable": true
|
||||
|
@ -266,8 +288,8 @@
|
|||
]
|
||||
},
|
||||
"vita3k": {
|
||||
"name": "Vita3k",
|
||||
"description": "PS Vita emulator",
|
||||
"name": "Vita3k",
|
||||
"options": [
|
||||
{
|
||||
"resettable": true
|
||||
|
@ -285,8 +307,8 @@
|
|||
]
|
||||
},
|
||||
"xemu": {
|
||||
"name": "XEMU",
|
||||
"description": "XBOX emulator",
|
||||
"name": "XEMU",
|
||||
"options": [
|
||||
{
|
||||
"resettable": true
|
||||
|
@ -304,8 +326,8 @@
|
|||
]
|
||||
},
|
||||
"yuzu": {
|
||||
"name": "Yuzu",
|
||||
"description": "Switch emulator",
|
||||
"name": "Yuzu",
|
||||
"options": [
|
||||
{
|
||||
"resettable": true
|
||||
|
|
Binary file not shown.
|
@ -1,8 +0,0 @@
|
|||
ID,URL,Description
|
||||
rd_web,https://retrodeck.net/,Opens the RetroDECK Website in your default browser
|
||||
rd_changelog,https://retrodeck.readthedocs.io/en/latest/wiki_rd_versions/version-history/,Opens the RetroDECK change log in your default browser
|
||||
rd_wiki,https://retrodeck.readthedocs.io/en/latest/,Opens the RetroDECK Wiki in your default browser
|
||||
rd_credits,https://retrodeck.readthedocs.io/en/latest/,Opens the RetroDECK Credits in your default browser
|
||||
rd_donate,https://retrodeck.readthedocs.io/en/latest/wiki_credits/donations-licenses/,Opens Donations in your default browser
|
||||
rd_contactus,https://github.com/XargonWan/RetroDECK,Opens the RetroDECK contact us section in your default browser
|
||||
rd_licenses,https://retrodeck.readthedocs.io/en/latest/wiki_credits/donations-licenses/,Opens the RetroDECK licenses in your default browser
|
|
@ -15,16 +15,41 @@ var emu_pick_option: OptionButton
|
|||
var tab_container: TabContainer
|
||||
var anim_logo: AnimatedSprite2D
|
||||
var anim_rekku: AnimatedSprite2D
|
||||
#var data_handler: DataHandler
|
||||
|
||||
var player =[]
|
||||
|
||||
var app_data = AppData.new()
|
||||
func _ready():
|
||||
_get_nodes()
|
||||
_connect_signals()
|
||||
_play_main_animations()
|
||||
#print(save_manager.data)#["name"]["unlock_goal"])
|
||||
print(save_manager.data["about_links"]["rd_web"]["name"], " ", save_manager.data["about_links"]["rd_web"]["url"])
|
||||
print(save_manager.data["emulators"]["mame"]["name"], " ", save_manager.data["emulators"]["mame"]["description"])
|
||||
#print(save_manager.data["about_links"]["rd_web"]["name"], " ", save_manager.data["about_links"]["rd_web"]["url"])
|
||||
#print(save_manager.data["emulators"]["mame"]["name"], " ", save_manager.data["emulators"]["mame"]["description"])
|
||||
|
||||
# Populate app_data with some test data
|
||||
var link = Link.new()
|
||||
link.name = "Example Site"
|
||||
link.url = "https://example.com"
|
||||
link.description = "An example description."
|
||||
app_data.about_links["example_site"] = link
|
||||
|
||||
var emulator = Emulator.new()
|
||||
emulator.name = "Example Emulator"
|
||||
emulator.description = "An example emulator."
|
||||
var option = EmulatorOption.new()
|
||||
option.resettable = true
|
||||
emulator.options.append(option)
|
||||
var property = EmulatorProperty.new()
|
||||
property.standalone = true
|
||||
property.abxy_button_status = false
|
||||
emulator.properties.append(property)
|
||||
app_data.emulators["example_emulator"] = emulator
|
||||
|
||||
data_handler.save_data(app_data)
|
||||
|
||||
var app_data = data_handler.load_data()
|
||||
if app_data:
|
||||
var website_link = app_data.about_links["rd_web"]
|
||||
print (website_link.name,"-",website_link.url,"-",website_link.description)
|
||||
|
||||
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)
|
||||
|
|
|
@ -21,6 +21,7 @@ config/icon="res://icon.svg"
|
|||
|
||||
class_functions="*res://scripts/class_functions.gd"
|
||||
save_manager="*res://scripts/save_manager.gd"
|
||||
data_handler="*res://scripts/data_handler.gd"
|
||||
|
||||
[display]
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2,7 +2,7 @@ extends Node
|
|||
|
||||
class_name DataHandler
|
||||
|
||||
var data_file_path = "res://data.json"
|
||||
var data_file_path = "res://data_list.json"
|
||||
var app_data: AppData
|
||||
|
||||
func _ready():
|
||||
|
@ -14,11 +14,11 @@ func load_data() -> AppData:
|
|||
if file:
|
||||
var json_data = file.get_as_text()
|
||||
file.close()
|
||||
|
||||
var json = JSON.new()
|
||||
var parsed_data = json.parse(json_data)
|
||||
if parsed_data.error == OK:
|
||||
var data_dict = parsed_data.result
|
||||
var parsed_data = json.parse_string(json_data)
|
||||
#if parsed_data.error == OK:
|
||||
if parsed_data:
|
||||
var data_dict = parsed_data
|
||||
|
||||
var about_links = {}
|
||||
for key in data_dict["about_links"].keys():
|
||||
|
@ -36,16 +36,17 @@ func load_data() -> AppData:
|
|||
emulator.name = emulator_data["name"]
|
||||
emulator.description = emulator_data["description"]
|
||||
|
||||
emulator.options = []
|
||||
#emulator.options = []
|
||||
#emulator.properties = []
|
||||
for option_data in emulator_data["options"]:
|
||||
var option = EmulatorOption.new()
|
||||
option.resettable = option_data["resettable"]
|
||||
emulator.options.append(option)
|
||||
|
||||
emulator.properties = []
|
||||
|
||||
for property_data in emulator_data["properties"]:
|
||||
var property = EmulatorProperty.new()
|
||||
property.standalone = property_data["standalone"]
|
||||
property.standalone = property_data.get("standalone", false)
|
||||
property.abxy_button_status = property_data.get("abxy_button", {}).get("status", false)
|
||||
emulator.properties.append(property)
|
||||
|
||||
|
@ -63,10 +64,16 @@ func load_data() -> AppData:
|
|||
return null
|
||||
|
||||
func save_data(app_data: AppData):
|
||||
var file = FileAccess.open(data_file_path, FileAccess.WRITE)
|
||||
var file = FileAccess.open(data_file_path, FileAccess.READ)
|
||||
var existing_data = {}
|
||||
if file:
|
||||
var data_dict = {}
|
||||
|
||||
var json = JSON.new()
|
||||
var error = json.parse(file.get_as_text())
|
||||
if error == OK:
|
||||
existing_data = json.get_data()
|
||||
file.close()
|
||||
else:
|
||||
print("File not found. Creating a new one.")
|
||||
var about_links = {}
|
||||
for key in app_data.about_links.keys():
|
||||
var link = app_data.about_links[key]
|
||||
|
@ -76,6 +83,18 @@ func save_data(app_data: AppData):
|
|||
"description": link.description
|
||||
}
|
||||
|
||||
var new_data_dict = {}
|
||||
# Convert about_links to a dictionary
|
||||
var about_links = {}
|
||||
for key in app_data.about_links.keys():
|
||||
var link = app_data.about_links[key]
|
||||
about_links[key] = {
|
||||
"name": link.name,
|
||||
"url": link.url,
|
||||
"description": link.description
|
||||
}
|
||||
|
||||
# Convert emulators to a dictionary
|
||||
var emulators = {}
|
||||
for key in app_data.emulators.keys():
|
||||
var emulator = app_data.emulators[key]
|
||||
|
@ -99,10 +118,26 @@ func save_data(app_data: AppData):
|
|||
"properties": properties
|
||||
}
|
||||
|
||||
data_dict["about_links"] = about_links
|
||||
data_dict["emulators"] = emulators
|
||||
new_data_dict["about_links"] = about_links
|
||||
new_data_dict["emulators"] = emulators
|
||||
|
||||
var json = JSON.new()
|
||||
var json_text = json.print(data_dict)
|
||||
# Merge existing data with new data
|
||||
for key in new_data_dict.keys():
|
||||
if existing_data.has(key):
|
||||
var existing_dict = existing_data[key]
|
||||
var new_dict = new_data_dict[key]
|
||||
|
||||
# Merge dictionaries
|
||||
for sub_key in new_dict.keys():
|
||||
existing_dict[sub_key] = new_dict[sub_key]
|
||||
else:
|
||||
existing_data[key] = new_data_dict[key]
|
||||
|
||||
# Serialize the combined data to JSON
|
||||
var json_text = JSON.new().stringify(existing_data, "\t")
|
||||
|
||||
# Open the file in append mode and write the new JSON data
|
||||
file = FileAccess.open(data_file_path, FileAccess.WRITE)
|
||||
file.store_string(json_text)
|
||||
file.close()
|
||||
print("Data appended successfully")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
extends Resource
|
||||
|
||||
class_name EmulatorProperty
|
||||
|
||||
@export var standalone: bool
|
||||
@export var abxy_button_status: bool = false
|
||||
@export var abxy_button_status: bool
|
||||
|
|
|
@ -16,7 +16,7 @@ func _ready():
|
|||
#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")
|
||||
tk_about = class_functions.import_csv_data("res://tk_about.txt")
|
||||
_get_nodes()
|
||||
_connect_signals()
|
||||
|
||||
|
|
Loading…
Reference in a new issue