Previous 199869 Revisions Next

r31784 Tuesday 26th August, 2014 at 15:58:54 UTC by David Haywood
added decryption for Gundam Wing: Endless Duel (SNES bootleg) [iq_132]

still doesn't work, probably needs correct boot vectors or some other protection?
[src/mame/drivers]snesb.c

trunk/src/mame/drivers/snesb.c
r31783r31784
844844
845845DRIVER_INIT_MEMBER(snesb_state,endless)
846846{
847   INT32 i;
848   UINT8 *rom = memregion("user3")->base();
847   int i;
848   UINT8 *src = memregion("user7")->base();
849   UINT8 *dst = memregion("user3")->base();
849850
850   /* there is more to this, 0x800 based block swaps? */
851   for (i = 0; i < 0x200000; i++)
852   {
853      rom[i] = rom[i]^0x55;
851   static const UINT8 address_tab_high[0x40] = {
852      0x3b, 0x1d, 0x35, 0x15, 0x39, 0x19, 0x34, 0x13, 0x32, 0x1f, 0x37, 0x17, 0x3d, 0x11, 0x3a, 0x1a,
853      0x14, 0x3e, 0x18, 0x36, 0x1e, 0x31, 0x10, 0x3c, 0x1b, 0x3f, 0x16, 0x30, 0x12, 0x38, 0x1c, 0x33,
854      0x2b, 0x0d, 0x25, 0x05, 0x29, 0x09, 0x24, 0x03, 0x22, 0x0f, 0x27, 0x07, 0x2d, 0x01, 0x2a, 0x0a,
855      0x04, 0x2e, 0x08, 0x26, 0x0e, 0x21, 0x00, 0x2c, 0x0b, 0x2f, 0x06, 0x20, 0x02, 0x28, 0x0c, 0x23
856   };
857
858   static const UINT8 address_tab_low[0x40] = {
859      0x14, 0x1d, 0x11, 0x3c, 0x0a, 0x29, 0x2d, 0x2e, 0x30, 0x32, 0x16, 0x36, 0x05, 0x25, 0x26, 0x37,
860      0x20, 0x21, 0x27, 0x28, 0x33, 0x34, 0x23, 0x12, 0x1e, 0x1f, 0x3b, 0x24, 0x2c, 0x35, 0x38, 0x39,
861      0x3d, 0x0c, 0x2a, 0x0d, 0x22, 0x18, 0x19, 0x1a, 0x03, 0x08, 0x04, 0x3a, 0x0b, 0x0f, 0x15, 0x17,
862      0x1b, 0x13, 0x00, 0x1c, 0x2b, 0x01, 0x06, 0x2f, 0x07, 0x09, 0x02, 0x31, 0x10, 0x0e, 0x3f, 0x3e
863   };
864
865   static const UINT8 data_high[16] = {
866      0x88, 0x38, 0x10, 0x98, 0x90, 0x00, 0x08, 0x18, 0x20, 0xb8, 0xa8, 0xa0, 0x30, 0x80, 0x28, 0xb0
867   };
868
869   static const UINT8 data_low[16] = {
870      0x41, 0x46, 0x02, 0x43, 0x03, 0x00, 0x40, 0x42, 0x04, 0x47, 0x45, 0x05, 0x06, 0x01, 0x44, 0x07
871   };
872
873   for (i = 0; i < 0x200000; i++) {
874      int j = (address_tab_high[i >> 15] << 15) + (i & 0x7fc0) + address_tab_low[i & 0x3f];
875
876      dst[i] = data_high[src[j]>>4] | data_low[src[j]&0xf];
877
878      if (i >= 0x00000 && i < 0x10000) {
879         dst[i] = BITSWAP8(dst[i],2,3,4,1,7,0,6,5);
880      }
881
882      if (i >= 0x10000 && i < 0x20000) {
883         dst[i] = BITSWAP8(dst[i],1,5,6,0,2,4,7,3) ^ 0xff;
884      }
885
886      if (i >= 0x20000 && i < 0x30000) {
887         dst[i] = BITSWAP8(dst[i],3,0,1,6,4,5,2,7);
888      }
889
890      if (i >= 0x30000 && i < 0x40000) {
891         dst[i] = BITSWAP8(dst[i],0,4,2,3,5,6,7,1) ^ 0xff;
892      }
854893   }
855894
856895   DRIVER_INIT_CALL(snes);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team