Implemented multi-cart support to ST-V driver [Angelo Salese]

This commit is contained in:
Angelo Salese 2011-05-18 23:22:43 +00:00
parent 3960c5423a
commit de9c2b6e5e
3 changed files with 94 additions and 12 deletions

1
.gitattributes vendored
View File

@ -8,6 +8,7 @@ docs/newvideo.txt svneol=native#text/plain
docs/windows.txt svneol=native#text/plain
hash/megatech.xml svneol=native#text/plain
hash/softwarelist.dtd svneol=native#text/plain
hash/stv.xml svneol=native#text/plain
hlsl/color.fx svneol=native#text/plain
hlsl/color_heavy.fx svneol=native#text/plain
hlsl/color_light.fx svneol=native#text/plain

46
hash/stv.xml Normal file
View File

@ -0,0 +1,46 @@
<?xml version="1.0"?>
<!DOCTYPE softwarelist SYSTEM "softwarelist.dtd">
<!--
Note: most games doesn't support multi cart system, the ones that are does have a "CART-AM" in the header
-->
<softwarelist name="stv" description="Sega Titan Video cartridges">
<!-- Game: Baku Baku Animal -->
<software name="bakubaku">
<description>Baku Baku Animal (J 950407 V1.000)</description>
<year>1995</year>
<publisher>Sega</publisher>
<part name="cart" interface="stv_cart">
<dataarea name="rom" size="0x3000000">
<rom name="fpr17969.13" size="0x100000" crc="bee327e5" sha1="1d226db72d6ef68fd294f60659df7f882b25def6" offset="0x000001" loadflag="load16_byte"/>
<rom name="mpr17970.2" size="0x400000" crc="bc4d6f91" sha1="dcc241dcabea59325decfba3fd5e113c07958422" offset="0x400000"/>
<rom name="mpr17971.3" size="0x400000" crc="c780a3b3" sha1="99587eea528a6413cacc3e4d3d1dbfff57b03dca" offset="0x800000"/>
<rom name="mpr17972.4" size="0x400000" crc="8f29815a" sha1="e86acd8096f2aee5f5e3ddfd3abb4f5c2b11df66" offset="0xc00000"/>
<rom name="mpr17973.5" size="0x400000" crc="5f6e0e8b" sha1="eeb5efb5216ab8b8fdee4656774bbd5a2a5b2d42" offset="0x1000000"/>
</dataarea>
</part>
</software>
<!-- Game: Golden Axe - The Duel -->
<software name="gaxeduel">
<description>Golden Axe - The Duel (JUETL 950117 V1.000)</description>
<year>1994</year>
<publisher>Sega</publisher>
<part name="cart" interface="stv_cart">
<dataarea name="rom" size="0x3000000">
<rom name="epr17766.13" size="0x0080000" crc="a83fcd62" sha1="4ce77ebaa0e93c6553ad8f7fb87cbdc32433402b" offset="0x0000001" loadflag="load16_byte"/>
<rom size="0x0080000" offset="0x0100001" loadflag="reload" />
<rom name="mpr17768.2" size="0x0400000" crc="d6808a7d" sha1="83a97bbe1160cb45b3bdcbde8adc0d9bae5ded60" offset="0x0400000"/>
<rom name="mpr17769.3" size="0x0400000" crc="3471dd35" sha1="24febddfe70984cebc0e6948ad718e0e6957fa82" offset="0x0800000"/>
<rom name="mpr17770.4" size="0x0400000" crc="06978a00" sha1="a8d1333a9f4322e28b23724937f595805315b136" offset="0x0c00000"/>
<rom name="mpr17771.5" size="0x0400000" crc="aea2ea3b" sha1="2fbe3e10d3f5a3b3099a7ed5b38b93b6e22e19b8" offset="0x1000000"/>
<rom name="mpr17772.6" size="0x0400000" crc="b3dc0e75" sha1="fbe2790c84466d186ea3e9d41edfcb7afaf54bea" offset="0x1400000"/>
<rom name="mpr17767.1" size="0x0400000" crc="9ba1e7b1" sha1="f297c3697d2e8ba4476d672267163f91f371b362" offset="0x1800000"/>
</dataarea>
</part>
</software>
</softwarelist>

View File

@ -3020,16 +3020,17 @@ MACHINE_CONFIG_END
struct stv_cart_region
{
const char *tag;
int slot;
const char *region;
};
static const struct stv_cart_region stv_cart_table[] =
{
{ 0, "game0" },
{ 1, "game1" },
{ 2, "game2" },
{ 3, "game3" },
{ "cart1", 0, "game0" },
{ "cart2", 1, "game1" },
{ "cart3", 2, "game2" },
{ "cart4", 3, "game3" },
{ 0 }
};
@ -3037,12 +3038,12 @@ static DEVICE_IMAGE_LOAD( stv_cart )
{
// saturn_state *state = image.device().machine().driver_data<saturn_state>();
const struct stv_cart_region *stv_cart = &stv_cart_table[0], *this_cart;
const char *pcb_name;
//const char *pcb_name;
/* First, determine where this cart has to be loaded */
while (stv_cart->region)
while (stv_cart->tag)
{
if (strcmp(stv_cart->region, image.device().tag()) == 0)
if (strcmp(stv_cart->tag, image.device().tag()) == 0)
break;
stv_cart++;
@ -3053,14 +3054,42 @@ static DEVICE_IMAGE_LOAD( stv_cart )
if (image.software_entry() == NULL)
return IMAGE_INIT_FAIL;
//printf("load list\n");
UINT8 *ROM = image.device().machine().region(this_cart->region)->base();
//printf("load list2\n");
UINT32 length = image.get_software_region_length("rom");
memcpy(ROM, image.get_software_region("rom"), length);
if ((pcb_name = image.get_feature("pcb_type")) == NULL)
return IMAGE_INIT_FAIL;
/* fix endianess */
{
UINT8 j[4];
int i;
for(i=0;i<0x0200000;i+=4)//0x0200000
{
j[0] = ROM[i];
j[1] = ROM[i+1];
j[2] = ROM[i+2];
j[3] = ROM[i+3];
ROM[i] = j[3];
ROM[i+1] = j[2];
ROM[i+2] = j[1];
ROM[i+3] = j[0];
}
for(i=0x0200000;i<length;i+=4)//0x0200000
{
j[0] = ROM[i];
j[1] = ROM[i+1];
j[2] = ROM[i+2];
j[3] = ROM[i+3];
ROM[i] = j[2];
ROM[i+1] = j[3];
ROM[i+2] = j[0];
ROM[i+3] = j[1];
}
}
//if ((pcb_name = image.get_feature("pcb_type")) == NULL)
// return IMAGE_INIT_FAIL;
return IMAGE_INIT_PASS;
}
@ -3256,7 +3285,13 @@ ROM_LOAD16_WORD_SWAP_BIOS( x, "saturn.bin", 0x000000, 0x080000, CRC(653ff2d8) SH
ROM_START( stvbios )
STV_BIOS
ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 ) /* SH2 code */
ROM_REGION32_BE( 0x3000000, "game0", ROMREGION_ERASE00 )
ROM_REGION32_BE( 0x3000000, "game1", ROMREGION_ERASE00 )
ROM_REGION32_BE( 0x3000000, "game2", ROMREGION_ERASE00 )
ROM_REGION32_BE( 0x3000000, "game3", ROMREGION_ERASE00 )
ROM_END
/*