Talk:Save data structure (Generation III): Difference between revisions

From Bulbapedia, the community-driven Pokémon encyclopedia.
Jump to navigationJump to search
Line 10: Line 10:
:Currently, I have done absolutely zero RAM investigation of any sort, so I can't offer concrete help, but I'd imagine you should look at addresses being changed after the Gym Leader battle. Possibly if you compare that to addresses that were changed after a regular battle, you could figure out (or narrow down) where the Gym Badges are. I suppose it would also access that data when you look at your {{ga|Trainer Card}}.
:Currently, I have done absolutely zero RAM investigation of any sort, so I can't offer concrete help, but I'd imagine you should look at addresses being changed after the Gym Leader battle. Possibly if you compare that to addresses that were changed after a regular battle, you could figure out (or narrow down) where the Gym Badges are. I suppose it would also access that data when you look at your {{ga|Trainer Card}}.
:Otherwise, there are sites with (much) more active modding communities that might be better able to offer help. One of these that I was browsing recently is [[PokéCommunity]]. [[Smogon]] also conducts much research into the games. [[User:Tiddlywinks|Tiddlywinks]] ([[User talk:Tiddlywinks|talk]]) 11:00, 25 March 2014 (UTC)
:Otherwise, there are sites with (much) more active modding communities that might be better able to offer help. One of these that I was browsing recently is [[PokéCommunity]]. [[Smogon]] also conducts much research into the games. [[User:Tiddlywinks|Tiddlywinks]] ([[User talk:Tiddlywinks|talk]]) 11:00, 25 March 2014 (UTC)
Flags are defined in include/constants/flags.h from https://github.com/pret/pokeruby
The sections 1-4 should be read as a single data block, then you have to give a look to src/event_data.c to FlagSet and GetFlagPointer you will find that to get the offset in the flags variable you have to divide the flag / 8 and that the shift needed to do you bitwise operation with the concrete bit is (flag & 7); to set a flag we still need the flags variable own offset in the file include/global.h we can find
struct SaveBlock1 /* 0x02025734 */
This contains
/*0x1220*/ u8 flags[FLAGS_COUNT];
That means that our flag will be located in the offset
hex('1220') + (flag/8)
Lets think about a common example, we want to set the eon ticket received so our cheat code to get the eon ticket can have any use.
We will find in include/constants/flags.h
#define FLAG_SYS_HAS_EON_TICKET  (SYSTEM_FLAGS + 0x53)
We have to seek what the meaning of SYSTEM_FLAGS is
#define SYSTEM_FLAGS        (TRAINER_FLAG_START + NUMBER_OF_TRAINERS + 0x4B) // 0x800
TRAINER_FLAG_START and NUMBER_OF_TRAINERS
#define TRAINER_FLAG_START 0x500
#define NUMBER_OF_TRAINERS  693
That means that our id will be
hex('53') + hex('4B') + hex('500') + '693'
So the offset will be
id / 8
And to set it we should replace the offset as uchar by
offset |=  ( 1 << ( id & 7 ) ) );
I want to update the wiki to reflect my findings, but I am not quite familiarized with the wiki.
I have sucessfully catched latias in the event using what I learned. [[User:Sergiotarxz|Sergiotarxz]] ([[User talk:Sergiotarxz|talk]]) 18:25, 27 January 2023 (UTC)


== Section 1 - team / items ==
== Section 1 - team / items ==

Revision as of 18:26, 27 January 2023

Adding 0x0498 to the Trainer section's address you'll get into the battle trainer (e-Reader trainer) section. The first 2 bytes are used for the sprite which will also determine how the trainer looks like ingame. Afterwards, after you leave out 2 bytes (i don't know what they do, they are not set for me), the name will follow, using up to 12 bytes while it has to be terminated by FF. Now the values used for the dialogue, the Pokémon, their moves and their names, including items they carry are saved afterwards. At 0x0550 the checksum of the subsection (4-bytes long) is being saved (you can get it by simply following the instruction for the checksum and leaving the last two steps out). Maybe someone can help me getting a clearer structure and add it to the wiki page after we're finished investigating. Fighter19 (talk) 22:11, 27 February 2014 (UTC)

Badges flags

I am working on a small program (for fun) which extracts data from the game (real time – by reading the emulator memory). Pokemon data structure is working very well so far (thanks to this great page) but I am having problems with finding locations of the badge flags.

I theorized there is either a 1-byte storage (each badge = 1 bit of the 1-byte storage – so after beating Brock the byte could look like 00000001 (depends on the chosen 'endianity' meaning the storing order), after Misty 00000011, etc... or 8 individual bytes (with values 0x00 or 0x01). But nothing seems to work. I am using Cheat Engine 6.3. Encorte (talk) 04:11, 25 March 2014 (UTC)

Currently, I have done absolutely zero RAM investigation of any sort, so I can't offer concrete help, but I'd imagine you should look at addresses being changed after the Gym Leader battle. Possibly if you compare that to addresses that were changed after a regular battle, you could figure out (or narrow down) where the Gym Badges are. I suppose it would also access that data when you look at your Trainer Card.
Otherwise, there are sites with (much) more active modding communities that might be better able to offer help. One of these that I was browsing recently is PokéCommunity. Smogon also conducts much research into the games. Tiddlywinks (talk) 11:00, 25 March 2014 (UTC)

Flags are defined in include/constants/flags.h from https://github.com/pret/pokeruby The sections 1-4 should be read as a single data block, then you have to give a look to src/event_data.c to FlagSet and GetFlagPointer you will find that to get the offset in the flags variable you have to divide the flag / 8 and that the shift needed to do you bitwise operation with the concrete bit is (flag & 7); to set a flag we still need the flags variable own offset in the file include/global.h we can find

struct SaveBlock1 /* 0x02025734 */

This contains

/*0x1220*/ u8 flags[FLAGS_COUNT];

That means that our flag will be located in the offset

hex('1220') + (flag/8)

Lets think about a common example, we want to set the eon ticket received so our cheat code to get the eon ticket can have any use. We will find in include/constants/flags.h

#define FLAG_SYS_HAS_EON_TICKET   (SYSTEM_FLAGS + 0x53)

We have to seek what the meaning of SYSTEM_FLAGS is

#define SYSTEM_FLAGS        (TRAINER_FLAG_START + NUMBER_OF_TRAINERS + 0x4B) // 0x800

TRAINER_FLAG_START and NUMBER_OF_TRAINERS

  1. define TRAINER_FLAG_START 0x500
  2. define NUMBER_OF_TRAINERS 693

That means that our id will be

hex('53') + hex('4B') + hex('500') + '693'

So the offset will be

id / 8

And to set it we should replace the offset as uchar by offset |= ( 1 << ( id & 7 ) ) ); I want to update the wiki to reflect my findings, but I am not quite familiarized with the wiki. I have sucessfully catched latias in the event using what I learned. Sergiotarxz (talk) 18:25, 27 January 2023 (UTC)

Section 1 - team / items

There is a mistake in the offsets for FRLG. The offset for the "Key item pocket" should be 0x03B8. Tested this myself. :) -- Deviler (talk) 17:01, 30 May 2014 (UTC)

Section question

The article says that the sections are 4kb (4096 bytes), but lists the organization as 4080 bytes, 2 bytes, 2 bytes, and 4 bytes. That's 4088 bytes. What's the remaining 8 bytes? Padding? And, if so, why isn't this listed?--Gou (talk) 15:06, 8 May 2015 (UTC)

SRAM or FLASH?

The article says the gen iii games use SRAM, but can somebody confirm this? I think it should be FLASH? D (talk) 16:40, 15 July 2019 (UTC)