DMA device register always returns Step 1.x PCI ID

Step 2.x games by AM3 request PCI ID this way and expect to see 0x16c311db
This commit is contained in:
gm-matthew 2023-08-19 23:47:00 +01:00 committed by trzy
parent 7924fed369
commit b2fee4242c
3 changed files with 16 additions and 24 deletions

View file

@ -2949,12 +2949,7 @@ bool CModel3::LoadGame(const Game &game, const ROMSet &rom_set)
// Initialize Real3D // Initialize Real3D
int stepping = ((game.stepping[0] - '0') << 4) | (game.stepping[2] - '0'); int stepping = ((game.stepping[0] - '0') << 4) | (game.stepping[2] - '0');
uint32_t real3DPCIID = game.real3d_pci_id; GPU.SetStepping(stepping);
if (0 == real3DPCIID)
{
real3DPCIID = stepping >= 0x20 ? CReal3D::PCIID::Step2x : CReal3D::PCIID::Step1x;
}
GPU.SetStepping(stepping, real3DPCIID);
// MPEG board (if present) // MPEG board (if present)
if (rom_set.get_rom("mpeg_program").size) if (rom_set.get_rom("mpeg_program").size)

View file

@ -27,10 +27,10 @@
* *
* PCI IDs * PCI IDs
* ------- * -------
* It appears that Step 2.0 returns a different PCI ID depending on whether * It appears that accessing the PCI configuration space returns the PCI ID
* the PCI configuration space or DMA register are accessed. For example, * of Mercury (0x16C311DB) on Step 1.x and the DMA device (0x178611DB) on
* Virtual On 2 expects 0x178611DB from the PCI configuration header but * Step 2.x, while accessing the Step 2.x DMA device register returns the
* 0x16C311DB from the DMA device. * PCI ID of Mercury. Step 2.x games by AM3 expect this behavior.
* *
* To-Do List * To-Do List
* ---------- * ----------
@ -628,7 +628,8 @@ void CReal3D::WriteDMARegister32(unsigned reg, uint32_t data)
case 0x10: // command register case 0x10: // command register
if ((data&0x20000000)) // DMA ID command if ((data&0x20000000)) // DMA ID command
{ {
dmaData = pciID; // Games requesting PCI ID via the DMA device expect 0x16C311DB, even on step 2.x boards
dmaData = PCIID::Step1x;
DebugLog("Real3D: DMA ID command issued (ATTENTION: make sure we're returning the correct value), PC=%08X, LR=%08X\n", ppc_get_pc(), ppc_get_lr()); DebugLog("Real3D: DMA ID command issued (ATTENTION: make sure we're returning the correct value), PC=%08X, LR=%08X\n", ppc_get_pc(), ppc_get_lr());
} }
else if ((data&0x80000000)) else if ((data&0x80000000))
@ -921,7 +922,7 @@ uint32_t CReal3D::GetASICIDCode(ASIC asic) const
return it == m_asicID.end() ? 0 : it->second; return it == m_asicID.end() ? 0 : it->second;
} }
void CReal3D::SetStepping(int stepping, uint32_t pciIDValue) void CReal3D::SetStepping(int stepping)
{ {
step = stepping; step = stepping;
if ((step!=0x10) && (step!=0x15) && (step!=0x20) && (step!=0x21)) if ((step!=0x10) && (step!=0x15) && (step!=0x20) && (step!=0x21))
@ -931,7 +932,7 @@ void CReal3D::SetStepping(int stepping, uint32_t pciIDValue)
} }
// Set PCI ID // Set PCI ID
pciID = pciIDValue; pciID = stepping >= 0x20 ? PCIID::Step2x : PCIID::Step1x;
// Pass to renderer // Pass to renderer
if (Render3D != NULL) if (Render3D != NULL)

View file

@ -68,10 +68,11 @@ public:
/* /*
* PCI IDs * PCI IDs
* *
* The CReal3D object must be configured with the desired ID. Some Step 2.x * The CReal3D object must be configured with the PCI ID of the ASIC directly
* appear to defy this and expect the 1.x ID. The symptom of this is that * connected to the PCI slot; 0x16c311db for Step 1.x, 0x178611db for Step
* VBL is enabled briefly then disabled. This should be investigated further. * 2.x. Requesting PCI ID via the DMA device on Step 2.x appears to return
* Perhaps a different ASIC's PCI ID is being read in these situations? * the PCI ID of Mercury which is the ASIC connected to the PCI slot on Step
* 1.x, hence why some Step 2.x games appear to expect the 1.x ID.
* *
* The vendor ID code 0x11db is Sega's. * The vendor ID code 0x11db is Sega's.
*/ */
@ -374,7 +375,7 @@ public:
uint32_t GetASICIDCode(ASIC asic) const; uint32_t GetASICIDCode(ASIC asic) const;
/* /*
* SetStepping(stepping, pciIDValue): * SetStepping(stepping):
* *
* Sets the Model 3 hardware stepping, which also determines the Real3D * Sets the Model 3 hardware stepping, which also determines the Real3D
* functionality. The default is Step 1.0. This should be called prior to * functionality. The default is Step 1.0. This should be called prior to
@ -383,13 +384,8 @@ public:
* Parameters: * Parameters:
* stepping 0x10 for Step 1.0, 0x15 for Step 1.5, 0x20 for Step 2.0, or * stepping 0x10 for Step 1.0, 0x15 for Step 1.5, 0x20 for Step 2.0, or
* 0x21 for Step 2.1. Anything else defaults to 1.0. * 0x21 for Step 2.1. Anything else defaults to 1.0.
* pciIDValue The PCI ID code to return. This should be one of the PCIID
* enum values otherwise games may fail to boot. Although the
* PCI ID depends on stepping, there are a few games that
* have to be explicitly configured with an older ID code,
* which is why this parameter is exposed.
*/ */
void SetStepping(int stepping, uint32_t pciIDValue); void SetStepping(int stepping);
/* /*