branches/new_menus/src/mame/drivers/twincobr.c
| r29319 | r29320 | |
| 639 | 639 | 8*8 /* every tile takes 8 consecutive bytes */ |
| 640 | 640 | }; |
| 641 | 641 | |
| 642 | | static 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 | | |
| 654 | 642 | static GFXDECODE_START( twincobr ) |
| 655 | 643 | GFXDECODE_ENTRY( "gfx1", 0x00000, charlayout, 1536, 32 ) /* colors 1536-1791 */ |
| 656 | 644 | GFXDECODE_ENTRY( "gfx2", 0x00000, tilelayout, 1280, 16 ) /* colors 1280-1535 */ |
| 657 | 645 | GFXDECODE_ENTRY( "gfx3", 0x00000, tilelayout, 1024, 16 ) /* colors 1024-1079 */ |
| 658 | | GFXDECODE_ENTRY( "gfx4", 0x00000, spritelayout, 0, 64 ) /* colors 0-1023 */ |
| 659 | 646 | GFXDECODE_END |
| 660 | 647 | |
| 661 | 648 | |
| r29319 | r29320 | |
| 692 | 679 | /* video hardware */ |
| 693 | 680 | MCFG_MC6845_ADD("crtc", HD6845, "screen", XTAL_28MHz/8, twincobr_mc6845_intf) /* 3.5MHz measured on CLKin */ |
| 694 | 681 | |
| 695 | | MCFG_TOAPLAN_SCU_ADD("toaplan_scu") |
| 696 | | MCFG_TOAPLAN_SCU_GFXDECODE("gfxdecode") |
| 682 | MCFG_TOAPLAN_SCU_ADD("scu", "palette", 31, 15) |
| 697 | 683 | |
| 698 | 684 | MCFG_BUFFERED_SPRITERAM16_ADD("spriteram16") |
| 699 | 685 | |
| r29319 | r29320 | |
| 719 | 705 | MACHINE_CONFIG_END |
| 720 | 706 | |
| 721 | 707 | |
| 722 | | static MACHINE_CONFIG_DERIVED( fsharkbt, twincobr ) |
| 708 | static MACHINE_CONFIG_DERIVED( fshark, twincobr ) |
| 709 | MCFG_DEVICE_MODIFY("scu") |
| 710 | toaplan_scu_device::static_set_xoffsets(*device, 32, 14); |
| 711 | MACHINE_CONFIG_END |
| 723 | 712 | |
| 713 | |
| 714 | static MACHINE_CONFIG_DERIVED( fsharkbt, fshark ) |
| 715 | |
| 724 | 716 | MCFG_CPU_ADD("mcu", I8741, XTAL_28MHz/16) |
| 725 | 717 | /* Program Map is internal to the CPU */ |
| 726 | 718 | MCFG_CPU_IO_MAP(fsharkbt_i8741_io_map) |
| r29319 | r29320 | |
| 772 | 764 | ROM_LOAD( "b30_10.12c", 0x10000, 0x08000, CRC(170c01db) SHA1(f4c5a1600f6cbb48abbace66c6f7514f79138e8b) ) |
| 773 | 765 | ROM_LOAD( "b30_09.10c", 0x18000, 0x08000, CRC(44f5accd) SHA1(2f9bdebe71c8be195332356df68992fd38d86994) ) |
| 774 | 766 | |
| 775 | | ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */ |
| 767 | ROM_REGION( 0x40000, "scu", 0 ) /* sprites */ |
| 776 | 768 | ROM_LOAD( "b30_20.12d", 0x00000, 0x10000, CRC(cb4092b8) SHA1(35b1d1e04af760fa106124bd5a94174d63ff9705) ) |
| 777 | 769 | ROM_LOAD( "b30_19.14d", 0x10000, 0x10000, CRC(9cb8675e) SHA1(559c21d505c60401f7368d4ab2b686b15075c5c5) ) |
| 778 | 770 | ROM_LOAD( "b30_18.15d", 0x20000, 0x10000, CRC(806fb374) SHA1(3eebefadcbdf713bf2a65b438092746b07edd3f0) ) |
| r29319 | r29320 | |
| 817 | 809 | ROM_LOAD( "b30_10.12c", 0x10000, 0x08000, CRC(170c01db) SHA1(f4c5a1600f6cbb48abbace66c6f7514f79138e8b) ) |
| 818 | 810 | ROM_LOAD( "b30_09.10c", 0x18000, 0x08000, CRC(44f5accd) SHA1(2f9bdebe71c8be195332356df68992fd38d86994) ) |
| 819 | 811 | |
| 820 | | ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */ |
| 812 | ROM_REGION( 0x40000, "scu", 0 ) /* sprites */ |
| 821 | 813 | ROM_LOAD( "b30_20.12d", 0x00000, 0x10000, CRC(cb4092b8) SHA1(35b1d1e04af760fa106124bd5a94174d63ff9705) ) |
| 822 | 814 | ROM_LOAD( "b30_19.14d", 0x10000, 0x10000, CRC(9cb8675e) SHA1(559c21d505c60401f7368d4ab2b686b15075c5c5) ) |
| 823 | 815 | ROM_LOAD( "b30_18.15d", 0x20000, 0x10000, CRC(806fb374) SHA1(3eebefadcbdf713bf2a65b438092746b07edd3f0) ) |
| r29319 | r29320 | |
| 862 | 854 | ROM_LOAD( "b30_10.12c", 0x10000, 0x08000, CRC(170c01db) SHA1(f4c5a1600f6cbb48abbace66c6f7514f79138e8b) ) |
| 863 | 855 | ROM_LOAD( "b30_09.10c", 0x18000, 0x08000, CRC(44f5accd) SHA1(2f9bdebe71c8be195332356df68992fd38d86994) ) |
| 864 | 856 | |
| 865 | | ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */ |
| 857 | ROM_REGION( 0x40000, "scu", 0 ) /* sprites */ |
| 866 | 858 | ROM_LOAD( "b30_20.12d", 0x00000, 0x10000, CRC(cb4092b8) SHA1(35b1d1e04af760fa106124bd5a94174d63ff9705) ) |
| 867 | 859 | ROM_LOAD( "b30_19.14d", 0x10000, 0x10000, CRC(9cb8675e) SHA1(559c21d505c60401f7368d4ab2b686b15075c5c5) ) |
| 868 | 860 | ROM_LOAD( "b30_18.15d", 0x20000, 0x10000, CRC(806fb374) SHA1(3eebefadcbdf713bf2a65b438092746b07edd3f0) ) |
| r29319 | r29320 | |
| 911 | 903 | ROM_LOAD( "b02_10.h16", 0x10000, 0x08000, CRC(4bd099ff) SHA1(9326075f83549b0a9656f69bd4436fb1be2ac805) ) |
| 912 | 904 | ROM_LOAD( "b02_09.h15", 0x18000, 0x08000, CRC(230f1582) SHA1(0fd4156a46ed64cb6e5c59b8836382dd86c229cf) ) |
| 913 | 905 | |
| 914 | | ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */ |
| 906 | ROM_REGION( 0x40000, "scu", 0 ) /* sprites */ |
| 915 | 907 | ROM_LOAD( "b02_01.d15", 0x00000, 0x10000, CRC(2234b424) SHA1(bd6242b9dcdb0f582565df588106cd1ce2aad53b) ) |
| 916 | 908 | ROM_LOAD( "b02_02.d16", 0x10000, 0x10000, CRC(30d4c9a8) SHA1(96ce4f41207c5487e801a8444030ec4dc7b58b23) ) |
| 917 | 909 | ROM_LOAD( "b02_03.d17", 0x20000, 0x10000, CRC(64f3d88f) SHA1(d0155cfb0a8885d58e34141f9696b9aa208440ca) ) |
| r29319 | r29320 | |
| 960 | 952 | ROM_LOAD( "b02_10.h16", 0x10000, 0x08000, CRC(4bd099ff) SHA1(9326075f83549b0a9656f69bd4436fb1be2ac805) ) |
| 961 | 953 | ROM_LOAD( "b02_09.h15", 0x18000, 0x08000, CRC(230f1582) SHA1(0fd4156a46ed64cb6e5c59b8836382dd86c229cf) ) |
| 962 | 954 | |
| 963 | | ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */ |
| 955 | ROM_REGION( 0x40000, "scu", 0 ) /* sprites */ |
| 964 | 956 | ROM_LOAD( "b02_01.d15", 0x00000, 0x10000, CRC(2234b424) SHA1(bd6242b9dcdb0f582565df588106cd1ce2aad53b) ) |
| 965 | 957 | ROM_LOAD( "b02_02.d16", 0x10000, 0x10000, CRC(30d4c9a8) SHA1(96ce4f41207c5487e801a8444030ec4dc7b58b23) ) |
| 966 | 958 | ROM_LOAD( "b02_03.d17", 0x20000, 0x10000, CRC(64f3d88f) SHA1(d0155cfb0a8885d58e34141f9696b9aa208440ca) ) |
| r29319 | r29320 | |
| 1009 | 1001 | ROM_LOAD( "b02_10.h16", 0x10000, 0x08000, CRC(4bd099ff) SHA1(9326075f83549b0a9656f69bd4436fb1be2ac805) ) |
| 1010 | 1002 | ROM_LOAD( "b02_09.h15", 0x18000, 0x08000, CRC(230f1582) SHA1(0fd4156a46ed64cb6e5c59b8836382dd86c229cf) ) |
| 1011 | 1003 | |
| 1012 | | ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */ |
| 1004 | ROM_REGION( 0x40000, "scu", 0 ) /* sprites */ |
| 1013 | 1005 | ROM_LOAD( "b02_01.d15", 0x00000, 0x10000, CRC(2234b424) SHA1(bd6242b9dcdb0f582565df588106cd1ce2aad53b) ) |
| 1014 | 1006 | ROM_LOAD( "b02_02.d16", 0x10000, 0x10000, CRC(30d4c9a8) SHA1(96ce4f41207c5487e801a8444030ec4dc7b58b23) ) |
| 1015 | 1007 | ROM_LOAD( "b02_03.d17", 0x20000, 0x10000, CRC(64f3d88f) SHA1(d0155cfb0a8885d58e34141f9696b9aa208440ca) ) |
| r29319 | r29320 | |
| 1061 | 1053 | ROM_LOAD( "b02_10.h16", 0x10000, 0x08000, CRC(4bd099ff) SHA1(9326075f83549b0a9656f69bd4436fb1be2ac805) ) |
| 1062 | 1054 | ROM_LOAD( "b02_09.h15", 0x18000, 0x08000, CRC(230f1582) SHA1(0fd4156a46ed64cb6e5c59b8836382dd86c229cf) ) |
| 1063 | 1055 | |
| 1064 | | ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */ |
| 1056 | ROM_REGION( 0x40000, "scu", 0 ) /* sprites */ |
| 1065 | 1057 | ROM_LOAD( "b02_01.d15", 0x00000, 0x10000, CRC(2234b424) SHA1(bd6242b9dcdb0f582565df588106cd1ce2aad53b) ) |
| 1066 | 1058 | ROM_LOAD( "b02_02.d16", 0x10000, 0x10000, CRC(30d4c9a8) SHA1(96ce4f41207c5487e801a8444030ec4dc7b58b23) ) |
| 1067 | 1059 | ROM_LOAD( "b02_03.d17", 0x20000, 0x10000, CRC(64f3d88f) SHA1(d0155cfb0a8885d58e34141f9696b9aa208440ca) ) |
| r29319 | r29320 | |
| 1123 | 1115 | ROM_LOAD( "10.ic116", 0x10000, 0x08000, CRC(4bd099ff) SHA1(9326075f83549b0a9656f69bd4436fb1be2ac805) ) |
| 1124 | 1116 | ROM_LOAD( "9.ic117", 0x18000, 0x08000, CRC(230f1582) SHA1(0fd4156a46ed64cb6e5c59b8836382dd86c229cf) ) |
| 1125 | 1117 | |
| 1126 | | ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */ |
| 1118 | ROM_REGION( 0x40000, "scu", 0 ) /* sprites */ |
| 1127 | 1119 | ROM_LOAD( "1.ic54", 0x00000, 0x10000, CRC(2234b424) SHA1(bd6242b9dcdb0f582565df588106cd1ce2aad53b) ) |
| 1128 | 1120 | ROM_LOAD( "2.ic53", 0x10000, 0x10000, CRC(30d4c9a8) SHA1(96ce4f41207c5487e801a8444030ec4dc7b58b23) ) |
| 1129 | 1121 | ROM_LOAD( "3.ic52", 0x20000, 0x10000, CRC(64f3d88f) SHA1(d0155cfb0a8885d58e34141f9696b9aa208440ca) ) |
| r29319 | r29320 | |
| 1177 | 1169 | ROM_LOAD( "11-u197.bin", 0x10000, 0x08000, CRC(7b721ed3) SHA1(afd10229414c65a56e184d56a69460ca3a502a27) ) |
| 1178 | 1170 | ROM_LOAD( "10-u196.rom", 0x18000, 0x08000, CRC(160f38ab) SHA1(da310ec387d439b26c8b6b881e5dcc07c2b9bb00) ) |
| 1179 | 1171 | |
| 1180 | | ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */ |
| 1172 | ROM_REGION( 0x40000, "scu", 0 ) /* sprites */ |
| 1181 | 1173 | ROM_LOAD( "20-u262.bin", 0x00000, 0x10000, CRC(10665ca0) SHA1(0c552c3807e00a7ef4f9fd28c7988a232628a1f5) ) |
| 1182 | 1174 | ROM_LOAD( "19-u261.bin", 0x10000, 0x10000, CRC(cfa6d417) SHA1(f6c17d938b58dc5756ecf617f00fbfaf701602a7) ) |
| 1183 | 1175 | ROM_LOAD( "18-u260.bin", 0x20000, 0x10000, CRC(2e6a0c49) SHA1(0b7ddad8775dcebe240a8246ef7816113f517f87) ) |
| r29319 | r29320 | |
| 1223 | 1215 | ROM_LOAD( "11-u197.bin", 0x10000, 0x08000, CRC(7b721ed3) SHA1(afd10229414c65a56e184d56a69460ca3a502a27) ) |
| 1224 | 1216 | ROM_LOAD( "10-u196.rom", 0x18000, 0x08000, CRC(160f38ab) SHA1(da310ec387d439b26c8b6b881e5dcc07c2b9bb00) ) |
| 1225 | 1217 | |
| 1226 | | ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */ |
| 1218 | ROM_REGION( 0x40000, "scu", 0 ) /* sprites */ |
| 1227 | 1219 | ROM_LOAD( "20-u262.bin", 0x00000, 0x10000, CRC(10665ca0) SHA1(0c552c3807e00a7ef4f9fd28c7988a232628a1f5) ) |
| 1228 | 1220 | ROM_LOAD( "19-u261.bin", 0x10000, 0x10000, CRC(cfa6d417) SHA1(f6c17d938b58dc5756ecf617f00fbfaf701602a7) ) |
| 1229 | 1221 | ROM_LOAD( "18-u260.bin", 0x20000, 0x10000, CRC(2e6a0c49) SHA1(0b7ddad8775dcebe240a8246ef7816113f517f87) ) |
| r29319 | r29320 | |
| 1243 | 1235 | } |
| 1244 | 1236 | |
| 1245 | 1237 | |
| 1246 | | GAME( 1987, fshark, 0, twincobr, fshark, twincobr_state, twincobr, ROT270, "Toaplan / Taito Corporation", "Flying Shark (World)", 0 ) |
| 1247 | | GAME( 1987, skyshark, fshark, twincobr, skyshark, twincobr_state, twincobr, ROT270, "Toaplan / Taito America Corporation (Romstar license)", "Sky Shark (US)", 0 ) |
| 1248 | | GAME( 1987, hishouza, fshark, twincobr, hishouza, twincobr_state, twincobr, ROT270, "Toaplan / Taito Corporation", "Hishou Zame (Japan)", 0 ) |
| 1238 | GAME( 1987, fshark, 0, fshark, fshark, twincobr_state, twincobr, ROT270, "Toaplan / Taito Corporation", "Flying Shark (World)", 0 ) |
| 1239 | GAME( 1987, skyshark, fshark, fshark, skyshark, twincobr_state, twincobr, ROT270, "Toaplan / Taito America Corporation (Romstar license)", "Sky Shark (US)", 0 ) |
| 1240 | GAME( 1987, hishouza, fshark, fshark, hishouza, twincobr_state, twincobr, ROT270, "Toaplan / Taito Corporation", "Hishou Zame (Japan)", 0 ) |
| 1249 | 1241 | GAME( 1987, fsharkbt, fshark, fsharkbt, skyshark, twincobr_state, twincobr, ROT270, "bootleg", "Flying Shark (bootleg with 8741)", 0 ) |
| 1250 | | GAME( 1987, fnshark, fshark, twincobr, hishouza, twincobr_state, twincobr, ROT270, "bootleg", "Flyin' Shark (bootleg of Hishou Zame)", 0 ) |
| 1242 | GAME( 1987, fnshark, fshark, fshark, hishouza, twincobr_state, twincobr, ROT270, "bootleg", "Flyin' Shark (bootleg of Hishou Zame)", 0 ) |
| 1251 | 1243 | GAME( 1987, twincobr, 0, twincobr, twincobr, twincobr_state, twincobr, ROT270, "Toaplan / Taito Corporation", "Twin Cobra (World)", 0 ) |
| 1252 | 1244 | GAME( 1987, twincobru, twincobr, twincobr, twincobru, twincobr_state, twincobr, ROT270, "Toaplan / Taito America Corporation (Romstar license)", "Twin Cobra (US)", 0 ) |
| 1253 | 1245 | GAME( 1987, ktiger, twincobr, twincobr, ktiger, twincobr_state, twincobr, ROT270, "Toaplan / Taito Corporation", "Kyukyoku Tiger (Japan)", 0 ) |
branches/new_menus/src/mame/drivers/toaplan1.c
| r29319 | r29320 | |
| 1771 | 1771 | 16*8 /* every tile takes 16 consecutive bytes */ |
| 1772 | 1772 | }; |
| 1773 | 1773 | |
| 1774 | | static 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 | | }; |
| 1785 | 1774 | |
| 1786 | | |
| 1787 | 1775 | static GFXDECODE_START( toaplan1 ) |
| 1788 | 1776 | GFXDECODE_ENTRY( "gfx1", 0x00000, tilelayout, 0, 64 ) |
| 1789 | 1777 | GFXDECODE_ENTRY( "gfx2", 0x00000, tilelayout, 64*16, 64 ) |
| r29319 | r29320 | |
| 1791 | 1779 | |
| 1792 | 1780 | static GFXDECODE_START( rallybik ) |
| 1793 | 1781 | GFXDECODE_ENTRY( "gfx1", 0x00000, tilelayout, 0, 64 ) |
| 1794 | | GFXDECODE_ENTRY( "gfx2", 0x00000, rallybik_spr_layout, 64*16, 64 ) |
| 1795 | 1782 | GFXDECODE_END |
| 1796 | 1783 | |
| 1797 | 1784 | |
| r29319 | r29320 | |
| 1825 | 1812 | MCFG_SCREEN_VBLANK_DRIVER(toaplan1_rallybik_state, screen_eof_rallybik) |
| 1826 | 1813 | MCFG_SCREEN_PALETTE("palette") |
| 1827 | 1814 | |
| 1828 | | MCFG_TOAPLAN_SCU_ADD("toaplan_scu") |
| 1829 | | MCFG_TOAPLAN_SCU_GFXDECODE("gfxdecode") |
| 1815 | MCFG_TOAPLAN_SCU_ADD("scu", "palette", 31, 15) |
| 1830 | 1816 | |
| 1831 | 1817 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", rallybik) |
| 1832 | 1818 | MCFG_PALETTE_ADD("palette", (64*16)+(64*16)) |
| r29319 | r29320 | |
| 2133 | 2119 | ROM_LOAD16_BYTE( "b45-07.bin", 0x40000, 0x20000, CRC(cd3748b4) SHA1(a20eb19a0f813112b4e5d9cd91db29de9b37af17) ) |
| 2134 | 2120 | ROM_LOAD16_BYTE( "b45-06.bin", 0x40001, 0x20000, CRC(144b085c) SHA1(84b7412d58fe9c5e9915896db92e80a621571b74) ) |
| 2135 | 2121 | |
| 2136 | | ROM_REGION( 0x40000, "gfx2", 0 ) |
| 2122 | ROM_REGION( 0x40000, "scu", 0 ) |
| 2137 | 2123 | ROM_LOAD( "b45-11.rom", 0x00000, 0x10000, CRC(0d56e8bb) SHA1(c29cb53f846c73b7cf9936051fb0f9dd3805f53f) ) |
| 2138 | 2124 | ROM_LOAD( "b45-10.rom", 0x10000, 0x10000, CRC(dbb7c57e) SHA1(268132965cd65b5e972ca9d0258c30b8a86f3703) ) |
| 2139 | 2125 | ROM_LOAD( "b45-12.rom", 0x20000, 0x10000, CRC(cf5aae4e) SHA1(5832c52d2e9b86414d8ee2926fa190abe9e41da4) ) |
branches/new_menus/src/mame/drivers/wardner.c
| r29319 | r29320 | |
| 336 | 336 | 8*8 /* every tile takes 8 consecutive bytes */ |
| 337 | 337 | }; |
| 338 | 338 | |
| 339 | | static 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 | | }; |
| 350 | 339 | |
| 351 | | |
| 352 | 340 | /* handler called by the 3812 emulator when the internal timers cause an IRQ */ |
| 353 | 341 | WRITE_LINE_MEMBER(wardner_state::irqhandler) |
| 354 | 342 | { |
| r29319 | r29320 | |
| 360 | 348 | GFXDECODE_ENTRY( "gfx1", 0x00000, charlayout, 1536, 32 ) /* colors 1536-1791 */ |
| 361 | 349 | GFXDECODE_ENTRY( "gfx2", 0x00000, tilelayout, 1280, 16 ) /* colors 1280-1535 */ |
| 362 | 350 | GFXDECODE_ENTRY( "gfx3", 0x00000, tilelayout, 1024, 16 ) /* colors 1024-1079 */ |
| 363 | | GFXDECODE_ENTRY( "gfx4", 0x00000, spritelayout, 0, 64 ) /* colors 0-1023 */ |
| 364 | 351 | GFXDECODE_END |
| 365 | 352 | |
| 366 | 353 | |
| r29319 | r29320 | |
| 409 | 396 | /* video hardware */ |
| 410 | 397 | MCFG_MC6845_ADD("crtc", HD6845, "screen", XTAL_14MHz/4, twincobr_mc6845_intf) /* 3.5MHz measured on CLKin */ |
| 411 | 398 | |
| 412 | | MCFG_TOAPLAN_SCU_ADD("toaplan_scu") |
| 413 | | MCFG_TOAPLAN_SCU_GFXDECODE("gfxdecode") |
| 399 | MCFG_TOAPLAN_SCU_ADD("scu", "palette", 32, 14) |
| 414 | 400 | |
| 415 | 401 | MCFG_BUFFERED_SPRITERAM8_ADD("spriteram8") |
| 416 | 402 | |
| r29319 | r29320 | |
| 480 | 466 | ROM_LOAD( "b25-10.rom", 0x10000, 0x08000, CRC(b9a61e81) SHA1(541e579664d583fbbf81111046115018fdaff073) ) |
| 481 | 467 | ROM_LOAD( "b25-09.rom", 0x18000, 0x08000, CRC(585411b7) SHA1(67c0f4b7ab303341d5481c4024dc4199acb7c279) ) |
| 482 | 468 | |
| 483 | | ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */ |
| 469 | ROM_REGION( 0x40000, "scu", 0 ) /* sprites */ |
| 484 | 470 | ROM_LOAD( "b25-01.rom", 0x00000, 0x10000, CRC(42ec01fb) SHA1(646192a2e89f795ed016860cdcdc0b5ef645fca2) ) |
| 485 | 471 | ROM_LOAD( "b25-02.rom", 0x10000, 0x10000, CRC(6c0130b7) SHA1(8b6ad72848d03c3d4ee3acd35abbb3a0e678122c) ) |
| 486 | 472 | ROM_LOAD( "b25-03.rom", 0x20000, 0x10000, CRC(b923db99) SHA1(2f4be81afdf200586bc44b1e94553d84d16d0b62) ) |
| r29319 | r29320 | |
| 531 | 517 | ROM_LOAD( "b25-10.rom", 0x10000, 0x08000, CRC(b9a61e81) SHA1(541e579664d583fbbf81111046115018fdaff073) ) |
| 532 | 518 | ROM_LOAD( "b25-09.rom", 0x18000, 0x08000, CRC(585411b7) SHA1(67c0f4b7ab303341d5481c4024dc4199acb7c279) ) |
| 533 | 519 | |
| 534 | | ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */ |
| 520 | ROM_REGION( 0x40000, "scu", 0 ) /* sprites */ |
| 535 | 521 | ROM_LOAD( "b25-01.rom", 0x00000, 0x10000, CRC(42ec01fb) SHA1(646192a2e89f795ed016860cdcdc0b5ef645fca2) ) |
| 536 | 522 | ROM_LOAD( "b25-02.rom", 0x10000, 0x10000, CRC(6c0130b7) SHA1(8b6ad72848d03c3d4ee3acd35abbb3a0e678122c) ) |
| 537 | 523 | ROM_LOAD( "b25-03.rom", 0x20000, 0x10000, CRC(b923db99) SHA1(2f4be81afdf200586bc44b1e94553d84d16d0b62) ) |
| r29319 | r29320 | |
| 582 | 568 | ROM_LOAD( "b25-10.rom", 0x10000, 0x08000, CRC(b9a61e81) SHA1(541e579664d583fbbf81111046115018fdaff073) ) |
| 583 | 569 | ROM_LOAD( "b25-09.rom", 0x18000, 0x08000, CRC(585411b7) SHA1(67c0f4b7ab303341d5481c4024dc4199acb7c279) ) |
| 584 | 570 | |
| 585 | | ROM_REGION( 0x40000, "gfx4", 0 ) /* sprites */ |
| 571 | ROM_REGION( 0x40000, "scu", 0 ) /* sprites */ |
| 586 | 572 | ROM_LOAD( "b25-01.rom", 0x00000, 0x10000, CRC(42ec01fb) SHA1(646192a2e89f795ed016860cdcdc0b5ef645fca2) ) |
| 587 | 573 | ROM_LOAD( "b25-02.rom", 0x10000, 0x10000, CRC(6c0130b7) SHA1(8b6ad72848d03c3d4ee3acd35abbb3a0e678122c) ) |
| 588 | 574 | ROM_LOAD( "b25-03.rom", 0x20000, 0x10000, CRC(b923db99) SHA1(2f4be81afdf200586bc44b1e94553d84d16d0b62) ) |
branches/new_menus/src/mame/drivers/nemesis.c
| r29319 | r29320 | |
| 1318 | 1318 | |
| 1319 | 1319 | /******************************************************************************/ |
| 1320 | 1320 | |
| 1321 | | #define XOR(x) ((x)^NATIVE_ENDIAN_VALUE_LE_BE(8,0)) |
| 1322 | | |
| 1323 | 1321 | static const gfx_layout charlayout = |
| 1324 | 1322 | { |
| 1325 | 1323 | 8,8, /* 8*8 characters */ |
| 1326 | | 2048, /* 2048 characters (+ blank one) */ |
| 1324 | RGN_FRAC(1,1), |
| 1327 | 1325 | 4, /* 4 bits per pixel */ |
| 1328 | 1326 | { 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 |
| 1332 | 1330 | }; |
| 1333 | 1331 | |
| 1334 | 1332 | static const gfx_layout spritelayout = |
| 1335 | 1333 | { |
| 1336 | 1334 | 16,16, /* 16*16 sprites */ |
| 1337 | | 512, /* 512 sprites */ |
| 1335 | RGN_FRAC(1,1), |
| 1338 | 1336 | 4, /* 4 bits per pixel */ |
| 1339 | 1337 | { 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 |
| 1345 | 1341 | }; |
| 1346 | 1342 | |
| 1347 | 1343 | static const gfx_layout spritelayout3216 = |
| 1348 | 1344 | { |
| 1349 | 1345 | 32,16, /* 32*16 sprites */ |
| 1350 | | 256, /* 256 sprites */ |
| 1346 | RGN_FRAC(1,1), |
| 1351 | 1347 | 4, /* 4 bits per pixel */ |
| 1352 | 1348 | { 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 |
| 1360 | 1352 | }; |
| 1361 | 1353 | |
| 1362 | 1354 | static const gfx_layout spritelayout1632 = |
| 1363 | 1355 | { |
| 1364 | 1356 | 16,32, /* 16*32 sprites */ |
| 1365 | | 256, /* 256 sprites */ |
| 1357 | RGN_FRAC(1,1), |
| 1366 | 1358 | 4, /* 4 bits per pixel */ |
| 1367 | 1359 | { 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 |
| 1375 | 1363 | }; |
| 1376 | 1364 | |
| 1377 | 1365 | static const gfx_layout spritelayout3232 = |
| 1378 | 1366 | { |
| 1379 | 1367 | 32,32, /* 32*32 sprites */ |
| 1380 | | 128, /* 128 sprites */ |
| 1368 | RGN_FRAC(1,1), |
| 1381 | 1369 | 4, /* 4 bits per pixel */ |
| 1382 | 1370 | { 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 |
| 1392 | 1374 | }; |
| 1393 | 1375 | |
| 1394 | 1376 | static const gfx_layout spritelayout816 = |
| 1395 | 1377 | { |
| 1396 | | 8,16, /* 16*16 sprites */ |
| 1397 | | 1024, /* 1024 sprites */ |
| 1378 | 8,16, /* 8*16 sprites */ |
| 1379 | RGN_FRAC(1,1), |
| 1398 | 1380 | 4, /* 4 bits per pixel */ |
| 1399 | 1381 | { 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 |
| 1404 | 1385 | }; |
| 1405 | 1386 | |
| 1406 | 1387 | static const gfx_layout spritelayout168 = |
| 1407 | 1388 | { |
| 1408 | 1389 | 16,8, /* 16*8 sprites */ |
| 1409 | | 1024, /* 1024 sprites */ |
| 1390 | RGN_FRAC(1,1), |
| 1410 | 1391 | 4, /* 4 bits per pixel */ |
| 1411 | 1392 | { 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 |
| 1417 | 1396 | }; |
| 1418 | 1397 | |
| 1419 | | static 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 | | }; |
| 1398 | static const UINT32 spritelayout6464_xoffset[64] = { STEP64(0, 4) }; |
| 1430 | 1399 | |
| 1431 | | static 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 | | }; |
| 1400 | static const UINT32 spritelayout6464_yoffset[64] = { STEP64(0, 4*64) }; |
| 1442 | 1401 | |
| 1443 | 1402 | static const gfx_layout spritelayout6464 = |
| 1444 | 1403 | { |
| 1445 | | 64,64, /* 32*32 sprites */ |
| 1446 | | 32, /* 128 sprites */ |
| 1404 | 64,64, /* 64*64 sprites */ |
| 1405 | RGN_FRAC(1,1), |
| 1447 | 1406 | 4, /* 4 bits per pixel */ |
| 1448 | 1407 | { 0, 1, 2, 3 }, |
| 1449 | 1408 | EXTENDED_XOFFS, |
| 1450 | 1409 | EXTENDED_YOFFS, |
| 1451 | | 2048*8, /* every sprite takes 128 consecutive bytes */ |
| 1410 | 4*64*64, |
| 1452 | 1411 | spritelayout6464_xoffset, |
| 1453 | 1412 | spritelayout6464_yoffset |
| 1454 | 1413 | }; |
| 1455 | 1414 | |
| 1456 | 1415 | static 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 ) |
| 1465 | 1424 | GFXDECODE_END |
| 1466 | 1425 | |
| 1467 | 1426 | /******************************************************************************/ |
branches/new_menus/src/emu/digfx.c
| r0 | r29320 | |
| 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 | |
| 21 | device_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 | |
| 35 | device_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 | |
| 45 | void 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 | |
| 60 | void 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 | |
| 76 | void 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 | |
| 104 | void 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 | |
| 116 | void 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 | |
| 295 | void 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 | } |
branches/new_menus/src/emu/digfx.h
| r0 | r29320 | |
| 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 | |
| 24 | const int MAX_GFX_ELEMENTS = 32; |
| 25 | const int MAX_GFX_PLANES = 8; |
| 26 | const 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 ) \ |
| 39 | const 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 |
| 153 | class gfx_element; |
| 154 | class palette_device; |
| 155 | |
| 156 | struct 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 | |
| 173 | struct 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 | |
| 185 | class device_gfx_interface : public device_interface |
| 186 | { |
| 187 | public: |
| 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 | |
| 207 | protected: |
| 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 | |
| 213 | private: |
| 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 |
| 226 | typedef device_interface_iterator<device_gfx_interface> gfx_interface_iterator; |
| 227 | |
| 228 | |
| 229 | #endif /* __DIGFX_H__ */ |
branches/new_menus/src/emu/drawgfx.c
| r29319 | r29320 | |
| 11 | 11 | |
| 12 | 12 | #include "emu.h" |
| 13 | 13 | #include "drawgfxm.h" |
| 14 | | #include "validity.h" |
| 15 | 14 | |
| 16 | 15 | |
| 17 | 16 | /*************************************************************************** |
| r29319 | r29320 | |
| 71 | 70 | |
| 72 | 71 | const device_type GFXDECODE = &device_creator<gfxdecode_device>; |
| 73 | 72 | |
| 74 | | gfxdecode_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) |
| 73 | gfxdecode_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) |
| 78 | 76 | { |
| 79 | 77 | } |
| 80 | 78 | |
| 81 | | //************************************************************************** |
| 82 | | // INITIALIZATION AND CONFIGURATION |
| 83 | | //************************************************************************** |
| 84 | 79 | |
| 85 | | void gfxdecode_device::static_set_gfxdecodeinfo(device_t &device, const gfx_decode_entry *info) |
| 86 | | { |
| 87 | | downcast<gfxdecode_device &>(device).m_gfxdecodeinfo = info; |
| 88 | | } |
| 89 | 80 | |
| 90 | | void gfxdecode_device::static_set_palette(device_t &device, const char *tag) |
| 91 | | { |
| 92 | | downcast<gfxdecode_device &>(device).m_palette.set_tag(tag); |
| 93 | | } |
| 94 | 81 | |
| 95 | | //------------------------------------------------- |
| 96 | | // device_stop - final cleanup |
| 97 | | //------------------------------------------------- |
| 98 | | |
| 99 | | void gfxdecode_device::device_stop() |
| 100 | | { |
| 101 | | } |
| 102 | | |
| 103 | | //------------------------------------------------- |
| 104 | | // device_start - start up the device |
| 105 | | //------------------------------------------------- |
| 106 | | |
| 107 | | void 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 | | |
| 260 | | void 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 | | |
| 334 | 82 | /*************************************************************************** |
| 335 | 83 | GRAPHICS ELEMENTS |
| 336 | 84 | ***************************************************************************/ |
| r29319 | r29320 | |
| 443 | 191 | if (m_layout_is_raw) |
| 444 | 192 | { |
| 445 | 193 | // 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; |
| 447 | 195 | m_char_modulo = gl.charincrement / 8; |
| 448 | 196 | |
| 449 | 197 | // RAW graphics must have a pointer up front |
branches/new_menus/src/emu/drawgfx.h
| r29319 | r29320 | |
| 19 | 19 | #define __DRAWGFX_H__ |
| 20 | 20 | |
| 21 | 21 | |
| 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 | | |
| 42 | 22 | /*************************************************************************** |
| 43 | 23 | CONSTANTS |
| 44 | 24 | ***************************************************************************/ |
| 45 | 25 | |
| 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 | | |
| 65 | 26 | enum |
| 66 | 27 | { |
| 67 | 28 | DRAWMODE_NONE, |
| r29319 | r29320 | |
| 72 | 33 | |
| 73 | 34 | |
| 74 | 35 | /*************************************************************************** |
| 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 ) \ |
| 110 | | const gfx_layout name = { width, height, RGN_FRAC(1,1), 8, { GFX_RAW }, { 0 }, { linemod }, charmod }; |
| 111 | | |
| 112 | | |
| 113 | | |
| 114 | | /*************************************************************************** |
| 115 | 36 | TYPE DEFINITIONS |
| 116 | 37 | ***************************************************************************/ |
| 117 | 38 | |
| 118 | | struct 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 | | |
| 136 | 39 | class gfx_element |
| 137 | 40 | { |
| 138 | 41 | public: |
| r29319 | r29320 | |
| 291 | 194 | }; |
| 292 | 195 | |
| 293 | 196 | |
| 294 | | struct 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 | | |
| 307 | 197 | /*************************************************************************** |
| 308 | 198 | FUNCTION PROTOTYPES |
| 309 | 199 | ***************************************************************************/ |
| r29319 | r29320 | |
| 449 | 339 | // device type definition |
| 450 | 340 | extern const device_type GFXDECODE; |
| 451 | 341 | |
| 452 | | class gfxdecode_device : public device_t |
| 342 | class gfxdecode_device : public device_t, public device_gfx_interface |
| 453 | 343 | { |
| 454 | 344 | public: |
| 455 | 345 | // construction/destruction |
| 456 | 346 | gfxdecode_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 457 | 347 | |
| 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); } |
| 466 | 348 | protected: |
| 467 | | // device-level overrides |
| 468 | | virtual void device_validity_check(validity_checker &valid) const; |
| 469 | | virtual void device_start(); |
| 470 | | virtual void device_stop(); |
| 471 | | private: |
| 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() {}; |
| 478 | 350 | }; |
| 479 | 351 | |
| 480 | | // device type iterator |
| 481 | | typedef device_type_iterator<&device_creator<gfxdecode_device>, gfxdecode_device> gfxdecode_device_iterator; |
| 482 | | |
| 483 | 352 | GFXDECODE_EXTERN(empty); |
| 484 | 353 | |
| 485 | 354 | #endif // __DRAWGFX_H__ |
branches/new_menus/src/emu/ui/viewgfx.c
| r29319 | r29320 | |
| 41 | 41 | // information about a single gfx device |
| 42 | 42 | struct ui_gfx_info |
| 43 | 43 | { |
| 44 | | gfxdecode_device *device; // pointer to device |
| 44 | device_gfx_interface *interface; // pointer to device's gfx interface |
| 45 | 45 | UINT8 setcount; // how many gfx sets device has |
| 46 | 46 | UINT8 rotate[MAX_GFX_ELEMENTS]; // current rotation (orientation) value |
| 47 | 47 | UINT8 columns[MAX_GFX_ELEMENTS]; // number of items per row |
| r29319 | r29320 | |
| 169 | 169 | |
| 170 | 170 | static void ui_gfx_count_devices(running_machine &machine, ui_gfx_state &state) |
| 171 | 171 | { |
| 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()); |
| 174 | 174 | |
| 175 | 175 | // count the palette devices |
| 176 | | state.palette.devcount = pal_deviter.count(); |
| 176 | state.palette.devcount = pal_iter.count(); |
| 177 | 177 | |
| 178 | 178 | // set the pointer to the first palette |
| 179 | 179 | if (state.palette.devcount > 0) |
| 180 | 180 | palette_set_device(machine, state); |
| 181 | 181 | |
| 182 | | // count the gfx decoders |
| 182 | // count the gfx devices |
| 183 | 183 | state.gfxset.devcount = 0; |
| 184 | | int tempcount = gfx_deviter.count(); |
| 184 | int tempcount = gfx_iter.count(); |
| 185 | 185 | |
| 186 | | // count the gfx sets in each decoder |
| 186 | // count the gfx sets in each device, skipping devices with none |
| 187 | 187 | if (tempcount > 0) |
| 188 | 188 | { |
| 189 | | gfxdecode_device *m_gfxdecode; |
| 189 | device_gfx_interface *interface; |
| 190 | 190 | int i, count; |
| 191 | 191 | |
| 192 | | for (i = 0, m_gfxdecode = gfx_deviter.first(); |
| 192 | for (i = 0, interface = gfx_iter.first(); |
| 193 | 193 | i < tempcount && state.gfxset.devcount < MAX_GFX_DECODERS; |
| 194 | | i++, m_gfxdecode = gfx_deviter.next()) |
| 194 | i++, interface = gfx_iter.next()) |
| 195 | 195 | { |
| 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++); |
| 197 | 197 | |
| 198 | 198 | // count = index of first NULL |
| 199 | 199 | if (count > 0) |
| 200 | 200 | { |
| 201 | | state.gfxdev[state.gfxset.devcount].device = m_gfxdecode; |
| 201 | state.gfxdev[state.gfxset.devcount].interface = interface; |
| 202 | 202 | state.gfxdev[state.gfxset.devcount].setcount = count; |
| 203 | 203 | state.gfxset.devcount++; |
| 204 | 204 | } |
| r29319 | r29320 | |
| 341 | 341 | |
| 342 | 342 | static void palette_set_device(running_machine &machine, ui_gfx_state &state) |
| 343 | 343 | { |
| 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); |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | |
| r29319 | r29320 | |
| 564 | 564 | int dev = state.gfxset.devindex; |
| 565 | 565 | int set = state.gfxset.set; |
| 566 | 566 | 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); |
| 569 | 569 | float fullwidth, fullheight; |
| 570 | 570 | float cellwidth, cellheight; |
| 571 | 571 | float chwidth, chheight; |
| r29319 | r29320 | |
| 649 | 649 | |
| 650 | 650 | // figure out the title and expand the outer box to fit |
| 651 | 651 | sprintf(title, "'%s' %d/%d %dx%d COLOR %X", |
| 652 | | m_gfxdecode.tag(), |
| 652 | interface.device().tag(), |
| 653 | 653 | set, info.setcount - 1, |
| 654 | 654 | gfx.width(), gfx.height(), |
| 655 | 655 | info.color[set]); |
| r29319 | r29320 | |
| 758 | 758 | int dev = state.gfxset.devindex; |
| 759 | 759 | int set = state.gfxset.set; |
| 760 | 760 | ui_gfx_info &info = state.gfxdev[dev]; |
| 761 | | gfx_element &gfx = *info.device->gfx(set); |
| 761 | gfx_element &gfx = *info.interface->gfx(set); |
| 762 | 762 | |
| 763 | 763 | // handle cells per line (minus,plus) |
| 764 | 764 | if (ui_input_pressed(machine, IPT_UI_ZOOM_OUT)) |