Jump to content

Recommended Posts

Posted

It's just a bitfield which distributes 510 EVs to the enabled stats.

If you have 1 enabled, that stat gets 255 (0xFF, the max) 510/1=510 (exceeds max)

If you have 2 enabled, each stat gets 255 (0xFF, the max) 510/2=255

If you have 3 enabled, each stat gets 170; 510/3=170

4 -> 510/4 = 127.5 (floor it, 127)

5 -> 510/5 = 102

6 -> 510/6 = 85

EV byte to binary -> 76543210

bit 0 flagged = HP flagged

bit 1 flagged = Atk flagged

bit 2 flagged = Def flagged

bit 3 flagged = Spe flagged

bit 4 flagged = SpA flagged

bit 5 flagged = SpD flagged

anything greater than 0x40 has bits 7 and 6 flagged, which are unused. The game only considers bits 0-5

:)

For rosters, certain groups are allotted certain PKM choices.

Pretty sure andibad has an editor for subway PKM's as the format is the same as PWT's.

Posted (edited)
  PKMNTrainerNick144 said:
It's only a viewer Andibad has up. He hasn't released the version where you can edit the trainers/PKMN yet.

you really need this? just waiting until i have freetime (maybe after April) ... i will rewrite them from start since i used new structure ... i was think to make them able edit single file, read from folder, narc file, linked narc file... for rom , the problem is from unpack content into a place, since pokemon BW2 is huge, is not effective for your hard disk life.

  Kaphotics said:
Pretty sure andibad has an editor for subway PKM's as the format is the same as PWT's.

is same as battle frointer and tower from HGSS and DPPt, but is have extra useless byte, is safe to delete them.

Someone already figure out encrypted text on a/0/0/2 ?

yeah that encrypt method only apply on ascii character only ... , i was already done with this on january, but i not share them since i need test on eroupe ROM. is just shift binary only.

Bianca , why is not encrypted?

Bianca, this text have 6 char, Encrypted text is only accept if that odd number of character and not more than 6, if is more than that it will splited into two. Since "bianca" have 6 char, last char "a", split that. so you will get "bianc" a, and now bianc is now odd? but on encrypted text we need 00F1 and last key, so is need 3 byte more, "bianc" is 5, total 8? o this part must odd number of character so last char of "bianc" must split again become "bian" c a, since "bian is odd actually we need not odd, so "bia" "nc" "a", is not possible to do with that text since "nc" is not same char. if is same char like Jho nn y ("nn" will used a script \xabcd), is possible to encrypt that.

If you already basic of that so now how to de-crypt that encrypt char?, copy that encrypted text on hex editor (on unicode code), 00F1 always on first 2 byte, and last byte is a key, after 00F1 is key too also is first char of text. For odd number of character, is always have \xabcde, a = is double or not, bcde is charset or other attribute. before that script is always a key for char set 1, after tat script is last char (encrypted) with own key.

example : 00 F1 47 E4 D4 71 43 E7 (燔)

let's substring into 3 part :

part 1 : 00F1

part 2 : 47 E4 D4 71 43

part 3 : E7

part 3 convert into bit : E7 --> 1110 0111

every byte >>n+1 (n = 0)

47|    +|0100 0111|-
E4|   0+| 111 0010|-0
D4|  01+|  11 0101|-00
71| 011+|   0 1110|-001
43|0111+|     0100|-0011
E7 (1110 0111)

is Grunt (4772756E74)

well is no need to give a tutorial to de-crypt or en-crypt back that text completely since someone was already done to make all list (5 part is encrypted on a/0/0/2 is 53, 180, 368, 382, 409)

Edited by Andibad
Posted

Nice stuff for Battle Subway/PWT, very useful.

But still there is a lot of stuff that really bothers me and i personally never found out, these are:

- The 'banned list' e.g. most of the legendaries are not allowed(YES, I WANT TO USE SOME OF THEM!)

- Player & AI's Maximum Pokemon Slots(Currently are 3v3 only in singles and 4v4 doubles i believe)

- Level Cap of 50. WHY NOT 100? DANG IT!

- Something is missing...

Anyone has an idea of where i can start searching the files/narcs or even in the hex editor?

Posted
  Bowlingwater said:
Nice stuff for Battle Subway/PWT, very useful.

But still there is a lot of stuff that really bothers me and i personally never found out, these are:

- The 'banned list' e.g. most of the legendaries are not allowed(YES, I WANT TO USE SOME OF THEM!)

- Player & AI's Maximum Pokemon Slots(Currently are 3v3 only in singles and 4v4 doubles i believe)

- Level Cap of 50. WHY NOT 100? DANG IT!

- Something is missing...

Anyone has an idea of where i can start searching the files/narcs or even in the hex editor?

search on overllay or arm9, better check on pp.org wiki, and to trace that on ram, and assembly that O.o

using lua script from kaphotics to trace ram more easy (since it will read a specific offset, so is readable for you)

Posted

you might want to try these:

  Reveal hidden contents

idk exactly what makes up the list, but if it matches the legendary list, you might have some luck.

other than that, that stuff would need to be changed twice, once for the battle subway overlay set and once for the pwt overlay set.

Posted
  Andibad said:

For a/2/1/2 (Trainer list) :

Example :

307 – 314 are Masters Ingo (58) & Emmet (66)

Structure :

  • Single battle 21 win streak Ingo

  • Single battle 21 win streak Emmet

  • Single battle 48 win streak Ingo

  • Single battle 48 win streak Emmet

  • Double battle 21 win streak Ingo

  • Double battle 21 win streak Emmet

  • Double battle 48 win streak Ingo

  • Double battle 48 win streak Emmet

Double battle 48 win streak Emmet :

Trainer classes

How many pokemon on this trainer

Pokemon list id
(from a/2/1/1)

You can see on
http://serebii.net/blackwhite/battlesubway.shtml

fact pokemon list id is can handle 65535 pokemon since used 16 bit.

I managed to add 2 more slots to Emmett's list... but how I fix the Pokemon list ID?

edit: nevermind... i figured out how... thanks to your pwt/subway viewer once again.

Posted (edited)
  PKMNTrainerNick144 said:
I managed to add 2 more slots to Emmett's list... but how I fix the Pokemon list ID?

6600 0200 6C01 8503 ...

6600 0400 6C01 8503 aaaa aaaa ...

remember is add new byte, you need unpack narc content.

016C (364) --> a201304041342000.jpg

aaaa id is from a/2/1/1

Edited by Andibad
  • 4 weeks later...
Posted (edited)

well today i try to documented my research on item BW and BW2. This Thread , it will moved in here, later ..

Narc : a/0/2/4 - Item (BW/BW2)

1. Sell/Buy value

  Reveal hidden contents
  Reveal hidden contents

3. Gain percentage (depend on effect id)

  Reveal hidden contents

4. Berries Effect and other

  Reveal hidden contents
  Reveal hidden contents

5. Attribute and effect of items

  Reveal hidden contents
  Reveal hidden contents
  Reveal hidden contents
  Reveal hidden contents
  Reveal hidden contents

6. Recover/Remove bad status effect on pokemon (depend on effect id)

  Reveal hidden contents

7. On battle effect (?)

  Reveal hidden contents
  Reveal hidden contents

8. EV Increase or Decrease on stat

  Reveal hidden contents

9. HP, PP and happiness offset (if you change the id effect, some of them will ignore this part~)

  Reveal hidden contents
  Reveal hidden contents
Edited by Andibad
fixed
  • 4 weeks later...
  • 2 weeks later...
Posted

it's hypocritical of me to be posting in here, but someone asked me to add a minor feature to my nature adjustor, and i figured out something minorly useful. to change the max EV total, go to 0x201E980 and have a look. you'll see 0x000001FE in ram. that's 510. change it to whatever you want in the arm9.bin @ #(201E980 - 2004000) or use an AR code to change it in ram.

  • 1 month later...
Posted

someone asked me a bunch of questions that i couldn't answer, so i started reading through code. anyway, one of the things i picked up is that a/1/7/2 is for route connectors. each of those 124-byte files defines all the relevant data for the connectors. the other thing i did was take apart save block 37:

Member	Offset	Size	Use
RTC Offset	0x0	8	"RTC offset" is the change in seconds (positive or negative) of the time since the last boot- for tracking player clock changes
Birthday Month	0xE	1	Save owner's birthday month
Birthday Day	0xF	1	Save owner's birthday day
Adv Time Blk Init	0x10	4	Indicates that the adventure time block is ready/initialized
Year	0x14	4	Current year
Month	0x18	4	Current month
Day	0x1C	4	Current day
Weekday	0x20	4	Current weekday
Hour	0x24	4	Current hour
Minute	0x28	4	Current minute
Second	0x2C	4	Current second
Datetime Days	0x30	4	Current datetime days(days since 1/1/2000)
Newgame Datetime Seconds	0x34	8	Datetime seconds on new game boot(seconds since 1/1/2000 up to new game boot)
Datetime Seconds	0x3C	8	Current datetime seconds (seconds since 1/1/2000)
Minutes in Day	0x44	4	The total number of minutes that have passed in the given day:  counts down from 1440 to 0 - this only works if you reset and load a save.  savestates break this for obvious reasons.


block 37(0x25)			

  Reveal hidden contents

also fyi:

don't use script flags 0-99 or const vars 4000-4031. they are reinitialized on each boot.

  • 2 weeks later...
Posted

the reason the game loads immediately when you pick your save, but takes awhile to save when you're done, is that the savegame is read as a contiguous 0x26000 byte file into memory and written in blocks back to the save- 1 block at a time, 74 blocks total.

e: other general save info:

  Quote

0220528C is the list of blocks in the save.(74 total)

struct SaveBlockInfo {

u32 blkNum; //block count in hex(0-49)
u32 blkSize; //size of block in the save
u32 blkOffset; //offset into the save file

};

the game reads these numbers by doing block_address = blkNum * 12 + blk_base(220528C) to get the block to seek to then using block_address + 4 and block_address + 8 to get the desired info. then they add either the offset into the save file to the address of the save file in ram to decide where to read data from.

also, the block size doesn't always correspond with subtracting the offset of the next save block with the current one. that means there's extra unused space between some blocks. it would be trivial to use this for implementing new features.

when the game boots, a function runs that pulls from the save data info table @ 0x208F18C. the table is 73 entries and each is a struct like so:

typedef void (*SaveFn)(void);

struct SaveBlockInit {

int blkID;
SaveFn blkSize;
SaveFn callback;

};

basically, one function goes through and builds the table @ 0x220528C using the blkSize function pointers and some simple math. a second function iterates through all 73, running the callbacks one after the other to prepare the blocks for play. the 74th block is checksums.

this is actually really good news because it means that extending the size of a save block is as easy as changing that block size value to something bigger and then writing to the rest of the space. the only issue is that the pieces of unused block in each save block aren't very big. the reason that the padding exists in the first place is that each block is padded to the nearest 0x100 bytes. they have a bit of math to account for this when building the save data block table.

e: an example:

18E00	19333	19336	Party Pokemon

the party pkm block runs from 18E00 to 19337, but the padding extends to 193FF. that means that 19338-193FF is padded with FFs and unused. so if you change the block size in the config table, you can have read/write access to 0xC8(200d) bytes for managing your own save data. and you wouldn't have to do anything but read and write to it in memory because after adjusting the table, gamefreak's code would do all the management.

to find the right block in the table to change, you do this:

block_num * 0xC + 0x208F18C + 0x4

then you go to that address and follow the pointer at that address. somewhere very close by that address, you'll see 00000534 in ram/in the arm9. add up to 0xC8 more bytes to that and you have your own private save data.

Posted (edited)

i posted this awhile ago somewhere else, but i found it again in some code i was working on tonight and figured i might as well throw it up here.

typedef u32 OvlID;
typedef void (*OvlStartupFunc) (void);
typedef void (*OvlEndFunc) (void);


struct OvlTblInfo {		

OvlID		id;
u8		*ram_address;
u32		ram_size;
u32		bss_size;
OvlStartupFunc	*constructor;
OvlEndFunc	*destructor;
u32		file_id;
u32		sz_compressed:24;
u32		ovl_flags:8;

};

struct OvlWork {

int ovl_num;
bool is_loaded;

};

struct OvlInfo {

OvlTblInfo head;
Proc       cpu_target;
RomRegion  file_pos;

}

OvlTblInfo is the overlay table data entry in y9 and y7.bin, though there are never any arm7 overlays, so y7.bin is always empty.

the constructor and destructor don't necessarily have to run. only if you need to initialize and end things when loading/unloading the overlay.

sizeof(OvlTblInfo) is 32.

e: i wrote a quick program to dump the relevant info from overlay tables and provided a folder of all the necessary overlay info tables as text files here:

http://projectpokemon.org/forums/showthread.php?29665-I-m-Done

Edited by Bond697
Posted

at 0x209DA98 in white 2 is a very important set of data. it's 24 bytes, 6 members:

typedef void (*VBlankIntrFn)(void*);

struct SystemVframe {

VBlankIntrFn* callback;
void* heap_1;
u32 unused;
u32 vram_transfer;
void* vbl_intr_fn_arg;
void* gfl_std_use;

};

Address	Offset	Use	0x209DA98
0x209DA98	0x0	vblank callback function- changes based on what player is doing	
0x209DA9C	0x4	ptr to first object in memory(objects being heaps)	
0x209DAA0	0x8	unused- set to 0 while initializing	
0x209DAA4	0xC	u32 counter- successful vram transfers	
0x209DAA8	0x10	vblank callback argument	
0x209DAAC	0x14	ptr to gfl_use  system blocks	

it's basically the vblank manager.

one very interesting thing to note:

all ds and gba games handle graphics the same way- they draw to the screen while the screen is empty(i.e. during vblank) to avoid casuing tearing, artifacting, etc on the screen while the game is running. the system and sdk graphics systems are obviously designed around this, etc. gamefreak does handle their graphics during vblank, but not in the conventional way. when the system boots, they enable the vblank interrupt callback in the interrupt table:

ARM9:02005124             ; void __fastcall TwlMain()
ARM9:02005124             TwlMain            
ARM9:02005124 F8 B5                       PUSH    {R3-R7,LR}
ARM9:02005126 00 F0 1D F9                 BL      SystemInit
ARM9:0200512A 00 F0 C5 F9                 BL      setupSystem
ARM9:0200512E 25 49                       LDR     R1, =(_HBlankIntr+1) ; function
ARM9:02005130 02 20                       MOVS    R0, #2          ; intrBit
ARM9:02005132 74 F0 0B FE                 BL      OS_SetIrqFunction
ARM9:02005136 24 49                       LDR     R1, =(VBlankIntr+1) ; function
ARM9:02005138 01 20                       MOVS    R0, #1          ; intrBit
ARM9:0200513A 01 24                       MOVS    R4, #1
ARM9:0200513C 74 F0 06 FE                 BL      OS_SetIrqFunction
ARM9:02005140 03 20                       MOVS    R0, #3          ; intr
ARM9:02005142 74 F0 AB FE                 BL      OS_EnableIrqMask

(note VBlankIntr)

it looks something like this in normal code:

void TwlMain()
{
SystemInit();
setupSystem();

OS_SetIrqFunction(OS_IE_H_BLANK, HBlankIntr);
OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr);
OS_EnableIrqMask(HBlankIntr | VBlankIntr);

anyway, what's weird is that they do the vblank thing and they do do graphics-related stuff in the vblank callback, but the only time the callback does anything of note is when you enter a building. a function runs that does a bunch of floating point math and a few other things. the actual graphics are updated during vblank, but outside of the vblank callback. the code (called updateGfx) runs as soon as the vblank callback finishes, which is fine. there's nothing wrong with doing it the way they do, it's just different.

  • 3 weeks later...
Posted

you can adjust the volume of the main snd player @ 2149384 - 0x7F is max volume and 00 is min volume. if you want to adjust the sub-players, it's 0x2149384 + (i * 36) where i is the player number. there are 16 total possible players, but gen 5 uses 4. so use 0-3.

  • 3 weeks later...
  • 3 weeks later...
Posted

here's something someone might want to look into:

in personal.narc for bw2, there's a 16-bit value(bytes 11 and 12) that's used for how many of each ev a pokemon gives out when defeated. the first 12 bits are used for that because it's 2 bits per stat, 6 stats. however, the 13th bit is also used for something. it might be worth figuring out what that's for.

  • 2 weeks later...
Posted

i figured out what the 13th bit does. it indicates that diglett/dugtrio use a special animation for popping out of their pokeball. all other pokes jump out of their pokeball when the trainer throws the ball out, but diglett/dugtrio rise out of the ground when the ball is thrown out. if you set it for other pokes, they will rise up out of the ground when their ball is thrown out.

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