Gba and Genesis on Leia Displays

Hello everyone, is there any Dev that’s interested in Emulation? I Just stumbled upon a very interesting Github Page with a GBA and a Genesis Core for stereoscopic Output with Retroarch : MiLO83 · GitHub If anyone would spend a little Time to take a look at it If this could be Compiled for the Leia Displays would be awesome!
Unfortunately I am not a programmer.
There is also a stereoscopic SNES Emulator but it seems to be gtk only: GitHub - tjwei/snes9x-3d: snes9x + stereoscopic graphics

2 Likes

gosh, i wish i had the time to dig into these, they sound like fun. maybe i’ll have a little extra time next week to toy around :slight_smile:

2 Likes

That would be pretty awesome! If You don’t find the Time I would probably need to learn C and C++ to get Things going, since I only did some Ruby years ago this would probably take ages for me to learn besides my daytime job. By the way, did you comment Your Code in what you needed to change to get citra to compile? Maybe I can learn from it.

1 Like

I added some comments on two commits here:

and here:

however, they don’t paint a cohesive picture since there’s some extra cruft in these commits that i didn’t end up using or just aren’t necessary

i’ll look into commenting the code

i could maybe write a blog post / do a video walk-thru or something if there’s interest


this is probably the most important part: leia view interlacing fragment shader · jakedowns/citra-android@41dcf4c · GitHub


the hardest part for me is usually just getting the builds set up in the IDE, getting gradle & all the dependencies nice & happy

then establishing the lay of the land for the given project,

finding a main activity controller to bootstrap leia backlight controls / implement BacklightListener methods, setting it up to toggle between 2D/3D mode at the appropriate times (when showing / hiding text-based UIs for example)

if applicable get the leia Java deps loading in (took some time to learn how to do that, but it’s not too bad)

then i find where i’ll be working with C++ code or Rust or whatever the project uses, but at some level, when the code is preparing to update the display (usually a loop updating an open gl canvas) i find out if the project already supports a shader pipeline at all. most projects that deal with stereoscopic data usually have this kind of concept floating around in the code, so then it just becomes a matter of figuring out a) how the project stores / organizes / loads it’s shader code b) figure out where in the rendering pipeline you can inject your custom Leia interlacing shader

  • in citra it was here: src/video_core/renderer_opengl/renderer_opengl.cpp
  • in my fork of mpv-android, they already had infrastructure for the end user to edit custom shader code and load it in. so i just tapped into that here: (initially i was writing to config files as tho the user was doing it, but a kind maintainer pointed me to a lower-level api to do it more directly using the underlying mpv library) see this commit
  • in VVB i followed the project’s convention of a “renderer” class, there were already stereoscopic renderers i could reference and clone into my custom renderer. the renderer classes already had logic in place for loading shaders, so, i basically just needed to set my shader as a constant in the new rust class (never used rust before) then get it wired as an optional renderer See renderers/leia.rs here

so yeah, i’ll take a glance at those other projects, i’d be surprised if the process deviated drastically for them.

:slight_smile: i’m excited to potentially have some new forks to work on, thanks for the heads up and interest in the work.

3 Likes

Awesome! I will Take a Look at it and try to wrap my head around this at Christmas time, since work is pretty busy these days. Thank You very mouch! Hopefully I am able to understand the process, be prepared for noob questions though. :smiley:

2 Likes

I Took a Look at it and I think I understand the Concept, However the Retroarch Cores have another Issue, since they use older versions of GLES or no GLES at all, they need to be coded from the Grund Up since they don’t support the GL_OVR_Multiview Extension, which would lead to a not so great Performance.

Maybe it is just my lack of knowledge but it seems like there is a lot more coding involved than with Citra, which leads me to another question, is it possible to invoke the Backlight thru GLES 2.0 or does it also need 3.0 or 3.2?
If not this would require a more recent Emulator than what Retroarch can provide since the whole Frontend ist based on 2.0 to 2.5.

What OS, SDK and NDK did You use with Android Studio?

I have a hard time getting Gradle and especially the NDK setup in Windows 10,
even without the native Leia-Code it throws “Gradle sync failed: NDK not configured” all the time.

I already tried setting the NDK path manually in the local.properties and also tried different JDK and NDK-Versions. This already took me more than a day just to not compile anything,
this is with all the Projects I threw at it, it seems they changed the Handling of the NDK-Setup completely as someone on Stackoverflow pointed out, and Android Studio doesn’t properly reflect these changes atm.

Doesn’t seem like a great start into 2022 unfortunately and I tried to avoid setting up a Linux Distro especially for this.

I’m not a great programmer but I’ve always generally been able to resolve my issues with Android dev on Windows using the Nvidia Codeworks tool. It’ll manage tools and dependencies for you making the process of installation of NDK, etc. pretty easy.

3 Likes

Awesome, Thank You very mouch, I’ll try that :+1:

hey Johannes, my holiday coding break got interrupted by getting covid :frowning:

i’m deep in a refactor at my full-time gig,

i plan to dive back into this again soon-- i’ll try to put together some notes on how i got the ndk mapped up in android studio- i remember it gave me several hours of trouble as well.

1 Like

Thank You very mouch! I hope You get well soon!!!