On 2018-08-19 10:34:51, Jeremy Evans <jer...@openbsd.org> wrote:
> This upgrades mednafen to the latest released version.  Initial diff
> from an...@disroot.org, some changes by me.  I tested most of the
> emulator types, and all appear to work except SNES, which crashes for me
> right after the window opens, with no useful debug output.  Not sure if
> that is a regression or not, or if it is due to my video card. I
> generally use snes9x for SNES emulation.
> 
> Ports-wise, the main change is that mednafen now requires SDL2.
> 
> OKs?
> 

I see the same crash with SNES emulation, but the old version
crashed too, so that's not a regression.

Sound doesn't work though.

        Initializing sound...
        Using "OpenBSD(/dev/audio*)" audio driver with SexyAL's default
        device selection.OpenBSD Audio Error: fd = open(id ? id :
        "/dev/audio", O_WRONLY) No such file or directory
        Error opening a sound device.

        [...]

        % ls -la /dev/audio
        ls: /dev/audio: No such file or directory

I removed this link according to current.html which says the
following:

        2018/07/29 - Remove /dev/audio and /dev/audioctl

        The /dev/audio and /dev/audioctl symbolic links are not
        used anymore and can be removed:
        # rm /dev/audio /dev/audioctl

So I had to apply the following patch to get sound.

Index: src/sexyal/drivers/openbsd.cpp
--- src/sexyal/drivers/openbsd.cpp.orig
+++ src/sexyal/drivers/openbsd.cpp
@@ -165,7 +165,7 @@ SexyAL_device* SexyALI_OpenBSD_Open(const char* id, Se
 
  AUDIO_INITPAR(&par);
 
- OBSD_TRY(fd = open(id ? id : "/dev/audio", O_WRONLY));
+ OBSD_TRY(fd = open(id ? id : "/dev/audio0", O_WRONLY));
 
  par.bits = SAMPFORMAT_BITS(format->sampformat);
  par.bps = SAMPFORMAT_BYTES(format->sampformat);

This got sound working for me, but I'm not sure how good of a
solution it actually is.  If anyone has multiple sound cards, then
it would hardcode it to only work with /dev/audio0

A proper solution would probably be writing a proper sndio backend
for it, but I'm not sure how much work that would actually entail.

Failing that, I suppose another option would be to leave things
as-is, and adding a MESSAGE telling the user to create the
/dev/audio link manually.


A final, and somewhat hackish solution (but still probably the
best option if it could be made to work) would be to add something
like the following patch (NOT WORKING IN ITS CURRENT STATE!).

Index: src/sexyal/drivers/openbsd.cpp
--- src/sexyal/drivers/openbsd.cpp.orig
+++ src/sexyal/drivers/openbsd.cpp
@@ -165,7 +165,7 @@ SexyAL_device* SexyALI_OpenBSD_Open(const char* id, Se
 
  AUDIO_INITPAR(&par);
 
  OBSD_TRY(fd = open(id ? id : "/dev/audio", O_WRONLY));
+ OBSD_TRY(fd = open(id ? id : "/dev/audio0", O_WRONLY));
+ OBSD_TRY(fd = open(id ? id : "/dev/audio1", O_WRONLY));
+ OBSD_TRY(fd = open(id ? id : "/dev/audio2", O_WRONLY));
+ OBSD_TRY(fd = open(id ? id : "/dev/audio3", O_WRONLY));
 
  par.bits = SAMPFORMAT_BITS(format->sampformat);
  par.bps = SAMPFORMAT_BYTES(format->sampformat);

So that it would check the /dev/audio link first, and then choose
the first audio device that sucessfully opens if there's no
/dev/audio link.

That way, it would work for most people by choosing audio0, but
could be overridden with a /dev/audio link for those who want to
point it to a different device.


All in all, I've lightly tested the update, and it seems to work
fine for me with NES emulation at least.  With my patch, audio
works, as well as video, a USB gamepad, and everything else.

Since you're the maintainer, I'll defer to your judgement on how
to best handle the audio patching.

Anyway, thanks for the update!

-- 
Bryan

Reply via email to