From de9c2b6e5ef9f19588039a99c388ae4d2ad03144 Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Wed, 18 May 2011 23:22:43 +0000 Subject: [PATCH] Implemented multi-cart support to ST-V driver [Angelo Salese] --- .gitattributes | 1 + hash/stv.xml | 46 ++++++++++++++++++++++++++++++ src/mame/drivers/saturn.c | 59 +++++++++++++++++++++++++++++++-------- 3 files changed, 94 insertions(+), 12 deletions(-) create mode 100644 hash/stv.xml diff --git a/.gitattributes b/.gitattributes index 8b913b1a032..29894327687 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/hash/stv.xml b/hash/stv.xml new file mode 100644 index 00000000000..d8864316610 --- /dev/null +++ b/hash/stv.xml @@ -0,0 +1,46 @@ + + + + + + + + + Baku Baku Animal (J 950407 V1.000) + 1995 + Sega + + + + + + + + + + + + + + Golden Axe - The Duel (JUETL 950117 V1.000) + 1994 + Sega + + + + + + + + + + + + + + + + + diff --git a/src/mame/drivers/saturn.c b/src/mame/drivers/saturn.c index 7540089b32f..0c704a23514 100644 --- a/src/mame/drivers/saturn.c +++ b/src/mame/drivers/saturn.c @@ -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(); 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