Skip to content

Commit e2b5b61

Browse files
committed
Change definitions to use the ps2sdk definitions where possible
1 parent 5f924f8 commit e2b5b61

17 files changed

+205
-451
lines changed

modules/iopcore/cdvdfsv/cdvdfsv-internal.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
#include <thbase.h>
1717
#include <thevent.h>
1818
#include <thsemap.h>
19+
#include <cdvdman.h>
1920

20-
#include "cdvdman.h"
21+
#include "cdvdman_opl.h"
2122
#include "smsutils.h"
2223

2324
extern void cdvdfsv_register_scmd_rpc(SifRpcDataQueue_t *rpc_DQ);

modules/iopcore/cdvdfsv/irx_imports.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include <irx.h>
55

6-
#include "cdvdman.h"
6+
#include <cdvdman.h>
77
#include <intrman.h>
88
#include <loadcore.h>
99
#include <sifcmd.h>

modules/iopcore/cdvdfsv/ncmd.c

+13-13
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ typedef struct
1111
u32 lsn;
1212
u32 sectors;
1313
void *buf;
14-
cd_read_mode_t mode;
14+
sceCdRMode mode;
1515
void *eeaddr1;
1616
void *eeaddr2;
1717
} RpcCdvd_t;
@@ -22,7 +22,7 @@ typedef struct
2222
u32 sectors;
2323
void *buf;
2424
int cmd;
25-
cd_read_mode_t mode;
25+
sceCdRMode mode;
2626
u32 pad;
2727
} RpcCdvdStream_t;
2828

@@ -51,7 +51,7 @@ typedef struct
5151
u8 buf2[64];
5252
} cdvdfsv_readee_t;
5353

54-
static cd_read_mode_t cdvdfsv_Stmode;
54+
static sceCdRMode cdvdfsv_Stmode;
5555

5656
static SifRpcServerData_t cdvdNcmds_rpcSD;
5757
static u8 cdvdNcmds_rpcbuf[1024];
@@ -161,7 +161,7 @@ static inline void cdvd_readee(void *buf)
161161

162162
while (1) {
163163
do {
164-
if ((sectors_to_read == 0) || (sceCdGetError() == CDVD_ERR_ABRT)) {
164+
if ((sectors_to_read == 0) || (sceCdGetError() == SCECdErABRT)) {
165165
sysmemSendEE((void *)&readee, (void *)r->eeaddr1, sizeof(cdvdfsv_readee_t));
166166

167167
*((u32 *)&curlsn_buf[0]) = nbytes;
@@ -187,8 +187,8 @@ static inline void cdvd_readee(void *buf)
187187
}
188188

189189
if (sceCdRead(r->lsn, temp, (void *)fsvRbuf, NULL) == 0) {
190-
if (sceCdGetError() == CDVD_ERR_NO) {
191-
fsverror = CDVD_ERR_READCF;
190+
if (sceCdGetError() == SCECdErNO) {
191+
fsverror = SCECdErREADCF;
192192
sceCdSC(CDSC_SET_ERROR, &fsverror);
193193
}
194194

@@ -297,8 +297,8 @@ static inline void cdvd_readiopm(void *buf)
297297
}
298298

299299
if (r == 0) {
300-
if (sceCdGetError() == CDVD_ERR_NO) {
301-
fsverror = CDVD_ERR_READCFR;
300+
if (sceCdGetError() == SCECdErNO) {
301+
fsverror = SCECdErREADCFR;
302302
sceCdSC(CDSC_SET_ERROR, &fsverror);
303303
}
304304
}
@@ -323,8 +323,8 @@ static inline void cdvd_readchain(void *buf)
323323

324324
if ((u32)ch->buf & 1) { // IOP addr
325325
if (sceCdRead(lsn, tsectors, (void *)addr, NULL) == 0) {
326-
if (sceCdGetError() == CDVD_ERR_NO) {
327-
fsverror = CDVD_ERR_READCFR;
326+
if (sceCdGetError() == SCECdErNO) {
327+
fsverror = SCECdErREADCFR;
328328
sceCdSC(CDSC_SET_ERROR, &fsverror);
329329
}
330330

@@ -339,8 +339,8 @@ static inline void cdvd_readchain(void *buf)
339339
nsectors = (tsectors > CDVDMAN_FS_SECTORS) ? CDVDMAN_FS_SECTORS : tsectors;
340340

341341
if (sceCdRead(lsn, nsectors, cdvdfsv_buf, NULL) == 0) {
342-
if (sceCdGetError() == CDVD_ERR_NO) {
343-
fsverror = CDVD_ERR_READCF;
342+
if (sceCdGetError() == SCECdErNO) {
343+
fsverror = SCECdErREADCF;
344344
sceCdSC(CDSC_SET_ERROR, &fsverror);
345345
}
346346

@@ -368,7 +368,7 @@ static inline void rpcNCmd_cdreadDiskID(void *buf)
368368
u8 *p = (u8 *)buf;
369369

370370
mips_memset(p, 0, 10);
371-
*(int *)buf = sceCdReadDiskID(&p[4]);
371+
*(int *)buf = sceCdReadDiskID((unsigned int *)&p[4]);
372372
}
373373

374374
//-------------------------------------------------------------------------

modules/iopcore/cdvdfsv/scmd.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
typedef struct
1010
{
1111
int result;
12-
cd_clock_t rtc;
12+
sceCdCLOCK rtc;
1313
} cdvdreadclock_res_t;
1414

1515
typedef struct
@@ -91,7 +91,7 @@ static inline void rpcSCmd_cdreadGUID(void *buf)
9191

9292
cdvdSCmd_res_t *r = (cdvdSCmd_res_t *)buf;
9393

94-
r->result = sceCdReadGUID(&r->param1);
94+
r->result = sceCdReadGUID((u64 *)&r->param1);
9595
}
9696

9797
//-------------------------------------------------------------------------
@@ -151,7 +151,7 @@ static void *cbrpc_cdvdScmds(int fno, void *buf, int size)
151151
*(int *)buf = 1;
152152
break;
153153
case CDVDFSV_SCMD_POWEROFF:
154-
*(int *)buf = sceCdPowerOff((int *)buf);
154+
*(int *)buf = sceCdPowerOff((u32 *)buf);
155155
break;
156156
case CDVDFSV_SCMD_MMODE:
157157
*(int *)buf = sceCdMmode(*(int *)buf);

modules/iopcore/cdvdfsv/searchfile.c

+21-21
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,27 @@
77
#include "cdvdfsv-internal.h"
88

99
typedef struct
10-
{ // size =0x124
11-
cd_file_t cdfile; // 0x000
12-
char name[256]; // 0x020
13-
void *dest; // 0x120
10+
{ // size =0x124
11+
sceCdlFILE cdfile; // 0x000
12+
char name[256]; // 0x020
13+
void *dest; // 0x120
1414
} SearchFilePkt_t;
1515

1616
typedef struct
17-
{ // size =0x128
18-
cd_file_t cdfile; // 0x000
19-
u32 flag; // 0x020
20-
char name[256]; // 0x024
21-
void *dest; // 0x124
17+
{ // size =0x128
18+
sceCdlFILE cdfile; // 0x000
19+
u32 flag; // 0x020
20+
char name[256]; // 0x024
21+
void *dest; // 0x124
2222
} SearchFilePkt2_t;
2323

2424
typedef struct
25-
{ // size =0x12c
26-
cd_file_t cdfile; // 0x000
27-
u32 flag; // 0x020
28-
char name[256]; // 0x024
29-
void *dest; // 0x124
30-
int layer; // 0x128
25+
{ // size =0x12c
26+
sceCdlFILE cdfile; // 0x000
27+
u32 flag; // 0x020
28+
char name[256]; // 0x024
29+
void *dest; // 0x124
30+
int layer; // 0x128
3131
} SearchFilePktl_t;
3232

3333
static SifRpcServerData_t cdsearchfile_rpcSD;
@@ -50,21 +50,21 @@ static void *cbrpc_cdsearchfile(int fno, void *buf, int size)
5050
if (size == sizeof(SearchFilePkt2_t)) {
5151
ee_addr = (void *)pkt2->dest; // Search File: Called from Not Dual_layer Version
5252
p = (void *)&pkt2->name[0];
53-
pktsize = sizeof(cd_file_t) + sizeof(u32);
54-
r = sceCdSearchFile((cd_file_t *)buf, p);
53+
pktsize = sizeof(sceCdlFILE) + sizeof(u32);
54+
r = sceCdSearchFile((sceCdlFILE *)buf, p);
5555
pkt2->flag = 0;
5656
} else {
5757
if (size > sizeof(SearchFilePkt2_t)) { // Search File: Called from Dual_layer Version
5858
ee_addr = (void *)pktl->dest;
5959
p = (char *)&pktl->name[0];
60-
pktsize = sizeof(cd_file_t) + sizeof(u32);
61-
r = sceCdLayerSearchFile((cd_file_t *)buf, p, pktl->layer);
60+
pktsize = sizeof(sceCdlFILE) + sizeof(u32);
61+
r = sceCdLayerSearchFile((sceCdlFILE *)buf, p, pktl->layer);
6262
pktl->flag = 0;
6363
} else { // Search File: Called from Old Library
6464
ee_addr = (void *)pkt->dest;
6565
p = (char *)&pkt->name[0];
66-
pktsize = sizeof(cd_file_t);
67-
r = sceCdSearchFile((cd_file_t *)buf, p);
66+
pktsize = sizeof(sceCdlFILE);
67+
r = sceCdSearchFile((sceCdlFILE *)buf, p);
6868
}
6969
}
7070

modules/iopcore/cdvdman/cdvdman.c

+21-21
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extern struct irx_export_table _exp_dev9;
2525

2626
// internal functions prototypes
2727
static void oplShutdown(int poff);
28-
static int cdvdman_writeSCmd(u8 cmd, void *in, u32 in_size, void *out, u32 out_size);
28+
static int cdvdman_writeSCmd(u8 cmd, const void *in, u16 in_size, void *out, u16 out_size);
2929
static unsigned int event_alarm_cb(void *args);
3030
static void cdvdman_signal_read_end(void);
3131
static void cdvdman_signal_read_end_intr(void);
@@ -75,7 +75,7 @@ void oplRegisterShutdownCallback(oplShutdownCb_t cb)
7575

7676
static void oplShutdown(int poff)
7777
{
78-
int stat;
78+
u32 stat;
7979

8080
DeviceLock();
8181
if (vmcShutdownCb != NULL)
@@ -107,7 +107,7 @@ void cdvdman_init(void)
107107
#endif
108108

109109
if (!cdvdman_cdinited) {
110-
cdvdman_stat.err = CDVD_ERR_NO;
110+
cdvdman_stat.err = SCECdErNO;
111111

112112
cdvdman_fs_init();
113113

@@ -146,10 +146,10 @@ static int cdvdman_read_sectors(u32 lsn, unsigned int sectors, void *buf)
146146

147147
DPRINTF("cdvdman_read lsn=%lu sectors=%u buf=%p\n", lsn, sectors, buf);
148148

149-
cdvdman_stat.err = CDVD_ERR_NO;
149+
cdvdman_stat.err = SCECdErNO;
150150

151151
for (ptr = buf, remaining = sectors; remaining > 0;) {
152-
if (cdvdman_stat.err != CDVD_ERR_NO)
152+
if (cdvdman_stat.err != SCECdErNO)
153153
break;
154154

155155
SectorsToRead = remaining;
@@ -168,7 +168,7 @@ static int cdvdman_read_sectors(u32 lsn, unsigned int sectors, void *buf)
168168
}
169169

170170
if (DeviceReadSectors(lsn, ptr, SectorsToRead) != 0) {
171-
cdvdman_stat.err = CDVD_ERR_READ;
171+
cdvdman_stat.err = SCECdErREAD;
172172
if (cdvdman_settings.common.flags & IOPCORE_COMPAT_ACCU_READS)
173173
CancelAlarm(&cdvdemu_read_end_cb, NULL);
174174
break;
@@ -204,12 +204,12 @@ static int cdvdman_read_sectors(u32 lsn, unsigned int sectors, void *buf)
204204
}
205205
}
206206

207-
return (cdvdman_stat.err == CDVD_ERR_NO ? 0 : 1);
207+
return (cdvdman_stat.err == SCECdErNO ? 0 : 1);
208208
}
209209

210210
static int cdvdman_read(u32 lsn, u32 sectors, void *buf)
211211
{
212-
cdvdman_stat.status = CDVD_STAT_READ;
212+
cdvdman_stat.status = SCECdStatRead;
213213

214214
buf = (void *)PHYSADDR(buf);
215215
#ifdef HDD_DRIVER //As of now, only the ATA interface requires this. We do this here to share cdvdman_buf.
@@ -246,13 +246,13 @@ static int cdvdman_read(u32 lsn, u32 sectors, void *buf)
246246

247247
ReadPos = 0; /* Reset the buffer offset indicator. */
248248

249-
cdvdman_stat.status = CDVD_STAT_PAUSE;
249+
cdvdman_stat.status = SCECdStatPause;
250250

251251
return 1;
252252
}
253253

254254
//-------------------------------------------------------------------------
255-
int sceCdGetReadPos(void)
255+
u32 sceCdGetReadPos(void)
256256
{
257257
DPRINTF("sceCdGetReadPos\n");
258258

@@ -331,16 +331,16 @@ int cdvdman_SyncRead(u32 lsn, u32 sectors, void *buf)
331331
//-------------------------------------------------------------------------
332332
static void cdvdman_initDiskType(void)
333333
{
334-
cdvdman_stat.err = CDVD_ERR_NO;
334+
cdvdman_stat.err = SCECdErNO;
335335

336336
cdvdman_stat.disc_type_reg = (int)cdvdman_settings.common.media;
337337
DPRINTF("DiskType=0x%x\n", cdvdman_settings.common.media);
338338
}
339339

340340
//-------------------------------------------------------------------------
341-
int sceCdPosToInt(cd_location_t *p)
341+
u32 sceCdPosToInt(sceCdlLOCCD *p)
342342
{
343-
register int result;
343+
register u32 result;
344344

345345
result = ((u32)p->minute >> 16) * 10 + ((u32)p->minute & 0xF);
346346
result *= 60;
@@ -353,9 +353,9 @@ int sceCdPosToInt(cd_location_t *p)
353353
}
354354

355355
//-------------------------------------------------------------------------
356-
cd_location_t *sceCdIntToPos(int i, cd_location_t *p)
356+
sceCdlLOCCD *sceCdIntToPos(u32 i, sceCdlLOCCD *p)
357357
{
358-
register int sc, se, mi;
358+
register u32 sc, se, mi;
359359

360360
i += 150;
361361
se = i / 75;
@@ -370,7 +370,7 @@ cd_location_t *sceCdIntToPos(int i, cd_location_t *p)
370370
}
371371

372372
//-------------------------------------------------------------------------
373-
int *sceCdCallback(void *func)
373+
sceCdCBFunc sceCdCallback(sceCdCBFunc func)
374374
{
375375
int oldstate;
376376
void *old_cb;
@@ -387,7 +387,7 @@ int *sceCdCallback(void *func)
387387

388388
CpuResumeIntr(oldstate);
389389

390-
return (int *)old_cb;
390+
return old_cb;
391391
}
392392

393393
//-------------------------------------------------------------------------
@@ -431,7 +431,7 @@ int sceCdSC(int code, int *param)
431431
}
432432

433433
//-------------------------------------------------------------------------
434-
static int cdvdman_writeSCmd(u8 cmd, void *in, u32 in_size, void *out, u32 out_size)
434+
static int cdvdman_writeSCmd(u8 cmd, const void *in, u16 in_size, void *out, u16 out_size)
435435
{
436436
int i;
437437
u8 *p;
@@ -484,7 +484,7 @@ static int cdvdman_writeSCmd(u8 cmd, void *in, u32 in_size, void *out, u32 out_s
484484
}
485485

486486
//--------------------------------------------------------------
487-
int cdvdman_sendSCmd(u8 cmd, void *in, u32 in_size, void *out, u32 out_size)
487+
int cdvdman_sendSCmd(u8 cmd, const void *in, u16 in_size, void *out, u16 out_size)
488488
{
489489
int r, retryCount = 0;
490490

@@ -575,8 +575,8 @@ static void cdvdman_startThreads(void)
575575
{
576576
iop_thread_t thread_param;
577577

578-
cdvdman_stat.status = CDVD_STAT_PAUSE;
579-
cdvdman_stat.err = CDVD_ERR_NO;
578+
cdvdman_stat.status = SCECdStatPause;
579+
cdvdman_stat.err = SCECdErNO;
580580

581581
thread_param.thread = &cdvdman_cdread_Thread;
582582
thread_param.stacksize = 0x1000;

modules/iopcore/cdvdman/device-bdm.c

-20
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,9 @@
44
Review Open PS2 Loader README & LICENSE files for further details.
55
*/
66

7-
#include "smsutils.h"
8-
#include "atad.h"
9-
#include "ioplib_util.h"
10-
#include "cdvdman.h"
117
#include "internal.h"
12-
#include "cdvd_config.h"
138

149
#include <bdm.h>
15-
#include <loadcore.h>
16-
#include <stdio.h>
17-
#include <sysclib.h>
18-
#include <sysmem.h>
19-
#include <thbase.h>
20-
#include <thevent.h>
21-
#include <intrman.h>
22-
#include <ioman.h>
23-
#include <thsemap.h>
24-
#include <usbd.h>
25-
#include <errno.h>
26-
#include <io_common.h>
27-
#include "ioman_add.h"
28-
29-
#include <errno.h>
3010

3111
#include "device.h"
3212

0 commit comments

Comments
 (0)