Skip to content
Permalink
Browse files

gpu: copy bits from textured polygon commands to e1

Fixes Tekken 3 Health bar and Worms Armageddon menu and player names
  • Loading branch information
JaCzekanski committed Dec 3, 2019
1 parent c7d1d21 commit 274de9f121f334bdc2a4ac3fb7a2bcdbb3822db9
Showing with 18 additions and 0 deletions.
  1. +18 −0 src/device/gpu/gpu.cpp
@@ -288,6 +288,18 @@ void GPU::cmdPolygon(PolygonArgs arg) {
triangle.clut.x = tex.getClutX();
triangle.clut.y = tex.getClutY();
triangle.transparency = tex.semiTransparencyBlending();

// Copy texture bits from Polygon draw command to E1 register
// texpagex, texpagey, semi-transparency, texture disable bits
const uint32_t E1_MASK = 0b00001001'11111111;

uint16_t newBits = (tex.texpage >> 16) & E1_MASK;
if (!textureDisableAllowed) {
newBits &= ~(1 << 11);
}

gp0_e1._reg &= ~E1_MASK;
gp0_e1._reg |= newBits;
}

triangle.assureCcw();
@@ -617,6 +629,9 @@ void GPU::writeGP0(uint32_t data) {
} else if (command == 0xe1) {
// Draw mode setting
gp0_e1._reg = arguments[0];
if (!textureDisableAllowed) {
gp0_e1.textureDisable = false;
}
} else if (command == 0xe2) {
// Texture window setting
gp0_e2._reg = arguments[0];
@@ -725,6 +740,9 @@ void GPU::writeGP1(uint32_t data) {
gp1_08._reg = argument;
} else if (command == 0x09) { // Allow texture disable
textureDisableAllowed = argument & 1;
if (!textureDisableAllowed) {
gp0_e1.textureDisable = false;
}
} else if (command >= 0x10 && command <= 0x1f) { // get GPU Info
readMode = ReadMode::Register;
argument &= 0xf;

0 comments on commit 274de9f

Please sign in to comment.
You can’t perform that action at this time.