Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPU: Implement start code validation for BDEC/IDEC #6270

Merged
merged 2 commits into from May 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
72 changes: 0 additions & 72 deletions bin/resources/GameIndex.yaml
Expand Up @@ -15847,8 +15847,6 @@ SLES-53541:
region: "PAL-M4"
clampModes:
vuClampMode: 3 # Fix black textures on characters.
gameFixes:
- SkipMPEGHack # Fixes hang after EA intro (IPU).
SLES-53542:
name: "Shadow the Hedgehog"
region: "PAL-M5"
Expand Down Expand Up @@ -18979,8 +18977,6 @@ SLES-54867:
region: "PAL-E-F"
clampModes:
vuClampMode: 2 # Fix black textures on characters.
gameFixes:
- SkipMPEGHack # Fixes hang after EA intro.
SLES-54870:
name: "FIFA '08"
region: "PAL-E"
Expand Down Expand Up @@ -20825,25 +20821,6 @@ SLES-82038:
compat: 5
gameFixes:
- SoftwareRendererFMVHack # Wrong white textures in FMV.
patches:
812C5A96:
content: |-
comment=patched by Kozarrov and ported by Prafull
//Improve menus, and other 2D displays handled on IPU
// Set IPU_DATA IVF to Intra
patch=1,EE,003c3678,word,3C040020
// Set IPU_CMD to IDEC, and set QSC to 2
// Why 2? Because it seems to work best.
patch=1,EE,003c368c,word,3C021002
// Old patch by shadow lady (still needed)
patch=1,EE,00104170,word,00000000
// Disable print - we need that loop!
// Without loop ipu break itself.
patch=1,EE,0010FDC8,word,34190180
patch=1,EE,0010FDCC,word,1720FFFF
patch=1,EE,0010FDD0,word,2739FFFF
patch=1,EE,0010FDD4,word,03E00008
patch=1,EE,0010FDD8,word,00000000
SLES-82039:
name: "Onimusha - Dawn of Dreams [Disc2of2]"
region: "PAL-M5"
Expand All @@ -20852,25 +20829,6 @@ SLES-82039:
- SoftwareRendererFMVHack # Wrong white textures in FMV.
memcardFilters:
- "SLES-82038"
patches:
812C5A96:
content: |-
comment=patched by Kozarrov and ported by Prafull
//Improve menus, and other 2D displays handled on IPU
// Set IPU_DATA IVF to Intra
patch=1,EE,003c3678,word,3C040020
// Set IPU_CMD to IDEC, and set QSC to 2
// Why 2? Because it seems to work best.
patch=1,EE,003c368c,word,3C021002
// Old patch by shadow lady (still needed)
patch=1,EE,00104170,word,00000000
// Disable print - we need that loop!
// Without loop ipu break itself.
patch=1,EE,0010FDC8,word,34190180
patch=1,EE,0010FDCC,word,1720FFFF
patch=1,EE,0010FDD0,word,2739FFFF
patch=1,EE,0010FDD4,word,03E00008
patch=1,EE,0010FDD8,word,00000000
SLES-82042:
name: "Metal Gear Solid 3 - Subsistence [Disc1of3]"
region: "PAL-E-F"
Expand Down Expand Up @@ -26252,12 +26210,6 @@ SLPM-65583:
compat: 4
gameFixes:
- XGKickHack
patches:
C4467D30:
content: |-
comment=Patch by Nachbrenner
// Skip sceIpuSync.
patch=1,EE,0027c808,word,03e00008
SLPM-65585:
name: "Princess Holiday"
region: "NTSC-J"
Expand Down Expand Up @@ -28269,8 +28221,6 @@ SLPM-66191:
region: "NTSC-J"
clampModes:
vuClampMode: 3 # Fixes black textures on characters.
gameFixes:
- SkipMPEGHack # Fixes hang after EA intro (IPU).
SLPM-66192:
name: "Izumo 2"
region: "NTSC-J"
Expand Down Expand Up @@ -41624,24 +41574,6 @@ SLUS-21180:
compat: 5
gameFixes:
- SoftwareRendererFMVHack # Wrong white textures in FMV.
patches:
FE44479E:
content: |-
author=kozarovv
// Set IPU_DATA IVF to Intra
patch=1,EE,003BFDD8,word,3C040020
// Set IPU_CMD to IDEC, and set QSC to 2
// Why 2? Because it seems to work best.
patch=1,EE,003BFDEC,word,3C021002
// Old patch by shadow lady (still needed)
patch=1,EE,00104170,word,00000000
// Disable print - we need that loop!
// Without loop ipu break itself.
patch=1,EE,0010FDC8,word,34190180
patch=1,EE,0010FDCC,word,1720FFFF
patch=1,EE,0010FDD0,word,2739FFFF
patch=1,EE,0010FDD4,word,03E00008
patch=1,EE,0010FDD8,word,00000000
SLUS-21181:
name: "D.I.C.E. - DNA Integrated Cybernetic Enterprises"
region: "NTSC-U"
Expand Down Expand Up @@ -42088,8 +42020,6 @@ SLUS-21264:
compat: 5
clampModes:
vuClampMode: 3 # Fix black textures on characters.
gameFixes:
- SkipMPEGHack # Fixes hang after EA intro (IPU).
SLUS-21265:
name: "Sims 2, The"
region: "NTSC-U"
Expand Down Expand Up @@ -43888,8 +43818,6 @@ SLUS-21646:
compat: 5
clampModes:
vuClampMode: 2 # Fix black textures on characters.
gameFixes:
- SkipMPEGHack # Fixes hang after EA intro.
SLUS-21647:
name: "NHL '08"
region: "NTSC-U"
Expand Down
34 changes: 32 additions & 2 deletions pcsx2/IPU/mpeg2lib/Mpeg.cpp
Expand Up @@ -920,6 +920,7 @@ __fi bool mpeg2sliceIDEC()
case 3:
{
u8 bit8;
u32 start_check;
if (!getBits8((u8*)&bit8, 0))
{
ipu_cmd.pos[0] = 3;
Expand All @@ -929,7 +930,21 @@ __fi bool mpeg2sliceIDEC()
if (bit8 == 0)
{
g_BP.Align();
ipuRegs.ctrl.SCD = 1;
do
{
if (!g_BP.FillBuffer(24))
{
ipu_cmd.pos[0] = 3;
return false;
}
start_check = UBITS(24);
if (start_check == 1)
{
ipuRegs.ctrl.SCD = 1;
break;
}
DUMPBITS(8);
} while (start_check != 1);
}
}
[[fallthrough]];
Expand Down Expand Up @@ -1196,6 +1211,7 @@ __fi bool mpeg2_slice()
case 4:
{
u8 bit8;
u32 start_check;
if (!getBits8((u8*)&bit8, 0))
{
ipu_cmd.pos[0] = 4;
Expand All @@ -1205,7 +1221,21 @@ __fi bool mpeg2_slice()
if (bit8 == 0)
{
g_BP.Align();
ipuRegs.ctrl.SCD = 1;
do
{
if (!g_BP.FillBuffer(24))
{
ipu_cmd.pos[0] = 4;
return false;
}
start_check = UBITS(24);
if (start_check == 1)
{
ipuRegs.ctrl.SCD = 1;
break;
}
DUMPBITS(8);
} while (start_check != 1);
}
}
[[fallthrough]];
Expand Down