Previous 15994 Revisions Next

r9917 Wednesday 5th January, 2011 at 03:56:57 UTC by MooglyGuy
[N64] Correctly index into the hidden buffer. Fixes flickery edges during fades in the N64 driver. [Harmony]
[src/mame/video]rdpfb.c rdpspn16.c rdptpipe.c

src/mame/video/rdptpipe.c
r9916r9917
815815   tbase += tile[tilenum].tmem;
816816   UINT32 tpal   = tile[tilenum].palette;
817817
818   if (tformat == FORMAT_I && tsize > PIXEL_SIZE_8BIT)
819   {
820      tformat = FORMAT_RGBA; // Used by Supercross 2000 (in-game)
821   }
822   if (tformat == FORMAT_CI && tsize > PIXEL_SIZE_8BIT)
823   {
824      tformat = FORMAT_RGBA; // Used by Clay Fighter - Sculptor's Cut
825   }
826
827   if (tformat == FORMAT_RGBA && tsize < PIXEL_SIZE_16BIT)
828   {
829      tformat = FORMAT_CI; // Used by Exterem-G2, Madden Football 64, and Rat Attack
830   }
831
832818   UINT16 *tc16 = m_rdp->GetTMEM16();
833819
834820   switch (tformat)
r9916r9917
837823      {
838824         switch (tsize)
839825         {
840            case PIXEL_SIZE_4BIT:
826            case PIXEL_SIZE_4BIT: // Treated the same as 4-bit CI
827            {
828               UINT8 *tc = m_rdp->GetTMEM();
829               int taddr = ((tbase << 4) + s) >> 1;
830               taddr ^= ((t & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR);
831               taddr &= 0xfff;
832
833               if (m_other_modes->en_tlut)
834               {
835                  taddr &= 0x7ff;
836                  UINT8 p = (s & 1) ? (tc[taddr] & 0xf) : (tc[taddr] >> 4);
837                  UINT16 c = m_rdp->GetTLUT()[((tpal << 4) | p) << 2];
838
839                  if (m_other_modes->tlut_type == 0)
840                  {
841                     color.i.r = GET_HI_RGBA16_TMEM(c);
842                     color.i.g = GET_MED_RGBA16_TMEM(c);
843                     color.i.b = GET_LOW_RGBA16_TMEM(c);
844                     color.i.a = (c & 1) ? 0xff : 0;
845                  }
846                  else
847                  {
848                     color.i.r = color.i.g = color.i.b = (c >> 8) & 0xff;
849                     color.i.a = c & 0xff;
850                  }
851               }
852               else
853               {
854                  UINT8 p = (s & 1) ? (tc[taddr] & 0xf) : (tc[taddr] >> 4);
855                  p = (tpal << 4) | p;
856                  color.i.r = color.i.g = color.i.b = color.i.a = p;
857               }
858
841859               break;
842            case PIXEL_SIZE_8BIT:
860            }
861            case PIXEL_SIZE_8BIT: // Treated the same as 8-bit CI
862            {
863               UINT8 *tc = m_rdp->GetTMEM();
864               int taddr = (tbase << 3) + s;
865               taddr ^= ((t & 1) ? BYTE_XOR_DWORD_SWAP : BYTE_ADDR_XOR);
866               taddr &= 0xfff;
867
868               if (m_other_modes->en_tlut)
869               {
870                  taddr &= 0x7ff;
871                  UINT8 p = tc[taddr];
872                  UINT16 c = m_rdp->GetTLUT()[p << 2];
873
874                  if (m_other_modes->tlut_type == 0)
875                  {
876                     color.i.r = GET_HI_RGBA16_TMEM(c);
877                     color.i.g = GET_MED_RGBA16_TMEM(c);
878                     color.i.b = GET_LOW_RGBA16_TMEM(c);
879                     color.i.a = (c & 1) ? 0xff : 0;
880                  }
881                  else
882                  {
883                     color.i.r = color.i.g = color.i.b = (c >> 8) & 0xff;
884                     color.i.a = c & 0xff;
885                  }
886               }
887               else
888               {
889                  UINT8 p = tc[taddr];
890                  color.i.r = p;
891                  color.i.g = p;
892                  color.i.b = p;
893                  color.i.a = p;
894               }
843895               break;
896            }
844897            case PIXEL_SIZE_16BIT:
845898            {
846899               int taddr = (tbase << 2) + s;
r9916r9917
10371090               }
10381091               break;
10391092            }
1093            case PIXEL_SIZE_16BIT: // Treated the same as 16-bit RGBA
1094            {
1095               int taddr = (tbase << 2) + s;
1096               taddr ^= ((t & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR);
1097               taddr &= 0x7ff;
1098
1099               if (!m_other_modes->en_tlut)
1100               {
1101                  UINT16 c = tc16[taddr];
1102                  color.i.r = GET_HI_RGBA16_TMEM(c);
1103                  color.i.g = GET_MED_RGBA16_TMEM(c);
1104                  color.i.b = GET_LOW_RGBA16_TMEM(c);
1105                  color.i.a = (c & 1) ? 0xff : 0;
1106               }
1107               else
1108               {
1109                  UINT16 c = tc16[taddr];
1110                  c = m_rdp->GetTLUT()[(c >> 8) << 2];
1111                  if (m_other_modes->tlut_type == 0) // Used by Goldeneye 007 (ocean in Frigate)
1112                  {
1113                     color.i.r = GET_HI_RGBA16_TMEM(c);
1114                     color.i.g = GET_MED_RGBA16_TMEM(c);
1115                     color.i.b = GET_LOW_RGBA16_TMEM(c);
1116                     color.i.a = (c & 1) ? 0xff : 0;
1117                  }
1118                  else // Used by Beetle Adventure Racing (Mount Mayhem level)
1119                  {
1120                     color.i.r = color.i.g = color.i.b = (c >> 8) & 0xff;
1121                     color.i.a = c & 0xff;
1122                  }
1123               }
1124               break;
1125            }
1126            case PIXEL_SIZE_32BIT:  // Treated the same as 32-bit RGBA
1127            {
1128               UINT32 *tc = m_rdp->GetTMEM32();
1129               int taddr = (tbase << 2) + s;
1130               taddr ^= ((t & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR);
1131
1132               if (!m_other_modes->en_tlut)
1133               {
1134                  taddr &= 0x3ff;
1135                  UINT32 c = tc16[taddr];
1136                  color.i.r = (c >> 8) & 0xff;
1137                  color.i.g = c & 0xff;
1138                  c = tc16[taddr | 0x400];
1139                  color.i.b = (c >>  8) & 0xff;
1140                  color.i.a = c & 0xff;
1141               }
1142               else // Used by California Speed, attract mode
1143               {
1144                  taddr &= 0x3ff;
1145                  UINT32 c = tc[taddr];
1146                  c = m_rdp->GetTLUT()[(c >> 24) << 2];
1147                  if (m_other_modes->tlut_type == 0)
1148                  {
1149                     color.i.r = GET_HI_RGBA16_TMEM(c);
1150                     color.i.g = GET_MED_RGBA16_TMEM(c);
1151                     color.i.b = GET_LOW_RGBA16_TMEM(c);
1152                     color.i.a = (c & 1) ? 0xff : 0;
1153                  }
1154                  else
1155                  {
1156                     color.i.r = color.i.g = color.i.b = (c >> 8) & 0xff;
1157                     color.i.a = c & 0xff;
1158                  }
1159               }
1160
1161               break;
1162            }
10401163            default:
10411164               fatalerror("FETCH_TEXEL: unknown CI texture size %d\n", tsize);
10421165               break;
r9916r9917
12391362
12401363               break;
12411364            }
1365            case PIXEL_SIZE_16BIT: // Treated the same as 16-bit RGBA
1366            {
1367               int taddr = (tbase << 2) + s;
1368               taddr ^= ((t & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR);
1369               taddr &= 0x7ff;
1370
1371               if (!m_other_modes->en_tlut)
1372               {
1373                  UINT16 c = tc16[taddr];
1374                  color.i.r = GET_HI_RGBA16_TMEM(c);
1375                  color.i.g = GET_MED_RGBA16_TMEM(c);
1376                  color.i.b = GET_LOW_RGBA16_TMEM(c);
1377                  color.i.a = (c & 1) ? 0xff : 0;
1378               }
1379               else
1380               {
1381                  UINT16 c = tc16[taddr];
1382                  c = m_rdp->GetTLUT()[(c >> 8) << 2];
1383                  if (m_other_modes->tlut_type == 0) // Used by Goldeneye 007 (ocean in Frigate)
1384                  {
1385                     color.i.r = GET_HI_RGBA16_TMEM(c);
1386                     color.i.g = GET_MED_RGBA16_TMEM(c);
1387                     color.i.b = GET_LOW_RGBA16_TMEM(c);
1388                     color.i.a = (c & 1) ? 0xff : 0;
1389                  }
1390                  else // Used by Beetle Adventure Racing (Mount Mayhem level)
1391                  {
1392                     color.i.r = color.i.g = color.i.b = (c >> 8) & 0xff;
1393                     color.i.a = c & 0xff;
1394                  }
1395               }
1396               break;
1397            }
1398            case PIXEL_SIZE_32BIT:  // Treated the same as 32-bit RGBA
1399            {
1400               UINT32 *tc = m_rdp->GetTMEM32();
1401               int taddr = (tbase << 2) + s;
1402               taddr ^= ((t & 1) ? WORD_XOR_DWORD_SWAP : WORD_ADDR_XOR);
1403
1404               if (!m_other_modes->en_tlut)
1405               {
1406                  taddr &= 0x3ff;
1407                  UINT32 c = tc16[taddr];
1408                  color.i.r = (c >> 8) & 0xff;
1409                  color.i.g = c & 0xff;
1410                  c = tc16[taddr | 0x400];
1411                  color.i.b = (c >>  8) & 0xff;
1412                  color.i.a = c & 0xff;
1413               }
1414               else // Used by California Speed, attract mode
1415               {
1416                  taddr &= 0x3ff;
1417                  UINT32 c = tc[taddr];
1418                  c = m_rdp->GetTLUT()[(c >> 24) << 2];
1419                  if (m_other_modes->tlut_type == 0)
1420                  {
1421                     color.i.r = GET_HI_RGBA16_TMEM(c);
1422                     color.i.g = GET_MED_RGBA16_TMEM(c);
1423                     color.i.b = GET_LOW_RGBA16_TMEM(c);
1424                     color.i.a = (c & 1) ? 0xff : 0;
1425                  }
1426                  else
1427                  {
1428                     color.i.r = color.i.g = color.i.b = (c >> 8) & 0xff;
1429                     color.i.a = c & 0xff;
1430                  }
1431               }
1432
1433               break;
1434            }
12421435            default:
12431436               fatalerror("FETCH_TEXEL: unknown I texture size %d\n", tsize);
12441437               break;
src/mame/video/rdpspn16.c
r9916r9917
143143   SpanParam w = m_w;
144144
145145   UINT32 zb = m_misc_state->m_zb_address >> 1;
146   UINT32 zhb = zb;
146   UINT32 zhb = m_misc_state->m_zb_address;
147147   UINT8 offx = 0, offy = 0;
148148
149149   INT32 tile1 = tilenum;
r9916r9917
283283   SpanParam w = m_w;
284284
285285   UINT32 zb = m_misc_state->m_zb_address >> 1;
286   UINT32 zhb = zb;
286   UINT32 zhb = m_misc_state->m_zb_address;
287287   UINT8 offx = 0, offy = 0;
288288
289289   INT32 tile2 = (tilenum + 1) & 7;
src/mame/video/rdpfb.c
r9916r9917
3737#endif
3838
3939   UINT32 fb = (m_misc_state->m_fb_address >> 1) + curpixel;
40   UINT32 hb = fb;
40   UINT32 hb = m_misc_state->m_fb_address;
4141
4242#if 0
4343   if (m_misc_state->m_curpixel_cvg > 8 && m_other_modes->z_mode != 1)
r9916r9917
164164void Framebuffer::Read16Bit(UINT32 curpixel)
165165{
166166   UINT16 fword = RREADIDX16((m_misc_state->m_fb_address >> 1) + curpixel);
167   UINT8 hbyte = HREADADDR8((m_misc_state->m_fb_address >> 1) + curpixel);
167   UINT8 hbyte = HREADADDR8(m_misc_state->m_fb_address + curpixel);
168168   m_rdp->GetMemoryColor()->i.r = GETHICOL(fword);
169169   m_rdp->GetMemoryColor()->i.g = GETMEDCOL(fword);
170170   m_rdp->GetMemoryColor()->i.b = GETLOWCOL(fword);
r9916r9917
220220{
221221   UINT16 val = ((r >> 3) << 11) | ((g >> 3) << 6) | ((b >> 3) << 1) | ((m_misc_state->m_curpixel_cvg >> 2) & 1);
222222   RWRITEIDX16((m_misc_state->m_fb_address >> 1) + curpixel, val);
223   HWRITEADDR8((m_misc_state->m_fb_address >> 1) + curpixel, m_misc_state->m_curpixel_cvg & 3);
223   HWRITEADDR8(m_misc_state->m_fb_address + curpixel, m_misc_state->m_curpixel_cvg & 3);
224224}
225225
226226void Framebuffer::Copy32Bit(UINT32 curpixel, UINT32 r, UINT32 g, UINT32 b)
r9916r9917
259259      val = (m_rdp->GetFillColor32() >> 16) & 0xffff;
260260   }
261261   RWRITEIDX16((m_misc_state->m_fb_address >> 1) + curpixel, val);
262   HWRITEADDR8((m_misc_state->m_fb_address >> 1) + curpixel, ((val & 1) << 1) | (val & 1));
262   HWRITEADDR8(m_misc_state->m_fb_address + curpixel, ((val & 1) << 1) | (val & 1));
263263}
264264
265265void Framebuffer::Fill32Bit(UINT32 curpixel)
266266{
267267   UINT32 fill_color = m_rdp->GetFillColor32();
268268   RWRITEIDX32((m_misc_state->m_fb_address >> 2) + curpixel, fill_color);
269   HWRITEADDR8((m_misc_state->m_fb_address >> 1) + (curpixel << 1), (fill_color & 0x10000) ? 3 : 0);
270   HWRITEADDR8((m_misc_state->m_fb_address >> 1) + (curpixel << 1) + 1, (fill_color & 0x1) ? 3 : 0);
269   HWRITEADDR8(m_misc_state->m_fb_address + (curpixel << 1), (fill_color & 0x10000) ? 3 : 0);
270   HWRITEADDR8(m_misc_state->m_fb_address + (curpixel << 1) + 1, (fill_color & 0x1) ? 3 : 0);
271271}
272272
273273} // namespace RDP

Previous 15994 Revisions Next


© 1998-2018 The MESS Team