From cd32bc2f2ae1da0c9167babe56590a293ad7f97b Mon Sep 17 00:00:00 2001 From: David Haywood Date: Sun, 4 May 2014 15:23:20 +0000 Subject: [PATCH] sc4dnd layout helper fun (nw) --- .gitattributes | 3 + src/mame/drivers/bfm_sc4.c | 359 +-------- src/mame/drivers/bfm_sc45_helper.c | 645 +++++++++++++++ src/mame/drivers/bfm_sc45_helper.h | 5 + src/mame/drivers/bfm_sc5.c | 1 + src/mame/layout/sc4dnd.lay | 1168 ++++++++++++++++++++++++++++ src/mame/mame.mak | 4 +- 7 files changed, 1845 insertions(+), 340 deletions(-) create mode 100644 src/mame/drivers/bfm_sc45_helper.c create mode 100644 src/mame/drivers/bfm_sc45_helper.h create mode 100644 src/mame/layout/sc4dnd.lay diff --git a/.gitattributes b/.gitattributes index c9e8eabb6ef..6c3ad8f60e3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4254,6 +4254,8 @@ src/mame/drivers/bfm_ad5sw.c svneol=native#text/plain src/mame/drivers/bfm_sc1.c svneol=native#text/plain src/mame/drivers/bfm_sc2.c svneol=native#text/plain src/mame/drivers/bfm_sc4.c svneol=native#text/plain +src/mame/drivers/bfm_sc45_helper.c svneol=native#text/plain +src/mame/drivers/bfm_sc45_helper.h svneol=native#text/plain src/mame/drivers/bfm_sc4h.c svneol=native#text/plain src/mame/drivers/bfm_sc5.c svneol=native#text/plain src/mame/drivers/bfm_sc5sw.c svneol=native#text/plain @@ -6349,6 +6351,7 @@ src/mame/layout/sc2_dmd.lay svneol=native#text/xml src/mame/layout/sc2_vfd.lay svneol=native#text/xml src/mame/layout/sc2_vid.lay svneol=native#text/xml src/mame/layout/sc4_dmd.lay svneol=native#text/xml +src/mame/layout/sc4dnd.lay svneol=native#text/plain src/mame/layout/sderby.lay svneol=native#text/xml src/mame/layout/seabattl.lay svneol=native#text/xml src/mame/layout/seawolf.lay svneol=native#text/xml diff --git a/src/mame/drivers/bfm_sc4.c b/src/mame/drivers/bfm_sc4.c index 1d907b7e3f9..d0c6b49b807 100644 --- a/src/mame/drivers/bfm_sc4.c +++ b/src/mame/drivers/bfm_sc4.c @@ -38,7 +38,9 @@ #include "emu.h" #include "includes/bfm_sc45.h" +#include "bfm_sc45_helper.h" +#include "sc4dnd.lh" bool compare_mbus(UINT16* rom) { @@ -75,326 +77,6 @@ void find_mbus(sc4_state *state, UINT16* rom) } -// addrxor used for endianness stuff, mode used for when we have a missing pair half -int find_project_string(running_machine &machine, int addrxor, int mode) -{ - // search for the title - const int strlength = 14; - char title_string[] = "PROJECT NUMBER"; - UINT8 *src = machine.root_device().memregion( "maincpu" )->base(); - int size = machine.root_device().memregion( "maincpu" )->bytes(); - - int search_start = 0; - int search_step = 1; - - if (mode==1) - { - search_start = 0; - search_step = 2; - } - - if (mode==2) - { - search_start = 1; - search_step = 2; - } - - for (int i=0;i=0x20) && (rom<0x7f)) - { - printf("%c", rom); - blankcount = 0; - } - else - { - blankcount++; - if (blankcount<10) printf(" "); - } - } - - count++; - - if (count>=0x100) - end = 1; - } - printf("\n"); - - return 1; - } - } - - return 0; -} - -// find where the button definitions are in the ROM to make creating input ports easier for games using common test mode code -// not ALL games have a comprehensive list, but enough do to make this a worthwile debugging aid. -bool compare_input_code(running_machine &machine, int addr) -{ - UINT16 *src = (UINT16*)machine.root_device().memregion( "maincpu" )->base(); - UINT16* rom = &src[addr]; - - - if ((rom[0] != 0x48e7) || (rom[1] != 0x3020) || (rom[2] != 0x322f) || (rom[3] != 0x0010) || (rom[4] != 0x227c)) - return false; - - if ((rom[7] != 0x4242) || (rom[8] != 0x2449) || (rom[9] != 0x3639)) - return false; - - return true; -} - -int find_input_strings(running_machine &machine) -{ - int foundat = -1; - UINT32 startblock = 0; - UINT32 endblock = 0; - - UINT16 *rom = (UINT16*)machine.root_device().memregion( "maincpu" )->base(); - UINT8 *rom8 = machine.root_device().memregion( "maincpu" )->base(); - - for (int i=0;i<(0x100000-0x40)/2;i++) - { - bool found = compare_input_code(machine, i); - - if (found==true) - { - - startblock = (rom[i + 5] << 16) | rom[i + 6]; - endblock = (rom[i + 10] << 16) | rom[i + 11]; - printf("------------ INPUTS -----------------\n"); - printf("input strings found at %08x (start of ponter block %08x end of pointer block %08x\n", i*2, startblock, endblock); - foundat = i; - - if (endblock > startblock) - { - for (int j = startblock / 2; j < endblock / 2; j+=4) - { - UINT16 portpos = rom[j + 0]; - int port = (portpos & 0x1f); - int pos = (portpos >> 5); - UINT16 unk2 = rom[j + 1]; - UINT32 stringaddr = (rom[j + 2] << 16) | rom[j + 3]; - - printf("(port %02x position %02x) unk %04x addr %08x ", port,pos, unk2, stringaddr); - - for (int k = stringaddr; k < stringaddr + 6; k++) - { - UINT8 chr = rom8[k^1]; - - if ((chr == 0xff) || (chr == 0x00)) - { - k = stringaddr + 6; - } - else - { - printf("%c", chr); - } - - } - - - printf("\n"); - - } - } - - } - } - - return foundat; -} - -int find_lamp_strings(running_machine &machine) -{ - if (strcmp(machine.system().name, "sc4dnd")) - return 0; - - // these are for sc4dnd ONLY, need to work out how the code calculates them - int startblock = 0x1cac0; - int endblock = 0x1cf9a; - - - UINT16 *rom = (UINT16*)machine.root_device().memregion( "maincpu" )->base(); - UINT8 *rom8 = machine.root_device().memregion( "maincpu" )->base(); - - printf("------------ LAMPS -----------------\n"); - - if (endblock > startblock) - { - for (int j = startblock / 2; j < endblock / 2; j+=3) - { - UINT16 portpos = rom[j + 0]; - int row = portpos & 0xf; - int col = (portpos >> 4 ) & 0xf; - - UINT32 stringaddr = (rom[j + 1] << 16) | rom[j + 2]; - - printf("(row %02d, col %02d, unused %02x) addr %08x ", row,col, (portpos&0xff00)>>8, stringaddr); - - for (int k = stringaddr; k < stringaddr + 10; k++) - { - UINT8 chr = rom8[k^1]; - - if ((chr == 0xff) || (chr == 0x00)) - { - k = stringaddr + 10; - } - else - { - printf("%c", chr); - } - - } - - - printf("\n"); - - } - } - - return 0; -} - - -int find_reel_strings(running_machine &machine) -{ - if (strcmp(machine.system().name, "sc4dnd")) - return 0; - - // these are for sc4dnd ONLY, need to work out how the code calculates them - - // this list is 4 * 16 symbols for the regular reels, 12 symbols for the number spin, and 2 groups of 16 depending on jackpot/stake keys used for the prize reel - // code that points at these is likely to be complex because it's conditional on the game code / mode.. - int reelsizes[] = { 16, 16, 16, 16, 12, 16, 16 }; - int total_reel_symbols = 0; - - for (int i = 0; i < 7; i++) - { - total_reel_symbols += reelsizes[i]; - } - - int startblock = 0x8d74c; - int endblock = startblock + 4 * (total_reel_symbols); - - - UINT16 *rom = (UINT16*)machine.root_device().memregion( "maincpu" )->base(); - UINT8 *rom8 = machine.root_device().memregion( "maincpu" )->base(); - - - - printf("------------ REELS -----------------\n"); - - if (endblock > startblock) - { - int which_reel = 0; - int current_symbols = 0; - - - - for (int j = startblock / 2; j < endblock / 2; j+=2) - { - if (current_symbols == 0) - { - printf("REEL %d\n", which_reel+1); - } - - UINT32 stringaddr = (rom[j + 0] << 16) | rom[j + 1]; - - printf("addr %08x ", stringaddr); - - for (int k = stringaddr; k < stringaddr + 10; k++) - { - UINT8 chr = rom8[k^1]; - - if ((chr == 0xff) || (chr == 0x00)) - { - k = stringaddr + 10; - } - else - { - printf("%c", chr); - } - - } - - printf("\n"); - - current_symbols++; - if (current_symbols == reelsizes[which_reel]) - { - current_symbols = 0; - which_reel++; - } - - - } - } - - return 0; -} - /* default reels */ static const stepper_interface* default_reel_configs[6] = { @@ -451,9 +133,8 @@ DRIVER_INIT_MEMBER(sc4_state,sc4) m_reel_setup = default_reel_configs; // debug helpers to find strings used for inputs and where the buttons map - find_input_strings(machine()); - find_lamp_strings(machine()); - find_reel_strings(machine()); + bfm_sc45_layout_helper(machine()); + } DRIVER_INIT_MEMBER(sc4_state,sc4mbus) @@ -30188,22 +29869,22 @@ INPUT_PORTS_START( sc4dnd35 ) INPUT_PORTS_END // PR1927 AWP DEAL OR NO DEAL S4 PR1907 DEAL OR NO DEAL SOUNDS11 -GAME( 200?, sc4dnd ,0, sc4, sc4dnd25, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL016, set 1)", GAME_NOT_WORKING ) // DONL 016 -GAME( 200?, sc4dndb ,sc4dnd, sc4, sc4dnd25, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL016, set 2)", GAME_NOT_WORKING ) // DONL 016 -GAME( 200?, sc4dnde ,sc4dnd, sc4, sc4dnd25, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL017, set 1)", GAME_NOT_WORKING ) // DONL 017 -GAME( 200?, sc4dndh ,sc4dnd, sc4, sc4dnd25, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL017, set 2)", GAME_NOT_WORKING ) // DONL 017 -GAME( 200?, sc4dndf ,sc4dnd, sc4, sc4dnd25, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL018, set 1)", GAME_NOT_WORKING ) // DONL 018 -GAME( 200?, sc4dndi ,sc4dnd, sc4, sc4dnd25, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL018, set 2)", GAME_NOT_WORKING )// DONL 018 -GAME( 200?, sc4dndd ,sc4dnd, sc4, sc4dnd35, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL402, set 1)", GAME_NOT_WORKING ) // DONL 402 -GAME( 200?, sc4dndg ,sc4dnd, sc4, sc4dnd35, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL402, set 2)", GAME_NOT_WORKING ) // DONL 402 -GAME( 200?, sc4dndj ,sc4dnd, sc4, sc4dnd35, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL406, set 1)", GAME_NOT_WORKING )// DONL 406 -GAME( 200?, sc4dndl ,sc4dnd, sc4, sc4dnd35, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL406, set 2)", GAME_NOT_WORKING )// DONL 406 -GAME( 200?, sc4dndc ,sc4dnd, sc4, sc4dnd35, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL422, set 1)", GAME_NOT_WORKING ) // DONL 422 -GAME( 200?, sc4dnda ,sc4dnd, sc4, sc4dnd35, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL422, set 2)", GAME_NOT_WORKING ) // DONL 422, incomplete pairing -GAME( 200?, sc4dndn ,sc4dnd, sc4, sc4dnd35, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL424, set 1)", GAME_NOT_WORKING )// DONL 424 -GAME( 200?, sc4dndo ,sc4dnd, sc4, sc4dnd35, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL424, set 2)", GAME_NOT_WORKING )// DONL 424 -GAME( 200?, sc4dndk ,sc4dnd, sc4, sc4dnd35, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL428, set 1)", GAME_NOT_WORKING )// DONL 428 -GAME( 200?, sc4dndm ,sc4dnd, sc4, sc4dnd35, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL428, set 2)", GAME_NOT_WORKING )// DONL 428 +GAMEL( 200?, sc4dnd ,0, sc4, sc4dnd25, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL016, set 1)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_sc4dnd ) // DONL 016 +GAMEL( 200?, sc4dndb ,sc4dnd, sc4, sc4dnd25, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL016, set 2)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_sc4dnd ) // DONL 016 +GAMEL( 200?, sc4dnde ,sc4dnd, sc4, sc4dnd25, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL017, set 1)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_sc4dnd ) // DONL 017 +GAMEL( 200?, sc4dndh ,sc4dnd, sc4, sc4dnd25, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL017, set 2)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_sc4dnd ) // DONL 017 +GAMEL( 200?, sc4dndf ,sc4dnd, sc4, sc4dnd25, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL018, set 1)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_sc4dnd ) // DONL 018 +GAMEL( 200?, sc4dndi ,sc4dnd, sc4, sc4dnd25, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL018, set 2)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_sc4dnd )// DONL 018 +GAMEL( 200?, sc4dndd ,sc4dnd, sc4, sc4dnd35, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL402, set 1)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_sc4dnd ) // DONL 402 +GAMEL( 200?, sc4dndg ,sc4dnd, sc4, sc4dnd35, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL402, set 2)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_sc4dnd ) // DONL 402 +GAMEL( 200?, sc4dndj ,sc4dnd, sc4, sc4dnd35, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL406, set 1)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_sc4dnd )// DONL 406 +GAMEL( 200?, sc4dndl ,sc4dnd, sc4, sc4dnd35, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL406, set 2)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_sc4dnd )// DONL 406 +GAMEL( 200?, sc4dndc ,sc4dnd, sc4, sc4dnd35, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL422, set 1)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_sc4dnd ) // DONL 422 +GAMEL( 200?, sc4dnda ,sc4dnd, sc4, sc4dnd35, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL422, set 2)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_sc4dnd ) // DONL 422, incomplete pairing +GAMEL( 200?, sc4dndn ,sc4dnd, sc4, sc4dnd35, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL424, set 1)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_sc4dnd )// DONL 424 +GAMEL( 200?, sc4dndo ,sc4dnd, sc4, sc4dnd35, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL424, set 2)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_sc4dnd )// DONL 424 +GAMEL( 200?, sc4dndk ,sc4dnd, sc4, sc4dnd35, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL428, set 1)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_sc4dnd )// DONL 428 +GAMEL( 200?, sc4dndm ,sc4dnd, sc4, sc4dnd35, sc4_state, sc4dnd, ROT0, "BFM","Deal Or No Deal (Bellfruit) (Scorpion 4) (DONL428, set 2)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_sc4dnd )// DONL 428 static const stepper_interface* sc4dndcs_reel_configs[6] = { diff --git a/src/mame/drivers/bfm_sc45_helper.c b/src/mame/drivers/bfm_sc45_helper.c new file mode 100644 index 00000000000..41ce6fb4f4e --- /dev/null +++ b/src/mame/drivers/bfm_sc45_helper.c @@ -0,0 +1,645 @@ +/* helper functions for BFM SC4/5 set identification and layout file creation + - these are not strictly required by the emulation + + */ + +#include "emu.h" + +//#define sc45helperlog printf +#define sc45helperlog logerror + +// addrxor used for endianness stuff, mode used for when we have a missing pair half +int find_project_string(running_machine &machine, int addrxor, int mode) +{ + // search for the title + const int strlength = 14; + char title_string[] = "PROJECT NUMBER"; + UINT8 *src = machine.root_device().memregion( "maincpu" )->base(); + int size = machine.root_device().memregion( "maincpu" )->bytes(); + + int search_start = 0; + int search_step = 1; + + if (mode==1) + { + search_start = 0; + search_step = 2; + } + + if (mode==2) + { + search_start = 1; + search_step = 2; + } + + for (int i=0;i=0x20) && (rom<0x7f)) + { + sc45helperlog("%c", rom); + blankcount = 0; + } + else + { + blankcount++; + if (blankcount<10) sc45helperlog(" "); + } + } + + count++; + + if (count>=0x100) + end = 1; + } + sc45helperlog("\n"); + + return 1; + } + } + + return 0; +} + +// find where the button definitions are in the ROM to make creating input ports easier for games using common test mode code +// not ALL games have a comprehensive list, but enough do to make this a worthwile debugging aid. +bool compare_input_code(running_machine &machine, int addr) +{ + UINT16 *src = (UINT16*)machine.root_device().memregion( "maincpu" )->base(); + UINT16* rom = &src[addr]; + + + if ((rom[0] != 0x48e7) || (rom[1] != 0x3020) || (rom[2] != 0x322f) || (rom[3] != 0x0010) || (rom[4] != 0x227c)) + return false; + + if ((rom[7] != 0x4242) || (rom[8] != 0x2449) || (rom[9] != 0x3639)) + return false; + + return true; +} + +int find_input_strings(running_machine &machine) +{ + int foundat = -1; + UINT32 startblock = 0; + UINT32 endblock = 0; + + UINT16 *rom = (UINT16*)machine.root_device().memregion( "maincpu" )->base(); + UINT8 *rom8 = machine.root_device().memregion( "maincpu" )->base(); + + for (int i=0;i<(0x100000-0x40)/2;i++) + { + bool found = compare_input_code(machine, i); + + if (found==true) + { + + startblock = (rom[i + 5] << 16) | rom[i + 6]; + endblock = (rom[i + 10] << 16) | rom[i + 11]; + sc45helperlog("------------ INPUTS -----------------\n"); + sc45helperlog("input strings found at %08x (start of ponter block %08x end of pointer block %08x\n", i*2, startblock, endblock); + foundat = i; + + if (endblock > startblock) + { + for (int j = startblock / 2; j < endblock / 2; j+=4) + { + UINT16 portpos = rom[j + 0]; + int port = (portpos & 0x1f); + int pos = (portpos >> 5); + UINT16 unk2 = rom[j + 1]; + UINT32 stringaddr = (rom[j + 2] << 16) | rom[j + 3]; + + sc45helperlog("(port %02x position %02x) unk %04x addr %08x ", port,pos, unk2, stringaddr); + astring tempstring; + + for (int k = stringaddr; k < stringaddr + 6; k++) + { + UINT8 chr = rom8[k^1]; + + if ((chr == 0xff) || (chr == 0x00)) + { + k = stringaddr + 6; + } + else + { + tempstring.cat(chr); + } + + } + + sc45helperlog("%s", tempstring.cstr()); + + sc45helperlog("\n"); + + } + } + + } + } + + return foundat; +} + +struct lampinfo +{ + astring lampname; + bool used; + int x, y; + int width, height; + bool draw_label; + astring lamptypename; + int clickport; + int clickmask; +}; + +lampinfo lamps[16][16]; + +void set_clickable_temp(running_machine &machine, astring teststring, int clickport, int clickmask) +{ + for (int y = 0; y < 16; y++) + { + for (int x = 0; x < 16; x++) + { + if (!strcmp(teststring.cstr(), lamps[y][x].lampname.cstr())) + { + lamps[y][x].clickport = clickport; + lamps[y][x].clickmask = clickmask; + + lamps[y][x].lamptypename = "buttonlamp"; + } + + } + } +} + +int find_lamp_strings(running_machine &machine) +{ + if (strcmp(machine.system().name, "sc4dnd")) + return 0; + + + + for (int y = 0; y < 16; y++) + { + for (int x = 0; x < 16; x++) + { + char tmp[32]; + + sprintf(tmp, "(%02d:%02d)", y, x); + + lamps[y][x].lampname = astring(tmp); + lamps[y][x].used = false; + lamps[y][x].y = (y * 28); + lamps[y][x].x = 380 + (x * 24); + lamps[y][x].draw_label = true; + lamps[y][x].width = 23; + lamps[y][x].height = 16; + lamps[y][x].lamptypename = "unusedlamp"; + lamps[y][x].clickport = -1; + lamps[y][x].clickmask = 0; + + } + } + + + + + + // these are for sc4dnd ONLY, need to work out how the code calculates them + int startblock = 0x1cac0; + int endblock = 0x1cf9a; + + + UINT16 *rom = (UINT16*)machine.root_device().memregion( "maincpu" )->base(); + UINT8 *rom8 = machine.root_device().memregion( "maincpu" )->base(); + +// sc45helperlog("------------ LAMPS -----------------\n"); + + if (endblock > startblock) + { + for (int j = startblock / 2; j < endblock / 2; j+=3) + { + UINT16 portpos = rom[j + 0]; + int row = portpos & 0xf; + int col = (portpos >> 4 ) & 0xf; + + UINT32 stringaddr = (rom[j + 1] << 16) | rom[j + 2]; + + //sc45helperlog("(row %02d, col %02d, unused %02x) addr %08x ", row,col, (portpos&0xff00)>>8, stringaddr); + + astring tempstring; + + for (int k = stringaddr; k < stringaddr + 10; k++) + { + UINT8 chr = rom8[k^1]; + + if ((chr == 0xff) || (chr == 0x00)) + { + k = stringaddr + 10; + } + else + { + tempstring.cat(chr); + } + + } + + if (lamps[row][col].used == false) + { + lamps[row][col].used = true; + lamps[row][col].lampname = tempstring; + lamps[row][col].lamptypename = "matrixlamp"; + + lamps[row][col].lampname.trimspace(); + lamps[row][col].lampname.makelower(); + } + else + { + fatalerror("duplicate lamp?\n"); + } + + //sc45helperlog("%s", tempstring.cstr()); + + //sc45helperlog("\n"); + + } + } + + // layout elements for each of the text labels + int d = 0; + for (int y = 0; y < 16; y++) + { + //sc45helperlog("---ROW %02d---\n", y); + for (int x = 0; x < 16; x++) + { + sc45helperlog("\n", d, lamps[y][x].lampname.cstr()); + d++; + } + } + + // some stuff needed by the matrix layout + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n"); + sc45helperlog("\n\n"); + + + sc45helperlog("\n"); + + // try to find some specific named elements and move them around + d = 0; + + for (int reel = 0; reel < 8; reel++) + { + char tempname[32]; + sprintf(tempname, "reel%d ", reel+1); + + + for (int pos = 0; pos < 3; pos++) + { + char tempname2[32]; + + if (pos == 0) sprintf(tempname2, "%stop", tempname); + if (pos == 1) sprintf(tempname2, "%smid", tempname); + if (pos == 2) sprintf(tempname2, "%sbot", tempname); + + + for (int y = 0; y < 16; y++) + { + for (int x = 0; x < 16; x++) + { + + if (!strcmp(tempname2, lamps[y][x].lampname.cstr())) + { + //sc45helperlog("%s found\n", tempname2); + lamps[y][x].draw_label = false; + + lamps[y][x].x = 0 + (50 * reel); + lamps[y][x].y = 300 + (17 * pos); + lamps[y][x].width = 50; + lamps[y][x].height = 17; + lamps[y][x].lamptypename = "reellamp"; + + + } + else + { + //printf("%s:%s:\n", tempname2, lamps[y][x].lampname.cstr()); + } + + } + } + } + } + + // todo, find these by cross-referencing button names and lamp names instead + { + set_clickable_temp(machine, "cancel", 1, 0x01); + set_clickable_temp(machine, "hold1", 1, 0x02); + set_clickable_temp(machine, "hold2", 1, 0x04); + set_clickable_temp(machine, "hold3", 1, 0x08); + set_clickable_temp(machine, "hold4", 1, 0x10); + + set_clickable_temp(machine, "chnge stk", 2, 0x01); + set_clickable_temp(machine, "collect", 2, 0x02); + set_clickable_temp(machine, "transfer", 2, 0x04); + + set_clickable_temp(machine, "strt exch", 2, 0x10); + + set_clickable_temp(machine, "nodeal", 8, 0x01); + set_clickable_temp(machine, "deal", 8, 0x02); + set_clickable_temp(machine, "cash bust", 8, 0x04); + + // no 'refill' lamp? + + + } + + + // dump out basic matrix stuff in layout format + d = 0; + for (int y = 0; y < 16; y++) + { + //sc45helperlog("---ROW %02d---\n", y); + for (int x = 0; x < 16; x++) + { + if (lamps[y][x].clickport== -1) sc45helperlog("\n", d, lamps[y][x].lamptypename.cstr(), lamps[y][x].x, lamps[y][x].y, lamps[y][x].width, lamps[y][x].height); + else sc45helperlog("\n", d, lamps[y][x].lamptypename.cstr(), lamps[y][x].clickport, lamps[y][x].clickmask, lamps[y][x].x, lamps[y][x].y, lamps[y][x].width, lamps[y][x].height); + + if (lamps[y][x].draw_label == false) sc45helperlog("\n"); + + d++; + } + } + + sc45helperlog("\n"); + + // other layout debug stuff + d = 0; + int extrax = 0; + for (int x = 0; x < 32; x++) + { + if (x % 5 == 0) extrax += 4; + + for (int y = 0; y < 8; y++) + { + sc45helperlog("\n", d, (x*4)+extrax, 40+y*4); + d++; + } + } + + sc45helperlog("\n"); + + d = 0; + for (int x = 0; x < 16; x++) + { + for (int y = 0; y < 2; y++) + { + sc45helperlog("\n", d, (15*10)- (x * 10), 80+(y * 20)); + d++; + } + } + + sc45helperlog("\n"); + + d = 0; + for (int x = 0; x < 16; x++) + { + int y = 10; + + sc45helperlog("\n", d, 0 + (x * 10), y); + d++; + } + + { + // write reel stuff to layouts + // sc4dnd specific.. + int num_normal_reels = 4; + int num_special_reels = 2; + int current_reel = 0; + + for (int i = 0; i < num_normal_reels + num_special_reels; i++) + { + int x = i * 50; + int y = 300; + sc45helperlog("\n", current_reel+1, x+40, y+50); + sc45helperlog("\n", current_reel+1, current_reel+1, x, y); + + current_reel++; + + } + + + } + + + + sc45helperlog("\n"); + sc45helperlog("\n"); + + + return 0; +} + + +int find_reel_strings(running_machine &machine) +{ + if (strcmp(machine.system().name, "sc4dnd")) + return 0; + + // these are for sc4dnd ONLY, need to work out how the code calculates them + + // this list is 4 * 16 symbols for the regular reels, 12 symbols for the number spin, and 2 groups of 16 depending on jackpot/stake keys used for the prize reel + // code that points at these is likely to be complex because it's conditional on the game code / mode.. + int reelsizes[] = { 16, 16, 16, 16, 12, 16, 16 }; + int total_reel_symbols = 0; + + for (int i = 0; i < 7; i++) + { + total_reel_symbols += reelsizes[i]; + } + + int startblock = 0x8d74c; + int endblock = startblock + 4 * (total_reel_symbols); + + + UINT16 *rom = (UINT16*)machine.root_device().memregion( "maincpu" )->base(); + UINT8 *rom8 = machine.root_device().memregion( "maincpu" )->base(); + + + + sc45helperlog("------------ LAYOUT -----------------\n"); + + sc45helperlog("\n"); + sc45helperlog("\n"); + + if (endblock > startblock) + { + int which_reel = 0; + int current_symbols = 0; + + + + for (int j = startblock / 2; j < endblock / 2; j+=2) + { + if (current_symbols == 0) + { + int shifted = ((0x10000 / 16) * 11 ) + 692; + // sc45helperlog("REEL %d\n", which_reel+1); + sc45helperlog("\n", which_reel+1); + sc45helperlog("\n"); + sc45helperlog("\n"); + + current_symbols = 0; + which_reel++; + } + else + { + sc45helperlog(","); + } + + + } + } + + return 0; +} + + +void bfm_sc45_layout_helper(running_machine &machine) +{ + find_input_strings(machine); + find_reel_strings(machine); + find_lamp_strings(machine); +} diff --git a/src/mame/drivers/bfm_sc45_helper.h b/src/mame/drivers/bfm_sc45_helper.h new file mode 100644 index 00000000000..e4baa5ebd89 --- /dev/null +++ b/src/mame/drivers/bfm_sc45_helper.h @@ -0,0 +1,5 @@ +/* */ + +void bfm_sc45_layout_helper(running_machine &machine); +int find_project_string(running_machine &machine, int addrxor, int mode); + diff --git a/src/mame/drivers/bfm_sc5.c b/src/mame/drivers/bfm_sc5.c index fd1183b46fe..79d55b167de 100644 --- a/src/mame/drivers/bfm_sc5.c +++ b/src/mame/drivers/bfm_sc5.c @@ -17,6 +17,7 @@ #include "machine/mcf5206e.h" #include "bfm_sc5.lh" #include "video/awpvid.h" +#include "bfm_sc45_helper.h" diff --git a/src/mame/layout/sc4dnd.lay b/src/mame/layout/sc4dnd.lay new file mode 100644 index 00000000000..cdce4d2d9ff --- /dev/null +++ b/src/mame/layout/sc4dnd.lay @@ -0,0 +1,1168 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/mame/mame.mak b/src/mame/mame.mak index 7814c2f10cb..3b1979b7838 100644 --- a/src/mame/mame.mak +++ b/src/mame/mame.mak @@ -932,6 +932,7 @@ $(MAMEOBJ)/bfm.a: \ $(DRIVERS)/bfm_sc5sw.o \ $(DRIVERS)/bfm_ad5.o \ $(DRIVERS)/bfm_ad5sw.o \ + $(DRIVERS)/bfm_sc45_helper.o \ $(DRIVERS)/bfm_swp.o \ $(DRIVERS)/bfmsys83.o \ $(DRIVERS)/bfmsys85.o \ @@ -2496,7 +2497,8 @@ $(DRIVERS)/bfm_sc2.o: $(LAYOUT)/sc2_vfd.lh \ $(LAYOUT)/sltblgtk.lh $(DRIVERS)/bfm_sc4.o: $(LAYOUT)/bfm_sc4.lh \ - $(LAYOUT)/sc4_dmd.lh + $(LAYOUT)/sc4_dmd.lh \ + $(LAYOUT)/sc4dnd.lh $(DRIVERS)/bfm_sc4h.o: $(LAYOUT)/bfm_sc4.lh \ $(LAYOUT)/sc4_dmd.lh