PDA

View Full Version : White Forest / Black City Trainer Save File Offsets



Kaphotics
Jul 7th, 2011, 06:49 PM
Research from my White Save File, pretty sure Black won't be different. Inhabitants are not encrypted like the Entralink related stuff.

Save Block: 0x1FA00-0x1FCDF

0x1FA00-0x1FA07 Intro Data, constant.
24 bytes per Trainer starting at 0x1FA08 and repeating until 0x1FBE8

Struct of each 24 byte trainer block:
1byte - Trainer Present Byte (00 or 01)
1byte - Trainer ID# (00 thru 1D)
1byte - Happiness (00 thru 64)
1byte - Able To Talk To (07 yes, or 00 no)
20 bytes - zeroes.

No trainer is just zeroes.

0x1FCDE - Checksum (2 bytes as usual)
Over 0x1FA00 thru 0x1FCDB

http://dl.dropbox.com/u/12206225/RNG/wfbcchecksum.png


White Forest Inhabitants | Name / {In Grass} [In Water]
==================================================
00 = Schoolkid Leo / {Pidgey} [Surskit]
01 = Schoolkid Sylvia / {Wurmple} [Surskit]
02 = Roughneck Dave / {Gastly} [Surskit]
03 = Clerk Britney / {Hoppip} [Surskit]
04 = Youngster Robbie / {Elekid} [Surskit]
05 = Lass Miki / {Togepi} [Surskit]
06 = Black Belt Ryder / {Machop} [Lotad]
07 = Battle Girl Karenna / {Slakoth} [Lotad]
08 = Clerk Doug / {Shinx} [Lotad]
09 = Ace Trainer Vincent / {Magby} [Corphish]
0A = Scientist Marie / {Magnemite} [Lotad]
0B = Ace Trainer Lena / {Ralts} [Wooper]
0C = Backpacker Carlos / {Starly} [Corphish]
0D = Backpacker Molly / {Azurill} [Lotad]
0E = Gentleman Frederic / {Budew} [Wooper]
0F = Lady Lynette / {Oddish} [Surskit]
10 = Rich Boy Pierce / {Mareep} [Surskit]
11 = Hiker Gene / {Aron} [Surskit]
12 = Clerk Piper / {Bellsprout} [Surskit]
13 = Nusery Aide Miho / {Seedot} [Surskit]
14 = Schoolkid Shane / {Rhyhorn} [Surskit]
15 = Pokemon Ranger Ralph / {Lotad} [Surskit]
16 = Pokemon Ranger Eliza / {Trapinch} [Lotad]
17 = Clerk Collin / {Abra} [Lotad]
18 = Veteran Ken / {Nidoran-M} [Corphish]
19 = Scientist Jacques / {Nidoran-F} [Lotad]
1A = Veteran Rosa / {Whismur} [Lotad]
1B = Backpacker Herman / {Porygon} [Wooper]
1C = Backpacker Emi / {Happiny} [Corphish]
1D = Socialite Grace / {Bagon} [Wooper]

enjoy :)

Pedro250
Jul 13th, 2011, 06:10 PM
Hi,
I already devloped a tool for edit this data, but i am having problems with the Checksum.

The program is here: 8902.

This is just a BETA version, only edit the first trainer. First i am trying to solve the Checksum problem, then i will do the rest.

It edit the data, but you need to fix the Checksum by yourself, or no change will be showed in-game.
To fix the Checksum just open PokéGen, load your save on PokéGen, and save it again.
It worked for me, tested two times.

If anyone can help me with the Checksum Fix, i would appreciate it.
Thanks

Kaphotics
Jul 13th, 2011, 07:24 PM
There's active trainers and inactive trainers.

10 slots for active, 12? slots for inactive.

There's some problems with 00 being the trainer value loaded (Leo), as his "Talked To" hex is 00. Which means there's no trainer there. (You probably already know this)

I'll look at it more in depth tonight, thanks for making this!

It's a ccitt-16 checksum by the way.

Pedro250
Jul 14th, 2011, 04:26 AM
There's active trainers and inactive trainers.

10 slots for active, 12? slots for inactive.

There's some problems with 00 being the trainer value loaded (Leo), as his "Talked To" hex is 00. Which means there's no trainer there. (You probably already know this)

I'll look at it more in depth tonight, thanks for making this!

It's a ccitt-16 checksum by the way.

AS i said to you, the program is still a beta, so bugs will happen.
I will look on that, but first, the most important is the checksum fix.
Thanks

Pedro250
Jul 15th, 2011, 05:14 PM
Hi again,
In the Project Wikia there is a method of Checksum calculation, but don't know what language is it wrote, maybe someone can help me converting it to .net language? Thanks
The link is http://www.projectpokemon.org/wiki/Pok%C3%A9mon_NDS_Save_File_Checksum

Antidote
Jul 27th, 2011, 11:00 AM
Hi again,
In the Project Wikia there is a method of Checksum calculation, but don't know what language is it wrote, maybe someone can help me converting it to .net language? Thanks
The link is http://www.projectpokemon.org/wiki/Pok%C3%A9mon_NDS_Save_File_Checksum

Pedro, that link you provided has C# code, if you want VB.NET code it's a simple matter of popping that into a C# project, compile, pop the resulting executable into Reflector and change the language to VB.NET

For your convenience I've converted it to VB.NET for you




Public Shared SeedTable As Integer()

Public Function GetCheckSum(ByVal data As Byte()) As UInt16
Dim sum As Integer = &HFFFF
Dim i As Integer
For i = 0 To data.Length - 1
sum = ((sum << 8) Xor SeedTable(CByte((data(i) Xor CByte((sum >> 8))))))
Next i
Return CUShort(sum)
End Function

Public Shared Sub GetSeeds()
SeedTable = New Integer(&H100 - 1) {}
Dim index As Integer = 0
Dim result As Integer = 0
Do
result = (index << 8)
Do
If ((CByte((result >> 8)) And &H80) <> 0) Then
result = ((2 * result) Xor &H1021)
Else
result = (result * 2)
End If
Loop While (++index < 8)
index = index + 1
SeedTable(index) = result
Loop While (index <= &HFF)
End Sub

marc_max
Sep 10th, 2011, 02:47 AM
There are no 20 zeroes. Well... That's just if it's a new inhabitant. But if he/she comes from another Black City/White Forest it has the name of the trainer.
When you chat someone at White Forest, the trainer says: "I remember battling with [name] in Black City", that's the stored name :)