Jump to content

Pokémon Black & White Entralink Forest tool 0.1 --> dream pokemon wondercard-like! (Arceus event included)


Recommended Posts

  • Replies 54
  • Created
  • Last Reply

Top Posters In This Topic

Posted

Great work!

Are you also planning to include items? Well they are not stored in the efd data file but they belong to the forest and so are also a "lost feature". Though they are not that important, but it would be nice.

Items	0x1D3E4 (20 x 2 bytes)
Amount	0x1D40C (20 x 1 byte)	max. per item was 20 pieces

Posted (edited)

I wasn't planning to add items, but give how easy the structure is, I might as well add it even though pokéstock also has them. Are those offsets for BW1 or BW2?

ps: I've re-discovered (or so I've been told) how the keys in the key system are stored in the savegame.

EDIT: Key system structure (block 69)

The first 0x27 bytes hold data regarding black tower and treehollow unlocked areas. Still need to be mapped.

0x00-0x07 - Unknown
0x08-0x17 - Seems always 0x00
0x18-0x27 - Unknown
0x28 - Easy key (W) 				- 0x00035691
0x2C - Challenge key (B) 			- 0x00018256
0x30 - Tower Key (B)/ Treehollow key (W)	- 0x00059389
0x34 - Iron Key (B) 				- 0x00048292
0x38 - Iceberg Key (W)  			- 0x00009892
0x3C - Easy mode unlocked			- 0x00093389
0x40 - Challenge mode unlocked 			- 0x00022843
0x44 - Black City / White forest unlocked 	- 0x00034771
0x48 - Iron chamber unlocked 			- 0x000AB031
0x4C - Iceberg chamber unlocked 		- 0x000B3818
0x50 - Difficulty config (easy 0x00031239 | normal 0x00015657 | challenge 0x00049589)
0x54 - Black city/White city config (black city 0x00034525| white city 0x00011963)
0x58 - Chamber config (rock 0x00094525 | iron 0x00081963 | iceberg 0x00038569)
0x5C - Unique ID used to xor the keys (also present in memory link block)
0x60 - Counter
0x62 - ccrit checksum

To store a key/unlock in savegame, the u32 value needed is Unique ID xored with the key seed.
For some reason they used the same slot for the Tower/Treehollow key, but the chamber key and difficulty key each have their own slots, allowing a single save to hold 5 keys, and probably that allows impossible transfers, like a black 2 game transfering the easy key or the iceberg key. As I only have 1 cartridge and this uses the IR feature, I can't test (but there's really no need).

Edited by suloku
Posted

Thanks, I'll try looking into it. Since it was easy, I've coded the key system editor, it is already on github. Should I make a thread? Some of the editors aren't still fully functional, but the block dumper/injector, checksum verify/update and key system editor are complete (unless I add more things).

Btw it now accepts sav/dsv files, but only outputs as raw sav.

  • 3 weeks later...
  • 2 months later...
Posted

No, dev on the tool is stalled for now. You can use ppkecgear or pikasav, they both allow entralink forest editing.

My ultimate goal for entralink editing is to have a "legal" mode were you can only insert pokemon you could actually get on dream world or pgl events like arceus (I'd need some info on the later though, not sure if those are always added to the special section of the forest or what...but once captured they all have the same characteristics though).

Posted

I already used both of them and successfully inserted all moving pokemons (animation no.4-randomly walking) using pokecgear and hex editor. But these editors don't provide any option for unlocking forest area 8.

Posted

Mine will be able to, but saving changes to forest is still not implemented. I wonder why those don't allow area 8 unlocking, was that area legitimately unlockable when dream world was running?

Posted

I think Pikaedit allowed editing of the Entree forests.

Not sure if I can find it, but I previously created a file with all the encounters from Dream World, waiting in Entree Forest.

edit:

pikaedit and attachment with entree forest stuff (the phl file)

(hopefully this helps)

Posted
Mine will be able to, but saving changes to forest is still not implemented. I wonder why those don't allow area 8 unlocking, was that area legitimately unlockable when dream world was running?

I never got chance to use the dream world feature when it was working. I only have limited knowledge about its features. Therefore I only use editor to insert pokemon in the entree forest.

Posted

So, here is a small guide, I hope it is understandable. If something is unclear don't hesitate to ask. I'll try to improve the guide.

Be sure to keep a backup of your file! I'm not responsible for any damage!

How to edit the Entralink Forest

Structure

General Structure

0x000 - 0x84B   encrypted data
0x84C - 0x84F   initial encryption seed
0x850 - 0x851   update counter
0x852 - 0x853   checksum from 0x000 - 0x84F (CRC16-CCITT)
0x854 - 0x8FF   unused (filled with 0x00 or 0xFF)

Decrypted Data Structure (0x000 - 0x84B)

3 x 20 Pokemon in each area from 1 - 8.
3 x 10 Pokemon in 9th area.
20 Pokemon in the deepest area.

0x000   deepest area
0x050   9th area center
0x078   9th area left
0x0A0   9th area right
0x0C8   1st area center
0x118   1st area left
0x168   1st area right
0x1B8   2nd area center
0x208   2nd area left
0x258   2nd area right
0x2A8   3rd area center
0x2F8   3rd area left
0x348   3rd area right
0x398   4th area center
0x3E8   4th area left
0x438   4th area right
0x488   5th area center
0x4D8   5th area left
0x528   5th area right
0x578   6th area center
0x5C8   6th area left
0x618   6th area right
0x668   7th area center
0x6B8   7th area left
0x708   7th area right
0x758   8th area center
0x7A8   8th area left
0x7F8   8th area right
0x848   unlock area 9 (0x01 to unlock)
0x849   unlock areas 3 - 8 (0x01 - 0x06) (area 1 & 2 and the deepest area are unlocked by default -> 0x00)
0x84A   0x00
0x84B   0x00

Pokemon Structure (4 bytes)

Bits
00-10   species
11-20   special move
21-22   gender (0 -> male, 1 -> female, 2 -> genderless)
23-27   form (see below)
28-31   animation (see below)

Forms

Unown
0 A
...
25 Z
26 !
27 ?

Deoxys
0 Normal
1 Attack
2 Defense
3 Speed

Burmy/Wormadam
0 Plant
1 Sand
2 Trash

Shellos/Gastrodon
0 West
1 East

Rotom
0 Normal
1 Heat
2 Wash
3 Frost
4 Fan
5 Mow

Giratina
0 Altered
1 Origin

Shaymin
0 Land
1 Sky

Basculin
0 Red
1 Blue

Deerling/Sawsbuck
0 Winter
1 Spring
2 Summer
3 Autumn

Meloetta
0 Aria
1 Pirouette

Animations

0	randomly turning around
2	randomly walking
4	randomly walking
6	walking up/down
8	walking left/right
10	walking left/right and randomly looking up/down
12	turning around clockwise
14	turning around counterclockwise
All odd numbers are invalid for animations and will make the Pokemon invisible.

Dumping the data

The data is stored at the following offsets in the save files.

BW 0x22C00 - 0x234FF

B2W2 0x22A00 - 0x232FF

The whole block has a size of 2304 (0x900) Bytes, but only offset 0 - 0x853 are used. The rest is filled with 0x00 or 0xFF.

If you used suloku's tool, you got the whole block. Though keep in mind that the tool currently only works with BW!

If you extract it manually with an hex editor you need to decrypt the data before it can be edited.

Decryption/Encryption

The initial seed is taken from the data at 0x84C - 0x84F.

New seeds are calculated via the LCRNG algorithm.

The upper 16 bits of the new seeds are XORed against the data (0x000 - 0x84B) (as words) to encrypt/decrypt.

seed = (0x41C64E6D * seed + 0x6073);
data = data ^ (seed >> 16);

Editing Pokemon

See Bulbapedia for lists of Pokemon from each of the DW Areas Dream World Areas (available Pokemon).

Pokemon that were never available in the DW can technically be in the Entralink Forest too. Though not every Pokemon has an overworld sprite in the 5th generation games. Those will get a generic sprite of some guy.

Each Pokemon consists of 4 Bytes which are structured in Bits.

The Bytes are stored Big Endian so you have to reverse them before you can edit them (AA BB CC DD becomes DD CC BB AA).

Convert these Bytes into Bits and you will get the following structure.

[color="#800080"]0000[/color][color="#008000"]0000 0[/color][color="#FFA500"]00[/color][color="#0000FF"]00000 00000[/color][color="#FF0000"]000 00000000[/color]

Bits (counted from right to left)
[color="#FF0000"]00-10[/color]   species
[color="#0000FF"]11-20[/color]   special move
[color="#FFA500"]21-22[/color]   gender (0 -> male, 1 -> female, 2 -> genderless)
[color="#008000"]23-27[/color]   form
[color="#800080"]28-31[/color]   animation

To edit a Pokemon you take the index number of it's species or special move and convert them to Bits.

Take the lower 11 Bits from the species index and the lower 10 Bits from the move index and put them at the corresponding place.

Do the same for gender, form and animation.

For the indexes refer to Bulbapedia Pokemon by index number Moves by index number

Forms and animations are listed in the structure above.

Example:

I want to create a randomly walking male Ralts with Destiny Bonds.

Species index is 280 (0x0118) which is 00000001 00011000 in Bits.

Move index is 194 (0x00C2) which is 00000000 11000010 in Bits.

Gender is male so I keep those Bits 00

Animation should be randomly walking which is 2 and in Bits 0010

I can put them into the right structure now and get this: 00100000 11000010001 00011000

I convert the Bits to Bytes and get 0x01 0x06 0x11 0x18 and reversed (remember Big Endian!) 0x18 0x11 0x06 0x01.

This can be inserted into one of the forest areas. For example at offset 0x1C4 to insert it into a slot in the center of the second forest area.

Unlocking Forest Areas

Area 1 and 2 are unlocked by default, if you want to unlock the remaining 6 areas you have to edit offset 0x849. Just set it to the number of areas that you want to unlock.

If you want to unlock them all, set 0x849 to 0x06. Don't try any higher number, it will break your game!

There's a special 9th area which can be unlocked by setting offset 0x848 to 0x01.

Inserting the forest data into the save file

Once you have edited what you want you can insert the data back to your save file.

First you need to re-encrypt the decrypted data section (see above). Then you have to fix the checksum of the encrypted data by calculating a CRC16-CCITT from offset 0x000 - 0x84F.

If that is done insert the data back to your save file at the following offset.

BW 0x22C00 - 0x234FF

B2W2 0x22A00 - 0x232FF

Finally fix the checksums of your save file and you are done!

Posted

I don't understand how to decrypt the forest data. It is difficult for me. Can you please tell me how to do this. The of hex data at 0x84C - 0x84F is 'b0 65 7e fe' . Please give some more examples for the Decryption of encrypted data.

Posted
I don't understand how to decrypt the forest data. It is difficult for me. Can you please tell me how to do this. The of hex data at 0x84C - 0x84F is 'b0 65 7e fe' . Please give some more examples for the Decryption of encrypted data.

Well, doing the decryption manually probably isn't a good idea. You could do that but it probably takes a long time.

I attached a tool I made a while ago. You can use it to decrypt/encrypt your file. Simply drag and drop your file onto the exe. Checksum will also be fixed, so the file is ready for injection.

Currently it doesn't detect if your file is decrypted or encrypted. But if you look at the hex data and see many zeros (pr at least 0x84A and 0x84B if your forest is full) it is decrypted. Otherwise it's encrypted.

Use it in the mean time until suloku adds encryption to his editor.

Posted
How many 5th gen pokemon sprites are available in entree forest?

Good question, they made a few for BW2, don't really know if they made more than just the ones available at dream world. What happens when putting a species that doesn't have a sprite?

I don't understand how to decrypt the forest data. It is difficult for me. Can you please tell me how to do this. The of hex data at 0x84C - 0x84F is 'b0 65 7e fe' . Please give some more examples for the Decryption of encrypted data.

I'm re-starting work on my tool, for now just gonna try finishing the entralink forest editor as I have little free time, if you really want to manually edit, I can upload a binary of the current build (allows to dump/inject and decrypt/encrypt any block from the savefile). The source has been on github since... february? but there was no binary.

Other features I wanted to add might slowly come through the year (my free time is gonna be drastically reduced starting july until february).

Posted
Good question, they made a few for BW2, don't really know if they made more than just the ones available at dream world. What happens when putting a species that doesn't have a sprite?

As BlackShark mentioned in his post #44. When I was trying to insert some 5th gen pokemons 'a generic sprite of some guy' appear but the function of that pokemon doesn't have any changes. I also checked every pokemons from 1 to 4 gen and each one of them have their own sprites.

Posted
As BlackShark mentioned in his post #44. When I was trying to insert some 5th gen pokemons 'a generic sprite of some guy' appear but the function of that pokemon doesn't have any changes. I also checked every pokemons from 1 to 4 gen and each one of them have their own sprites.

Here's an image of all the overworld sprites in 5th generation http://www.spriters-resource.com/ds/pokemonblackwhite2/sheet/48050/

Here's a list of Unova Pokemon that have overworld sprites. Only 53 are available.

Watchog

Herdier

Liepard

Pansage

Pansear

Panpour

Pidove

Zebstrika

Boldore

Woobat

Drilbur

Audino

Gurdurr

Tympole

Throh

Sawk

Leavanny

Scolipede

Cottonee

Petilil

Basculin (Red/Blue)

Krookodile

Maractus

Crustle

Scraggy

Sigilyph

Tirtouga

Garbodor

Minccino

Gothorita

Duosion

Ducklett

Vanillite

Emolga

Karrablast

Alomomola

Galvantula

Klang

Elgyem

Litwick

Axew

Cubchoo

Shelmet

Stunfisk

Mienfoo

Druddigon

Golett

Pawniard

Bouffalant

Braviary

Mandibuzz

Heatmor

Durant

Posted (edited)

Really useful to know the 53 available sprites for BW2.

I've added preliminary entralink forest editing, I'd like to complete the following todo list before a formal release, but If someone is really interested I can send a binary.

To do:

- Add gender filters --> DONE

- Add form filters and text for those pokemon with forms --> DONE

- Add no-sprite warning for those pokemon without sprite --> DONE

- Add "dream world emulation" (easy buttons to add legit dream pokemon)

- Add import/export buttons for whole forest (decripted, efdd file) and areas (pokeCgear/pikasav phl format) --> DONE. Also note that encripted forest can be dumped/injected via the block dumper in the tool, but I see no point in encrypted data right now.

http://puu.sh/pstmD/b2b132044b.png

Edited by suloku
Posted (edited)

Ok, some progress news:

The editor is finished as far as no bugs are found: http://puu.sh/ptrUi/93686b3fa6.png

But I've only implemented pokemon cafe forest data so far for testing. What remains to be done? Create the databases for the other 7 areas. This means creating arrays with pokemon ID number, the 3 ID moves they can have and if they are gender restricted. It is an easy but tedious job, I hope I can finish today, but not sure about it.

There's also the BW1 and BW2 differences, I think I'm gonna add a text note instead of making separate lists since it's only 1-2 different pokemon per area, maybe add a warning prompt or something, or disable the OK button if the selected pokemon is BW1 and save is BW2.

Also, I'd like to add buttons for the PGL pokemon (http://bulbapedia.bulbagarden.net/wiki/List_of_Pok%C3%A9mon_Global_Link_promotions/Pok%C3%A9mon)

As far as I know these PGL promotion pokemon were added to the forest. I think they didn't even have special moves, they just had fixed gender. I don't know if I should make the animation random (I made so for the "dream world simulator") or make it be 0, as the legit arceus I have has 0 as animation. I recall downloading some of the event pokemon in phl format, supposedly they were dumped from real distributions, but maybe they were just created with pokeCgear.

Any info would be apreciated.

Also, if someone is willing to provide a list with the Dream World exclusive moves in the following format, I'll add a marking to the move to make it clear that it is a dream world eclusive move.

Format I'd need:

dream world area - pokedex number - Pokemon - move - move ID (in decimal)

(move id: http://bulbapedia.bulbagarden.net/wiki/List_of_moves)

Bulbapedia classifies the 3 possible moves in A, B and C maybe we are lucky and the dream world exclusive move is always in the same slot? That would make things easier.

I think I've covered everything regarding entralink forest.

ps: as I already stated, I don't see any point in ading an entralink item editor, there's nothing really exclusive to having items there, one can just add them to the inventory with pokegen. pokeCgear can edit those if someone is really interested.

EDIT: excel magic is gonna speed up the process A LOT since I realized I can convert pokemon names to ID and move names to move index number by copy pasting bulbapedia.

EDIT 2: well, excel magic is really something, I already finished addnig all dream world pokemon! It was way quicker than expected thanks to excel batch functions to get the needed arrays. Now I'll add the pokemon global link promotions and everything should be set.

Also, I've searched a little and seems that attacks go like this:

A: standard attack, the pokemon can learn via level up

B & C: can't be learnt via level up

* B: it usually seems to be an egg move

* C: I've seen it as egg move, but when it's not an egg move, seems to be the dream world exclusive move.

EDIT 3: @BlackShark, I've opened the forest file attached to the first post and I've just noticed that there are pokemon with movement set up to 28. I haven't seen anything higher, but supposedly the forest is from legit dream world downloads.

EDIT: nevermind, probably it's a bug in my reading code, assumed it was correctly working, which it isn't as it is obiously reading more than 4 bits.

Also, I've finished implementing PGL promotions, but I need to check if the resulting pokemon have the attacks they are supposed to have. Also, it seems those pokemon go to area9, so maybe I'll restrict it so they can only be added to area9... what do you think? Maybe I'll just add a warning if user is not in area 9.

EDIT4: The save I have has a couple PGL pokemon in the "standard" areas (I know because those don't have a special move assigned). I guess the only one that made it to area 9 was arceus?

EDIT 5: all done

EDIT 6: Full tool released here: https://projectpokemon.org/forums/showthread.php?48943-GEN-5-Generation-5-save-tool-entralink-medals-join-avenue-and-others-not-in-pokegen

Edited by suloku

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...