Jump to content

FR/LG flags research


cicciochiave

Recommended Posts

Table with found Flags and Constant (it's not empty, just scroll down):

Spoiler

 

I appreciate any help or report of errors.

 

Original post:

Spoiler

Hello, seeing that PKHeX has no 3rd gen event flags in the editor, i tried to find some flags by myself using the FlagDiff Researcher included in the program.

I started with Leaf Green.

At the first try, i used a save file in which the player is in front of Zapdos and the save file right after the catch of the bird (see the image under the spoiler).

Spoiler

sxngpd.jpg

My goal was to find the flag that handle the appearance of Zapdos, but the flag difference that i found wasn't the right one.

What was wrong? How can we find the right flag?

Thanks!

Link to comment
Share on other sites

Last update: December 10, 2018

Complete (or almost complete):

  • Trainer battles
  • Static encounters
  • In-game trades
  • Move tutors
  • Items
  • Hidden items

Missing (or almost missing):

  • Trainer re-battles
  • In-game events
  • Others

 

 

Original post:

Spoiler

Yes, the 1569 flag does nothing.

Those are the constants:

Spoiler

170: 45919->2253
171: 61473->64965
172: 45835->2200
173: 61473->64965
174: 45835->2200
175: 61473->64965
176: 45835->2200
177: 61473->64965
178: 45835->2200
179: 61473->64965
180: 52024->28843
181: 61473->64965
182: 45835->2200
183: 61473->64965
184: 45316->2696
185: 61473->64965
186: 46016->2132
187: 61473->64965
188: 45647->2524
189: 61473->64965
190: 45835->2200
191: 61473->64965
192: 45831->2197
193: 61473->64965
194: 45866->2233
195: 61473->64965
196: 45835->2200
197: 61473->64965
198: 45826->2193
199: 61473->64965
200: 45872->2211
201: 61473->64965
202: 45835->2200
203: 61473->64965
204: 45834->2201
205: 61473->64965
206: 45851->2184
207: 61473->64965
208: 45835->2200
209: 61473->64965
210: 45835->2200
211: 61473->64965
212: 45833->2202
213: 61473->64965
214: 45835->2200
215: 61473->64965
216: 45835->2200
217: 61473->64965
218: 45835->2200
219: 61473->64965
220: 45835->2200
221: 61473->64965
222: 45832->2203
223: 61473->64965
224: 45835->2200
225: 61473->64965
226: 45835->2200
227: 61473->64965
228: 45835->2200
229: 61473->64965
230: 45835->2200
231: 61473->64965
232: 45835->2200
233: 61473->64965
234: 45835->2200
235: 61473->64965
236: 45835->2200
237: 61473->64965
238: 45835->2200
239: 61473->64965
240: 45835->2200
241: 61473->64965
242: 45835->2200
243: 61473->64965
244: 45835->2200
245: 61473->64965
246: 45836->2207
247: 61473->64965
248: 45835->2200
249: 61473->64965
250: 45835->2200
251: 61473->64965
252: 45834->2201
253: 61473->64965
254: 45835->2200
255: 61473->64965
 

I can collect this info for every legendary if this is useful 

Spoiler

2e3wg1x.jpg

 

Edited by cicciochiave
Link to comment
Share on other sites

42 minutes ago, cicciochiave said:

Yes, the 1569 flag does nothing.

Those are the constants:

  Hide contents

170: 45919->2253
171: 61473->64965
172: 45835->2200
173: 61473->64965
174: 45835->2200
175: 61473->64965
176: 45835->2200
177: 61473->64965
178: 45835->2200
179: 61473->64965
180: 52024->28843
181: 61473->64965
182: 45835->2200
183: 61473->64965
184: 45316->2696
185: 61473->64965
186: 46016->2132
187: 61473->64965
188: 45647->2524
189: 61473->64965
190: 45835->2200
191: 61473->64965
192: 45831->2197
193: 61473->64965
194: 45866->2233
195: 61473->64965
196: 45835->2200
197: 61473->64965
198: 45826->2193
199: 61473->64965
200: 45872->2211
201: 61473->64965
202: 45835->2200
203: 61473->64965
204: 45834->2201
205: 61473->64965
206: 45851->2184
207: 61473->64965
208: 45835->2200
209: 61473->64965
210: 45835->2200
211: 61473->64965
212: 45833->2202
213: 61473->64965
214: 45835->2200
215: 61473->64965
216: 45835->2200
217: 61473->64965
218: 45835->2200
219: 61473->64965
220: 45835->2200
221: 61473->64965
222: 45832->2203
223: 61473->64965
224: 45835->2200
225: 61473->64965
226: 45835->2200
227: 61473->64965
228: 45835->2200
229: 61473->64965
230: 45835->2200
231: 61473->64965
232: 45835->2200
233: 61473->64965
234: 45835->2200
235: 61473->64965
236: 45835->2200
237: 61473->64965
238: 45835->2200
239: 61473->64965
240: 45835->2200
241: 61473->64965
242: 45835->2200
243: 61473->64965
244: 45835->2200
245: 61473->64965
246: 45836->2207
247: 61473->64965
248: 45835->2200
249: 61473->64965
250: 45835->2200
251: 61473->64965
252: 45834->2201
253: 61473->64965
254: 45835->2200
255: 61473->64965
 

I can collect this info for every legendary if this is useful 

  Hide contents

2e3wg1x.jpg

 

that looks like way too many constants.

Consider changing both flags and constants to before state, then check if the Zapdos can be re-battled :)

Link to comment
Share on other sites

I just tried to change only the constants, only the flag, both constants and flag... Guess what? No Zapdos re-battle ?

I copied 85 constants individually in PKHeX for nothing! ?

I think that there is something bigger to understand in 3rd gen flags than i know... 

I hope someone will find the answer.

Thanks anyway for the reply @theSLAYER!

Link to comment
Share on other sites

4 minutes ago, cicciochiave said:

I just tried to change only the constants, only the flag, both constants and flag... Guess what? No Zapdos re-battle ?

I copied 85 constants individually in PKHeX for nothing! ?

I think that there is something bigger to understand in 3rd gen flags than i know... 

I hope someone will find the answer.

Thanks anyway for the reply @theSLAYER!

hey, do you mind sending me the before save? :3

Link to comment
Share on other sites

1 hour ago, cicciochiave said:

Sure!

I'll PM you everything ?

Looks like the flag 1569 isn't required.

I've identified that something in save section 00 to 01 or save section 09 to 0E (half the save's data) is responsible for toggling Zapdos on and off.
(playing with the flag on a before save keeps Zapdos appearing, even after refreshing the map)

I'm trying to narrow the save sections down, to make it easier to notice differences.
(It doesn't help that the save sections change)

  • Thanks 1
Link to comment
Share on other sites

Okay, I got a way to make legendary reappear.

1. Save right in front of where legendary would be.
2. You need to find save section 01 of the latest save block in your save (there's 2 save blocks in your save, navigate to the latest one). (here's how the save sections work)
3. Change offsets as listed below (offsets are of save section 01, not the entire save)
4. Use PKHeX to fix the overall save's checksum
5. Take a step in-game. The map will refresh and the legendary will appear.
 

@Kaphotics
These are the only offsets we need to be bothered with, in save section 01:

tested:
Mewtwo: 0xEF0, bit 1 [set] (went from 0x99 to 0x9B)
Articuno: 0xEF0, bit 2 [set] (went from 0x99 to 0x9D)
Zapdos: 0xEEB, bit 5 [set] (went from 0xCD to 0xED)
Moltres: 0xEEA, bit 2 [set] (went from 0x9A to 0x9E)

untested presently (data obtained by comparing bitflags from saves)
Lapras: 0xF28, bit 6 [set] (went from 0x00 to 0x40)
Eevee: 0xEEA, bit 7 [unset] (went from 0x9E to 0x1E)
Togepi: 0xF3B, bit 2 [set] (went from 0x20 to 0x24)
Hitmonlee: 0xF2F, bit 0 [set] (went from 0x30 to 0x31), 0xEEC bit 0 [set] (went from 0x04 to 0x05)
Hitmonchan: 0xF2F, bit 0 [set] (went from 0x30 to 0x31), 0xEEC bit 1 [set] (went from 0x04 to 0x06)
Aerodactyl (Fossil Restoration): 0xF3D, bit 6 [set] (went from 0x80 to 0xC0)
Omanyte (Fossil Restoration): 0xF3D, bit 5 [set] (went from 0x00 to 0x20)
Kabuto (Fossil Restoration): 0xF3D, bit 4 [set] (went from 0x00 to 0x10) 
 

In the mean time, if rebattling legendaries is desperately needed, and don't know how to hex edit, then use the code below on VBA.
It will need FRLG's (M) code to work. (I got this code from here; appears to work once I reload the map using ladders/cave entrances):

Spoiler

9584746B 390CF182
  • Like 2
  • Amazed 1
Link to comment
Share on other sites

2 hours ago, theSLAYER said:

Kaphotics this can probably be implemented for PKHeX :D

I think this part is fine ahaha

You're doing a really amazing job!

I'm almost ashamed of my research... I found the flags for trainer card stickers ?

Spoiler

 

Hall of Fame sticker:

  • set 2192 (1 HoF victory)
  • unset 2192, set 2193 (40 HoF victories)
  • set 2192, set 2193 (100 HoF victories)
  • unset 2192, unset 2193, set 2194 (200 HoF victories)

Egg sticker:

  • set 2208 (1 egg hatched)
  • unset 2208, set 2209 (100 eggs hatched)
  • set 2208, set 2209 (200 eggs hatched)
  • unset 2208, unset 2209, set 2210 (300 eggs hatched)

Link Battle sticker:

  • set 2224 (1 link win)
  • unset 2224, set 2225 (20 link wins)
  • set 2224, set 2225 (50 link wins)
  • unset 2224, unset 2225, set 2226 (100 link wins)

If you set them but you have not reached the sticker goal, when you talk to the sticker man at fourth island you will receive the appropriate sticker

Exemple: 

  1. you hatched 1 egg and receive from the sticker man the 1-egg-sticker
  2. in PKHeX you set the 300-eggs-sticker
  3. in your trainer card you will see the 300-eggs one
  4. but if you talk to the sticker man, he will give you again the 1-egg one 

 

 

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

@theSLAYER : it could be that PKHeX is reading from the wrong offset.

https://github.com/kwsch/PKHeX/commit/ee57bc49f066bb6c477df39f2db7aea5f209198c

Was added over a year ago; the real 'offset' isn't Block2+0; it's likely Block1+0xE??.

Need to get the alignment right. The disassembly of firered's large block doesn't have nearly as much documentation as RS/E (flags, vars).

  • Like 1
Link to comment
Share on other sites

5 minutes ago, Kaphotics said:

@theSLAYER : it could be that PKHeX is reading from the wrong offset.

https://github.com/kwsch/PKHeX/commit/ee57bc49f066bb6c477df39f2db7aea5f209198c

Was added over a year ago; the real 'offset' isn't Block2+0; it's likely Block1+0xE??.

Need to get the alignment right. The disassembly of firered's large block doesn't have nearly as much documentation as RS/E (flags, vars).

That makes sense.

If you do get some makeshift implementation up, I could test it to see if it works.
(the bitflags I'm finding, are in the teams/items block)

Link to comment
Share on other sites

1 minute ago, theSLAYER said:

That makes sense.

If you do get some makeshift implementation up, I could test it to see if it works.
(the bitflags I'm finding, are in the teams/items block)

The savefile chunks aren't separate, they're just chopped up when saving to the cartridge, and verified in pieces (checksums).

block0 = trainer data

block1|block2|block3|block4 = savedata stuff

block5+ = storage

Link to comment
Share on other sites

2 minutes ago, Kaphotics said:

The savefile chunks aren't separate, they're just chopped up when saving to the cartridge, and verified in pieces (checksums).

block0 = trainer data

block1|block2|block3|block4 = savedata stuff

block5+ = storage

yeah, I had to figure that out the hard way when I first looked at the saves.

I basically checked block by block (copied from pre save into post save),
and discovered that all those bitflags are in block 1.

Link to comment
Share on other sites

1 hour ago, theSLAYER said:

yeah, I had to figure that out the hard way when I first looked at the saves.

I basically checked block by block (copied from pre save into post save),
and discovered that all those bitflags are in block 1.

Offset for FRLG should be Block1+0xEE0, not Block2+0x000

 

PKHeX's current setup for gen3 saves doesn't work for split-chunk operations, so don't expect it to work for flags >1280 (read the recent commit message). I need to figure out how to rework some logic...

Edit: fixed with some workaround, should be all good now :)

  • Like 1
  • Amazed 1
Link to comment
Share on other sites

There is nothing you guys can't do! Really impressed!

I just compiled the latest build of PKHeX and used the FlagDiff Researcher to test Zapdos re-battle.

Unsetting flag 93 and 703 makes Zapdos appear again

Spoiler

21dexzl.jpg

The strange thing is that even if you unset only one of the flags above, it will reappear anyway

Link to comment
Share on other sites

As usual, @Kaphotics you're our hero :3

35 minutes ago, cicciochiave said:

There is nothing you guys can't do! Really impressed!

I just compiled the latest build of PKHeX and used the FlagDiff Researcher to test Zapdos re-battle.

Unsetting flag 93 and 703 makes Zapdos appear again

  Hide contents

21dexzl.jpg

The strange thing is that even if you unset only one of the flags above, it will reappear anyway

If I'm not mistaken, only one is required. I think one controls NPC appearance (for present map) and another controls whether it's active.

based on what Kaph has said so far, for Zapdos [0xEEB, bit 5] counting (0xEEB - 0xEE0) x 8 + 5 bits, the value does add up to 0093, which is the same value displayed above.

I'll need to play around and check with other in-game events to be sure..

Link to comment
Share on other sites

10 minutes ago, cicciochiave said:

I tested the other legendaries and everything worked:

  • Mewtwo: unset 0129
  • Articuno: unset 0130
  • Zapdos: unset 0093
  • Moltres: unset 0082

thanks for the confirmation.

now I just gotta play around with the rest

I also made some saves for Magikarp sellers, the 2 Snorlaxes, Berry Forest Hypno etc.

its now easier to check the bitflags; while not difficult, jumping it's the saves to find the correct section for comparison was a bit tedious

Link to comment
Share on other sites

  • 3 weeks later...

Wow, you guys are doing awsome work. I don't suppose y'all know which flags activate which hidden items in FR/LG? Still, to this day I can't seem to spawn those Heart Scales in Tanoby Ruins or that Big Pearl in Trainer Tower. ?

Edited by DestroyMagnet
Misspelled a word
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...