News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Jackknife - Jackal Editor  (Read 4240 times)

Trax

  • Hero Member
  • *****
  • Posts: 512
    • View Profile
    • Trax ROM Hacking
Jackknife - Jackal Editor
« on: November 04, 2014, 06:57:56 pm »
Once again, I started working on another editor. This time, it's the game Jackal. It looked like a nice game to hack, and to make longer and possibly harder. The ROM structure has a lot in common with Contra, with which I'm very familiar. And not surprising since they are both games made by Konami, and at about the same time...

At 1C473, there's a nice pointer table, one pointer per level, plus other extras, like the intro, ending, etc. This table points to a series of pointers for graphics data. Each level has specific blocks of graphics loaded at different places in the PPU. Some of these blocks are used for all levels, so the data itself doesn't need to be repeated. The graphics data is compressed, just like Contra, using a simple combination of literal strings of bytes and RLE...

The levels are made of blocks, each of them made of 4x4 tiles (8x8 pixels). Each screen that compose the levels is 7.5 blocks high and 8 blocks wide. The 7.5 figure is because a single screen is 240 pixels, so 240 / 32 = 7.5. Therefore, the top row of blocks in each screen is truncated in half. At 1D000, there's a pointer table for codes that define the blocks for the 6 levels. There are 0x40 codes per screen. At 1D00C, another pointer table for the tile codes that make the blocks I just mentioned, 0x10 bytes per block. And at 1D018 (the 3 tables follow each other), a pointer table for palette mappings, 1 byte per block, 2 bits per 4x4 corner...

At 1D62C, there's the palette data for each 6 levels, one after another. It always start with 3F 00 (the starting PPU address for palettes), then 0x10 bytes for background, 0x10 bytes for sprites, and FF as the ending byte...

With that, we can at least successfully display all 6 levels. The editor can decompress the graphics correctly, according to the selected level, and use the block codes to lay out the screens that make up the levels. Below, screenshots of level 1 and 2...


Some graphics can show up garbled, though, because some graphics can change to make place to other tiles when the Boss screen approaches. Not all levels have that, but those that do will show weird tiles where the boss is, in the editor. I'll probably do something like in Red Falcon editor, and have a "Alternate Graphics" button, to toggle between the two states of the PPU. It's the case for level 3 (the big boat a the end), level 5 (the hangar doors and walls at the end) and level 6 (part of the last screen)...

Next thing to do: enemy data. I already got the pointer table, at 1F1E0. More to come about this editor...

Any questions?

snarfblam

  • Submission Reviewer
  • Hero Member
  • *****
  • Posts: 590
  • CANT HACK METROID
    • View Profile
    • snarfblam
Re: Jackknife - Jackal Editor
« Reply #1 on: November 05, 2014, 05:55:59 pm »
Once again, I started working on another editor.
You and I seem to have similar taste in games :D

Looks pretty good. Just curious, exactly what sort of compression do the graphics use?

Trax

  • Hero Member
  • *****
  • Posts: 512
    • View Profile
    • Trax ROM Hacking
Re: Jackknife - Jackal Editor
« Reply #2 on: November 06, 2014, 08:28:54 pm »
Quite simple. Each block of graphics data starts with the initial PPU offset, big-endian. Then, next byte, if bit 7 is set, it's a literal sequence, so the byte is ANDed with 7F, and this many bytes that follow are copied to the PPU. If bit 7 is clear, then it's a RLE, the byte is ANDed with 7F and the next byte is repeated this many times...

That's it. There's no value to signal a change in PPU address (Contra had this mechanism). The only thing I don't know about graphics is the parts of the PPU that are replaced in specific levels. I presume it's just a simple table of PPU starting addresses and another pointer table for the raw graphics data...

The only thing I hate in this game is the scrolling thresholds. I feel you are always chasing the border of the screen and don't see enough in front of the Jeep. If this annoyance could be corrected, it would be awesome. But scrolling mechanisms are always a pain in the ass and usually involve complex ASM...

mrrichard999

  • Hero Member
  • *****
  • Posts: 686
  • So Goooood! :D
    • View Profile
    • GameFAQS Profile
Re: Jackknife - Jackal Editor
« Reply #3 on: November 08, 2014, 08:36:16 pm »
Need a PC Version :(

This game takes me back and used to cause so much pain in my hands after playing through the whole thing back when it came out :) Hope somebody with an Apple makes some awesome levels to make a whole new game out of this!

Trax

  • Hero Member
  • *****
  • Posts: 512
    • View Profile
    • Trax ROM Hacking
Re: Jackknife - Jackal Editor
« Reply #4 on: November 11, 2014, 10:16:19 pm »
It could happen relatively soon. Enemy data is also very simple to decode, so the basics are covered. We still have to find out how to make the levels longer. Shouldn't be difficult. Here, another screenshot for the road, depicting level 3...

As usual, if anyone wants to port the editor for another platform, even if it's in a very early stage, I can assist you in doing so...

snarfblam

  • Submission Reviewer
  • Hero Member
  • *****
  • Posts: 590
  • CANT HACK METROID
    • View Profile
    • snarfblam
Re: Jackknife - Jackal Editor
« Reply #5 on: November 12, 2014, 05:54:25 pm »
Trax, if you have good documentation (for this or any other game), I'd happily bang out a Windows editor.

mrrichard999

  • Hero Member
  • *****
  • Posts: 686
  • So Goooood! :D
    • View Profile
    • GameFAQS Profile
Re: Jackknife - Jackal Editor
« Reply #6 on: November 14, 2014, 12:21:39 am »
Any chance of adding a graphics extractor to this tool? Seems they cant be edited with a simple tile editor :( Had a neat idea for a Jackal hack using Contra graphics and a back story to it :P Call it "Jackal C" :D

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 6918
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Jackknife - Jackal Editor
« Reply #7 on: November 14, 2014, 12:25:38 pm »
Quote
Quite simple. Each block of graphics data starts with the initial PPU offset, big-endian. Then, next byte, if bit 7 is set, it's a literal sequence, so the byte is ANDed with 7F, and this many bytes that follow are copied to the PPU. If bit 7 is clear, then it's a RLE, the byte is ANDed with 7F and the next byte is repeated this many times...

Sounds like Graveyard Duck. Is the end condition still when it reads an RLE code 0xFF?
"My watch says 30 chickens" Google, 2018

Trax

  • Hero Member
  • *****
  • Posts: 512
    • View Profile
    • Trax ROM Hacking
Re: Jackknife - Jackal Editor
« Reply #8 on: November 16, 2014, 06:37:14 pm »
Yes. A value of FF at the beginning of a sequence terminates the graphics block being processed. And as far as I know, there's no special byte for PPU displacement or other special operations, so you just need the different graphics blocks for each level...

The pointer table for graphics groups, for each level and other screens, is at 1C473. The tables pointed to have entries with 3 bytes: the first is the bank number (usually 2 or 3) and the 2 following bytes is the address, little-endian. For example, the first graphics group for level 1 has an entry like this: 02 08 80. Bank 2, address 8008. Go on until you hit FF and your PPU will be ready for whatever drawing you want to do...

mrrichard999

  • Hero Member
  • *****
  • Posts: 686
  • So Goooood! :D
    • View Profile
    • GameFAQS Profile
Re: Jackknife - Jackal Editor
« Reply #9 on: November 19, 2014, 01:00:19 pm »
Would there be a way to integrate the features of graveyard duck into this editor?

Trax

  • Hero Member
  • *****
  • Posts: 512
    • View Profile
    • Trax ROM Hacking
Re: Jackknife - Jackal Editor
« Reply #10 on: November 21, 2014, 11:44:34 pm »
I presume it wouldn't be too hard to integrate a very basic graphics editor into Jackknife. I can figure something like two display options. One lets you see the individual blocks of graphics, and the other lets you see all the blocks at the same time, so you can make sure there is no overlap. Of course, as soon as you start using more or less space than the original game, offsets management become inevitable. And since the graphics are compressed, differences in used space will happen...

Another caveat is that some blocks are shared between levels...