diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-07-13 15:22:55 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-07-13 15:22:55 -0400 |
commit | 252e2911383a5267673f00c08419e2afeac35a31 (patch) | |
tree | 9713a54f6a17afa14999bab5b4c4e982ca40bfea /gba/source/main.c | |
parent | 2c837223756de2596931c22c8f4fa2ba4a4237a9 (diff) | |
download | gen3uploader-252e2911383a5267673f00c08419e2afeac35a31.tar.gz gen3uploader-252e2911383a5267673f00c08419e2afeac35a31.tar.bz2 gen3uploader-252e2911383a5267673f00c08419e2afeac35a31.zip |
App now waits for confirmation to import, and reads pokedex seen&caught
Diffstat (limited to 'gba/source/main.c')
-rw-r--r-- | gba/source/main.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/gba/source/main.c b/gba/source/main.c index 6207685..14d2f1d 100644 --- a/gba/source/main.c +++ b/gba/source/main.c | |||
@@ -10,6 +10,10 @@ | |||
10 | 10 | ||
11 | int main(void) | 11 | int main(void) |
12 | { | 12 | { |
13 | // This possibly increases stability, I don't rightly know, this is all black | ||
14 | // magic, will test more later. | ||
15 | REG_IME = 0; | ||
16 | |||
13 | initializeLink(); | 17 | initializeLink(); |
14 | 18 | ||
15 | // Identify the host game. | 19 | // Identify the host game. |
@@ -105,4 +109,57 @@ int main(void) | |||
105 | 109 | ||
106 | sendU32(tti); | 110 | sendU32(tti); |
107 | waitForAck(); | 111 | waitForAck(); |
112 | |||
113 | // Does the player want to import this game? | ||
114 | if (waitForResponse() == 0) | ||
115 | { | ||
116 | return 0; | ||
117 | } | ||
118 | |||
119 | // Send Pokédex data | ||
120 | u8* pokedexSeen = 0; | ||
121 | if (GAME_RS) | ||
122 | { | ||
123 | pokedexSeen = SaveBlock2->rs.pokedex.seen; | ||
124 | } else if (GAME_FRLG) | ||
125 | { | ||
126 | pokedexSeen = SaveBlock2->frlg.pokedex.seen; | ||
127 | } else if (GAME_EM) | ||
128 | { | ||
129 | pokedexSeen = SaveBlock2->e.pokedex.seen; | ||
130 | } | ||
131 | |||
132 | for (int i=0; i<13; i++) | ||
133 | { | ||
134 | u32 psi = | ||
135 | (pokedexSeen[i*4]) | ||
136 | | (pokedexSeen[i*4+1] << 8) | ||
137 | | (pokedexSeen[i*4+2] << 16) | ||
138 | | (pokedexSeen[i*4+3] << 24); | ||
139 | |||
140 | directSendU32(psi); | ||
141 | } | ||
142 | |||
143 | u8* pokedexCaught = 0; | ||
144 | if (GAME_RS) | ||
145 | { | ||
146 | pokedexCaught = SaveBlock2->rs.pokedex.owned; | ||
147 | } else if (GAME_FRLG) | ||
148 | { | ||
149 | pokedexCaught = SaveBlock2->frlg.pokedex.owned; | ||
150 | } else if (GAME_EM) | ||
151 | { | ||
152 | pokedexCaught = SaveBlock2->e.pokedex.owned; | ||
153 | } | ||
154 | |||
155 | for (int i=0; i<13; i++) | ||
156 | { | ||
157 | u32 psi = | ||
158 | (pokedexCaught[i*4]) | ||
159 | | (pokedexCaught[i*4+1] << 8) | ||
160 | | (pokedexCaught[i*4+2] << 16) | ||
161 | | (pokedexCaught[i*4+3] << 24); | ||
162 | |||
163 | directSendU32(psi); | ||
164 | } | ||
108 | } | 165 | } |