Previous 199869 Revisions Next

r21440 Monday 25th February, 2013 at 22:55:28 UTC by David Haywood
notes on clipping during ending, and a bit of a hack
[src/mame/drivers]coolridr.c

trunk/src/mame/drivers/coolridr.c
r21439r21440
408408   UINT32 m_spriteblit[12];
409409
410410   UINT32 m_clipvals[2][3];
411   UINT8  m_clipblitterMode[2]; // hack
411412
412413
413
414414   required_device<cpu_device> m_maincpu;
415415   required_device<cpu_device> m_subcpu;
416416   required_device<cpu_device> m_soundcpu;
r21439r21440
13141314      if (clipminY>clipmaxY) clipminY = clipmaxY;
13151315   
13161316
1317
1318//      b1colorNumber = object->state->machine().rand()&0xfff;
1317      //b1colorNumber = object->state->machine().rand()&0xfff;
13191318   }
13201319
13211320   /* DRAW */
r21439r21440
17651764
17661765      if (m_blitterMode&0x80)
17671766      {
1768         m_clipvals[1][0] = m_spriteblit[1];
1769         m_clipvals[1][1] = m_spriteblit[2];
1770         m_clipvals[1][2] = m_spriteblit[3];
1767         // HACK...
1768         // the end sequences do this.. 4f / af cliprects
1769         //(mode 4f) unknown sprite list type 1 - 0054 0105 0059 0198 (00540105 0060019f 00000007)
1770         //(mode 50) unknown sprite list type 1 - 0000 017f 0000 01f0 (0000017f 000701f7 00000007)
1771         // THEN writes the sprite that needs to be clipped(!)
1772         // this ends up disabling the cliprect before the sprite that actually needs it
1773         //
1774         // all other cliprect blits seem to be written after mode 50, so this hack just prevents
1775         // writes with a higher value than the last one from taking effect, fixing the ending...
1776         // especially noticable with 'LoveMachine'
1777         // (mode 4f) unknown sprite list type 1 - 0054 0105 0059 0198 (00540105 0060019f 00000007)
1778         // (mode 50) unknown sprite list type 1 - 0000 017f 0000 01f0 (0000017f 000701f7 00000007)
1779         // said ending also ends up drawing a red bar under the image, which isn't clipped out and
1780         // is sent before the clip window anyway(?)...
17711781
1782         // lightning also needs clipping (doesn't have the red bar problem)
1783         // (mode 4f) unknown sprite list type 1 - 0054 0105 0059 0198 (00540105 0060019f 00000007)
1784
1785         if (m_clipblitterMode[1] >= m_blitterMode)
1786         {
1787            m_clipvals[1][0] = m_spriteblit[1];
1788            m_clipvals[1][1] = m_spriteblit[2];
1789            m_clipvals[1][2] = m_spriteblit[3];
1790            m_clipblitterMode[1] = m_blitterMode;
1791         }
1792
17721793      }
17731794      else
17741795      {
1775         m_clipvals[0][0] = m_spriteblit[1];
1776         m_clipvals[0][1] = m_spriteblit[2];
1777         m_clipvals[0][2] = m_spriteblit[3];
1778         //printf("unknown sprite list type 1 - %04x %04x %04x %04x (%08x %08x %08x)\n", (m_spriteblit[1]&0xffff0000)>>16,(m_spriteblit[1]&0x0000ffff)>>0, ((m_spriteblit[2]&0xffff0000)>>16)-((m_spriteblit[3]&0x0000ffff)>>0),((m_spriteblit[2]&0x0000ffff)>>0)-((m_spriteblit[3]&0x0000ffff)>>0),    m_spriteblit[1],m_spriteblit[2],m_spriteblit[3]);
1796         if (m_clipblitterMode[0] >= m_blitterMode)
1797         {
1798            m_clipvals[0][0] = m_spriteblit[1];
1799            m_clipvals[0][1] = m_spriteblit[2];
1800            m_clipvals[0][2] = m_spriteblit[3];
1801            m_clipblitterMode[0] = m_blitterMode;
1802         }
1803         printf("(mode %02x) unknown sprite list type 1 - %04x %04x %04x %04x (%08x %08x %08x)\n", m_blitterMode, (m_spriteblit[1]&0xffff0000)>>16,(m_spriteblit[1]&0x0000ffff)>>0, ((m_spriteblit[2]&0xffff0000)>>16)-((m_spriteblit[3]&0x0000ffff)>>0),((m_spriteblit[2]&0x0000ffff)>>0)-((m_spriteblit[3]&0x0000ffff)>>0),    m_spriteblit[1],m_spriteblit[2],m_spriteblit[3]);
1804
17791805      }
17801806
17811807      // abort early
r21439r21440
18361862   testobject->blittype = m_blittype;
18371863   osd_work_queue *queue;
18381864   // which queue, which bitmap
1839   if (m_blitterMode == 0x30 || m_blitterMode == 0x40 || m_blitterMode == 0x50 || m_blitterMode == 0x60)
1865   if (m_blitterMode == 0x30 || m_blitterMode == 0x40 || m_blitterMode == 0x4f || m_blitterMode == 0x50 || m_blitterMode == 0x60)
18401866   {
18411867      testobject->drawbitmap = &m_temp_bitmap_sprites[0];
18421868      testobject->zbitmap = &m_zbuffer_bitmap;
r21439r21440
18471873
18481874      queue = m_work_queue[0];
18491875   }
1850   else // 0x90, 0xa0, 0xb0, 0xc0
1876   else // 0x90, 0xa0, 0xaf, 0xb0, 0xc0
18511877   {
18521878      testobject->drawbitmap = &m_temp_bitmap_sprites2[0];
18531879      testobject->zbitmap = &m_zbuffer_bitmap2;
r21439r21440
18671893{
18681894   m_blitterMode = (data & 0x00ff0000) >> 16;
18691895
1870   if (m_blitterMode == 0x4f)
1896
1897   if (m_blitterMode == 0xf4)
18711898   {
1872      /* used during end sequence, purpose unknown */
1873   }
1874   else if (m_blitterMode == 0xf4)
1875   {
18761899      // Some sort of addressing state.
18771900      // In the case of text, simply writes 4 characters per 32-bit word.
18781901      // These values may be loaded into RAM somewhere as they are written.
r21439r21440
18871910
18881911
18891912   }
1890   else if (m_blitterMode == 0x30 || m_blitterMode == 0x40 || m_blitterMode == 0x50 || m_blitterMode == 0x60
1891        || m_blitterMode == 0x90 || m_blitterMode == 0xa0 || m_blitterMode == 0xb0 || m_blitterMode == 0xc0)
1913   else if (m_blitterMode == 0x30 || m_blitterMode == 0x40 || m_blitterMode == 0x4f || m_blitterMode == 0x50 || m_blitterMode == 0x60
1914        || m_blitterMode == 0x90 || m_blitterMode == 0xa0 || m_blitterMode == 0xaf || m_blitterMode == 0xb0 || m_blitterMode == 0xc0)
18921915   {
1916      // 4f / af are used to send the clipping window during the end sequence, I don't know if the 'f' bit has any special meaning
1917      // we need a hack for the blit window to set by them to work at all
1918
18931919      // The blitter function(s).
18941920      // After this is set a fixed count of 11 32-bit words are sent to the data register.
18951921      // The lower word always seems to be 0x0001 and the upper byte always 0xac.
r21439r21440
19141940
19151941      // i've seen this triggered once or twice
19161942      // might be there are more z-bits, or it's just overflowing when there are too many sprites
1917      if (data & 0x0000f000)
1918         printf("blitter mode with mask 0x0000f000\n");
1943      // also set on the 4f/af cliprect during the ending
1944      //if (data & 0x0000f000)
1945      //   printf("blitter mode with mask 0x0000f000 (%08x)\n", data & 0x0000f000);
19191946
19201947
19211948
r21439r21440
19571984      space.write_dword(memOffset, data);
19581985      m_blitterSerialCount += 0x04;
19591986   }
1960   else if (m_blitterMode == 0x30 || m_blitterMode == 0x40 || m_blitterMode == 0x50 || m_blitterMode == 0x60
1961        || m_blitterMode == 0x90 || m_blitterMode == 0xa0 || m_blitterMode == 0xb0 || m_blitterMode == 0xc0)
1987   else if (m_blitterMode == 0x30 || m_blitterMode == 0x40 || m_blitterMode == 0x4f || m_blitterMode == 0x50 || m_blitterMode == 0x60
1988        || m_blitterMode == 0x90 || m_blitterMode == 0xa0 || m_blitterMode == 0xaf || m_blitterMode == 0xb0 || m_blitterMode == 0xc0)
19621989   {
19631990      // Serialized counts
19641991      if (m_blitterSerialCount < 12)
r21439r21440
20072034   }
20082035   else
20092036   {
2010      logerror("unk blit mode %02x\n", m_blitterMode);
2037      printf("unk blit mode %02x\n", m_blitterMode);
20112038   }
20122039}
20132040
r21439r21440
20802107            m_clipvals[0][0] = 0;
20812108            m_clipvals[0][1] = 0;
20822109            m_clipvals[0][2] = 0;
2110            m_clipblitterMode[0] = 0xff;
20832111         }
20842112         else if(m_blitterClearMode == 0x8c800000)
20852113         {
r21439r21440
20912119            m_clipvals[1][0] = 0;
20922120            m_clipvals[1][1] = 0;
20932121            m_clipvals[1][2] = 0;
2122            m_clipblitterMode[1] = 0xff;
20942123         }
20952124
20962125         //printf("frame\n");

Previous 199869 Revisions Next


© 1997-2024 The MAME Team