JHRobotics / patcher9x

Patch for Windows 9x to fix CPU issues
MIT License
779 stars 39 forks source link

Windows Me - TLB invalidation bug patch #1

Open JHRobotics opened 2 years ago

JHRobotics commented 2 years ago

Windows ME has same bug in code as Windows 98, but from my observation, the system calls this code very rarely. So I need to know some configuration/application/driver who will cause this bug.

And in VMM/FlushMappedCacheBlock on Windows Me is much less space to inject some code, so patch will need longer jump/call to somewhere where space is. Untested code is here: https://github.com/JHRobotics/patcher9x/blob/main/vmm/FlushMappedCacheBlockMe.asm

If you need patched file, I created bootable floppy with fixed vmm.vxd on it. If you think you found this bug in your system/configuration you can copy vmm.vxd to WINDOWS\system\vmm32 (or exec vxdcopy.bat on floppy - it will do it for you) and check if it will solve problem.

If it solves bug, please write it to me and if it causes terrible crashes, let me know too.

kjliew commented 2 years ago

Hello, drop by the say THANK YOU!! The Win98 SE patch works and it is the most significant patch for Windows 98 SE in 20 years since its EOL!

Thanks again for working on WinME patch. WinME does suffer the same issue as I experienced in QEMU on Windows WHPX and Linux KVM. MSKB Q296773 installs a new version 4.90.3003 of VMM.VXD in C:\WINDOWS\SYSTEM\VMM32. I am not sure if it is in clear binary or packed VXDs archive. I think the patch should be based on this final MSKB update.

http://web.archive.org/web/20050208131847/http://support.microsoft.com/?kbid=296773 https://www.mdgx.com/files/ME296773.EXE

JHRobotics commented 2 years ago

Hello @kjliew,

I'm very happy that you like my work! :-)

I can't test QEMU+WHPX now (I'm stuck with this bug https://www.vogons.org/viewtopic.php?f=9&t=87507) and my Linux machine runs on older CPU. I think that problem is somewhere in WHPX (evenVirtualBox is much lesser stable if running on Hyper-V NEM).

But for today release: https://github.com/JHRobotics/patcher9x/releases/tag/v0.6.23 (boot floppy) I added patch code for Me to patcher. So, if run it with -millennium argument it's able to patch Me's VMM32.VXD. In Q296773 is patched function (FlushMappedCacheBlock) binary same as in vanilla, so patch works even for update. There only one difficulty - after install update, you need install patch again (on floppy is patchme.bat so you can run it directly from running system after upgrade). Thank you for pointing me to this update - I changed patching strategy for Windows Me, because older one was extracting VMM.VXD from VMM32.VXD and replaced update. On update is vmm.vxd driver itself (clean binary), I don't think some updated modifying the archive SYSTEM/VMM32.VXD (because it is individual for your HW configuration, it's compressed too and it's probably only one file of this type (W3/W4) in whole OS).

Could you test this patch please? I verified code itself was run by installer and loader so it is probably safe, but I don't know if it resolves same issues as for 98.

kjliew commented 2 years ago

Hello @JHRobotics !

I have tested the Windows Millennium patch and it works as expected. While WinME may be less prone to the same DLL errors as in un-patched Win98SE, I do occasionally have the same errors though less frequently. I typically use WinME as a workaround when Windows games failed to work in un-patched Win98SE and didn't work very well on Win2K/XP.

I tested with Millennium patch with fresh install WinME, KVM-accelerated from scratch. IIRC, this wasn't possible before the patch. With your awesome patches for Win98/ME, both can now do fresh install with KVM/WHPX accelerated. This is an extremely significant improvement. On fast NVME SSDs, the installation simply breezed through to completion in less than 10 mins!!

Your patch made Win98/ME the BEST ever Windows VM for retro games, especially Win98 which is the most compatible for Windows games from the late 90's till the turn of Millennia. It is the dream comes true of achieving & preserving the BEST ever experience (high resolution, MAX details/view distance) with retro games on VM with the tremendous advancement of CPU/GPU in modern x86 platforms.

There was once the curse of "Virtualization is only GOOD for speed, but BAD for Games compatibility". Thank YOU again for the patch, you had indeed broken the curse. Your patch made QEMU Win98/XP VMs delivers great experience for retro games spanning the entire Golden era of Windows 3D games from the early 3Dfx/DirectX Win9x to the last DirectX 9.0c WinXP era. Anything beyond that would have been little trouble with Win10/11 or well covered by modern Wine/Proton/Steam play.

After all, with the FOSS, cross-architecture & cross platform readiness of QEMU, Win98/XP VMs will continue to live on preserving many great games in pristine condition. Absolutely amazing work!!

JHRobotics commented 2 years ago

Hello @kjliew,

Many thanks for the test! It’s look, we reanimated two ancient OS (ME, 98 SE) for some time… until architecture changes on future CPUs have revealed next bugs.

I’ve same opinion – Virtualization brings much more performance than emulation and you won’t mess your productive system with wrappers/driver tunning/system patching to bring old applications/games alive. There are also two drawbacks – old operation systems have bugs to prevent to run them on newer hardware and virtualization software has usually poor GPU performance. I tried to solve first one and it looks you tried to solve second part (https://github.com/kjliew/qemu-3dfx) – I very appreciate you doing this :-)

And yes, it’s very nice see old games in same condition as were new!