kwsch / PKHeX

Pokémon Save File Editor
https://projectpokemon.org/pkhex/
Other
3.68k stars 689 forks source link

[XY] Friend safari slot unlocking #330

Closed suloku closed 7 years ago

suloku commented 7 years ago

I've been researching friend safari a little. It relies on the friend list on the 3DS console, each friend code gives a safari with 3 pokemon, the 3rd pokemon is only accessible if the friend has been on the PSS at the same time as you.

Turns out the lock are bitflags, stored on a single byte.

Friend safari list offset: 0x1E800 I holds up to 100 entries, each one being 0x15 bytes in size. The byte that controls the lock status for each safari entry is the last one. I don't have a clue about what the other bytes do, but since the entries get updated at boot depending on the console's friend list I don't think there's any point.

Here are all the possible values (i though an image would be better): https://s17.postimg.org/f90hfmrmn/safari.png

It would be great if this could be implemented at some point, there's probably other priorities right now but I think this is rather useful since less and less people will play gen VI.

I'll try to make a list of 71 unique friend codes that allow to have every single friend safari pokemon in the game.

suloku commented 7 years ago

I've just realized friend code exchanging has been going forever and there are sites like these:

http://friend-safari-exchange.tumblr.com/ http://safaricode.com/users

Getting the 71 code combinations shouldn't be diffult searching those site, if anyone wants to help compiling please contact me.

EDIT: nevermind, using actual friend codes needs research on modifying the friend code list (or enabling registered codes so the game recognizes them), I though nintendo's tool would do it for me, but it only adds them to the list, it doesn't "enable" them. Gonna see if the 100 dummy codes it is able to add to the list are enough to cover all safari pokemon.

EDIT2: unfortunately, the dummy friends nintendo's tool adds won't cover all safaris and though the friendlist savefile can be dumped, there's been no research on editing that file.

EDIT3: I guess a valid approach would be to try creating a friendlist savefile on a spare emunand, then upload it since decrypt9 can backup/restore that file. The only "problem" would be getting all the safaris on a single friendlist file.

EDIT4: I've managed to modify the SDK app so it adds different dummy people, so with some patience and work I think I'll be able to generate both a patch for the sdk app and a friend file with the needed codes to get all safari pokemon. Too bad I can't just use codes already on internet database.

EDIT5: turns out I figure out how to use internet codes instead of the dummy ones the sdk app has, so I just need to compile them and make a ips patch for the sdk csu file.

EDIT6: Turns out friend code isn't the only determinant of friend safari (probably nickname is also involved), so even though I can add any friendcodes I want, building a file that allows catching all safari pokemon will need trial/error (well, I could try figure out the friendlist file structure itself, but that would take more time for me, or even be impossible, so trial-error seems quicker, and I can test batches of 100).

kwsch commented 7 years ago

Since it depends on the console's stored FC's, not something that can be reliably edited. Better to just hack in the pkm :)

suloku commented 7 years ago

@kwsch Unlocking the third slot has nothing to do with the actual friend list. The normal way to unlock the 3rd slot is for you and your friends to be online simultaneously, the feature I request removes this need.

This also allows unlocking the 3rd slot for friends you may have in your friendlist that don't play XY.

Being able to modify/fake the friend list (with is something unrelated to pkhex) still needs the "unlock third slot" feature too, and I'm talking about the friend file in the 3DS, not the list stored in the savegame.

kwsch commented 7 years ago

Should be documented on the forums first prior to being a candidate for implementation. I'd like to not inter mix research requests and feature requests.

ReignOfComputer commented 7 years ago

Noting @suloku's unlocker tool here: https://github.com/suloku/gen6_safari_mirage_tool

greenDarkness commented 7 years ago

So basically in order to use this tool I'd need to dump this friend file, modify it with the tool, and then inject it back into the 3ds?

If so I think it would be a nice addition to PKHeX.

suloku commented 7 years ago

Clarification:

This is the code needed to fully unlock (all 3 slots unlocked + unhidden) all safaris present in the savegame (+checksum fixing):

//Unlock + reveal all safari
int i;
for (i=1;i<101;i++)
{
    if( savebuffer_XY[0x1E7FF+(0x15*i)] != 0x00 ) //When there's no friend in the slot, it will be 0x00
        savebuffer_XY[0x1E7FF+(0x15*i)] = 0x3D;
}

This image shows all possible values for the slot status (I know they are bitflags, but this felt more graphic): https://s17.postimg.org/f90hfmrmn/safari.png

What this allows to do:

Altering the friend list to have desired safaris is unrelated to pkhex and I should have left that research outside of this issue, the confusion is my fault and I'm sorry, but altering the friend list will still need the unlock feature for maximum benefit.

I hope everything is clear now.