Previous 199869 Revisions Next

r21445 Tuesday 26th February, 2013 at 09:58:36 UTC by Fabio Priuli
(MESS) gb.c: attempt in emulating protection for Chong Wu Xiao Jing Ling/Pokemon Pikecho. [Fabio Priuli]
[hash]gbcolor.xml
[src/mess/drivers]gb.c
[src/mess/machine]gb_mbc.c gb_mbc.h gb_slot.c gb_slot.h

trunk/src/mess/machine/gb_mbc.c
r21444r21445
2525const device_type GB_ROM_MBC7 = &device_creator<gb_rom_mbc7_device>;
2626const device_type GB_ROM_MMM01 = &device_creator<gb_rom_mmm01_device>;
2727const device_type GB_ROM_SINTAX = &device_creator<gb_rom_sintax_device>;
28const device_type GB_ROM_CHONGWU = &device_creator<gb_rom_chongwu_device>;
2829
2930
3031gb_rom_mbc_device::gb_rom_mbc_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock)
r21444r21445
5354{
5455}
5556
57gb_rom_mbc5_device::gb_rom_mbc5_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock)
58               : gb_rom_mbc_device(mconfig, type, name, tag, owner, clock)
59{
60}
61
5662gb_rom_mbc5_device::gb_rom_mbc5_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
5763               : gb_rom_mbc_device(mconfig, GB_ROM_MBC5, "GB MBC5 Carts", tag, owner, clock)
5864{
r21444r21445
7884{
7985}
8086
87gb_rom_chongwu_device::gb_rom_chongwu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
88               : gb_rom_mbc5_device(mconfig, GB_ROM_CHONGWU, "GB Chong Wu Xiao Jing Ling", tag, owner, clock)
89{
90}
8191
92
8293void gb_rom_mbc_device::device_start()
8394{
8495   has_timer = FALSE;
r21444r21445
275286   save_item(NAME(m_xor5));
276287}
277288
289void gb_rom_chongwu_device::device_start()
290{
291   has_timer = FALSE;
292   has_rumble = FALSE;
293   
294   m_latch_bank = 0;
295   m_latch_bank2 = 1;
296   m_ram_bank = 0;
297   m_ram_enable = 0;
298   m_mode = 0;
299   m_protection_checked = 0;
300   save_item(NAME(m_latch_bank));
301   save_item(NAME(m_latch_bank2));
302   save_item(NAME(m_ram_bank));
303   save_item(NAME(m_ram_enable));
304   save_item(NAME(m_mode));
305   save_item(NAME(m_protection_checked));
306}
278307
308
279309/*-------------------------------------------------
280310 mapper specific handlers
281311 -------------------------------------------------*/
r21444r21445
727757   }
728758}
729759
760// MBC5 variant used by Chong Wu Xiao Jing Ling (this appears to be a re-release of a Li Cheng / Niutoude game,
761// given that it contains the Niutoude logo, with most protection checks patched out)
762
763READ8_MEMBER(gb_rom_chongwu_device::read_rom)
764{
765   // protection check at the first read here...
766   if (offset == 0x41c3 && !m_protection_checked)
767   {
768      m_protection_checked = 1;
769      return 0x5d;
770   }
771
772   if (offset < 0x4000)
773      return m_rom[rom_bank_map[m_latch_bank] * 0x4000 + (offset & 0x3fff)];
774   else
775      return m_rom[rom_bank_map[m_latch_bank2] * 0x4000 + (offset & 0x3fff)];
776}
777
730778// MBC5 variant used by Sintax games
731779
732780void gb_rom_sintax_device::set_xor_for_bank(UINT8 bank)
r21444r21445
809857         m_sintax_mode = data;
810858         write_bank(space, 0x2000, 1);   //force a fake bank switch
811859      }
812      printf("sintax mode %x\n", m_sintax_mode & 0xf);
860//      printf("sintax mode %x\n", m_sintax_mode & 0xf);
813861   }
814862   else if (offset >= 0x7000)
815863   {
r21444r21445
848896   if (m_ram && m_ram_enable)
849897      m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)] = data;
850898}
899
trunk/src/mess/machine/gb_mbc.h
r21444r21445
105105{
106106public:
107107   // construction/destruction
108   gb_rom_mbc5_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
108109   gb_rom_mbc5_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
109110
110111   // device-level overrides
r21444r21445
172173   UINT8 m_bank_mask, m_bank, m_reg;
173174};
174175
176// ======================> gb_rom_chongwu_device
177
178class gb_rom_chongwu_device : public gb_rom_mbc5_device
179{
180public:
181   // construction/destruction
182   gb_rom_chongwu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
183   
184   // device-level overrides
185   virtual void device_start();
186   virtual void device_config_complete() { m_shortname = "gb_rom_chongwu"; }
187   
188   virtual DECLARE_READ8_MEMBER(read_rom);
189   UINT8 m_protection_checked;
190};
191
175192// ======================> gb_rom_sintax_device
176193class gb_rom_sintax_device : public gb_rom_mbc_device
177194{
r21444r21445
207224extern const device_type GB_ROM_MBC7;
208225extern const device_type GB_ROM_MMM01;
209226extern const device_type GB_ROM_SINTAX;
227extern const device_type GB_ROM_CHONGWU;
210228
211229#endif
trunk/src/mess/machine/gb_slot.c
r21444r21445
215215   { GB_MBC_LASAMA, "rom_lasama" },
216216   { GB_MBC_ATVRACIN, "rom_atvrac" },
217217   { GB_MBC_SINTAX, "rom_sintax" },
218   { GB_MBC_CHONGWU, "rom_chong" },
218219   { GB_MBC_CAMERA, "rom_camera" }
219220};
220221
trunk/src/mess/machine/gb_slot.h
r21444r21445
2828   GB_MBC_ATVRACIN,
2929   GB_MBC_CAMERA,
3030   GB_MBC_SINTAX,
31   GB_MBC_CHONGWU,
3132   GB_MBC_MEGADUCK,     /* MEGADUCK style banking                        */
3233   GB_MBC_UNKNOWN       /* Unknown mapper                                */
3334};
trunk/src/mess/drivers/gb.c
r21444r21445
646646   SLOT_INTERFACE_INTERNAL("rom_atvrac",  GB_ROM_ATVRAC)
647647   SLOT_INTERFACE_INTERNAL("rom_camera",  GB_STD_ROM)
648648   SLOT_INTERFACE_INTERNAL("rom_sintax",  GB_ROM_SINTAX)
649   SLOT_INTERFACE_INTERNAL("rom_chong",  GB_ROM_CHONGWU)
649650SLOT_INTERFACE_END
650651
651652static SLOT_INTERFACE_START(megaduck_cart)
trunk/hash/gbcolor.xml
r21444r21445
2336123361   </software>
2336223362
2336323363<!-- 1byte difference between this and the hacked version... check what is about! -->
23364   <software name="chongwu" supported="no">
23364   <software name="chongwu">
23365    <!-- at 0x1e0 starts a routine which (at 0x1ec) reads from $41c3, then compares
23366         the value with 0x5d. if comparison fails, the code enters a routine at 0x780
23367         where it gets stuck. if comparison works, then the code goes to 0x150 as the
23368         patched version does (because the single modified byte replaces the jump to
23369         0x1e0 with the jump to 0x150). Not sure yet if current workaround is correct... -->
2336523370      <description>Chong Wu Xiao Jing Ling - Jie Jin Ta Zhi Wang (Chi)</description>
2336623371      <year>20??</year>
2336723372      <publisher>&lt;unknown&gt;</publisher>
2336823373      <info name="alt_title" value="宠物小精灵 结金塔之王"/>
2336923374      <part name="cart" interface="gameboy_cart">
23370         <feature name="slot" value="rom_mbc5" />
23375         <feature name="slot" value="rom_chong" />
2337123376         <!-- cartridge ram -->
2337223377         <dataarea name="rom" size="1048576">
2337323378            <rom name="chong wu xiao jing ling - jie jin ta zhi wang (unlicensed, chinese) [raw dump].bin" size="1048576" crc="620e785d" sha1="74da832c2eeb27a4260fe6f42514539473f48b11" offset="000000" />
r21444r21445
2337723382      </part>
2337823383   </software>
2337923384
23380   <software name="chongwuh" cloneof="chongwu">
23381      <description>Chong Wu Xiao Jing Ling - Jie Jin Ta Zhi Wang (Chi, Hacked)</description>
23382      <year>20??</year>
23383      <publisher>&lt;unknown&gt;</publisher>
23384      <info name="alt_title" value="宠物小精灵 结金塔之王"/>
23385      <part name="cart" interface="gameboy_cart">
23386         <feature name="slot" value="rom_mbc5" />
23387         <!-- cartridge ram -->
23388         <dataarea name="rom" size="1048576">
23389            <rom name="chong wu xiao jing ling - jie jin ta zhi wang (unlicensed, chinese) [fixed].bin" size="1048576" crc="24ee5c85" sha1="9fc1a8a1a75fd535980aee8966f4d5f8609e5ef5" offset="000000" />
23390         </dataarea>
23391         <dataarea name="nvram" size="32768">
23392         </dataarea>
23393      </part>
23394   </software>
23395
2339623385   <software name="jyqxc2">
2339723386      <description>Jin Yong Qun Xia Chuan II (Chi)</description>
2339823387      <year>20??</year>

Previous 199869 Revisions Next


© 1997-2024 The MAME Team