2024-12-13 03:19:48 +00:00
|
|
|
extends Node
|
2024-12-10 12:59:49 +00:00
|
|
|
|
2024-12-13 03:19:48 +00:00
|
|
|
@onready var loader = preload("res://scripts/libretro_loader.gd").new()
|
2024-12-10 12:59:49 +00:00
|
|
|
|
|
|
|
func _ready():
|
2024-12-13 03:19:48 +00:00
|
|
|
var core_path = "res://cores/genesis_plus_gx_libretro.so" # Replace with your actual core path
|
|
|
|
var rom_path = "res://roms/megadrive/Sonic the Hedgehog.bin" # Replace with your actual ROM path
|
|
|
|
|
|
|
|
print("Core path: ", core_path)
|
|
|
|
print("ROM path: ", rom_path)
|
2024-12-11 07:29:31 +00:00
|
|
|
|
2024-12-13 03:19:48 +00:00
|
|
|
var success = await loader.start_emulation(core_path, rom_path) # Use await to call the coroutine
|
|
|
|
if success:
|
|
|
|
print("Game started successfully.")
|
|
|
|
start_emulation_loop()
|
|
|
|
else:
|
|
|
|
print("Failed to start the game.")
|
2024-12-11 07:29:31 +00:00
|
|
|
|
2024-12-13 03:19:48 +00:00
|
|
|
func start_emulation_loop():
|
|
|
|
"""
|
|
|
|
Continuously runs the emulation in the `_process` callback.
|
|
|
|
"""
|
|
|
|
set_process(true)
|
2024-12-11 07:29:31 +00:00
|
|
|
|
2024-12-13 03:19:48 +00:00
|
|
|
func _process(delta):
|
|
|
|
loader._process(delta) # Delegate the frame updates to the loader
|