caiiiycuk / js-dos

The best API for running dos programs in browser
https://js-dos.com
1k stars 123 forks source link

Mouse works very slowly in WarCraft II (dosbox-x), native version works fine #316

Closed guozanhua closed 1 week ago

guozanhua commented 3 weeks ago

When I execute the following JavaScript, v7 is normal. And v8 is too slow.

const xyArray = [[0.25, 0.25], [0.75, 0.25], [0.75, 0.75], [0.25, 0.75]]; let index = 0; setInterval(() => { ci.sendMouseMotion(xyArray[index][0], xyArray[index][1]); index = (index + 1) % xyArray.length; }, 500);

https://github.com/caiiiycuk/js-dos/assets/157069/2fc84f23-4dc7-4a8b-901e-d4e189df0011

https://github.com/caiiiycuk/js-dos/assets/157069/f6c0c239-292f-457f-936b-b4bec472392c

caiiiycuk commented 1 week ago

This happens because Warcraft II is working very slow under DOSBOX-X backend. I don't know why this happens, but if you switch to DOSBOX it will work smooth. Also with other games, for example simcity sendMouseMotion works fine with dosbox-x.

caiiiycuk commented 1 week ago

You need to enable capture mouse for the game, if you use dosbox-x backend. Then it works fine изображение