libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.34k stars 1.84k forks source link

[Feature Request] Wayland: Support for wl_shell #16361

Open shoddydev opened 8 months ago

shoddydev commented 8 months ago

I'm trying to compile retroarch for the PlayStation Classic which uses wl_shell. It appears that versions up to 1.7.8 had support for it, but then it switched to xdg-shell and dropped wl_shell in 1.7.9. Is it possible to add support for it again or can someone guide me on reverting the changes? I'm a beginner at this.

https://github.com/libretro/RetroArch/commit/8345f08f649ae2150365d6a1cd48fabd4341b5d5#diff-e127ff03593cbcf81393a0fb9781fc30

I've also tried compiling newer versions of Weston and Wayland but the PSC bricks when I try to add it in internally. The PSC uses Weston and Wayland 1.11.0

ColinKinloch commented 8 months ago

wl_shell is deprecated infavor of xdg_shell.

I don't really know the PS Classic but your best bets are:

shoddydev commented 8 months ago

I was able to get Retroarch 1.10.0 to work by painstakingly editing the code to revert the commit to match ver 1.7.7. But since 1.11.0 there appears to have been a revamp in the code where it splits up into different wayland_common.c files. I edited it to the best of my ability and it successfully compiled but I get a seg fault error. I'm really just a beginner tinkering around but I'm sure someone who's more experienced with it can figure it out.

I prefer to keep the PSC in it's stock state as much as possible. As a inspiring dev i'm not so much thinking of myself, rather I'm more interested in how others interact with it. when I'm targeting a specific console, I'm trying to make it as simple for the user as possible where they don't have to install additional stuff to get it working. even if I am able too. the PSC has plug and play capabilities so that means it's possible to run homebrew without installing any hacks.

sometimes it's more interesting to get things working on lower spec hardware than on a modern PC. yes I have a ps4 ps5, nvidia shield and a ton of other things that will run better but i just get more of a thrill out of seeing it work on a PSC. it's like when people see doom running on a NES or something.

or how back in the day ebay didn't have gallery thumbnails in their listings. then one day someone figure out how to inject html code to add the <img src= code and leave it unclosed and it display a picture in their listing. Now seeing a thumbnail isn't anything spectacular but because it wasn't meant to work, that intrigue people where it got a ton of traffic. even though they can run the code elsewhere, they just find it more interesting when its seen on something that wasn't supposed to work. Maybe it's the novelty who knows but its little gimmicks like that that can give something an edge

ColinKinloch commented 8 months ago

I appreciate your enthusiasm.

I think getting software you want to run on it to support a deprecated protocol will be more of an uphill battle than getting a newer weston to work however that may be incompatible with sonys software.

Have you tried figuring out what the stock weston version is and trying to compile a drop in replacement of that version?

shoddydev commented 8 months ago

It uses weston 1.11.0 and yeah I did attempt to compile it last year in 2023 when I was trying to get Xwayland working on the PSC. When I updated weston the psc would boot up with a error message saying "An error has occurred. Turn off the console, unplug the AC adaptor, and then turn on the console again."

I eventually got Xwayland to work by compiling Xorg and it spat out Xwayland. The only problem is it's using software: https://www.youtube.com/watch?v=0r9hfC03sSg

I plan on revisiting these projects later. I really only started learning how to compile in 2023 so I didn't understand a lot back then. Now that I have a better understanding I might be able to get it to work.

I'm not really concerned about potentially bricking my psc as there are multiple ways to restore either with FASTBOOT or by booting into debian and flashing the rootfs.img to restore it. i've ransacked the filesystem quite a bit while I was learning.

I should mention that I was able to get the latest Retroarch working if I set the video display driver to SDL2. However it's limited to RGUI and it doesn't work with certain cores like ppsspp and flycast. I theorize wl_shell can work it's just newer builds had a code rewrite, like in the wayland_ctx.c file there are names like gfx_ctx_wl_get_video_size_common that's not referenced in ver 1.10.0 but it is in ver 1.11.0. and later versions added new header files and other things I'm unaware of.

The PlayStation classic has two main hacks available, Autobleem and Project Eris. The Autobleem version uses Retroarch 1.9.0 and it was last updated in Sept 2020 while Project Eris uses Retroarch 1.7.8 and that was last built in 2019. I kinda just wanted to build my own Retroarch with my own custom touch to it. I don't really plan on maintaining it but I figure if I'm going to attempt to build it I should try to compile the latest version. having a build from 2024 might sound more appealing than a build from 2022. But yeah it might be a one off thing that I don't plan on updating in the future. Plus a stable build of retroarch can last for years. Hell I'm still using retroarch 1.7.2 lol

ColinKinloch commented 8 months ago

Aparently it's not all that complex to get a UART (assuming you haven't already) https://cybercx.co.nz/blog/playstation-classic-hacking/

Might produce slightly better error messages than "An error has occurred"

shoddydev commented 8 months ago

I'm clueless when it comes to anything related to hardware so most of this is beyond me lol but it looks very useful. seems like a lot of work just to dump the firmware. What I do is I use putty, that lets me have root access and make img backups of the partitions. I can also run wayland-terminal on the PSC too.

I'm going to show this to donluca, he made a Debian linux distro for the PSC and that's what I'm currently using to compile apps. The main drawback is it doesn't have hardware acceleration. Prior to that I didn't know how to use linux so the PSC is pretty good for beginners who want to learn. I've tried using linux ubuntu before on virtual machines and chromebooks, but i never really got deep into it. due to the PSC's limitations of only having 14gb of internal storage, that allows me to experiment more because I would be more hesitant to ransack a linux filesystem that has 1tb. it'll take forever to backup and restore.

Also part of the motivating factor of the psc is I get the sense of developing on a real gaming console. Even though it's really just a arm linux device, the thought of developing on it gives me more motivation because pretty much every PSC is the same and that's one of the things i liked about classic consoles is the simplicity. We can simply power it on in 5 seconds, then turn it off after we're done. When we're using other devices like a raspberry pi, retropie, nvidia shield, android, there's a little more work involved and it's not as kid friendly. Sometimes you just want to let your kids go on a device where you don't have to worry about them messing up the configurations or them bugging you how to switch games and stuff.

My ultimate goal is to modify the psc to attach a mini cd/dvd drive inside to play real ps1 discs with the Retroarch disc project and just a few days ago i was able to compile pcsx rearmed to make it work with Disc Project. And I hit up Notaz who is the maintainer of pcsx rearmed and he added some new commits yesterday to improve it. yes i know this is real niche and novel but i think it's cool.

I also got mkxp-z to work which let's us run RPG Maker XP/VX/VXA games. however I'm going to use it to design a frontend. So I'll like to make my own UI that uses retroarch to launch games. I'm more of a software guy