[BUG] System shock crash on launch on specific cases

Discussion of development and patch submission.
Post Reply
JosepMa
Posts: 202
Joined: Tue 20 Jun, 2017 6:25 pm

[BUG] System shock crash on launch on specific cases

Post by JosepMa »

Hi.

While I was debugging the problem with AWE32 chorus that you reported with System Shock, I had some problems to make it run.
I got a copy of the cd version from internet.

Depending on the drivers that i load ( config.sys, autoexec.bat ), the emulator crashes at game startup due to a "fatal()" call coming from here.
System is MS-DOS 6.22 under Pentium 166 MMX and loading XMS and EMS:

codegen_x86.c (also present in codegen_x86_64.c )
static void add_to_block_list(codeblock_t *block)
[...]
if (block->next)
{
if (!block->next->pc)
fatal("block->next->pc=0 %p %p %x %x\n", (void *)block->next, (void *)codeblock, block_current, block_pos);
}
Log:
block->next->pc=0 07E94538 07020000 1b84 328
PIC1 : MASK A8 PEND 00 INS 00 VECTOR 08
PIC2 : MASK 1D PEND 00 INS 00 VECTOR 70
Dumping rram.dmp
Dumping rram4.dmp
Dumping done
EAX=000000FF EBX=0000001F ECX=00000001 EDX=0000008A
EDI=0064222C ESI=FFFCCA3B EBP=00642258 ESP=0064229C
PC=000C CS=0180 DS=0188 ES=0188 SS=0188 FLAGS=0297
0180:000C 0000:0000
138621661 ins
In protected mode
CS : base=000000 limit=FFFFFFFF access=9B limit_low=00000000 limit_high=FFFFFFFF
DS : base=000000 limit=FFFFFFFF access=93 limit_low=00000000 limit_high=FFFFFFFF
ES : base=000000 limit=FFFFFFFF access=93 limit_low=00000000 limit_high=FFFFFFFF
FS : base=FFFFFFFF limit=0000FFFF access=00 limit_low=00000000 limit_high=0000FFFF
GS : base=005990 limit=0000FFFF access=93 limit_low=00000000 limit_high=0000FFFF
SS : base=000000 limit=FFFFFFFF access=93 limit_low=00000000 limit_high=FFFFFFFF
GDT : base=410010 limit=3FFF
LDT : base=410010 limit=3FFF
IDT : base=005A50 limit=07FF
TR : base=006704 limit=0067
386 in 32-bit mode stack in 32-bit mode
CR0=80000011 CR2=8004FFFF CR3=00008000 CR4=00000000
Entries in readlookup : 0 writelookup : 0
Entries in readlookup : 234 writelookup : 11
ST(0)=0.000000 ST(1)=0.000000 ST(2)=0.000000 ST(3)=0.000000
ST(4)=0.000000 ST(5)=-0.000000 ST(6)=0.000000 ST(7)=1.#INF00
Status = 0000 Control = 037F Tag = FFFF
I have the dumps but even zipped with 7zip still sizes 900KB.

I was able to make it run when loading the cd drivers from FDOS. Loading another set of cd drivers didn't work.
With a Winchip 166 without recompile, the same thing happens, except there is no fatal(). With FDOS drivers, the game loads, and without them it halts on a black screen. (the emulator windows keep responsive).

I don't know if this is a problem with PCem, or a problem with the game, but still, it was strange.
User avatar
SarahWalker
Site Admin
Posts: 2054
Joined: Thu 24 Apr, 2014 4:18 pm

Re: [BUG] System shock crash on launch on specific cases

Post by SarahWalker »

What are the CD drivers it failed with? It's jumped to CS:EIP = 0, which is generally bad.

I have to admit, I was using the floppy disk version...
JosepMa
Posts: 202
Joined: Tue 20 Jun, 2017 6:25 pm

Re: [BUG] System shock crash on launch on specific cases

Post by JosepMa »

When loading, they say " E-IDE/ATAPI CD-ROM device driver ver 1.25" "Copyright LG Electronics Inc 1997. All rights reserved"
Filename is GSCDROM.SYS, loaded with Microsoft's MSCDEX.

I'll try now to load it with FDOS's SHSUCDX to see if it is the loader or the driver.
JosepMa
Posts: 202
Joined: Tue 20 Jun, 2017 6:25 pm

Re: [BUG] System shock crash on launch on specific cases

Post by JosepMa »

Mmm.. curious...

If I use the FDOS driver, with or without the cdrcache.sys, it works.

If I load the GSCDROM with the cdrcache (either with mscdex or shsucdx) it works, but if not (either with mscdex or shsucdx) it crashes.
JosepMa
Posts: 202
Joined: Tue 20 Jun, 2017 6:25 pm

Re: [BUG] System shock crash on launch on specific cases

Post by JosepMa »

Another update: Running it from inside windows 98 works. And also works when running in MS-DOS mode ( F8 on boot up ).

So I believe that this is more like some incompatibility coming from somewhere, or a patched game.
Sorry for the noise. It might still be of help to others if they end finding that same download.

(Edit: advantage of the CDrom version is higher resolution modes and svga cutscenes.)
ecksemmess
Posts: 183
Joined: Wed 18 Mar, 2015 5:27 am

Re: [BUG] System shock crash on launch on specific cases

Post by ecksemmess »

Even if it's just caused by a poorly patched ISO, isn't it still a bad sign that PCem itself is crashing/fataling? The failure should be contained within the emulated system, so there's still something amiss to troubleshoot here, right?
User avatar
SarahWalker
Site Admin
Posts: 2054
Joined: Thu 24 Apr, 2014 4:18 pm

Re: [BUG] System shock crash on launch on specific cases

Post by SarahWalker »

PCem's recompiler dies when the CPU jumps to 0:0 as it treats that as 'code block deleted', and fails sanity checks when trying to process it. It strictly shouldn't fatal, but as jumping to 0:0 is a sign that the emulated system has gone completely tits up it's often a useful and fairly immediate indicator of something wrong!
Battler
Posts: 793
Joined: Sun 06 Jul, 2014 7:05 pm

Re: [BUG] System shock crash on launch on specific cases

Post by Battler »

Well, most sane operating system (not talking DOS here), trap the first page of RAM, so something jumping to 0:0 will raise an exception anyway, causing the OS to give an error message. I'm quite sure that's more desirable behavior than the emulator fataling.
User avatar
SarahWalker
Site Admin
Posts: 2054
Joined: Thu 24 Apr, 2014 4:18 pm

Re: [BUG] System shock crash on launch on specific cases

Post by SarahWalker »

This is DOS though (also Windows 9x doesn't trap the first page). Fatal'ing with a message is more useful for debugging than the inevitable hang would be.
Post Reply