summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2009-07-16 06:20:20 +0000
committer Aaron Giles <aaron@aarongiles.com>2009-07-16 06:20:20 +0000
commit4d1d8b7938d46efc8307a11c395cd47020de52df (patch)
treefb9f412e79ef2c1b6adbfa9fbeb037a393645ad7 /src
parent061280b057b048b6788f6b300c744900d0f574ef (diff)
From: David Haywood [neohaze@nildram.co.uk]
Sent: Friday, July 10, 2009 11:38 PM To: Aaron Giles; Angelo Salese Subject: Shogun Warriors 11/07/09 backup Fully inclusive patch In addition to previous listed updates -- decodes a block of data used by the Japanese version (fjbuster) for the character select screen. Basically block 0x40 is the same as mcu block/table 0x41, but using different encryption (inline encryption table + additional overlay table instead of each byte being bit shifted) Kaneko definitely wanted to be annoying with this, and all their multiple modes, the roms contain everything from unencrypted blocks, to simple bitshifts, 0x40 byte tables, right through to blocks which seem to have everything enabled. Will continue to work with dox to gather more data. Current progress -- decoded tables for several of the startup commands, made some observations, was unable to properly decode table 0x80, second byte scrambling is .. odd, so just using extract data right now. -- properly mapped inputs in Shogun Warriors Gets Shogun Warriors to the Titlescreen at least. Will look at further trojan work with Dox on Sunday. I'm not sure all the sprite roms are the right size, some non-protected sprite elements aren't appearing correctly, not sure yet tho.
Diffstat (limited to 'src')
-rw-r--r--src/mame/drivers/kaneko16.c167
-rw-r--r--src/mame/machine/kaneko16.c2
2 files changed, 151 insertions, 18 deletions
diff --git a/src/mame/drivers/kaneko16.c b/src/mame/drivers/kaneko16.c
index 79db28c4ddb..40017f3e57e 100644
--- a/src/mame/drivers/kaneko16.c
+++ b/src/mame/drivers/kaneko16.c
@@ -229,6 +229,17 @@ static MACHINE_RESET( shogwarr )
{
MACHINE_RESET_CALL(kaneko16);
+ kaneko16_sprite_xoffs = 0xa00;
+
+ kaneko16_sprite_yoffs = 0x200;
+
+
+ kaneko16_priority.sprite[0] = 2; // below all
+ kaneko16_priority.sprite[1] = 3; // above tile[0], below the others
+ kaneko16_priority.sprite[2] = 5; // above all
+ kaneko16_priority.sprite[3] = 7; // ""
+ kaneko16_priority.VIEW2_2_pri = 0;
+
calc3_mcu_init();
}
@@ -1496,8 +1507,8 @@ static INPUT_PORTS_START( shogwarr )
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
- PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
- PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) // ? tested
+ PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_START1 )
+ PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_START("P2") /* b80002.w */
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
@@ -1506,18 +1517,18 @@ static INPUT_PORTS_START( shogwarr )
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
- PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
- PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) // ? tested
+ PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_START2 )
+ PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_START("SYSTEM") /* b80004.w */
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2 )
- PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
- PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2)
- PORT_SERVICE_NO_TOGGLE( 0x1000, IP_ACTIVE_LOW )
- PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_TILT )
+ PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
+ PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
+ PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
+ PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SERVICE1 )
- PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) // ? tested
+ PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("UNK") /* ? - b80006.w */
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN )
@@ -1981,8 +1992,8 @@ static INTERRUPT_GEN( shogwarr_interrupt )
case 1: cpu_set_input_line(device, 3, HOLD_LINE); break;
// the code for this interupt is provided by the MCU..
- //case 0: cpu_set_input_line(device, 4, HOLD_LINE); break;
- case 0:
+ case 0: cpu_set_input_line(device, 4, HOLD_LINE); break;
+ /*case 0:
{
// hack, clear this ram address to get into test mode (interrupt would clear it)
if (kaneko16_mainram[0x2dfe/2]==0xff00)
@@ -1990,7 +2001,7 @@ static INTERRUPT_GEN( shogwarr_interrupt )
kaneko16_mainram[0x2dfe/2]=0x0000;
}
- }
+ }*/
}
}
@@ -2009,7 +2020,7 @@ static MACHINE_DRIVER_START( shogwarr )
MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
MDRV_SCREEN_SIZE(320, 240)
- MDRV_SCREEN_VISIBLE_AREA(0, 320-1, 0, 240-1)
+ MDRV_SCREEN_VISIBLE_AREA(40, 296-1, 0, 240-1)
MDRV_GFXDECODE(1x4bit_1x4bit)
MDRV_PALETTE_LENGTH(2048)
@@ -3190,7 +3201,7 @@ ROM_START( shogwarr )
ROM_REGION( 0x020000, "cpu1", 0 ) /* MCU Code */
ROM_LOAD( "fb040a.u33", 0x000000, 0x020000, CRC(4b62c4d9) SHA1(35c943dde70438a411714070e42a84366db5ef83) )
- ROM_REGION( 0x600000, "gfx1", 0 ) /* Sprites */
+ ROM_REGION( 0x1000000, "gfx1", 0 ) /* Sprites */ /* not sure these are all correct size */
ROM_LOAD( "fb020a.u1", 0x000000, 0x080000, CRC(da1b7373) SHA1(89510901848f1798fb76dd82d1cd9ac97c41521d) )
ROM_LOAD( "fb022a.u5", 0x080000, 0x080000, CRC(60aa1282) SHA1(4648816016e00df3256226ba5134f6e5bb429909) )
ROM_LOAD( "fb020b.u2", 0x100000, 0x100000, CRC(276b9d7b) SHA1(7a154f65b4737f2b6ac8effa3352711079f571dc) )
@@ -3792,6 +3803,7 @@ int calc3_decompress_table(running_machine* machine, int tabnum, UINT8* dstram,
{
// shogwarr does this with 'mode' as 0x08, which probably has some special meaning
//printf("CALC3: requested 0 length table!\n");
+ // -- seems to be 'reset stack' to default for the protection table writes
}
if (inline_table_size)
@@ -3799,7 +3811,26 @@ int calc3_decompress_table(running_machine* machine, int tabnum, UINT8* dstram,
for (i=0;i<length;i++)
{
UINT8 dat = rom[offset+i];
- dat -= rom[inline_table_base + (i%inline_table_size)];
+ UINT8 inlinet = rom[inline_table_base + (i%inline_table_size)];
+ //printf("%02x, ",inlinet);
+ dat -= inlinet;
+
+ if (tabnum==0x40) // fjbuster / shogun warriors japanese character select (what enables this extra?)
+ {
+ // note the original, table is an odd number of words, so we can't just check if i is odd / even because the additional overlay
+ // is relative to the start of the original table, and has a size of 0x11 (17) bytes which loop.
+ if (((i%inline_table_size)&1)==0)
+ {
+ // thie gets mapped over half the inline table?!.. (inline length is 0x22, this changes odd bytes)
+ // what specifies the additional overlay here?
+ UINT8 extra[0x11] = { 0x14,0xf0,0xf8,0xd2,0xbe,0xfc,0xac,0x86,0x64,0x08,0x0c,0x74,0xd6,0x6a,0x24,0x12,0x1a };
+ dat -= extra[(i%inline_table_size)>>1];
+
+ }
+
+
+ }
+
dstram[(dstoffset+i)^1] = dat;
}
}
@@ -3816,8 +3847,110 @@ int calc3_decompress_table(running_machine* machine, int tabnum, UINT8* dstram,
for (i=0;i<length;i++)
{
+
+
UINT8 dat = rom[offset+i];
- dat -= table[i&0x3f];
+
+
+ if (tabnum==0x80) // shogwarr table 80 (irq code)
+ {
+
+ unsigned char extracted80[686+2] = {
+ 0x00, 0x00,
+ 0xE7, 0x48, 0xFE, 0xFF, 0x39, 0x4A, 0x10, 0x00, 0xFE, 0x2D, 0x00, 0x67,
+ 0x64, 0x02, 0x39, 0x4A, 0x10, 0x00, 0x26, 0x2E, 0x00, 0x66, 0x54, 0x02,
+ 0x3C, 0x10, 0x4D, 0x00, 0x39, 0x4A, 0x10, 0x00, 0x10, 0x2E, 0x04, 0x67,
+ 0xC0, 0x08, 0x07, 0x00, 0xC0, 0x13, 0x90, 0x00, 0x00, 0x00, 0xF9, 0x43,
+ 0x58, 0x00, 0x00, 0x00, 0xF9, 0x41, 0x10, 0x00, 0x00, 0x18, 0xD8, 0x22,
+ 0xD8, 0x22, 0xD8, 0x22, 0xD8, 0x22, 0xD8, 0x22, 0xD8, 0x22, 0xD8, 0x22,
+ 0xD8, 0x22, 0xD8, 0x22, 0xD8, 0x22, 0xD8, 0x22, 0xD8, 0x22, 0xD8, 0x22,
+ 0xD8, 0x22, 0xD8, 0x22, 0xD8, 0x22, 0xD8, 0x22, 0xD8, 0x22, 0xD8, 0x22,
+ 0xD8, 0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0x00, 0x66, 0x64, 0x00, 0xF9, 0x45, 0x10, 0x00, 0x40, 0x32, 0xF9, 0x41,
+ 0x80, 0x00, 0x00, 0x00, 0xDA, 0x30, 0xDA, 0x30, 0xDA, 0x30, 0xDA, 0x30,
+ 0xF9, 0x41, 0x90, 0x00, 0x14, 0x00, 0x39, 0x30, 0x10, 0x00, 0x38, 0x32,
+ 0x40, 0x02, 0xC0, 0xFF, 0x40, 0x44, 0xC0, 0x30, 0x39, 0x30, 0x10, 0x00,
+ 0x3A, 0x32, 0x40, 0x02, 0xC0, 0xFF, 0x40, 0x44, 0x79, 0xD0, 0x10, 0x00,
+ 0x1E, 0x2E, 0xC0, 0x30, 0x39, 0x30, 0x10, 0x00, 0x3C, 0x32, 0x40, 0x02,
+ 0xC0, 0xFF, 0x40, 0x44, 0xC0, 0x30, 0x39, 0x30, 0x10, 0x00, 0x3E, 0x32,
+ 0x40, 0x02, 0xC0, 0xFF, 0x40, 0x44, 0x79, 0xD0, 0x10, 0x00, 0x1E, 0x2E,
+ 0xC0, 0x30, 0x00, 0x60, 0x9A, 0x00, 0xF9, 0x41, 0x80, 0x00, 0x00, 0x00,
+ 0x39, 0x30, 0x10, 0x00, 0x40, 0x32, 0x40, 0x31, 0x02, 0x00, 0x40, 0x31,
+ 0x06, 0x00, 0xF9, 0x41, 0x90, 0x00, 0x1C, 0x00, 0x39, 0x30, 0x10, 0x00,
+ 0x34, 0x32, 0x48, 0xED, 0x40, 0x44, 0xC0, 0x30, 0x39, 0x30, 0x10, 0x00,
+ 0x30, 0x32, 0x40, 0x06, 0x20, 0x00, 0x48, 0xED, 0x40, 0x44, 0x79, 0xD0,
+ 0x10, 0x00, 0x1E, 0x2E, 0xC0, 0x30, 0xF9, 0x41, 0x10, 0x00, 0x28, 0x2E,
+ 0xE8, 0x45, 0x00, 0x02, 0x79, 0x22, 0x10, 0x00, 0x22, 0x2E, 0xE9, 0x47,
+ 0x00, 0x10, 0x3C, 0x30, 0x07, 0x00, 0xD8, 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E, 0x00, 0x00, 0x66, 0x06, 0x00,
+ 0xBC, 0x10, 0x04, 0x00, 0xE8, 0x41, 0x12, 0x00, 0xC8, 0x51, 0xE6, 0xFF,
+ 0xC0, 0x33, 0x2C, 0x00, 0x00, 0x00, 0x3C, 0x30, 0x14, 0x00, 0xC8, 0x51,
+ 0xFE, 0xFF, 0xC0, 0x33, 0x2D, 0x00, 0x00, 0x00, 0xDF, 0x4C, 0xFF, 0x7F,
+ 0x73, 0x4E
+ };
+
+ if ((i&1)==0)
+ {
+ dat -= table[i&0x3f];
+ dat = BITSWAP8(dat,2,1,0,7,6,5,4,3);
+ // we can decode this byte... but compare it to the extract table for verification
+ if (extracted80[i^1] != dat) printf("error %02x %02x %02x\n", i, extracted80[i^1],dat);
+ }
+ else
+ {
+ // I don't understand how to decode this byte :-(
+ dat = extracted80[i^1];
+
+
+
+
+
+ // dat = BITSWAP8(dat,4,3,2,1,0,7,6,5);
+ // dat -= table[i&0x3f];
+ }
+ }
+ else if (tabnum==0x41) // shogwarr table 41 -- note fjbuster uses table 40, which looks like (almost) the same data but with better encryption...
+ {
+ // simple shifts...
+ dat -= table[i&0x3f];
+
+ if ((i&1)==1) dat = BITSWAP8(dat,0,7,6,5,4,3,2,1);
+ else dat = BITSWAP8(dat,6,5,4,3,2,1,0,7);
+ }
+ else
+ {
+ dat -= table[i&0x3f];
+ }
+
+
dstram[(dstoffset+i)^1] = dat;
}
}
@@ -3946,4 +4079,4 @@ GAME( 1992, shogwarr, 0, shogwarr, shogwarr, calc3, ROT0, "Kaneko", "S
GAME( 1992, shogware, shogwarr, shogwarr, shogwarr, calc3, ROT0, "Kaneko", "Shogun Warriors (Euro)", GAME_NOT_WORKING )
GAME( 1992, fjbuster, shogwarr, shogwarr, shogwarr, calc3, ROT0, "Kaneko", "Fujiyama Buster (Japan)", GAME_NOT_WORKING )
GAME( 1992, brapboys, 0, shogwarr, shogwarr, calc3, ROT0, "Kaneko", "B.Rap Boys (World)", GAME_NOT_WORKING )
-GAME( 1992, brapboyj, brapboys, shogwarr, shogwarr, calc3, ROT0, "Kaneko", "B.Rap Boys (Japan)", GAME_NOT_WORKING )
+GAME( 1992, brapboyj, brapboys, shogwarr, shogwarr, calc3, ROT0, "Kaneko", "B.Rap Boys Special (Japan)", GAME_NOT_WORKING )
diff --git a/src/mame/machine/kaneko16.c b/src/mame/machine/kaneko16.c
index d9b584bff3d..de56999e79a 100644
--- a/src/mame/machine/kaneko16.c
+++ b/src/mame/machine/kaneko16.c
@@ -361,7 +361,7 @@ static void calc3_mcu_run(running_machine *machine)
// execute the command:
kaneko16_mcu_ram[param1 / 2] = ~input_port_read(machine, "DSW1"); // DSW
- kaneko16_mcu_ram[param2 / 2] = 0xffff; // ? -1 / anything else
+ kaneko16_mcu_ram[param2 / 2] = 0x0000;// 0xffff; // ? -1 / anything else (changes coinage..)
// param 4?
kaneko16_mcu_ram[param5 / 2] = calc3_mcu_crc; // MCU Rom Checksum!