Alright, here's the new driver selection window. No more fucking with system.video.
The reason I require a restart is because I now hide all UI elements and such for unsupported features of drivers. No more "why doesn't point / linear do anything when I'm using DirectDraw" questions. I don't have a way to hude menu items
after creation on Windows menus just yet, so I can't do it dynamically. And it's also part of the way the crash handler works.
I show the current driver caps, rather than the selected driver caps, because it's possible that some caps can only be detected after driver initialization. The device drivers also perform some setup on construction, and the cap() functions cannot be static and virtual at the same time. It's also a nice way to remind one what the active driver is in case they change it and go back to the panel.
And yes, there's a "None" driver for each in that list. No, I really don't care that nobody will ever play bsnes without video / sound / input. They stay, they're very useful for determining how much overhead each driver adds, and there's always a chance there's a system that has issues with all drivers, eg OpenSolaris not having audio support right now, or something. The name says "None", if someone is too stupid to understand what that means, TFB. You can't even
see the option unless you drop down the combobox, so you can hardly call it clutter.
Also, I can't make the text black for the checkboxes. GTK+ will auto uncheck the boxes when clicked if they're left enabled. Windows, you can at least stop it. And I'm not going to auto re-check / uncheck boxes to what the values should be. Nor do I want idiot users thinking you can add capabilities to your hardware by toggling checkboxes.
Haven't looked on Windows, hopefully they're smart enough to not gray out the text, too.
So, don't ask me to change that stuff. Not going to happen.
You can try and talk me out of the second text line in the note section, if you like.
Next up, the crash handler itself.
If you select a driver, and bsnes crashes on startup, then you can start the emulator again and you get the above window. It's only that window, the main window is not visible. You can change the driver, close the window (which closes the program), and then restart bsnes.
No, I'm not going to resume the program after closing the crash handler window, because the GUI setup depends on the drivers chosen, and the drivers chosen might be the ones crashing things in the first place. I avoid initializing the drivers, and thus all the menu / window setup, to avoid the crashing.
Again, much more work to get around than it's worth. I imagine ~1% of users will ever even see this screen anyway.
Note that this window isn't for my own 'buggy' code crashing, it's for the driver APIs themselves crashing. Xorg is really bad at that. You get a valid adapter, pass it a valid value, and it crashes with a BadMatch. Yes, I know those can be caught. But it shouldn't by default hard crash your app. That's what return codes are for. I'll work on hooking the Xorg crash handler in the future to avoid it, but for now -- this is a nice backup plan.
It's needed because if your driver crashes, then you restart, it'll just keep crashing in a loop, forcing you to edit the config file by hand. That sucks, so this avoids that.
Also, yes I could hide the driver list on the left and resize the window and change the titlebar text ... again, it's too rarely used to screw with all of that. This is beyond good enough. I don't know of any other emulators for any system that do anything like that at all (probably because their driver swaps don't crash the program, hah) so this should be good enough.
---------
Next up, my audio resampling calculations were completely wrong. I can't believe I got it working before at all. It's now:
Resample output rate = Sound card frequency
Scale = (0.5 slowest, 1.0 normal, 2.0 fastest)
Resample input rate = SNES input frequency * scale
Resample ratio = input / output
That means the SNES input rates we were using before were actually backwards. Oops. So now you move the slider left to prevent audio underruns, and right to prevent video duplications. 31960hz seems to be working well for me here.
Speaking of which, I changed the value printed to show as -N to +N, where 0 is 32000hz. So you would see -40, rather than 31960. However, with advanced.enable, it prints both for you.
Next, volume is clamped from 10 - 100 (not going to zero, sorry) with advanced.enable off, and 10 - 200 with it on.
Latency stays from 20ms - 200ms. I get too close to 150ms for comfort on Windows. If people try setting it to 200ms thinking it's a good thing, then they deserve what they get.
PC output frequency loses 22050hz, but keeps the other four.
And of course, SDL video output on Linux with a compositor enabled is fixed. Xv + compositor is not. I can't find a matching adaptor for the 32-bit window. Will work on it, though Xv sucks anyway.
Oh, and it turns out that the nvidia binary driver
does allow you to specify whether or not OpenGL syncs to vblank. But if you uncheck "sync to vblank" in nvidia-settings, it ignores the setting. So you can now toggle sync to vblank from the GUI. Neat, feature parity with Windows at last.
Hey, I have that background too :D
Yeah, Interfacelift is a nice site. Not my actual wallpaper though. Didn't want to hear people bitching / poking fun at it :P
Funny timing, 99% of the time my wallpaper is a solid color.
Excuse me, I'm not very familiar with Linux, what is the desktop environment being used and what theme?
Xfce 4 with Gelly theme. It's the closest to Plastik I've found. Like hell I'm using KDE for Plastik, though.