Jump to content

Friend Safari calculator for XY?


Recommended Posts

I wanted to try and figure out how X & Y determine Friend Safaris based off of friend codes. I've tried looking for this in a variety of places online (and even in a couple of different languages). A couple of people have suggested that they figured it out, but there's no proof anywhere that I could find. Most threads around this died a few years ago, but I figure some people might still be interested so I thought I'd ask about it here.

Here's what I have found out:

  • Friend codes seem to be saved within the save file as a truncated 32-bit integer. In other words, the friend code is treated as a 12-digit base-10 integer & then stored in a 32-bit value. This is alongside some other data (like whether or not the 3rd slot is unlocked, or if you've unlocked hidden abilities).
  • I did find the area in memory that lists the Pokemon in the Friend Safari in order. It's simply a list of 216 Pokemon (any Pokemon with a 50% chance of appearing for a given slot appears twice in the list). I uploaded the list as a text file, for anyone who's interested. It's split into sections, with each line representing one slot & the Pokemon are in the same order as in the game's memory. With the ROM I was looking at, the list starts at address 0x65EDEA, if you want to look for yourself.

I've tried a few different things using friend codes:

1) Using the friend codes directly (like XORing the high and low words, or XORing all of the bytes & then looking at the result mod 18)

2) Using the friend codes as a seed for the PRNG, and then doing more math on that result (more XORs & mod 18 math)

I haven't had any luck discerning any kind of pattern just using math & logical operators. Also, some people have suggested that the Friend Safari is based on additional factors (like region and/or birth date), although I'm not certain about that ... but if it's true, then it would be even more difficult to work it out this way.

The other approach, of course, is to look at the code's disassembly & try to figure it out from that side. Unfortunately, I'm not very good with disassembly, so my attempts there haven't met with any success.

Any thoughts?

FS_Pokemon.txt

Link to comment
Share on other sites

4 hours ago, iriomote said:

1) Using the friend codes directly (like XORing the high and low words, or XORing all of the bytes & then looking at the result mod 18)

2) Using the friend codes as a seed for the PRNG, and then doing more math on that result (more XORs & mod 18 math)

FS_Pokemon.txt 2.02 kB · 1 download

If it's anything like Mirage Spots (long thread with research and documentation),
It could have used friend codes to seed the Mersenne twister or something...
Probably too complicated IMO.
 

Barely relevant information:
We do have a Friend Safari Editor (Well, not exactly an editor, but an unlocker)

I think it only unlocks the third slot, if you already have friends on that device.

 

Link to comment
Share on other sites

13 hours ago, theSLAYER said:

If it's anything like Mirage Spots (long thread with research and documentation),
It could have used friend codes to seed the Mersenne twister or something...
Probably too complicated IMO.
 

Barely relevant information:
We do have a Friend Safari Editor (Well, not exactly an editor, but an unlocker)

I think it only unlocks the third slot, if you already have friends on that device.

 

Yeah - I actually found the relevant bits concerning the third slot & hidden abilities when I was playing around with save files a while back.

Anyway, this was purely a matter of curiosity - I haven't really touched Gen 6 for a while, and I've already collected all of the Friend Safaris that I really care about. It just seemed like an interesting problem.

  • Like 1
Link to comment
Share on other sites

  • 4 years later...
Posted (edited)

Apologies for resurrecting an old thread, but there is now an answer to this! I wish I could take credit, but I just did a random search for it recently & found this - https://github.com/zaksabeast/XY-All-Friend-Safaris-Patch. This project essentially fakes out a bunch of FS entries that, if added as a patch, would give someone every possible Pokemon. This project also includes some Javascript that shows how the FS is actually determined. GF certainly went to a lot of trouble to obfuscate this, especially given how relatively insignificant the FS is.

The main thing is that it doesn't actually use the 12-digit friend code, but instead uses a hidden local friend code. I actually found that this local friend code is stored in the Pokemon X & Y save file, and since I have a backup of my save file on my computer I grabbed a few friend codes to test it out. I then went into the Friend Safari in-game & confirmed that the entries matched up with the results of the code.

Anyway, I realize it's a very small thing, but it's something that's been kind of bugging me off & on for years, so I'm glad I got some closure. And if someone else looks this up & stumbles upon this post, perhaps they'll find it interesting as well.

Edited by iriomote
  • Like 2
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...