+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Oracle of ages
Pages: 1 2 3 [4] 5 6
Author Topic: Oracle of ages  (Read 4 times)
Dwedit
Guest
« Reply #45 on: March 25, 2009, 11:39:51 pm »

I already have all the map data figured out.

Dungeons use dictionary compression.  Uses a byte to indicate which next 8 are literals, and are from a dictionary.  Zero bits indicate literals.
For dictionary use, it takes 16 bits.
Top 4 bits = length (add 3), bottom 12 bits: Pointer inside the 4k dictionary.

Every 8 things read (literals or dictionary uses) make it read another byte to determine whether the next 8 are literals or dictionary entries.  Repeat until entire map is loaded (size B0)

The 00 or 01 byte (00 for dungeons, 01 for overworlds) is actually an entry in an immediate jump table.  All other values make the game crash or behave weird.
Tauwasser
Guest
« Reply #46 on: March 26, 2009, 06:55:53 am »

Sounds like the gba lz77 compression type. It might actually be well worth to write an app that can decode those on a general basis, like tell it the layout and what to add to length and there you go o.o
Gosh, we should really make comparison versions out of those lol

cYa,

Tauwasser
Dwedit
Guest
« Reply #47 on: March 26, 2009, 08:48:34 am »

LZ77 is about going BACKWARD in decompressed data to find back references
The dungeons use Dictionary Compression (LZ78), where you find references in the Dictionary, not in the decompression history.
The graphics can use LZ77 compression however.

The exact format of any bitstream of compressed data varies depending on implementation.  Unless you can find a game which reads one byte to tell you whether the next 8 bytes are literals or backreferences, it will only work with this game.
« Last Edit: March 26, 2009, 09:03:43 am by Dwedit »
Tauwasser
Guest
« Reply #48 on: March 26, 2009, 11:41:39 am »

Quote
Unless you can find a game which reads one byte to tell you whether the next 8 bytes are literals or backreferences, it will only work with this game.

There are lots of those out there Cheesy
Since GBA for example has native support, many games there feature the same kind. Some reverse the bit order, some the meaning (eg. 1 is uncompressed, 0 is backreference). However, the general approach is there Cheesy
Also, you didn't quite explain your dictionary method and it was proven that decompression history and external dictionary are equivalent, read wikipedia on it.

Quote from: English Wikipedia
LZ77 and LZ78 are the names for the two lossless data compression algorithms[...].

They are both dictionary coders, [...]. LZ77 is the "sliding window" compression algorithm, which was later shown to be equivalent to the explicit dictionary technique first given in LZ78.
(emphasis added).

cYa,

Tauwasser
Jigglysaint
Guest
« Reply #49 on: March 26, 2009, 01:55:01 pm »

Well if maps are all figured out, then I guess everything's good.  I've got other data, but I don't thing it's nessicary for a map viewer.
Dwedit
Guest
« Reply #50 on: March 26, 2009, 04:23:34 pm »

To nobody's surprise, map numbers in dungeons do not correspond to a Y*16+X rule.
Working on this now...  (file address F081 is the room number where you enter level 1)
Jigglysaint
Guest
« Reply #51 on: March 26, 2009, 04:33:50 pm »

Quote from: Dwedit on March 26, 2009, 04:23:34 pm
To nobody's surprise, map numbers in dungeons do not correspond to a Y*16+X rule.
Working on this now...  (file address F081 is the room number where you enter level 1)

What do you mean exactly?  You mean that the rooms arn't right next to each other like in the overworld?

4FCE is where the dungeon assembler data is located.
Dwedit
Guest
« Reply #52 on: March 26, 2009, 06:27:38 pm »

There are "floors", 64 byte (8x8) tables indicating what rooms are where for a dungeon.
Out of bounds areas usually load dungeon room #0, which is a white room with nothing inside that plays Maku Road music.

Floor data starts at 1:4FCE, there's a bunch of them.  Floor 0x18 is the floor for caves.

The game does a linear search to take you to the correct place when you enter a dungeon, (it teleports you inside the dungeon by room number, but it finds it and sends you to the correct coordinates)

There also appear to be up to 16 dungeons in the game.  (512 possible cave/dungeon rooms total as well)
Jigglysaint
Guest
« Reply #53 on: March 26, 2009, 09:31:13 pm »

Yeah I got that.  Right now I'm actually in Seasons trying to figure out how the Hero's Cave warp data works.  My goal is to find where the bit is set if you are in a linked game.  Of course since Season's ram map is totally different than Ages, it's kind of fruitless.  I guess I could search for the GBA switch instead and check how the game does the Advance Shop.  My goal is to find where the covering to Ages Hero's cave is.  It seems that on plane 0, screen 48, tile 64 gets superimposed over a specific spot, and when you are in a linked game, it gets removed.  In Seasons, it uses warp data and seems to do some sort of switch.  You know it's funny how two games that appear to be exactly the same is actually quite different.
Dwedit
Guest
« Reply #54 on: March 26, 2009, 09:43:23 pm »

And I bet Seasons has nothing for cleaning up the oceans Smiley

I bet the special doors under certain circumstances are done by game objects.
« Last Edit: March 26, 2009, 09:54:39 pm by Dwedit »
Jigglysaint
Guest
« Reply #55 on: March 26, 2009, 10:09:26 pm »

Quote from: Dwedit on March 26, 2009, 09:43:23 pm
And I bet Seasons has nothing for cleaning up the oceans Smiley

I bet the special doors under certain circumstances are done by game objects.

That's not always the case.  In fact, I did check the objects for that screen and even after adjusting the pointer, the wall tile was still there.  I searched for it, but nothing came up.  In case you are wondering, it's plane 0, screen 48, Tile ID is 64, clipping is 0f(solid), and DD is the tile ID that should be under it.

Also, one interesting thing about Ages and Seasons is that Ages has assumed warp tiles.  That means that the game is smart enough to know that if you go up a flight of stairs, you will appear in the same spot on the map above.  Seasons has no such warps, and all of them are data as usual.  Of course since each wap takes up 4 bytes each, plus it's parent data(another 4), it's not that bad, even in that room with like 100 stairs in the 7th dungeon.

Edit:  Okay I found it.  There is a list of pointers that represent the 7 planes at 1232E.  What these are, are special tiles that would be added or taken away based on some critteria.  No idea what, but it seems 1233F, if changed from 40 to 00, gets rid of the wall that blocks the Hero's Cave.  It doesn't seem to look like code, so I don't know exactly what's happening.  It seems to be a mix of screen ID's and tile ID's.

Edit 2:  Apparently the second byte is the ram flag to look for when determining if the object should be drawn or not.  However, I ran into an interesting quirk.  Apparently in plane 04, the first dungeon plane, only the first tile seems to work.  It's what overwrites the Armos tile in room 56 in Moonlight Grotto, and it's set to search for 20.  I think these tiles do things like hold certain doors open, like the room to the right of the Pea Shooter.  For some reason the lamp event will only tigger the even, but the tile won't even activate.  There's also two tiles in room 4B that never seem to trigger, and also the even in C5 matches up correctly with the action, but altering the tile doesn't seem to have an affect.
« Last Edit: March 27, 2009, 03:16:30 pm by Jigglysaint »
Dwedit
Guest
« Reply #56 on: March 27, 2009, 10:53:07 pm »



Here's a new screenshot.
Yes, it loads maps.  It also loads dungeon floor layouts so it can show the dungeons.  There's even a minimap now.
Jigglysaint
Guest
« Reply #57 on: March 28, 2009, 02:08:30 pm »

That is looking pretty amazing.  I can't wait to see it for myself.
Dwedit
Guest
« Reply #58 on: March 29, 2009, 11:29:19 pm »

I have just discovered a 100% pure certified WTF in the game.
The specifications for the screen east of the Maku tree (past) specify that the walls should be blue.



When I check it in game, the walls are a different color.
After a bunch of investigation, I discover what the game is doing here.

After it loads any tileset, it performs these checks:
* Are we in the overworld?
* Are we in the past?
* Are we NOT at the maku tree?
If all these pass, the game MANUALLY GOES THROUGH THE TILE DATA for tiles 64-127, FORCES ANY INSTANCE OF PALETTE #6 to PALETTE #0.

Then the walls are drawn correctly:



For some reason, the game uses this many times, even though it has its own perfectly good mechanisms for specifying things otherwise.
« Last Edit: March 30, 2009, 12:00:49 am by Dwedit »
Jigglysaint
Guest
« Reply #59 on: March 30, 2009, 05:37:25 pm »

Even more interesting is that the game also has checks for Symmatry Village and it's transitions from regular screen to either the ruined present tileset, or past tileset for that area.  I'm sure Rolling Ridge also has those pallete fades as well.

I'm not really sure why the game would auto fix pallete 6, but it could be to make sure that all tiles are even.  Since the Maku Tree has a bit set that makes all exits make the screen fade, my guess is that if you took that bit off, switching between screens would mess up the palletes.  I think screen exit fading is triggered when bit 07 is set in the data that defines what screen belongs in what area map.

Edit:  Close, but not quite.  It's at 1075C, and it's the list that has either an 01 or 7F.  There's a lone 80 there and that's the Maku Tree and it controls fade in warps.  I think it's mostly used in Seasons where there would be some obvious tileset conflicts between the different seasons.
« Last Edit: March 30, 2009, 05:49:15 pm by Jigglysaint »
Pages: 1 2 3 [4] 5 6  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC