Jump to content

Pt/HGSS Trainer Records offsets & Misc. (research)


futuu

Recommended Posts

Trainer Records is encrypted by LCRNG algorithm
Y0 = seed

Yn+1 = Yn * 0x41C64E6D + 0x6073
Xn = origin data XOR Yn 3&4th bytes

offsets:
Pt: 61B4~6367 seed: 6368~636B
HGSS: 4B44~4CF7 seed: 4CF8~4CFB

DP are not encrypted

17587.png.2492a01b1f40b09634e9eb67e3a5cee0.png

Pt can receive globe and crystals from Mr. Goods
accessed GTS: flag 2444 set
used another underground count by constant 71, 72, 73, 84: ->100
DP is 70~73

HGSS event flag(unset) 0681, 0682, 0683 = battle tower trophy
flag 0239, 0240, 0241 constant 226: ->4(conversation) = all Pokéathlon basement room enterable
flag(unset) 0725, 0726, 0727, 0728, 0729 = room items

26009.png.09d88ca43f465ccce5ac34895644ca31.png

Edited by futuu
  • Like 1
Link to comment
Share on other sites

  • 4 months later...

It seems Pt/HGSS are using the same offsets
+61B0 for Pt or +4B40 for HGSS
   4 score
 10 berry planted
 1C wild pokemon battles
 20 NPC trainer battles
 24 pokemon caught
 28 times fished
 2C eggs hatched
 30 pokemon evolved
 38 played in game corner
 3C battle tower continues won
 4C link trades
 50 link battles
 54 link battle wins
 58 link battle losses
 60 wifi trades
 64 wifi battles
 68 wifi battle wins
 6C wifi battle losses
 74 battle tower won
 8C money spent
 A0 daycare sent
 A4 pokemon defeated
 B4 mail wrote
 C0 TV watched
 C4 nicknames given
 CC berries pokemon picked
 C8 premium ball got
 D0 poffin made
 DC ***unknown Pt recorded
 E0 ***unknown Pt recorded
 E4 battleground won
 E8 battle frontier total won
 EC battle brains total won
 F0 battle factory won
 F4 battle castle won
 F8 battle hall won
 FC battle arcade won
100 battle factory pokemon changed
104 battle castle CP total remained
108 battle hall over level 10 selected?
10C battle arcade bonus BP?
110 BP got
114 BP spent
118 ***unknown Pt recorded
120 championship won
-126 splash used
-142 contest participated
144 link contest participated?
-146 contest won
148 link contest won?
14C move no effect
-14E own pokemon fainted
150 friendlyfire?
-152 failed run
154 pokemon run
-156 failed fishing
174 fossil restored
-176 ***unknown Pt recorded

Edited by futuu
  • Like 1
Link to comment
Share on other sites

  • futuu changed the title to Pt/HGSS Trainer Records offsets (research)
On 10/19/2021 at 8:19 AM, theSLAYER said:

I've merged your messages. Also, no need to send unsolicated pings to specific people to ask for help.

I found the encryption algorithm and succeed to decrypt them, researching the offsets now
Is it easy to add the editor to PKHeX?

  • Like 1
Link to comment
Share on other sites

  • futuu changed the title to Pt/HGSS Trainer Records offsets & Misc. (research)
  • 1 year later...

Not knowing a thing about hex editing, I'm trying to make sense of this but got stuck. I'm trying to edit a Platinum save.

Flags 71; 72; 73 and 84 are easy. They can be changed in the Research tab of the Event Flag Editor. Don't know what they meant with "accessed GTS: flag 2444 set". It's not a constant (they go from 0 to 287), nor a hex number telling you what flag is it (equals 9284 in decimal). I thought it was an offset and changed it from 00 to 01 in my save file, but seems like I'm mistaken and/or doing something wrong (save file gets corrupted). Changing GeonetGlobalFlag from false to true in the Simple Editor doesn't trigger Mr. Goods giving you the Globe either.

Now the dumber tries:

I go to the 61B4-6367 block, but I don't know what to do with the list futuu posted. Knowing I caught the entire dex (493) I tried the sum of 61B4+24 (Pokemon Caught) and it's 61D8. Which in my save file is 27 hexadecimal (39 in decimal). Then I tried 61D8-61DB, assuming that Pokemon Caught goes from 24 to 27 because 28 is Times Fished. In my save file that's 27 D0 1B F7 and no matter if I flip the order or not (I remember hex editing a Gen3 file and I had to flip them), it's a very high decimal number, far from 493 (01ED in hex). Then I tried searching for 01 ED and ED 01 but no matches found in the 61B4-6367 block.

If teaching how to understand this is too much, I just really want two things:
1.- The Globe from Mr. Goods.
2.- See where is my Battle Hall won count stored
(F8 in the futuu's list). I have a legit 180 streak but I want to set the score to 10000 and trigger this: If the record is over 1,000, the player will get Johanna, and over 10,000 will get Professor Oak or Jasmine. BUT... Changing the record in the Battle Frontier tab of the Misc Editor is not enough. Bulbapedia may be wrong or it may be a random or bugged event, not sure.

Edited by jacksonf
Link to comment
Share on other sites

On 10/30/2023 at 10:15 AM, jacksonf said:

Not knowing a thing about hex editing, I'm trying to make sense of this but got stuck. I'm trying to edit a Platinum save.

Flags 71; 72; 73 and 84 are easy. They can be changed in the Research tab of the Event Flag Editor. Don't know what they meant with "accessed GTS: flag 2444 set". It's not a constant (they go from 0 to 287), nor a hex number telling you what flag is it (equals 9284 in decimal). I thought it was an offset and changed it from 00 to 01 in my save file, but seems like I'm mistaken and/or doing something wrong (save file gets corrupted). Changing GeonetGlobalFlag from false to true in the Simple Editor doesn't trigger Mr. Goods giving you the Globe either.

Now the dumber tries:

I go to the 61B4-6367 block, but I don't know what to do with the list futuu posted. Knowing I caught the entire dex (493) I tried the sum of 61B4+24 (Pokemon Caught) and it's 61D8. Which in my save file is 27 hexadecimal (39 in decimal). Then I tried 61D8-61DB, assuming that Pokemon Caught goes from 24 to 27 because 28 is Times Fished. In my save file that's 27 D0 1B F7 and no matter if I flip the order or not (I remember hex editing a Gen3 file and I had to flip them), it's a very high decimal number, far from 493 (01ED in hex). Then I tried searching for 01 ED and ED 01 but no matches found in the 61B4-6367 block.

If teaching how to understand this is too much, I just really want two things:
1.- The Globe from Mr. Goods.
2.- See where is my Battle Hall won count stored
(F8 in the futuu's list). I have a legit 180 streak but I want to set the score to 10000 and trigger this: If the record is over 1,000, the player will get Johanna, and over 10,000 will get Professor Oak or Jasmine. BUT... Changing the record in the Battle Frontier tab of the Misc Editor is not enough. Bulbapedia may be wrong or it may be a random or bugged event, not sure.

globe: just set flag 2444 on

a.png.c9e2fa1744f584b7321e6f59fcf7e0de.png

Battle Hall won count (trainer records) needs to be decrypted, a boring work

you can upload your save file and let me check it out

but it looks like the characters don't always appear every time

https://www7a.biglobe.ne.jp/~namake/diary/2008/stage.htm

Edited by futuu
Link to comment
Share on other sites

10 hours ago, futuu said:

globe: just set flag 2444 on

a.png.c9e2fa1744f584b7321e6f59fcf7e0de.png

Battle Hall won count (trainer records) needs to be decrypted, a boring work

you can upload your save file and let me check it out

but it looks like the characters don't always appear every time

https://www7a.biglobe.ne.jp/~namake/diary/2008/stage.htm

Ah, so Flag and Constant are two different things? Or does the Constant list only includes what has been already researched? Goes to show how much I don't know. Thank you, the Globe part was easy to follow. Grateful for the offer, here's my save file:

Plat Save.sav

Link to comment
Share on other sites

8 hours ago, jacksonf said:

Ah, so Flag and Constant are two different things? Or does the Constant list only includes what has been already researched? Goes to show how much I don't know. Thank you, the Globe part was easy to follow. Grateful for the offer, here's my save file:

Plat Save.sav 512 kB · 1 download

(flag has 2 states on and off in 1 bit & constant is a number 0~65535 in 2 bytes)

your pokemon caught count is 219 and battle hall won count is certainly 180

a.png.c960d00bcbe4e3950bdbda6c41d5701f.png

here i edited the battle hall won count to 10180, see if the characters appear

Plat Save.sav

Edited by futuu
  • V-Wheeeeeel!!! 1
Link to comment
Share on other sites

On 11/3/2023 at 11:14 AM, futuu said:

(flag has 2 states on and off in 1 bit & constant is a number 0~65535 in 2 bytes)

your pokemon caught count is 219 and battle hall won count is certainly 180

a.png.c960d00bcbe4e3950bdbda6c41d5701f.png

here i edited the battle hall won count to 10180, see if the characters appear

Plat Save.sav 512 kB · 2 downloads

Thanks again for taking the time to help! Oops, I thought that caught=owned (that's what I said 483) but I guess caught=caught. Will edit this post If I manage to trigger the NPCs. Hope this gets added to PKHeX someday.

EDIT: If you want to know how to trigger the NPCs, watch this video: https://www.youtube.com/watch?v=-Rp9rY-61To.

Edited by jacksonf
Link to comment
Share on other sites

  • 4 months later...

Is what futuu posted all that’s needed to implement trainer records editing for dppthgss save files? Please implement something like that if is true because it’s been two and a half years!

 

Edit: I had to add "if" between "that" and "is" for grammar.

Edited by Jollygator
Link to comment
Share on other sites

  • 2 months later...
On 11/3/2023 at 8:14 AM, futuu said:

(flag has 2 states on and off in 1 bit & constant is a number 0~65535 in 2 bytes)

your pokemon caught count is 219 and battle hall won count is certainly 180

a.png.c960d00bcbe4e3950bdbda6c41d5701f.png

here i edited the battle hall won count to 10180, see if the characters appear

Plat Save.sav 512 kB · 192 downloads

Hey, sorry for the very late response, but I was kinda interested in editing my Platinum, HG, and SS files so I can have 9,990 wins (and do the last ten wins) so I can get that 10,000 wins fan, but I try looking at my file on HxD but couldn't make heads or tails of it myself.

I tried using PkHex, but it didn't quite work the way I wished it (it edited the PREV win streak, but not the actual record). If you, or anyone, can show me how to edit the wins, I would be appreciative, but no biggie if not.

Link to comment
Share on other sites

  • 1 month later...
Posted (edited)

@Jollygator @Providence

Since I posted, PKHeX has added a Gen4 Record Editor, check latest dev build that includes this PR: https://github.com/kwsch/PKHeX/pull/4298. Most of the records are not documented, but now noobs like us can help to speed things up by modifying values, doing trial and error and learn what they do, as the decryption part is done by the app.

I tried to go one by one using the list futuu has posted but I couldn't correlate the values with what PKHeX shows easily. Gotta go the long way of testing what looks familiar (knowing the numbers in our save files). But more knowledgeable people may be able to do it in a smarter way.

I haven't tested everything, but I am 100% sure of these records in my Platinum save. You can check them in the file I uploaded before and the one futuu edited for me:
Record 0 - May be Steps Counter.
Record 1 - Trainer Card score.
Record 4 - Berries Planted.
Record 7 - Wild Pokémon Battles.
Record 8 - NPC Trainer Battles.
Record 9 - Pokémon caught.
Record 10 - Times Fished successfully.
Record 11 - Eggs Hatched.
Record 12 - Pokémon evolved.
Record 15 - Battle Tower continues won (every 7 matches).
Record 29 - Battle Tower won (Updates when you get a continue or lose the streak. It's the total you have won, not your record).
Record 35 - Money Spent on the Mart, I guess (If you buy something it changes accordingly, but paying for the Daycare doesn't update the value).
Record 40 - Pokémon sent to the Daycare (It doesn't update instantly, I guess you need to take some steps before it counts).
Record 41 - Pokémon Defeated.
Record 48 - Times you have watched TV.
Record 49 - Nicknames given.
Record 50 - Premier Balls got.
Record 57 - Looks like Pokémon levels achieved through battling (Rare Candies and Daycare don't count).
Record 58 - Battle Frontier total won**. This one is weird. It updates everytime you defeat a trainer in the Frontier but it should be higher. I had a legit Battle Hall 180-streak and every Gold Print from other facilities, but this value is much lower. Some facilities and/or battles may not count, not sure.
Record 60 - Battle Factory won.
Record 61 - Battle Castle won.
Record 62 - Battle Hall won count.
Record 63 - Battle Arcade won.
Record 65 - Castle Points won (Not the same as current record CP).
Record 68 - BP got.
Record 69 - BP spent.

Most of them are in the same exact order from futuu's list. Some are not, beware. Record 47 is probably berries picked but I didn't test that yet. Record 55 or 56 may be related to Pal Park as they're equal to 335 and 350 respectively in my save file. I "palparked" almost every species from my Emerald playthrough, so 335 and 350 are close. Tried palparking today but the values did not update. I may wrong or it only counts new species from palparking (I've seen and obtained the entire Dex).

Citing the PR's author (abcboy101), fields are not exactly the same in every Gen4 game. I'm not a programmer but the summary part of the Record4.cs file is not that hard to follow. Looks like he has also found this to be true:

Diamond/Pearl:
Record 0 is Trainer Card Score.

Platinum:
Record 1 is Trainer Card Score (as I found out too by testing his PR).

HG/SS:
Record 1 is ApricornGet (not sure what this means, I don't own HG/SS).
Record 2 is Trainer Card Score.
Record 22 is BadgeGet (again, not sure).
Record 69 is BattlePoints.

Edited by jacksonf
Link to comment
Share on other sites

14 hours ago, jacksonf said:

@Jollygator @Providence

Since I posted, PKHeX has added a Gen4 Record Editor, check latest dev build that includes this PR: https://github.com/kwsch/PKHeX/pull/4298. Most of the records are not documented, but now noobs like us can help to speed things up by modifying values, doing trial and error and learn what they do, as the decryption part is done by the app.

I tried to go one by one using the list futuu has posted but I couldn't correlate the values with what PKHeX shows easily. Gotta go the long way of testing what looks familiar (knowing the numbers in our save files). But more knowledgeable people may be able to do it in a smarter way.

I haven't tested everything, but I am 100% sure of these records in my Platinum save. You can check them in the file I uploaded before and the one futuu edited for me:
Record 0 - May be Steps Counter.
Record 1 - Trainer Card score.
Record 4 - Berries Planted.
Record 7 - Wild Pokémon Battles.
Record 8 - NPC Trainer Battles.
Record 9 - Pokémon caught.
Record 10 - Times Fished successfully.
Record 11 - Eggs Hatched.
Record 12 - Pokémon evolved.
Record 15 - Battle Tower continues won (every 7 matches).
Record 29 - Battle Tower won (Updates when you get a continue or lose the streak. It's the total you have won, not your record).
Record 35 - Money Spent on the Mart, I guess (If you buy something it changes accordingly, but paying for the Daycare doesn't update the value).
Record 40 - Pokémon sent to the Daycare (It doesn't update instantly, I guess you need to take some steps before it counts).
Record 41 - Pokémon Defeated.
Record 48 - Times you have watched TV.
Record 49 - Nicknames given.
Record 50 - Premier Balls got.
Record 57 - Looks like Pokémon levels achieved through battling (Rare Candies and Daycare don't count).
Record 58 - Battle Frontier total won**. This one is weird. It updates everytime you defeat a trainer in the Frontier but it should be higher. I had a legit Battle Hall 180-streak and every Gold Print from other facilities, but this value is much lower. Some facilities and/or battles may not count, not sure.
Record 60 - Battle Factory won.
Record 61 - Battle Castle won.
Record 62 - Battle Hall won count.
Record 63 - Battle Arcade won.
Record 65 - Castle Points won (Not the same as current record CP).
Record 68 - BP got.
Record 69 - BP spent.

Most of them are in the same exact order from futuu's list. Some are not, beware. Record 47 is probably berries picked but I didn't test that yet. Record 55 or 56 may be related to Pal Park as they're equal to 335 and 350 respectively in my save file. I "palparked" almost every species from my Emerald playthrough, so 335 and 350 are close. Tried palparking today but the values did not update. I may wrong or it only counts new species from palparking (I've seen and obtained the entire Dex).

Citing the PR's author (abcboy101), fields are not exactly the same in every Gen4 game. I'm not a programmer but the summary part of the Record4.cs file is not that hard to follow. Looks like he has also found this to be true:

Diamond/Pearl:
Record 0 is Trainer Card Score.

Platinum:
Record 1 is Trainer Card Score (as I found out too by testing his PR).

HG/SS:
Record 1 is ApricornGet (not sure what this means, I don't own HG/SS).
Record 2 is Trainer Card Score.
Record 22 is BadgeGet (again, not sure).
Record 69 is BattlePoints.

i think it works as 1 record = 4 bytes
for example if record 1 = offset 04
then record 4 = offset 04 + 04x3 = 10
offset 08 0C doesn't work so record 2 3 is the same

*steps counter is not encrypted and its offset is 00

Link to comment
Share on other sites

On 5/26/2024 at 2:33 PM, Providence said:

Hey, sorry for the very late response, but I was kinda interested in editing my Platinum, HG, and SS files so I can have 9,990 wins (and do the last ten wins) so I can get that 10,000 wins fan, but I try looking at my file on HxD but couldn't make heads or tails of it myself.

I tried using PkHex, but it didn't quite work the way I wished it (it edited the PREV win streak, but not the actual record). If you, or anyone, can show me how to edit the wins, I would be appreciative, but no biggie if not.

i deleted previous reply for the method offered by jacksonf is better
once it's officially released it will be easier to verify, especially "unknown" and "?" marked offsets

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...