ptitSeb / box64

Box64 - Linux Userspace x86_64 Emulator with a twist, targeted at ARM64 Linux devices
https://box86.org
MIT License
3.38k stars 239 forks source link

Force GLES context similar to box86 implementation #1010

Open daedalia opened 9 months ago

daedalia commented 9 months ago

Hello.

I'm looking to add functionality to box64, similar to what's in box86, which forces a GLES context. I believe it will help getting some games running on the Odroid Go Ultra and clones with the JELOS firmware. I've done a POC forcing the ES context by modifying SDL2, which resolves the initial issue of not being able to find a GL context, but then has a Rubiks cube effect, breaking things further along I think. The modification on box86 was made by JonnyOnFlame and can be found here:

https://github.com/ptitSeb/box86/pull/455/commits/fb79a9eb2297cf2f819e1f60757b64586d37959e

I've given it a go with some basic adaptions but I'm no C programmer. There are a couple of issues when it comes to compilation.

The first one is the following line. It's commented out elsewhere in the box64 codebase so I think it's globally defined now and can be removed? sdl2_my_t *my = (sdl2_my_t *)emu->context->sdl2lib->priv.w.p2;

Error is: error: \u2018library_t\u2019 {aka \u2018struct library_s\u2019} has no member named \u2018priv\u2019 594 | sdl2_my_t *my = (sdl2_my_t *)emu->context->sdl2lib->priv.w.p2;

The second one I'm not sure what to do with and hoping you could give some insight: int (*SDL_GL_SetAttribute_p)(uint32_t, int) = dlsym(emu->context->sdl2lib->priv.w.lib, "SDL_GL_SetAttribute");

Error is: error: \u2018library_t\u2019 {aka \u2018struct library_s\u2019} has no member named \u2018priv\u2019 613 | int (*SDL_GL_SetAttribute_p)(uint32_t, int) = dlsym(emu->context->sdl2lib->priv.w.lib, "SDL_GL_SetAttribute");

Thanks for taking the time and I appreciate your work, it's an absolute marvel!

ptitSeb commented 9 months ago

I'll have a look at that this week end. I remember those changes on box86, I'll see if I can port them to box64.

daedalia commented 9 months ago

That's great, thank you

daedalia commented 9 months ago

Hello, don't worry too much about this. I managed to get it implemented and I came across the same errors I did with my SDL2 hack job. Let me know if you'd like a PR, may be a little smelly.