Skip to content

Commit

Permalink
gpu: copy bits from textured polygon commands to e1
Browse files Browse the repository at this point in the history
Fixes Tekken 3 Health bar and Worms Armageddon menu and player names
  • Loading branch information
JaCzekanski committed Dec 3, 2019
1 parent c7d1d21 commit 274de9f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/device/gpu/gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 274de9f

Please sign in to comment.