schellingb / dosbox-pure

DOSBox Pure is a new fork of DOSBox built for RetroArch/Libretro aiming for simplicity and ease of use.
GNU General Public License v2.0
731 stars 61 forks source link

"The Lost Vikings" refuses to run (2014 Blizzard version) #435

Closed Feilakas closed 7 months ago

Feilakas commented 8 months ago

First of all, we are not talking about the original 1993 "Silicon & Synapse" version of the game which runs flawlessly in Dosbox Pure but the re-release that Blizzard offered for free in 2014 and which is still available, by Blizzard, in the following link: http://dist.blizzard.com/downloads/classics/9f8ba2a406416a70cfe1bc97ec5346ba/The_Lost_Vikings.zip

Said version is a modified DOS version of the game running through Dosbox.

When loading the game in vanilla DOSBox 0.74-3 for Windows, it works just fine and with sound. No modification or special config file are needed. (although, using the dosbox.conf file included with the game does offer better results).

When trying to load it through Pure OR Core however, the below message is displayed and the game refuses to start: _** An Error has occurred while running PC Vikings Copy protection failure. Please run setup._**

The game's SETUP.EXE, which is ONLY used to select a sound card, is not included with this version but using the setup from 1993's version "kinda works" and appears to directly modify the DATA.DAT file.

The issue is that this method only works when choosing "Sound Blaster" audio. Selecting the "Roland SCC-1/General Midi" sound driver that this version of the game "normally" uses results in the sound card not being detected and the game defaulting to "No Audio".

schellingb commented 8 months ago

Quite interesting. It took me a while to figure this one out. It doesn't work in any "current" variant of DOSBox. Version 0.74-3 is a few years old, but a version built from current source code also shows the same error. Also printing the error are other DOSBox forks like DOSBox-X.

So it turns out that the missing SETUP.EXE is writing the size of the hard disk into the DATA.DAT file and then VIKINGS.EXE checks against that. But I think the reason why the emulated hard disk size was changed a few years ago in DOSBox is to increase compatibility with older software. So changing it back isn't really an option.

A workaround would be to circumvent the hard disk check in VIKINGS.EXE by modifying 2 bytes at byte offset 15419 from 75 7B to 90 90.

In #87 we are collecting a list of games that don't launch when being moved from their install directory. This case is a bit different because VIKINGS doesn't seem to care about what directory or drive it is running from as long as the hard disk geometry matches. But any magic that would fix other games in #87 could also be used to apply this check circumvention in VIKINGS.EXE.

Feilakas commented 7 months ago

I must be doing something wrong as I cannot find the value "75 7B" in neither the decimal 15419 (0x3C3B) OR hexadecimal 0x15419 offset.

I do find those values at hex 0x9080 and 0xAE580 but those don't seem to do anything.

By reading this guidehttps://www.pcgamingwiki.com/wiki/The_Lost_Vikings#Copy_protection_failure(/url) I found that the offset being altered by setup.exe for the sound card are bytes at offsets 0x876 and 0x877 but I still cannot make it work by changing these values to either 90 90 or BA 02...

schellingb commented 7 months ago

The circumvention I suggested was removing the copy protection in VIKINGS.EXE, not trying to fix the (encrypted) drive geometry information in DATA.DAT. You should be able to find "75 7B" at byte offset 15419 (0x3C3B) of the 325520 bytes long VIKINGS.EXE.

I also tried to figure out how the bytes in DATA.DAT are calculated based on hard disk geometry (seems to be based on the 8 bit number sectors per cluster and the 16 bit number total clusters) but it wasn't that clear. It turned out to be much easier to just have VIKINGS.EXE ignore the hard disk numbers and run from anywhere.

Feilakas commented 7 months ago

Ah, that makes more sense. Yes, patching the executable did indeed make the game work under both Core and Pure.

However, I found interesting that while Pure plays the game WITH audio, Core doesn't play any sound at all. Not sure why is that because when using SETUP.EXE and setting the audio to Sound Blaster, both Pure and Core have sound.

In any case, pretty good workaround for just running the game in Retroarch