News: 11 March 2016 - Forum Rules

Author Topic: Hack Ninja Gaiden Arcade (original 1988) for MAME  (Read 1779 times)

fhrans

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Hack Ninja Gaiden Arcade (original 1988) for MAME
« on: November 23, 2021, 06:50:38 am »
Hello,
I wanted to learn how to hack the Ninja Gaiden Arcade game (the original from 1988) for MAME. My intention is to modify the graphics of the game.
Could someone help me to know what "specific" programs I need and how to do it?
I have the following doubts:
The tiles will be extracted but,
How do I interpret them? Since Ryu Hayabusa is not seen in its entirety. I understand that the graphics are divided.
How to disassemble the game (rom)? Would dz80 work? How does it work in that case?
How do I modify the tiles? Would Paint or Gimp serve?
How do I insert them once modified?
How do I reassemble the game? Would TASM work? How does it work in that case?
I have no knowledge of how to hack a rom.
Thanks.

Jorpho

  • Hero Member
  • *****
  • Posts: 5111
  • The cat screams with the voice of a man.
    • View Profile
Re: Hack Ninja Gaiden Arcade (original 1988) for MAME
« Reply #1 on: November 24, 2021, 09:45:51 pm »
I don't know why you're talking about disassembling and reassembling.  Assembling and disassembling is for code, not graphics.

The first second thing to try would be to try opening the various parts of the ROM in Tile Molester. You may be able to find the graphics somewhere, but you might have to try different graphic modes; Tile Molester supports a lot of them.

If you can't find the graphics anywhere, then they are probably compressed. Decompression is very difficult.

The first thing to try would be to Google around and see if anyone has already tried to do anything with this game before.
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

Anime_World

  • RHDN Supporter
  • Jr. Member
  • *****
  • Posts: 78
    • View Profile
Re: Hack Ninja Gaiden Arcade (original 1988) for MAME
« Reply #2 on: November 25, 2021, 03:10:58 am »
Start here, learning Motorola 68000 assembly:
https://mrjester.hapisan.com/04_MC68/

The original Ninja Gaiden is programmed and run under a Motorola 68000 CPU. Take a look at PCB Layout:
Code: [Select]
-----------------------------------------------
|         MN50005XTA         4MHz  DSW2 DSW1  |
|                    6264 6264       8049     |
|           IOP8     1.3S 2.4S                |
|24MHz                                        |
|                                             |
|18.432MHz                                   J|
|                                             |
|              68000P10                      A|
|                                             |
|          6116                              M|
|          6116                               |
|          6116                              M|
|                                             |
|                                            A|
|                                             |
|              6264    YM2203  YM3014         |
|       Z80    3.4B                           |
| 4MHz  6295   4.4A    YM2203  YM3014         |
-----------------------------------------------

A second cpu can be found, it's a Zilog Z80.
Some coroutines and audio drivers are written in Z80 assembly.
So, you need to learn Z80 too.
https://www.msx.org/wiki/Z80_Assembler_for_Dummies

After known some basics, you can start a disassembly using IDA.
Here is some steps:
 1 - Locate tiledata and split it in single files. If tiledata is compressed, you 'll need to write a decompressor/recompressor recreating it using original decompressor routine in asm as base.
 2 - Locate text data, label and comment them
 3 - Locate and label all variables and constants inside RAM
 4 - Label all main routines
 5 - Label all coroutines

Golden Tip:
Mame Debugger can help you in disassembly processs.
https://www.youtube.com/watch?v=CGNXFNogYpA&list=PL4X0K6ZbXhINtESNGa9q7qGuFE83VLZyd&index=1

Good Work :thumbsup:


« Last Edit: November 25, 2021, 03:53:06 am by Anime_World »

fhrans

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: Hack Ninja Gaiden Arcade (original 1988) for MAME
« Reply #3 on: November 29, 2021, 04:09:51 pm »
I really appreciate the answers. It seems complex!
Ninja Gaiden was hacked a while ago. You can see the result in this video:
https://www.youtube.com/watch?v=vxuIKgEVmCY

Jorpho

  • Hero Member
  • *****
  • Posts: 5111
  • The cat screams with the voice of a man.
    • View Profile
Re: Hack Ninja Gaiden Arcade (original 1988) for MAME
« Reply #4 on: November 29, 2021, 07:59:32 pm »
Ninja Gaiden was hacked a while ago. You can see the result in this video:
https://www.youtube.com/watch?v=vxuIKgEVmCY
That seems to be a professional job.

It is entirely possible that the code in that version was substantially re-written and that you may have an easier time finding the graphics there (i.e. using Tile Molester) than in the original.
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

fhrans

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: Hack Ninja Gaiden Arcade (original 1988) for MAME
« Reply #5 on: November 30, 2021, 05:16:57 pm »
I have unzipped gaiden.zip and opened the .bin files but cannot decrypt any graphics with Tile Molester. I have tried different codecs but there is no way to visualize anything.

Jorpho

  • Hero Member
  • *****
  • Posts: 5111
  • The cat screams with the voice of a man.
    • View Profile
Re: Hack Ninja Gaiden Arcade (original 1988) for MAME
« Reply #6 on: November 30, 2021, 09:19:58 pm »
Like I said, the next step is to try doing the same thing with Dragon Bowl (which you linked to).

If you can't find anything in there, then it's going to be pretty hopeless.
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

fhrans

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: Hack Ninja Gaiden Arcade (original 1988) for MAME
« Reply #7 on: December 01, 2021, 06:32:32 am »
Yes, excuse me, I also tried Dragon Bowl. I think it is more a problem of my lack of ability to use the program, since it is difficult to locate the sprites. I saw a tutorial in which I mentioned changing the codecs, changing 2-Dimensional Mode and activating the Full Canvas box but I can't see anything.
Do you know which codecs I should use for Ninja Gaiden or Dragon Bowl?
Could someone proficient in Tile Molester take a test?

Jorpho

  • Hero Member
  • *****
  • Posts: 5111
  • The cat screams with the voice of a man.
    • View Profile
Re: Hack Ninja Gaiden Arcade (original 1988) for MAME
« Reply #8 on: December 01, 2021, 11:46:50 am »
If you're not sure whether you're using Tile Molester correctly, why not try it with something known to actually work with Tile Molester, like a console ROM?

You can also try looking at the source code of the MAME driver to narrow down where the graphics are stored.
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

Anime_World

  • RHDN Supporter
  • Jr. Member
  • *****
  • Posts: 78
    • View Profile
Re: Hack Ninja Gaiden Arcade (original 1988) for MAME
« Reply #9 on: December 01, 2021, 02:22:36 pm »
Yes, excuse me, I also tried Dragon Bowl. I think it is more a problem of my lack of ability to use the program, since it is difficult to locate the sprites. I saw a tutorial in which I mentioned changing the codecs, changing 2-Dimensional Mode and activating the Full Canvas box but I can't see anything.
Do you know which codecs I should use for Ninja Gaiden or Dragon Bowl?
Could someone proficient in Tile Molester take a test?



2BPP Linear, set blocks to 2x2

fhrans

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: Hack Ninja Gaiden Arcade (original 1988) for MAME
« Reply #10 on: December 02, 2021, 06:30:20 am »
I appreciate the help you are offering me. I'm really looking forward to this project. Since I was little I have admired this video game.
As I said, I have managed to visualize the sprite.
Is there a way to see the whole sprite set? For example, the sequence of when he walks, but all the sprites in a row. I have seen some tutorial of Tile Molester and in roms of other consoles they manage to visualize everything together.
On the other hand, as I mentioned, I have also seen how, from the option Palette> Import From> This File, the Offset and Size options make the color palette look good.
I have downloaded the gaiden.cpp file, which I am attaching:
https://drive.google.com/file/d/1eBF8w5nDjWeoLhrXhiYqP7dVQw5yLLLj/view?usp=sharing
In this file you can see a lot of information about the game. For instance:
PALETTE (config, m_palette) .set_format (palette_device :: xBGR_444, 4096);
I do not know if that information can be useful to get a good view of the color palette.

Some time ago, with the help of a fellow OpenBOR forum, I started a Ninja Gaiden project. You could select the enemy of the hockey mask, choose the color of Ryu Hayabusa, and a few more modifications.
Although it is very incomplete, it can be downloaded at this link:
https://drive.google.com/file/d/1Q3EOd1AxyQqgTxmwudQ9kVY6jauEq2rX/view?usp=sharing
« Last Edit: December 04, 2021, 07:22:01 am by fhrans »