[Bug] Joystick detection & PCem crashes

Discussion of development and patch submission.
basic2004
Posts: 118
Joined: Sun 08 Jan, 2017 5:59 pm

[Bug] Joystick detection & PCem crashes

Postby basic2004 » Thu 27 Jul, 2017 8:53 am

I wrote PCem crash problem about 10 days ago,
https://pcem-emulator.co.uk/phpBB3/viewtopic.php?f=3&t=766#p6150
basic2004 wrote:Thanks.
I confirmed this fix in Windows 7 32bit on VMware.

Why Windows 7, because my native Windows 10 64bit crashes when exit machine and restart over 2 times.
always crashes 3rd time of booting machine.

basic2004 wrote:And sometimes PCem crashes when exit and restart without quit PCem, too.

Yes, this problem.


I found a reason of this issue.

I use joystick in my PC.
I didn't happen this crashing with PCem when unplug any joystick and disable vJoy from device manager.
so PCem didn't crash in Windows 7 32bit on VMware, there was no joystick.

Let's talk about joystick issues.

1. PCem crashes when restart(select and starting machine from PCem Configure Manager) over 2 times without quitting PCem.
2. No joystick detection from 'PCem Configure Manager' first time.

Joystick configuration is different among 3 cases,

when launched PCem and didn't loaded any machines, PCem can't detect any joysticks.
joystick-config-pcem-confman-firsttime.png
joystick-config-pcem-confman-firsttime.png (16.31 KiB) Viewed 238 times


After start machine, loaded joystick configure from PCem Main window
joystick-config-pcem-main.png
joystick-config-pcem-main.png (22.64 KiB) Viewed 238 times


Exit from machine over once, joystick configure from 'PCem Configure Manager' when didn't quit PCem.
joystick-config-pcem-confman-exitmachine.png
joystick-config-pcem-confman-exitmachine.png (16.51 KiB) Viewed 238 times


Exit and restart over twice, PCem crashes maybe initialization overflow of joystick.
Last edited by basic2004 on Thu 27 Jul, 2017 9:11 am, edited 2 times in total.
basic2004
Posts: 118
Joined: Sun 08 Jan, 2017 5:59 pm

Re: [Bug] Joystick detection & PCem crashes

Postby basic2004 » Thu 27 Jul, 2017 9:05 am

Adding a post because attach limits per post.
If joystick was defined(+saved) and relaunch PCem,

Blank selections when launched PCem and didn't loaded any machines.
joysticknr-not0-confman-firsttime.png
joysticknr-not0-confman-firsttime.png (16.17 KiB) Viewed 235 times


Broken encoding in non-English Windows when after loading machine.
joysticknr-not0-main.png
joysticknr-not0-main.png (22.8 KiB) Viewed 235 times
basic2004
Posts: 118
Joined: Sun 08 Jan, 2017 5:59 pm

Re: [Bug] Joystick detection & PCem crashes

Postby basic2004 » Thu 27 Jul, 2017 10:32 am

I found why PCem crashes when restart twice,
button mapping is messed up after 2nd joystick initialization.
joystick-before-crash.png
joystick-before-crash.png (17.06 KiB) Viewed 227 times


and I found broken encoding issue.
This issue was a font problem, MS Sans Serif is showing only English.

src/win-joystickconfig.c, line 298:

Code: Select all

        data += MultiByteToWideChar(CP_ACP, 0, "MS Sans Serif", -1, data, 50);

I replaced and tested "MS Shell Dlg 2" instead, this font can showing non-English.

[EDIT] I recommend "Microsoft Sans Serif" for all of configure dialog. this font didn't break non-English, and similar with "MS Sans Serif".

Return to “Development”

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests