VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

I notice that, with my UniPCemu emulator, building it for SDL2 (compared to the normal SDL build) somehow gives some strange caps lock/shift issues. I notice that when booting and starting the MS-DOS prompt, sometimes everything ends up in capital letters (without shift/caps lock being used), while all numbers end up in their alternative forms (which normally happens when shift is pressed), so instead of `1234567890-= I get ~!@#$%^&*()_+, while normal keys like enter etc. simply completely stop working(entering text at the MS-DOS prompt).

Anyone knows if this is actually a SDL2 bug? Or is this a problem in my emulator itself? It looks like it's gotten the shift key stuck? I think the problem itself might be in SDL2, since SDL1.2.15 doesn't exhibit this problem (and uses the exact same input method using SDL_KEYDOWN and SDL_KEYUP events, which has changed from a simple lookup table to a function for decoding pressed keys and encoding them to an universal format that the keyboard emulation understands(104-key keyboard)).

https://bitbucket.org/superfury/unipcemu/src/ … put.c?at=master

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 1 of 5, by leileilol

User metadata
Rank l33t++
Rank
l33t++

Unrelated to your project, there was a pull request for OA to use SDL2 (for some pointless "mandatory" reason) and i've immediately found input issues with alt-tab and restarting the video subsystem. The player spun A LOT when either happened and could not stop ever. Very obvious bugs that should have been squashed before being committed to the parent's master branch

where the problem really lies i'm not sure, but you bet your ass I rejected that pull request to master. The problems (this input bug; platform regressions) outweigh the benefits (making 'nix maintainers happy for using the "latest", as far as I can tell)

apsosig.png
long live PCem

Reply 2 of 5, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

My guess is that the op's problem is due to some fault in the port sdl1.2x to sdl2. I've experienced strange keyboard problems with all versions of SDL. Last time with the fork of Dosbox, dosbox-x/daum - something broke there with SDL 1.2x and keyboard stuff.

As for SDL2 newer, shinier, latest, the problem is that SDL 1.2x is no longer maintained and at least on OS X, only the latest SDL 1.2x source is useable, the ancient last release is broken. And no new release willlikely ever land...

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 3 of 5, by superfury

User metadata
Rank l33t++
Rank
l33t++

The changes in the port from SDL1 to SDL2 can be found by looking for the "#if(n)def SDL2" blocks in the code. Most of the SDL1 code is unmodified, I've just changed incompatible parts(like the big lookup table becoming a function and repeating looking at the repeat flag) to be able to run in SDL2. Those parts are all that's changed in SDL2 actually(done according to the SDL2 migration guide on the official website).

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 5 of 5, by superfury

User metadata
Rank l33t++
Rank
l33t++

After looking at the commits I've made to my emulator, the first commit doing anything with SDL2 is commit of 20-5-2016: https://bitbucket.org/superfury/unipcemu/src/ … le-view-default

Before that it's SDL1.2.15 only.

This is all that's changed adding SDL2 compatibility up to now:
https://bitbucket.org/superfury/unipcemu/diff … 73ca9&at=master

There's also a side-by-side diff when you click on it's button.

Edit: Looking at the way it handles the released keys in Direct Input mode:

				//SDL2?
INLINEREGISTER int index;
INLINEREGISTER int key;
index = signed2unsigned16(event->key.keysym.sym); //Load the index to use!
key = emu_keys_sdl_rev(index); //Load the index to use!
if (key != -1) //Valid key?
{
if (emu_keys_state[key] & 1) //We're pressed at all?
{
emu_keys_state[key] |= 2; //We're released!
handleKeyPressRelease(key); //Handle release immediately!
}
}

Thinking about it: it doesn't make sense to use signed2unsigned16 on the SDL2 32-bit event->key.keysym.sym. That would truncate the upper 16 bits(bit 15 being converted from 'sign' bit), thus giving the wrong key index to translate! Fixing this right now. This might have been the actual problem:S

Looking at the key code lookup table, this will affect any 'extended' non-basic input, with values past SDLK_DELETE in the following list:
https://wiki.libsdl.org/SDLKeycodeLookup

In this case, it's caused by the arrow keys I was using during a setup.exe of The Lord of the Rings Vol I(which I was using to try and test my new Game Blaster emulation, based on the Dosbox code(the register storage and part of it's register access and audio rendering code(except the signal generators itself, which I've based on my OPL2 emulation for accuracy))).

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io