Jump to content

Recommended Posts

Posted (edited)

Download PWTE 2.1 by Prof.9

==

So far there have been 4 download tournaments and one secret relic tournament locked away in the ROM; I might as well explain where it's at and how most of the important stuff is stored. I spent a little bit of time figuring out enough to get meaningful data out like text and teams, nothing more than that... so here's what I've found so far.

PWT download events are set into the save file in the latter half along with all of the other downloadable content like mystery gifts. The tournament region is 0x7A000-0x7DFFF, for 0x1400 bytes for each tournament * 3 tournaments. By just looking at a downloaded tournament, it's hard to visually see the general structure via a hex viewer because it doesn't display Japanese characters... for visual help, you can use /a/2/5/8 from B2/W2's files, as this was their hard-coded test tournament that has a bit of English text (and wasn't removed for retail release).

0xA-0x54: Tournament Name

~afterwards, there's text for describing the tournament

PKMs are set up to be as compact as possible, skipping nonessential stuff kinda like battle pkms. 52 bytes per PKM (0x34), one after another to make 6.

Structure of PWT-DLC PKMs:
0x0-0x1: Species
0x2-0x17: 11 character namefield (after names, they are usually 0xFFFF aka terminators, not characters)
0x18-0x19: Held Item
0x1A: Shiny Flag (00 or 01) ~ unconfirmed, hasn't been used except for the ROM tournament
0x1B: Ability
0x1C: HP EV
0x1D: ATK EV
0x1E: DEF EV
0x1F: SPE EV
0x20: SPA EV
0x21: SPD EV
0x22-0x23: Move 1
0x24-0x25: Move 2
0x26-0x27: Move 3
0x28-0x29: Move 4
0x2A: gender? ~ unconfirmed. may just be bitflags for stuff
0x2B: Nature
0x2C-0x2F: IVs (stored same way as pkms)
0x30: ??? always 0. might be secondary sparkle like N's
0x31: Ball
0x32: Current Level
0x33: Happiness

0x270: Start of Trainer 1

PKM1: 0x274-0x2A7

PKM2: 0x2A8-0x2DB

PKM3: 0x2DC-0x30F

PKM4: 0x310-0x343

PKM5: 0x344-0x377

PKM6: 0x378-0x3AB

0x3AC-0x3C1 - Trainer Name ~ not sure on the lengths of these

0x3CC-0x3DD - Trainer Class ~ as I haven't seen longer name/classes

Trainer win messages or something afterwards, didn't care enough to determine how they worked.

Next trainer:

0x650: start of trainer 2

0x654: pkm data....

0x3E0 between each trainer block, always 4 trainer blocks

(0x270, 0x650, 0xA30, 0xE10)

0x1400 next tournament... repeats...

0x1670 trainer 1...

0x1A50 trainer 2...

etc.

that's all I know, however there's certain bytes somewhere which make the game use other stuff in the ROM instead of the programmed PKMs or trainer name/class. I just wanted to get the important team sets out so I didn't bother figuring out the entire structure.

===

resources~

Excel Parser ~ paste in tabulated data strings into the proper cells. PKM related lookup tables from Bulbapedia & pkmcodedepo and character tables from here.

Ripped Tournament from the region I mentioned above (7A000-7BFFF). "PWT Download" for the file extension naming

example results from parsing stuff & (rom example)

Edited by Kaphotics
Posted

I found out recently that nintendo offers downloadble tournaments..

so I figure we could make our own tournaments..

this is a very good find and I really hope you can manage to develop a tool to edit tournaments,

or even better, find a way to create PWT files for people to share..

that would be awesome

  • 2 months later...
Posted

I was able to change the name of the new English tournament (before it was reissued) through save hacking:

C13hM.png

Haven't done anything else yet, but I'll probably look into this some more.

Here are my notes:

SAVE OFFSET: 0x7A000

Size: 0x1314 (?)

CHECKSUMS:

0x1210: CRC-16 CCITT of 0x0000-0x1210 (0x1210)

0x1216: CRC-16 CCITT of 0x0000-0x1214 (0x1214)

0x1300: CRC-16 CCITT of 0x0000-0x1214 (0x1214)

0x1312: CRC-16 CCITT of 0x1300-0x1304 (0x0004)

Basically the tournament data has a checksum, then there is a checksum of the tournament data plus the checksum, stored in two places, and finally there's a checksum of THAT checksum.
Posted (edited)

Got tournament injection and removal working:

faZeE.png

Here's how it's done:

Step 1: Copy tournament block

Just write the whole tournament block (0x1314 bytes) to 0x7A000, 0x7B400 or 0x7C800. Make sure all checksums are valid!

See my previous post for notes on this.

Step 2: Set in block index

The block index is located at 0x19400 and 0x3F400. The game uses this to keep track of which extra storage blocks are used. To enable a tournament block after you've inserted it, write 0xC21E to 0x52, 0x54 or 0x56, and take the 32-bit value at 0x1304 in the tournament block and write it to 0xA0, 0xA4 or 0xA8. Afterwards, fix this checksum:

0xB0: CRC-16 CCITT of 0x00-0xB0 (0xB0)

Step 3: Update checksum list

The checksum list is located at 0x25F00 and 0x4BF00. The game uses this to check for corrupted blocks. Basically, take the checksum for the block index from step 2 and write it to 0x36. Finally, fix this last checksum:

0xA2: CRC-16 CCITT of 0x00-0x94 (0x94)

I've been working on a program to modify tournaments. At the moment, it can import and extract tournaments from a save file, as well as dump and load the raw tournament data (i.e. the first 0x1210 bytes of a tournament file); it will take care of all checksumming and stuff automatically. This should simplify tinkering with and experimenting on the data. It's still very much a work in progress, so there's not much to see yet. Source is included (but it's not the neatest thing I've ever written), and you'll need the .NET Framework 2.0 to run it. Hasn't been thoroughly tested, so use at your own risk, I guess.

http://www.mediafire.com/?8xh1eu37aiceb3x

So, time to start collecting those tournament files?

EDIT: Fixed step 2.

Edited by Prof. 9
Fixed step 2
Posted

2012にほんだいひょうにちょうせん - 2012 Japanese Video Games Championship (parse output)

チャンピオン ワタルにちょうせん! - Challenge the Champion, Lance! (parse output)

しゅうけつ!ジムリーダー! - Gathered! Gym Leader!

でんせつの ローテーションバトル! - The Legendary Rotation Battle!

I don't have "The Battle of Legendary Pokémon!" which started Sep 14th.

  • Like 1
Posted (edited)

This seems to be the basic memory layout:

Tournament (0x1210 bytes):

0x0000: Tournament settings (0x274 bytes)

0x0274: Trainer 1 (0x3E0 bytes)

0x0654: Trainer 2 (0x3E0 bytes)

0x0A34: Trainer 3 (0x3E0 bytes)

0x0E14: Trainer 4 (0x3E0 bytes)

0x11F4: ??? (0x1C bytes)

Trainer data (0x3E0 bytes):

0x000: Pokémon 1 (0x34 bytes)

0x034: Pokémon 2 (0x34 bytes)

0x068: Pokémon 3 (0x34 bytes)

0x09C: Pokémon 4 (0x34 bytes)

0x0D0: Pokémon 5 (0x34 bytes)

0x104: Pokémon 6 (0x34 bytes)

0x138: Trainer settings (0x2A8 bytes)

A bunch of tournament settings that I figured out the meaning of:

0x000 = ?

0x001 = ?

0x002 = ?

0x003 = ?

0x004 = ?

0x005 = ?

0x006 = ?

0x007 = ?

0x008 = ?

0x009 = ?

0x00A = Tournament Name (37 characters)

0x054 = Tournament Description (75 characters)

0x0EA = Battle Rules (111 characters)

0x1C8 = Minimum amount of Pokémon required

0x1C9 = Maximum amount of Pokémon allowed (also the amount the opponent will use)

0x1CA = Allowed Level (8-bit)

0x1CB = Level style (0x00 = normal, 0x01 = minimum, 0x02 = maximum, 0x03 = scale down, 0x04 = set, 0x05 = scale up)

0x1CC = Maximum total party level (16-bit)

0x1CE = Allow duplicate Pokémon (1 bit)

0x1CF = Allow duplicate items (1 bit)

0x1D0 = Banned Pokémon (656 bits, 1 bit per species)

0x222 = Banned Items (608 bits, 1 bit per item)

0x26E = ?

0x26F = Battle Type (2 bits) (Single Battle, Double Battle, Triple Battle, Rotation Battle)

0x270 = Use World Champion battle music instead of PWT Finals battle music (1 bit)

0x271 = Allowed Type (8-bit) (if 0x11, all types are allowed)

0x272 = Banned Move (single 16-bit value; only 1 move can be banned (Sky Drop?)?)

Surprising amount of rules you can make with this. 0x26E seems to be always 0 and 0x00-0x09 I can't get any breaks from, so I have no idea what they do.

EDIT: rectified a typo: level style 0x05 should be scale up, not set.

Edited by Prof. 9
fixed typo
Posted

first trainer settings, offsets after the pkm data; trainer data starts at 0x0000

0x138-0x157 - Trainer Name (0x20 bytes)
0x158-0x183 - Trainer Class (0x2C bytes)
0x184-0x217 - Trainer Intro (0x94 bytes)		~ close each entry with 00 F0 01 BE 00 00 then pad with FF
0x218-0x2AB - Trainer OnDefeat (0x94 bytes)		~ ^.. might be "wait for A button press to continue"
0x2AC-0x33F - Trainer OnVictory (0x94 bytes)		~ ^
0x340-0x3D3 - Trainer Extra? (0x94 bytes)		~ ^
0x3D4-0x3DF - Flag Settings

note: 0xFFFE (FE FF) stands for line break

You can do editing of the tournament in the RAM if you choose so. Upon accessing the PWT Tournament menu, t_download_save.c brings up the tournament; the data for the tournament begins at (english offsets)

Bot Tournament: 0x02293BE8 w2 / 0x02293BC8 b2

Mid Tournament: 0x02294E28 w2 / 0x02294E08 b2

Top Tournament: 0x02296068 w2 / 0x02296048 b2

0x1240 gap between tournaments positions, because there's stuff right before the data itself (t_download_save.c)

That way you can make changes on the fly instead of editing the save file each time you want to tinker with an unknown byte. With that said, there has to be a setting to choose what sprites to use (would special music be set too for the Region Leaders?), and if trainers tend to use certain combinations for their team. There's 4 slots for trainers and data, there has to be a flag that signifies either a trainer or PKM isn't used. Also, the whole "rigging" of the tournament for opponents.

Posted

There must be a flag which determines if the game displays the texts from the downloaded data or something from the ROM.

Also, in some tournaments it's completely random which trainer is the final opponent and sometimes it's always the same person (in the WCS one for example).

Posted
damn, why after the gts exploit, they find funny to secure any kind fo connection*sarcasm*

GTS exploit was working in Gen IV, then they find it funny to not fix the exploit when releasing Gen V. ;)

Posted
GTS exploit was working in Gen IV, then they find it funny to not fix the exploit when releasing Gen V. ;)

it could be cool if you could emulate the server for many stuff(i dont really care DW as it is fun the way it is, but PWT is another story)

i think that if in Gen VI they dont fix it its because they find it funny

Posted
2012にほんだいひょうにちょうせん - 2012 Japanese Video Games Championship (parse output)

チャンピオン ワタルにちょうせん! - Challenge the Champion, Lance! (parse output)

しゅうけつ!ジムリーダー! - Gathered! Gym Leader!

でんせつの ローテーションバトル! - The Legendary Rotation Battle!

I don't have "The Battle of Legendary Pokémon!" which started Sep 14th.

Hello everybody, this is my first post here! First of all, sorry for my English, I'm Italian.

I'm trying to use these Japanese Tournaments in my Italian White2, they all work fine except for "The Legendary Rotation Battle!". Before the main menu appears, there is a message that can be translated into "PWT data has been erased" or something like that. If I have other tornaments in my save file, only "The Legendary Rotation Battle!" gets erased.

I used Prof. 9's PWTEditor to import the .pwt files.

Any ideas? :)

  • Like 1
Posted (edited)
Hello everybody, this is my first post here! First of all, sorry for my English, I'm Italian.

I'm trying to use these Japanese Tournaments in my Italian White2, they all work fine except for "The Legendary Rotation Battle!". Before the main menu appears, there is a message that can be translated into "PWT data has been erased" or something like that. If I have other tornaments in my save file, only "The Legendary Rotation Battle!" gets erased.

I used Prof. 9's PWTEditor to import the .pwt files.

Any ideas? :)

Turns out one of the things I listed in Step 2 of tournament insertion wasn't entirely correct, I was just writing 0x00000001 to 0xA0/0xA4/0xA8 but the game expects what I think is the savecount of the tournament datablock to be there, and the savecount for Legendary Rotation Battle was 2 for whatever reason. It should be fixed in the new PWTEditor (see below).

I've been working on my PWT editor a bit and you can now change basic stuff like descriptors, rules and banlists in a cramped GUI. Can't edit trainers yet though. I've tried to make it impossible to set impossible rules like 6 Pokémon minimum with max total party level 1, or a higher minimum required amount of Pokémon than the maximum allowed.

PbTR5.png

Download PWTEditor v0.2.1 (source included): http://www.mediafire.com/?tq2gh4v5w0mtn2a

I should think of a better name for this.

Edited by Prof. 9
Posted

Did you figure out more data yet?

Like this:

There must be a flag which determines if the game displays the texts from the downloaded data or something from the ROM.

Also, in some tournaments it's completely random which trainer is the final opponent and sometimes it's always the same person (in the WCS one for example).

Posted

Unused ROM Tournaments (WCS2011)

pwt%20b.pngpwt%20juniorb.pngpwt%20seniorb.pngpwt%20masterb.png

Backstory (meh):

Back when B2W2 first came out, I noted that there was an unused narc that contained data for WCS2011 tournaments, a/2/5/8. It is inaccessible in game, but I managed to parse the data it contained.

Interestingly enough, the file format is not too far off of the Download Tournaments. So... I converted the unused ROM tournaments to actual raw download files, then using Prof. 9's program I got them out as the .pwt files :)

There was 12 tournaments in the narc. Juniors, Masters, and Seniors all had tournaments -- one is the standard, then the other is an edited (toned down) version. Then there's duplicates of the first 6.. so I omitted those.

Lots of things are messed up (sprites, text..), because it was never set/polished. Just a heads up :P

Posted (edited)

0x3D4-0x3DF    Trainer Settings

0x3D4 - Trainer Sprite

0x00	Youngster
0x01	Ace Trainer
0x02	Pokémon Ranger
0x03	Pokémon Breeder
0x04	Researcher
0x05	Hiker
0x06	Skinhead
0x07	Day-Care student
0x08	Lass
0x09	Ace Trainer (Female)
0x0a	Pokémon Ranger (Female)
0x0b	Pokémon Breeder (Female)
0x0c	Researcher (Female)
0x0d	Parasol Lady
0x0e	Nurse
0x0f	Day-Care student (Female)
0x10	Hiker (Young Male)
0x11	Hiker (Young Female)
0x12	Veteran (Male)
0x13	Veteran (Female)
0x14	Schoolkid (Male)
0x15	Schoolkid (Female)
0x16 Psychic (Male)
0x17 Psychic (Female)
0x18 Karate (Male)
0x19 Karate (Female)
0x1A Business (Male)
0x1B Business (Female)
0x1C Book Girl (Female)
0x1D Maid (Female)

there's more...

Sometimes the ones after schoolkid don't work... dunno why yet.

The rest of this region determines their sayings as well!

0x3D5 - Greeting Text

0x3D6 - Loss Text

0x3D7 - Win Text

0x3D8 - InBattle Loss (displayed at end of battle)

0x3D9 - InBattle Win (displayed at end of battle)

0x3DA - Announcer Text

0x3DB - ???

Here's a list of the sayings sorted for each saying group. From /a/0/0/2_408 text file.

There's 8 different groups but only 7 are set... dunno :\

The others might just be Win/Loss/Greeting settings if the G/L/W aren't set to 0.

For the sake of editing, 3D5/3D6/3D7 should be set by the player, thus be 0. The only thing that isn't set is the Announcer Text, which can also be set to 0 since it calls the "Trainer Extra" (at the time I didn't know its function).

So essentially all of these could be set to 0 and defined by the Editor.

0x3DC-0x3DF - ??? ~ no idea what this does.

The 0x1C settings at the end is what allows the special names/sprites as seen in the Lance & Gym leader tournaments. I copy pasted the Gym Leader one onto the VGC and their names & sprites changed, also their Sayings changed too. So it looks to override it with a hard coded response.

Looking at the 0x1C of the Gathered Gym leaders, we see:

02 05 16 00 02 05 21 00 02 05 29 00 02 05 35 00 01 01 00 00 01 01 00 00 01 01 00 00

break it down into chunks:

02 05 16 00 
02 05 21 00 
02 05 29 00 
02 05 35 00 

01 01 00 00 
01 01 00 00 
01 01 00 00

You can see that 4 trainers are called up.

I went to my PWT parse of the in-game teams of the trainers, and it just so happens that they follow the same order.


edit: it appears as if this list is off
0	N/A 
1	Cheren
2	Roxie
3	Burgh
4	Elesa
5	Clay
6	Skyla
7	Drayden
8	Marlon
9	Bianca
A	Chili
B	Cress
C	Cilan
D	Lenora
E	Brycen
F	Blue
10	Lance
11	Steven
12	Wallace
13	Cynthia
14	Alder
15	Brock
16	Misty
17	Lt. Surge
18	Erika
19	Sabrina
1A	Blaine
1B	Giovanni
1C	Falkner
1D	Bugsy
1E	Whitney
1F	Morty
20	Chuck
21	Jasmine
22	Pryce
23	Clair
24	Janine
25	Roxanne
26	Brawly
27	Wattson
28	Flannery
29	Norman
2A	Winona
2B	Tate
2C	Liza
2D	Juan
2E	Roark
2F	Gardenia
30	Fantina
31	Maylene
32	Crasher Wake
33	Byron
34	Candice
35	Volkner
36	Red
37	Hilda
38	Cheren? Should be Hilbert. Maybe 37 is opposte protag.
39	Rival
3A	Colress
the rest are just regular trainers, 3B	Castor...

02 05 16 00 == 0016 = Misty
02 05 21 00 == 0021 = Jasmine
02 05 29 00 == 0029 = Norman
02 05 35 00 == 0035 = Volkner

01 01 00 00 
01 01 00 00 
01 01 00 00

-- double confirming this with Lance's tournament:

02 05 10 00 == 0010 = Lance
02 03 1F 00 == 001F = Morty
02 03 18 00 == 0018 = Erika
02 03 1E 00 == 001E = Whitney 
01 01 00 00
01 01 00 00 
00 01 00 00

The game takes the text from the ROM, so you can't change the name and sayings on a Download Tournament.

Edited by Kaphotics

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