Merge branch 'feat/godot' into cooker

This commit is contained in:
Rekku 2024-08-19 12:49:14 +01:00
commit 53e30fcfbc
7 changed files with 203 additions and 163 deletions

View file

@ -1,3 +1,6 @@
#todo
# add cores as class/ Like eumlator but one level lower
extends Control
var bios_type:int
@ -24,25 +27,33 @@ var a_button_texture_alt: Texture2D = load("res://assets/icons/kenney_input-prom
var b_button_texture: Texture2D = load("res://assets/icons/kenney_input-prompts-pixel-16/Tiles/tile_0043.png")
var b_button_texture_alt: Texture2D = load("res://assets/icons/kenney_input-prompts-pixel-16/Tiles/tile_0048.png")
var app_data = AppData.new()
var app_data := AppData.new()
func _ready():
_get_nodes()
_connect_signals()
_play_main_animations()
%locale_option.selected = class_functions.map_locale_id(OS.get_locale_language())
"""
# Load json data. Test to show some data
app_data = data_handler.load_base_data()
app_data = data_handler.app_data
if app_data:
var website_data = app_data.about_links["rd_web"]
print (website_data.name,"-",website_data.url,"-",website_data.description)
print (app_data.about_links["rd_web"]["url"])
var console: bool = false
var test = class_functions.execute_command("cat",["/var/config/retrodeck/retrodeck.cfg"],console)
print (test)
"""
var website_data: Link = app_data.about_links["rd_web"]
print (website_data.name,"-",website_data.url,"-",website_data.description,"-",website_data.url)
#print (app_data.about_links["rd_web"]["name"])
for key in app_data.emulators.keys():
var emulator = app_data.emulators[key]
# Display the properties of each emulator
print("Emulator Name: ", emulator.name)
print("Description: ", emulator.description)
print("Properties:")
# Iterate over properties and show each one
for property: EmulatorProperty in emulator.properties:
print("Cheevos: ", property.cheevos)
print("ABXY_button:", property.abxy_button)
print("multi_user_config_dir: ", property.multi_user_config_dir)
else:
print ("No emulators")
var config_file_path = "/var/config/retrodeck/retrodeck.cfg"
var json_file_path = "/var/config/retrodeck/retrodeck.json"
var config = data_handler.parse_config_to_json(config_file_path)
@ -68,23 +79,7 @@ func _ready():
n.self_modulate.a = 0.5 #make it half transparent
combine_tkeys()
func _process(delta):
if Input.is_action_pressed("quit1") and Input.is_action_pressed("quit2"):
get_tree().quit()
if Input.is_action_pressed("next_tab"):
%r1_button.texture_normal = %r1_button.texture_pressed
elif Input.is_action_pressed("previous_tab"):
%l1_button.texture_normal = %l1_button.texture_pressed
elif Input.is_action_pressed("back_button"):
%b_button.texture_normal = %b_button.texture_pressed
elif Input.is_action_pressed("action_button"):
%a_button.texture_normal = %a_button.texture_pressed
else:
%r1_button.texture_normal = r1_button_texture
%l1_button.texture_normal = l1_button_texture
%a_button.texture_normal = a_button_texture
%b_button.texture_normal = b_button_texture
func _get_nodes() -> void:
status_code_label = get_node("%status_code_label")
theme_option = get_node("%theme_optionbutton")
@ -128,6 +123,22 @@ func _conf_theme(index: int) -> void:
_play_main_animations()
func _input(event):
if Input.is_action_pressed("quit1") and Input.is_action_pressed("quit2"):
get_tree().quit()
if Input.is_action_pressed("next_tab"):
%r1_button.texture_normal = %r1_button.texture_pressed
elif Input.is_action_pressed("previous_tab"):
%l1_button.texture_normal = %l1_button.texture_pressed
elif Input.is_action_pressed("back_button"):
%b_button.texture_normal = %b_button.texture_pressed
elif Input.is_action_pressed("action_button"):
%a_button.texture_normal = %a_button.texture_pressed
else:
%r1_button.texture_normal = r1_button_texture
%l1_button.texture_normal = l1_button_texture
%a_button.texture_normal = a_button_texture
%b_button.texture_normal = b_button_texture
if event.is_action_pressed("quit"):
_exit()

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=58 format=3 uid="uid://61f6m4r1mpan"]
[gd_scene load_steps=59 format=3 uid="uid://61f6m4r1mpan"]
[ext_resource type="Texture2D" uid="uid://bv6vh33cnfaw4" path="res://icon.svg" id="1_axfei"]
[ext_resource type="Script" path="res://main.gd" id="1_obpq7"]
@ -38,6 +38,7 @@
[ext_resource type="Texture2D" uid="uid://cbwhpqip43aei" path="res://res/flags/china_32.png" id="11_ri2fv"]
[ext_resource type="Texture2D" uid="uid://cqq2qlcr5djsw" path="res://assets/icons/Icon Pack/PS1.png" id="11_v45kn"]
[ext_resource type="Texture2D" uid="uid://b164ihk8riiwh" path="res://assets/graphics/space_bground.png" id="15_qdvxo"]
[ext_resource type="Texture2D" uid="uid://ble152m6361l8" path="res://assets/icons/pixelitos/128/internet-web-browser.png" id="21_1vm5n"]
[ext_resource type="Texture2D" uid="uid://dyumvh0ixwrbl" path="res://assets/icons/kenney_input-prompts-pixel-16/Tiles/tile_0042.png" id="30_glnve"]
[ext_resource type="Texture2D" uid="uid://cn11vcrybtor4" path="res://assets/icons/kenney_input-prompts-pixel-16/Tiles/tile_0047.png" id="31_j5ri1"]
[ext_resource type="Texture2D" uid="uid://cor8ep0fkqm08" path="res://res/Rekku/base.png" id="32_omdu2"]
@ -166,9 +167,11 @@ grow_vertical = 2
unique_name_in_owner = true
layout_mode = 2
tab_alignment = 1
current_tab = 7
script = ExtResource("3_id6l4")
[node name="TK_GRAPHICS" type="MarginContainer" parent="Background/MarginContainer/TabContainer"]
visible = false
layout_mode = 2
[node name="ScrollContainer" type="ScrollContainer" parent="Background/MarginContainer/TabContainer/TK_GRAPHICS"]
@ -196,6 +199,7 @@ layout_mode = 2
columns = 2
[node name="borders_adv_button" type="Button" parent="Background/MarginContainer/TabContainer/TK_GRAPHICS/ScrollContainer/VBoxContainer/decorations_container/GridContainer"]
visible = false
layout_mode = 2
disabled = true
text = "TK_ADVANCED"
@ -225,9 +229,8 @@ text = "TK_ADVANCED"
[node name="borders" type="CheckButton" parent="Background/MarginContainer/TabContainer/TK_GRAPHICS/ScrollContainer/VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
button_pressed = true
text = "TK_BORDERS"
icon = ExtResource("4_xcuib")
[node name="GridContainer" type="GridContainer" parent="Background/MarginContainer/TabContainer/TK_GRAPHICS/ScrollContainer/VBoxContainer"]
layout_mode = 2
@ -240,7 +243,6 @@ theme_override_colors/font_color = Color(0, 0.917647, 0, 1)
theme_override_colors/font_pressed_color = Color(0.913725, 0, 0, 1)
theme_override_colors/icon_normal_color = Color(0, 0.858824, 0, 1)
theme_override_colors/icon_pressed_color = Color(0.866667, 0, 0, 1)
theme_override_colors/icon_hover_color = Color(0.00392157, 0, 0, 1)
toggle_mode = true
text = "Nintendo
Gameboy
@ -1015,7 +1017,6 @@ popup/item_4/text = "OpenDyslexic3"
popup/item_4/id = 4
[node name="TK_ABOUT" type="MarginContainer" parent="Background/MarginContainer/TabContainer"]
visible = false
layout_mode = 2
script = ExtResource("4_m4rto")
@ -1035,59 +1036,17 @@ theme_override_font_sizes/normal_font_size = 23
text = "TK_ABOUTHEADER"
scroll_active = false
[node name="website_button" type="Button" parent="Background/MarginContainer/TabContainer/TK_ABOUT/ScrollContainer/about_container"]
unique_name_in_owner = true
layout_mode = 2
text = "TK_WEBSITE"
[node name="changelog_button" type="Button" parent="Background/MarginContainer/TabContainer/TK_ABOUT/ScrollContainer/about_container"]
unique_name_in_owner = true
layout_mode = 2
text = "TK_CHANGELOG"
[node name="wiki_button" type="Button" parent="Background/MarginContainer/TabContainer/TK_ABOUT/ScrollContainer/about_container"]
unique_name_in_owner = true
layout_mode = 2
text = "TK_WIKI"
[node name="credits_button" type="Button" parent="Background/MarginContainer/TabContainer/TK_ABOUT/ScrollContainer/about_container"]
unique_name_in_owner = true
layout_mode = 2
text = "TK_CREDITS"
[node name="donate_button" type="Button" parent="Background/MarginContainer/TabContainer/TK_ABOUT/ScrollContainer/about_container"]
unique_name_in_owner = true
layout_mode = 2
text = "TK_DONATE"
[node name="contactus_button" type="Button" parent="Background/MarginContainer/TabContainer/TK_ABOUT/ScrollContainer/about_container"]
unique_name_in_owner = true
layout_mode = 2
text = "TK_CONTACTUS"
[node name="licenses_button" type="Button" parent="Background/MarginContainer/TabContainer/TK_ABOUT/ScrollContainer/about_container"]
unique_name_in_owner = true
layout_mode = 2
text = "TK_LICENSES"
[node name="ScrollContainer2" type="ScrollContainer" parent="Background/MarginContainer/TabContainer/TK_ABOUT"]
custom_minimum_size = Vector2(300, 200)
layout_mode = 2
size_flags_horizontal = 4
follow_focus = true
horizontal_scroll_mode = 0
vertical_scroll_mode = 0
[node name="rd_title" type="RichTextLabel" parent="Background/MarginContainer/TabContainer/TK_ABOUT/ScrollContainer2"]
[node name="rd_title" type="RichTextLabel" parent="Background/MarginContainer/TabContainer/TK_ABOUT/ScrollContainer/about_container"]
unique_name_in_owner = true
clip_contents = false
custom_minimum_size = Vector2(300, 300)
custom_minimum_size = Vector2(300, 150)
layout_mode = 2
text = "RetroDECK"
scroll_active = false
autowrap_mode = 2
tab_size = 2
[node name="logo" type="TextureRect" parent="Background/MarginContainer/TabContainer/TK_ABOUT/ScrollContainer2/rd_title"]
[node name="logo" type="TextureRect" parent="Background/MarginContainer/TabContainer/TK_ABOUT/ScrollContainer/about_container/rd_title"]
custom_minimum_size = Vector2(128, 128)
layout_mode = 2
offset_left = 166.0
@ -1100,6 +1059,60 @@ texture = ExtResource("1_axfei")
expand_mode = 1
stretch_mode = 4
[node name="GridContainer" type="GridContainer" parent="Background/MarginContainer/TabContainer/TK_ABOUT/ScrollContainer/about_container"]
unique_name_in_owner = true
layout_mode = 2
columns = 3
[node name="website_button" type="Button" parent="Background/MarginContainer/TabContainer/TK_ABOUT/ScrollContainer/about_container/GridContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
text = "TK_WEBSITE"
icon = ExtResource("21_1vm5n")
[node name="changelog_button" type="Button" parent="Background/MarginContainer/TabContainer/TK_ABOUT/ScrollContainer/about_container/GridContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
text = "TK_CHANGELOG"
icon = ExtResource("21_1vm5n")
[node name="wiki_button" type="Button" parent="Background/MarginContainer/TabContainer/TK_ABOUT/ScrollContainer/about_container/GridContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
text = "TK_WIKI"
icon = ExtResource("21_1vm5n")
[node name="credits_button" type="Button" parent="Background/MarginContainer/TabContainer/TK_ABOUT/ScrollContainer/about_container/GridContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
text = "TK_CREDITS"
icon = ExtResource("21_1vm5n")
[node name="donate_button" type="Button" parent="Background/MarginContainer/TabContainer/TK_ABOUT/ScrollContainer/about_container/GridContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
text = "TK_DONATE"
icon = ExtResource("21_1vm5n")
[node name="contactus_button" type="Button" parent="Background/MarginContainer/TabContainer/TK_ABOUT/ScrollContainer/about_container/GridContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
text = "TK_CONTACTUS"
icon = ExtResource("21_1vm5n")
[node name="licenses_button" type="Button" parent="Background/MarginContainer/TabContainer/TK_ABOUT/ScrollContainer/about_container/GridContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
text = "TK_LICENSES"
icon = ExtResource("21_1vm5n")
[node name="side_logo" type="Control" parent="Background"]
layout_mode = 1
anchors_preset = 6

View file

@ -22,6 +22,10 @@ config/icon="res://icon.svg"
class_functions="*res://scripts/class_functions.gd"
data_handler="*res://scripts/data_handler.gd"
AppDataD="res://scripts/app_data.gd"
Emulators="res://scripts/emulator.gd"
EmulatorProperties="res://scripts/emulator_property.gd"
Links="res://scripts/link.gd"
[display]

File diff suppressed because one or more lines are too long

View file

@ -34,21 +34,25 @@ func load_base_data() -> AppData:
var emulator = Emulator.new()
emulator.name = emulator_data["name"]
emulator.description = emulator_data["description"]
print (emulator.name)
if emulator_data.has("properties"):
for property_data in emulator_data["properties"]:
print (emulator,"----",property_data)
var property = EmulatorProperty.new()
property.standalone = property_data.get("standalone", false)
#todo fix error
# property.abxy_button_status = property_data.get("abxy_button", {}).get("status", false)
if property_data.has("cheevos"):
property.cheevos = property_data.get("cheevos",true)
if property_data.has("cheevos_hardcore"):
property.cheevos_hardcore = property_data.get("cheevos_hardcore",true)
if property_data.has("abxy_button"):
property.abxy_button = property_data.get("abxy_button",true)
if property_data.has("multi_user_config_dir"):
property.multi_user_config_dir = property_data.get("multi_user_config_dir",true)
emulator.properties.append(property)
emulators[key] = emulator
var this_app_data = AppData.new()
this_app_data.about_links = about_links
this_app_data.emulators = emulators
return this_app_data
var app_data = AppData.new()
app_data.about_links = about_links
app_data.emulators = emulators
return app_data
else:
print("Error parsing JSON")
else:
@ -93,7 +97,7 @@ func save_base_data(app_data: AppData):
var properties = []
for property in emulator.properties:
properties.append({
"standalone": property.standalone,
#"standalone": property.standalone,
"abxy_button": {"status": property.abxy_button_status}
})
@ -153,8 +157,11 @@ func modify_emulator(key: String, new_name: String, new_description: String, new
emulator.properties.clear()
for property in new_properties:
var new_property = EmulatorProperty.new()
new_property.standalone = property.standalone
new_property.borders = property.borders
new_property.abxy_button_status = property.abxy_button_status
new_property.ask_to_exit = property.ask_to_exit
new_property.cheevos = property.cheevos
emulator.properties.append(new_property)
app_data.emulators[key] = emulator
@ -176,7 +183,7 @@ func add_emulator() -> void:
emulator.name = "Example Emulator"
emulator.description = "An example emulator."
var property = EmulatorProperty.new()
property.standalone = true
#property.standalone = true
property.abxy_button_status = false
emulator.properties.append(property)
app_data.emulators["example_emulator"] = emulator
@ -188,7 +195,7 @@ func modify_emulator_test() -> void:
var new_properties = []
var new_property = EmulatorProperty.new()
new_property.standalone = false
#new_property.standalone = false
new_property.abxy_button_status = true
new_properties.append(new_property)

View file

@ -1,5 +1,10 @@
extends Resource
class_name EmulatorProperty
@export var standalone: bool
@export var abxy_button_status: bool
@export var borders: bool
@export var abxy_button: bool
@export var cheevos: bool
@export var cheevos_hardcore: bool
@export var ask_to_exit: bool
@export var multi_user_config_dir: String
@export var universal_dyn_input: bool

View file

@ -1,33 +1,36 @@
extends MarginContainer
#var class_functions: ClassFunctions
var website_button: Button
var changelog_button: Button
var rd_web_button := Button.new()
var rd_changelog_button := Button.new()
var wiki_button: Button
var credits_button: Button
var donate_button: Button
var contactus_button: Button
var licenses_button: Button
var app_data = AppData.new()
var app_data := AppData.new()
var bArray :Array = [rd_web_button,rd_changelog_button]
func _ready():
#tk_about = class_functions.import_csv_data("res://tk_about.txt")
app_data = data_handler.load_base_data()
app_data = data_handler.app_data
_get_nodes()
_connect_signals()
for but in bArray:
%GridContainer.add_child(but)
for id in app_data.about_links:
var web_data = app_data.about_links[id]
var web_data: Link = app_data.about_links[id]
match id:
"rd_web":
%website_button.text = web_data.name
%website_button.tooltip_text = web_data.description
%website_button.editor_description = web_data.url
rd_web_button.text = web_data.name
rd_web_button.tooltip_text = web_data.description
rd_web_button.icon = ResourceLoader.load("res://assets/icons/pixelitos/128/internet-web-browser.png")
rd_web_button.editor_description = web_data.url
"rd_changelog":
%changelog_button.text = web_data.name
%changelog_button.tooltip_text = web_data.description
%changelog_button.editor_description = web_data.url
rd_changelog_button.text = web_data.name
rd_changelog_button.tooltip_text = web_data.description
rd_changelog_button.icon = ResourceLoader.load("res://assets/icons/pixelitos/128/internet-web-browser.png")
rd_changelog_button.editor_description = web_data.url
"rd_wiki":
%wiki_button.text = web_data.name
%wiki_button.tooltip_text = web_data.description
@ -50,18 +53,15 @@ func _ready():
%licenses_button.editor_description = web_data.url
func _get_nodes() -> void:
website_button = get_node("%website_button")
changelog_button = get_node("%changelog_button")
wiki_button = get_node("%wiki_button")
credits_button = get_node("%credits_button")
donate_button = get_node("%donate_button")
contactus_button = get_node("%contactus_button")
licenses_button = get_node("%licenses_button")
func _connect_signals() -> void:
website_button.pressed.connect(_about_button_pressed.bind("rd_web"))
changelog_button.pressed.connect(_about_button_pressed.bind("rd_changelog"))
rd_web_button.pressed.connect(_about_button_pressed.bind("rd_web"))
rd_changelog_button.pressed.connect(_about_button_pressed.bind("rd_changelog"))
wiki_button.pressed.connect(_about_button_pressed.bind("rd_wiki"))
credits_button.pressed.connect(_about_button_pressed.bind("rd_credits"))
donate_button.pressed.connect(_about_button_pressed.bind("rd_donate"))
@ -71,9 +71,9 @@ func _connect_signals() -> void:
func _about_button_pressed(id: String) -> void:
match id:
"rd_web":
OS.shell_open(%website_button.editor_description)
OS.shell_open(rd_web_button.editor_description)
"rd_changelog":
OS.shell_open(%changelog_button.editor_description)
OS.shell_open(rd_changelog_button.editor_description)
"rd_wiki":
OS.shell_open(%wiki_button.editor_description)
"rd_credits":