Open Technoturnovers opened 1 year ago
Using the project lrproxy, I was able to get what info the core reported about itself, and there's a whole lotta null, here. That would explain pretty much all of the issues, probably including the borked aspect ratio. Ideally there would be ways to override all of this in configs, but there's probably also a way to modify this proxy library to intercept these null values and change them to ones that actually, well, work.
technoturnovers@debian-armhf:~$ ./retroarch-latest-nocheats/retroarch --verbose -L /home/technoturnovers/lrproxy/src/proxy_core.so /home/technoturnovers/res_fif/fif.rom
[INFO] [Config]: Looking for config in: "/home/technoturnovers/.config/retroarch/retroarch.cfg".
[INFO] RetroArch 1.16.0 (Git 6c2cc45628)
[INFO] === Build =======================================
[INFO] CPU Model Name: ARMv7 Processor rev 5 (v7l)
[INFO] Capabilities: NEON VFPV3 VFPV4
[INFO] Version: 1.16.0
[INFO] Git: 6c2cc45628
[INFO] Built: Oct 19 2023
[INFO] =================================================
[INFO] [Input]: Found input driver: "x".
[INFO] [Core]: Loading dynamic libretro core from: "/home/technoturnovers/lrproxy/src/proxy_core.so"
[LRPROXY] Loading core "./fif_libretro.so"
[LRPROXY] Getting pointer to retro_init
[LRPROXY] Getting pointer to retro_deinit
[LRPROXY] Getting pointer to retro_api_version
[LRPROXY] Getting pointer to retro_get_system_info
[LRPROXY] Getting pointer to retro_get_system_av_info
[LRPROXY] Getting pointer to retro_set_environment
[LRPROXY] Getting pointer to retro_set_video_refresh
[LRPROXY] Getting pointer to retro_set_audio_sample
[LRPROXY] Getting pointer to retro_set_audio_sample_batch
[LRPROXY] Getting pointer to retro_set_input_poll
[LRPROXY] Getting pointer to retro_set_input_state
[LRPROXY] Getting pointer to retro_set_controller_port_device
[LRPROXY] Getting pointer to retro_reset
[LRPROXY] Getting pointer to retro_run
[LRPROXY] Getting pointer to retro_serialize_size
[LRPROXY] Getting pointer to retro_serialize
[LRPROXY] Getting pointer to retro_unserialize
[LRPROXY] Getting pointer to retro_cheat_reset
[LRPROXY] Getting pointer to retro_cheat_set
[LRPROXY] Getting pointer to retro_load_game
[LRPROXY] Getting pointer to retro_load_game_special
[LRPROXY] Getting pointer to retro_unload_game
[LRPROXY] Getting pointer to retro_get_region
[LRPROXY] Getting pointer to retro_get_memory_data
[LRPROXY] Getting pointer to retro_get_memory_size
[LRPROXY] retro_get_system_info(0x120c6e4)
[LRPROXY] ->library_name = "(null)"
[LRPROXY] ->library_version = "(null)"
[LRPROXY] ->valid_extensions = "(null)"
[LRPROXY] ->need_fullpath = 0
[LRPROXY] ->block_extract = 0
[LRPROXY] retro_set_environment(0x48c5c9)
[INFO] [Overrides]: Redirecting save file to "/home/technoturnovers/.config/retroarch/saves/Unknown/fif.srm".
[INFO] [Overrides]: Redirecting save state to "/home/technoturnovers/.config/retroarch/states/Unknown/fif.state".
[LRPROXY] retro_init()
[INFO] [Content]: Loading content file: "/home/technoturnovers/res_fif/fif.rom".
[INFO] [Environ]: SET_INPUT_DESCRIPTORS:
[LRPROXY] RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS(0xbe8e91bc) = 1
[LRPROXY] [0].port = 0
[LRPROXY] [0].device = 0 << RETRO_DEVICE_TYPE_SHIFT | RETRO_DEVICE_JOYPAD
[LRPROXY] [0].index = 0
[LRPROXY] [0].id = RETRO_DEVICE_ID_JOYPAD_LEFT
[LRPROXY] [0].description = "D-Pad Left"
[LRPROXY] [1].port = 0
[LRPROXY] [1].device = 0 << RETRO_DEVICE_TYPE_SHIFT | RETRO_DEVICE_JOYPAD
[LRPROXY] [1].index = 0
[LRPROXY] [1].id = RETRO_DEVICE_ID_JOYPAD_UP
[LRPROXY] [1].description = "D-Pad Up"
[LRPROXY] [2].port = 0
[LRPROXY] [2].device = 0 << RETRO_DEVICE_TYPE_SHIFT | RETRO_DEVICE_JOYPAD
[LRPROXY] [2].index = 0
[LRPROXY] [2].id = RETRO_DEVICE_ID_JOYPAD_DOWN
[LRPROXY] [2].description = "D-Pad Down"
[LRPROXY] [3].port = 0
[LRPROXY] [3].device = 0 << RETRO_DEVICE_TYPE_SHIFT | RETRO_DEVICE_JOYPAD
[LRPROXY] [3].index = 0
[LRPROXY] [3].id = RETRO_DEVICE_ID_JOYPAD_RIGHT
[LRPROXY] [3].description = "D-Pad Right"
[LRPROXY] [4].port = 0
[LRPROXY] [4].device = 0 << RETRO_DEVICE_TYPE_SHIFT | RETRO_DEVICE_JOYPAD
[LRPROXY] [4].index = 0
[LRPROXY] [4].id = RETRO_DEVICE_ID_JOYPAD_B
[LRPROXY] [4].description = "B"
[LRPROXY] [5].port = 0
[LRPROXY] [5].device = 0 << RETRO_DEVICE_TYPE_SHIFT | RETRO_DEVICE_JOYPAD
[LRPROXY] [5].index = 0
[LRPROXY] [5].id = RETRO_DEVICE_ID_JOYPAD_A
[LRPROXY] [5].description = "A"
[LRPROXY] [6].port = 0
[LRPROXY] [6].device = 0 << RETRO_DEVICE_TYPE_SHIFT | RETRO_DEVICE_JOYPAD
[LRPROXY] [6].index = 0
[LRPROXY] [6].id = RETRO_DEVICE_ID_JOYPAD_Y
[LRPROXY] [6].description = "Insert Coin"
[LRPROXY] [7].port = 0
[LRPROXY] [7].device = 0 << RETRO_DEVICE_TYPE_SHIFT | RETRO_DEVICE_JOYPAD
[LRPROXY] [7].index = 0
[LRPROXY] [7].id = RETRO_DEVICE_ID_JOYPAD_START
[LRPROXY] [7].description = "Start"
[LRPROXY] [8].port = 1
[LRPROXY] [8].device = 0 << RETRO_DEVICE_TYPE_SHIFT | RETRO_DEVICE_JOYPAD
[LRPROXY] [8].index = 0
[LRPROXY] [8].id = RETRO_DEVICE_ID_JOYPAD_LEFT
[LRPROXY] [8].description = "D-Pad Left"
[LRPROXY] [9].port = 1
[LRPROXY] [9].device = 0 << RETRO_DEVICE_TYPE_SHIFT | RETRO_DEVICE_JOYPAD
[LRPROXY] [9].index = 0
[LRPROXY] [9].id = RETRO_DEVICE_ID_JOYPAD_UP
[LRPROXY] [9].description = "D-Pad Up"
[LRPROXY] [10].port = 1
[LRPROXY] [10].device = 0 << RETRO_DEVICE_TYPE_SHIFT | RETRO_DEVICE_JOYPAD
[LRPROXY] [10].index = 0
[LRPROXY] [10].id = RETRO_DEVICE_ID_JOYPAD_DOWN
[LRPROXY] [10].description = "D-Pad Down"
[LRPROXY] [11].port = 1
[LRPROXY] [11].device = 0 << RETRO_DEVICE_TYPE_SHIFT | RETRO_DEVICE_JOYPAD
[LRPROXY] [11].index = 0
[LRPROXY] [11].id = RETRO_DEVICE_ID_JOYPAD_RIGHT
[LRPROXY] [11].description = "D-Pad Right"
[LRPROXY] [12].port = 1
[LRPROXY] [12].device = 0 << RETRO_DEVICE_TYPE_SHIFT | RETRO_DEVICE_JOYPAD
[LRPROXY] [12].index = 0
[LRPROXY] [12].id = RETRO_DEVICE_ID_JOYPAD_B
[LRPROXY] [12].description = "B"
[LRPROXY] [13].port = 1
[LRPROXY] [13].device = 0 << RETRO_DEVICE_TYPE_SHIFT | RETRO_DEVICE_JOYPAD
[LRPROXY] [13].index = 0
[LRPROXY] [13].id = RETRO_DEVICE_ID_JOYPAD_A
[LRPROXY] [13].description = "A"
[LRPROXY] [14].port = 1
[LRPROXY] [14].device = 0 << RETRO_DEVICE_TYPE_SHIFT | RETRO_DEVICE_JOYPAD
[LRPROXY] [14].index = 0
[LRPROXY] [14].id = RETRO_DEVICE_ID_JOYPAD_Y
[LRPROXY] [14].description = "Insert Coin"
[LRPROXY] [15].port = 1
[LRPROXY] [15].device = 0 << RETRO_DEVICE_TYPE_SHIFT | RETRO_DEVICE_JOYPAD
[LRPROXY] [15].index = 0
[LRPROXY] [15].id = RETRO_DEVICE_ID_JOYPAD_START
[LRPROXY] [15].description = "Start"
[INFO] [Environ]: SET_PIXEL_FORMAT: RGB565.
[LRPROXY] RETRO_ENVIRONMENT_SET_PIXEL_FORMAT(RETRO_PIXEL_FORMAT_RGB565) = 1
[LRPROXY] retro_load_game(0x22d83a8) = 1
[LRPROXY] ->path = "/home/technoturnovers/res_fif/fif.rom"
[LRPROXY] ->data = 0x22ee170
[LRPROXY] ->size = 4
[LRPROXY] ->meta = "(null)"
[INFO] [Replay]: Found last replay slot: #0
[LRPROXY] retro_get_memory_size(0) = 0
[LRPROXY] retro_get_memory_data(0) = (nil)
[LRPROXY] retro_get_memory_size(1) = 0
[LRPROXY] retro_get_memory_data(1) = (nil)
[INFO] [SRAM]: Skipping SRAM load.
[LRPROXY] retro_set_video_refresh(0x6813b5)
[LRPROXY] retro_set_audio_sample(0x66dff5)
[LRPROXY] retro_set_audio_sample_batch(0x66e155)
[LRPROXY] retro_set_input_state(0x67a549)
[LRPROXY] retro_set_video_refresh(0x6813b5)
[LRPROXY] retro_set_audio_sample(0x66dff5)
[LRPROXY] retro_set_audio_sample_batch(0x66e155)
[LRPROXY] retro_set_input_state(0x67a549)
[LRPROXY] retro_api_version() = 1
[INFO] [Core]: Version of libretro API: 1, Compiled against API: 1
[LRPROXY] retro_set_video_refresh(0x6813b5)
[LRPROXY] retro_set_audio_sample(0x66dff5)
[LRPROXY] retro_set_audio_sample_batch(0x66e155)
[LRPROXY] retro_set_input_state(0x493b65)
[LRPROXY] retro_set_input_poll(0x493bb9)
[LRPROXY] retro_get_system_av_info(0x125d790)
[LRPROXY] ->geometry.base_width = 240
[LRPROXY] ->geometry.base_height = 320
[LRPROXY] ->geometry.max_width = 240
[LRPROXY] ->geometry.max_height = 320
[LRPROXY] ->geometry.aspect_ratio = 0.000000
[LRPROXY] ->timing.fps = 60.000000
[LRPROXY] ->timing.sample_rate = 44100.000000
[INFO] [Core]: Geometry: 240x320, Aspect: 0.000, FPS: 60.00, Sample rate: 44100.00 Hz.
[INFO] [Audio]: Set audio input rate to: 44100.00 Hz.
[INFO] [Video]: Set video size to: 720x960.
[ERROR] [Wayland]: Failed to connect to Wayland server.
IT WORKS I don't even know C, by the way- didn't manage to fix the aspect ratio issue quite yet it seems, but it launches on default compile and can save remaps now I'll make a github repo for the changes I made to lrproxy tomorrow, it's really late right now
I haven't been able to figure out what is causing the incorrect aspect ratio, core-wise, but an ugly hack that seems to work in the meantime is just using aspect ratio settings to manually stretch the game to two times its width, and possibly set overscan cropping to get rid of the black bars for use in a portrait monitor configuration. I'm not really sure what could be causing this type of viewport/scaling related issue, since it doesn't seem like there are that many parameters that are relevant; if anyone has any insight, I would be glad to hear it, since this isn't exactly elegant (then again, this wrapper core isn't terribly elegant just in principle).
Have you tried changing this:
[LRPROXY] ->geometry.aspect_ratio = 0.000000
to 0.75 (that is, 3:4)?
Great work so far, by the way. That's a clever idea to use the wrapper core to solve the shortcomings of the closed-source core.
Have you tried changing this:
[LRPROXY] ->geometry.aspect_ratio = 0.000000
to 0.75 (that is, 3:4)?Great work so far, by the way. That's a clever idea to use the wrapper core to solve the shortcomings of the closed-source core.
Tried that, it didn't do anything. Gonna make a repo for what I have so far
https://github.com/Technoturnovers/lrproxy_fif Here it is, all it does is override the unspecified sys_info stuff with actual values.
Note: in order to get the core info file to work, I had to rename the proxy core to proxy-core.so and the info file to proxy-core.info
Alright, I still haven't been able to figure out the video issue, mainly because I am a tiny-brained compsci novice who only knows Python, JavaScript, and some Java, and looking at the core info functions for AV in the reference libretro.h and a variety of other existing cores hasn't really told me much about what could be causing the frame to be squeezed within the viewport. Does anyone have any advice for what structs may be in play with this?
Alright, I have come to the conclusion that there is probably letterboxing baked into this particular core, with it being targeted at a 4:3 aspect ratio; I found an AtGames promotional video on Facebook that is a direct capture of the game in question, and that video is at 4:3 when that would make no sense as an intentional decision rather than just them leaving the capture as is. I still need to find a configuration that won't end up with uneven pixels, so I'll report back when I figure that out.
Also, I'm leaving this issue open because even though I found a workaround for the last remaining issue, there's still a crash here where there wasn't before, and that's bad obviously and should still be fixed.
EDIT: Just took a look at the Facebook video, and that has uneven pixels too, so it looks like this core just has uneven scaling as a matter course. Lame.
oh nice. Mystery solved, then. If you're able to get it to render at wider-than-desired without wonky pixels (i.e., an even integer multiple), you could shrink it down with a shader to keep the quality up.
oh nice. Mystery solved, then. If you're able to get it to render at wider-than-desired without wonky pixels (i.e., an even integer multiple), you could shrink it down with a shader to keep the quality up.
Actually, I'm going to try one more thing- how do I set a rotation value? EDIT: Figured it out, didn't do what I was hoping.
I wasn't able to find a simple integer factor in order to get the pixels to even out, but I was able to get a base resolution target, that being 428x320; that leaves the actual game area at a base size of 240x320 as intended, should work fine with integer scaling, and should probably also work fine with non-integer scaling since that should change the pixel size rather than duplicating actual pixels, at larger resolutions. Now I need to figure out a way to either automatically crop out a given portion of the base image using a config or core parameter, or have a shader to do it for me (although the latter is not preferred for performance reasons).
Can you use integer overscale? Will that cut enough off for your purposes?
Can you use integer overscale? Will that cut enough off for your purposes?
All integer overscale does is always round up when scaling- there are two black bars to either side of the frame horizontally, and there just isn't any way for me to crop that out without manually setting aspect ratio to custom and figuring out the viewport x setting that works, plus manually changing the window size.
I tried testing it on my one spare RPi, but there was a complication: this thing is only ARM6, which means the arch is armeb as opposed to armhf. I would need to either buy a new Pi, or pull my Pi 4 from KVM duty (which isn't feasible right now). Gonna consider my options, since I really want to see what this looks like at full native performance
EDIT: Turns out that I have an SNES Classic (somehow), so I'm gonna test using that EDIT EDIT: didn't work, it segfaulted and I can't tell why unless I get a compile environment functional, which is difficult because the SNES Classic uses an ancient libc
After commit https://github.com/libretro/RetroArch/commit/b2634ea5885b6f09697c4b0d13e8d9c93ca381ea by @LibretroAdmin, attempting to launch the core results in a segmentation fault, with the following backtrace on a debug-enabled build linking the crash to the cheat manager:
Does this crash still happen?
(Note: at the advice of hizzlekizzle, I am closing the prior issue #15802 in favor of this one)
Description
fif_libretro.so is a proprietary libretro core for the game Fix-It Felix Jr., originally developed by Code Mystics under license from Disney as a standalone game for promotional Windows-based arcade cabinets, and later licensed with Disney's approval for porting to libretro and inclusion on AtGames's various Linux-based home arcade cabinets in 2019. The shared library is compiled as a 32-bit ARMv8 ELF binary, and only depends on libc and libm (and can run on armhf, aka ARMv7, platforms). Full details on the core's unusual operation will detailed later.
After commit b2634ea5885b6f09697c4b0d13e8d9c93ca381ea by @LibretroAdmin, attempting to launch the core results in a segmentation fault, with the following backtrace on a debug-enabled build linking the crash to the cheat manager:
GDB backtrace
``` technoturnovers@debian-armhf:~/retroarch-broken/RetroArch$ gdb --args ./retroarch --verbose -L /home/technoturnovers/fif_libretro.so /home/technoturnovers/res_fif/fif.rom GNU gdb (Debian 13.2-1) 13.2 Copyright (C) 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or laterThis core also has a variety of other non-crashing issues not tied to this specific commit, which I will list later (and potentially make future separate issues about).
Expected behavior
Pictured is the core running on the latest release version of RetroArch with only
--disable-cheats
and debug flags set on compile:Further fif_libretro details and issues:
As stated previously, fif_libretro.so is a libretro core compiled as a 32-bit ARM binary, with libc and libm as the only dependencies. It requires being pointed at a "ROM" in the form of the file 'fif.rom'; however, this file is actually just a plain text file with the text "FIF" in it, and only serves as a dummy file that allows the core to receive the assets folder with all of the unpacked assets contained inside. Here is a list of the files required to run the core, with SHA-1 sums for each:
SHA-1
``` SHA-1: 709f2f1a9147d9987a00c2c86ad1beced4ed4b75 ./fif_libretro.so 7a40f13a4f3cab9348f71cef4f3cbe155eadcb4f ./res_fif/controls.log 2314358705f32d68c8709a990e724ecef3ed7b4c ./res_fif/fif.rom 74f346a151e16e479de68e7ede99f6077749971a ./res_fif/fif.rom.l.png 1f764f5f5b4387dd7853719b707aa5e852672108 ./res_fif/fif.rom.png 3fac5a8704d8f97e378152132e7e6ceb3288940f ./res_fif/fif.rom.s.png 34a5dca2810f31ea7336b167b2e89dfba953db94 ./res_fif/sound0.wav c9e41e0a3ef7b8b99bc04922135d4d9e772e0b8c ./res_fif/sound1.wav fb0fcd30c2736faec27cb2e6ae392c0ba997204f ./res_fif/sound10.wav f4fe6d07446e633d327fa0b5e8f77b51812236d9 ./res_fif/sound11.wav c30eab4db02adf7be7fe4f1fc8bffd5b949e292c ./res_fif/sound12.wav c60445a5afc41fa1c7306e494de3d977c1860054 ./res_fif/sound13.wav 43619830a69d1541c432afcb27937ee928668e79 ./res_fif/sound14.wav 393f02665bccc12c71d78c8b406a81b623ff660d ./res_fif/sound15.wav 9f3146264532fe42083fdfc5beef902046a91d20 ./res_fif/sound16.wav 56aa52bb0032aaa9edcdfe476b7af853b0a873d7 ./res_fif/sound17.wav dba72e4253047894170d7b1b4fa48ea7f9b74f32 ./res_fif/sound18.wav 3517443234d3d75e485e23607fc34b699d5700d1 ./res_fif/sound19.wav d296e8eef2059c6d2b00a49f78ada9828e6fb395 ./res_fif/sound2.wav 3bbd8ca70019b2123143d6397732b5877c5fc304 ./res_fif/sound20.wav 022138961a374d4eda7a133796b476edf87cb3b7 ./res_fif/sound21.wav a89280408c43b5624b2ff4c84cbe66f1d83ddd18 ./res_fif/sound22.wav 8401b37e7bcaa4eef7caac2c3ef05a47c0f29847 ./res_fif/sound23.wav 2798b239ce23a22847cda2936cdfbb00e280b395 ./res_fif/sound24.wav 2bed76ffe0e3aa7137b4611b10dac1296dc6ffee ./res_fif/sound25.wav a93a3593b729444591f616afb981f454e2177a0c ./res_fif/sound26.wav 5effb7b0fd79033973d7a66601cfe589a65893c2 ./res_fif/sound27.wav 0f0043be3fb2b97e207ee15684d8fb1f12fa9f3d ./res_fif/sound28.wav 63a43994cc3a8fd92011e5a3b5d1ba8d501d07a5 ./res_fif/sound29.wav 404de5cb7d6a56ab9a17405e9241494693f79021 ./res_fif/sound3.wav 8f75836a9ba115b77c1e1002560b2896c62b61af ./res_fif/sound30.wav 672ba3d47cdd654f82b8ee6c84572ee20ae7117c ./res_fif/sound31.wav a44af75d16a9e2f79d1dcead24dba35001913b09 ./res_fif/sound4.wav 6ecb91ac9534eaaa4069a043661c9c16e21942d2 ./res_fif/sound5.wav 66365bd6dc650d714547cfd46278da692b40fe22 ./res_fif/sound6.wav ed09b930615429362628cde3713ec31cd2ce1a31 ./res_fif/sound7.wav e21920b85c2edae9e7614251e0cf90b808de0072 ./res_fif/sound8.wav 1bd8cb6c168db29ecfa73e6e776277af21166579 ./res_fif/sound9.wav 3bd2ad5d0d481b813b00024cb0e290133238c5ba ./res_fif/texture2.bmp ```I cannot link to any of these files due to copyright, but they are out there (if a bit difficult to find), and they can also be pulled from any AtGames console that includes the game.
The core does not come with a core info file, and I have yet to pin down exactly what capabilities it exposes due to it apparently relying on the defaults of AtGames's proprietary libretro frontend/implementation, retroplayer. However, I have managed to get it to launch from the menu, accept the .rom file, and even enable save states with this core info file I made up, named
fif_libretro.info
:Even with this core info file however, there are still issues, seemingly tied to the core itself reporting absolutely zero details about itself. So far, I've had the following issues crop up (although there's probably more):
[INFO] [Overrides]: Error saving overrides.
Environment Information
OS:
Linux debian-armhf 6.5.0-1-armmp-lpae #1 SMP Debian 6.5.3-1 (2023-09-13) armv7l GNU/Linux
QEMU launch command:qemu-system-arm -machine virt,gic-version=max -m 1G -cpu cortex-a7 -smp 4 -netdev user,id=vnet,hostfwd=:127.0.0.1:2222-:22 -device virtio-net-pci,netdev=vnet -drive file=harddisk.qcow2,if=none,id=drive0,cache=writeback -device virtio-blk,drive=drive0,bootindex=0 -drive file=flash0.img,format=raw,if=pflash -drive file=flash1.img,format=raw,if=pflash -device virtio-gpu-pci -device qemu-xhci -device usb-kbd -device usb-tablet -display sdl,show-cursor=on -accel tcg,thread=multi -device usb-audio