Checkpoint

This commit is contained in:
XargonWan 2024-12-18 15:48:50 +09:00
parent de0e5f357d
commit f20ff575b0
5 changed files with 33 additions and 17 deletions

Binary file not shown.

View file

@ -2,8 +2,9 @@
git clone https://github.com/gabrielmedici/gdlibretro
cd gdlibretro
git submodule update --init --recursive
cmake -DNO_GIT_REVISION=ON -DCMAKE_BUILD_TYPE=Debug -DLINUX=true -DCMAKE_CXX_FLAGS="-DLINUX" .
cmake --build .
cd -
mv -fv "gdlibretro/LibRetroHost/lib/Linux-x86_64/libLibRetroHost-d.so" "addons"
git submodule update --init --recursive && \
cmake -DNO_GIT_REVISION=ON -DCMAKE_BUILD_TYPE=Debug -DLINUX=true -DCMAKE_CXX_FLAGS="-DLINUX" . && \
cmake --build . && \
cd - && \
mv -fv "gdlibretro/LibRetroHost/lib/Linux-x86_64/libLibRetroHost-d.so" "addons" && \
rm -rf "gdlibretro/LibRetroHost"

View file

@ -4,8 +4,15 @@ extends Node
func _ready():
var core_path = "res://cores/genesis_plus_gx_libretro.so" # Replace with your actual core path
if not FileAccess.file_exists(core_path):
push_error("Core not found at: " + core_path)
return false
var rom_path = "res://roms/megadrive/Sonic the Hedgehog.bin" # Replace with your actual ROM path
if not FileAccess.file_exists(rom_path):
push_error("Rom not found at: " + rom_path)
return false
print("Core path: ", core_path)
print("ROM path: ", rom_path)

View file

@ -37,4 +37,6 @@ renderer/rendering_method.mobile="gl_compatibility"
[xr]
openxr/enabled=true
openxr/foveation_level=3
openxr/foveation_dynamic=true
shaders/enabled=true

View file

@ -9,8 +9,12 @@ var current_rom : String = "" # Initialize to an empty string
func start_emulation(core_path: String, rom_path: String) -> bool:
print("Starting emulation with core: ", core_path, ", ROM: ", rom_path)
if not core_path or not rom_path:
push_error("Core path or ROM path is missing.")
if not core_path:
push_error("Core path is missing.")
return false
if not rom_path:
push_error("ROM path is missing.")
return false
# Load the core (emulator)
@ -47,19 +51,21 @@ func start_emulation(core_path: String, rom_path: String) -> bool:
current_rom = rom_path
print("Core and ROM loaded successfully.")
# Wait for SubViewport to render at least one frame
# Ensure SubViewport is ready
sub_viewport.render_target_update_mode = SubViewport.UPDATE_ALWAYS
await get_tree().create_timer(0.1).timeout # Delay ensures rendering starts
# Assign the SubViewport texture
var viewport_texture = sub_viewport.get_texture()
if viewport_texture:
texture_rect.texture = viewport_texture
print("SubViewport texture assigned successfully.")
else:
push_error("Error: SubViewport texture is not ready.")
# Wait for the SubViewport to initialize (up to 3 seconds)
var max_wait_time = 3.0 # Maximum wait time in seconds
var elapsed_time = 0.0
while not sub_viewport.get_texture() and elapsed_time < max_wait_time:
await get_tree().idle_frame # Waits for the next frame
elapsed_time += get_process_delta_time()
if not sub_viewport.get_texture():
push_error("Error: SubViewport texture is not ready after waiting.")
return false
texture_rect.texture = sub_viewport.get_texture()
print("SubViewport texture assigned successfully.")
return true
func _process(delta):