-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Godot player basic save/load and colourizing
- Loading branch information
Showing
19 changed files
with
591 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Godot; | ||
using System; | ||
using System.Linq; | ||
using System.Collections.Generic; | ||
using Qkmaxware.Emulators.Gameboy.Hardware; | ||
|
||
namespace Qkmaxware.Emulators.Gameboy.Player; | ||
public partial class CartInfoDebug : Control { | ||
|
||
[Export] public TextureRenderer Player; | ||
|
||
private RichTextLabel text; | ||
|
||
// Called when the node enters the scene tree for the first time. | ||
public override void _Ready() { | ||
text = this.GetNode<RichTextLabel>("ScrollContainer/MarginContainer/RichTextLabel"); | ||
} | ||
|
||
public void Refresh() { | ||
var str = string.Empty; | ||
|
||
if (Player?.Console?.GetCartridge() is Cartridge cart) { | ||
str = cart.Info.ToString(); | ||
} | ||
|
||
this.text.Text = str; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
[gd_scene load_steps=3 format=3 uid="uid://t7khq15qfjuw"] | ||
|
||
[ext_resource type="Texture2D" uid="uid://divrqb47wvwvt" path="res://reload.png" id="1_0a8i2"] | ||
[ext_resource type="Script" path="res://Debuggers/CartInfoDebug.cs" id="1_m4mxx"] | ||
|
||
[node name="Cartridge Info" type="Control"] | ||
layout_mode = 3 | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
script = ExtResource("1_m4mxx") | ||
|
||
[node name="ScrollContainer" type="ScrollContainer" parent="."] | ||
layout_mode = 1 | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
offset_top = 44.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
|
||
[node name="MarginContainer" type="MarginContainer" parent="ScrollContainer"] | ||
layout_mode = 2 | ||
size_flags_horizontal = 3 | ||
theme_override_constants/margin_left = 10 | ||
theme_override_constants/margin_top = 10 | ||
theme_override_constants/margin_right = 10 | ||
theme_override_constants/margin_bottom = 10 | ||
|
||
[node name="RichTextLabel" type="RichTextLabel" parent="ScrollContainer/MarginContainer"] | ||
layout_mode = 2 | ||
size_flags_horizontal = 3 | ||
fit_content = true | ||
|
||
[node name="Reload" type="Button" parent="."] | ||
layout_mode = 1 | ||
anchors_preset = 1 | ||
anchor_left = 1.0 | ||
anchor_right = 1.0 | ||
offset_left = -95.0 | ||
offset_bottom = 31.0 | ||
grow_horizontal = 0 | ||
text = "Reload" | ||
icon = ExtResource("1_0a8i2") | ||
expand_icon = true | ||
|
||
[connection signal="pressed" from="Reload" to="." method="Refresh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
[gd_scene load_steps=2 format=3 uid="uid://c2fsn6ee6p522"] | ||
|
||
[ext_resource type="Script" path="res://Debuggers/DisassemblerRow.cs" id="1_1mo4q"] | ||
|
||
[node name="Row" type="HBoxContainer"] | ||
anchors_preset = 10 | ||
anchor_right = 1.0 | ||
offset_bottom = 31.0 | ||
grow_horizontal = 2 | ||
size_flags_horizontal = 3 | ||
script = ExtResource("1_1mo4q") | ||
|
||
[node name="Address" type="HBoxContainer" parent="."] | ||
layout_mode = 2 | ||
size_flags_horizontal = 3 | ||
|
||
[node name="Decimal" type="Button" parent="Address"] | ||
layout_mode = 2 | ||
text = "x10" | ||
|
||
[node name="Hex" type="Button" parent="Address"] | ||
layout_mode = 2 | ||
text = "x16" | ||
|
||
[node name="Label" type="Label" parent="Address"] | ||
layout_mode = 2 | ||
text = "0x900" | ||
|
||
[node name="Instruction" type="HBoxContainer" parent="."] | ||
layout_mode = 2 | ||
size_flags_horizontal = 3 | ||
|
||
[node name="Decimal" type="Button" parent="Instruction"] | ||
layout_mode = 2 | ||
text = "x10" | ||
|
||
[node name="Hex" type="Button" parent="Instruction"] | ||
layout_mode = 2 | ||
text = "x16" | ||
|
||
[node name="Name" type="Button" parent="Instruction"] | ||
layout_mode = 2 | ||
text = "Inst" | ||
|
||
[node name="Label" type="Label" parent="Instruction"] | ||
layout_mode = 2 | ||
text = "Jump" | ||
|
||
[node name="Args" type="HBoxContainer" parent="."] | ||
layout_mode = 2 | ||
size_flags_horizontal = 3 | ||
|
||
[node name="Decimal" type="Button" parent="Args"] | ||
layout_mode = 2 | ||
text = "x10" | ||
|
||
[node name="Hex" type="Button" parent="Args"] | ||
layout_mode = 2 | ||
text = "x16" | ||
|
||
[node name="Label" type="Label" parent="Args"] | ||
layout_mode = 2 | ||
text = "120" | ||
|
||
[connection signal="pressed" from="Address/Decimal" to="." method="AddressModeDecimal"] | ||
[connection signal="pressed" from="Address/Hex" to="." method="AddressModeHex"] | ||
[connection signal="pressed" from="Instruction/Decimal" to="." method="InstructionModeDecimal"] | ||
[connection signal="pressed" from="Instruction/Hex" to="." method="InstructionModeHex"] | ||
[connection signal="pressed" from="Instruction/Name" to="." method="InstructionModeName"] | ||
[connection signal="pressed" from="Args/Decimal" to="." method="ArgModeDecimal"] | ||
[connection signal="pressed" from="Args/Hex" to="." method="ArgModeHex"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using Godot; | ||
using System; | ||
using System.Linq; | ||
using Qkmaxware.Emulators.Gameboy.Hardware; | ||
using Qkmaxware.Vm.LR35902; | ||
|
||
namespace Qkmaxware.Emulators.Gameboy.Player; | ||
|
||
public partial class DisassemblerRow : HBoxContainer { | ||
|
||
private InstructionInfo info; | ||
|
||
private Label addressLabel; | ||
private Label instructionLabel; | ||
private Label argsLabel; | ||
|
||
const string EmptyArgument = "--"; | ||
|
||
// Called when the node enters the scene tree for the first time. | ||
public override void _Ready() { | ||
this.addressLabel = GetNode<Label>("Address/Label"); | ||
this.instructionLabel = GetNode<Label>("Instruction/Label"); | ||
this.argsLabel = GetNode<Label>("Args/Label"); | ||
} | ||
|
||
public void SetInfo(InstructionInfo info) { | ||
this.info = info; | ||
|
||
AddressModeHex(); | ||
InstructionModeName(); | ||
ArgModeDecimal(); | ||
} | ||
|
||
public void AddressModeDecimal() { | ||
this.addressLabel.Text = info.Address.ToString(); | ||
} | ||
public void AddressModeHex() { | ||
this.addressLabel.Text = "0x" + info.Address.ToString("X4"); | ||
} | ||
|
||
public void InstructionModeDecimal() { | ||
this.instructionLabel.Text = info.Opcode.ToString(); | ||
} | ||
public void InstructionModeHex() { | ||
this.instructionLabel.Text = "0x" + info.Opcode.ToString("X2"); | ||
} | ||
public void InstructionModeName() { | ||
this.instructionLabel.Text = info.Operation?.Name ?? info.Opcode.ToString(); | ||
} | ||
|
||
public void ArgModeDecimal() { | ||
if (info.Arguments is null || info.Arguments.Length == 0) { | ||
this.argsLabel.Text = EmptyArgument; | ||
return; | ||
} | ||
this.argsLabel.Text = string.Join(' ', info.Arguments.Select(x => x.ToString())); | ||
} | ||
public void ArgModeHex() { | ||
if (info.Arguments is null || info.Arguments.Length == 0) { | ||
this.argsLabel.Text = EmptyArgument; | ||
return; | ||
} | ||
this.argsLabel.Text = string.Join(' ', info.Arguments.Select(x => "0x" + x.ToString("X2"))); | ||
} | ||
} |
Oops, something went wrong.