[Patch] Game patches & Real3D PCI-IDs

Technical discussion for those interested in Supermodel development and Model 3 reverse engineering. Prospective contributors welcome.
Forum rules
Keep it classy!

  • No ROM requests or links.
  • Do not ask to be a play tester.
  • Do not ask about release dates.
  • No drama!

[Patch] Game patches & Real3D PCI-IDs

Postby HarryTuttle » Sun Jul 08, 2018 6:43 am

In my recent posts here what I thought was just a typo revealed instead, after a deeper check, much more.

Looking inside MAME code I find out that not only more step 1.x games use MPC106, but there're step 2.x games which, seemingly, need an older Real3D model whose PCI ID is 0x16C311DB. I also added the following comment copied from MAME:

Code: Select all
// Some step 2+ games need the older PCI ID (obvious symptom:
// vbl is enabled briefly then disabled so the game hangs)

These changes made possible to eliminate the patches for step 1.5 variants of Virtua Striker while still making them playable, VS298 now doesn't need a patch either, VON2 still boots correctly. In general the correct PCI ID is returned for step 2.x games which now is the same whether the PCI configuration space or DMA register are accessed.

Another change to Star Wars Trilogy patches taken from MAME made JTAG work, so I could remove the workarounds in <New3D.cpp>, while still skipping the force feedback lever check. Test menu is still accessible and a black background is correctly drawn behind making the text much more readable, as it should be (see swtrilgya for comparison).

An apparent regression is that now the game runs at half the speed, at least on low performance PC: it seems the old patch incidentally influenced the frame timing so made the game run fluid. But this problem is only related with the official frame timing algorithm, in my build I use a different one and all games run fluid.

This situation, in my theory, should be not surprisingly similar to what happens for Sega Rally 2 and the Deluxe variant, the current patch for the former makes it playable but disables JTAG, maybe someone with the needed skills can make a single line patch for SR2 based on what Bart made for the Deluxe version...

I removed the patches for LeMans24: the game needed those when network code was absent so that booted *always* in stand alone mode. Now if you compile Supermodel with network support and enable it in config, you can boot LeMans24 and when the screen waiting for connection appears just press F2 and configure the machine to be stand alone. I noticed that even with multi-thread enabled Supermodel doesn't crash if no network connection is attempted with another emulated machines.

Other changes are just cosmetics: I converted tab indentations to spaces, as the rest of the file.

EDIT:
I forgot to mention that I reinserted in <Games.xml> the patch to enable the secret test menu in Scud Race. Obviously leave it as you please.
Attachments
diff.zip
(32.87 KiB) Downloaded 9 times
Last edited by HarryTuttle on Mon Jul 09, 2018 5:05 pm, edited 3 times in total.
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] Game patches & Real3D PCI-IDs

Postby Ian » Sun Jul 08, 2018 7:02 am

Seems like u've done some great work Harry :) I'll push these later today when back at pc, or maybe Bart can if he gets there first. He has a better idea than me how these parts of the system work.
Ian
 
Posts: 1468
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] Game patches & Real3D PCI-IDs

Postby Ian » Sun Jul 08, 2018 4:22 pm

An apparent regression is that now the game runs at half the speed, at least on low performance PC: I noticed the old patch incidentally influenced the frame timing so made the game run fluid. But this problem is only related with the current frame sync algorithm, in my build I use a different one and all games run fluid.


Been spending a little time debugging how stuff is written to the GPU to try and better understand frame timing. Star wars was puzzling because it looked like it was doing a double frame write, but in one frame. Ie updating the database twice in one frame. But it still appeared to run at the correct speed. But saying that I think running it at 100mhz makes attract mode run too slowly.

in my build I use a different one and all games run fluid.

What do you do different to make games run better? I wonder if the JTAG stuff effects frame timing at all ...

but there're step 2.x games which needs a, supposedly, older Real3D model with PCI-ID 0x16C311DB.

How does this work? The games as far as I know are generally interchangeable, as long as they are running on the correct step version?
Ian
 
Posts: 1468
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] Game patches & Real3D PCI-IDs

Postby HarryTuttle » Sun Jul 08, 2018 5:04 pm

Ian wrote:
in my build I use a different one and all games run fluid.

What do you do different to make games run better? I wonder if the JTAG stuff effects frame timing at all ...

Consider that I'm continuously changing and trying to improve it, based on what I think it *might* happen, but it's low level stuff and very difficult for me to understand... anyway this is schematically what I'm doing in RunMainBoardFrame:

Code: Select all
- look at system IRQs state
- if ((IRQ.ReadIRQEnable() & 0x40) && (midiCtrlPort & 0x30)) reserve few cycles for audio stuff
- if (IRQ.ReadIRQEnable() & 0x20) we are dealing with video stuff (3D and/or 2D, this is an assumption of mine, the meaning of that bit is officially unknown judging from comments in MAME driver and Supermodel)

Audio stuff:
- if midiCtrlPort == 0x37 execute few cycles until IRQ status changes
- if midiCtrlPort == 0x27 execute few cycles until IRQ status changes

Video stuff:
if (IRQ.ReadIRQEnable() & 0xD) { // VD3, VD2, VD0 System IRQ bits
  return 0xFDFFFFFF from [b]ReadRegister[/b] function
  execute 66000-166000 ppc cycles depending on stepping model
  return 0xFFFFFFFF from [b]ReadRegister[/b] function
}
if (IRQ.ReadIRQEnable() & 0x2) { // VBL System IRQ bit
  assert 0x2
  execute 750000-1000000 ppc cycles depending on stepping model
  deassert 0x2
} else {
  execute 750000-1000000 ppc cycles depending on stepping model
}

Actually it's a bit more complicated, but you get the idea. Now, the hard quest is to find out if we really need those assert/deassert, if the cycles are fixed or must execute until something specific happens (IRQ state change or whatever), etc. This is what, since last year and from time to time, I'm trying to do, to find an all-satisfying algorithm. Basically I spend much less time inside RunMainBoardFrame function compared to official build.

Also I don't get any tearing in Scud Race Plus intro cgi animation or ECA's rapid image sequence at the end of attract intro.

Ian wrote:
but there're step 2.x games which needs a, supposedly, older Real3D model with PCI-ID 0x16C311DB.

How does this work? The games as far as I know are generally interchangeable, as long as they are running on the correct step version?


That's taken from MAME source code. I think it's just a matter of Device IDs (Vendor ID stays the same) and nothing more. But games that check for a particular sequence could hang if it's not correct. In Supermodel we're currently returning always the same ID when accessing to DMA register, regardless the game, stepping, etc.
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] Game patches & Real3D PCI-IDs

Postby Ian » Mon Jul 09, 2018 1:29 am

Slightly off topic.
IRQ2 seems to drive frame drawing. Except in ocean hunter in the part where the game falls apart. If you stop calling IRQ2 is just carries on drawing as normal, until the game goes back to the normal attract sequence, which is quite weird :)
Ian
 
Posts: 1468
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] Game patches & Real3D PCI-IDs

Postby HarryTuttle » Mon Jul 09, 2018 4:11 am

Ian wrote:Slightly off topic.
IRQ2 seems to drive frame drawing. Except in ocean hunter in the part where the game falls apart. If you stop calling IRQ2 is just carries on drawing as normal, until the game goes back to the normal attract sequence, which is quite weird :)


Hmmm, I didn't check that particular case. Yeah that's strange...

I noticed system IRQ bit 0x20 seems always set in combination with any of the last 4 bits, including VBL ( IRQ2 ).
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] Game patches & Real3D PCI-IDs

Postby YoYo09 » Tue Jul 10, 2018 3:41 am

Harry, Ian
r737 weird symptoms
Sega rally 2 sound, compared to r735 (At the start of the demonstration after the Sega logo)
The sound of the background sounds strange like other music.
YoYo09
 
Posts: 56
Joined: Mon Nov 28, 2016 7:43 pm

Re: [Patch] Game patches & Real3D PCI-IDs

Postby HarryTuttle » Tue Jul 10, 2018 7:24 am

YoYo09 wrote:Harry, Ian
r737 weird symptoms
Sega rally 2 sound, compared to r735 (At the start of the demonstration after the Sega logo)
The sound of the background sounds strange like other music.


Strange... Sega Rally 2 wasn't even involved in the list of changes. Maybe it's another game of the group step20_with_old_real3d? With the old code dma register returned the old PCI ID to every step 2.0 game.

I'll check it out and let you know.
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] Game patches & Real3D PCI-IDs

Postby HarryTuttle » Tue Jul 10, 2018 7:36 am

YoYo09: did you compile with networking enabled? If so try to launch the game with net board disabled (-no-net).
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] Game patches & Real3D PCI-IDs

Postby YoYo09 » Tue Jul 10, 2018 8:10 am

HarryTuttle wrote:YoYo09: did you compile with networking enabled? If so try to launch the game with net board disabled (-no-net).


I did not.
I took it from the site I visited frequently and tested it.
http://www.emucr.com/2018/07/supermodel-svn-r737.html

Is compilation a problem?

ps r737
Le Mans 24, la Machine Guns Some screen frame drops have been fixed
I always play thankful.
YoYo09
 
Posts: 56
Joined: Mon Nov 28, 2016 7:43 pm

Next

Return to The Dark Room

Who is online

Users browsing this forum: No registered users and 1 guest