aboutsummaryrefslogtreecommitdiff
path: root/libpcsxcore
diff options
context:
space:
mode:
authornotaz2014-12-21 19:03:56 +0200
committernotaz2014-12-21 19:03:56 +0200
commite06ee7f47a951fd8abe122969bedeb2983bf8dc2 (patch)
tree7ce3bd553001a993fa1e382009252743300592e0 /libpcsxcore
parent46b3a2fc18d9384cee636360ebabbdd1822d1eca (diff)
downloadpcsx_rearmed-e06ee7f47a951fd8abe122969bedeb2983bf8dc2.tar.gz
pcsx_rearmed-e06ee7f47a951fd8abe122969bedeb2983bf8dc2.tar.bz2
pcsx_rearmed-e06ee7f47a951fd8abe122969bedeb2983bf8dc2.zip
misc: merge from pcsxr r86908
Author: edgbla CdromId fix;
Diffstat (limited to 'libpcsxcore')
-rw-r--r--libpcsxcore/misc.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/libpcsxcore/misc.c b/libpcsxcore/misc.c
index 917a567..14f68ec 100644
--- a/libpcsxcore/misc.c
+++ b/libpcsxcore/misc.c
@@ -312,7 +312,7 @@ int CheckCdrom() {
char *buf;
unsigned char mdir[4096];
char exename[256];
- int i, c;
+ int i, len, c;
FreePPFCache();
@@ -322,8 +322,9 @@ int CheckCdrom() {
READTRACK();
- CdromLabel[0] = '\0';
- CdromId[0] = '\0';
+ memset(CdromLabel, 0, sizeof(CdromLabel));
+ memset(CdromId, 0, sizeof(CdromId));
+ memset(exename, 0, sizeof(exename));
strncpy(CdromLabel, buf + 52, 32);
@@ -363,14 +364,13 @@ int CheckCdrom() {
return -1; // SYSTEM.CNF and PSX.EXE not found
if (CdromId[0] == '\0') {
- i = strlen(exename);
- if (i >= 2) {
- if (exename[i - 2] == ';') i-= 2;
- c = 8; i--;
- while (i >= 0 && c >= 0) {
- if (isalnum(exename[i])) CdromId[c--] = exename[i];
- i--;
- }
+ len = strlen(exename);
+ c = 0;
+ for (i = 0; i < len; ++i) {
+ if (exename[i] == ';' || c >= sizeof(CdromId) - 1)
+ break;
+ if (isalnum(exename[i]))
+ CdromId[c++] = exename[i];
}
}
@@ -388,6 +388,7 @@ int CheckCdrom() {
}
SysPrintf(_("CD-ROM Label: %.32s\n"), CdromLabel);
SysPrintf(_("CD-ROM ID: %.9s\n"), CdromId);
+ SysPrintf(_("CD-ROM EXE Name: %.255s\n"), exename);
BuildPPFCache();