Previous 199869 Revisions Next

r29320 Saturday 5th April, 2014 at 15:47:25 UTC by Nathan Woods
Merge branch 'master' of ssh://mess.org/mame into new_menus
[/branches/new_menus/src/emu]digfx.c* digfx.h* drawgfx.c drawgfx.h emu.h emu.mak machine.h tilemap.c tilemap.h validity.c validity.h
[/branches/new_menus/src/emu/bus/iq151]video32.c video64.c
[/branches/new_menus/src/emu/ui]viewgfx.c
[/branches/new_menus/src/mame/drivers]nemesis.c pgm.c toaplan1.c twincobr.c wardner.c
[/branches/new_menus/src/mame/includes]toaplan1.h twincobr.h
[/branches/new_menus/src/mame/video]c45.c k053250.c k053250.h nemesis.c pgm.c toaplan1.c toaplan_scu.c toaplan_scu.h twincobr.c
[/branches/new_menus/src/mess/machine]megacd.c

branches/new_menus/src/mame/drivers/twincobr.c
r29319r29320
639639   8*8             /* every tile takes 8 consecutive bytes */
640640};
641641
642static const gfx_layout spritelayout =
643{
644   16,16,          /* 16*16 sprites */
645   RGN_FRAC(1,4),  /* 2048 sprites */
646   4,              /* 4 bits per pixel */
647   { RGN_FRAC(0,4), RGN_FRAC(1,4), RGN_FRAC(2,4), RGN_FRAC(3,4) },
648   { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
649   { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
650         8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 },
651   32*8            /* every sprite takes 32 consecutive bytes */
652};
653
654642static GFXDECODE_START( twincobr )
655643   GFXDECODE_ENTRY( "gfx1", 0x00000, charlayout,   1536, 32 )  /* colors 1536-1791 */
656644   GFXDECODE_ENTRY( "gfx2", 0x00000, tilelayout,   1280, 16 )  /* colors 1280-1535 */
657645   GFXDECODE_ENTRY( "gfx3", 0x00000, tilelayout,   1024, 16 )  /* colors 1024-1079 */
658   GFXDECODE_ENTRY( "gfx4", 0x00000, spritelayout,    0, 64 )  /* colors    0-1023 */
659646GFXDECODE_END
660647
661648
r29319r29320
692679   /* video hardware */
693680   MCFG_MC6845_ADD("crtc", HD6845, "screen", XTAL_28MHz/8, twincobr_mc6845_intf) /* 3.5MHz measured on CLKin */
694681
695   MCFG_TOAPLAN_SCU_ADD("toaplan_scu")
696   MCFG_TOAPLAN_SCU_GFXDECODE("gfxdecode")
682   MCFG_TOAPLAN_SCU_ADD("scu", "palette", 31, 15)
697683
698684   MCFG_BUFFERED_SPRITERAM16_ADD("spriteram16")
699685
r29319r29320
719705MACHINE_CONFIG_END
720706
721707
722static MACHINE_CONFIG_DERIVED( fsharkbt, twincobr )
708static MACHINE_CONFIG_DERIVED( fshark, twincobr )
709   MCFG_DEVICE_MODIFY("scu")
710   toaplan_scu_device::static_set_xoffsets(*device, 32, 14);
711MACHINE_CONFIG_END
723712
713
714static MACHINE_CONFIG_DERIVED( fsharkbt, fshark )
715
724716   MCFG_CPU_ADD("mcu", I8741, XTAL_28MHz/16)
725717   /* Program Map is internal to the CPU */
726718   MCFG_CPU_IO_MAP(fsharkbt_i8741_io_map)
r29319r29320
772764   ROM_LOAD( "b30_10.12c", 0x10000, 0x08000, CRC(170c01db) SHA1(f4c5a1600f6cbb48abbace66c6f7514f79138e8b) )
773765   ROM_LOAD( "b30_09.10c", 0x18000, 0x08000, CRC(44f5accd) SHA1(2f9bdebe71c8be195332356df68992fd38d86994) )
774766
775   ROM_REGION( 0x40000, "gfx4", 0 )    /* sprites */
767   ROM_REGION( 0x40000, "scu", 0 )    /* sprites */
776768   ROM_LOAD( "b30_20.12d", 0x00000, 0x10000, CRC(cb4092b8) SHA1(35b1d1e04af760fa106124bd5a94174d63ff9705) )
777769   ROM_LOAD( "b30_19.14d", 0x10000, 0x10000, CRC(9cb8675e) SHA1(559c21d505c60401f7368d4ab2b686b15075c5c5) )
778770   ROM_LOAD( "b30_18.15d", 0x20000, 0x10000, CRC(806fb374) SHA1(3eebefadcbdf713bf2a65b438092746b07edd3f0) )
r29319r29320
817809   ROM_LOAD( "b30_10.12c", 0x10000, 0x08000, CRC(170c01db) SHA1(f4c5a1600f6cbb48abbace66c6f7514f79138e8b) )
818810   ROM_LOAD( "b30_09.10c", 0x18000, 0x08000, CRC(44f5accd) SHA1(2f9bdebe71c8be195332356df68992fd38d86994) )
819811
820   ROM_REGION( 0x40000, "gfx4", 0 )    /* sprites */
812   ROM_REGION( 0x40000, "scu", 0 )    /* sprites */
821813   ROM_LOAD( "b30_20.12d", 0x00000, 0x10000, CRC(cb4092b8) SHA1(35b1d1e04af760fa106124bd5a94174d63ff9705) )
822814   ROM_LOAD( "b30_19.14d", 0x10000, 0x10000, CRC(9cb8675e) SHA1(559c21d505c60401f7368d4ab2b686b15075c5c5) )
823815   ROM_LOAD( "b30_18.15d", 0x20000, 0x10000, CRC(806fb374) SHA1(3eebefadcbdf713bf2a65b438092746b07edd3f0) )
r29319r29320
862854   ROM_LOAD( "b30_10.12c", 0x10000, 0x08000, CRC(170c01db) SHA1(f4c5a1600f6cbb48abbace66c6f7514f79138e8b) )
863855   ROM_LOAD( "b30_09.10c", 0x18000, 0x08000, CRC(44f5accd) SHA1(2f9bdebe71c8be195332356df68992fd38d86994) )
864856
865   ROM_REGION( 0x40000, "gfx4", 0 )    /* sprites */
857   ROM_REGION( 0x40000, "scu", 0 )    /* sprites */
866858   ROM_LOAD( "b30_20.12d", 0x00000, 0x10000, CRC(cb4092b8) SHA1(35b1d1e04af760fa106124bd5a94174d63ff9705) )
867859   ROM_LOAD( "b30_19.14d", 0x10000, 0x10000, CRC(9cb8675e) SHA1(559c21d505c60401f7368d4ab2b686b15075c5c5) )
868860   ROM_LOAD( "b30_18.15d", 0x20000, 0x10000, CRC(806fb374) SHA1(3eebefadcbdf713bf2a65b438092746b07edd3f0) )
r29319r29320
911903   ROM_LOAD( "b02_10.h16", 0x10000, 0x08000, CRC(4bd099ff) SHA1(9326075f83549b0a9656f69bd4436fb1be2ac805) )
912904   ROM_LOAD( "b02_09.h15", 0x18000, 0x08000, CRC(230f1582) SHA1(0fd4156a46ed64cb6e5c59b8836382dd86c229cf) )
913905
914   ROM_REGION( 0x40000, "gfx4", 0 )    /* sprites */
906   ROM_REGION( 0x40000, "scu", 0 )    /* sprites */
915907   ROM_LOAD( "b02_01.d15", 0x00000, 0x10000, CRC(2234b424) SHA1(bd6242b9dcdb0f582565df588106cd1ce2aad53b) )
916908   ROM_LOAD( "b02_02.d16", 0x10000, 0x10000, CRC(30d4c9a8) SHA1(96ce4f41207c5487e801a8444030ec4dc7b58b23) )
917909   ROM_LOAD( "b02_03.d17", 0x20000, 0x10000, CRC(64f3d88f) SHA1(d0155cfb0a8885d58e34141f9696b9aa208440ca) )
r29319r29320
960952   ROM_LOAD( "b02_10.h16", 0x10000, 0x08000, CRC(4bd099ff) SHA1(9326075f83549b0a9656f69bd4436fb1be2ac805) )
961953   ROM_LOAD( "b02_09.h15", 0x18000, 0x08000, CRC(230f1582) SHA1(0fd4156a46ed64cb6e5c59b8836382dd86c229cf) )
962954
963   ROM_REGION( 0x40000, "gfx4", 0 )    /* sprites */
955   ROM_REGION( 0x40000, "scu", 0 )    /* sprites */
964956   ROM_LOAD( "b02_01.d15", 0x00000, 0x10000, CRC(2234b424) SHA1(bd6242b9dcdb0f582565df588106cd1ce2aad53b) )
965957   ROM_LOAD( "b02_02.d16", 0x10000, 0x10000, CRC(30d4c9a8) SHA1(96ce4f41207c5487e801a8444030ec4dc7b58b23) )
966958   ROM_LOAD( "b02_03.d17", 0x20000, 0x10000, CRC(64f3d88f) SHA1(d0155cfb0a8885d58e34141f9696b9aa208440ca) )
r29319r29320
10091001   ROM_LOAD( "b02_10.h16", 0x10000, 0x08000, CRC(4bd099ff) SHA1(9326075f83549b0a9656f69bd4436fb1be2ac805) )
10101002   ROM_LOAD( "b02_09.h15", 0x18000, 0x08000, CRC(230f1582) SHA1(0fd4156a46ed64cb6e5c59b8836382dd86c229cf) )
10111003
1012   ROM_REGION( 0x40000, "gfx4", 0 )    /* sprites */
1004   ROM_REGION( 0x40000, "scu", 0 )    /* sprites */
10131005   ROM_LOAD( "b02_01.d15", 0x00000, 0x10000, CRC(2234b424) SHA1(bd6242b9dcdb0f582565df588106cd1ce2aad53b) )
10141006   ROM_LOAD( "b02_02.d16", 0x10000, 0x10000, CRC(30d4c9a8) SHA1(96ce4f41207c5487e801a8444030ec4dc7b58b23) )
10151007   ROM_LOAD( "b02_03.d17", 0x20000, 0x10000, CRC(64f3d88f) SHA1(d0155cfb0a8885d58e34141f9696b9aa208440ca) )
r29319r29320
10611053   ROM_LOAD( "b02_10.h16", 0x10000, 0x08000, CRC(4bd099ff) SHA1(9326075f83549b0a9656f69bd4436fb1be2ac805) )
10621054   ROM_LOAD( "b02_09.h15", 0x18000, 0x08000, CRC(230f1582) SHA1(0fd4156a46ed64cb6e5c59b8836382dd86c229cf) )
10631055
1064   ROM_REGION( 0x40000, "gfx4", 0 )    /* sprites */
1056   ROM_REGION( 0x40000, "scu", 0 )    /* sprites */
10651057   ROM_LOAD( "b02_01.d15", 0x00000, 0x10000, CRC(2234b424) SHA1(bd6242b9dcdb0f582565df588106cd1ce2aad53b) )
10661058   ROM_LOAD( "b02_02.d16", 0x10000, 0x10000, CRC(30d4c9a8) SHA1(96ce4f41207c5487e801a8444030ec4dc7b58b23) )
10671059   ROM_LOAD( "b02_03.d17", 0x20000, 0x10000, CRC(64f3d88f) SHA1(d0155cfb0a8885d58e34141f9696b9aa208440ca) )
r29319r29320
11231115   ROM_LOAD( "10.ic116", 0x10000, 0x08000, CRC(4bd099ff) SHA1(9326075f83549b0a9656f69bd4436fb1be2ac805) )
11241116   ROM_LOAD( "9.ic117",  0x18000, 0x08000, CRC(230f1582) SHA1(0fd4156a46ed64cb6e5c59b8836382dd86c229cf) )
11251117
1126   ROM_REGION( 0x40000, "gfx4", 0 )    /* sprites */
1118   ROM_REGION( 0x40000, "scu", 0 )    /* sprites */
11271119   ROM_LOAD( "1.ic54", 0x00000, 0x10000, CRC(2234b424) SHA1(bd6242b9dcdb0f582565df588106cd1ce2aad53b) )
11281120   ROM_LOAD( "2.ic53", 0x10000, 0x10000, CRC(30d4c9a8) SHA1(96ce4f41207c5487e801a8444030ec4dc7b58b23) )
11291121   ROM_LOAD( "3.ic52", 0x20000, 0x10000, CRC(64f3d88f) SHA1(d0155cfb0a8885d58e34141f9696b9aa208440ca) )
r29319r29320
11771169   ROM_LOAD( "11-u197.bin", 0x10000, 0x08000, CRC(7b721ed3) SHA1(afd10229414c65a56e184d56a69460ca3a502a27) )
11781170   ROM_LOAD( "10-u196.rom", 0x18000, 0x08000, CRC(160f38ab) SHA1(da310ec387d439b26c8b6b881e5dcc07c2b9bb00) )
11791171
1180   ROM_REGION( 0x40000, "gfx4", 0 )    /* sprites */
1172   ROM_REGION( 0x40000, "scu", 0 )    /* sprites */
11811173   ROM_LOAD( "20-u262.bin", 0x00000, 0x10000, CRC(10665ca0) SHA1(0c552c3807e00a7ef4f9fd28c7988a232628a1f5) )
11821174   ROM_LOAD( "19-u261.bin", 0x10000, 0x10000, CRC(cfa6d417) SHA1(f6c17d938b58dc5756ecf617f00fbfaf701602a7) )
11831175   ROM_LOAD( "18-u260.bin", 0x20000, 0x10000, CRC(2e6a0c49) SHA1(0b7ddad8775dcebe240a8246ef7816113f517f87) )
r29319r29320
12231215   ROM_LOAD( "11-u197.bin", 0x10000, 0x08000, CRC(7b721ed3) SHA1(afd10229414c65a56e184d56a69460ca3a502a27) )
12241216   ROM_LOAD( "10-u196.rom", 0x18000, 0x08000, CRC(160f38ab) SHA1(da310ec387d439b26c8b6b881e5dcc07c2b9bb00) )
12251217
1226   ROM_REGION( 0x40000, "gfx4", 0 )    /* sprites */
1218   ROM_REGION( 0x40000, "scu", 0 )    /* sprites */
12271219   ROM_LOAD( "20-u262.bin", 0x00000, 0x10000, CRC(10665ca0) SHA1(0c552c3807e00a7ef4f9fd28c7988a232628a1f5) )
12281220   ROM_LOAD( "19-u261.bin", 0x10000, 0x10000, CRC(cfa6d417) SHA1(f6c17d938b58dc5756ecf617f00fbfaf701602a7) )
12291221   ROM_LOAD( "18-u260.bin", 0x20000, 0x10000, CRC(2e6a0c49) SHA1(0b7ddad8775dcebe240a8246ef7816113f517f87) )
r29319r29320
12431235}
12441236
12451237
1246GAME( 1987, fshark,    0,        twincobr, fshark, twincobr_state,    twincobr, ROT270, "Toaplan / Taito Corporation", "Flying Shark (World)", 0 )
1247GAME( 1987, skyshark,  fshark,   twincobr, skyshark, twincobr_state,  twincobr, ROT270, "Toaplan / Taito America Corporation (Romstar license)", "Sky Shark (US)", 0 )
1248GAME( 1987, hishouza,  fshark,   twincobr, hishouza, twincobr_state,  twincobr, ROT270, "Toaplan / Taito Corporation", "Hishou Zame (Japan)", 0 )
1238GAME( 1987, fshark,    0,        fshark,   fshark, twincobr_state,    twincobr, ROT270, "Toaplan / Taito Corporation", "Flying Shark (World)", 0 )
1239GAME( 1987, skyshark,  fshark,   fshark,   skyshark, twincobr_state,  twincobr, ROT270, "Toaplan / Taito America Corporation (Romstar license)", "Sky Shark (US)", 0 )
1240GAME( 1987, hishouza,  fshark,   fshark,   hishouza, twincobr_state,  twincobr, ROT270, "Toaplan / Taito Corporation", "Hishou Zame (Japan)", 0 )
12491241GAME( 1987, fsharkbt,  fshark,   fsharkbt, skyshark, twincobr_state,  twincobr, ROT270, "bootleg", "Flying Shark (bootleg with 8741)", 0 )
1250GAME( 1987, fnshark,   fshark,   twincobr, hishouza, twincobr_state,  twincobr, ROT270, "bootleg", "Flyin' Shark (bootleg of Hishou Zame)", 0 )
1242GAME( 1987, fnshark,   fshark,   fshark,  hishouza, twincobr_state,  twincobr, ROT270, "bootleg", "Flyin' Shark (bootleg of Hishou Zame)", 0 )
12511243GAME( 1987, twincobr,  0,        twincobr, twincobr, twincobr_state,  twincobr, ROT270, "Toaplan / Taito Corporation", "Twin Cobra (World)", 0 )
12521244GAME( 1987, twincobru, twincobr, twincobr, twincobru, twincobr_state, twincobr, ROT270, "Toaplan / Taito America Corporation (Romstar license)", "Twin Cobra (US)", 0 )
12531245GAME( 1987, ktiger,    twincobr, twincobr, ktiger, twincobr_state,    twincobr, ROT270, "Toaplan / Taito Corporation", "Kyukyoku Tiger (Japan)", 0 )
branches/new_menus/src/mame/drivers/toaplan1.c
r29319r29320
17711771   16*8            /* every tile takes 16 consecutive bytes */
17721772};
17731773
1774static const gfx_layout rallybik_spr_layout =
1775{
1776   16,16,          /* 16*16 sprites */
1777   RGN_FRAC(1,4),  /* 2048 sprites */
1778   4,              /* 4 bits per pixel */
1779   { RGN_FRAC(0,4), RGN_FRAC(1,4), RGN_FRAC(2,4), RGN_FRAC(3,4) },
1780   { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
1781   { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
1782         8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 },
1783   32*8            /* every sprite takes 32 consecutive bytes */
1784};
17851774
1786
17871775static GFXDECODE_START( toaplan1 )
17881776   GFXDECODE_ENTRY( "gfx1", 0x00000, tilelayout,       0, 64 )
17891777   GFXDECODE_ENTRY( "gfx2", 0x00000, tilelayout,   64*16, 64 )
r29319r29320
17911779
17921780static GFXDECODE_START( rallybik )
17931781   GFXDECODE_ENTRY( "gfx1", 0x00000, tilelayout,             0, 64 )
1794   GFXDECODE_ENTRY( "gfx2", 0x00000, rallybik_spr_layout, 64*16, 64 )
17951782GFXDECODE_END
17961783
17971784
r29319r29320
18251812   MCFG_SCREEN_VBLANK_DRIVER(toaplan1_rallybik_state, screen_eof_rallybik)
18261813   MCFG_SCREEN_PALETTE("palette")
18271814
1828   MCFG_TOAPLAN_SCU_ADD("toaplan_scu")
1829   MCFG_TOAPLAN_SCU_GFXDECODE("gfxdecode")
1815   MCFG_TOAPLAN_SCU_ADD("scu", "palette", 31, 15)
18301816
18311817   MCFG_GFXDECODE_ADD("gfxdecode", "palette", rallybik)
18321818   MCFG_PALETTE_ADD("palette", (64*16)+(64*16))
r29319r29320
21332119   ROM_LOAD16_BYTE( "b45-07.bin",  0x40000, 0x20000, CRC(cd3748b4) SHA1(a20eb19a0f813112b4e5d9cd91db29de9b37af17) )
21342120   ROM_LOAD16_BYTE( "b45-06.bin",  0x40001, 0x20000, CRC(144b085c) SHA1(84b7412d58fe9c5e9915896db92e80a621571b74) )
21352121
2136   ROM_REGION( 0x40000, "gfx2", 0 )
2122   ROM_REGION( 0x40000, "scu", 0 )
21372123   ROM_LOAD( "b45-11.rom",  0x00000, 0x10000, CRC(0d56e8bb) SHA1(c29cb53f846c73b7cf9936051fb0f9dd3805f53f) )
21382124   ROM_LOAD( "b45-10.rom",  0x10000, 0x10000, CRC(dbb7c57e) SHA1(268132965cd65b5e972ca9d0258c30b8a86f3703) )
21392125   ROM_LOAD( "b45-12.rom",  0x20000, 0x10000, CRC(cf5aae4e) SHA1(5832c52d2e9b86414d8ee2926fa190abe9e41da4) )
branches/new_menus/src/mame/drivers/wardner.c
r29319r29320
336336   8*8     /* every tile takes 8 consecutive bytes */
337337};
338338
339static const gfx_layout spritelayout =
340{
341   16,16,  /* 16*16 sprites */
342   2048,   /* 2048 sprites */
343   4,      /* 4 bits per pixel */
344   { 0*2048*32*8, 1*2048*32*8, 2*2048*32*8, 3*2048*32*8 }, /* the bitplanes are separated */
345   { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
346   { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
347         8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 },
348   32*8    /* every sprite takes 32 consecutive bytes */
349};
350339
351
352340/* handler called by the 3812 emulator when the internal timers cause an IRQ */
353341WRITE_LINE_MEMBER(wardner_state::irqhandler)
354342{
r29319r29320
360348   GFXDECODE_ENTRY( "gfx1", 0x00000, charlayout,   1536, 32 )  /* colors 1536-1791 */
361349   GFXDECODE_ENTRY( "gfx2", 0x00000, tilelayout,   1280, 16 )  /* colors 1280-1535 */
362350   GFXDECODE_ENTRY( "gfx3", 0x00000, tilelayout,   1024, 16 )  /* colors 1024-1079 */
363   GFXDECODE_ENTRY( "gfx4", 0x00000, spritelayout,    0, 64 )  /* colors    0-1023 */
364351GFXDECODE_END
365352
366353
r29319r29320
409396   /* video hardware */
410397   MCFG_MC6845_ADD("crtc", HD6845, "screen", XTAL_14MHz/4, twincobr_mc6845_intf) /* 3.5MHz measured on CLKin */
411398
412   MCFG_TOAPLAN_SCU_ADD("toaplan_scu")
413   MCFG_TOAPLAN_SCU_GFXDECODE("gfxdecode")
399   MCFG_TOAPLAN_SCU_ADD("scu", "palette", 32, 14)
414400
415401   MCFG_BUFFERED_SPRITERAM8_ADD("spriteram8")
416402
r29319r29320
480466   ROM_LOAD( "b25-10.rom",  0x10000, 0x08000, CRC(b9a61e81) SHA1(541e579664d583fbbf81111046115018fdaff073) )
481467   ROM_LOAD( "b25-09.rom",  0x18000, 0x08000, CRC(585411b7) SHA1(67c0f4b7ab303341d5481c4024dc4199acb7c279) )
482468
483   ROM_REGION( 0x40000, "gfx4", 0 )    /* sprites */
469   ROM_REGION( 0x40000, "scu", 0 )    /* sprites */
484470   ROM_LOAD( "b25-01.rom",  0x00000, 0x10000, CRC(42ec01fb) SHA1(646192a2e89f795ed016860cdcdc0b5ef645fca2) )
485471   ROM_LOAD( "b25-02.rom",  0x10000, 0x10000, CRC(6c0130b7) SHA1(8b6ad72848d03c3d4ee3acd35abbb3a0e678122c) )
486472   ROM_LOAD( "b25-03.rom",  0x20000, 0x10000, CRC(b923db99) SHA1(2f4be81afdf200586bc44b1e94553d84d16d0b62) )
r29319r29320
531517   ROM_LOAD( "b25-10.rom",  0x10000, 0x08000, CRC(b9a61e81) SHA1(541e579664d583fbbf81111046115018fdaff073) )
532518   ROM_LOAD( "b25-09.rom",  0x18000, 0x08000, CRC(585411b7) SHA1(67c0f4b7ab303341d5481c4024dc4199acb7c279) )
533519
534   ROM_REGION( 0x40000, "gfx4", 0 )    /* sprites */
520   ROM_REGION( 0x40000, "scu", 0 )    /* sprites */
535521   ROM_LOAD( "b25-01.rom",  0x00000, 0x10000, CRC(42ec01fb) SHA1(646192a2e89f795ed016860cdcdc0b5ef645fca2) )
536522   ROM_LOAD( "b25-02.rom",  0x10000, 0x10000, CRC(6c0130b7) SHA1(8b6ad72848d03c3d4ee3acd35abbb3a0e678122c) )
537523   ROM_LOAD( "b25-03.rom",  0x20000, 0x10000, CRC(b923db99) SHA1(2f4be81afdf200586bc44b1e94553d84d16d0b62) )
r29319r29320
582568   ROM_LOAD( "b25-10.rom",  0x10000, 0x08000, CRC(b9a61e81) SHA1(541e579664d583fbbf81111046115018fdaff073) )
583569   ROM_LOAD( "b25-09.rom",  0x18000, 0x08000, CRC(585411b7) SHA1(67c0f4b7ab303341d5481c4024dc4199acb7c279) )
584570
585   ROM_REGION( 0x40000, "gfx4", 0 )    /* sprites */
571   ROM_REGION( 0x40000, "scu", 0 )    /* sprites */
586572   ROM_LOAD( "b25-01.rom",  0x00000, 0x10000, CRC(42ec01fb) SHA1(646192a2e89f795ed016860cdcdc0b5ef645fca2) )
587573   ROM_LOAD( "b25-02.rom",  0x10000, 0x10000, CRC(6c0130b7) SHA1(8b6ad72848d03c3d4ee3acd35abbb3a0e678122c) )
588574   ROM_LOAD( "b25-03.rom",  0x20000, 0x10000, CRC(b923db99) SHA1(2f4be81afdf200586bc44b1e94553d84d16d0b62) )
branches/new_menus/src/mame/drivers/pgm.c
r29319r29320
431431/*** GFX Decodes *************************************************************/
432432
433433/* We can't decode the sprite data like this because it isn't tile based.
434   Note that the bit indexes in these layouts are inverted compared to usual
435   MAME gfx layouts (0 = LSB, 7 = MSB) */
434   Note that the bit indexes are reversed compared to usual gfx layouts
435   (0-7 = LSB to MSB) */
436436
437437static const gfx_layout pgm8_charlayout =
438438{
r29319r29320
463463};
464464
465465GFXDECODE_START( pgm )
466   GFXDECODE_ENTRY( "tiles", 0, pgm8_charlayout,    0x800, 32  ) /* 8x8x4 Tiles */
467   GFXDECODE_ENTRY( "tiles", 0, pgm32_charlayout,   0x400, 32  ) /* 32x32x5 Tiles */
466   GFXDECODE_REVERSEBITS( "tiles", 0, pgm8_charlayout,    0x800, 32  ) /* 8x8x4 Tiles */
467   GFXDECODE_REVERSEBITS( "tiles", 0, pgm32_charlayout,   0x400, 32  ) /* 32x32x5 Tiles */
468468GFXDECODE_END
469469
470470/*** Machine Driver **********************************************************/
branches/new_menus/src/mame/drivers/nemesis.c
r29319r29320
13181318
13191319/******************************************************************************/
13201320
1321#define XOR(x) ((x)^NATIVE_ENDIAN_VALUE_LE_BE(8,0))
1322
13231321static const gfx_layout charlayout =
13241322{
13251323   8,8,    /* 8*8 characters */
1326   2048,   /* 2048 characters (+ blank one) */
1324   RGN_FRAC(1,1),
13271325   4,  /* 4 bits per pixel */
13281326   { 0, 1, 2, 3 }, /* the two bitplanes are merged in the same nibble */
1329   { XOR(0*4), XOR(1*4), XOR(2*4), XOR(3*4), XOR(4*4), XOR(5*4), XOR(6*4), XOR(7*4) },
1330   { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
1331   32*8     /* every char takes 32 consecutive bytes */
1327   { STEP8(0, 4) },
1328   { STEP8(0, 4*8) },
1329   4*8*8
13321330};
13331331
13341332static const gfx_layout spritelayout =
13351333{
13361334   16,16,  /* 16*16 sprites */
1337   512,    /* 512 sprites */
1335   RGN_FRAC(1,1),
13381336   4,  /* 4 bits per pixel */
13391337   { 0, 1, 2, 3 }, /* the two bitplanes are merged in the same nibble */
1340   { XOR(0*4), XOR(1*4), XOR(2*4), XOR(3*4), XOR(4*4), XOR(5*4), XOR(6*4), XOR(7*4),
1341         XOR(8*4), XOR(9*4), XOR(10*4), XOR(11*4), XOR(12*4), XOR(13*4), XOR(14*4), XOR(15*4) },
1342   { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64,
1343         8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },
1344   128*8     /* every sprite takes 128 consecutive bytes */
1338   { STEP16(0, 4) },
1339   { STEP16(0, 4*16) },
1340   4*16*16
13451341};
13461342
13471343static const gfx_layout spritelayout3216 =
13481344{
13491345   32,16,  /* 32*16 sprites */
1350   256,    /* 256 sprites */
1346   RGN_FRAC(1,1),
13511347   4,  /* 4 bits per pixel */
13521348   { 0, 1, 2, 3 }, /* the two bitplanes are merged in the same nibble */
1353   { XOR(0*4), XOR(1*4), XOR(2*4), XOR(3*4), XOR(4*4), XOR(5*4), XOR(6*4), XOR(7*4),
1354         XOR(8*4), XOR(9*4), XOR(10*4), XOR(11*4), XOR(12*4), XOR(13*4), XOR(14*4), XOR(15*4),
1355         XOR(16*4),XOR(17*4), XOR(18*4), XOR(19*4), XOR(20*4), XOR(21*4), XOR(22*4), XOR(23*4),
1356         XOR(24*4),XOR(25*4), XOR(26*4), XOR(27*4), XOR(28*4), XOR(29*4), XOR(30*4), XOR(31*4)},
1357   { 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128,
1358         8*128, 9*128, 10*128, 11*128, 12*128, 13*128, 14*128, 15*128 },
1359   256*8     /* every sprite takes 128 consecutive bytes */
1349   { STEP32(0, 4) },
1350   { STEP16(0, 4*32) },
1351   4*32*16
13601352};
13611353
13621354static const gfx_layout spritelayout1632 =
13631355{
13641356   16,32,  /* 16*32 sprites */
1365   256,    /* 256 sprites */
1357   RGN_FRAC(1,1),
13661358   4,  /* 4 bits per pixel */
13671359   { 0, 1, 2, 3 }, /* the two bitplanes are merged in the same nibble */
1368   { XOR(0*4), XOR(1*4), XOR(2*4), XOR(3*4), XOR(4*4), XOR(5*4), XOR(6*4), XOR(7*4),
1369         XOR(8*4), XOR(9*4), XOR(10*4), XOR(11*4), XOR(12*4), XOR(13*4), XOR(14*4), XOR(15*4)},
1370   { 0*64,  1*64,  2*64,  3*64,  4*64,  5*64,  6*64,  7*64,
1371      8*64,  9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64,
1372      16*64, 17*64, 18*64, 19*64, 20*64, 21*64, 22*64, 23*64,
1373      24*64, 25*64, 26*64, 27*64, 28*64, 29*64, 30*64, 31*64},
1374   256*8     /* every sprite takes 128 consecutive bytes */
1360   { STEP16(0, 4) },
1361   { STEP32(0, 4*16) },
1362   4*16*32
13751363};
13761364
13771365static const gfx_layout spritelayout3232 =
13781366{
13791367   32,32,  /* 32*32 sprites */
1380   128,    /* 128 sprites */
1368   RGN_FRAC(1,1),
13811369   4,  /* 4 bits per pixel */
13821370   { 0, 1, 2, 3 }, /* the two bitplanes are merged in the same nibble */
1383   { XOR(0*4), XOR(1*4), XOR(2*4), XOR(3*4), XOR(4*4), XOR(5*4), XOR(6*4), XOR(7*4),
1384         XOR(8*4), XOR(9*4), XOR(10*4), XOR(11*4), XOR(12*4), XOR(13*4), XOR(14*4), XOR(15*4),
1385         XOR(16*4),XOR(17*4), XOR(18*4), XOR(19*4), XOR(20*4), XOR(21*4), XOR(22*4), XOR(23*4),
1386         XOR(24*4),XOR(25*4), XOR(26*4), XOR(27*4), XOR(28*4), XOR(29*4), XOR(30*4), XOR(31*4)},
1387   { 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128,
1388         8*128,  9*128, 10*128, 11*128, 12*128, 13*128, 14*128, 15*128,
1389         16*128, 17*128, 18*128, 19*128, 20*128, 21*128, 22*128, 23*128,
1390         24*128, 25*128, 26*128, 27*128, 28*128, 29*128, 30*128, 31*128},
1391   512*8     /* every sprite takes 128 consecutive bytes */
1371   { STEP32(0, 4) },
1372   { STEP32(0, 4*32) },
1373   4*32*32
13921374};
13931375
13941376static const gfx_layout spritelayout816 =
13951377{
1396   8,16,   /* 16*16 sprites */
1397   1024,   /* 1024 sprites */
1378   8,16,   /* 8*16 sprites */
1379   RGN_FRAC(1,1),
13981380   4,  /* 4 bits per pixel */
13991381   { 0, 1, 2, 3 }, /* the two bitplanes are merged in the same nibble */
1400   { XOR(0*4), XOR(1*4), XOR(2*4), XOR(3*4), XOR(4*4), XOR(5*4), XOR(6*4), XOR(7*4)},
1401   { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
1402         8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32 },
1403   64*8     /* every sprite takes 128 consecutive bytes */
1382   { STEP8(0, 4) },
1383   { STEP16(0, 4*8) },
1384   4*8*16
14041385};
14051386
14061387static const gfx_layout spritelayout168 =
14071388{
14081389   16,8,   /* 16*8 sprites */
1409   1024,   /* 1024 sprites */
1390   RGN_FRAC(1,1),
14101391   4,  /* 4 bits per pixel */
14111392   { 0, 1, 2, 3 }, /* the two bitplanes are merged in the same nibble */
1412   { XOR(0*4), XOR(1*4), XOR(2*4), XOR(3*4), XOR(4*4), XOR(5*4), XOR(6*4), XOR(7*4),
1413         XOR(8*4), XOR(9*4), XOR(10*4), XOR(11*4), XOR(12*4), XOR(13*4), XOR(14*4), XOR(15*4)},
1414   { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64},
1415   64*8     /* every sprite takes 128 consecutive bytes */
1416
1393   { STEP16(0, 4) },
1394   { STEP8(0, 4*16) },
1395   4*16*8
14171396};
14181397
1419static const UINT32 spritelayout6464_xoffset[64] =
1420{
1421   XOR(0*4), XOR(1*4), XOR(2*4), XOR(3*4), XOR(4*4), XOR(5*4), XOR(6*4), XOR(7*4),
1422   XOR(8*4), XOR(9*4), XOR(10*4), XOR(11*4), XOR(12*4), XOR(13*4), XOR(14*4), XOR(15*4),
1423   XOR(16*4),XOR(17*4), XOR(18*4), XOR(19*4), XOR(20*4), XOR(21*4), XOR(22*4), XOR(23*4),
1424   XOR(24*4),XOR(25*4), XOR(26*4), XOR(27*4), XOR(28*4), XOR(29*4), XOR(30*4), XOR(31*4),
1425   XOR(32*4),XOR(33*4), XOR(34*4), XOR(35*4), XOR(36*4), XOR(37*4), XOR(38*4), XOR(39*4),
1426   XOR(40*4),XOR(41*4), XOR(42*4), XOR(43*4), XOR(44*4), XOR(45*4), XOR(46*4), XOR(47*4),
1427   XOR(48*4),XOR(49*4), XOR(50*4), XOR(51*4), XOR(52*4), XOR(53*4), XOR(54*4), XOR(55*4),
1428   XOR(56*4),XOR(57*4), XOR(58*4), XOR(59*4), XOR(60*4), XOR(61*4), XOR(62*4), XOR(63*4)
1429};
1398static const UINT32 spritelayout6464_xoffset[64] = { STEP64(0, 4) };
14301399
1431static const UINT32 spritelayout6464_yoffset[64] =
1432{
1433   0*256, 1*256, 2*256, 3*256, 4*256, 5*256, 6*256, 7*256,
1434   8*256, 9*256, 10*256, 11*256, 12*256, 13*256, 14*256, 15*256,
1435   16*256, 17*256, 18*256, 19*256, 20*256, 21*256, 22*256, 23*256,
1436   24*256, 25*256, 26*256, 27*256, 28*256, 29*256, 30*256, 31*256,
1437   32*256, 33*256, 34*256, 35*256, 36*256, 37*256, 38*256, 39*256,
1438   40*256, 41*256, 42*256, 43*256, 44*256, 45*256, 46*256, 47*256,
1439   48*256, 49*256, 50*256, 51*256, 52*256, 53*256, 54*256, 55*256,
1440   56*256, 57*256, 58*256, 59*256, 60*256, 61*256, 62*256, 63*256
1441};
1400static const UINT32 spritelayout6464_yoffset[64] = { STEP64(0, 4*64) };
14421401
14431402static const gfx_layout spritelayout6464 =
14441403{
1445   64,64,  /* 32*32 sprites */
1446   32, /* 128 sprites */
1404   64,64,  /* 64*64 sprites */
1405   RGN_FRAC(1,1),
14471406   4,  /* 4 bits per pixel */
14481407   { 0, 1, 2, 3 },
14491408   EXTENDED_XOFFS,
14501409   EXTENDED_YOFFS,
1451   2048*8,     /* every sprite takes 128 consecutive bytes */
1410   4*64*64,
14521411   spritelayout6464_xoffset,
14531412   spritelayout6464_yoffset
14541413};
14551414
14561415static GFXDECODE_START( nemesis )
1457   GFXDECODE_ENTRY( NULL, 0x0, charlayout,   0, 0x80 ) /* the game dynamically modifies this */
1458   GFXDECODE_ENTRY( NULL, 0x0, spritelayout, 0, 0x80 ) /* the game dynamically modifies this */
1459   GFXDECODE_ENTRY( NULL, 0x0, spritelayout3216, 0, 0x80 ) /* the game dynamically modifies this */
1460   GFXDECODE_ENTRY( NULL, 0x0, spritelayout816, 0, 0x80 )  /* the game dynamically modifies this */
1461   GFXDECODE_ENTRY( NULL, 0x0, spritelayout3232, 0, 0x80 ) /* the game dynamically modifies this */
1462   GFXDECODE_ENTRY( NULL, 0x0, spritelayout1632, 0, 0x80 ) /* the game dynamically modifies this */
1463   GFXDECODE_ENTRY( NULL, 0x0, spritelayout168, 0, 0x80 )  /* the game dynamically modifies this */
1464   GFXDECODE_ENTRY( NULL, 0x0, spritelayout6464, 0, 0x80 ) /* the game dynamically modifies this */
1416   GFXDECODE_RAM( "charram", 0x0, charlayout,   0, 0x80 )
1417   GFXDECODE_RAM( "charram", 0x0, spritelayout, 0, 0x80 )
1418   GFXDECODE_RAM( "charram", 0x0, spritelayout3216, 0, 0x80 )
1419   GFXDECODE_RAM( "charram", 0x0, spritelayout816, 0, 0x80 )
1420   GFXDECODE_RAM( "charram", 0x0, spritelayout3232, 0, 0x80 )
1421   GFXDECODE_RAM( "charram", 0x0, spritelayout1632, 0, 0x80 )
1422   GFXDECODE_RAM( "charram", 0x0, spritelayout168, 0, 0x80 )
1423   GFXDECODE_RAM( "charram", 0x0, spritelayout6464, 0, 0x80 )
14651424GFXDECODE_END
14661425
14671426/******************************************************************************/
branches/new_menus/src/mame/includes/toaplan1.h
r29319r29320
164164public:
165165   toaplan1_rallybik_state(const machine_config &mconfig, device_type type, const char *tag)
166166      : toaplan1_state(mconfig, type, tag),
167      m_spritegen(*this, "toaplan_scu")
167      m_spritegen(*this, "scu")
168168   {
169169   }
170170
branches/new_menus/src/mame/includes/twincobr.h
r29319r29320
1818      m_maincpu(*this, "maincpu"),
1919      m_audiocpu(*this, "audiocpu"),
2020      m_dsp(*this, "dsp"),
21      m_spritegen(*this, "toaplan_scu"),
21      m_spritegen(*this, "scu"),
2222      m_gfxdecode(*this, "gfxdecode"),
2323      m_screen(*this, "screen"),
2424      m_palette(*this, "palette")
branches/new_menus/src/mame/video/c45.c
r29319r29320
214214}
215215
216216MACHINE_CONFIG_FRAGMENT( namco_c45_road )
217   MCFG_GFXDECODE_ADD("gfxdecode", "^palette", empty) // FIXME
217   MCFG_GFXDECODE_ADD("gfxdecode", ":palette", empty) // FIXME
218218MACHINE_CONFIG_END
219219//-------------------------------------------------
220220//  device_mconfig_additions - return a pointer to
branches/new_menus/src/mame/video/toaplan_scu.c
r29319r29320
1010
1111const device_type TOAPLAN_SCU = &device_creator<toaplan_scu_device>;
1212
13static const gfx_layout spritelayout =
14{
15   16,16,          /* 16*16 sprites */
16   RGN_FRAC(1,4),
17   4,              /* 4 bits per pixel */
18   { RGN_FRAC(0,4), RGN_FRAC(1,4), RGN_FRAC(2,4), RGN_FRAC(3,4) },
19   { STEP16(0, 1) },
20   { STEP16(0, 16) },
21   16*16
22};
23
24static GFXDECODE_START( toaplan_scu )
25   GFXDECODE_DEVICE( DEVICE_SELF, 0, spritelayout, 0, 64 )
26GFXDECODE_END
27
28
1329toaplan_scu_device::toaplan_scu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1430   : device_t(mconfig, TOAPLAN_SCU, "toaplan_scu_device", tag, owner, clock, "toaplan_scu", __FILE__),
15   m_gfxregion(0),
16   m_gfxdecode(*this)
31   device_gfx_interface(mconfig, *this, GFXDECODE_NAME( toaplan_scu ))
1732{
1833}
1934
20//-------------------------------------------------
21//  static_set_gfxdecode_tag: Set the tag of the
22//  gfx decoder
23//-------------------------------------------------
24
25void toaplan_scu_device::static_set_gfxdecode_tag(device_t &device, const char *tag)
35void toaplan_scu_device::static_set_xoffsets(device_t &device, int xoffs, int xoffs_flipped)
2636{
27   downcast<toaplan_scu_device &>(device).m_gfxdecode.set_tag(tag);
37   toaplan_scu_device &dev = downcast<toaplan_scu_device &>(device);
38   dev.m_xoffs = xoffs;
39   dev.m_xoffs_flipped = xoffs_flipped;
2840}
2941
3042void toaplan_scu_device::device_start()
r29319r29320
4052   screen.register_screen_bitmap(m_temp_spritebitmap);
4153}
4254
43void toaplan_scu_device::set_gfx_region(int region)
44{
45   m_gfxregion = region;
46}
47
4855/***************************************************************************
4956    Sprite Handlers
5057***************************************************************************/
r29319r29320
7380
7481         sx = spriteram[offs + 2] >> 7;
7582         flipx = attribute & 0x100;
76         if (flipx) sx -= 14;        /* should really be 15 */
83         if (flipx) sx -= m_xoffs_flipped;
84
7785         flipy = attribute & 0x200;
78         m_gfxdecode->gfx(m_gfxregion)->transpen_raw(m_temp_spritebitmap,cliprect,
86         gfx(0)->transpen_raw(m_temp_spritebitmap,cliprect,
7987            sprite,
8088            color << 4 /* << 4 because using _raw */ ,
8189            flipx,flipy,
82            sx-32,sy-16,0);
83
90            sx-m_xoffs,sy-16,0);
8491      }
8592   }
8693
r29319r29320
94101void toaplan_scu_device::copy_sprites_from_tempbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority)
95102{
96103   int y, x;
97   int colourbase = m_gfxdecode->gfx(m_gfxregion)->colorbase();
104   int colourbase = gfx(0)->colorbase();
98105
99106   for (y=cliprect.min_y;y<=cliprect.max_y;y++)
100107   {
branches/new_menus/src/mame/video/toaplan_scu.h
r29319r29320
22
33
44
5class toaplan_scu_device : public device_t
5class toaplan_scu_device : public device_t, public device_gfx_interface
66{
77public:
88   toaplan_scu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
99
1010   // static configuration
11   static void static_set_gfxdecode_tag(device_t &device, const char *tag);
11   static void static_set_xoffsets(device_t &device, int xoffs, int xoffs_flipped);
1212
1313   void draw_sprites_to_tempbitmap(const rectangle &cliprect, UINT16* spriteram, UINT32 bytes );
1414   void copy_sprites_from_tempbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority);
1515   void alloc_sprite_bitmap(screen_device &screen);
16   void set_gfx_region(int region);
1716
1817protected:
1918   virtual void device_start();
r29319r29320
2120
2221private:
2322   bitmap_ind16 m_temp_spritebitmap;
24   int m_gfxregion;
25   required_device<gfxdecode_device> m_gfxdecode;
23   int m_xoffs;
24   int m_xoffs_flipped;
2625};
2726
2827extern const device_type TOAPLAN_SCU;
2928
30#define MCFG_TOAPLAN_SCU_ADD(_tag ) \
31   MCFG_DEVICE_ADD(_tag, TOAPLAN_SCU, 0)
32#define MCFG_TOAPLAN_SCU_GFXDECODE(_gfxtag) \
33   toaplan_scu_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
29#define MCFG_TOAPLAN_SCU_ADD(_tag, _palette_tag, _xoffs, _xoffs_flipped ) \
30   MCFG_DEVICE_ADD(_tag, TOAPLAN_SCU, 0) \
31   MCFG_GFX_PALETTE(_palette_tag) \
32   toaplan_scu_device::static_set_xoffsets(*device, _xoffs, _xoffs_flipped);
branches/new_menus/src/mame/video/pgm.c
r29319r29320
617617   m_aoffset = 0;
618618   m_boffset = 0;
619619
620   // temporary, this will be specified in gfxdecode info eventually
621   m_gfxdecode->gfx(0)->set_xormask(7);
622   m_gfxdecode->gfx(1)->set_xormask(7);
623
624620   m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(pgm_state::get_pgm_tx_tilemap_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
625621   m_tx_tilemap->set_transparent_pen(15);
626622
branches/new_menus/src/mame/video/k053250.c
r29319r29320
44
55k053250_device::k053250_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
66   : device_t(mconfig, K053250, "K053250", tag, owner, clock, "k053250", __FILE__),
7      device_video_interface(mconfig, *this),
8      m_palette(*this)
7      device_gfx_interface(mconfig, *this),
8      device_video_interface(mconfig, *this)
99{
1010}
1111
12void k053250_device::static_set_palette_tag(device_t &device, const char *tag)
13{
14        downcast<k053250_device &>(device).m_palette.set_tag(tag);
15}
16
1712void k053250_device::static_set_offsets(device_t &device, int offx, int offy)
1813{
1914   k053250_device &dev = downcast<k053250_device &>(device);
r29319r29320
6055}
6156
6257// utility function to render a clipped scanline vertically or horizontally
63inline void k053250_device::pdraw_scanline32(bitmap_rgb32 &bitmap, const pen_t *palette, UINT8 *source,
58inline void k053250_device::pdraw_scanline32(bitmap_rgb32 &bitmap, const pen_t *pal_base, UINT8 *source,
6459                              const rectangle &cliprect, int linepos, int scroll, int zoom,
6560                              UINT32 clipmask, UINT32 wrapmask, UINT32 orientation, bitmap_ind8 &priority, UINT8 pri)
6661{
r29319r29320
7469   UINT8  *src_base;
7570   int src_fx, src_fdx;
7671   int pix_data, dst_offset;
77   const pen_t *pal_base;
7872   UINT8  *pri_base;
7973   UINT32 *dst_base;
8074   int dst_adv;
r29319r29320
183177   // so we set all bits of the wrapmask to one
184178   src_wrapmask = (clipmask) ? ~0 : wrapmask;
185179
186   pal_base = palette;
187180   dst_offset = -dst_offset; // negate target offset in order to terminated draw loop at 0 condition
188181
189182   if (pri)
r29319r29320
358351   linedata_offs += line_start * linedata_adv;     // pre-advance line info offset for the clipped region
359352
360353   // load physical palette base
361   pal_base = m_palette->pens() + (colorbase << 4) % m_palette->entries();
354   pal_base = palette()->pens() + (colorbase << 4) % palette()->entries();
362355
363356   // walk the target bitmap within the visible area vertically or horizontally, one line at a time
364357   for (line_pos=line_start; line_pos <= line_end; linedata_offs += linedata_adv, line_pos++)
branches/new_menus/src/mame/video/k053250.h
r29319r29320
99
1010#define MCFG_K053250_ADD(_tag, _palette_tag, _screen_tag, offx, offy)  \
1111   MCFG_DEVICE_ADD(_tag, K053250, 0) \
12   MCFG_GFX_PALETTE(_palette_tag) \
1213   MCFG_VIDEO_SET_SCREEN(_screen_tag) \
13   k053250_device::static_set_palette_tag(*device, "^" _palette_tag); \
1414   k053250_device::static_set_offsets(*device, offx, offy);
1515
1616class k053250_device :   public device_t,
17                  public device_gfx_interface,
1718                  public device_video_interface
1819{
1920public:
2021   k053250_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
2122
22   static void static_set_palette_tag(device_t &device, const char *tag);
2323   static void static_set_offsets(device_t &device, int offx, int offy);
2424
2525   DECLARE_READ16_MEMBER(reg_r);
r29319r29320
4747   UINT8 m_page;
4848   INT32 m_frame;
4949
50   required_device<palette_device> m_palette;
51
5250   // internal helpers
5351   void unpack_nibbles();
5452   void dma(int limiter);
55   static void pdraw_scanline32(bitmap_rgb32 &bitmap, const pen_t *palette, UINT8 *source,
53   static void pdraw_scanline32(bitmap_rgb32 &bitmap, const pen_t *pal_base, UINT8 *source,
5654                           const rectangle &cliprect, int linepos, int scroll, int zoom,
5755                           UINT32 clipmask, UINT32 wrapmask, UINT32 orientation, bitmap_ind8 &priority, UINT8 pri);
5856};
branches/new_menus/src/mame/video/twincobr.c
r29319r29320
102102VIDEO_START_MEMBER(twincobr_state,toaplan0)
103103{
104104   m_spritegen->alloc_sprite_bitmap(*m_screen);
105   m_spritegen->set_gfx_region(3);
106105
107106   /* the video RAM is accessed via ports, it's not memory mapped */
108107   m_txvideoram_size = 0x0800;
branches/new_menus/src/mame/video/nemesis.c
r29319r29320
297297   memset(m_charram, 0, m_charram.bytes());
298298   memset(m_blank_tile, 0, ARRAY_LENGTH(m_blank_tile));
299299
300   m_gfxdecode->gfx(0)->set_source((UINT8 *)m_charram.target());
301   m_gfxdecode->gfx(1)->set_source((UINT8 *)m_charram.target());
302   m_gfxdecode->gfx(2)->set_source((UINT8 *)m_charram.target());
303   m_gfxdecode->gfx(3)->set_source((UINT8 *)m_charram.target());
304   m_gfxdecode->gfx(4)->set_source((UINT8 *)m_charram.target());
305   m_gfxdecode->gfx(5)->set_source((UINT8 *)m_charram.target());
306   m_gfxdecode->gfx(6)->set_source((UINT8 *)m_charram.target());
307   m_gfxdecode->gfx(7)->set_source((UINT8 *)m_charram.target());
308
309300   /* Set up save state */
310301   machine().save().register_postload(save_prepost_delegate(FUNC(nemesis_state::nemesis_postload), this));
311302}
branches/new_menus/src/mame/video/toaplan1.c
r29319r29320
287287VIDEO_START_MEMBER(toaplan1_rallybik_state,rallybik)
288288{
289289   m_spritegen->alloc_sprite_bitmap(*m_screen);
290   m_spritegen->set_gfx_region(1);
290   m_spritegen->gfx(0)->set_colorbase(64*16);
291291
292292   toaplan1_create_tilemaps();
293293   toaplan1_vram_alloc();
branches/new_menus/src/emu/emu.mak
r29319r29320
6565   $(EMUOBJ)/device.o \
6666   $(EMUOBJ)/didisasm.o \
6767   $(EMUOBJ)/diexec.o \
68   $(EMUOBJ)/digfx.o \
6869   $(EMUOBJ)/diimage.o \
6970   $(EMUOBJ)/dimemory.o \
7071   $(EMUOBJ)/dinetwork.o \
branches/new_menus/src/emu/digfx.c
r0r29320
1/***************************************************************************
2
3    digfx.c
4
5    Device graphics interfaces.
6
7***************************************************************************/
8
9#include "emu.h"
10#include "validity.h"
11
12
13//**************************************************************************
14//  DEVICE GFX INTERFACE
15//**************************************************************************
16
17//-------------------------------------------------
18//  device_gfx_interface - constructor
19//-------------------------------------------------
20
21device_gfx_interface::device_gfx_interface(const machine_config &mconfig, device_t &device,
22                              const gfx_decode_entry *gfxinfo, const char *palette_tag)
23   : device_interface(device),
24   m_gfxdecodeinfo(gfxinfo),
25   m_palette_tag(palette_tag),
26   m_palette_is_sibling(palette_tag == NULL),
27   m_decoded(false)
28{
29}
30
31//-------------------------------------------------
32//  ~device_gfx_interface - destructor
33//-------------------------------------------------
34
35device_gfx_interface::~device_gfx_interface()
36{
37}
38
39
40//-------------------------------------------------
41//  static_set_info: configuration helper to set
42//  the gfxdecode info used by the device
43//-------------------------------------------------
44
45void device_gfx_interface::static_set_info(device_t &device, const gfx_decode_entry *gfxinfo)
46{
47   device_gfx_interface *gfx;
48   if (!device.interface(gfx))
49      throw emu_fatalerror("MCFG_GFX_INFO called on device '%s' with no gfx interface\n", device.tag());
50
51   gfx->m_gfxdecodeinfo = gfxinfo;
52}
53
54
55//-------------------------------------------------
56//  static_set_palette: configuration helper to
57//  set the palette used by the device
58//-------------------------------------------------
59
60void device_gfx_interface::static_set_palette(device_t &device, const char *tag)
61{
62   device_gfx_interface *gfx;
63   if (!device.interface(gfx))
64      throw emu_fatalerror("MCFG_GFX_PALETTE called on device '%s' with no gfx interface\n", device.tag());
65
66   gfx->m_palette_tag = tag;
67   gfx->m_palette_is_sibling = true;
68}
69
70
71//-------------------------------------------------
72//  interface_pre_start - make sure all our input
73//  devices are started
74//-------------------------------------------------
75
76void device_gfx_interface::interface_pre_start()
77{
78   if (m_palette_tag == NULL)
79      fatalerror("No palette specified for device '%s'\n", device().tag());
80
81   // find our palette device, either as a sibling device or subdevice
82   if (m_palette_is_sibling)
83      m_palette = device().siblingdevice<palette_device>(m_palette_tag);
84   else
85      m_palette = device().subdevice<palette_device>(m_palette_tag);
86
87   if (m_palette == NULL)
88      fatalerror("Device '%s' specifies nonexistent %sdevice '%s' as palette\n",
89                        device().tag(),
90                        (m_palette_is_sibling ? "sibling " : "sub"),
91                        m_palette_tag);
92   
93   // if palette device isn't started, wait for it
94   if (!m_palette->started())
95      throw device_missing_dependencies();
96}
97
98
99//-------------------------------------------------
100//  interface_post_start - decode gfx, if we
101//  haven't done so already
102//-------------------------------------------------
103
104void device_gfx_interface::interface_post_start()
105{
106   if (!m_decoded)
107      decode_gfx(m_gfxdecodeinfo);
108}
109
110
111//-------------------------------------------------
112//  decode_gfx - parse gfx decode info and
113//  create gfx elements
114//-------------------------------------------------
115
116void device_gfx_interface::decode_gfx(const gfx_decode_entry *gfxdecodeinfo)
117{
118   // skip if nothing to do
119   if (gfxdecodeinfo == NULL)
120      return;
121
122   // local variables to hold mutable copies of gfx layout data
123   gfx_layout glcopy;
124   dynamic_array<UINT32> extxoffs(0);
125   dynamic_array<UINT32> extyoffs(0);
126
127   // loop over all elements
128   for (int curgfx = 0; curgfx < MAX_GFX_ELEMENTS && gfxdecodeinfo[curgfx].gfxlayout != NULL; curgfx++)
129   {
130      const gfx_decode_entry &gfx = gfxdecodeinfo[curgfx];
131
132      // extract the scale factors and xormask
133      UINT32 xscale = GFXENTRY_GETXSCALE(gfx.flags);
134      UINT32 yscale = GFXENTRY_GETYSCALE(gfx.flags);
135      UINT32 xormask = GFXENTRY_ISREVERSE(gfx.flags) ? 7 : 0;
136
137      // resolve the region
138      UINT32       region_length;
139      const UINT8 *region_base;
140      UINT8        region_width;
141      endianness_t region_endianness;
142
143      if (gfx.memory_region != NULL)
144      {
145         device_t &basedevice = (GFXENTRY_ISDEVICE(gfx.flags)) ? device() : *device().owner();
146         if (GFXENTRY_ISRAM(gfx.flags))
147         {
148            memory_share *share = basedevice.memshare(gfx.memory_region);
149            assert(share != NULL);
150            region_length = 8 * share->bytes();
151            region_base = reinterpret_cast<UINT8 *>(share->ptr());
152            region_width = share->width() / 8;
153            region_endianness = share->endianness();
154         }
155         else
156         {
157            memory_region *region = basedevice.memregion(gfx.memory_region);
158            assert(region != NULL);
159            region_length = 8 * region->bytes();
160            region_base = region->base();
161            // FIXME
162            region_width = 1;
163            region_endianness = ENDIANNESS_NATIVE;
164         }
165      }
166      else
167      {
168         region_length = 0;
169         region_base = NULL;
170         region_width = 1;
171         region_endianness = ENDIANNESS_NATIVE;
172      }
173
174      if (region_endianness != ENDIANNESS_NATIVE)
175      {
176         switch (region_width)
177         {
178            case 2:
179               xormask |= 0x08;
180               break;
181            case 4:
182               xormask |= 0x18;
183               break;
184            case 8:
185               xormask |= 0x38;
186               break;
187         }
188      }
189
190      // copy the layout into our temporary variable
191      memcpy(&glcopy, gfx.gfxlayout, sizeof(gfx_layout));
192
193      // copy the X and Y offsets into our temporary arrays
194      extxoffs.resize(glcopy.width * xscale);
195      extyoffs.resize(glcopy.height * yscale);
196      memcpy(&extxoffs[0], glcopy.xoffset, glcopy.width * sizeof(UINT32));
197      memcpy(&extyoffs[0], glcopy.yoffset, glcopy.height * sizeof(UINT32));
198
199      // if there are extended offsets, copy them over top
200      if (glcopy.extxoffs != NULL)
201         memcpy(&extxoffs[0], glcopy.extxoffs, glcopy.width * sizeof(UINT32));
202      if (glcopy.extyoffs != NULL)
203         memcpy(&extyoffs[0], glcopy.extyoffs, glcopy.height * sizeof(UINT32));
204
205      // always use the extended offsets here
206      glcopy.extxoffs = extxoffs;
207      glcopy.extyoffs = extyoffs;
208
209      // expand X and Y by the scale factors
210      if (xscale > 1)
211      {
212         glcopy.width *= xscale;
213         for (int j = glcopy.width - 1; j >= 0; j--)
214            extxoffs[j] = extxoffs[j / xscale];
215      }
216      if (yscale > 1)
217      {
218         glcopy.height *= yscale;
219         for (int j = glcopy.height - 1; j >= 0; j--)
220            extyoffs[j] = extyoffs[j / yscale];
221      }
222
223      // if the character count is a region fraction, compute the effective total
224      if (IS_FRAC(glcopy.total))
225      {
226         assert(region_length != 0);
227         glcopy.total = region_length / glcopy.charincrement * FRAC_NUM(glcopy.total) / FRAC_DEN(glcopy.total);
228      }
229
230      // for non-raw graphics, decode the X and Y offsets
231      if (glcopy.planeoffset[0] != GFX_RAW)
232      {
233         // loop over all the planes, converting fractions
234         for (int j = 0; j < glcopy.planes; j++)
235         {
236            UINT32 value1 = glcopy.planeoffset[j];
237            if (IS_FRAC(value1))
238            {
239               assert(region_length != 0);
240               glcopy.planeoffset[j] = FRAC_OFFSET(value1) + region_length * FRAC_NUM(value1) / FRAC_DEN(value1);
241            }
242         }
243
244         // loop over all the X/Y offsets, converting fractions
245         for (int j = 0; j < glcopy.width; j++)
246         {
247            UINT32 value2 = extxoffs[j];
248            if (IS_FRAC(value2))
249            {
250               assert(region_length != 0);
251               extxoffs[j] = FRAC_OFFSET(value2) + region_length * FRAC_NUM(value2) / FRAC_DEN(value2);
252            }
253         }
254
255         for (int j = 0; j < glcopy.height; j++)
256         {
257            UINT32 value3 = extyoffs[j];
258            if (IS_FRAC(value3))
259            {
260               assert(region_length != 0);
261               extyoffs[j] = FRAC_OFFSET(value3) + region_length * FRAC_NUM(value3) / FRAC_DEN(value3);
262            }
263         }
264      }
265
266      // otherwise, just use the line modulo
267      else
268      {
269         int base = gfx.start;
270         int end = region_length/8;
271         int linemod = glcopy.yoffset[0];
272         while (glcopy.total > 0)
273         {
274            int elementbase = base + (glcopy.total - 1) * glcopy.charincrement / 8;
275            int lastpixelbase = elementbase + glcopy.height * linemod / 8 - 1;
276            if (lastpixelbase < end)
277               break;
278            glcopy.total--;
279         }
280      }
281
282      // allocate the graphics
283      m_gfx[curgfx].reset(global_alloc(gfx_element(m_palette, glcopy, (region_base != NULL) ? region_base + gfx.start : NULL, xormask, gfx.total_color_codes, gfx.color_codes_start)));
284   }
285
286   m_decoded = true;
287}
288
289
290//-------------------------------------------------
291//  interface_validity_check - validate graphics
292//  decoding configuration
293//-------------------------------------------------
294
295void device_gfx_interface::interface_validity_check(validity_checker &valid) const
296{
297   // validate palette tag
298   if (m_palette_tag == NULL)
299      mame_printf_error("No palette specified for device '%s'\n", device().tag());
300   else
301   {
302      palette_device *palette;
303      if (m_palette_is_sibling)
304         palette = device().siblingdevice<palette_device>(m_palette_tag);
305      else
306         palette = device().subdevice<palette_device>(m_palette_tag);
307
308      if (palette == NULL)
309         mame_printf_error("Device '%s' specifies nonexistent %sdevice '%s' as palette\n",
310                        device().tag(),
311                        (m_palette_is_sibling ? "sibling " : "sub"),
312                        m_palette_tag);
313   }
314
315   if (!m_gfxdecodeinfo)
316      return;
317
318   // validate graphics decoding entries
319   for (int gfxnum = 0; gfxnum < MAX_GFX_ELEMENTS && m_gfxdecodeinfo[gfxnum].gfxlayout != NULL; gfxnum++)
320   {
321      const gfx_decode_entry &gfx = m_gfxdecodeinfo[gfxnum];
322      const gfx_layout &layout = *gfx.gfxlayout;
323
324      // currently we are unable to validate RAM-based entries
325      const char *region = gfx.memory_region;
326      if (region != NULL && GFXENTRY_ISROM(gfx.flags))
327      {
328         // resolve the region
329         astring gfxregion;
330         if (GFXENTRY_ISDEVICE(gfx.flags))
331            device().subtag(gfxregion, region);
332         else
333            device().owner()->subtag(gfxregion, region);
334
335         UINT32 region_length = valid.region_length(gfxregion);
336         if (region_length == 0)
337            mame_printf_error("gfx[%d] references nonexistent region '%s'\n", gfxnum, gfxregion.cstr());
338
339         // if we have a valid region, and we're not using auto-sizing, check the decode against the region length
340         else if (!IS_FRAC(layout.total))
341         {
342            // determine which plane is at the largest offset
343            int start = 0;
344            for (int plane = 0; plane < layout.planes; plane++)
345               if (layout.planeoffset[plane] > start)
346                  start = layout.planeoffset[plane];
347            start &= ~(layout.charincrement - 1);
348
349            // determine the total length based on this info
350            int len = layout.total * layout.charincrement;
351
352            // do we have enough space in the region to cover the whole decode?
353            int avail = region_length - (gfx.start & ~(layout.charincrement / 8 - 1));
354
355            // if not, this is an error
356            if ((start + len) / 8 > avail)
357               mame_printf_error("gfx[%d] extends past allocated memory of region '%s'\n", gfxnum, region);
358         }
359      }
360
361      int xscale = GFXENTRY_GETXSCALE(gfx.flags);
362      int yscale = GFXENTRY_GETYSCALE(gfx.flags);
363
364      // verify raw decode, which can only be full-region and have no scaling
365      if (layout.planeoffset[0] == GFX_RAW)
366      {
367         if (layout.total != RGN_FRAC(1,1))
368            mame_printf_error("gfx[%d] with unsupported layout total\n", gfxnum);
369         if (xscale != 1 || yscale != 1)
370            mame_printf_error("gfx[%d] with unsupported xscale/yscale\n", gfxnum);
371      }
372
373      // verify traditional decode doesn't have too many planes
374      else
375      {
376         if (layout.planes > MAX_GFX_PLANES)
377            mame_printf_error("gfx[%d] with invalid planes\n", gfxnum);
378      }
379   }
380}
Property changes on: branches/new_menus/src/emu/digfx.c
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
branches/new_menus/src/emu/digfx.h
r0r29320
1/***************************************************************************
2
3    digfx.h
4
5    Device graphics interfaces.
6
7***************************************************************************/
8
9#pragma once
10
11#ifndef __EMU_H__
12#error Dont include this file directly; include emu.h instead.
13#endif
14
15#ifndef __DIGFX_H__
16#define __DIGFX_H__
17
18
19
20//**************************************************************************
21//  CONSTANTS
22//**************************************************************************
23
24const int MAX_GFX_ELEMENTS = 32;
25const int MAX_GFX_PLANES = 8;
26const int MAX_GFX_SIZE = 32;
27
28
29
30//**************************************************************************
31//  GRAPHICS LAYOUT MACROS
32//**************************************************************************
33
34#define EXTENDED_XOFFS          { 0 }
35#define EXTENDED_YOFFS          { 0 }
36
37#define GFX_RAW                 0x12345678
38#define GFXLAYOUT_RAW( name, width, height, linemod, charmod ) \
39const gfx_layout name = { width, height, RGN_FRAC(1,1), 8, { GFX_RAW }, { 0 }, { linemod }, charmod };
40// When planeoffset[0] is set to GFX_RAW, the gfx data is left as-is, with no conversion.
41// No buffer is allocated for the decoded data, and gfxdata is set to point to the source
42// data.
43// xoffset[0] is an optional displacement (*8) from the beginning of the source data, while
44// yoffset[0] is the line modulo (*8) and charincrement the char modulo (*8). They are *8
45// for consistency with the usual behaviour, but the bottom 3 bits are not used.
46//
47// This special mode can be used for graphics that are already in 8bpp linear format,
48// or for unusual formats that don't fit our generic model and need to be decoded using
49// custom code. See blend_gfx() in atarigen.c for an example of the latter usage.
50
51
52// these macros describe gfx_layouts in terms of fractions of a region
53// they can be used for total, planeoffset, xoffset, yoffset
54#define RGN_FRAC(num,den)       (0x80000000 | (((num) & 0x0f) << 27) | (((den) & 0x0f) << 23))
55#define IS_FRAC(offset)         ((offset) & 0x80000000)
56#define FRAC_NUM(offset)        (((offset) >> 27) & 0x0f)
57#define FRAC_DEN(offset)        (((offset) >> 23) & 0x0f)
58#define FRAC_OFFSET(offset)     ((offset) & 0x007fffff)
59
60// these macros are useful in gfx_layouts
61#define STEP2(START,STEP)       (START),(START)+(STEP)
62#define STEP4(START,STEP)       STEP2(START,STEP),STEP2((START)+2*(STEP),STEP)
63#define STEP8(START,STEP)       STEP4(START,STEP),STEP4((START)+4*(STEP),STEP)
64#define STEP16(START,STEP)      STEP8(START,STEP),STEP8((START)+8*(STEP),STEP)
65#define STEP32(START,STEP)      STEP16(START,STEP),STEP16((START)+16*(STEP),STEP)
66#define STEP64(START,STEP)      STEP32(START,STEP),STEP32((START)+32*(STEP),STEP)
67#define STEP128(START,STEP)     STEP64(START,STEP),STEP64((START)+64*(STEP),STEP)
68#define STEP256(START,STEP)     STEP128(START,STEP),STEP128((START)+128*(STEP),STEP)
69#define STEP512(START,STEP)     STEP256(START,STEP),STEP256((START)+256*(STEP),STEP)
70#define STEP1024(START,STEP)    STEP512(START,STEP),STEP512((START)+512*(STEP),STEP)
71#define STEP2048(START,STEP)    STEP1024(START,STEP),STEP1024((START)+1024*(STEP),STEP)
72
73
74
75//**************************************************************************
76//  GRAPHICS INFO MACROS
77//**************************************************************************
78
79// optional horizontal and vertical scaling factors
80#define GFXENTRY_XSCALEMASK   0x000000ff
81#define GFXENTRY_YSCALEMASK   0x0000ff00
82#define GFXENTRY_XSCALE(x)    ((((x)-1) << 0) & GFXENTRY_XSCALEMASK)
83#define GFXENTRY_YSCALE(x)    ((((x)-1) << 8) & GFXENTRY_YSCALEMASK)
84#define GFXENTRY_GETXSCALE(x) ((((x) & GFXENTRY_XSCALEMASK) >> 0) + 1)
85#define GFXENTRY_GETYSCALE(x) ((((x) & GFXENTRY_YSCALEMASK) >> 8) + 1)
86
87// GFXENTRY_RAM means region tag refers to a RAM share instead of a ROM region
88#define GFXENTRY_ROM          0x00000000
89#define GFXENTRY_RAM          0x00010000
90#define GFXENTRY_ISROM(x)     (((x) & GFXENTRY_RAM) == 0)
91#define GFXENTRY_ISRAM(x)     (((x) & GFXENTRY_RAM) != 0)
92
93// GFXENTRY_DEVICE means region tag is relative to this device instead of its owner
94#define GFXENTRY_DEVICE       0x00020000
95#define GFXENTRY_ISDEVICE(x)  (((x) & GFXENTRY_DEVICE) != 0)
96
97// GFXENTRY_REVERSE reverses the bit order in the layout (0-7 = LSB-MSB instead of MSB-LSB)
98#define GFXENTRY_REVERSE      0x00040000
99#define GFXENTRY_ISREVERSE(x) (((x) & GFXENTRY_REVERSE) != 0)
100
101
102// these macros are used for declaring gfx_decode_entry info arrays
103#define GFXDECODE_NAME( name ) gfxdecodeinfo_##name
104#define GFXDECODE_EXTERN( name ) extern const gfx_decode_entry GFXDECODE_NAME(name)[]
105#define GFXDECODE_START( name ) const gfx_decode_entry GFXDECODE_NAME(name)[] = {
106#define GFXDECODE_END { 0 } };
107
108// common gfx_decode_entry macros
109#define GFXDECODE_ENTRYX(region,offset,layout,start,colors,flags) { region, offset, &layout, start, colors, flags },
110#define GFXDECODE_ENTRY(region,offset,layout,start,colors) { region, offset, &layout, start, colors, 0 },
111
112// specialized gfx_decode_entry macros
113#define GFXDECODE_RAM(region,offset,layout,start,colors) { region, offset, &layout, start, colors, GFXENTRY_RAM },
114#define GFXDECODE_DEVICE(region,offset,layout,start,colors) { region, offset, &layout, start, colors, GFXENTRY_DEVICE },
115#define GFXDECODE_DEVICE_RAM(region,offset,layout,start,colors) { region, offset, &layout, start, colors, GFXENTRY_DEVICE | GFXENTRY_RAM },
116#define GFXDECODE_SCALE(region,offset,layout,start,colors,x,y) { region, offset, &layout, start, colors, GFXENTRY_XSCALE(x) | GFXENTRY_YSCALE(y) },
117#define GFXDECODE_REVERSEBITS(region,offset,layout,start,colors) { region, offset, &layout, start, colors, GFXENTRY_REVERSE },
118
119
120
121//**************************************************************************
122//  INTERFACE CONFIGURATION MACROS
123//**************************************************************************
124
125#define MCFG_GFX_PALETTE(_palette_tag) \
126   device_gfx_interface::static_set_palette(*device, _palette_tag);
127
128#define MCFG_GFX_INFO(_info) \
129   device_gfx_interface::static_set_info(*device, GFXDECODE_NAME(_info));
130
131
132
133//**************************************************************************
134//  DEVICE CONFIGURATION MACROS
135//**************************************************************************
136
137#define MCFG_GFXDECODE_ADD(_tag, _palette_tag, _info) \
138   MCFG_DEVICE_ADD(_tag, GFXDECODE, 0) \
139   MCFG_GFX_PALETTE(_palette_tag) \
140   MCFG_GFX_INFO(_info)
141
142#define MCFG_GFXDECODE_MODIFY(_tag, _info) \
143   MCFG_DEVICE_MODIFY(_tag) \
144   MCFG_GFX_INFO(_info)
145
146
147
148//**************************************************************************
149//  TYPE DEFINITIONS
150//**************************************************************************
151
152// forward declarations
153class gfx_element;
154class palette_device;
155
156struct gfx_layout
157{
158   UINT32 xoffs(int x) const { return (extxoffs != NULL) ? extxoffs[x] : xoffset[x]; }
159   UINT32 yoffs(int y) const { return (extyoffs != NULL) ? extyoffs[y] : yoffset[y]; }
160
161   UINT16          width;              // pixel width of each element
162   UINT16          height;             // pixel height of each element
163   UINT32          total;              // total number of elements, or RGN_FRAC()
164   UINT16          planes;             // number of bitplanes
165   UINT32          planeoffset[MAX_GFX_PLANES]; // bit offset of each bitplane
166   UINT32          xoffset[MAX_GFX_SIZE]; // bit offset of each horizontal pixel
167   UINT32          yoffset[MAX_GFX_SIZE]; // bit offset of each vertical pixel
168   UINT32          charincrement;      // distance between two consecutive elements (in bits)
169   const UINT32 *  extxoffs;           // extended X offset array for really big layouts
170   const UINT32 *  extyoffs;           // extended Y offset array for really big layouts
171};
172
173struct gfx_decode_entry
174{
175   const char *    memory_region;      // memory region where the data resides
176   UINT32          start;              // offset of beginning of data to decode
177   const gfx_layout *gfxlayout;        // pointer to gfx_layout describing the layout; NULL marks the end of the array
178   UINT16          color_codes_start;  // offset in the color lookup table where color codes start
179   UINT16          total_color_codes;  // total number of color codes
180   UINT32          flags;              // flags and optional scaling factors
181};
182
183// ======================> device_gfx_interface
184
185class device_gfx_interface : public device_interface
186{
187public:
188   // construction/destruction
189   device_gfx_interface(const machine_config &mconfig, device_t &device,
190                  const gfx_decode_entry *gfxinfo = NULL, const char *palette_tag = NULL);
191   virtual ~device_gfx_interface();
192
193   // static configuration
194   static void static_set_info(device_t &device, const gfx_decode_entry *gfxinfo);
195   static void static_set_palette(device_t &device, const char *tag);
196
197   // getters
198   palette_device *palette() const { return m_palette; }
199   gfx_element *gfx(int index) const { assert(index < MAX_GFX_ELEMENTS); return m_gfx[index]; }
200
201   // decoding
202   void decode_gfx(const gfx_decode_entry *gfxdecodeinfo);
203   void decode_gfx() { decode_gfx(m_gfxdecodeinfo); }
204
205   void set_gfx(int index, gfx_element *element) { assert(index < MAX_GFX_ELEMENTS); m_gfx[index].reset(element); }
206
207protected:
208   // interface-level overrides
209   virtual void interface_validity_check(validity_checker &valid) const;
210   virtual void interface_pre_start();
211   virtual void interface_post_start();
212
213private:
214   // configuration
215   const gfx_decode_entry *   m_gfxdecodeinfo;      // pointer to array of gfx decode information
216   const char *            m_palette_tag;         // configured tag for palette device
217   bool                  m_palette_is_sibling;   // is palette a sibling or a subdevice?
218
219   // internal state
220   bool                  m_decoded;               // have we processed our decode info yet?
221   palette_device *         m_palette;               // pointer to the palette device
222   auto_pointer<gfx_element>   m_gfx[MAX_GFX_ELEMENTS];   // array of pointers to graphic sets
223};
224
225// iterator
226typedef device_interface_iterator<device_gfx_interface> gfx_interface_iterator;
227
228
229#endif  /* __DIGFX_H__ */
Property changes on: branches/new_menus/src/emu/digfx.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/new_menus/src/emu/bus/iq151/video32.c
r29319r29320
4040GFXDECODE_END
4141
4242static MACHINE_CONFIG_FRAGMENT( video32 )
43   MCFG_GFXDECODE_ADD("gfxdecode", "^^palette", video32)
43   MCFG_GFXDECODE_ADD("gfxdecode", ":palette", video32)
4444MACHINE_CONFIG_END
4545
4646//**************************************************************************
branches/new_menus/src/emu/bus/iq151/video64.c
r29319r29320
4040GFXDECODE_END
4141
4242static MACHINE_CONFIG_FRAGMENT( video64 )
43   MCFG_GFXDECODE_ADD("gfxdecode", "^^palette", video64)
43   MCFG_GFXDECODE_ADD("gfxdecode", ":palette", video64)
4444MACHINE_CONFIG_END
4545
4646//**************************************************************************
branches/new_menus/src/emu/emu.h
r29319r29320
6666#include "dimemory.h"
6767#include "diexec.h"
6868#include "opresolv.h"
69#include "digfx.h"
6970#include "diimage.h"
7071#include "dioutput.h"
7172#include "diserial.h"
branches/new_menus/src/emu/drawgfx.c
r29319r29320
1111
1212#include "emu.h"
1313#include "drawgfxm.h"
14#include "validity.h"
1514
1615
1716/***************************************************************************
r29319r29320
7170
7271const device_type GFXDECODE = &device_creator<gfxdecode_device>;
7372
74gfxdecode_device::gfxdecode_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
75   : device_t(mconfig, GFXDECODE, "gfxdecode", tag, owner, clock, "gfxdecode", __FILE__),
76      m_palette(*this),
77      m_gfxdecodeinfo(NULL)
73gfxdecode_device::gfxdecode_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
74   device_t(mconfig, GFXDECODE, "gfxdecode", tag, owner, clock, "gfxdecode", __FILE__),
75   device_gfx_interface(mconfig, *this)
7876{
7977}
8078
81//**************************************************************************
82//  INITIALIZATION AND CONFIGURATION
83//**************************************************************************
8479
85void gfxdecode_device::static_set_gfxdecodeinfo(device_t &device, const gfx_decode_entry *info)
86{
87   downcast<gfxdecode_device &>(device).m_gfxdecodeinfo = info;
88}
8980
90void gfxdecode_device::static_set_palette(device_t &device, const char *tag)
91{
92   downcast<gfxdecode_device &>(device).m_palette.set_tag(tag);
93}
9481
95//-------------------------------------------------
96//  device_stop - final cleanup
97//-------------------------------------------------
98
99void gfxdecode_device::device_stop()
100{
101}
102
103//-------------------------------------------------
104//  device_start - start up the device
105//-------------------------------------------------
106
107void gfxdecode_device::device_start()
108{
109   const gfx_decode_entry *gfxdecodeinfo = m_gfxdecodeinfo;
110   int curgfx;
111
112   // skip if nothing to do
113   if (gfxdecodeinfo == NULL)
114      return;
115
116   // loop over all elements
117   for (curgfx = 0; curgfx < MAX_GFX_ELEMENTS && gfxdecodeinfo[curgfx].gfxlayout != NULL; curgfx++)
118   {
119      const gfx_decode_entry *gfxdecode = &gfxdecodeinfo[curgfx];
120      UINT32 region_length;
121      const UINT8 *region_base;
122
123      // resolve the region
124      if (gfxdecode->memory_region != NULL)
125      {
126         astring gfxregion;
127         owner()->subtag(gfxregion, gfxdecode->memory_region);
128         memory_region *region = owner()->memregion(gfxregion);
129         region_length = 8 * region->bytes();
130         region_base = region->base();
131      }
132      else
133      {
134         region_length = 0;
135         region_base = NULL;
136      }
137
138      UINT32 xscale = (gfxdecode->xscale == 0) ? 1 : gfxdecode->xscale;
139      UINT32 yscale = (gfxdecode->yscale == 0) ? 1 : gfxdecode->yscale;
140      UINT32 *extpoffs, extxoffs[MAX_ABS_GFX_SIZE], extyoffs[MAX_ABS_GFX_SIZE];
141      const gfx_layout *gl = gfxdecode->gfxlayout;
142      int israw = (gl->planeoffset[0] == GFX_RAW);
143      int planes = gl->planes;
144      UINT32 width = gl->width;
145      UINT32 height = gl->height;
146      UINT32 total = gl->total;
147      UINT32 xormask = 0;
148      UINT32 charincrement = gl->charincrement;
149      gfx_layout glcopy;
150      int j;
151
152      // make a copy of the layout
153      glcopy = *gfxdecode->gfxlayout;
154
155      // copy the X and Y offsets into temporary arrays
156      memcpy(extxoffs, glcopy.xoffset, sizeof(glcopy.xoffset));
157      memcpy(extyoffs, glcopy.yoffset, sizeof(glcopy.yoffset));
158
159      // if there are extended offsets, copy them over top
160      if (glcopy.extxoffs != NULL)
161         memcpy(extxoffs, glcopy.extxoffs, glcopy.width * sizeof(extxoffs[0]));
162      if (glcopy.extyoffs != NULL)
163         memcpy(extyoffs, glcopy.extyoffs, glcopy.height * sizeof(extyoffs[0]));
164
165      // always use the extended offsets here
166      glcopy.extxoffs = extxoffs;
167      glcopy.extyoffs = extyoffs;
168
169      extpoffs = glcopy.planeoffset;
170
171      // expand X and Y by the scale factors
172      if (xscale > 1)
173      {
174         width *= xscale;
175         for (j = width - 1; j >= 0; j--)
176            extxoffs[j] = extxoffs[j / xscale];
177      }
178      if (yscale > 1)
179      {
180         height *= yscale;
181         for (j = height - 1; j >= 0; j--)
182            extyoffs[j] = extyoffs[j / yscale];
183      }
184
185      // if the character count is a region fraction, compute the effective total
186      if (IS_FRAC(total))
187      {
188         assert(region_length != 0);
189         total = region_length / charincrement * FRAC_NUM(total) / FRAC_DEN(total);
190      }
191
192      // for non-raw graphics, decode the X and Y offsets
193      if (!israw)
194      {
195         // loop over all the planes, converting fractions
196         for (j = 0; j < planes; j++)
197         {
198            UINT32 value1 = extpoffs[j];
199            if (IS_FRAC(value1))
200            {
201               assert(region_length != 0);
202               extpoffs[j] = FRAC_OFFSET(value1) + region_length * FRAC_NUM(value1) / FRAC_DEN(value1);
203            }
204         }
205
206         // loop over all the X/Y offsets, converting fractions
207         for (j = 0; j < width; j++)
208         {
209            UINT32 value2 = extxoffs[j];
210            if (IS_FRAC(value2))
211            {
212               assert(region_length != 0);
213               extxoffs[j] = FRAC_OFFSET(value2) + region_length * FRAC_NUM(value2) / FRAC_DEN(value2);
214            }
215         }
216
217         for (j = 0; j < height; j++)
218         {
219            UINT32 value3 = extyoffs[j];
220            if (IS_FRAC(value3))
221            {
222               assert(region_length != 0);
223               extyoffs[j] = FRAC_OFFSET(value3) + region_length * FRAC_NUM(value3) / FRAC_DEN(value3);
224            }
225         }
226      }
227
228      // otherwise, just use the line modulo
229      else
230      {
231         int base = gfxdecode->start;
232         int end = region_length/8;
233         int linemod = gl->yoffset[0];
234         while (total > 0)
235         {
236            int elementbase = base + (total - 1) * charincrement / 8;
237            int lastpixelbase = elementbase + height * linemod / 8 - 1;
238            if (lastpixelbase < end)
239               break;
240            total--;
241         }
242      }
243
244      // update glcopy
245      glcopy.width = width;
246      glcopy.height = height;
247      glcopy.total = total;
248
249      // allocate the graphics
250      m_gfx[curgfx].reset(global_alloc(gfx_element(m_palette, glcopy, (region_base != NULL) ? region_base + gfxdecode->start : NULL, xormask, gfxdecode->total_color_codes, gfxdecode->color_codes_start)));
251   }
252}
253
254
255//-------------------------------------------------
256//  device_validity_check - validate graphics decoding
257//  configuration
258//-------------------------------------------------/
259
260void gfxdecode_device::device_validity_check(validity_checker &valid) const
261{
262
263   // bail if no gfx
264   if (!m_gfxdecodeinfo)
265      return;
266
267   // iterate over graphics decoding entries
268   for (int gfxnum = 0; gfxnum < MAX_GFX_ELEMENTS && m_gfxdecodeinfo[gfxnum].gfxlayout != NULL; gfxnum++)
269   {
270      const gfx_decode_entry &gfx = m_gfxdecodeinfo[gfxnum];
271      const gfx_layout &layout = *gfx.gfxlayout;
272
273      // make sure the region exists
274      const char *region = gfx.memory_region;
275      if (region != NULL)
276      {
277         // resolve the region
278         astring gfxregion;
279         
280         owner()->subtag(gfxregion, region);
281
282         // loop over gfx regions
283         UINT32 region_length = valid.region_length(gfxregion);
284         if (region_length == 0)
285            mame_printf_error("gfx[%d] references non-existent region '%s'\n", gfxnum, gfxregion.cstr());
286
287         // if we have a valid region, and we're not using auto-sizing, check the decode against the region length
288         else if (!IS_FRAC(layout.total))
289         {
290            // determine which plane is at the largest offset
291            int start = 0;
292            for (int plane = 0; plane < layout.planes; plane++)
293               if (layout.planeoffset[plane] > start)
294                  start = layout.planeoffset[plane];
295            start &= ~(layout.charincrement - 1);
296
297            // determine the total length based on this info
298            int len = layout.total * layout.charincrement;
299
300            // do we have enough space in the region to cover the whole decode?
301            int avail = region_length - (gfx.start & ~(layout.charincrement / 8 - 1));
302
303            // if not, this is an error
304            if ((start + len) / 8 > avail)
305               mame_printf_error("gfx[%d] extends past allocated memory of region '%s'\n", gfxnum, region);
306         }
307      }
308
309      int xscale = (m_gfxdecodeinfo[gfxnum].xscale == 0) ? 1 : m_gfxdecodeinfo[gfxnum].xscale;
310      int yscale = (m_gfxdecodeinfo[gfxnum].yscale == 0) ? 1 : m_gfxdecodeinfo[gfxnum].yscale;
311
312      // verify raw decode, which can only be full-region and have no scaling
313      if (layout.planeoffset[0] == GFX_RAW)
314      {
315         if (layout.total != RGN_FRAC(1,1))
316            mame_printf_error("gfx[%d] with unsupported layout total\n", gfxnum);
317         if (xscale != 1 || yscale != 1)
318            mame_printf_error("gfx[%d] with unsupported xscale/yscale\n", gfxnum);
319      }
320
321      // verify traditional decode doesn't have too many planes or is not too large
322      else
323      {
324         if (layout.planes > MAX_GFX_PLANES)
325            mame_printf_error("gfx[%d] with invalid planes\n", gfxnum);
326         if (xscale * layout.width > MAX_ABS_GFX_SIZE || yscale * layout.height > MAX_ABS_GFX_SIZE)
327            mame_printf_error("gfx[%d] with invalid xscale/yscale\n", gfxnum);
328      }
329   }
330   
331}
332
333
33482/***************************************************************************
33583    GRAPHICS ELEMENTS
33684***************************************************************************/
r29319r29320
443191   if (m_layout_is_raw)
444192   {
445193      // modulos are determined for us by the layout
446      m_line_modulo = ((gl.extyoffs != NULL) ? gl.extyoffs[0] : gl.yoffset[0]) / 8;
194      m_line_modulo = gl.yoffs(0) / 8;
447195      m_char_modulo = gl.charincrement / 8;
448196
449197      // RAW graphics must have a pointer up front
branches/new_menus/src/emu/drawgfx.h
r29319r29320
1919#define __DRAWGFX_H__
2020
2121
22//**************************************************************************
23//  DEVICE CONFIGURATION MACROS
24//**************************************************************************
25
26#define MCFG_GFXDECODE_ADD(_tag, _palette_tag, _info) \
27   MCFG_DEVICE_ADD(_tag, GFXDECODE, 0) \
28   MCFG_GFX_PALETTE(_palette_tag) \
29   MCFG_GFXDECODE_INFO(_info) \
30
31#define MCFG_GFX_PALETTE(_palette_tag) \
32   gfxdecode_device::static_set_palette(*device, "^" _palette_tag);
33
34#define MCFG_GFXDECODE_INFO(_info) \
35   gfxdecode_device::static_set_gfxdecodeinfo(*device, GFXDECODE_NAME(_info));
36
37#define MCFG_GFXDECODE_MODIFY(_tag, _info) \
38   MCFG_DEVICE_MODIFY(_tag) \
39   MCFG_GFXDECODE_INFO(_info) \
40
41
4222/***************************************************************************
4323    CONSTANTS
4424***************************************************************************/
4525
46#define MAX_GFX_PLANES          8
47#define MAX_GFX_SIZE            32
48#define MAX_ABS_GFX_SIZE        1024
49
50#define EXTENDED_XOFFS          { 0 }
51#define EXTENDED_YOFFS          { 0 }
52
53#define GFX_RAW                 0x12345678
54// When planeoffset[0] is set to GFX_RAW, the gfx data is left as-is, with no conversion.
55// No buffer is allocated for the decoded data, and gfxdata is set to point to the source
56// data.
57// xoffset[0] is an optional displacement (*8) from the beginning of the source data, while
58// yoffset[0] is the line modulo (*8) and charincrement the char modulo (*8). They are *8
59// for consistency with the usual behaviour, but the bottom 3 bits are not used.
60
61// This special mode can be used to save memory in games that require several different
62// handlings of the same ROM data (e.g. metro.c can use both 4bpp and 8bpp tiles, and both
63// 8x8 and 16x16; cps.c has 8x8, 16x16 and 32x32 tiles all fetched from the same ROMs).
64
6526enum
6627{
6728   DRAWMODE_NONE,
r29319r29320
7233
7334
7435/***************************************************************************
75    MACROS
76***************************************************************************/
77
78// these macros describe gfx_layouts in terms of fractions of a region
79// they can be used for total, planeoffset, xoffset, yoffset
80#define RGN_FRAC(num,den)       (0x80000000 | (((num) & 0x0f) << 27) | (((den) & 0x0f) << 23))
81#define IS_FRAC(offset)         ((offset) & 0x80000000)
82#define FRAC_NUM(offset)        (((offset) >> 27) & 0x0f)
83#define FRAC_DEN(offset)        (((offset) >> 23) & 0x0f)
84#define FRAC_OFFSET(offset)     ((offset) & 0x007fffff)
85
86// these macros are useful in gfx_layouts
87#define STEP2(START,STEP)       (START),(START)+(STEP)
88#define STEP4(START,STEP)       STEP2(START,STEP),STEP2((START)+2*(STEP),STEP)
89#define STEP8(START,STEP)       STEP4(START,STEP),STEP4((START)+4*(STEP),STEP)
90#define STEP16(START,STEP)      STEP8(START,STEP),STEP8((START)+8*(STEP),STEP)
91#define STEP32(START,STEP)      STEP16(START,STEP),STEP16((START)+16*(STEP),STEP)
92#define STEP64(START,STEP)      STEP32(START,STEP),STEP32((START)+32*(STEP),STEP)
93#define STEP128(START,STEP)     STEP64(START,STEP),STEP64((START)+64*(STEP),STEP)
94#define STEP256(START,STEP)     STEP128(START,STEP),STEP128((START)+128*(STEP),STEP)
95#define STEP512(START,STEP)     STEP256(START,STEP),STEP256((START)+256*(STEP),STEP)
96#define STEP1024(START,STEP)    STEP512(START,STEP),STEP512((START)+512*(STEP),STEP)
97#define STEP2048(START,STEP)    STEP1024(START,STEP),STEP1024((START)+1024*(STEP),STEP)
98
99
100// these macros are used for declaring gfx_decode_entry_entry info arrays.
101#define GFXDECODE_NAME( name ) gfxdecodeinfo_##name
102#define GFXDECODE_EXTERN( name ) extern const gfx_decode_entry GFXDECODE_NAME(name)[]
103#define GFXDECODE_START( name ) const gfx_decode_entry GFXDECODE_NAME(name)[] = {
104#define GFXDECODE_ENTRY(region,offset,layout,start,colors) { region, offset, &layout, start, colors, 0, 0 },
105#define GFXDECODE_SCALE(region,offset,layout,start,colors,xscale,yscale) { region, offset, &layout, start, colors, xscale, yscale },
106#define GFXDECODE_END { 0 } };
107
108// these macros are used for declaring gfx_layout structures.
109#define GFXLAYOUT_RAW( name, width, height, linemod, charmod ) \
110const gfx_layout name = { width, height, RGN_FRAC(1,1), 8, { GFX_RAW }, { 0 }, { linemod }, charmod };
111
112
113
114/***************************************************************************
11536    TYPE DEFINITIONS
11637***************************************************************************/
11738
118struct gfx_layout
119{
120   UINT32 xoffs(int x) const { return (extxoffs != NULL) ? extxoffs[x] : xoffset[x]; }
121   UINT32 yoffs(int y) const { return (extyoffs != NULL) ? extyoffs[y] : yoffset[y]; }
122
123   UINT16          width;              // pixel width of each element
124   UINT16          height;             // pixel height of each element
125   UINT32          total;              // total number of elements, or RGN_FRAC()
126   UINT16          planes;             // number of bitplanes
127   UINT32          planeoffset[MAX_GFX_PLANES]; // bit offset of each bitplane
128   UINT32          xoffset[MAX_GFX_SIZE]; // bit offset of each horizontal pixel
129   UINT32          yoffset[MAX_GFX_SIZE]; // bit offset of each vertical pixel
130   UINT32          charincrement;      // distance between two consecutive elements (in bits)
131   const UINT32 *  extxoffs;           // extended X offset array for really big layouts
132   const UINT32 *  extyoffs;           // extended Y offset array for really big layouts
133};
134
135
13639class gfx_element
13740{
13841public:
r29319r29320
291194};
292195
293196
294struct gfx_decode_entry
295{
296   const char *    memory_region;      // memory region where the data resides
297   UINT32          start;              // offset of beginning of data to decode
298   const gfx_layout *gfxlayout;        // pointer to gfx_layout describing the layout; NULL marks the end of the array
299   UINT16          color_codes_start;  // offset in the color lookup table where color codes start
300   UINT16          total_color_codes;  // total number of color codes
301   UINT8           xscale;             // optional horizontal scaling factor; 0 means 1x
302   UINT8           yscale;             // optional vertical scaling factor; 0 means 1x
303};
304
305
306
307197/***************************************************************************
308198    FUNCTION PROTOTYPES
309199***************************************************************************/
r29319r29320
449339// device type definition
450340extern const device_type GFXDECODE;
451341
452class gfxdecode_device :    public device_t
342class gfxdecode_device : public device_t, public device_gfx_interface
453343{
454344public:
455345   // construction/destruction
456346   gfxdecode_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
457347
458   // static configuration
459   static void static_set_gfxdecodeinfo(device_t &device, const gfx_decode_entry *info);
460   static void static_set_palette(device_t &device, const char *tag);
461
462   palette_device *palette() const { return m_palette; }
463   gfx_element * gfx(int index) { assert(index < MAX_GFX_ELEMENTS); return m_gfx[index]; }   
464   
465   void set_gfx(int index, gfx_element * val) { assert(index < MAX_GFX_ELEMENTS); m_gfx[index].reset(val); }   
466348protected:
467   // device-level overrides
468   virtual void device_validity_check(validity_checker &valid) const;
469   virtual void device_start();
470   virtual void device_stop();
471private:
472   // devices
473   required_device<palette_device> m_palette;         // default palette assigned to gfx_elements
474
475   // configuration state
476   const gfx_decode_entry *m_gfxdecodeinfo;         // pointer to array of graphics decoding information
477   auto_pointer<gfx_element> m_gfx[MAX_GFX_ELEMENTS];   // array of pointers to graphic sets (chars, sprites)
349   virtual void device_start() {};
478350};
479351
480// device type iterator
481typedef device_type_iterator<&device_creator<gfxdecode_device>, gfxdecode_device> gfxdecode_device_iterator;
482
483352GFXDECODE_EXTERN(empty);
484353
485354#endif  // __DRAWGFX_H__
branches/new_menus/src/emu/validity.c
r29319r29320
281281      validate_driver();
282282      validate_roms();
283283      validate_inputs();
284      validate_display();
285284      validate_devices();
286285   }
287286   catch (emu_fatalerror &err)
r29319r29320
693692
694693
695694//-------------------------------------------------
696//  validate_display - validate display
697//  configurations
698//-------------------------------------------------
699
700void validity_checker::validate_display()
701{
702   // iterate over screen devices looking for paletted screens
703   screen_device_iterator iter(m_current_config->root_device());
704   for (const screen_device *scrconfig = iter.first(); scrconfig != NULL; scrconfig = iter.next())
705      if (scrconfig->format() == BITMAP_FORMAT_IND16)
706      {
707         // check for empty palette
708         //if (scrconfig->palette()->entries() == 0)
709//            mame_printf_error("Driver has zero palette entries but uses a palette-based bitmap format\n");
710      }
711}
712
713
714//-------------------------------------------------
715695//  validate_analog_input_field - validate an
716696//  analog input field
717697//-------------------------------------------------
branches/new_menus/src/emu/validity.h
r29319r29320
6666   void validate_inlines();
6767   void validate_driver();
6868   void validate_roms();
69   void validate_display();
7069   void validate_analog_input_field(ioport_field &field);
7170   void validate_dip_settings(ioport_field &field);
7271   void validate_condition(ioport_condition &condition, device_t &device, int_map &port_map);
branches/new_menus/src/emu/tilemap.c
r29319r29320
343343//  init - initialize the tilemap
344344//-------------------------------------------------
345345
346tilemap_t &tilemap_t::init(tilemap_manager &manager, gfxdecode_device &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows)
346tilemap_t &tilemap_t::init(tilemap_manager &manager, device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows)
347347{
348348   // populate managers and devices
349349   m_manager = &manager;
r29319r29320
15151515   { FUNC(tilemap_t::scan_cols_flip_xy) }
15161516};
15171517
1518tilemap_t &tilemap_manager::create(gfxdecode_device &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated)
1518tilemap_t &tilemap_manager::create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated)
15191519{
15201520   if (allocated == NULL)
15211521      allocated = global_alloc(tilemap_t);
15221522   return m_tilemap_list.append(allocated->init(*this, decoder, tile_get_info, mapper, tilewidth, tileheight, cols, rows));
15231523}
15241524
1525tilemap_t &tilemap_manager::create(gfxdecode_device &decoder, tilemap_get_info_delegate tile_get_info, tilemap_standard_mapper mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated)
1525tilemap_t &tilemap_manager::create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_standard_mapper mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated)
15261526{
15271527   if (allocated == NULL)
15281528      allocated = global_alloc(tilemap_t);
branches/new_menus/src/emu/ui/viewgfx.c
r29319r29320
4141// information about a single gfx device
4242struct ui_gfx_info
4343{
44   gfxdecode_device *device;         // pointer to device
44   device_gfx_interface *interface;   // pointer to device's gfx interface
4545   UINT8 setcount;                  // how many gfx sets device has
4646   UINT8 rotate[MAX_GFX_ELEMENTS];      // current rotation (orientation) value
4747   UINT8 columns[MAX_GFX_ELEMENTS];   // number of items per row
r29319r29320
169169
170170static void ui_gfx_count_devices(running_machine &machine, ui_gfx_state &state)
171171{
172   palette_device_iterator pal_deviter(machine.root_device());
173   gfxdecode_device_iterator gfx_deviter(machine.root_device());
172   palette_device_iterator pal_iter(machine.root_device());
173   gfx_interface_iterator gfx_iter(machine.root_device());
174174
175175   // count the palette devices
176   state.palette.devcount = pal_deviter.count();
176   state.palette.devcount = pal_iter.count();
177177
178178   // set the pointer to the first palette
179179   if (state.palette.devcount > 0)
180180      palette_set_device(machine, state);
181181
182   // count the gfx decoders
182   // count the gfx devices
183183   state.gfxset.devcount = 0;
184   int tempcount = gfx_deviter.count();
184   int tempcount = gfx_iter.count();
185185
186   // count the gfx sets in each decoder
186   // count the gfx sets in each device, skipping devices with none
187187   if (tempcount > 0)
188188   {
189      gfxdecode_device *m_gfxdecode;
189      device_gfx_interface *interface;
190190      int i, count;
191191
192      for (i = 0, m_gfxdecode = gfx_deviter.first();
192      for (i = 0, interface = gfx_iter.first();
193193            i < tempcount && state.gfxset.devcount < MAX_GFX_DECODERS;
194            i++, m_gfxdecode = gfx_deviter.next())
194            i++, interface = gfx_iter.next())
195195      {
196         for (count = 0; count < MAX_GFX_ELEMENTS && m_gfxdecode->gfx(count) != NULL; count++);
196         for (count = 0; count < MAX_GFX_ELEMENTS && interface->gfx(count) != NULL; count++);
197197
198198         // count = index of first NULL
199199         if (count > 0)
200200         {
201            state.gfxdev[state.gfxset.devcount].device = m_gfxdecode;
201            state.gfxdev[state.gfxset.devcount].interface = interface;
202202            state.gfxdev[state.gfxset.devcount].setcount = count;
203203            state.gfxset.devcount++;
204204         }
r29319r29320
341341
342342static void palette_set_device(running_machine &machine, ui_gfx_state &state)
343343{
344   palette_device_iterator pal_deviter(machine.root_device());
345   state.palette.device = pal_deviter.byindex(state.palette.devindex);
344   palette_device_iterator pal_iter(machine.root_device());
345   state.palette.device = pal_iter.byindex(state.palette.devindex);
346346}
347347
348348
r29319r29320
564564   int dev = state.gfxset.devindex;
565565   int set = state.gfxset.set;
566566   ui_gfx_info &info = state.gfxdev[dev];
567   gfxdecode_device &m_gfxdecode = *info.device;
568   gfx_element &gfx = *m_gfxdecode.gfx(set);
567   device_gfx_interface &interface = *info.interface;
568   gfx_element &gfx = *interface.gfx(set);
569569   float fullwidth, fullheight;
570570   float cellwidth, cellheight;
571571   float chwidth, chheight;
r29319r29320
649649
650650   // figure out the title and expand the outer box to fit
651651   sprintf(title, "'%s' %d/%d %dx%d COLOR %X",
652               m_gfxdecode.tag(),
652               interface.device().tag(),
653653               set, info.setcount - 1,
654654               gfx.width(), gfx.height(),
655655               info.color[set]);
r29319r29320
758758   int dev = state.gfxset.devindex;
759759   int set = state.gfxset.set;
760760   ui_gfx_info &info = state.gfxdev[dev];
761   gfx_element &gfx = *info.device->gfx(set);
761   gfx_element &gfx = *info.interface->gfx(set);
762762
763763   // handle cells per line (minus,plus)
764764   if (ui_input_pressed(machine, IPT_UI_ZOOM_OUT))
branches/new_menus/src/emu/tilemap.h
r29319r29320
429429// tile_data is filled in by the get_tile_info callback
430430struct tile_data
431431{
432   gfxdecode_device *decoder;      // set in tilemap_t::init()
432   device_gfx_interface *decoder;  // set in tilemap_t::init()
433433   const UINT8 *   pen_data;       // required
434434   const UINT8 *   mask_data;      // required
435435   pen_t           palette_base;   // defaults to 0
r29319r29320
485485   tilemap_t();
486486   virtual ~tilemap_t();
487487
488   tilemap_t &init(tilemap_manager &manager, gfxdecode_device &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows);
488   tilemap_t &init(tilemap_manager &manager, device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows);
489489
490490public:
491491   // getters
r29319r29320
684684   running_machine &machine() const { return m_machine; }
685685
686686   // tilemap creation
687   tilemap_t &create(gfxdecode_device &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated = NULL);
688   tilemap_t &create(gfxdecode_device &decoder, tilemap_get_info_delegate tile_get_info, tilemap_standard_mapper mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated = NULL);
687   tilemap_t &create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated = NULL);
688   tilemap_t &create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_standard_mapper mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated = NULL);
689689
690690   // tilemap list information
691691   tilemap_t *find(int index) { return m_tilemap_list.find(index); }
branches/new_menus/src/emu/machine.h
r29319r29320
2525//  CONSTANTS
2626//**************************************************************************
2727
28const int MAX_GFX_ELEMENTS = 32;
29
30
3128// machine phases
3229enum machine_phase
3330{
branches/new_menus/src/mess/machine/megacd.c
r29319r29320
312312   MCFG_TIMER_DRIVER_ADD("stamp_timer", sega_segacd_device, segacd_gfx_conversion_timer_callback)
313313   MCFG_TIMER_DRIVER_ADD("scd_dma_timer", sega_segacd_device, scd_dma_timer_callback)
314314
315   MCFG_GFXDECODE_ADD("gfxdecode", "^gen_vdp:palette", segacd) // FIXME
315   MCFG_GFXDECODE_ADD("gfxdecode", ":gen_vdp:palette", segacd) // FIXME
316316
317317   MCFG_DEFAULT_LAYOUT( layout_megacd )
318318
Property changes on: branches/new_menus
Modified: svn:mergeinfo
   Merged /trunk:r29317-29319

Previous 199869 Revisions Next


© 1997-2024 The MAME Team