aliases.txt separator and location changed

This commit is contained in:
Mauro Vietri 2023-06-03 18:17:27 -03:00
parent a0e3ef28ad
commit 77d60b95b4
4 changed files with 29 additions and 38 deletions

View file

@ -1,18 +0,0 @@
2020bb:2020 Super Baseball
alpham2:Alpha Mission II
mslug:Metal Slug - Super Vehicle-001
neogeo:Neo-Geo MV-6F
mslug2:Metal Slug 2 - Super Vehicle-001/II
mslug2t:Metal Slug 2 Turbo
mslug3h:Metal Slug 3
mslug3:Metal Slug 3
mslug3a:Metal Slug 3
mslug4h:Metal Slug 4
mslug4:Metal Slug 4
mslug5b:Metal Slug 5
mslug5:Metal Slug 5
mslug5h:Metal Slug 5
mslug6:Metal Slug 6
awbios:Atomiswave Bios
mslug3b6:Metal Slug 6
mslugx:Metal Slug X - Super Vehicle-001

View file

@ -1,3 +1,11 @@
#Avoid complex names
#Separator is '~'. Do not include that in the alias
#Lines starting with '#' are comments and are not count
#Keep below 1000 including comments
#
#Works for any list (collections, favorites, consoles, etc)
#Real filename will be shown on game's menu. This only affects main menu listing.
#
#NEOGEO~## #NEOGEO~##
2020bb~2020 Super Baseball 2020bb~2020 Super Baseball
sonicwi2~Aero Fighters 2 sonicwi2~Aero Fighters 2
@ -516,4 +524,4 @@ xmvsfu~X-Men vs. Street Fighter
xmcotau~X-Men: Children of the Atom xmcotau~X-Men: Children of the Atom
zaxxon~Zaxxon zaxxon~Zaxxon
zerowing~Zero Wing zerowing~Zero Wing
zookeep~Zoo Keeper zookeep~Zoo Keeper

View file

@ -62,7 +62,7 @@
#define BATTERY_PATH SDCARD_PATH "/battery.txt" #define BATTERY_PATH SDCARD_PATH "/battery.txt"
#define SCREENSHOTS_PATH SDCARD_PATH "/Screenshots" #define SCREENSHOTS_PATH SDCARD_PATH "/Screenshots"
#define ADB_FLAG_PATH SDCARD_PATH "/enableADB" #define ADB_FLAG_PATH SDCARD_PATH "/enableADB"
#define ALIASES_PATH SDCARD_PATH "/aliases.txt" #define ALIASES_PATH SDCARD_PATH "/Roms/aliases.txt"
#define LAST_PATH "/tmp/last.txt" // transient #define LAST_PATH "/tmp/last.txt" // transient
#define CHANGE_DISC_PATH "/tmp/change_disc.txt" #define CHANGE_DISC_PATH "/tmp/change_disc.txt"

View file

@ -1304,29 +1304,30 @@ int main (int argc, char *argv[]) {
FILE *aliases = fopen(ALIASES_PATH, "r"); FILE *aliases = fopen(ALIASES_PATH, "r");
int aIndex = 0; int aIndex = 0;
char* original[50]; char* original[1000];
char* alias[50]; char* alias[1000];
char line[75]; char line[75];
if (aliases) { if (aliases) {
while(fgets(line, sizeof line, aliases)!=NULL) { while(fgets(line, sizeof line, aliases)!=NULL) {
original[aIndex] = malloc(sizeof(line)); if (line[0] != '\0' && line[0] != '#') {
alias[aIndex] = malloc(sizeof(line)); original[aIndex] = malloc(sizeof(line));
alias[aIndex] = malloc(sizeof(line));
int set_alias = 0; int set_alias = 0;
char* split = strtok(line, ":"); char* split = strtok(line, "~");
while(split) { while(split) {
if (!set_alias) { if (!set_alias) {
strcpy(original[aIndex], split); strcpy(original[aIndex], split);
set_alias = 1; set_alias = 1;
} else { } else {
strcpy(alias[aIndex], split); strcpy(alias[aIndex], split);
} }
split = strtok(NULL, ":"); split = strtok(NULL, "~");
} }
aIndex++;
aIndex++; }
} }
fclose(aliases); fclose(aliases);