Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐧] GNU+Linux compatibility progress #1430

Open
39 of 42 tasks
YoshiRulz opened this issue Jan 7, 2019 · 303 comments
Open
39 of 42 tasks

[🐧] GNU+Linux compatibility progress #1430

YoshiRulz opened this issue Jan 7, 2019 · 303 comments
Labels
App: EmuHawk Relating to EmuHawk frontend Meta Relating to code organisation or to things that aren't code re: Multiplatform Relating to porting to Linux (or macOS, etc.), or porting to other host architectures

Comments

@YoshiRulz
Copy link
Member

YoshiRulz commented Jan 7, 2019

jump to known bugs

Overview:

  • Nothing on this page applies to the (discontinued) macOS port.
  • Build instructions are in the readme. tl;dr: run Dist/BuildRelease.sh.
  • "Installation" instructions are also in the readme. tl;dr: run output/EmuHawkMono.sh.
    • No Wine required! If you get it working in Wine, good for you, but I'm going to ignore you and hide any counter-productive comments.
  • 35-ish of 40-ish systems can be emulated, with the notable exception of N64 (Mupen64Plus isn't available, and the experimental Ares64 core is too slow).
  • For casual players, most things work as they would on Windows.
  • For TASers, most things work as they would on Windows.
  • For glitch hunters and romhackers, everything sucks and I'm sorry. But if a core is available on Linux, and the core implements the necessary services for a tool, then it should be at least functional.
  • Before 2.10:
    • Command-line flags to EmuHawkMono.sh are passed through as expected. The single exception is if you pass --mono-no-redirect as the first flag, which disables redirecting stdout/stderr to EmuHawkMono_last*.txt (the default behaviour is to write to disk instead of the terminal).
    • When it inevitably crashes, some errors go to the terminal/EmuHawkMono_last*.txt, some appear in dialog boxes, some both. Most of these error dialogs will either have a "Copy" button, or will allow Ctrl+C.

As of 2.10, the following systems can be emulated:

  • 3DS with Encore
  • Amiga with UAE
  • Apple II with Virtu
  • Arcades with MAME
  • Atari 2600 with Atari2600Hawk or Stella
  • Atari 7800 with A7800Hawk
  • Atari Jaguar with VirtualJaguar
  • Atari Lynx with Handy
  • Channel F with ChannelFHawk (I don't have roms --yoshi)
  • ColecoVision with ColecoHawk
  • Commodore 64 with C64Hawk (loads to BASIC prompt, at least --yoshi)
  • Game Boy and GBC with Gambatte, GBHawk, or SameBoy
  • GBA with mGBA
  • Intellivision with IntelliHawk
  • Magnavox Odyssey² with O2Hawk
  • MSX with MSXHawk
  • N64 with Ares64
  • N64DD with Ares64 (I don't have roms --yoshi)
  • Neo Geo Pocket / Color with NeoPop
  • NES/Famicom plus FDS with NesHawk or QuickNes
  • Nintendo DS with melonDS
  • Nintendo Virtual Boy with Virtual Boyee
  • PC Engine / TG-16 and SuperGrafx plus CD with HyperNyma, PCEHawk, or TurboNyma
  • PC-FX with T.S.T.
  • PSX with Nymashock
  • Sega 32X with PicoDrive
  • Sega CD with Genplus-gx
  • Sega Game Gear with SMSHawk
  • Sega Genesis / Mega Drive with Genplus-gx
  • Sega Master System with SMSHawk
  • Sega Pico with Genplus-gx (I don't have roms --yoshi)
  • Sega Saturn with Saturnus (see "Issues with Saturnus" below)
  • Sega SG-1000 SMSHawk
  • SNES/SFC with BSNES, Faust, or Snes9x
  • Super Game Boy with Gambatte or BSNES
  • TI-83 with Emu83 or TI83Hawk
  • TIC-80 fantasy console with TIC-80 reference implementation
  • Uzebox fantasy console with Uzem
  • Vectrex with VectrexHawk
  • WonderSwan / Color with Cygne
  • ZX Spectrum with ZXHawk
  • Anything else via Libretro cores (provided they don't crash)
@YoshiRulz
Copy link
Member Author

YoshiRulz commented Jan 7, 2019

Issues with EmuHawk

Startup issues:

  • Gtk not found (missing LD_LIBRARY_PATH to libgtk-x11-2.0.so.0?), using built-in colorscheme—see ignored GTK theme below.
  • Unable to locate theme engine in module_path: "adwaita" seems to be a harmless error, but can be resolved by installing gnome-themes-extra.

Misc. issues:

  • Mono seemingly ignores the GTK theme... on my machine >:( (Others have reported mono/mono#20078 dark theme being inconsistently applied). As a result, everything is an ugly beige, and some icons in e.g. open file dialogs are missing. Hope you remember which is the parent directory button!
    • THEMING UPDATE 2024-09: Some work has been put into making the default not so ugly, but hopefully the "correct" light theme can be installed and coerced to load as was done for NixOS in 9a2c163. Users who were affected by mixed dark/light theme have had success with the GTK_DATA_PREFIX='' ./EmuHawkMono.sh workaround, so perhaps that could be applied by default.
      • GTK_DATA_PREFIX seems to have no effect on Ubuntu 24.04 (GNOME).
    • There was a tiny amount of work put into making the mixed dark/light theme usable (b967e60), but EmuHawk was designed for a light theme. Please report if you're affected by the mixed dark/light theme, but don't report individual instances of illegible text for example—those are wontfix.
  • I think file extensions are case-sensitive on Mono. The rom loader dialog doesn't recognise my .32X file as a rom. fixed in f8a688d
  • (unthrottled) FPS triples when window unfocused. Is input slowing it down? who knows --yoshi
    • actually I can't repro this --yoshi at 25a5449
    • dwango repro'd this on stream. still no idea why it happens. --yoshi
    • Still can't repro, no change when swapping out OpenTKInputAdapter for a DummyInputAdapter --yoshi at 24f69eb
    • Repro'd on NixOS, both on 2.9.1 and at ebe3cad, though it's a very small difference in Release config. --yoshi
    • It's just defocusing MainForm, by the way, you can have the Lua Console or Virtual Pad focused to get the speedup
  • Keyboard shortcuts in RAM Watch don't work. ToolStripMenuItem.ShortcutKeys isn't working at all.
    • Just looked into this again with TAStudo and ProcessCmdKey isn't even being called. --yoshi at 681ef72
  • Menubar mnemonics are disabled. Past me did it to prevent a crash, needs retesting. --yoshi at 03d10ce
    • enabled on MainForm as of 28d62e6
    • not working on other Forms --yoshi at 28d62e6
    • probably same cause as ShortcutKeys --yoshi at 681ef72
  • Some file open dialogs cause a ArgumentOutOfRangeException in System.DateTimeOffset.FromUnixTimeSeconds(long). --yoshi at 03d10ce
  • In IToolFormAutoConfigs, Settings > Stay on Top correctly writes Window.KeepAbove = !item.Checked, but does not read the actual value i.e. toggling keep-above via the WM does not change the checkbox's state. I suggest this menu item be disabled on Linux (and macOS?). --yoshi at 03d10ce
    • Fixed in 329a7de (by hiding the menu item).
  • Defaults for Config > Paths... could be changed to standards like $XDG_CONFIG_HOME. Making this change to system-global dirs would break from the "portable app" precedent. --yoshi
    • Sorta done in NixHawk
  • Users with only an Intel iGPU (i.e. no discrete GPU) may get i965: Failed to submit batchbuffer: Invalid argument. Try LIBGL_ALWAYS_SOFTWARE=1 ./EmuHawkMono.sh or otherwise setting that environment variable. (workaround found by @InfamousKnight)
  • Dialogs which pause emulation should cause the current frame to be redrawn to MainForm, but instead drawing stops and you get the solitaire effect. --yoshi at 268ab96
  • Possibly related, under Plasma Wayland on NixOS: "open file" dialogs sometimes result in empty black windows, which then become "infectious" and result in even the main window only showing black, which persists until user logout / compositor shutdown. --bugQ
  • Dropdowns not closing: WinForms - ToolStrip dropdowns do not close properly mono/mono#12644 --yoshi at 42fc895
    • workaround added in 653844e (sorry I didn't do that sooner --yoshi)
  • Controls in RecordMovie (dialog asking for filename and author for new movie) are misplaced, making keyboard navigation a requirement for recording movies (without TAStudio) --yoshi at 9e60927
  • If you get an error like "GDI+ status: InvalidParameter" at System.Drawing.Image.get_FrameDimensionsList, try updating libgdiplus.
  • Hard crash when clicking+dragging scrollbar in OpenFileDialog. Nothing in stdout or stderr. ¯\_(ツ)_/¯
    • Similarly, random hard crashes when clicking+dragging scrollbar in core settings dialogs, then moving cursor over the button of a dropdown menu without releasing the mouse button.
  • In Hex Editor, opening context menu causes scroll wheel and arrow keys to have no effect until the window is unfocused and refocused.
  • Log Window threading is fragile, see LogWindow something causes crash on Mono #2741.
  • Starting Mono while the solution is being rebuild will, rather than hitting the version check in EmuHawk.Program, cause Mono to segfault. (Not before init'ing GTK, though. I swear it's taunting me.)
  • May be NixOS-specific, but it seems idling with Lua scripts running+drawing but emulation paused causes the Lua Console (possible all WinForms UI?) to freeze, and unpausing emulation fixes it immediately...
    • It also seems to unpause for no reason? Does it think I closed a menu and it was only temp. paused?
  • RetroAchievements dialogs aren't great, but they are technically usable
  • From 2.10, SDL2 handles sleep prevention, but while it's implemented for Linux (X11), it's not working in practice. See BizHawk does not inhibit display or system sleep while running #3644 (comment).
  • PictureBox applies anti-aliasing/interpolation to pixel graphics: NES PPU Viewer's "zoom box" shouldn't be anti-aliased #3764
  • Buttons in some windows and dialogs are missing their labels. Possibly related to Japanese locale. Initially reported by @miyakut on Discord, running Mint. 404f28f didn't work and was reverted.
  • Lua Console REPL, and possibly elsewhere, doesn't accept numpad input. Repro'd on Ubuntu 22.04 but not NixOS.

Cores

Issues with Mupen

System.InvalidOperationException: got null pointer from dlopen, error: libmupen64plus.so.2: cannot open shared object file: No such file or directory (or, if standalone Mupen64Plus is installed, System.InvalidOperationException: got null pointer from dlopen, error: /usr/lib/mupen64plus: cannot read file data: Is a directory) from mupen64plusApi ctor --yoshi at 25a5449
fixed in 6e46cb5

Issues with TI83Hawk

  • IndexOutOfRangeException at BizHawk.Emulation.Cores.Calculators.TI83.ReadMemory(ushort) --yoshi at 25a5449

Building and packaging

Dependencies are being recorded (so build scripts can be made) in the GitLab mirror's snippets. On multi-arch distros, target x86_64/amd64.

For the record I've mostly focused on Manjaro (which I use), Nix/NixOS, Linux Mint, and Ubuntu. --yoshi

Bus error (core dumped) when building may be because you're out of disk space.

libblip_buf works as intended on both OSes, but the Makefile for Linux builds was hacked together (see libblip_buf issue tracker) and using the library in BizHawk was intended to be a temporary hack. The library has been rewritten as noted in #1312. Sappharad has previously attempted moving it to managed C#. It may be possible to use libspeex instead. they serve different purposes according to #3207 (comment) --yoshi

Don't know where else to leave these:

  • Debug P/Invokes (.dll/.so loading) with MONO_LOG_LEVEL=debug MONO_LOG_MASK=dll ./EmuHawkMono.sh --mono-no-redirect.
  • It seems libgdiplus.so doesn't support whatever the "PNG 256x256" mode of .icos is.

@nattthebear

This comment has been minimized.

@Sappharad

This comment has been minimized.

@alyosha-tas

This comment was marked as outdated.

@YoshiRulz

This comment has been minimized.

@Asnivor

This comment was marked as outdated.

@YoshiRulz

This comment was marked as outdated.

@Asnivor

This comment was marked as outdated.

@nattthebear

This comment has been minimized.

@Sappharad

This comment has been minimized.

@Asnivor

This comment has been minimized.

@nattthebear

This comment has been minimized.

@Asnivor

This comment has been minimized.

@YoshiRulz

This comment has been minimized.

@Asnivor

This comment has been minimized.

@nattthebear

This comment has been minimized.

@nattthebear

This comment has been minimized.

@Asnivor

This comment has been minimized.

@nattthebear

This comment has been minimized.

@lsthiros

This comment was marked as outdated.

@YoshiRulz

This comment has been minimized.

Asnivor added a commit to Asnivor/BizHawk that referenced this issue Jan 14, 2019
EmuHawk: SharpCompress implementation for Mono - TASEmulators#1430
Asnivor added a commit to Asnivor/BizHawk that referenced this issue Jan 15, 2019
…licks 'open firmware folder'. This mitigates the 'Folder open dialog crash' referenced in TASEmulators#1430
Asnivor added a commit to Asnivor/BizHawk that referenced this issue Jan 16, 2019
@YoshiRulz

This comment has been minimized.

@CasualPokePlayer
Copy link
Member

That seems very odd, it's for some reason failing here. This is also somehow after it works here, so ???

Could you try doing export SDL_VIDEO_X11_FORCE_EGL=0 before launching EmuHawkMono.sh and see if that ends up working?

@awsms
Copy link

awsms commented Nov 4, 2024

Could you try doing export SDL_VIDEO_X11_FORCE_EGL=0 before launching EmuHawkMono.sh and see if that ends up working?

That worked!

@CasualPokePlayer
Copy link
Member

Could you try doing export SDL_VIDEO_X11_FORCE_EGL=0 before launching EmuHawkMono.sh and see if that ends up working?

That worked!

That's odd, that's indicating that EGL seems to be initially succeeding but failing when trying to use it for a second window.

Best guess perhaps is SDL not cleaning up the window surface of the initial test window somehow interfering with this. Could you try replacing the libSDL2.so in the dll folder with this build and see if it works (without the export)? libSDL2.zip

@awsms
Copy link

awsms commented Nov 7, 2024

Replacing the lib with the one you linked gave me the same error (and as expected, it works if I override the SDL_VIDEO_X11_FORCE_EGL env variable):

OpenGL check for version 3.2 failed, underlying exception: System.Exception: Could not create SDL Window! SDL Error: Could not create GLES window surface
  at BizHawk.Bizware.Graphics.SDL2OpenGLContext..ctor (System.Int32 majorVersion, System.Int32 minorVersion, System.Boolean coreProfile) [0x0004a] in <5c4f421a02a9479ab97949d87d943696>:0 
  at BizHawk.Bizware.Graphics.OpenGLVersion.CheckVersion (System.Int32 requestedMajor, System.Int32 requestedMinor) [0x00007] in <5c4f421a02a9479ab97949d87d943696>:0

@CasualPokePlayer
Copy link
Member

Looking at BizHawk's code, I could perhaps actually be mislead by the issue, since the context creation might also fail in the static ctor, but it wouldn't be reported. This might be more a bug in BizHawk's fallback code, since it doesn't explicitly unload the library?

I've changed the code in the latest commit, see if a dev build here changes things?

@awsms
Copy link

awsms commented Nov 7, 2024

I've changed the code in the latest commit, see if a dev build here changes things?

I can confirm you it works now!

@awsms
Copy link

awsms commented Feb 5, 2025

Something broke very recently (using the build from https://nightly.link/TASEmulators/BizHawk/workflows/ci/master/BizHawk-dev-linux.zip):

console ``` ./EmuHawkMono.sh 20:40:26 Unknown distro, assuming system-wide libraries are in /usr/lib... (capturing output in /home/me/bizhawk/EmuHawkMono_last*.txt)

=================================================================
Native Crash Reporting

Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.

=================================================================
Native stacktrace:

0x5ab59469af19 - mono : 
0x5ab594644437 - mono : 
0x5ab5946898e5 - mono : 
0x704a1e739f0d - /home/me/bizhawk/dll/libSDL2.so : 
0x704a1e73f7a5 - /home/me/bizhawk/dll/libSDL2.so : 
0x704a1e73ed9e - /home/me/bizhawk/dll/libSDL2.so : 
0x704a1e711e73 - /home/me/bizhawk/dll/libSDL2.so : 
0x4101d143 - Unknown

=================================================================
Telemetry Dumper:

Pkilling 0x123463769519808x from 0x123463824393024x
Pkilling 0x123463653463744x from 0x123463824393024x
Entering thread summarizer pause from 0x123463824393024x
Finished thread summarizer pause from 0x123463824393024x.
Failed to create breadcrumb file (null)/crash_hash_0xc167ced16
NULL handle mono-state mem on freeing
NULL handle mono-state mem on freeing
NULL handle mono-state mem on freeing

Waiting for dumping threads to resume

=================================================================
External Debugger Dump:

[New LWP 1017493]
[New LWP 1017481]
[New LWP 1017480]

This GDB supports auto-downloading debuginfo from the following URLs:
https://debuginfod.archlinux.org
Enable debuginfod for this session? (y or [n]) [answered N; input not from terminal]
Debuginfod has been disabled.
To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit.
warning: File "/usr/bin/mono-sgen-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
add-auto-load-safe-path /usr/bin/mono-sgen-gdb.py
line to your configuration file "/home/me/.config/gdb/gdbinit".
To completely disable this security protection add
set auto-load safe-path /
line to your configuration file "/home/me/.config/gdb/gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual. E.g., run from the shell:
info "(gdb)Auto-loading safe path"
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
0x0000704a296f2be2 in ?? () from /usr/lib/libc.so.6
Id Target Id Frame

  • 1 Thread 0x704a29654340 (LWP 1017448) "mono" 0x0000704a296f2be2 in ?? () from /usr/lib/libc.so.6
    2 Thread 0x704a1f3516c0 (LWP 1017493) "mono" 0x0000704a296f2be2 in ?? () from /usr/lib/libc.so.6
    3 Thread 0x704a261ff6c0 (LWP 1017481) "Finalizer" 0x0000704a296f2be2 in ?? () from /usr/lib/libc.so.6
    4 Thread 0x704a28bff6c0 (LWP 1017480) "SGen worker" 0x0000704a296f2be2 in ?? () from /usr/lib/libc.so.6

Thread 4 (Thread 0x704a28bff6c0 (LWP 1017480) "SGen worker"):
#0 0x0000704a296f2be2 in ??? () at /usr/lib/libc.so.6
#1 0x0000704a296e6e33 in ??? () at /usr/lib/libc.so.6
#2 0x0000704a296e74bc in ??? () at /usr/lib/libc.so.6
#3 0x0000704a296e9c0e in pthread_cond_wait () at /usr/lib/libc.so.6
#4 0x00005ab5948fb855 in ??? ()
#5 0x0000704a296ea70a in ??? () at /usr/lib/libc.so.6
#6 0x0000704a2976eaac in ??? () at /usr/lib/libc.so.6

Thread 3 (Thread 0x704a261ff6c0 (LWP 1017481) "Finalizer"):
#0 0x0000704a296f2be2 in ??? () at /usr/lib/libc.so.6
#1 0x0000704a296e6e33 in ??? () at /usr/lib/libc.so.6
#2 0x0000704a296e74bc in ??? () at /usr/lib/libc.so.6
#3 0x0000704a296f2ae8 in ??? () at /usr/lib/libc.so.6
#4 0x00005ab59489f6a6 in ??? ()
#5 0x00005ab594853b11 in ??? ()
#6 0x0000704a296ea70a in ??? () at /usr/lib/libc.so.6
#7 0x0000704a2976eaac in ??? () at /usr/lib/libc.so.6

Thread 2 (Thread 0x704a1f3516c0 (LWP 1017493) "mono"):
#0 0x0000704a296f2be2 in ??? () at /usr/lib/libc.so.6
#1 0x0000704a296e6e33 in ??? () at /usr/lib/libc.so.6
#2 0x0000704a296e74bc in ??? () at /usr/lib/libc.so.6
#3 0x0000704a296e9e11 in pthread_cond_timedwait () at /usr/lib/libc.so.6
#4 0x00005ab59490f7a0 in ??? ()
#5 0x00005ab594919536 in ??? ()
#6 0x00005ab5947de7e9 in ??? ()
#7 0x0000000040fbefb6 in ??? ()
#8 0x0000704a28f47f08 in ??? ()
#9 0x0000704a28f48090 in ??? ()
#10 0x0000704a28f47e88 in ??? ()
#11 0x0000704a28f47f58 in ??? ()
#12 0x0000704a28f47e88 in ??? ()
#13 0x0000704a18002510 in ??? ()
#14 0x0000704a1f350a10 in ??? ()
#15 0x0000704a1f350840 in ??? ()
#16 0x0000704a1f350a10 in ??? ()
#17 0x0000704a2639189b in ??? () at /usr/lib/mono/4.5/mscorlib.dll.so
#18 0x0000000000001388 in ??? ()
#19 0x0000704a26391870 in ??? () at /usr/lib/mono/4.5/mscorlib.dll.so
#20 0x0000704a1f350a10 in ??? ()
#21 0x0000000040fb61db in ??? ()
#22 0x0000704a28f48198 in ??? ()
#23 0x0000704a28f481d8 in ??? ()
#24 0x0000704a28f48338 in ??? ()
#25 0x0000704a28f48198 in ??? ()
#26 0x0000704a28f48338 in ??? ()
#27 0x0000704a28f48338 in ??? ()
#28 0x0000704a28f481d8 in ??? ()
#29 0x0000000000000000 in ??? ()

Thread 1 (Thread 0x704a29654340 (LWP 1017448) "mono"):
#0 0x0000704a296f2be2 in ??? () at /usr/lib/libc.so.6
#1 0x0000704a296e6e33 in ??? () at /usr/lib/libc.so.6
#2 0x0000704a296e6e74 in ??? () at /usr/lib/libc.so.6
#3 0x0000704a29757d6f in wait4 () at /usr/lib/libc.so.6
#4 0x00005ab59469b1a6 in ??? ()
#5 0x00005ab594644437 in ??? ()
#6 0x00005ab5946898e5 in ??? ()
#7 0x0000704a1e739f0d in ??? () at /home/me/bizhawk/dll/libSDL2.so
#8 0x0000704a1e73f7a5 in ??? () at /home/me/bizhawk/dll/libSDL2.so
#9 0x0000704a1e73ed9e in ??? () at /home/me/bizhawk/dll/libSDL2.so
#10 0x0000704a1e711e73 in ??? () at /home/me/bizhawk/dll/libSDL2.so
#11 0x000000004101d143 in ??? ()
#12 0x00005ab5b50e11c0 in ??? ()
#13 0x00007fff17fe1408 in ??? ()
#14 0x00007fff17fe1480 in ??? ()
#15 0x00005ab5b46a9760 in ??? ()
#16 0x000000004101c650 in ??? ()
#17 0x0000704a29594208 in ??? ()
#18 0x00007fff17fe10e0 in ??? ()
#19 0x00007fff17fe1518 in ??? ()
#20 0x00007fff17fe10e0 in ??? ()
#21 0x00007fff17fe0fb0 in ??? ()
#22 0x000000004101cf20 in ??? ()
#23 0x0000000000000000 in ??? ()
[Inferior 1 (process 1017448) detached]
NULL handle mono-state mem on freeing

=================================================================
Basic Fault Address Reporting

Memory around native instruction pointer (0x704a1e739f0d):0x704a1e739efd 45 85 f6 7f ce 48 8b 45 30 4a 8b 04 f8 48 8b 00 E....H.E0J...H..
0x704a1e739f0d 4c 8b a0 d8 00 00 00 49 8b 74 24 08 49 8b 84 24 L......I.t$.I..$
0x704a1e739f1d e0 00 00 00 4c 8b 30 4c 89 f7 ff 15 03 52 0b 00 ....L.0L.....R..
0x704a1e739f2d 48 85 c0 0f 85 63 ff ff ff 48 89 df 31 c0 e8 c0 H....c...H..1...

=================================================================
Managed Stacktrace:

  at <unknown> <0xffffffff>
  at SDL2.SDL:INTERNAL_SDL_GL_LoadLibrary <0x00082>
  at SDL2.SDL:SDL_GL_LoadLibrary <0x0001f>
  at BizHawk.Bizware.Graphics.SDL2OpenGLContext:.cctor <0x003ab>
  at System.Object:runtime_invoke_void <0x0006e>
  at <unknown> <0xffffffff>
  at System.Object:__icall_wrapper_mono_generic_class_init <0x00056>
  at BizHawk.Bizware.Graphics.OpenGLVersion:CheckVersion <0x00087>
  at <>c:<SupportsVersion>b__3_0 <0x00037>
  at BizHawk.Common.CollectionExtensions.CollectionExtensions:GetValueOrPut <0x0004d>
  at BizHawk.Bizware.Graphics.OpenGLVersion:SupportsVersion <0x0011b>
  at BizHawk.Bizware.Graphics.IGL_OpenGL:get_Available <0x00013>
  at <>c__DisplayClass4_0:<SubMain>g__TryInitIGL|1 <0x002ab>
  at BizHawk.Client.EmuHawk.Program:SubMain <0x00dab>
  at BizHawk.Client.EmuHawk.Program:Main <0x0000f>
  at <Module>:runtime_invoke_int_object <0x00104>

=================================================================
fish: Job 1, './EmuHawkMono.sh' terminated by signal SIGABRT (Abort)

</details>

@CasualPokePlayer
Copy link
Member

To be clear, does this also happen with 2.10?

@bigbass1997
Copy link

Something broke very recently (using the build from https://nightly.link/TASEmulators/BizHawk/workflows/ci/master/BizHawk-dev-linux.zip):

I can't reproduce (Ubuntu 24.04.1). What linux version/distro are you using? Does this crash happen immediately when opening BizHawk, or only after a certain action?

@awsms
Copy link

awsms commented Feb 5, 2025

You guys are right, 2.10 doesn't work either anymore, crashing with the same output.
There was recently a change in how SDL2/SDL2-compat are handled in the Arch Linux repository. Maybe it could due to that?
I'm running EndeavourOS, and yes this crash happens immediately after running the execution script.
I've also recently updated my NVIDIA drivers to 570.86.16, will try downgrading them.
edit: downgrading to 565 made the NVIDIA module unloadable. However, I can confirm bizhawk LAUNCHES when NVIDIA modules aren't loaded.
edit2: I got it to work on sway (Wayland), with the NVIDIA modules loaded! It won't run on i3 (X11).

to recap: NVIDIA+i3 = doesn't work.
NVIDIA+sway = works.
no NVIDIA+i3 = works.

@CasualPokePlayer
Copy link
Member

sdl2-compat doesn't matter as BizHawk uses its own vendored SDL2 (for good reason, we cannot rely on system packages being up to date enough for some rather bleeding edge "features" (or more bugfixes) being used).

I would suspect this is just a driver bug here regardless. Something to possibly try is pass the env var SDL_VIDEO_X11_FORCE_EGL=0

@awsms
Copy link

awsms commented Feb 5, 2025

sdl2-compat doesn't matter as BizHawk uses its own vendored SDL2 (for good reason, we cannot rely on system packages being up to date enough for some rather bleeding edge "features" (or more bugfixes) being used).

I would suspect this is just a driver bug here regardless. Something to possibly try is pass the env var SDL_VIDEO_X11_FORCE_EGL=0

SDL_VIDEO_X11_FORCE_EGL=0 ./EmuHawkMono.sh works in the NVIDIA+i3 environment! Phew 😄

@CasualPokePlayer
Copy link
Member

CasualPokePlayer commented Feb 5, 2025

Yeah, BizHawk will try to use EGL first with SDL before falling back on GLX with SDL if that does not work. In this case, sounds like EGL driver code is bugged for pure X11 somehow and ends up crashing (instead of doing something sane like fail gracefully allowing for an automatic fallback)

@thecnoNSMB
Copy link

thecnoNSMB commented Feb 9, 2025

sdl2-compat doesn't matter as BizHawk uses its own vendored SDL2 (for good reason, we cannot rely on system packages being up to date enough for some rather bleeding edge "features" (or more bugfixes) being used).

I would suspect this is just a driver bug here regardless. Something to possibly try is pass the env var SDL_VIDEO_X11_FORCE_EGL=0

This doesn't fix the issue for me, instead it produces an exciting new error:

System.Exception: Could not create GL Context! SDL Error: Could not make GL context current: BadMatch (invalid parameter attributes)
  at BizHawk.Bizware.Graphics.SDL2OpenGLContext.CreateContext () [0x00032] in <10eacaf20a4647c8b77e54c6b59913b9>:0 
  at BizHawk.Bizware.Graphics.SDL2OpenGLContext..ctor (System.IntPtr nativeWindowhandle, System.Int32 majorVersion, System.Int32 minorVersion, System.Boolean coreProfile) [0x00053] in <10eacaf20a4647c8b77e54c6b59913b9>:0 
  at BizHawk.Bizware.Graphics.Controls.OpenGLControl.OnHandleCreated (System.EventArgs e) [0x0000e] in <9f51c07612f142ab9470c82201b4e79c>:0 
  at System.Windows.Forms.Control.WmCreate (System.Windows.Forms.Message& m) [0x00000] in <f48fa8012e0640dab31cb271f884a65c>:0 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x001d7] in <f48fa8012e0640dab31cb271f884a65c>:0 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <f48fa8012e0640dab31cb271f884a65c>:0 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x0000b] in <f48fa8012e0640dab31cb271f884a65c>:0 
  at System.Windows.Forms.NativeWindow.WndProc (System.IntPtr hWnd, System.Windows.Forms.Msg msg, System.IntPtr wParam, System.IntPtr lParam) [0x0008e] in <f48fa8012e0640dab31cb271f884a65c>:0 
BizHawk has completed its shutdown routines, killing process...
Killed

ninja edit because i forgot: I'm running Nobara (Fedora) 41, KDE, Wayland, on an Nvidia GPU.

@CasualPokePlayer
Copy link
Member

This is a known issue, and is specifically what using EGL is supposed to fix (because another driver bug making GLX not work for whatever reason)

To be clear, you're running Wayland here (or more XWayland in this case), which reportedly didn't have this issue. So you have the above issue now with Wayland???

@thecnoNSMB
Copy link

Apparently so, unfortunately. Is there any diagnostics I could do that might provide more information?

@CasualPokePlayer
Copy link
Member

You could pass --gdi as a CLI arg to force the display method over to GDI+, which should "work" (but will be fairly slower, especially for fast forward speed).

@Martmists-GH
Copy link

For the issues with the Nvidia driver on Wayland it might be worth setting __GL_THREADED_OPTIMIZATIONS=0 and seeing if that changes anything.

@champred
Copy link

champred commented Feb 9, 2025

Is there a solution for getting custom fonts to work on Ubuntu (24.04)? I have it installed to /usr/share/fonts/truetype, and it is present in fc-list, but it doesn't appear to be rendered correctly when attempting to use through Lua. Any suggestions are appreciated.

Edit: using 2.10 release

@thecnoNSMB
Copy link

thecnoNSMB commented Feb 9, 2025

This is a known issue, and is specifically what using EGL is supposed to fix (because another driver bug making GLX not work for whatever reason)

To be clear, you're running Wayland here (or more XWayland in this case), which reportedly didn't have this issue. So you have the above issue now with Wayland???

It seems to have mysteriously fixed itself with a reboot. Maybe it breaks after sleep and wake, but in that case it seems unlikely that's Bizhawk's bug. (whoops, I was wrong, see below)

@thecnoNSMB
Copy link

thecnoNSMB commented Feb 10, 2025

You could pass --gdi as a CLI arg to force the display method over to GDI+, which should "work" (but will be fairly slower, especially for fast forward speed).

Nevermind my previous comment, it fixed itself after applying this argument, even though something in the script complains Failed to load --gdi specified on commandline. So the core OpenGL issue is still present.

@CasualPokePlayer
Copy link
Member

CasualPokePlayer commented Feb 10, 2025

Failed to load --gdi specified on commandline is probably due to the hacky-ish nature of how that's implemented, which is checked at a point before the usual CLI args (due to how early that has to be applied)

@YoshiRulz
Copy link
Member Author

#4201

@YoshiRulz
Copy link
Member Author

YoshiRulz commented Feb 10, 2025

Is there a solution for getting custom fonts to work on Ubuntu (24.04)? I have it installed to /usr/share/fonts/truetype, and it is present in fc-list, but it doesn't appear to be rendered correctly when attempting to use through Lua. Any suggestions are appreciated.

Edit: using 2.10 release

@champred CNR on Ubuntu 22.04. Do you mean the font is rendering incorrectly (expected due to aliasing, window scale, and A.R. correction) or not at all?

@champred
Copy link

champred commented Feb 10, 2025

CNR on Ubuntu 22.04. Do you mean the font is rendering incorrectly (expected due to aliasing, window scale, and A.R. correction) or not at all?

dd88ce35-a407-45cc-9fb9-41ae015c13ec.jpg

Here's a picture of what it looks like. Apologies for the poor quality, as this is running on Steam Deck (using distrobox). It seems to be using some default fallback font. Although if it's just an aliasing issue it's possible there's a setting I could change?

@YoshiRulz
Copy link
Member Author

I mean it resembles Franklin Gothic. You can check by passing a nonexistent font and observing the difference.

I believe even the rewrite doesn't support anti-aliasing, sorry.

@CasualPokePlayer
Copy link
Member

gui.drawText still just uses GDI+ which on Linux is just still whatever shoddy half-baked implementation libgdiplus provides.

@awsms
Copy link

awsms commented Feb 11, 2025

Is there a reason why the N64 ares core in bizhawk is significantly slower than ares-emu's own N64 core? I assumed perfs would be identical since the core is the same.
edit: never tried the Windows version of bizhawk, but I assumed it was only the case on Linux

@CasualPokePlayer
Copy link
Member

parallel-rdp, which upstream ares uses, is swapped out with angrylion. parallel-rdp uses the GPU to render while angrylion does everything on the CPU. For technical reasons (mainly to do with waterboxing) this swap is "required" so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
App: EmuHawk Relating to EmuHawk frontend Meta Relating to code organisation or to things that aren't code re: Multiplatform Relating to porting to Linux (or macOS, etc.), or porting to other host architectures
Projects
None yet
Development

No branches or pull requests