summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartmists <martmists@gmail.com>2020-04-10 17:33:55 +0200
committerMartmists <martmists@gmail.com>2020-04-10 17:33:55 +0200
commite3ffd55f2c823b51dfe65a9e8937ba526e0277c8 (patch)
tree97db43ebd0bb98fa37720d0045168a239164097b
parent7ae853c6c01b8dbadd84c3e2e9950781ff0b35e4 (diff)
Add known structs
-rw-r--r--.gitignore2
-rw-r--r--CMakeLists.txt6
-rw-r--r--main.c3
-rw-r--r--nitro/nitro.h7
-rw-r--r--nitro/types.h9
-rw-r--r--structs/map.h22
-rw-r--r--structs/pokemon.h195
-rw-r--r--structs/structs.h7
8 files changed, 251 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29b..e1343672 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1,2 @@
+.idea/
+cmake-build-debug/ \ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 00000000..00b7c6fe
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,6 @@
+cmake_minimum_required (VERSION 2.8.11)
+project(PokeDiamond)
+
+# TODO: Add commands
+
+add_executable(PokeDiamond main.c) \ No newline at end of file
diff --git a/main.c b/main.c
new file mode 100644
index 00000000..6879c08d
--- /dev/null
+++ b/main.c
@@ -0,0 +1,3 @@
+// Just includes for now so CLion sees the files
+#include "nitro/nitro.h"
+#include "structs/structs.h"
diff --git a/nitro/nitro.h b/nitro/nitro.h
new file mode 100644
index 00000000..ea87f994
--- /dev/null
+++ b/nitro/nitro.h
@@ -0,0 +1,7 @@
+#ifndef POKEDIAMOND_NITRO_H
+#define POKEDIAMOND_NITRO_H
+
+// Include all nitro files
+#include "types.h"
+
+#endif //POKEDIAMOND_NITRO_H
diff --git a/nitro/types.h b/nitro/types.h
new file mode 100644
index 00000000..af6d9c6b
--- /dev/null
+++ b/nitro/types.h
@@ -0,0 +1,9 @@
+#ifndef POKEDIAMOND_NITRO_TYPES_H
+#define POKEDIAMOND_NITRO_TYPES_H
+
+typedef long u64;
+typedef int u32;
+typedef short u16;
+typedef char u8;
+
+#endif //POKEDIAMOND_NITRO_TYPES_H
diff --git a/structs/map.h b/structs/map.h
new file mode 100644
index 00000000..18b8c1d1
--- /dev/null
+++ b/structs/map.h
@@ -0,0 +1,22 @@
+#ifndef POKEDIAMOND_MAP_H
+#define POKEDIAMOND_MAP_H
+
+typedef struct {
+ u8 MapAreaData;
+ u8 field_0x1;
+ u16 Matrix;
+ u16 MapScripts;
+ u16 MapLevelScripts;
+ u16 MapTexts;
+ u16 DayMusic;
+ u16 NightMusic;
+ u16 WildPokemonData;
+ u16 MapEvents;
+ u16 MapName;
+ u8 WeatherType;
+ u8 field_0x15;
+ u8 field_0x16;
+ u8 field_0x17;
+} MapHeader;
+
+#endif //POKEDIAMOND_MAP_H
diff --git a/structs/pokemon.h b/structs/pokemon.h
new file mode 100644
index 00000000..36f17307
--- /dev/null
+++ b/structs/pokemon.h
@@ -0,0 +1,195 @@
+#ifndef POKEDIAMOND_POKEMON_H
+#define POKEDIAMOND_POKEMON_H
+
+#include "nitro/types.h"
+
+// Enums
+
+typedef enum {
+ EGG=0,
+ EVENT=0,
+ HATCHED=0,
+ PAL_PARK=0,
+ TALL_GRASS=2,
+ DIALGA_GAME_EVENT=4,
+ PALKIA_GAME_EVENT=4,
+ CAVE=5,
+ HALL_OF_ORIGIN=5,
+ SURFING=7,
+ FISHING=7,
+ BUILDING=9,
+ SAFARI_ZONE=10,
+ STARTER=12,
+ FOSSIL=12,
+ GIFT_EEVEE=12
+} EncounterType;
+
+typedef enum {
+ JAPANESE=1,
+ ENGLISH=2,
+ FRENCH=3,
+ ITALIAN=4,
+ GERMAN=5,
+ SPANISH=7,
+ KOREAN=8
+} OriginLanguage;
+
+typedef enum {
+ // TODO: Add all Arceus forms
+ // and sort by value
+ ARCEUS_EARTH=32,
+ ARCEUS_FIST=8,
+ ARCEUS_NORMAL=0,
+ ARCEUS_SKY=16,
+ ARCEUS_STONE=40,
+ ARCEUS_TOXIC=24,
+ BURMY_PLANT=0,
+ BURMY_SANDY=8,
+ BURMY_TRASH=16,
+ DEOXYS_ATTACK=8,
+ DEOXYS_DEFENSE=16,
+ DEOXYS_NORMAL=0,
+ DEOXYS_SPEED=24,
+ GIRATINA_ALTERED=0,
+ GIRATINA_ORIGIN=8,
+ ROTOM_FAN=32,
+ ROTOM_FROST=24,
+ ROTOM_HEAT=8,
+ ROTOM_MOW=40,
+ ROTOM_NORMAL=0,
+ ROTOM_WASH=16,
+ SHAYMIN_LAND=0,
+ SHAYMIN_SKY=8,
+ SHELLOS_EAST=8,
+ SHELLOS_WEST=0,
+ UNOWN_EXCLAMATIONMARK =208,
+ UNOWN_QUESTIONMARK=216,
+ UNOWN_A=0,
+ UNOWN_B=8,
+ UNOWN_C=16,
+ UNOWN_D=24,
+ UNOWN_E=32,
+ UNOWN_F=40,
+ UNOWN_G=48,
+ UNOWN_H=56,
+ UNOWN_I=64,
+ UNOWN_J=72,
+ UNOWN_K=80,
+ UNOWN_L=88,
+ UNOWN_M=96,
+ UNOWN_N=104,
+ UNOWN_O=112,
+ UNOWN_P=120,
+ UNOWN_Q=128,
+ UNOWN_R=136,
+ UNOWN_S=144,
+ UNOWN_T=152,
+ UNOWN_U=160,
+ UNOWN_V=168,
+ UNOWN_W=176,
+ UNOWN_X=184,
+ UNOWN_Y=192,
+ UNOWN_Z=200
+} AlternateForms;
+
+// Structs
+
+typedef struct {
+ u16 species;
+ u16 heldItem;
+ u16 otID;
+ u16 otSecretID;
+ u32 exp;
+ u8 friendship;
+ u8 ability;
+ u8 circleMarking:1, triangleMarking:1, squareMarking:1, heartMarking:1, starMarking:1, diamondMarking:1;
+ OriginLanguage originLanguage;
+ u8 hpEV;
+ u8 atkEV;
+ u8 defEV;
+ u8 spdEV;
+ u8 spatkEV;
+ u8 spdefEV;
+ u8 coolStat;
+ u8 beautyStat;
+ u8 cuteStat;
+ u8 smartStat;
+ u8 toughStat;
+ u8 sheen;
+ // TODO: Finish SinnohRibbonSet1
+ u8 sinnohChampRibbon:1, abilityRibbon:1;
+ u8 field_0x1d;
+ u8 gorgeousRoyalRibbon:1, footprintRibbon:1;
+ u8 field_0x1f;
+} PokemonDataBlockA;
+
+typedef struct {
+ u16 move1;
+ u16 move2;
+ u16 move3;
+ u16 move4;
+ u8 move1pp;
+ u8 move2pp;
+ u8 move3pp;
+ u8 move4pp;
+ u8 move1ppUps;
+ u8 move2ppUps;
+ u8 move3ppUps;
+ u8 move4ppUps;
+ u32 hpIV:5, atkIV:5, defIV:5, spdIV:5, spatkIV:5, spdefIV:5, isEgg:1, isNicknamed:1;
+ // TODO: Finish HoennRibbonSet
+ u8 coolRibbon:1;
+ u8 field_0x15;
+ u8 field_0x16;
+ u8 field_0x17;
+ u8 fatefulEncounter:1, female:1, genderless:1, alternateForm:5;
+ u8 HGSS_shinyLeaves; // TODO: Turn into bitfield
+ u16 Unused;
+ u16 Platinum_EggLocation;
+ u16 Platinum_MetLocation;
+} PokemonDataBlockB;
+
+typedef struct {
+ u16 nickname[11];
+ u8 Unused;
+ u8 originGame;
+ // TODO: Finish SinnohRibbonSet2
+ u8 coolRibbon:1;
+ u8 field_0x19;
+ u8 field_0x1a;
+ u8 field_0x1b;
+ u32 Unused2;
+} PokemonDataBlockC;
+
+typedef struct {
+ u16 otTrainerName[8];
+ u8 dateEggReceived[3];
+ u8 dateMet[3];
+ u16 DP_EggLocation;
+ u16 DP_MetLocation;
+ u8 pokerus;
+ u8 pokeball;
+ u8 flags;
+ EncounterType encounterType;
+ u8 HGSS_Pokeball;
+ u8 HGSS_Performance;
+} PokemonDataBlockD;
+
+typedef union {
+ PokemonDataBlockA blockA;
+ PokemonDataBlockB blockB;
+ PokemonDataBlockC blockC;
+ PokemonDataBlockD blockD;
+} PokemonDataBlock;
+
+struct PokemonData {
+ u32 personalityValue;
+ u16 Unused; // Might be used for validity checks
+ u16 checksum; // Stored checksum of pokemon
+ PokemonDataBlock block1; // Blocks A-D; Order based on personalityValue
+ PokemonDataBlock block2;
+ PokemonDataBlock block3;
+ PokemonDataBlock block4;
+};
+
+#endif //POKEDIAMOND_POKEMON_H
diff --git a/structs/structs.h b/structs/structs.h
new file mode 100644
index 00000000..8a34d299
--- /dev/null
+++ b/structs/structs.h
@@ -0,0 +1,7 @@
+#ifndef POKEDIAMOND_STRUCTS_H
+#define POKEDIAMOND_STRUCTS_H
+
+#include "pokemon.h"
+#include "map.h"
+
+#endif //POKEDIAMOND_STRUCTS_H