I still do not understand how ti_read() reads in an app var into a struct. Data reads incorrectly.
Example code:
This is the struct
Code:
I print out the first 6 from stats, but shows:
Code:
On the app var, it should contain:
Code:
(they are in hex because I'm too lazy to convert)
I got these because I used convbin on a binary file that begins with these numbers.
CEmu confirmed that the data was transfered correctly, so no corruption. Checked it in the system, its the right digits.
Did I do something wrong? The ti_read code is (sorry about the bad naming, but I know its not part of the problem):
Code:
The rest of the struct contains vastly different data from the app var, in fact, here is the more of the wrong data:
Code:
There's a lot of 255 and 254s which I know I did not have in my program. I feel like there is a padding issue, but didn't you guys say that there is no padding?
Example code:
This is the struct
Code:
struct PokeData{
uint8_t stats[202*(6 + 2 + 2 + 2)];
uint8_t evo[202*2];
uint16_t nameIndex[203];
char name[1436];
};
I print out the first 6 from stats, but shows:
Code:
255 153 254 255 255 243
On the app var, it should contain:
Code:
0x28 0x2D 0x3C 0x5A 0x37 ...
I got these because I used convbin on a binary file that begins with these numbers.
CEmu confirmed that the data was transfered correctly, so no corruption. Checked it in the system, its the right digits.
Did I do something wrong? The ti_read code is (sorry about the bad naming, but I know its not part of the problem):
Code:
PokeData pokedata;
ti_var_t pokeData = ti_Open("PokeData", "r");
ti_Read(&pokedata, sizeof(PokeData), 1, pokeData);
for(int i = 0; i < 6; i++){
dbg_printf("%d ", pokedata.stats[i]);
}
The rest of the struct contains vastly different data from the app var, in fact, here is the more of the wrong data:
Code:
255 153 254 255 255 243
255 138 255 109 255 153
255 138 255 255 255 97
254 243 254 109 255 243
255 243 254 143 255 211
254 255 255 255 255 109
254 109 255 153 254 255
254 243 254 211 255 109
202 211 255 138 255 138
254 255 255 97 255 243
255 109 255 243 254 109
255 211 255 109 255 153
255 109 255 138 255 153
254 255 255 243 254 143
255 138 255 109 255 243
202 211 255 138 255 138
//This is generated using the code:
for(int i = 0; i < 202; i++){ //there's 202 lines in total, but I'm not showing all of them.
for(int j = 0; j < 6; j++){
dbg_printf("%u ", pokedata.stats[12*i + j]);
}
dbg_printf("\n");
}
There's a lot of 255 and 254s which I know I did not have in my program. I feel like there is a padding issue, but didn't you guys say that there is no padding?