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
37 of 43 tasks
YoshiRulz opened this issue Jan 7, 2019 · 276 comments
Open
37 of 43 tasks

[🐧] GNU+Linux compatibility progress #1430

YoshiRulz opened this issue Jan 7, 2019 · 276 comments
Labels
App: EmuHawk Relating to EmuHawk frontend Meta Relating to code organisation or to things that aren't code re: Multiplatform Relating to the Linux and macOS ports (Mono Framework, and eventually .NET Core)

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.9.1, the following systems can be emulated:

  • 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
  • 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
  • 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 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)

These systems haven't been tested or aren't finished:

  • 3DS with Encore (I don't have roms --yoshi)
  • Amiga with PUAE (unreleased core)
  • Amstrad CPC with CPCHawk (unreleased core)
  • Channel F with ChannelFHawk (I don't have roms --yoshi)
  • N64DD with Ares64 (I don't have roms --yoshi)
  • Sega Pico with Genplus-gx (I don't have roms --yoshi)

These features/subsystems work:

  • The core lifecycle i.e. loading roms (for the systems noted above)
  • Savestates
  • Virtual Pad
  • Tool Box
  • Lua Console (scripts can load, YMMV)
  • Config > Controllers... and Config > Hotkeys...
    • Keyboard, mouse, and gamepad inputs, and from 2.10, haptic feedback
  • Config > Display...
  • Config > Sound...
  • Config > Paths...
  • Config > Firmwares...
  • Config > Autofire...
  • Config > Customize...
  • Config > Profiles...
  • Core selector (Config > Cores)
  • View > Window Size
  • Misc. OSD layers under View
  • Lua (from 2.9, same as Windows, before 2.9 see [🐧] Lua in Mono megathread #2951)
  • External tools (ApiHawk)
  • Movie playback, "traditional" movie recording
  • TAStudio (basic functionality is good)
  • Tools > RAM Watch
  • Hex Editor (works as of 625c657)
  • RAM Search
  • Tools > Cheats (does not crash)
  • Basic Bot (opens as of 1dbcdcd)
  • RetroAchievements
@YoshiRulz
Copy link
Member Author

YoshiRulz commented Jan 7, 2019

Issues with EmuHawk

Startup issues:

  • An InvalidOperationException with "Error compiling shader", "syntax error, unexpected KW_SAMPLER_STATE" (stacktrace will include the IGL_SlimDX9.CreateVertexShader method, which has since been removed): Seems to be a bug in WINE's GPU drivers. WINE is not supported, so just stop using it and you won't hit this.
  • 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.
    • 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
  • 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.9.2, 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.

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

CasualPokePlayer commented Aug 17, 2024

Pure Wayland (no X11) would just be completely unsupported in multiple ways currently. Not sure why exactly SDL is not liking your system here (the GL failures might also be related to loading a rom failing due to the NDS core also attempting to create a GL context itself, although that is supposed to fallback on no GL if needed...), might not be an issue for other cores.

EDIT: Note, the stable release does not use SDL2 at all. Also the SDL2 built for BizHawk which BizHawk will use is explicitly built with no Wayland support (since it wouldn't work anyways as the "foreign window" given to SDL2 for purposes of an OpenGL context would be an X Window not a Wayland one).

@bigbass1997
Copy link

Starting in Ubuntu 24.04, the dotnet-sdk package distributed by Ubuntu no longer contains the Microsoft.NET.Sdk.WindowsDesktop SDK, which is required by BizHawk.

With the dotnet-sdk-8.0 package installed via apt, the build process will spit out several errors like this (full output):

/usr/lib/dotnet/sdk/8.0.108/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(1355,3): error MSB4019: The imported project "/usr/lib/dotnet/sdk/8.0.108/Sdks/Microsoft.NET.Sdk.WindowsDesktop/targets/Microsoft.NET.Sdk.WindowsDesktop.targets" was not found. Confirm that the expression in the Import declaration ";/usr/lib/dotnet/sdk/8.0.108/Sdks/Microsoft.NET.Sdk/targets/../../Microsoft.NET.Sdk.WindowsDesktop/targets/Microsoft.NET.Sdk.WindowsDesktop.targets" is correct, and that the file exists on disk. [/opt/emulators/bizhawk-master/src/BizHawk.WinForms.Controls/BizHawk.WinForms.Controls.csproj]

dotnet/core#9258 discusses the change in more detail. The above issue in particular is shared in this comment.

The "fix" for now is to remove dotnet-sdk-8.0 (and associated dotnet packages), and then install using the shell script.

I didn't test the Snap package, but according to the github discussion the Snap package will now be built by Canonical instead of Microsoft. So I would expect this issue to apply to Snap as well.


Reproduction Steps

Problem should only exist on Ubuntu 24.04 (noble) based distributions.

  1. Clone BizHawk repo as normal
  2. Install dotnet via sudo apt install dotnet-sdk-8.0
  3. Run Dist/BuildRelease.sh (or any other build script)

@YoshiRulz
Copy link
Member Author

Yet another reason to not use Ubuntu

At least it only affects compilation and not running? I have seen that reported in other places too though, it seems fairly prevalent.

@bigbass1997
Copy link

Yep only compilation as far as I can tell.

@CasualPokePlayer
Copy link
Member

CasualPokePlayer commented Sep 4, 2024

@Martmists-GH your OpenGL issue should be fixed with 60fae35

For the theme issue, try setting the GTK_DATA_PREFIX environment variable to nothing (e.g. add export GTK_DATA_PREFIX= to the EmuHawkMono.sh script)

@BRQuad
Copy link

BRQuad commented Sep 17, 2024

  • TAStudio unusable with Encore
  • Font setting not saved
  • Invisible buttons in the open dialog

@CasualPokePlayer
Copy link
Member

  1. Elaborate on "unusable." If you are referring to the lack of rampant automatic stating, that is intentional, you have to create markers and branches for greenzone to be created (greenzone will be created near those).
  2. Not sure what you are referring to by "font setting"
  3. See above comment with GTK_DATA_PREFIX.

@BRQuad
Copy link

BRQuad commented Sep 18, 2024

In a new TAStudio project, if i click one time in the A column, the processor is saturated (2 cores/6), i can't use my PC anymore, i must disconnect myself, and then kill the mono process.
The font setting is the one in TAStudio (config > Set font).
I added export GTK_DATA_PREFIX= (without value ?) in EmuHawkMono.sh but the problem persists.

@Jakeory1
Copy link

This issues has been mentioned here already:
#1430 (comment)

I just want to bring it back up to ask if there is a hotfix. Also, if there might be a way to fix this in the next version of BizHawk, this might serve as a small reminder, in case you happen to work on something related anyways.

Summary
Text drawn by a lua script has bad quality because of the way it is rendered.
This is the case for many linux distros. E.g. Mint 22 Cinnamon 6.2.9, Wayland and the latest Debian KDE Plasma.
But it was fine (iirc) in Mint 21.3 Cinnamon, Wayland.

If the comments already explained a fix, it would be great if someone could explain further!

@CasualPokePlayer
Copy link
Member

CasualPokePlayer commented Sep 20, 2024

Any gui string lua function outside of gui.text is handled by GDI+. On Windows this performs as you expect as GDI+ is on Windows. On Linux, this performs badly, as GDI+ is a Window specific library, so Mono reimplements it (as libgdiplus). This reimplementation is incomplete, spotty and outright buggy in some cases, and there isn't anything that can be done about that. At some point in the future, gui.pixelText could probably be easily brought into the newer ImGui hw accelerated handling, which could help here. gui.drawText is unlikely ever going to work well in the foreseeable future (unless we somehow get that working with the new system). gui.text just reuses BizHawk's OSD message system, so it is unaffected by this kind of issue.

@YoshiRulz
Copy link
Member Author

@BRQuad The unlabelled buttons in file open dialogs is a known issue, which I believe can be fixed by finding the package which provides libgtk-x11-2.0.so.0.

@BRQuad
Copy link

BRQuad commented Sep 23, 2024

This lib is included in libgtk2.0-0 located in /usr/lib/x86_64-linux-gnu, and it is installed.
The buttons are square, thus it would be more an icon issue than a label issue.

@awsms
Copy link

awsms commented Oct 28, 2024

I'm unable to use OpenGL on the latest dev build:
System.Exception: Initialization of OpenGL Display Method failed; falling back to GDI+
I don't see any other errors (stderr.txt is empty). It worked on the bizhawk-bin package (2.9.1 build).
Looks like the program doesn't use the NVIDIA GPU at all, as it doesn't appear in nvidia-smi's output.
Setup: NVIDIA 4070 (laptop) + AMD APU, EndeavourOS
Launching bizhawk by simply running ./EmuHawkMono.sh from the dev build.

@CasualPokePlayer
Copy link
Member

CasualPokePlayer commented Oct 28, 2024

Does stdout.txt have anything?

@awsms
Copy link

awsms commented Oct 28, 2024

Does stdout.txt have anything?

Its content:

Using SDL2 for host input (keyboard + gamepads)
Connected SDL gamepad, device index 0, instance ID 1, name Xbox 360 Controller
Disconnecting SDL gamepad, device index 0, instance ID 1, name Xbox 360 Controller
BizHawk has completed its shutdown routines, killing process...

@YoshiRulz
Copy link
Member Author

Did you download the dev build manually or via makepkg? The build script on the AUR may be doing something that's necessary, IDK, I haven't checked on it in a while.

@awsms
Copy link

awsms commented Oct 29, 2024

Did you download the dev build manually or via makepkg? The build script on the AUR may be doing something that's necessary, IDK, I haven't checked on it in a while.

Yeah I took the existing PKGBUILD, and tweaked it for the dev build.
Even if I dl the 2.9.1 release from gh, extract it, and run the shell script without any prior config, OpenGL works just fine.
But there is something wrong in the dev one for me, unfortunately there are no verbose errors :(

@hhirtz
Copy link

hhirtz commented Oct 29, 2024

I get the same opengl error as #1430 (comment) with a AMD radeon, sway, archlinux and the 2.10-rc release tarball.

Then when GDI is used, this error happens:

X11 Error encountered: 
  Error: BadMatch (invalid parameter attributes)
  Request:     12 (0)
  Resource ID: 0x4000A4
  Serial:      6502
  Hwnd:        Hwnd, Mapped:True ClientWindow:0x4000A5, WholeWindow:0x4000A4, Zombie=False, Parent:[Hwnd, Mapped:True ClientWindow:0x4000A7, WholeWindow:0x4000A6, Zombie=False, Parent:[<null>]]
  Control:     BizHawk.Bizware.Graphics.Controls.GDIPlusControl  at System.Environment.get_StackTrace () [0x00000] in <296872a6734f443990477e3abd954b57>:0 
  at System.Windows.Forms.XplatUIX11.HandleError (System.IntPtr display, System.Windows.Forms.XErrorEvent& error_event) [0x00000] in <c87c1b414e134a3b85f757beb69a2505>:0 
  at System.Windows.Forms.XplatUIX11.XGetWindowProperty (System.IntPtr , System.IntPtr , System.IntPtr , System.IntPtr , System.IntPtr , System.Boolean , System.IntPtr , System.IntPtr& , System.Int32& , System.IntPtr& , System.IntPtr& , System.IntPtr& ) [0x00000] in <c87c1b414e134a3b85f757beb69a2505>:0 
  at System.Windows.Forms.XplatUIX11.GetActive () [0x00000] in <c87c1b414e134a3b85f757beb69a2505>:0 
  at System.Windows.Forms.XplatUI.GetActive () [0x00000] in <c87c1b414e134a3b85f757beb69a2505>:0 
  at System.Windows.Forms.Form.get_ActiveForm () [0x00000] in <c87c1b414e134a3b85f757beb69a2505>:0 
  at BizHawk.Client.EmuHawk.Input.UpdateThreadProc () [0x00000] in <04399846313242f4a77521075d3a9e24>:0 
  at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00000] in <296872a6734f443990477e3abd954b57>:0 
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <296872a6734f443990477e3abd954b57>:0 
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <296872a6734f443990477e3abd954b57>:0 
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x00000] in <296872a6734f443990477e3abd954b57>:0 
  at System.Threading.ThreadHelper.ThreadStart () [0x00000] in <296872a6734f443990477e3abd954b57>:0 

On the same machine, bizhawk 2.9.1 from aur crashes on resize (any window, lua console resize will crash bizhawk for example) and freezes indefinitely so i have to killall mono or hit Ctrl-C. This happens only when a ROM is loaded. No errors in logs.

On another machine (Intel gpu+sway+archlinux) bizhawk 2.9.1 worked fine (with OpenGL at least, haven't tested GDI).

@CasualPokePlayer
Copy link
Member

The GDI error I would assume is perhaps something the hottest new XWayland is getting horribly wrong, unsure what would be going wrong with OpenGL.

@CasualPokePlayer
Copy link
Member

CasualPokePlayer commented Oct 30, 2024

Relooking at what the core for OpenGL actually does, the exception message is actually just coming from here. This is indicating just creating an OpenGL 3.2 Core context is failing for some reason.

I've pushed a change to actually log the error, please re-check on the latest dev build.

@hhirtz
Copy link

hhirtz commented Oct 30, 2024

Thank you, the problem was that I had a SDL_VIDEODRIVER=wayland in my environment. I changed it to SDL_VIDEODRIVER=wayland,x11 and opengl worked.

OpenGL check for version 3.2 failed, underlying exception: System.TypeInitializationException: The type initializer for 'BizHawk.Bizware.Graphics.SDL2OpenGLContext' threw an exception. ---> System.Exception: Could not init SDL video! SDL Error: wayland not available
  at BizHawk.Bizware.Graphics.SDL2OpenGLContext..cctor () [0x0004b] in <bbc4fed5ee5441da8324ddef167733e9>:0 
   --- End of inner exception stack trace ---
  at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)
  at BizHawk.Bizware.Graphics.OpenGLVersion.CheckVersion (System.Int32 requestedMajor, System.Int32 requestedMinor) [0x00007] in <bbc4fed5ee5441da8324ddef167733e9>:0 

@CasualPokePlayer
Copy link
Member

That's strange, I intentionally ensure x11 is set for that hint here, an environment variable overrides it? I would guess might need to clear out the environment variable too in BizHawk's code.

@hhirtz
Copy link

hhirtz commented Oct 30, 2024

yeah it seems env vars have higher priority than SetHint:
https://wiki.libsdl.org/SDL2/SDL_SetHint#remarks

@CasualPokePlayer
Copy link
Member

6578c85 hopefully should fix this.

CasualPokePlayer referenced this issue Oct 30, 2024
ensures calls actually do something and won't be ignored due to env vars
@CasualPokePlayer
Copy link
Member

@awsms To be clear, did the above commit (i.e. latest dev build) fix your issue?

@awsms
Copy link

awsms commented Nov 4, 2024

@awsms To be clear, did the above commit (i.e. latest dev build) fix your issue?

Nope. However, I do have a visible error in stderr now:

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 <6d86480a70a14f6c8bf4143e01cea68b>:0 
  at BizHawk.Bizware.Graphics.OpenGLVersion.CheckVersion (System.Int32 requestedMajor, System.Int32 requestedMinor) [0x00007] in <6d86480a70a14f6c8bf4143e01cea68b>:0 

@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!

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 the Linux and macOS ports (Mono Framework, and eventually .NET Core)
Projects
None yet
Development

No branches or pull requests