News:

11 March 2016 - Forum Rules

Main Menu

Landstalker sprites unpack [Genesis]

Started by Kage, June 28, 2016, 05:52:57 AM

Previous topic - Next topic

Kage


Hello to everybody.  I need help with unpacking sprites for Sega Genesis game "Landstalker: The Treasures of King Nole" directly from ROM file. Graphics in this game is packed, expept the tiles. I would be very grateful. I'm interested in NPC & enemies sprites.








Landale

Hi! :)

Check out my Facebook group. The largest archive of Landstalker
files, artwork and info on the internet. You find sprites under files...

www.facebook.com/groups/Landstalker




Kage

Thank you, just a wonderful group, but unfortunately you do not have complete sets of sprites. But anyway thank you very much for the link.  :thumbsup:

Landale

Quote from: Kage on June 28, 2016, 08:11:08 AM
unfortunately you do not have complete sets of sprites.
I will update the sprites after im done with my Landstaker webpage. Stay tuned! :)

tryphon

Why do you need to unpack them from the ROM ?

If you just want sprites, it's easier to rip them. If you want to make a hack, you'll probablyy need to repack your edited sprites. If they are compressed, it'll likely be quite difficult.

Kage

Quote from: tryphon on June 28, 2016, 08:57:28 AM
Why do you need to unpack them from the ROM ?

If you just want sprites, it's easier to rip them. If you want to make a hack, you'll probablyy need to repack your edited sprites. If they are compressed, it'll likely be quite difficult.
because of unused sprites. I want to create a fan game on another engine.

tryphon

Tcrf already lists some. What make you think there are more ?

Kage

Quote from: tryphon on June 28, 2016, 10:02:10 AM
Tcrf already lists some. What make you think there are more ?
Well, at least they are not in jpg format  :)

tryphon

You're right ! Isn't it stupid to upload a sprite sheet in jpeg  ::)

There's a "Landstalker Translation Tool" on this site, that decompresses some stuff. have you checked whether it decompress your sprites ?

Kage

Quote from: tryphon on June 28, 2016, 05:23:36 PM
You're right ! Isn't it stupid to upload a sprite sheet in jpeg  ::)

There's a "Landstalker Translation Tool" on this site, that decompresses some stuff. have you checked whether it decompress your sprites ?
Yeah, it can decompile packed graphic for menus and some other screens and fonts, but to get the sprites i need to know their offset in ROM  :-\

tryphon

#10
OK, I had a look at the game.

The sprites are "dynamic" : that means that only the current frame is loaded in VRAM (opposed to static sprites : all frames are loaded at the beginning of the scene). That supposes that it's quite fast to load them, since you have only a 1/60th of second to load the frame. Usually, that means that frames are not compressed in the ROM. So I'd suggest you look carefully into the ROM, using Tile Molester or anthing related with proper config (4bpp).

It can also means that they are first decompressed in RAM, then loaded from the RAM, so you can try to make a RAM dump and look into the dump file (there are things that could be gfx around pos FF2E00, for example). If you find gfx there, it'll be easy to find the part of the code that decompress gfx there.

A good thing to know : frames are usually made of several sprites (from what I've seen plaing the game with Gens, they are made of 2 32x32 sprites). A 32x32 sprites is made of 4x4 = 16 tiles, ordered from top to bottom then left to right (whereas map tiles are raster order : left to right then top to bottom), so they are not always easy to track. If you don't succeed, you can make a dump of the VRAM : the chars tiles are tiles from 3A0 to 4FF (multiply by 32 to have the VRAM offset), then do a search in the ROM for some bytes you picked in the VRAM (be careful : some emulators don't have the wrong endianness when they dump the VRAM).

For the record, what I did :

I read into the LTT that there were compressed gfx at position 0x3986C, 0x398A0 and 0x398D4, so I launched gens-r57shell mod and made a breakpoint for reads in the ROM at these pos.

I saw that these addresses were read by the program at offset 4AB6. By studying the stack I came to the conclusion that the decompression routine starts at 2F0. The source offset is in register a0

I made a breakpoint for execution at address 2F0 and noted all the values of the register a0. Here's the list up to the first game screen. Here are the pos : 3861E (SEGA logo, it's not the offset in the doc of LTT weirdly), 3DF3C, 3986C, 398A0, 398D4 (title screen), F654 and
F668. The last twoaren't listed in the LTT doc, so they are worth a try with their tool. But it's quite unlikely : I played some time after that (up to the appearance of Friday) and no other call was made, so it'd mean these address contains all of the NPC frames. But I didn't see large portions of gfx in RAM.

So my bet is that sprites are uncompressed.

edit : there is uncompressed NPC (old man) gfx in ROM at 17E600. Nigel is around 123850.

Kage

Quote from: tryphon on June 29, 2016, 04:13:01 AM
edit : there is uncompressed NPC (old man) gfx in ROM at 17E600. Nigel is around 123850.
Thanks for the explanation. I have another question: is it possible to get the required tile palette for NPC to view them in editor?

tryphon

You can do it in Tile Molester (don't know about others, I rarely use a tile editor program).

The first step is to get the palette data. Using Gens and Sprite Viewer, you can see that Nigel uses palette 2. Using Hex Editor on CRAM, you get the palette 2 data at offset 40 - 60. Then you make a search in the ROM and find that this palette data is stored at 0xFB32 (and maybe elsewhere but that's not the point here).

In Tile Molester, you go to palette, import from this file, enter the offset FB32, be sure to select Motorola Byte Order and Genesis format (9bit RGB) et voilà !

Kage

It's not working yet, I try to understand step by step.

Quote from: tryphon on June 29, 2016, 12:19:51 PM
2. Using Hex Editor on CRAM, you get the palette 2 data at offset 40 - 60. Then you make a search in the ROM and find that this palette data is stored at 0xFB32 (and maybe elsewhere but that's not the point here).

You mean I have to do a memory dump, and open it in a hex?


Quote from: tryphon on June 29, 2016, 12:19:51 PM
palette 2 data at offset 40 - 60. Then you make a search in the ROM and find that this palette data is stored at

I do not quite understand, how do I know what kind of binary data is a palette that I'm looking for. I tried to use offset from above as palette address and nothing happened.

I'm sorry, I'm an absolute novice in the rom hacking and would be very grateful for the detailed answer.  :-[

tryphon

More detailled answer.

0) You need another version of GENS (there are plenty of them). My favourite is r57shell mod you can find on this site (Utilities, on your left)

2) With GENS r57shell mod, use "Tools/Hex Editor", then select "Region/CRAM". You'll end with a tiny hex dump :



Each palette codes 16 colors, a color is coded by 2 bytes (format : 0000bbb0 ggg0rrr0 where bbb, ggg, rrr are the amount of blue, green, red respectively) , so bytes from offset 00 to 1F are palette 0 (red), from 20 to 3D are palette 1 (green), etc.

In the "Tools/VDP Sprites" you can highlight each sprite one after another until youu find Nigel, in my capture it's sprites 16 and 17 (but ithey are reordered each frame). You can see that it used palette 2.



So you select some bytes in the hex dumper from offset 40 and select "Edit/Copy Numbers" (for example, I just copied : 00000CCC082404AE0048002408880444)

Then you open your favourite hex editor (because GENS' one doesn't have a search), mine is HxD and you look for these values (you can insert spaces to make it clearer : 00 00 0C CC 08 24 04 AE 00 48 00 24 08 88 04 44). I found two places in ROM (0x901C, 0xFB32).

Kage



Now I understand, thank you. Palette may be imported from save file.  :thumbsup:

dejan07

Question for hackers!
Is it possible to remove the black bar on the bottom of the screen and extend the screen view?

tryphon

Everything's possible but it may be hard (maybe the plane size was meant to be this high, so it would require to hack many parts of the code).

Also, the programmers certainly had a good reason to do that, for example performances issues.

paul_met

Quote from: dejan07 on July 02, 2016, 05:38:47 AM
Is it possible to remove the black bar on the bottom of the screen and extend the screen view?

Would be this game for the Sega Saturn, I would be able to remove the black bars. Eh...
Meduza Team

dejan07

Quote from: tryphon on July 02, 2016, 08:22:12 AM
Also, the programmers certainly had a good reason to do that, for example performances issues.

They did it probably to highlight the text box but they could use a link to the past routine of text appearing over the graphics and not obscuring a screen.