|
1182 | 1182 | if(extenstion || (file->d_type == 2)) {
|
1183 | 1183 | SEEK[ROMS.total+1] = telldir(directory);
|
1184 | 1184 | ROMS.total++;
|
| 1185 | + |
| 1186 | + //add_games(EXTENSIONS[STEP], file->d_name); |
1185 | 1187 | }
|
1186 | 1188 | }
|
1187 | 1189 | free(file);
|
|
1194 | 1196 | for(int n = 0; n < ROMS.total; n++) {
|
1195 | 1197 | // printf("\nSEEK[%d]:%d ", n, SEEK[n]);
|
1196 | 1198 | }
|
| 1199 | + |
| 1200 | + |
1197 | 1201 | }
|
1198 | 1202 |
|
1199 | 1203 | // printf("\n---------------------\n");
|
|
1279 | 1283 | }
|
1280 | 1284 |
|
1281 | 1285 | void get_files() {
|
| 1286 | + //create_games_file(DIRECTORIES[STEP]); |
1282 | 1287 | delete_numbers();
|
1283 | 1288 | count_files();
|
1284 | 1289 | seek_files();
|
|
1351 | 1356 | }
|
1352 | 1357 | //}#pragma endregion Files
|
1353 | 1358 |
|
| 1359 | +//{#pragma region File Manager |
| 1360 | + char** GAMES; |
| 1361 | + void create_games_file(char *emulator) { |
| 1362 | + printf("\n----- %s(%s) START -----", __func__, emulator); |
| 1363 | + char file[256] = "/sd/odroid/data"; |
| 1364 | + sprintf(file, "%s/%s", file, RETROESP_FOLDER); |
| 1365 | + sprintf(file, "%s/%s.txt", file, emulator); |
| 1366 | + |
| 1367 | + struct stat st; if (stat(file, &st) == 0) {unlink(file);} |
| 1368 | + |
| 1369 | + FILE *f; |
| 1370 | + f = fopen(file, "rb"); |
| 1371 | + if(f == NULL) { |
| 1372 | + f = fopen(file, "w+"); |
| 1373 | + // printf("\nCREATING: %s", file); |
| 1374 | + } else { |
| 1375 | + read_favorites(); |
| 1376 | + } |
| 1377 | + // printf("\nCLOSING: %s", file); |
| 1378 | + fclose(f); |
| 1379 | + printf("\n----- %s END -----", __func__); |
| 1380 | + } |
| 1381 | + |
| 1382 | + void read_games_file(char *emulator) { |
| 1383 | + printf("\n----- %s START -----", __func__); |
| 1384 | + char file[256] = "/sd/odroid/data"; |
| 1385 | + sprintf(file, "%s/%s", file, RETROESP_FOLDER); |
| 1386 | + sprintf(file, "%s/%s.txt", file, emulator); |
| 1387 | + |
| 1388 | + FILE *f; |
| 1389 | + f = fopen(file, "rb"); |
| 1390 | + if(f) { |
| 1391 | + // printf("\nREADING: %s\n", file); |
| 1392 | + char line[256]; |
| 1393 | + while (fgets(line, sizeof(line), f)) { |
| 1394 | + char *ep = &line[strlen(line)-1]; |
| 1395 | + while (*ep == '\n' || *ep == '\r'){*ep-- = '\0';} |
| 1396 | + printf("\n%s", line); |
| 1397 | + } |
| 1398 | + } |
| 1399 | + fclose(f); |
| 1400 | + |
| 1401 | + printf("\n----- %s END -----", __func__); |
| 1402 | + } |
| 1403 | + |
| 1404 | + void add_games(char *emulator, char *game) { |
| 1405 | + printf("\n----- %s START -----", __func__); |
| 1406 | + |
| 1407 | + char file[256] = "/sd/odroid/data"; |
| 1408 | + sprintf(file, "%s/%s", file, RETROESP_FOLDER); |
| 1409 | + sprintf(file, "%s/%s.txt", file, emulator); |
| 1410 | + |
| 1411 | + printf("%s\n", game); |
| 1412 | + |
| 1413 | + printf("\n----- %s END -----", __func__); |
| 1414 | + } |
| 1415 | +//}#pragma endregion File Manager |
| 1416 | + |
1354 | 1417 | //{#pragma region Favorites
|
1355 | 1418 | void create_favorites() {
|
1356 | 1419 | // printf("\n----- %s START -----", __func__);
|
|
0 commit comments