#56109 - Didou - Thu Oct 06, 2005 7:09 am
Hi,
I'm currently trying to add scores saving in ReboNDS. But I've tried tons of things, what I get is either no save or a frozen DS...
However I tried to follow examples...
First of all, amongst threads, Wiki and tutos, it appeard that some advised to write WAIT_CR with the mask 0x8080 and some others with only 0x80. So which one is the right one ?
Following the code that freeze my DS when it is reached...
Any idea ? I must miss something... While debuging it appeared that the crashing code is exactly the bytes copy in the SRAM, not the WAIT_CR modifications.
I also tried using 0x80 as masks. In this case, the DS is not frozen, but no save is done...
Thank's
I'm currently trying to add scores saving in ReboNDS. But I've tried tons of things, what I get is either no save or a frozen DS...
However I tried to follow examples...
First of all, amongst threads, Wiki and tutos, it appeard that some advised to write WAIT_CR with the mask 0x8080 and some others with only 0x80. So which one is the right one ?
Following the code that freeze my DS when it is reached...
Any idea ? I must miss something... While debuging it appeared that the crashing code is exactly the bytes copy in the SRAM, not the WAIT_CR modifications.
I also tried using 0x80 as masks. In this case, the DS is not frozen, but no save is done...
Thank's
Code: |
static void bytes_memcpy (char* dest, char *src, int size)
{ while (size--) *dest++ = *src++ ; } void save_scores () { u16 i ; tmp_data.magic_tag = MAGICNUMBER ; /* Scores. */ for (i = 0; i < sizeof (struct highscores); i++) ((u8*) &tmp_data.highscores)[i] = ((u8*) &global_highscores)[i] ; WAIT_CR &= ~0x80 ; /* It is now safe to write GBA Cartridge memory */ bytes_memcpy ((char*) SRAM, (char*) &tmp_data, sizeof (struct save_data)) ; WAIT_CR |= 0x80 ; } |