Skip to content

Commit 736c9df

Browse files
Restore sceCdRM ABI compatibility and keep safe copy
1 parent da2ba2b commit 736c9df

4 files changed

Lines changed: 8 additions & 10 deletions

File tree

include/libcdvd_add.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// For size_t
2-
#include <stddef.h>
3-
41
// Initialize add-on functions. Currently only retrieves the MECHACON's version to determine what sceCdAltGetRegionParams() should do.
52
int cdInitAdd(void);
63

@@ -16,8 +13,9 @@ int custom_sceCdReadRegionParams(u8 *data, u32 *stat);
1613
*/
1714
int custom_sceCdReadPS1BootParam(char *param, u32 *stat);
1815

19-
// Obtain model number from EEPROM via the mechacon SCMD 0x17
20-
int sceCdRM(char *ModelName, size_t modelNameSize, u32 *stat);
16+
// Obtain model number from EEPROM via the mechacon SCMD 0x17.
17+
// The caller must provide a buffer of at least 16 bytes (two 8-byte chunks).
18+
int sceCdRM(char *ModelName, u32 *stat);
2119

2220
// Provides an equivalent of the sceCdBootCertify function from the newer CDVDMAN modules. The old CDVDFSV and CDVDMAN modules don't support this S-command.
2321
int sceCdBootCertify(const u8 *data);

src/libcdvd_add.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,14 @@ int sceCdBootCertify(const u8 *data)
6666
return result;
6767
}
6868

69-
int sceCdRM(char *ModelName, size_t modelNameSize, u32 *stat)
69+
int sceCdRM(char *ModelName, u32 *stat)
7070
{
7171
unsigned char rdata[9];
7272
unsigned char sdata;
7373
int result1, result2;
74+
const size_t modelNameSize = 16; // Two 8-byte chunks
7475

75-
if (ModelName == NULL || stat == NULL || modelNameSize < 16) {
76+
if (ModelName == NULL || stat == NULL) {
7677
return 0;
7778
}
7879

src/modelname.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static int ReadModelName(char *name)
5252

5353
return 0; // Original returned -1
5454
} else {
55-
if ((result = sceCdRM(name, MODEL_NAME_MAX_LEN, &stat)) == 1) { // Command issued successfully.
55+
if ((result = sceCdRM(name, &stat)) == 1) { // Command issued successfully.
5656
if (stat & 0x80)
5757
return -2;
5858
if ((stat & 0x40) || name[0] == '\0')

tools/codacy_shims/ps2sdk/ps2sdk_shim.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,9 @@ static inline int sceCdMV(u8 *out, u32 *stat)
241241
return 0;
242242
}
243243

244-
static inline int sceCdRM(char *out, size_t modelNameSize, u32 *stat)
244+
static inline int sceCdRM(char *out, u32 *stat)
245245
{
246246
(void)out;
247-
(void)modelNameSize;
248247
(void)stat;
249248
return 0;
250249
}

0 commit comments

Comments
 (0)