Ugh ugh ugh.
| 1312 | |
| 1313 | void MMC5_hb(int); //Ugh ugh ugh. |
| 1314 | static void DoLine(void) { |
| 1315 | if (scanline >= 240 && scanline != totalscanlines) { |
| 1316 | X6502_Run(256 + 69); |
| 1317 | scanline++; |
| 1318 | X6502_Run(16); |
| 1319 | return; |
| 1320 | } |
| 1321 | |
| 1322 | int x; |
| 1323 | uint8 *target = XBuf + ((scanline < 240 ? scanline : 240) << 8); |
| 1324 | u8* dtarget = XDBuf + ((scanline < 240 ? scanline : 240) << 8); |
| 1325 | |
| 1326 | if (MMC5Hack) MMC5_hb(scanline); |
| 1327 | |
| 1328 | X6502_Run(256); |
| 1329 | EndRL(); |
| 1330 | |
| 1331 | if (!renderbg) {// User asked to not display background data. |
| 1332 | uint32 tem; |
| 1333 | uint8 col; |
| 1334 | if (gNoBGFillColor == 0xFF) |
| 1335 | col = READPAL(0); |
| 1336 | else col = gNoBGFillColor; |
| 1337 | tem = col | (col << 8) | (col << 16) | (col << 24); |
| 1338 | tem |= 0x40404040; |
| 1339 | FCEU_dwmemset(target, tem, 256); |
| 1340 | } |
| 1341 | |
| 1342 | if (SpriteON) |
| 1343 | CopySprites(target); |
| 1344 | |
| 1345 | //greyscale handling (mask some bits off the color) ? ? ? |
| 1346 | if (ScreenON || SpriteON) |
| 1347 | { |
| 1348 | if (PPU[1] & 0x01) { |
| 1349 | for (x = 63; x >= 0; x--) |
| 1350 | *(uint32*)&target[x << 2] = (*(uint32*)&target[x << 2]) & 0x30303030; |
| 1351 | } |
| 1352 | } |
| 1353 | |
| 1354 | //some pathetic attempts at deemph |
| 1355 | if ((PPU[1] >> 5) == 0x7) { |
| 1356 | for (x = 63; x >= 0; x--) |
| 1357 | *(uint32*)&target[x << 2] = ((*(uint32*)&target[x << 2]) & 0x3f3f3f3f) | 0xc0c0c0c0; |
| 1358 | } else if (PPU[1] & 0xE0) |
| 1359 | for (x = 63; x >= 0; x--) |
| 1360 | *(uint32*)&target[x << 2] = (*(uint32*)&target[x << 2]) | 0x40404040; |
| 1361 | else |
| 1362 | for (x = 63; x >= 0; x--) |
| 1363 | *(uint32*)&target[x << 2] = ((*(uint32*)&target[x << 2]) & 0x3f3f3f3f) | 0x80808080; |
| 1364 | |
| 1365 | //write the actual deemph |
| 1366 | for (x = 63; x >= 0; x--) |
| 1367 | *(uint32*)&dtarget[x << 2] = ((PPU[1]>>5)<<0)|((PPU[1]>>5)<<8)|((PPU[1]>>5)<<16)|((PPU[1]>>5)<<24); |
| 1368 | |
| 1369 | sphitx = 0x100; |
| 1370 | |
| 1371 | if (ScreenON || SpriteON) |
no test coverage detected