dosemu2 / dosemu2

Run DOS programs under linux:
http://dosemu2.github.io/dosemu2/
GNU General Public License v2.0
547 stars 57 forks source link

SimCity2000 hangs on mouse actions #1461

Closed stsp closed 3 years ago

stsp commented 3 years ago

Describe the bug Scrolling the map with a scroll bar causes the game hang. dosemu crashes shortly after. Actually moving the mouse wheel is enough to crash everything.

To Reproduce Scroll the city map with the side-scroller, or just move the mouse wheel.

A regression? Very likely so.

stsp commented 3 years ago

Doesn't crash if you have stacks=0 in config.sys, or if you use something else than freedos or fdpp. And the problem is specific to dos4gw-1.95 which sc2000 uses. Hmm... Most certainly another freedos bug...

stsp commented 3 years ago

It appears dos4gw-1.95 somehow (???) maps the DOS irq stack (if one is configured), and uses it as a stack for prot mode IRQs! So its particularly sensitive to the IRQ stack usage strategy, which probably differs between freedos and ms-dos. So it seems this is not a freedos bug, just some incompatibility in an irq stack usage. But how can one map the IRQ stack of DOS? Is there any API to find its location and size?

andrewbird commented 3 years ago

I don't know much about DOS stacks, but this page https://sites.google.com/site/pcdosretro/dostables (search for Stacks block header) seems to have some info. Incidentally the guy that has that site pcdosretro used to work on PC-DOS 7 and until fairly recently was active on vcfed see https://www.vcfed.org/forum/member/50489-pcdosretro , maybe he can help?

stsp commented 3 years ago

Thanks, interesting link. If they are talking about the stack set with stacks= then indeed freedos doesn't maintain that header and the descriptors array. Anyway, that still gives us no info on how dos4gw maps these stacks. If I knew that, I could try to cheat him and give it some scratch area instead of real stacks. But since this is still unknown, I'll try another idea: if I "revector" the mouse interrupt, then it will not execute on the DOS irq stack. Which may solve the problem quite cheaply. Or maybe just disable those silly irq stacks by default?

stsp commented 3 years ago

Whoa, it all appears much simpler. :)

    SetSelector(DPMIclient[rmcb_client].realModeCallBack[num].rm_ss_selector,
                (SREG(ss)<<4), 0xffff, DPMI_CLIENT.is_32,
                MODIFY_LDT_CONTENTS_DATA, 0, 0, 0, 0);

... is what dpmi_realmode_callback() does. So dosemu2 itself maps the irq stack to dos4gw if the call-back is done from IRQ - something that never happened in dosemu1.

stsp commented 3 years ago

So there was no bug at all. Just that dos4gw can't work with 256b irq stacks, so lets create 512b ones.

stsp commented 3 years ago

That would sill leave sc2000 broken on freedos... I need to stop mapping irq stacks to DPMI instead, I guess.