scores.c
// read the scores/achievements for a specific game
read the scores/achievements for a specific game
read the scores / achievements for a specific game
GameT vis_score_read(const char *game) {
  int8_t game_index = -1; 
  GameT gametmp;
  for (uint8_t i = 0; i < 5; i++) {
      eeprom_read_block((void*)&gametmp, (const void*)&eep_games[i], sizeof(GameT));
      if (!strcmp(game, gametmp.name)) { 
        game_index = i;
        gameidx = i;
        return gametmp;
      } else if (strcmp(GAME_HWID, gametmp.id) != 0) { 
        game_index = i;
      }
  }
  if (game_index == -1) 
    game_index = 0;
  vis_score_reset(game, game_index);
  return vis_score_read(game);
}
GameT vis_score_read ( const char * game ) { int8_t game_index = -1 ; GameT gametmp ; for ( uint8_t i = 0 ; i < 5 ; i ++ ) { eeprom_read_block ( ( void * ) & gametmp , ( const void * ) & eep_games [ i ] , sizeof ( GameT ) ) ; if ( ! strcmp ( game , gametmp . name ) ) { game_index = i ; gameidx = i ; return gametmp ; } else if ( strcmp ( GAME_HWID , gametmp . id ) != 0 ) { game_index = i ; } } if ( game_index == -1 ) game_index = 0 ; vis_score_reset ( game , game_index ) ; return vis_score_read ( game ) ; }
read the scores/achievements for a specific game
read the scores / achievements for a specific game
// location of game in EEPROM array of structs  // returns 0 when match found // free spot for empty initialization // not found, create empty // no space, overwrite first game entry