Denjuu Encounter data is difficult to hack...

Discuss anything related to hacking ROMs of the Telefang games here.
Blaziken257
Posts: 983
Joined: Fri Dec 22, 2006 11:52 am

Re: Denjuu Encounter data is difficult to hack...

Post by Blaziken257 »

I'm having a difficult time trying to reverse engineer Denjuu encounter data, because the way the data is stored is really weird. For Toronko Village, the data is in $1D56EE-$1D5702, though the data may be longer than that (I'm not 100% sure). One weird thing is that there I can't even find a pointer table for it (when I searched for EE 56 in the ROM (which would point to $1D56EE), the results I found didn't seem to be pointer tables (because usually pointer tables have an easy-to-find pattern).

That's not the real problem, though. The problem is that a lot of the bytes can determine both what Denjuu appear, and what level a Denjuu can appear at. The data seems to be like this: When encountering a Denjuu, the game pulls out a random byte from $1D56EE-$1D5702 (in Toronko Village anyway) for the Denjuu. Then, for the level, it pulls out ANOTHER byte, which seems to be a few bytes after the first one (again, this is random). This means that a byte that determines a Denjuu can also determine a level for ANOTHER Denjuu!

Here's an example. I hacked the bytes $1D56EE-$1D5702 like this:

Code: Select all

01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 
11 12 13 14 15
I made the bytes all different so that when I find a Denjuu, I can tell which bytes are affecting the wild Denjuu.

Here are some Denjuu I found in Toronko Village by doing this:

#1 Tsunonasu (L4)
#1 Tsunonasu (L5)
#1 Tsunonasu (L6)
#2 Kochia (L5)
#2 Kochia (L6)
#3 Oshe (L5)
#4 Keshi (L6)
#6 Monstera (L10)
#6 Monstera (L11)
#6 Monstera (L11)
#7 Fungus (L9)
#7 Fungus (L10)
#7 Fungus (L10)
#8 Hiougi (L9)
#8 Hiougi (L11)
#9 Punica (L10)
#11 Suguri (L14)
#11 Suguri (L15)
#11 Suguri (L15)
#11 Suguri (L15)
#11 Suguri (L16)
#12 Ganraikou (L15)
#12 Ganraikou (L15)
#12 Ganraikou (L15)
#12 Ganraikou (L16)
#13 Byakubu (L14)
#13 Byakubu (L15)
#13 Byakubu (L16)
#14 Telopea (L15)
#16 Ixora (L19)
#16 Ixora (L20)
#17 Myrtus (L19)
#17 Myrtus (L20)
#18 Lychnis (L20)
#18 Lychnis (L21)

So, basically, it pulled out a random byte for the Denjuu, and another random byte close to the first one (and to the right of it) for the level. It's kinda annoying though... what if you want to find a Cryptoride in the wild? Does that mean that some Denjuu will sometimes be at... Level 60? It seems like it, which is unfortunate.

One thing worth noting is that the farther up I got in Toronko Village, the higher the numbers that the game pulled out (which means I found Denjuu with higher numbers, with higher levels). I gotta figure out what in the game makes it do this... Also, in some acres at the very beginning, you could walk forever and not find anything.

If anybody else finds more information, that would be nice...
Milnivri(imported)
Posts: 351
Joined: Wed Dec 27, 2006 10:14 pm

Re: Denjuu Encounter data is difficult to hack...

Post by Milnivri(imported) »

I've found out how!

Basically, the Denjuu you find in a certain village/city/town cannot be found in all acres of the village, and so in a part of the data controls those acres of the village. Up to four different Denjuu can be found in any "acre plot" (the acres which have the same data), and the median of the level of the Denjuu is the byte after those four bytes of the Denjuu.

I can't explain properly, so let's use Toronko Village's acres as an example:

Code: Select all

- - 4 4
- - 4 3
3 3 3 3
2 1 1 3
2 2 2 
1 1 - 
- 2 2 
The numbers represent the different groups of Denjuu. It's like several habitats within one ecosystem, and so you get different Denjuu appearing there.

So let's take the first group of Denjuu as an example. Taking 5 bytes from $1D56EE-$1D56F2, you get:

Code: Select all

03 03 04 02 03
So you can see that there are three different Denjuu in group 1, which are Oshe (#03), Keshi (#04) and Kochia (#02). These are just from the first four bytes! Also you can see Keshi is more common than Oshe and Kochia, as it would tend to appear twice as more often than the other two.

The fifth byte will determine the range of the levels of the Denjuu in the group, as it is the median of the levels ±1 level. So, the levels would be from levels 2-4, with 3 in the middle.

Yeah so that's it. I've only tested this on Toronko Village by the way.

Hoho =D
Blaziken257
Posts: 983
Joined: Fri Dec 22, 2006 11:52 am

Re: Denjuu Encounter data is difficult to hack...

Post by Blaziken257 »

Wow... I don't have any idea how you managed to figure this out... awesome! It ended up being easier than I thought it would be! That fifth byte REALLY threw me off and made me think that the levels were controlled by other bytes! That also explains why I never found Denjuu #5, #10, or #15 after a half hour of searching, because those bytes were the levels!

Now I gotta find out the data for the other locations (this will take forever, though), and what determines which 5 bytes it reads for each acre...
Blaziken257
Posts: 983
Joined: Fri Dec 22, 2006 11:52 am

Re: Denjuu Encounter data is difficult to hack...

Post by Blaziken257 »

By the way, I figured out the data for Toronko Village Water Station. Here are its acres:

Code: Select all

- - - - - - - - 
- - - - - - - - 
- - - 2 2 - - - 
- - - 1 1 - - - 
- - - 1 1 1 - - 
- - - 1 1 1 - - 
- - - 2 1 - - - 
- - - 2 1 - - - 
And the offsets:

$1D57C0-$1D57C4 - 1
$1D57C5-$1D57C9 - 2

It uses the same format as before (first four bytes = Denjuu, fifth byte = level ±1). That's nice...

I haven't bothered to figure out the offsets for all that unused space out there (the ones I labeled -), though it might be useful if anybody ever hacks the map to add more space there. I also still need to figure out how to change the tiles of the different data at will (i.e. change 1 to 2 and vice versa...)
Milnivri(imported)
Posts: 351
Joined: Wed Dec 27, 2006 10:14 pm

Re: Denjuu Encounter data is difficult to hack...

Post by Milnivri(imported) »

Lol I took a real long time to figure out it was the fifth byte, since I had to hack every single byte one by one and didn't look at what you had above (the #5, #10 and #15 didn't appear). xD

So... now we have yet another thing to add on the to-do list for us Telefans, huh.
Blaziken257
Posts: 983
Joined: Fri Dec 22, 2006 11:52 am

Re: Denjuu Encounter data is difficult to hack...

Post by Blaziken257 »

Yeah, I guess it is. <_< Anyway, I found two more locations:

Kurinon Village:

$1D5702-$1D5706 - 1
$1D5707-$1D570B - 2

x = No Denjuu appear there (for some reason)

Code: Select all

x x
x 1
x x 2
2 2 2
Kurinon Village Cave:

$1D57CA-$1D57CE - Floor 1 (Yes, this goes for the ENTIRE floor. I checked every single screen.)
$1D57CF-$1D57D3 - Floor 2 (See above)

Also, one thing I noticed is that, so far, the game groups outdoor locations together in the same spot (i.e. Kurinon Village's data comes right after Toronko Village's), and it groups caves together in another spot (Kurinon Cave comes right after Toronko Water Station). This may make everything easier to find...
Milnivri(imported)
Posts: 351
Joined: Wed Dec 27, 2006 10:14 pm

Re: Denjuu Encounter data is difficult to hack...

Post by Milnivri(imported) »

Anyway, we do have to put the sections of the cities and towns into the wiki (as in the acre layout), so should we:

1. Split all the different sections across the whole Denjuu world and number them as in the ROM data
2. Split only within that town/city and number it from increasing order

The second option seems better, but in the event that two places in different cities/towns share the same encounter data, then the first option would be better.

Also, it might be more systematic to number the areas like the internal numbering for the Denjuu in Telefang 2.

What do you all think?
Milnivri(imported)
Posts: 351
Joined: Wed Dec 27, 2006 10:14 pm

Re: Denjuu Encounter data is difficult to hack...

Post by Milnivri(imported) »

Sorry to ask, but is anyone currently working on the encounter data acres? Since I was thinking of working on it, but if someone else is already doing so, then I would be wasting effort...

And at the same time collate where each Denjuu can be found in the wild to put in the wiki. (plus rarity - how many times that Denjuu appears in the set of 5 bytes?)
User avatar
andwhyisit
Site Admin
Posts: 1197
Joined: Fri Dec 14, 2007 9:24 pm

Re: Denjuu Encounter data is difficult to hack...

Post by andwhyisit »

Milnivri wrote: Sorry to ask, but is anyone currently working on the encounter data acres?
Doesn't seem like it.
Blaziken257
Posts: 983
Joined: Fri Dec 22, 2006 11:52 am

Re: Denjuu Encounter data is difficult to hack...

Post by Blaziken257 »

I would, but for the next week and a half, I'm not going to have much time to do much here, because I'm busy with work in real life. I can get a little bit done but I can't promise much for a week and a half.
Post Reply