aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/ps2/iop
diff options
context:
space:
mode:
authorEugene Sandulenko2014-04-28 21:20:42 +0300
committerEugene Sandulenko2014-04-28 21:20:42 +0300
commitc3ffbd884a2d917aede6020c4ae1ee4a13d7f861 (patch)
treeeef69449accc9a020cf1be49703a0dd698340c11 /backends/platform/ps2/iop
parent3d5dee897ef785e3f0c48ae3d857181f314700d1 (diff)
parent4592e0b586829fade4a5c800672849e693a0d151 (diff)
downloadscummvm-rg350-c3ffbd884a2d917aede6020c4ae1ee4a13d7f861.tar.gz
scummvm-rg350-c3ffbd884a2d917aede6020c4ae1ee4a13d7f861.tar.bz2
scummvm-rg350-c3ffbd884a2d917aede6020c4ae1ee4a13d7f861.zip
Merge pull request #426 from sunmax/master
PS2: Pull request to master for latest PS2 code
Diffstat (limited to 'backends/platform/ps2/iop')
-rw-r--r--backends/platform/ps2/iop/CoDyVDfs/common/codyvdirx.h14
-rw-r--r--backends/platform/ps2/iop/CoDyVDfs/iop/cdtypes.h88
-rw-r--r--backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.c72
-rw-r--r--backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.h28
-rw-r--r--backends/platform/ps2/iop/CoDyVDfs/iop/fiofs.c12
-rw-r--r--backends/platform/ps2/iop/CoDyVDfs/iop/rpcfs.c12
-rw-r--r--backends/platform/ps2/iop/rpckbd/include/ps2kbd.h4
-rw-r--r--backends/platform/ps2/iop/rpckbd/src/ps2kbd.c4
8 files changed, 117 insertions, 117 deletions
diff --git a/backends/platform/ps2/iop/CoDyVDfs/common/codyvdirx.h b/backends/platform/ps2/iop/CoDyVDfs/common/codyvdirx.h
index 81ef7cb6d0..6ac5a0bb65 100644
--- a/backends/platform/ps2/iop/CoDyVDfs/common/codyvdirx.h
+++ b/backends/platform/ps2/iop/CoDyVDfs/common/codyvdirx.h
@@ -26,13 +26,13 @@
#define CDVDFS_IRX_ID 0xD004352
// commands:
-#define READ_RTC 0
-#define SET_READ_SPEED 1
-#define DRIVE_STOP 2
-#define DRIVE_STANDBY 3
+#define READ_RTC 0
+#define SET_READ_SPEED 1
+#define DRIVE_STOP 2
+#define DRIVE_STANDBY 3
-#define CdTrayOpen 0
-#define CdTrayClose 1
-#define CdTrayCheck 2
+#define CdTrayOpen 0
+#define CdTrayClose 1
+#define CdTrayCheck 2
#endif // CDVDFS_COMMON_H
diff --git a/backends/platform/ps2/iop/CoDyVDfs/iop/cdtypes.h b/backends/platform/ps2/iop/CoDyVDfs/iop/cdtypes.h
index ae4fd44ce5..d9bd5287c6 100644
--- a/backends/platform/ps2/iop/CoDyVDfs/iop/cdtypes.h
+++ b/backends/platform/ps2/iop/CoDyVDfs/iop/cdtypes.h
@@ -39,24 +39,24 @@ typedef struct {
} ISOPathTableRecord __attribute__ ((packed));
typedef struct {
- uint8 year; // Number of years since 1900
- uint8 month; // Month of the year from 1 to 12
- uint8 day; // Day of the Month from 1 to 31
- uint8 hour; // Hour of the day from 0 to 23
- uint8 min; // Minute of the hour from 0 to 59
- uint8 sec; // second of the minute from 0 to 59
- uint8 gmtOff; // Offset from Greenwich Mean Time in number of 15 minute intervals from -48(West) to +52(East)
+ uint8 year; // Number of years since 1900
+ uint8 month; // Month of the year from 1 to 12
+ uint8 day; // Day of the Month from 1 to 31
+ uint8 hour; // Hour of the day from 0 to 23
+ uint8 min; // Minute of the hour from 0 to 59
+ uint8 sec; // second of the minute from 0 to 59
+ uint8 gmtOff; // Offset from Greenwich Mean Time in number of 15 minute intervals from -48(West) to +52(East)
uint8 padding[10];
} ISOTime __attribute__ ((packed));
typedef struct {
- uint8 year; // Number of years since 1900
- uint8 month; // Month of the year from 1 to 12
- uint8 day; // Day of the Month from 1 to 31
- uint8 hour; // Hour of the day from 0 to 23
- uint8 min; // Minute of the hour from 0 to 59
- uint8 sec; // second of the minute from 0 to 59
- uint8 gmtOff; // Offset from Greenwich Mean Time in number of 15 minute intervals from -48(West) to +52(East)
+ uint8 year; // Number of years since 1900
+ uint8 month; // Month of the year from 1 to 12
+ uint8 day; // Day of the Month from 1 to 31
+ uint8 hour; // Hour of the day from 0 to 23
+ uint8 min; // Minute of the hour from 0 to 59
+ uint8 sec; // second of the minute from 0 to 59
+ uint8 gmtOff; // Offset from Greenwich Mean Time in number of 15 minute intervals from -48(West) to +52(East)
//uint8 padding[10];
} ISOFileTime __attribute__ ((packed));
@@ -96,38 +96,38 @@ typedef struct {
uint8 reserved[6];
uint8 reserved2;
uint8 reserved3;
-} ISORoot __attribute__((packed)); // 0x22
+} ISORoot __attribute__((packed)); // 0x22
typedef struct {
- uint8 type; // 0x00
- char identifier[5]; // 0x01
- uint8 version; // 0x06
- uint8 reserved1; // 0x07
- char systemIdentifier[32]; // 0x08
+ uint8 type; // 0x00
+ char identifier[5]; // 0x01
+ uint8 version; // 0x06
+ uint8 reserved1; // 0x07
+ char systemIdentifier[32]; // 0x08
char volumeIdentifier[32]; // 0x28
- uint8 reserved2[8]; // 0x48
- uint32 volumeSpaceSize; // 0x50
- uint32 volumeSpaceSizeBE; // 0x54
- char reserved3[32]; // 0x58
- uint32 volumeSetSize; // 0x78
- uint32 volumeSequenceNumber; // 0x7C
- uint32 logicalBlockSize; // 0x80
- uint32 pathTableSize; // 0x84
- uint32 pathTableSizeBE; // 0x88
- uint32 pathTablePos; // 0x8C
- uint32 pathTable2Pos; // 0x90
- uint32 pathTablePosBE; // 0x94
- uint32 pathTable2PosBE; // 0x98
- ISORoot rootDir; // 0x9C
- ISOIds ids; // 0xBE
- ISOTime creation; // 0x32D
- ISOTime modification; // 0x33E
- ISOTime expiration; // 0x34F
- ISOTime effective; // 0x360
- uint8 fileStructureVersion; // 0x371
- uint8 reserved4; // 0x372
- uint8 applicationUse[512]; // 0x373
- uint8 reserved5[653]; // 0x573
-} ISOPvd __attribute__ ((packed)); // 0x800
+ uint8 reserved2[8]; // 0x48
+ uint32 volumeSpaceSize; // 0x50
+ uint32 volumeSpaceSizeBE; // 0x54
+ char reserved3[32]; // 0x58
+ uint32 volumeSetSize; // 0x78
+ uint32 volumeSequenceNumber; // 0x7C
+ uint32 logicalBlockSize; // 0x80
+ uint32 pathTableSize; // 0x84
+ uint32 pathTableSizeBE; // 0x88
+ uint32 pathTablePos; // 0x8C
+ uint32 pathTable2Pos; // 0x90
+ uint32 pathTablePosBE; // 0x94
+ uint32 pathTable2PosBE; // 0x98
+ ISORoot rootDir; // 0x9C
+ ISOIds ids; // 0xBE
+ ISOTime creation; // 0x32D
+ ISOTime modification; // 0x33E
+ ISOTime expiration; // 0x34F
+ ISOTime effective; // 0x360
+ uint8 fileStructureVersion; // 0x371
+ uint8 reserved4; // 0x372
+ uint8 applicationUse[512]; // 0x373
+ uint8 reserved5[653]; // 0x573
+} ISOPvd __attribute__ ((packed)); // 0x800
#endif // __CDTYPES_H__
diff --git a/backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.c b/backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.c
index e55e62853b..2a94560843 100644
--- a/backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.c
+++ b/backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.c
@@ -59,7 +59,7 @@ int verifyDriveReady(void) {
return -1; // drive still not ready
}
}
- if (mediaType == DISC_NONE)
+ if (mediaType == DISC_NONE)
return -1;
return 0;
}
@@ -72,14 +72,14 @@ int cacheEnterDir(ISODirectoryRecord *dir) {
cachedDirOfs = 0;
cacheName = cachedDir + strlen(cachedDir);
memcpy(cacheName, dir->name, dir->len_fi);
- cacheName[dir->len_fi] = '/';
+ cacheName[dir->len_fi] = '/';
cacheName[dir->len_fi + 1] = '\0';
return cdReadSectors(cachedDirLba, 1, cacheBuf, &rmode);
}
int initRootCache(void) {
CdRMode rmode = { 16, 0, CdSect2048, 0 };
- ISODirectoryRecord *root = (ISODirectoryRecord*)cacheBuf;
+ ISODirectoryRecord *root = (ISODirectoryRecord *)cacheBuf;
if (cdReadSectors(fsRootLba, 1, cacheBuf, &rmode) == 0) {
cachedDir[0] = '\0';
@@ -104,10 +104,10 @@ ISODirectoryRecord *findEntryInCache(const char *name, int nameLen) {
if (i != cachedDirOfs) {
if (cdReadSectors(cachedDirLba + i, 1, cacheBuf, &rmode) < 0)
return NULL;
- cachedDirOfs = i;
+ cachedDirOfs = i;
}
- while (entry->len_dr && ((uint8*)entry < cacheBuf + SECTOR_SIZE)) {
+ while (entry->len_dr && ((uint8 *)entry < cacheBuf + SECTOR_SIZE)) {
if ((entry->len_fi > 2) && (entry->name[entry->len_fi - 2] == ';') && (entry->name[entry->len_fi - 1] == '1')) {
if ((nameLen == entry->len_fi - 2) && (strnicmp(name, entry->name, entry->len_fi - 2) == 0))
return entry;
@@ -115,10 +115,10 @@ ISODirectoryRecord *findEntryInCache(const char *name, int nameLen) {
if ((nameLen == entry->len_fi) && (strnicmp(name, entry->name, entry->len_fi) == 0))
return entry;
}
- entry = (ISODirectoryRecord *)( (uint8*)entry + entry->len_dr );
+ entry = (ISODirectoryRecord *)( (uint8 *)entry + entry->len_dr );
}
}
- return NULL;
+ return NULL;
}
ISODirectoryRecord *findPath(const char *path) {
@@ -225,12 +225,12 @@ int initDisc(void) {
case 1:
discType = DISC_MODE1;
printf("Disc: Mode1\n");
- pvd = (ISOPvd*)(cacheBuf + 4);
+ pvd = (ISOPvd *)(cacheBuf + 4);
break;
case 2:
discType = DISC_MODE2;
printf("Disc: Mode2\n");
- pvd = (ISOPvd*)(cacheBuf + 12);
+ pvd = (ISOPvd *)(cacheBuf + 12);
break;
default:
DBG_PRINTF("Unknown Sector Type %02X\n", cacheBuf[3]);
@@ -257,7 +257,7 @@ int initDisc(void) {
mediaType = discType;
DBG_PRINTF("Root directory in sector %d\n", fsRootLba);
- return initRootCache();
+ return initRootCache();
}
}
}
@@ -290,46 +290,46 @@ int cd_init(iop_device_t *dev) {
}
iop_device_ops_t FS_ops = {
- (void *) cd_init,
- (void *) cd_dummy,
- (void *) cd_dummy,
- (void *) cd_open,
- (void *) cd_close,
- (void *) cd_read,
- (void *) cd_dummy,
- (void *) cd_lseek,
- (void *) cd_dummy,
- (void *) cd_dummy,
- (void *) cd_dummy,
- (void *) cd_dummy,
- (void *) cd_dopen,
- (void *) cd_dclose,
- (void *) cd_dread,
- (void *) cd_dummy,
- (void *) cd_dummy,
+ (void *) cd_init,
+ (void *) cd_dummy,
+ (void *) cd_dummy,
+ (void *) cd_open,
+ (void *) cd_close,
+ (void *) cd_read,
+ (void *) cd_dummy,
+ (void *) cd_lseek,
+ (void *) cd_dummy,
+ (void *) cd_dummy,
+ (void *) cd_dummy,
+ (void *) cd_dummy,
+ (void *) cd_dopen,
+ (void *) cd_dclose,
+ (void *) cd_dread,
+ (void *) cd_dummy,
+ (void *) cd_dummy,
};
#define FS_NAME "cdfs"
#define FS_DESC "CD-ROM"
iop_device_t fsdriver = {
- FS_NAME,
- IOP_DT_FS | IOP_DT_FSEXT,
- 1,
- FS_DESC,
- &FS_ops
+ FS_NAME,
+ IOP_DT_FS | IOP_DT_FSEXT,
+ 1,
+ FS_DESC,
+ &FS_ops
};
int _start(void) {
- printf("CoDyVDfs v0.01\n");
+ printf("CoDyVDfs v0.01\n");
CdInit(1);
- DelDrv(FS_NAME);
- AddDrv(&fsdriver);
+ DelDrv(FS_NAME);
+ AddDrv(&fsdriver);
initRpc();
initFio();
- return(0);
+ return(0);
}
int strnicmp(const char *s1, const char *s2, int n) {
diff --git a/backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.h b/backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.h
index d50e89e4f3..cc903ea841 100644
--- a/backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.h
+++ b/backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.h
@@ -51,20 +51,20 @@ enum ReadModes {
};
enum {
- CdDiskNone = 0x00,
- CdDiskDetect, // 0x01
- CdDiskDetectCD, // 0x02
- CdDiskDetectDVD, // 0x03
- CdDiskDetectUnk = 0x05,
- CdDiskCDPS1 = 0x10,
- CdDiskCDDAPS1 = 0x11,
- CdDiskCDPS2 = 0x12,
- CdDiskCDDAPS2 = 0x13,
- CdDiskDVDPS2 = 0x14,
- CdDiskDVDV2 = 0xFC,
- CdDiskCDDA = 0xFD,
- CdDiskDVDV = 0xFE,
- CdDiskIllegal = 0xFF
+ CdDiskNone = 0x00,
+ CdDiskDetect, // 0x01
+ CdDiskDetectCD, // 0x02
+ CdDiskDetectDVD, // 0x03
+ CdDiskDetectUnk = 0x05,
+ CdDiskCDPS1 = 0x10,
+ CdDiskCDDAPS1 = 0x11,
+ CdDiskCDPS2 = 0x12,
+ CdDiskCDDAPS2 = 0x13,
+ CdDiskDVDPS2 = 0x14,
+ CdDiskDVDV2 = 0xFC,
+ CdDiskCDDA = 0xFD,
+ CdDiskDVDV = 0xFE,
+ CdDiskIllegal = 0xFF
};
#define DISC_NOT_READY(type) ((type > CdDiskNone) && (type < CdDiskCDPS1) && (type != CdDiskDetectUnk))
diff --git a/backends/platform/ps2/iop/CoDyVDfs/iop/fiofs.c b/backends/platform/ps2/iop/CoDyVDfs/iop/fiofs.c
index f0a06f927b..611211a715 100644
--- a/backends/platform/ps2/iop/CoDyVDfs/iop/fiofs.c
+++ b/backends/platform/ps2/iop/CoDyVDfs/iop/fiofs.c
@@ -104,7 +104,7 @@ int cd_open(iop_file_t *handle, const char *name, int mode) {
fd->pos = 0;
fd->cachedLba = 0;
- handle->privdata = (void*)fdSlot;
+ handle->privdata = (void *)fdSlot;
return 0;
}
@@ -135,7 +135,7 @@ int cd_read(iop_file_t *handle, void *dest, int length) {
FioHandle *fd = fioHandles + (int)handle->privdata;
CdRMode rmode = { 16, 0, CdSect2048, 0 };
int readLba, readPos, bytesLeft;
- uint8 *destPos = (uint8*)dest;
+ uint8 *destPos = (uint8 *)dest;
int doCopy;
int numLba;
readLba = fd->lba + (fd->pos >> 11);
@@ -171,13 +171,13 @@ int cd_read(iop_file_t *handle, void *dest, int length) {
numLba = bytesLeft >> 11;
if (cdReadSectors(readLba, numLba, destPos, &rmode) != 0)
break;
- readLba += numLba;
+ readLba += numLba;
fd->pos += numLba << 11;
destPos += numLba << 11;
bytesLeft &= 0x7FF;
}
}
- return destPos - (uint8*)dest;
+ return destPos - (uint8 *)dest;
}
int cd_close(iop_file_t *handle) {
@@ -219,7 +219,7 @@ int cd_dopen(iop_file_t *handle, const char *path) {
}
dioHandles[fdSlot].curOfs = 0;
dioHandles[fdSlot].lbaOfs = 0;
- handle->privdata = (void*)fdSlot;
+ handle->privdata = (void *)fdSlot;
return fdSlot;
}
@@ -252,7 +252,7 @@ int cd_dread(iop_file_t *handle, iox_dirent_t *buf) {
}
}
}
- return 0;
+ return 0;
}
int cd_dclose(iop_file_t *handle) {
diff --git a/backends/platform/ps2/iop/CoDyVDfs/iop/rpcfs.c b/backends/platform/ps2/iop/CoDyVDfs/iop/rpcfs.c
index 5b760faa06..983ae38716 100644
--- a/backends/platform/ps2/iop/CoDyVDfs/iop/rpcfs.c
+++ b/backends/platform/ps2/iop/CoDyVDfs/iop/rpcfs.c
@@ -69,11 +69,11 @@ void *rpcReadClock(void *data) {
void *driveStop(void *data) {
if (CdStop() == 1) {
if (CdSync(0) == 0) {
- *(int*)data = CdGetError();
+ *(int *)data = CdGetError();
} else
- *(int*)data = -0x100;
+ *(int *)data = -0x100;
} else
- *(int*)data = -0x101;
+ *(int *)data = -0x101;
return data;
}
@@ -81,11 +81,11 @@ void *driveStandby(void *data) {
int type;
if (CdStandby() == 1) {
if (CdSync(0) == 0) {
- *(int*)data = CdGetError();
+ *(int *)data = CdGetError();
} else
- *(int*)data = -0x100;
+ *(int *)data = -0x100;
} else
- *(int*)data = -0x101;
+ *(int *)data = -0x101;
do { // wait until drive detected disc type
type = CdGetDiskType();
diff --git a/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h b/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h
index 07d9c3d7f9..6bef7caefa 100644
--- a/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h
+++ b/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h
@@ -87,8 +87,8 @@ typedef struct _kbd_keymap
#define KBD_RPC_SETSPECIALMAP 7 /* Sets the special key mapping */
#define KBD_RPC_FLUSHBUFFER 9 /* Flush the internal buffer, probably best after a keymap change */
#define KBD_RPC_RESETKEYMAP 10 /* Reset keymaps to default states */
-#define KBD_RPC_READKEY 11
-#define KBD_RPC_READRAW 12
+#define KBD_RPC_READKEY 11
+#define KBD_RPC_READRAW 12
/* Note on keymaps. In normal keymap a 0 would indicate no key */
/* Key maps are represented by 3 256*8bit tables. First table maps USB key to a char when not shifted */
diff --git a/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c b/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c
index 7266afdce5..838ce9fe85 100644
--- a/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c
+++ b/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c
@@ -1089,7 +1089,7 @@ void *ps2kbd_rpc_server(int fno, void *data, int size) {
ps2kbd_rpc_flushbuffer();
break;
case KBD_RPC_SETLEDS:
- ps2kbd_rpc_setleds(*(u8*) data);
+ ps2kbd_rpc_setleds(*(u8 *) data);
break;
case KBD_RPC_RESETKEYMAP:
ps2kbd_rpc_resetkeymap();
@@ -1129,7 +1129,7 @@ int ps2kbd_init_rpc(void) {
int th;
param.attr = 0x02000000;
- param.thread = (void*)ps2kbd_start_rpc;
+ param.thread = (void *)ps2kbd_start_rpc;
param.priority = 40;
param.stacksize = 0x800;
param.option = 0;