[Scummvm-cvs-logs] scummvm master -> c3ffbd884a2d917aede6020c4ae1ee4a13d7f861

sev- sev at scummvm.org
Mon Apr 28 20:21:55 CEST 2014


This automated email contains information about 37 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
17e8a6f220 PS2: cleaned cast (X*) -> (X *)
14f3a09c8c PS2: used C++ const_cast<...> where appropriate
b75c7f6bc4 PS2: added missing casts
e73027f2b8 PS2: fixed tabs and alignment
00b2e12897 PS2: Ps2Pad::initPad added case STAT_NONE
8e009b447b PS2: renamed animThread -> playAnim to avoid shadowing
623a0e7d61 PS2: use createPixelFormat for overlay format
7287448e89 PS2: commented out unused Gs2dScreen::tvMode
d687417da5 Makefile.common: added QUIET_CC
a2313aef66 configure: enhanced PS2 support
7dc0a54c5d PS2: beautified & simplified version on screen
33b22acc5d PS2: beautified & simplified version on screen
263a0972a3 PS2: removed plugins cksum deps on build time
5ba5434688 PS2: removed plugins cksum deps on build time
a960ec7adf PS2: snprintf hack to fix scumm.plg
fb69d8eddc PS2: enhanced Makefile.ps2 (incl. modules & debug)
1cbb90d8ea PS2: modular IRX drivers loading
ca2f0f0067 PS2: added [PlayStation2] section to scummvm.ini
beee456c68 PS2: support for different gfx modes
27735638c2 PS2: ps2pad.cpp - fixed duplicate switch case
066c2825a6 PS2: converted malloc(x) -> memalign(64, x)
61aaf9bafb PS2: reverted createPixelFormat to _overlayFormat
d211d579a2 PS2: do not assume _tvMode and _gfxMode are init 0
001e3f7658 PS2: modified sword25 loslib.cpp to support PS2
90d1e99968 PS2: added missing default engines to Makefile.ps2
b69a2c81a7 PS2: scummsys.h (u)int64 is "long" for PS2
4ccdb3e2a3 Merge branch 'master' of git://github.com/scummvm/scummvm
487e642d00 PS2: Support for latest SDK with -D__NEW_PS2SDK__
ab3a1b5e0c PS2: commented "offending" free in startIrxModules
c16c6653a1 PS2: Improved support for profiling (gprof) build
6487c362a1 PS2: Init Ps2Input after USB drivers are loaded
5e36716be5 PS2: Made it quieter unless -DLOGORRHEIC is set
0f264e2d73 PS2: Added compact Makefile.ps2.dev for debug
c65464a43b PS2: Added support for latest SDK in configure
68836e00c9 PS2: Added README.PS2
4592e0b586 Merge remote-tracking branch 'local/master'
c3ffbd884a Merge pull request #426 from sunmax/master


Commit: 17e8a6f220eb524bfebe07067266799268b45e04
    https://github.com/scummvm/scummvm/commit/17e8a6f220eb524bfebe07067266799268b45e04
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-18T12:40:58-05:00

Commit Message:
PS2: cleaned cast (X*) -> (X *)

Changed paths:
    backends/platform/ps2/Gs2dScreen.cpp
    backends/platform/ps2/Gs2dScreen.h
    backends/platform/ps2/GsDefs.h
    backends/platform/ps2/asyncfio.cpp
    backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.c
    backends/platform/ps2/iop/CoDyVDfs/iop/fiofs.c
    backends/platform/ps2/iop/CoDyVDfs/iop/rpcfs.c
    backends/platform/ps2/iop/rpckbd/src/ps2kbd.c
    backends/platform/ps2/sysdefs.h
    backends/platform/ps2/systemps2.cpp



diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp
index 58667c0..3a90c19 100644
--- a/backends/platform/ps2/Gs2dScreen.cpp
+++ b/backends/platform/ps2/Gs2dScreen.cpp
@@ -296,7 +296,7 @@ void Gs2dScreen::createAnimTextures(void) {
 	for (int i = 0; i < 16; i++) {
 		uint32 *destPos = (uint32 *)buf;
 		for (int ch = 15; ch >= 0; ch--) {
-			const uint32 *src = (const uint32*)(_binaryData + ((_binaryPattern[i] >> ch) & 1) * 4 * 14);
+			const uint32 *src = (const uint32 *)(_binaryData + ((_binaryPattern[i] >> ch) & 1) * 4 * 14);
 			for (int line = 0; line < 14; line++)
 				destPos[line << 4] = src[line];
 			destPos++;
diff --git a/backends/platform/ps2/Gs2dScreen.h b/backends/platform/ps2/Gs2dScreen.h
index 1a70dad..c9b9b54 100644
--- a/backends/platform/ps2/Gs2dScreen.h
+++ b/backends/platform/ps2/Gs2dScreen.h
@@ -49,7 +49,7 @@ public:
 	uint16 getWidth(void);
 	uint16 getHeight(void);
 
-	void copyPrintfOverlay(const uint8* buf);
+	void copyPrintfOverlay(const uint8 *buf);
 	void clearPrintfOverlay(void);
 
 	Graphics::Surface *lockScreen();
diff --git a/backends/platform/ps2/GsDefs.h b/backends/platform/ps2/GsDefs.h
index fab0c40..9e7bab7 100644
--- a/backends/platform/ps2/GsDefs.h
+++ b/backends/platform/ps2/GsDefs.h
@@ -27,13 +27,13 @@
 
 // Gs2dScreen defines:
 
-#define PAL_NTSC_FLAG		(*(volatile uint8*)0x1FC7FF52)
+#define PAL_NTSC_FLAG		(*(volatile uint8 *)0x1FC7FF52)
 
-#define GS_PMODE			*((volatile uint64*)0x12000000)
-#define GS_CSR				*((volatile uint64*)0x12001000)
-#define GS_DISPFB1			*((volatile uint64*)0x12000070)
-#define GS_DISPLAY1			*((volatile uint64*)0x12000080)
-#define GS_BGCOLOUR			*((volatile uint64*)0x120000E0)
+#define GS_PMODE			*((volatile uint64 *)0x12000000)
+#define GS_CSR				*((volatile uint64 *)0x12001000)
+#define GS_DISPFB1			*((volatile uint64 *)0x12000070)
+#define GS_DISPLAY1			*((volatile uint64 *)0x12000080)
+#define GS_BGCOLOUR			*((volatile uint64 *)0x120000E0)
 
 enum GS_CSR_FIELDS {
     CSR_SIGNAL = 1 << 0,
diff --git a/backends/platform/ps2/asyncfio.cpp b/backends/platform/ps2/asyncfio.cpp
index 3f20349..7e06172 100644
--- a/backends/platform/ps2/asyncfio.cpp
+++ b/backends/platform/ps2/asyncfio.cpp
@@ -90,7 +90,7 @@ void AsyncFio::read(int fd, void *dest, unsigned int len) {
 	checkSync();
 	assert(fd < MAX_HANDLES);
 	_runningOp = _ioSlots + fd;
-	fileXioRead(fd, (unsigned char*)dest, len);
+	fileXioRead(fd, (unsigned char *)dest, len);
 	SignalSema(_ioSema);
 }
 
@@ -99,7 +99,7 @@ void AsyncFio::write(int fd, const void *src, unsigned int len) {
 	checkSync();
 	assert(fd < MAX_HANDLES);
 	_runningOp = _ioSlots + fd;
-	fileXioWrite(fd, (unsigned char*)src, len);
+	fileXioWrite(fd, (unsigned char *)src, len);
 	SignalSema(_ioSema);
 }
 
diff --git a/backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.c b/backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.c
index e55e628..932d589 100644
--- a/backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.c
+++ b/backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.c
@@ -79,7 +79,7 @@ int cacheEnterDir(ISODirectoryRecord *dir) {
 
 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';
@@ -107,7 +107,7 @@ ISODirectoryRecord *findEntryInCache(const char *name, int nameLen) {
             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,7 +115,7 @@ 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;
@@ -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]);
diff --git a/backends/platform/ps2/iop/CoDyVDfs/iop/fiofs.c b/backends/platform/ps2/iop/CoDyVDfs/iop/fiofs.c
index f0a06f9..5c5cbf9 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);
@@ -177,7 +177,7 @@ int cd_read(iop_file_t *handle, void *dest, int length) {
 			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;
 }
 
diff --git a/backends/platform/ps2/iop/CoDyVDfs/iop/rpcfs.c b/backends/platform/ps2/iop/CoDyVDfs/iop/rpcfs.c
index 5b760fa..983ae38 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/src/ps2kbd.c b/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c
index 7266afd..838ce9f 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;
diff --git a/backends/platform/ps2/sysdefs.h b/backends/platform/ps2/sysdefs.h
index 0114402..a4ada47 100644
--- a/backends/platform/ps2/sysdefs.h
+++ b/backends/platform/ps2/sysdefs.h
@@ -40,30 +40,30 @@ enum Interrupts {
 };
 
 // dma 2 registers
-#define D2_CHCR (*(volatile uint32*)0x1000A000)
-#define D2_QWC  (*(volatile uint32*)0x1000A020)
-#define D2_TADR (*(volatile uint32*)0x1000A030)
-#define D2_MADR (*(volatile uint32*)0x1000A010)
-#define D2_ASR1 (*(volatile uint32*)0x1000A050)
-#define D2_ASR0 (*(volatile uint32*)0x1000A040)
+#define D2_CHCR (*(volatile uint32 *)0x1000A000)
+#define D2_QWC  (*(volatile uint32 *)0x1000A020)
+#define D2_TADR (*(volatile uint32 *)0x1000A030)
+#define D2_MADR (*(volatile uint32 *)0x1000A010)
+#define D2_ASR1 (*(volatile uint32 *)0x1000A050)
+#define D2_ASR0 (*(volatile uint32 *)0x1000A040)
 
-#define D_CTRL  (*(volatile uint32*)0x1000E000)
-#define D_STAT  (*(volatile uint32*)0x1000E010)
-#define D_PCR   (*(volatile uint32*)0x1000E020)
-#define D_SQWC  (*(volatile uint32*)0x1000E030)
-#define D_RBSR  (*(volatile uint32*)0x1000E040)
-#define D_RBOR  (*(volatile uint32*)0x1000E050)
-#define D_STADR (*(volatile uint32*)0x1000E060)
+#define D_CTRL  (*(volatile uint32 *)0x1000E000)
+#define D_STAT  (*(volatile uint32 *)0x1000E010)
+#define D_PCR   (*(volatile uint32 *)0x1000E020)
+#define D_SQWC  (*(volatile uint32 *)0x1000E030)
+#define D_RBSR  (*(volatile uint32 *)0x1000E040)
+#define D_RBOR  (*(volatile uint32 *)0x1000E050)
+#define D_STADR (*(volatile uint32 *)0x1000E060)
 
 #define CIM2 (1 << 18)
 #define CIS2 (1 << 2)
 
 
 // timer 0 registers
-#define T0_COUNT (*(volatile uint32*)0x10000000)
-#define T0_MODE  (*(volatile uint32*)0x10000010)
-#define T0_COMP  (*(volatile uint32*)0x10000020)
-#define T0_HOLD  (*(volatile uint32*)0x10000030)
+#define T0_COUNT (*(volatile uint32 *)0x10000000)
+#define T0_MODE  (*(volatile uint32 *)0x10000010)
+#define T0_COMP  (*(volatile uint32 *)0x10000020)
+#define T0_HOLD  (*(volatile uint32 *)0x10000030)
 
 #define TIMER_MODE(clks, gate, gates, gatem, zeroret, cue, cmpe, ovfe, equf, ovff) \
 	((clks) | ((gate) << 2) | ((gates) << 3) | ((gatem) << 4) | ((zeroret) << 6) | \
diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index a7d782b..9882974 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -184,7 +184,7 @@ void systemSoundThread(OSystem_PS2 *system) {
 }
 
 void gluePowerOffCallback(void *system) {
-	((OSystem_PS2*)system)->powerOffCallback();
+	((OSystem_PS2 *)system)->powerOffCallback();
 }
 
 void OSystem_PS2::startIrxModules(int numModules, IrxReference *modules) {
@@ -491,7 +491,7 @@ void OSystem_PS2::soundThreadCallback(void) {
 			// and feed it into the SPU
 			// non-blocking call, the function will return before the buffer's content
 			// was transferred.
-			SjPCM_Enqueue((short int*)soundBufL, (short int*)soundBufR, SMP_PER_BLOCK, 0);
+			SjPCM_Enqueue((short int *)soundBufL, (short int *)soundBufR, SMP_PER_BLOCK, 0);
 			bufferedSamples += SMP_PER_BLOCK;
 		}
 	}
@@ -555,7 +555,7 @@ void OSystem_PS2::grabPalette(byte *colors, uint start, uint num) {
 }
 
 void OSystem_PS2::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {
-	_screen->copyScreenRect((const uint8*)buf, pitch, x, y, w, h);
+	_screen->copyScreenRect((const uint8 *)buf, pitch, x, y, w, h);
 }
 
 void OSystem_PS2::updateScreen(void) {


Commit: 14f3a09c8ccb1b821924234ce4e330382ef5d5ab
    https://github.com/scummvm/scummvm/commit/14f3a09c8ccb1b821924234ce4e330382ef5d5ab
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-18T13:38:12-05:00

Commit Message:
PS2: used C++ const_cast<...> where appropriate

Changed paths:
    backends/platform/ps2/asyncfio.cpp



diff --git a/backends/platform/ps2/asyncfio.cpp b/backends/platform/ps2/asyncfio.cpp
index 7e06172..357ca95 100644
--- a/backends/platform/ps2/asyncfio.cpp
+++ b/backends/platform/ps2/asyncfio.cpp
@@ -33,7 +33,7 @@
 
 AsyncFio::AsyncFio(void) {
 	_runningOp = NULL;
-	memset((int *)_ioSlots, 0, MAX_HANDLES * sizeof(int));
+	memset(const_cast<int *>(_ioSlots), 0, MAX_HANDLES * sizeof(int));
 	ee_sema_t newSema;
 	newSema.init_count = 1;
 	newSema.max_count = 1;
@@ -80,7 +80,7 @@ void AsyncFio::close(int handle) {
 
 void AsyncFio::checkSync(void) {
 	if (_runningOp) {
-		fileXioWaitAsync(FXIO_WAIT, (int *)_runningOp);
+		fileXioWaitAsync(FXIO_WAIT, const_cast<int *>(_runningOp));
 		_runningOp = NULL;
 	}
 }
@@ -99,7 +99,7 @@ void AsyncFio::write(int fd, const void *src, unsigned int len) {
 	checkSync();
 	assert(fd < MAX_HANDLES);
 	_runningOp = _ioSlots + fd;
-	fileXioWrite(fd, (unsigned char *)src, len);
+	fileXioWrite(fd, (unsigned char *)const_cast<void *>(src), len);
 	SignalSema(_ioSema);
 }
 
@@ -210,7 +210,7 @@ bool AsyncFio::poll(int fd) {
 	bool retVal = false;
 	if (PollSema(_ioSema) >= 0) {
 		if (_runningOp == _ioSlots + fd) {
-			if (fileXioWaitAsync(FXIO_NOWAIT, (int *)_runningOp) == FXIO_COMPLETE) {
+			if (fileXioWaitAsync(FXIO_NOWAIT, const_cast<int *>(_runningOp)) == FXIO_COMPLETE) {
 				_runningOp = NULL;
 				retVal = true;
 			} else
@@ -226,7 +226,7 @@ bool AsyncFio::fioAvail(void) {
 	bool retVal = false;
 	if (PollSema(_ioSema) > 0) {
 		if (_runningOp) {
-			if (fileXioWaitAsync(FXIO_NOWAIT, (int *)_runningOp) == FXIO_COMPLETE) {
+			if (fileXioWaitAsync(FXIO_NOWAIT, const_cast<int *>(_runningOp)) == FXIO_COMPLETE) {
 				_runningOp = NULL;
 				retVal = true;
 			} else


Commit: b75c7f6bc4a7245ab88fca760ad303df7e5da7ef
    https://github.com/scummvm/scummvm/commit/b75c7f6bc4a7245ab88fca760ad303df7e5da7ef
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-18T13:39:20-05:00

Commit Message:
PS2: added missing casts

Changed paths:
    backends/platform/ps2/cd.c
    backends/platform/ps2/rpckbd.c



diff --git a/backends/platform/ps2/cd.c b/backends/platform/ps2/cd.c
index cd44b3d..1c54174 100644
--- a/backends/platform/ps2/cd.c
+++ b/backends/platform/ps2/cd.c
@@ -31,7 +31,7 @@ int cdvdInit(int mode)
     cdvdCd.server = NULL;
 
     do {
-        if ((ret = SifBindRpc(&cdvdCd, CDVD_INIT_BIND_RPC, 0)) < 0) {
+        if ((ret = SifBindRpc(&cdvdCd, (signed)CDVD_INIT_BIND_RPC, 0)) < 0) {
             return -1;
         }
         if (!cdvdCd.server) {
@@ -40,7 +40,7 @@ int cdvdInit(int mode)
     }
 	while(!cdvdCd.server);
 
-    pkt = sendBuffer;
+    pkt = (unsigned char *)sendBuffer;
     PUSHDATA( int, pkt, mode, i);
     pkt += i; len += i;
 
diff --git a/backends/platform/ps2/rpckbd.c b/backends/platform/ps2/rpckbd.c
index 0bb4520..e7975ab 100644
--- a/backends/platform/ps2/rpckbd.c
+++ b/backends/platform/ps2/rpckbd.c
@@ -17,7 +17,7 @@
 #include <string.h>
 #include "backends/platform/ps2/rpckbd.h"
 
-static int curr_readmode = PS2KBD_READMODE_NORMAL;
+static unsigned int curr_readmode = PS2KBD_READMODE_NORMAL;
 static int kbdRpcSema = -1;
 static int kbdInitialized = 0;
 


Commit: e73027f2b8891eb84abd700c7832efd0dcbf0898
    https://github.com/scummvm/scummvm/commit/e73027f2b8891eb84abd700c7832efd0dcbf0898
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-18T13:39:35-05:00

Commit Message:
PS2: fixed tabs and alignment

Changed paths:
    backends/platform/ps2/DmaPipe.cpp
    backends/platform/ps2/Gs2dScreen.cpp
    backends/platform/ps2/GsDefs.h
    backends/platform/ps2/asyncfio.cpp
    backends/platform/ps2/cd.c
    backends/platform/ps2/eecodyvdfs.h
    backends/platform/ps2/fileio.h
    backends/platform/ps2/iop/CoDyVDfs/common/codyvdirx.h
    backends/platform/ps2/iop/CoDyVDfs/iop/cdtypes.h
    backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.c
    backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.h
    backends/platform/ps2/iop/CoDyVDfs/iop/fiofs.c
    backends/platform/ps2/iop/rpckbd/include/ps2kbd.h
    backends/platform/ps2/ps2input.cpp
    backends/platform/ps2/ps2input.h
    backends/platform/ps2/ps2pad.cpp
    backends/platform/ps2/ps2time.cpp
    backends/platform/ps2/savefilemgr.cpp
    backends/platform/ps2/systemps2.cpp
    backends/platform/ps2/systemps2.h



diff --git a/backends/platform/ps2/DmaPipe.cpp b/backends/platform/ps2/DmaPipe.cpp
index a346a67..f3622ea 100644
--- a/backends/platform/ps2/DmaPipe.cpp
+++ b/backends/platform/ps2/DmaPipe.cpp
@@ -50,7 +50,7 @@ DmaPipe::DmaPipe(uint32 size) {
 	size &= ~0x1F;
 	_buf = (uint64 *)memalign(64, size);
 	_curPipe = 0;
-    _pipes[0] = new SinglePipe(_buf, size >> 4);
+	_pipes[0] = new SinglePipe(_buf, size >> 4);
 	_pipes[1] = new SinglePipe(_buf + (size >> 4), size >> 4);
 
 	// reset DMAC Channel 2
@@ -80,7 +80,7 @@ void DmaPipe::uploadTex(uint32 dest, uint16 bufWidth, uint16 destOfsX, uint16 de
 	*(_pipes[_curPipe]->_chainHead) |= (1 << 28);
 	_pipes[_curPipe]->setGifLoopTag(4);
 	_pipes[_curPipe]->setReg(GPR_BITBLTBUF, GS_SET_DEST_BLTBUF((dest/256) & 0x3fff, (bufWidth/64) & 0x3f, pixelFmt & 0x3f));
-	_pipes[_curPipe]->setReg(	GPR_TRXPOS, GS_SET_DEST_TRXPOS(destOfsX, destOfsY));
+	_pipes[_curPipe]->setReg(   GPR_TRXPOS, GS_SET_DEST_TRXPOS(destOfsX, destOfsY));
 	_pipes[_curPipe]->setReg(   GPR_TRXREG, GS_SET_TRXREG(width, height));
 	_pipes[_curPipe]->setReg(   GPR_TRXDIR, 0);
 
@@ -194,7 +194,7 @@ void DmaPipe::setConfig(uint8 prModeCont, uint8 dither, uint8 colClamp) {
 
 	// set some defaults
 	// alpha blending formula: (A-B) * C + D
-		// set: A = dest pixel, b = 0, C = source alpha, D = source pixel, fix = don't care
+	// set: A = dest pixel, b = 0, C = source alpha, D = source pixel, fix = don't care
 
 	_pipes[_curPipe]->setReg(GPR_ALPHA_1, GS_SET_ALPHA(DEST_COLOR, ZERO_COLOR, SOURCE_ALPHA, SOURCE_COLOR, 0));
 	_pipes[_curPipe]->setReg(   GPR_PRIM, 0);
@@ -279,7 +279,7 @@ void SinglePipe::appendChain(uint64 dmaTag) {
 void SinglePipe::setReg(uint64 reg, uint64 value) {
 	*_bufPos++ = value;
 	*_bufPos++ = reg;
-    (*_chainSize)++;
+	(*_chainSize)++;
 }
 
 void SinglePipe::setListReg(uint64 value1, uint64 value2) {
diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp
index 3a90c19..cecc08d 100644
--- a/backends/platform/ps2/Gs2dScreen.cpp
+++ b/backends/platform/ps2/Gs2dScreen.cpp
@@ -77,7 +77,7 @@ void runAnimThread(Gs2dScreen *param);
 
 int vblankStartHandler(int cause) {
 	// start of VBlank period
-	if (g_VblankCmd) {			  // is there a new image waiting?
+	if (g_VblankCmd) {                // is there a new image waiting?
 		GS_DISPFB1 = g_VblankCmd; // show it.
 		g_VblankCmd = 0;
 		iSignalSema(g_VblankSema);
@@ -87,8 +87,8 @@ int vblankStartHandler(int cause) {
 
 int dmacHandler(int channel) {
 	if (g_DmacCmd && (channel == 2)) { // GS DMA transfer finished,
-		g_VblankCmd = g_DmacCmd;	   // we want to show the image
-		g_DmacCmd = 0;				   // when the next vblank occurs
+		g_VblankCmd = g_DmacCmd;   // we want to show the image
+		g_DmacCmd = 0;             // when the next vblank occurs
 		iSignalSema(g_DmacSema);
 	}
 	return 0;
@@ -186,7 +186,7 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode mode) {
 	_clutPtrs[TEXT]   = _clutPtrs[SCREEN] + 0x2000;
 	_texPtrs[SCREEN]  = _clutPtrs[SCREEN] + 0x3000;
 	_texPtrs[TEXT]    = 0;                          // these buffers are stored in the alpha gaps of the frame buffers
-	_texPtrs[MOUSE]   = 128 * 256 * 4;
+	_texPtrs[MOUSE]	  = 128 * 256 * 4;
 	_texPtrs[PRINTF]  = _texPtrs[MOUSE] + M_SIZE * M_SIZE * 4;
 
 	_showOverlay = false;
@@ -249,17 +249,17 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode mode) {
 	createAnimTextures();
 
 	// create animation thread
-	ee_thread_t animationThread, thisThread;
+	ee_thread_t animThread, thisThread;
 	ReferThreadStatus(GetThreadId(), &thisThread);
 
 	_animStack = malloc(ANIM_STACK_SIZE);
-	animationThread.initial_priority = thisThread.current_priority - 3;
-	animationThread.stack      = _animStack;
-	animationThread.stack_size = ANIM_STACK_SIZE;
-	animationThread.func       = (void *)runAnimThread;
-	animationThread.gp_reg     = &_gp;
+	animThread.initial_priority = thisThread.current_priority - 3;
+	animThread.stack      = _animStack;
+	animThread.stack_size = ANIM_STACK_SIZE;
+	animThread.func       = (void *)runAnimThread;
+	animThread.gp_reg     = &_gp;
 
-	_animTid = CreateThread(&animationThread);
+	_animTid = CreateThread(&animThread);
 	assert(_animTid >= 0);
 	StartThread(_animTid, this);
 }
@@ -302,9 +302,9 @@ void Gs2dScreen::createAnimTextures(void) {
 			destPos++;
 		}
 		if (!(i & 1))
-			_dmaPipe->uploadTex( vramDest, 128, 0, 0,  GS_PSMT4HH, buf, 128, 16);
+			_dmaPipe->uploadTex( vramDest, 128, 0, 0, GS_PSMT4HH, buf, 128, 16);
 		else {
-			_dmaPipe->uploadTex( vramDest, 128, 0, 0,  GS_PSMT4HL, buf, 128, 16);
+			_dmaPipe->uploadTex( vramDest, 128, 0, 0, GS_PSMT4HL, buf, 128, 16);
 			vramDest += 128 * 16 * 4;
 		}
 		_dmaPipe->flush();
diff --git a/backends/platform/ps2/GsDefs.h b/backends/platform/ps2/GsDefs.h
index 9e7bab7..4da08ae 100644
--- a/backends/platform/ps2/GsDefs.h
+++ b/backends/platform/ps2/GsDefs.h
@@ -27,16 +27,16 @@
 
 // Gs2dScreen defines:
 
-#define PAL_NTSC_FLAG		(*(volatile uint8 *)0x1FC7FF52)
+#define PAL_NTSC_FLAG    (*(volatile uint8 *)0x1FC7FF52)
 
-#define GS_PMODE			*((volatile uint64 *)0x12000000)
-#define GS_CSR				*((volatile uint64 *)0x12001000)
-#define GS_DISPFB1			*((volatile uint64 *)0x12000070)
-#define GS_DISPLAY1			*((volatile uint64 *)0x12000080)
-#define GS_BGCOLOUR			*((volatile uint64 *)0x120000E0)
+#define GS_PMODE         *((volatile uint64 *)0x12000000)
+#define GS_CSR           *((volatile uint64 *)0x12001000)
+#define GS_DISPFB1       *((volatile uint64 *)0x12000070)
+#define GS_DISPLAY1      *((volatile uint64 *)0x12000080)
+#define GS_BGCOLOUR      *((volatile uint64 *)0x120000E0)
 
 enum GS_CSR_FIELDS {
-    CSR_SIGNAL = 1 << 0,
+	CSR_SIGNAL = 1 << 0,
 	CSR_FINISH = 1 << 1,
 	CSR_HSYNC  = 1 << 2,
 	CSR_VSYNC  = 1 << 3,
@@ -61,63 +61,63 @@ enum GS_CSR_FIELDS {
 //DmaPipe defines:
 
 enum GsRegs {
-	GPR_PRIM = 0x00,	// Select and configure current drawing primitive
-	GPR_RGBAQ,			// Setup current vertex color
-	GPR_ST,				// ...
-	GPR_UV,				// Specify Vertex Texture Coordinates
-	GPR_XYZF2,			// Set vertex coordinate
-	GPR_XYZ2,			// Set vertex coordinate and 'kick' drawing
-	GPR_TEX0_1,			// Texture Buffer Setup (Context 1)
-	GPR_TEX0_2,			// Texture Buffer Setup (Context 2)
-	GPR_CLAMP_1,		// ...
-	GPR_CLAMP_2,		// ...
-	GPR_FOG,			// ...
-
-	GPR_XYZF3 = 0x0C,	// ...
-	GPR_XYZ3,			// ...
-
-	GPR_TEX1_1 = 0x14,	// ...
-	GPR_TEX1_2,			// ...
-	GPR_TEX2_1,			// ...
-	GPR_TEX2_2,			// ...
-	GPR_XYOFFSET_1,		// Mapping from Primitive to Window coordinate system (Context 1)
-	GPR_XYOFFSET_2,		// Mapping from Primitive to Window coordinate system (Context 2)
-	GPR_PRMODECONT,		// ...
-	GPR_PRMODE,			// ...
-	GPR_TEXCLUT,		// ...
-
-	GPR_SCANMSK	= 0x22,	// ...
-
-	GPR_MIPTBP1_1 = 0x34,	// ...
-	GPR_MIPTBP1_2,		// ...
-	GPR_MIPTBP2_1,		// ...
-	GPR_MIPTBP2_2,		// ...
-
-	GPR_TEXA = 0x3b,	// ...
-
-	GPR_FOGCOL = 0x3d,	// ...
-
-	GPR_TEXFLUSH = 0x3f,// Write to this register before using newly loaded texture
-	GPR_SCISSOR_1,		// Setup clipping rectangle (Context 1)
-	GPR_SCISSOR_2,		// Setup clipping rectangle (Context 2)
-	GPR_ALPHA_1,		// Setup Alpha Blending Parameters (Context 1)
-	GPR_ALPHA_2,		// Setup Alpha Blending Parameters (Context 2)
-	GPR_DIMX,			// ...
-	GPR_DTHE,			// ...
-	GPR_COLCLAMP,		// ...
-	GPR_TEST_1,			// ...
-	GPR_TEST_2,			// ...
-	GPR_PABE,			// ...
-	GPR_FBA_1,			// ...
-	GPR_FBA_2,			// ...
-	GPR_FRAME_1,		// Frame buffer settings (Context 1)
-	GPR_FRAME_2,		// Frame buffer settings (Context 2)
-	GPR_ZBUF_1,			// ...
-	GPR_ZBUF_2,			// ...
-	GPR_BITBLTBUF,		// Setup Image Transfer Between EE and GS
-	GPR_TRXPOS,			// Setup Image Transfer Coordinates
-	GPR_TRXREG,			// Setup Image Transfer Size
-	GPR_TRXDIR,			// Set Image Transfer Directon + Start Transfer
+	GPR_PRIM = 0x00,        // Select and configure current drawing primitive
+	GPR_RGBAQ,              // Setup current vertex color
+	GPR_ST,                 // ...
+	GPR_UV,                 // Specify Vertex Texture Coordinates
+	GPR_XYZF2,              // Set vertex coordinate
+	GPR_XYZ2,               // Set vertex coordinate and 'kick' drawing
+	GPR_TEX0_1,             // Texture Buffer Setup (Context 1)
+	GPR_TEX0_2,             // Texture Buffer Setup (Context 2)
+	GPR_CLAMP_1,            // ...
+	GPR_CLAMP_2,            // ...
+	GPR_FOG,                // ...
+
+	GPR_XYZF3 = 0x0C,       // ...
+	GPR_XYZ3,               // ...
+
+	GPR_TEX1_1 = 0x14,      // ...
+	GPR_TEX1_2,             // ...
+	GPR_TEX2_1,             // ...
+	GPR_TEX2_2,             // ...
+	GPR_XYOFFSET_1,         // Mapping from Primitive to Window coordinate system (Context 1)
+	GPR_XYOFFSET_2,         // Mapping from Primitive to Window coordinate system (Context 2)
+	GPR_PRMODECONT,         // ...
+	GPR_PRMODE,             // ...
+	GPR_TEXCLUT,            // ...
+
+	GPR_SCANMSK = 0x22,     // ...
+
+	GPR_MIPTBP1_1 = 0x34,   // ...
+	GPR_MIPTBP1_2,          // ...
+	GPR_MIPTBP2_1,          // ...
+	GPR_MIPTBP2_2,          // ...
+
+	GPR_TEXA = 0x3b,        // ...
+
+	GPR_FOGCOL = 0x3d,      // ...
+
+	GPR_TEXFLUSH = 0x3f,    // Write to this register before using newly loaded texture
+	GPR_SCISSOR_1,          // Setup clipping rectangle (Context 1)
+	GPR_SCISSOR_2,          // Setup clipping rectangle (Context 2)
+	GPR_ALPHA_1,            // Setup Alpha Blending Parameters (Context 1)
+	GPR_ALPHA_2,            // Setup Alpha Blending Parameters (Context 2)
+	GPR_DIMX,               // ...
+	GPR_DTHE,               // ...
+	GPR_COLCLAMP,           // ...
+	GPR_TEST_1,             // ...
+	GPR_TEST_2,             // ...
+	GPR_PABE,               // ...
+	GPR_FBA_1,              // ...
+	GPR_FBA_2,              // ...
+	GPR_FRAME_1,            // Frame buffer settings (Context 1)
+	GPR_FRAME_2,            // Frame buffer settings (Context 2)
+	GPR_ZBUF_1,             // ...
+	GPR_ZBUF_2,             // ...
+	GPR_BITBLTBUF,          // Setup Image Transfer Between EE and GS
+	GPR_TRXPOS,             // Setup Image Transfer Coordinates
+	GPR_TRXREG,             // Setup Image Transfer Size
+	GPR_TRXDIR,             // Set Image Transfer Directon + Start Transfer
 	GPR_HWREG,
 
 	GPR_SIGNAL = 0x60,
@@ -135,15 +135,15 @@ enum PrimTypes {
 	PR_SPRITE
 };
 
-#define GS_PSMCT32		0x00
-#define GS_PSMCT24		0x01
-#define GS_PSMCT16		0x02
-#define GS_PSMCT16S		0x0A
-#define GS_PSMT8		0x13
-#define GS_PSMT4		0x14
-#define GS_PSMT4HL		0x24
-#define GS_PSMT4HH		0x2C
-#define GS_PSMT8H		0x1B
+#define GS_PSMCT32     0x00
+#define GS_PSMCT24     0x01
+#define GS_PSMCT16     0x02
+#define GS_PSMCT16S    0x0A
+#define GS_PSMT8       0x13
+#define GS_PSMT4       0x14
+#define GS_PSMT4HL     0x24
+#define GS_PSMT4HH     0x2C
+#define GS_PSMT8H      0x1B
 
 /*#define GS_SET_BITBLTBUF(sbp, sbw, spsm, dbp, dbw, dpsm) \
 	((uint64)(sbp)         | ((uint64)(sbw) << 16) | \
@@ -210,7 +210,7 @@ enum AlphaBlendColor {
 enum AlphaBlendAlpha {
 	SOURCE_ALPHA = 0,
 	DEST_ALPHA,
-    FIXED_ALPHA
+	FIXED_ALPHA
 };
 
 #define GS_SET_ALPHA(a, b, c, d, fix) \
diff --git a/backends/platform/ps2/asyncfio.cpp b/backends/platform/ps2/asyncfio.cpp
index 357ca95..0197ce3 100644
--- a/backends/platform/ps2/asyncfio.cpp
+++ b/backends/platform/ps2/asyncfio.cpp
@@ -63,7 +63,7 @@ int AsyncFio::open(const char *name, int ioMode, int mode) {
 	fileXioWaitAsync(FXIO_WAIT, &res);
 	SignalSema(_ioSema);
 	// dbg_printf("FIO: open ext(%s, %d, %d) => %d", name, ioMode, mode, res);
-    return res;
+	return res;
 }
 
 void AsyncFio::close(int handle) {
diff --git a/backends/platform/ps2/cd.c b/backends/platform/ps2/cd.c
index 1c54174..e08437d 100644
--- a/backends/platform/ps2/cd.c
+++ b/backends/platform/ps2/cd.c
@@ -19,35 +19,35 @@ int cdvdInitialised = 0;
 
 void cdvdExit(void)
 {
-    cdvdInitialised = 0;
+	cdvdInitialised = 0;
 }
 
 
 int cdvdInit(int mode)
 {
 	int i=0,len=0,ret=0;
-    u8  *pkt;
-
-    cdvdCd.server = NULL;
-
-    do {
-        if ((ret = SifBindRpc(&cdvdCd, (signed)CDVD_INIT_BIND_RPC, 0)) < 0) {
-            return -1;
-        }
-        if (!cdvdCd.server) {
-            nopdelay();
-        }
-    }
+	u8 *pkt;
+
+	cdvdCd.server = NULL;
+
+	do {
+		if ((ret = SifBindRpc(&cdvdCd, (signed)CDVD_INIT_BIND_RPC, 0)) < 0) {
+			return -1;
+		}
+		if (!cdvdCd.server) {
+			nopdelay();
+		}
+	}
 	while(!cdvdCd.server);
 
-    pkt = (unsigned char *)sendBuffer;
-    PUSHDATA( int, pkt, mode, i);
-    pkt += i; len += i;
+	pkt = (unsigned char *)sendBuffer;
+	PUSHDATA(int, pkt, mode, i);
+	pkt += i; len += i;
 
 	if ((ret = SifCallRpc(&cdvdCd, 0, 0, sendBuffer, len, NULL, 0, 0, 0)) < 0)
-        return -1;
+		return -1;
 
-    cdvdInitialised = 1;
+	cdvdInitialised = 1;
 
-    return 0;
+	return 0;
 }
diff --git a/backends/platform/ps2/eecodyvdfs.h b/backends/platform/ps2/eecodyvdfs.h
index 1d43fb6..fc959e3 100644
--- a/backends/platform/ps2/eecodyvdfs.h
+++ b/backends/platform/ps2/eecodyvdfs.h
@@ -40,7 +40,7 @@ struct CdClock {
 #ifdef __cplusplus
 extern "C" {
 #endif
-    int initCdvdFs(void);
+	int initCdvdFs(void);
 	void readRTC(struct CdClock *dest);
 	int driveStop(void);
 	int driveStandby(void);
diff --git a/backends/platform/ps2/fileio.h b/backends/platform/ps2/fileio.h
index afa2ca1..57c4a26 100644
--- a/backends/platform/ps2/fileio.h
+++ b/backends/platform/ps2/fileio.h
@@ -30,13 +30,13 @@
 #include "common/stream.h"
 
 enum {
-	CACHE_SIZE				= 2048 * 32,
-	MAX_READ_STEP			= 2048 * 16,
-	MAX_CACHED_FILES		= 6,
-	CACHE_READ_THRESHOLD	= 16 * 2048,
-	CACHE_FILL_MIN			= 2048 * 24,
-	READ_ALIGN				= 64,   // align all reads to the size of an EE cache line
-	READ_ALIGN_MASK			= READ_ALIGN - 1
+	CACHE_SIZE              = 2048 * 32,
+	MAX_READ_STEP           = 2048 * 16,
+	MAX_CACHED_FILES        = 6,
+	CACHE_READ_THRESHOLD    = 16 * 2048,
+	CACHE_FILL_MIN          = 2048 * 24,
+	READ_ALIGN              = 64,   // align all reads to the size of an EE cache line
+	READ_ALIGN_MASK         = READ_ALIGN - 1
 };
 
 // TODO: Make this a subclass of SeekableReadStream & WriteStream
diff --git a/backends/platform/ps2/iop/CoDyVDfs/common/codyvdirx.h b/backends/platform/ps2/iop/CoDyVDfs/common/codyvdirx.h
index e94e7dc..59b4975 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 ad86631..66c5837 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 932d589..2a94560 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,7 +72,7 @@ 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);
 }
@@ -104,7 +104,7 @@ 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)) {
@@ -118,7 +118,7 @@ ISODirectoryRecord *findEntryInCache(const char *name, int nameLen) {
 			entry = (ISODirectoryRecord *)( (uint8 *)entry + entry->len_dr );
 		}
 	}
-    return NULL;
+	return NULL;
 }
 
 ISODirectoryRecord *findPath(const char *path) {
@@ -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 b9f1edc..93124f9 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 5c5cbf9..611211a 100644
--- a/backends/platform/ps2/iop/CoDyVDfs/iop/fiofs.c
+++ b/backends/platform/ps2/iop/CoDyVDfs/iop/fiofs.c
@@ -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) {
@@ -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/rpckbd/include/ps2kbd.h b/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h
index 07d9c3d..6bef7ca 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/ps2input.cpp b/backends/platform/ps2/ps2input.cpp
index 6f36c5f..e840bb2 100644
--- a/backends/platform/ps2/ps2input.cpp
+++ b/backends/platform/ps2/ps2input.cpp
@@ -170,7 +170,7 @@ bool Ps2Input::pollEvent(Common::Event *event) {
 	}
 	if (checkPadMouse || checkPadKbd) {
 		// no usb mouse, simulate it using the pad
-        uint16 buttons;
+		uint16 buttons;
 		int16 joyh, joyv;
 		_pad->readPad(&buttons, &joyh, &joyv);
 		uint16 btnChange = buttons ^ _padLastButtons;
@@ -474,11 +474,11 @@ const Common::KeyCode Ps2Input::_usbToSdlk[0x100] = {
 	/* DD */	Common::KEYCODE_INVALID,
 	/* DE */	Common::KEYCODE_INVALID,
 	/* DF */	Common::KEYCODE_INVALID,
-	/* E0 */    Common::KEYCODE_LCTRL,
+	/* E0 */	Common::KEYCODE_LCTRL,
 	/* E1 */	Common::KEYCODE_LSHIFT,
 	/* E2 */	Common::KEYCODE_LALT,
 	/* E3 */	Common::KEYCODE_INVALID,
-	/* E4 */    Common::KEYCODE_RCTRL,
+	/* E4 */	Common::KEYCODE_RCTRL,
 	/* E5 */	Common::KEYCODE_RSHIFT,
 	/* E6 */	Common::KEYCODE_RALT,
 	/* E7 */	Common::KEYCODE_INVALID,
@@ -509,39 +509,39 @@ const Common::KeyCode Ps2Input::_usbToSdlk[0x100] = {
 };
 
 const Common::KeyCode Ps2Input::_padCodes[16] = {
-	Common::KEYCODE_1,					// Select
-	Common::KEYCODE_INVALID,			// L3
-	Common::KEYCODE_INVALID,			// R3
-	Common::KEYCODE_F5,					// Start
-	Common::KEYCODE_INVALID,			// Up
-	Common::KEYCODE_INVALID,			// Right
-	Common::KEYCODE_INVALID,			// Down
-	Common::KEYCODE_INVALID,			// Left
-	Common::KEYCODE_KP0,				// L2
-	Common::KEYCODE_PERIOD,				// R2
-	Common::KEYCODE_n,					// L1
-	Common::KEYCODE_y,					// R1
-	Common::KEYCODE_ESCAPE,				// Triangle
-	Common::KEYCODE_INVALID,			// Circle  => Right mouse button
-	Common::KEYCODE_INVALID,			// Cross	=> Left mouse button
-	Common::KEYCODE_RETURN				// Square
+	Common::KEYCODE_1,                  // Select
+	Common::KEYCODE_INVALID,            // L3
+	Common::KEYCODE_INVALID,            // R3
+	Common::KEYCODE_F5,                 // Start
+	Common::KEYCODE_INVALID,            // Up
+	Common::KEYCODE_INVALID,            // Right
+	Common::KEYCODE_INVALID,            // Down
+	Common::KEYCODE_INVALID,            // Left
+	Common::KEYCODE_KP0,                // L2
+	Common::KEYCODE_PERIOD,             // R2
+	Common::KEYCODE_n,                  // L1
+	Common::KEYCODE_y,                  // R1
+	Common::KEYCODE_ESCAPE,             // Triangle
+	Common::KEYCODE_INVALID,            // Circle => Right mouse button
+	Common::KEYCODE_INVALID,            // Cross  => Left mouse button
+	Common::KEYCODE_RETURN              // Square
 };
 
 const Common::KeyCode Ps2Input::_padFlags[16] = {
-	Common::KEYCODE_INVALID,			 // Select
-	Common::KEYCODE_INVALID,			 // L3
-	Common::KEYCODE_INVALID,			 // R3
-	Common::KEYCODE_INVALID,			 // Start
-	Common::KEYCODE_INVALID,			 //	Up
-	Common::KEYCODE_INVALID,			 //	Right
-	Common::KEYCODE_INVALID,			 //	Down
-	Common::KEYCODE_INVALID,			 //	Left
-	Common::KEYCODE_INVALID,			 //	L2
-	Common::KEYCODE_INVALID,			 //	R2
-	Common::KEYCODE_INVALID,			 //	L1
-	Common::KEYCODE_INVALID,			 //	R1
-	Common::KEYCODE_INVALID,			 // Triangle
-	Common::KEYCODE_INVALID,			 //	Circle
-	Common::KEYCODE_INVALID,			 //	Cross
-	Common::KEYCODE_INVALID				 //	Square
+	Common::KEYCODE_INVALID,            // Select
+	Common::KEYCODE_INVALID,            // L3
+	Common::KEYCODE_INVALID,            // R3
+	Common::KEYCODE_INVALID,            // Start
+	Common::KEYCODE_INVALID,            // Up
+	Common::KEYCODE_INVALID,            // Right
+	Common::KEYCODE_INVALID,            // Down
+	Common::KEYCODE_INVALID,            // Left
+	Common::KEYCODE_INVALID,            // L2
+	Common::KEYCODE_INVALID,            // R2
+	Common::KEYCODE_INVALID,            // L1
+	Common::KEYCODE_INVALID,            // R1
+	Common::KEYCODE_INVALID,            // Triangle
+	Common::KEYCODE_INVALID,            // Circle
+	Common::KEYCODE_INVALID,            // Cross
+	Common::KEYCODE_INVALID             // Square
 };
diff --git a/backends/platform/ps2/ps2input.h b/backends/platform/ps2/ps2input.h
index b97daac..5014feb 100644
--- a/backends/platform/ps2/ps2input.h
+++ b/backends/platform/ps2/ps2input.h
@@ -44,7 +44,7 @@ private:
 	int mapKey(int key, int mod);
 	bool getKeyEvent(Common::Event *event, uint16 buttonCode, bool down);
 	OSystem_PS2 *_system;
-	Ps2Pad		*_pad;
+	Ps2Pad *_pad;
 
 	uint16 _minx, _maxx, _miny, _maxy;
 
diff --git a/backends/platform/ps2/ps2pad.cpp b/backends/platform/ps2/ps2pad.cpp
index 607b614..60787bb 100644
--- a/backends/platform/ps2/ps2pad.cpp
+++ b/backends/platform/ps2/ps2pad.cpp
@@ -34,7 +34,7 @@ Ps2Pad::Ps2Pad(OSystem_PS2 *system) {
 	_padStatus = STAT_NONE;
 
 	padInit(0); // initialize library
-	_port = _slot = 0;	// first controller, no multitap
+	_port = _slot = 0; // first controller, no multitap
 	initPad();
 }
 
diff --git a/backends/platform/ps2/ps2time.cpp b/backends/platform/ps2/ps2time.cpp
index 1cddd23..3c9e4fb 100644
--- a/backends/platform/ps2/ps2time.cpp
+++ b/backends/platform/ps2/ps2time.cpp
@@ -30,9 +30,9 @@
 
 #define FROM_BCD(a) ((a >> 4) * 10 + (a & 0xF))
 
-static int	  g_timeSecs;
-static int	  g_day, g_month, g_year;
-static int	  g_lastTimeCheck;
+static int g_timeSecs;
+static int g_day, g_month, g_year;
+static int g_lastTimeCheck;
 extern volatile uint32 msecCount;
 
 void buildNewDate(int dayDiff) {
diff --git a/backends/platform/ps2/savefilemgr.cpp b/backends/platform/ps2/savefilemgr.cpp
index 46af42e..2bd4bcb 100644
--- a/backends/platform/ps2/savefilemgr.cpp
+++ b/backends/platform/ps2/savefilemgr.cpp
@@ -166,10 +166,10 @@ Common::OutSaveFile *Ps2SaveFileManager::openForSaving(const Common::String &fil
 			sprintf(path, "mc0:ScummVM/indy4/iq-points");
 		}
 		// FIXME : hack for bs1 saved games
-        else if (filename == "SAVEGAME.INF") {
-            mcCheck("mc0:ScummVM/sword1");
-            sprintf(path, "mc0:ScummVM/sword1/SAVEGAME.INF");
-        }
+		else if (filename == "SAVEGAME.INF") {
+			mcCheck("mc0:ScummVM/sword1");
+			sprintf(path, "mc0:ScummVM/sword1/SAVEGAME.INF");
+		}
 		else {
 			char temp[32];
 			strcpy(temp, filename.c_str());
diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index 9882974..abea696 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -392,14 +392,14 @@ void OSystem_PS2::initTimer(void) {
 	timerThread.stack            = _timerStack;
 	timerThread.stack_size       = TIMER_STACK_SIZE;
 	timerThread.func             = (void *)systemTimerThread;
-	timerThread.gp_reg			 = &_gp;
+	timerThread.gp_reg           = &_gp;
 
 	// soundthread's priority is higher than main- and timerthread
 	soundThread.initial_priority = thisThread.current_priority - 2;
 	soundThread.stack            = _soundStack;
 	soundThread.stack_size       = SOUND_STACK_SIZE;
 	soundThread.func             = (void *)systemSoundThread;
-	soundThread.gp_reg			 = &_gp;
+	soundThread.gp_reg           = &_gp;
 
 	_timerTid = CreateThread(&timerThread);
 	_soundTid = CreateThread(&soundThread);
@@ -459,33 +459,33 @@ void OSystem_PS2::soundThreadCallback(void) {
 
 			// demux data into 2 buffers, L and R
 			 __asm__ (
-				"move  $t2, %1\n\t"			// dest buffer right
-				"move  $t3, %0\n\t"			// dest buffer left
-				"lui   $t8, 0x7000\n\t"		// muxed buffer, fixed at 0x70000000
-				"addiu $t9, $0, 100\n\t"	// number of loops
-				"mtsab $0, 2\n\t"			// set qword shift = 2 byte
+				"move  $t2, %1\n\t"             // dest buffer right
+				"move  $t3, %0\n\t"             // dest buffer left
+				"lui   $t8, 0x7000\n\t"         // muxed buffer, fixed at 0x70000000
+				"addiu $t9, $0, 100\n\t"        // number of loops
+				"mtsab $0, 2\n\t"               // set qword shift = 2 byte
 
 				"loop:\n\t"
-				"  lq $t4,  0($t8)\n\t"		// load 8 muxed samples
-				"  lq $t5, 16($t8)\n\t"		// load 8 more muxed samples
+				"  lq $t4,  0($t8)\n\t"         // load 8 muxed samples
+				"  lq $t5, 16($t8)\n\t"         // load 8 more muxed samples
 
-				"  qfsrv $t6, $0, $t4\n\t"	// shift right for second
-				"  qfsrv $t7, $0, $t5\n\t"	// packing step (right channel)
+				"  qfsrv $t6, $0, $t4\n\t"      // shift right for second
+				"  qfsrv $t7, $0, $t5\n\t"      // packing step (right channel)
 
-				"  ppach $t4, $t5, $t4\n\t"	// combine left channel data
-				"  ppach $t6, $t7, $t6\n\t"	// right channel data
+				"  ppach $t4, $t5, $t4\n\t"     // combine left channel data
+				"  ppach $t6, $t7, $t6\n\t"     // right channel data
 
-				"  sq $t4, 0($t3)\n\t"		// write back
-				"  sq $t6, 0($t2)\n\t"		//
+				"  sq $t4, 0($t3)\n\t"          // write back
+				"  sq $t6, 0($t2)\n\t"          //
 
-				"  addiu $t9, -1\n\t"		// decrement loop counter
-				"  addiu $t2, 16\n\t"		// increment pointers
+				"  addiu $t9, -1\n\t"           // decrement loop counter
+				"  addiu $t2, 16\n\t"           // increment pointers
 				"  addiu $t3, 16\n\t"
 				"  addiu $t8, 32\n\t"
-				"  bnez  $t9, loop\n\t"		// loop
+				"  bnez  $t9, loop\n\t"         // loop
 					:  // outputs
 			 		: "r"(soundBufL), "r"(soundBufR)  // inputs
-				//  : "$t2", "$t3", "$t4", "$t5", "$t6", "$t7", "$t8", "$t9"  // destroyed
+				    //  : "$t2", "$t3", "$t4", "$t5", "$t6", "$t7", "$t8", "$t9"  // destroyed
 					: "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25"  // destroyed
 			);
 			// and feed it into the SPU
@@ -666,7 +666,7 @@ void OSystem_PS2::unlockScreen(void) {
 const OSystem::GraphicsMode OSystem_PS2::_graphicsMode = { NULL, NULL, 0 };
 
 const OSystem::GraphicsMode *OSystem_PS2::getSupportedGraphicsModes(void) const {
-    return &_graphicsMode;
+	return &_graphicsMode;
 }
 
 bool OSystem_PS2::setGraphicsMode(int mode) {
@@ -735,7 +735,7 @@ void OSystem_PS2::msgPrintf(int millis, const char *format, ...) {
 		Graphics::g_sysfont.drawString(&surf, str, posX, posY, 300 - posX, 1);
 		posY += 14;
 
-        lnSta = lnEnd + 1;
+		lnSta = lnEnd + 1;
 	}
 
 	uint8 *scrBuf = (uint8 *)memalign(64, 320 * 200);
@@ -911,7 +911,7 @@ bool OSystem_PS2::prepMC() {
 }
 
 void OSystem_PS2::makeConfigPath() {
-    FILE *src, *dst;
+	FILE *src, *dst;
 	char path[128], *buf;
 	int32 size;
 
diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h
index 3ba40a7..0ae6b2d 100644
--- a/backends/platform/ps2/systemps2.h
+++ b/backends/platform/ps2/systemps2.h
@@ -138,26 +138,26 @@ private:
 	bool _mouseVisible;
 	bool _useMouse, _useKbd, _useHdd, _usbMassLoaded, _useNet;
 
-	Gs2dScreen	*_screen;
-	Ps2Input	*_input;
-	uint16		_oldMouseX, _oldMouseY;
-	uint32		_msgClearTime;
-	uint16		_printY;
+	Gs2dScreen *_screen;
+	Ps2Input *_input;
+	uint16 _oldMouseX, _oldMouseY;
+	uint32 _msgClearTime;
+	uint16 _printY;
 	bool _modeChanged;
 	int _screenChangeCount;
 
-	int			_mutexSema;
-	Ps2Mutex	_mutex[MAX_MUTEXES];
+	int _mutexSema;
+	Ps2Mutex _mutex[MAX_MUTEXES];
 
-	uint8		*_timerStack, *_soundStack;
-	int			_timerTid, _soundTid;
-	int			_intrId;
+	uint8 *_timerStack, *_soundStack;
+	int _timerTid, _soundTid;
+	int _intrId;
 	volatile bool _systemQuit;
 	static const GraphicsMode _graphicsMode;
 
-	int			_bootDevice;
-	char		*_bootPath;
-	char		*_configFile;
+	int _bootDevice;
+	char *_bootPath;
+	char *_configFile;
 };
 
 #endif // SYSTEMPS2_H


Commit: 00b2e12897345298406abe17318dd130887fe353
    https://github.com/scummvm/scummvm/commit/00b2e12897345298406abe17318dd130887fe353
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-18T13:39:44-05:00

Commit Message:
PS2: Ps2Pad::initPad added case STAT_NONE

Changed paths:
    backends/platform/ps2/ps2pad.cpp



diff --git a/backends/platform/ps2/ps2pad.cpp b/backends/platform/ps2/ps2pad.cpp
index 60787bb..22c3f42 100644
--- a/backends/platform/ps2/ps2pad.cpp
+++ b/backends/platform/ps2/ps2pad.cpp
@@ -104,7 +104,8 @@ void Ps2Pad::initPad(void) {
 					_padStatus = STAT_OKAY;
 					break;
 				case STAT_OKAY:
-					// pad is already initialized
+				case STAT_NONE:
+					// pad is already initialized (or not there)
 					break;
 			}
 		} else {


Commit: 8e009b447b3c43a4164cae98c0857eb6e0c72489
    https://github.com/scummvm/scummvm/commit/8e009b447b3c43a4164cae98c0857eb6e0c72489
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-18T13:39:56-05:00

Commit Message:
PS2: renamed animThread -> playAnim to avoid shadowing

Changed paths:
    backends/platform/ps2/Gs2dScreen.cpp
    backends/platform/ps2/Gs2dScreen.h



diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp
index cecc08d..31e073a 100644
--- a/backends/platform/ps2/Gs2dScreen.cpp
+++ b/backends/platform/ps2/Gs2dScreen.cpp
@@ -655,7 +655,7 @@ void Gs2dScreen::wantAnim(bool runIt) {
 #define V 1000
 #define Z_TRANSL 65
 
-void Gs2dScreen::animThread(void) {
+void Gs2dScreen::playAnim(void) {
 	// animate zeros and ones while game accesses memory card, etc.
 	g_RunAnim = false;
 	float yPos   = 0.0;
@@ -763,7 +763,7 @@ void Gs2dScreen::animThread(void) {
 }
 
 void runAnimThread(Gs2dScreen *param) {
-	param->animThread();
+	param->playAnim();
 }
 
 // data for the animated zeros and ones...
diff --git a/backends/platform/ps2/Gs2dScreen.h b/backends/platform/ps2/Gs2dScreen.h
index c9b9b54..4945200 100644
--- a/backends/platform/ps2/Gs2dScreen.h
+++ b/backends/platform/ps2/Gs2dScreen.h
@@ -75,7 +75,7 @@ public:
 	void setMouseXy(int16 x, int16 y);
 	void setShakePos(int shake);
 
-	void animThread(void);
+	void playAnim(void);
 	void wantAnim(bool runIt);
 
 	void quit(void);


Commit: 623a0e7d619944fb390aaed55ea53eb1d7cd42db
    https://github.com/scummvm/scummvm/commit/623a0e7d619944fb390aaed55ea53eb1d7cd42db
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-18T13:40:32-05:00

Commit Message:
PS2: use createPixelFormat for overlay format

Changed paths:
    backends/platform/ps2/Gs2dScreen.cpp



diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp
index 31e073a..53b620a 100644
--- a/backends/platform/ps2/Gs2dScreen.cpp
+++ b/backends/platform/ps2/Gs2dScreen.cpp
@@ -32,6 +32,7 @@
 #include "DmaPipe.h"
 #include "GsDefs.h"
 #include "graphics/surface.h"
+#include "graphics/colormasks.h"
 #include "backends/platform/ps2/ps2debug.h"
 
 extern void *_gp;
@@ -202,12 +203,12 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode mode) {
 	_overlayFormat.rLoss = 3;
 	_overlayFormat.gLoss = 3;
 	_overlayFormat.bLoss = 3;
-	_overlayFormat.aLoss = 7;
+	_overlayFormat.aLoss = 7; // 8
 
 	_overlayFormat.rShift = 0;
 	_overlayFormat.gShift = 5;
 	_overlayFormat.bShift = 10;
-	_overlayFormat.aShift = 15;
+	_overlayFormat.aShift = 15; // 0
 
 	// setup hardware now.
 	GS_CSR = CSR_RESET; // Reset GS
@@ -526,7 +527,8 @@ void Gs2dScreen::hideOverlay(void) {
 }
 
 Graphics::PixelFormat Gs2dScreen::getOverlayFormat(void) {
-	return _overlayFormat;
+	// return _overlayFormat;
+	return Graphics::createPixelFormat<1555>();
 }
 
 int16 Gs2dScreen::getOverlayWidth(void) {


Commit: 7287448e896010f247102a9c0283e4510b83fced
    https://github.com/scummvm/scummvm/commit/7287448e896010f247102a9c0283e4510b83fced
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-18T13:41:02-05:00

Commit Message:
PS2: commented out unused Gs2dScreen::tvMode

Changed paths:
    backends/platform/ps2/Gs2dScreen.cpp
    backends/platform/ps2/Gs2dScreen.h



diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp
index 53b620a..da1cce3 100644
--- a/backends/platform/ps2/Gs2dScreen.cpp
+++ b/backends/platform/ps2/Gs2dScreen.cpp
@@ -635,11 +635,11 @@ void Gs2dScreen::setMouseXy(int16 x, int16 y) {
 	_mouseX = x;
 	_mouseY = y;
 }
-
+/*
 uint8 Gs2dScreen::tvMode(void) {
 	return _tvMode;
 }
-
+*/
 uint16 Gs2dScreen::getWidth(void) {
 	return _width;
 }
diff --git a/backends/platform/ps2/Gs2dScreen.h b/backends/platform/ps2/Gs2dScreen.h
index 4945200..ce65387 100644
--- a/backends/platform/ps2/Gs2dScreen.h
+++ b/backends/platform/ps2/Gs2dScreen.h
@@ -45,7 +45,7 @@ public:
 	Gs2dScreen(uint16 width, uint16 height, TVMode mode);
 	~Gs2dScreen(void);
 	void newScreenSize(uint16 width, uint16 height);
-	uint8 tvMode(void);
+	// uint8 tvMode(void);
 	uint16 getWidth(void);
 	uint16 getHeight(void);
 


Commit: d687417da5d67a4886e1af4a13a4ed6ec66180f2
    https://github.com/scummvm/scummvm/commit/d687417da5d67a4886e1af4a13a4ed6ec66180f2
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-18T13:41:41-05:00

Commit Message:
Makefile.common: added QUIET_CC

Changed paths:
    Makefile.common



diff --git a/Makefile.common b/Makefile.common
index b56300a..31bb83e 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -61,6 +61,7 @@ endif
 ifneq ($(findstring $(MAKEFLAGS),s),s)
 ifneq ($(VERBOSE_BUILD),1)
 ifneq ($(VERBOSE_BUILD),yes)
+QUIET_CC      = @echo '   ' C '      ' $@;
 QUIET_CXX     = @echo '   ' C++ '    ' $@;
 QUIET_AS      = @echo '   ' AS '     ' $@;
 QUIET_NASM    = @echo '   ' NASM '   ' $@;
@@ -94,6 +95,9 @@ ifdef CXX_UPDATE_DEP_FLAG
 
 # Build rule for C++ files. Makes use of CXX_UPDATE_DEP_FLAG for advanced
 # dependency tracking.
+%.o: %.c
+	$(QUIET)$(MKDIR) $(*D)/$(DEPDIR)
+	$(QUIET_CC)$(CC) $(CXX_UPDATE_DEP_FLAG) $(CFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
 %.o: %.cpp
 	$(QUIET)$(MKDIR) $(*D)/$(DEPDIR)
 	$(QUIET_CXX)$(CXX) $(CXX_UPDATE_DEP_FLAG) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o


Commit: a2313aef6635bb553e6bded3e1bd9ee7f2cf3621
    https://github.com/scummvm/scummvm/commit/a2313aef6635bb553e6bded3e1bd9ee7f2cf3621
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-18T13:41:53-05:00

Commit Message:
configure: enhanced PS2 support

Changed paths:
    configure



diff --git a/configure b/configure
index db78feb..f6fbad5 100755
--- a/configure
+++ b/configure
@@ -1378,6 +1378,9 @@ ps2)
 	_host_os=ps2
 	_host_cpu=mips64r5900el
 	_host_alias=ee
+	# PS2 bogus dirs: they actually depend on launch medium
+	datadir='host:data'
+	docdir='host:docs'
 	;;
 ps3)
 	_host_os=ps3
@@ -2634,6 +2637,8 @@ if test -n "$_host"; then
 			DEFINES="$DEFINES -DDISABLE_DOSBOX_OPL"
 			DEFINES="$DEFINES -DDISABLE_SID"
 			DEFINES="$DEFINES -DDISABLE_NES_APU"
+			CXXFLAGS="$CXXFLAGS -fno-exceptions"
+			CXXFLAGS="$CXXFLAGS -fno-rtti"
 			_backend="ps2"
 			_build_scalers=no
 			_mt32emu=no
@@ -2641,10 +2646,12 @@ if test -n "$_host"; then
 			# This trick doesn't work for tremor right now, as the PS2 port the resulting library
 			# libtremor, while our code later on expects it to be called libvorbisidec.
 			# TODO: Enable tremor, e.g. by adding  -ltremor or by renaming the lib.
+			_tremor=yes
 			_mad=yes
 			_zlib=yes
 			# HACK to fix compilation of C source files for now.
-			add_line_to_config_mk 'CC = ee-gcc'
+			add_line_to_config_mk 'CC := ee-gcc'
+			add_line_to_config_mk 'CFLAGS := -std=c99 -W -Wno-unused-parameter -Wconversion -pedantic -G2 -s -O2 -Wuninitialized'
 			# HACK to fix linking for now. It seems ee-g++ does not handle linking correctly.
 			LD=ee-gcc
 
@@ -3162,9 +3169,10 @@ POST_OBJS_FLAGS		:= -Wl,--export-all-symbols -Wl,--no-whole-archive -Wl,--out-im
 		;;
 	ps2)
 		_elf_loader=yes
+		DEFINES="$DEFINES -DUNCACHED_PLUGINS"
 _mak_plugins='
-LDFLAGS				+= -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -Wl,-T$(srcdir)/backends/plugins/ps2/main_prog.ld
-PLUGIN_LDFLAGS		+= -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -Wl,-T$(srcdir)/backends/plugins/ps2/plugin.ld -lstdc++ -lc
+LDFLAGS         += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -Wl,-T$(srcdir)/backends/plugins/ps2/main_prog.ld
+PLUGIN_LDFLAGS  += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -Wl,-T$(srcdir)/backends/plugins/ps2/plugin.ld -lstdc++ -lc
 '
 		;;
 	psp)
@@ -3300,6 +3308,8 @@ if test "$_tremor" = yes && test "$_vorbis" = no; then
 	if test "$_tremolo" = yes ; then
 		add_line_to_config_h '#define USE_TREMOLO'
 		LIBS="$LIBS $TREMOR_LIBS -ltremolo"
+	elif test "$_host" = ps2 ; then
+		LIBS="-ltremor $LIBS"
 	else
 		LIBS="$LIBS $TREMOR_LIBS -lvorbisidec"
 	fi
@@ -4055,6 +4065,10 @@ case $_backend in
 		# without a scummvm sub directory.
 		DEFINES="$DEFINES -DPLUGIN_DIRECTORY=\\\"$libdir\\\""
 		;;
+	ps2)
+		# PS2 bogus dir: it actually depends on launch medium
+		DEFINES="$DEFINES -DPLUGIN_DIRECTORY=\\\"host:plugins\\\""
+		;;
 	*)
 		DEFINES="$DEFINES -DPLUGIN_DIRECTORY=\\\"$libdir/scummvm\\\""
 		;;


Commit: 7dc0a54c5dcca7e86e88de513521961df67c812e
    https://github.com/scummvm/scummvm/commit/7dc0a54c5dcca7e86e88de513521961df67c812e
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-18T13:42:12-05:00

Commit Message:
PS2: beautified & simplified version on screen

Changed paths:
    base/version.cpp



diff --git a/base/version.cpp b/base/version.cpp
index c55bd63..43fa687 100644
--- a/base/version.cpp
+++ b/base/version.cpp
@@ -56,9 +56,15 @@
  * to properly work in exports (i.e. release tar balls etc.).
  */
 const char *gScummVMVersion = SCUMMVM_VERSION;
+#ifdef __PLAYSTATION2__
+const char *gScummVMBuildDate = "2013-05-31"; /* ScummVM 1.6.0 Release */
+const char *gScummVMVersionDate = SCUMMVM_VERSION " - PlayStation2";
+const char *gScummVMFullVersion = "ScummVM " SCUMMVM_VERSION " - PlayStation2";
+#else
 const char *gScummVMBuildDate = __DATE__ " " __TIME__;
 const char *gScummVMVersionDate = SCUMMVM_VERSION " (" __DATE__ " " __TIME__ ")";
 const char *gScummVMFullVersion = "ScummVM " SCUMMVM_VERSION " (" __DATE__ " " __TIME__ ")";
+#endif
 const char *gScummVMFeatures = ""
 #ifdef TAINTED_BUILD
 	// TAINTED means the build contains engines/subengines not enabled by default


Commit: 33b22acc5de3a93f1b6c82077a02f74110b879ef
    https://github.com/scummvm/scummvm/commit/33b22acc5de3a93f1b6c82077a02f74110b879ef
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-18T13:46:17-05:00

Commit Message:
PS2: beautified & simplified version on screen

Changed paths:
    base/version.cpp



diff --git a/base/version.cpp b/base/version.cpp
index 43fa687..8d087e0 100644
--- a/base/version.cpp
+++ b/base/version.cpp
@@ -57,7 +57,7 @@
  */
 const char *gScummVMVersion = SCUMMVM_VERSION;
 #ifdef __PLAYSTATION2__
-const char *gScummVMBuildDate = "2013-05-31"; /* ScummVM 1.6.0 Release */
+const char *gScummVMBuildDate = "Git Master"; /* ScummVM Git Master */
 const char *gScummVMVersionDate = SCUMMVM_VERSION " - PlayStation2";
 const char *gScummVMFullVersion = "ScummVM " SCUMMVM_VERSION " - PlayStation2";
 #else


Commit: 263a0972a3d4fcf53fa6e7272b9df2cc13a12d24
    https://github.com/scummvm/scummvm/commit/263a0972a3d4fcf53fa6e7272b9df2cc13a12d24
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-18T13:46:50-05:00

Commit Message:
PS2: removed plugins cksum deps on build time

Changed paths:
    backends/plugins/elf/version.cpp



diff --git a/backends/plugins/elf/version.cpp b/backends/plugins/elf/version.cpp
index 9f64870..c4f37e0 100644
--- a/backends/plugins/elf/version.cpp
+++ b/backends/plugins/elf/version.cpp
@@ -23,6 +23,10 @@
 #include "backends/plugins/elf/version.h"
 
 #ifdef USE_ELF_LOADER
-const char *gScummVMPluginBuildDate __attribute__((visibility("hidden"))) =
-	__DATE__ " " __TIME__ ;
+	#ifdef __PLAYSTATION2__
+	const char *gScummVMPluginBuildDate = "2013-05-31"; /* ScummVM 1.6.0 Release */
+	#else
+	const char *gScummVMPluginBuildDate __attribute__((visibility("hidden"))) =
+		__DATE__ " " __TIME__ ;
+	#endif
 #endif


Commit: 5ba543468863968c9f93a8840ff8472903cccc80
    https://github.com/scummvm/scummvm/commit/5ba543468863968c9f93a8840ff8472903cccc80
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-18T13:47:36-05:00

Commit Message:
PS2: removed plugins cksum deps on build time

Changed paths:
    backends/plugins/elf/version.cpp



diff --git a/backends/plugins/elf/version.cpp b/backends/plugins/elf/version.cpp
index c4f37e0..a2c1971 100644
--- a/backends/plugins/elf/version.cpp
+++ b/backends/plugins/elf/version.cpp
@@ -24,7 +24,7 @@
 
 #ifdef USE_ELF_LOADER
 	#ifdef __PLAYSTATION2__
-	const char *gScummVMPluginBuildDate = "2013-05-31"; /* ScummVM 1.6.0 Release */
+	const char *gScummVMPluginBuildDate = "Git Master"; /* ScummVM Git Master */
 	#else
 	const char *gScummVMPluginBuildDate __attribute__((visibility("hidden"))) =
 		__DATE__ " " __TIME__ ;


Commit: a960ec7adf0547e4a872f29cb645b5f02dc7558c
    https://github.com/scummvm/scummvm/commit/a960ec7adf0547e4a872f29cb645b5f02dc7558c
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-18T13:48:08-05:00

Commit Message:
PS2: snprintf hack to fix scumm.plg

Changed paths:
    engines/dialogs.cpp



diff --git a/engines/dialogs.cpp b/engines/dialogs.cpp
index c884075..1713b99 100644
--- a/engines/dialogs.cpp
+++ b/engines/dialogs.cpp
@@ -216,6 +216,11 @@ void MainMenuDialog::reflowLayout() {
 void MainMenuDialog::save() {
 	int slot = _saveDialog->runModalWithCurrentTarget();
 
+	#if defined(__PLAYSTATION2__) && defined(DYNAMIC_MODULES)
+	char pokeme[32];
+	snprintf(pokeme,32,"hack");
+	#endif
+
 	if (slot >= 0) {
 		Common::String result(_saveDialog->getResultString());
 		if (result.empty()) {


Commit: fb69d8eddcb2a29bace9a2fa7723068e2eb1b6fe
    https://github.com/scummvm/scummvm/commit/fb69d8eddcb2a29bace9a2fa7723068e2eb1b6fe
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-18T13:48:20-05:00

Commit Message:
PS2: enhanced Makefile.ps2 (incl. modules & debug)

Changed paths:
  R backends/platform/ps2/Makefile.gdb
    backends/platform/ps2/Makefile.ps2
    backends/platform/ps2/module.mk



diff --git a/backends/platform/ps2/Makefile.gdb b/backends/platform/ps2/Makefile.gdb
deleted file mode 100644
index 8ca47cd..0000000
--- a/backends/platform/ps2/Makefile.gdb
+++ /dev/null
@@ -1,104 +0,0 @@
-# $Header: Exp $
- include $(PS2SDK)/Defs.make
-
-PS2_EXTRA = /works/devel/ps2/sdk-extra
-PS2_EXTRA_INCS = /zlib/include /libmad/ee/include /SjPcm/ee/src /tremor
-PS2_EXTRA_LIBS = /zlib/lib /libmad/ee/lib /SjPcm/ee/lib /tremor/tremor
-
-ENABLED=STATIC_PLUGIN
-
-ENABLE_SCUMM = $(ENABLED)
-ENABLE_SCUMM_7_8 = $(ENABLED)
-# ENABLE_HE = $(ENABLED)
-# ENABLE_AGI = $(ENABLED)
-# ENABLE_AGOS = $(ENABLED)
-# ENABLE_AGOS2 = $(ENABLED)
-# ENABLE_CINE = $(ENABLED)
-# ENABLE_CRUISE = $(ENABLED)
-# ENABLE_DRACI = $(ENABLED)
-# ENABLE_DRASCULA = $(ENABLED)
-# ENABLE_GOB = $(ENABLED)
-# ENABLE_GROOVIE = $(ENABLED)
-## ENABLE_GROOVIE2 = $(ENABLED)
-# ENABLE_HUGO = $(ENABLED)
-# ENABLE_IHNM = $(ENABLED)
-# ENABLE_KYRA = $(ENABLED)
-## ENABLE_LOL = $(ENABLED)
-# ENABLE_LURE = $(ENABLED)
-## ENABLE_M4 = $(ENABLED)
-# ENABLE_MADE = $(ENABLED)
-# ENABLE_MOHAWK = $(ENABLED)
-# ENABLE_PARALLACTION = $(ENABLED)
-# ENABLE_QUEEN = $(ENABLED)
-# ENABLE_SAGA = $(ENABLED)
-# ENABLE_SAGA2 = $(ENABLED)
-# ENABLE_SCI = $(ENABLED)
-## ENABLE_SCI32 = $(ENABLED)
-# ENABLE_SKY = $(ENABLED)
-# ENABLE_SWORD1 = $(ENABLED)
-# ENABLE_SWORD2 = $(ENABLED)
-# ENABLE_TEENAGENT = $(ENABLED)
-# ENABLE_TINSEL = $(ENABLED)
-# ENABLE_TOON = $(ENABLED)
-# ENABLE_TOUCHE = $(ENABLED)
-# ENABLE_TUCKER = $(ENABLED)
-
-
-HAVE_GCC3 = true
-
-CC      = ee-gcc
-CXX     = ee-g++
-AS      = ee-gcc
-LD      = ee-gcc
-AR      = ee-ar cru
-RANLIB  = ee-ranlib
-STRIP   = ee-strip
-MKDIR   = mkdir -p
-RM      = rm -f
-
-srcdir = ../../..
-VPATH = $(srcdir)
-INCDIR = ../../../
-# DEPDIR = .deps
-
-DEFINES  = -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_ZLIB -DFORCE_RTL -DDISABLE_SAVEGAME_SORTING -D_EE -D__PLAYSTATION2__ -D__PS2_DEBUG__ -g -Wall -Wno-multichar -fno-rtti -fno-exceptions # -DNO_ADAPTOR
-# for release builds:
-#DEFINES += -DRELEASE_BUILD
-
-INCLUDES  = $(addprefix -I$(PS2_EXTRA),$(PS2_EXTRA_INCS))
-INCLUDES += -I $(PS2GDB)/ee -I $(PS2SDK)/ee/include -I $(PS2SDK)/common/include -I ./common -I . -I $(srcdir) -I $(srcdir)/engines
-
-CXX_UPDATE_DEP_FLAG = -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP
-
-TARGET = elf/scummvm.elf
-
-OBJS := $(srcdir)/backends/platform/ps2/DmaPipe.o \
-	$(srcdir)/backends/platform/ps2/Gs2dScreen.o \
-	$(srcdir)/backends/platform/ps2/irxboot.o \
-	$(srcdir)/backends/platform/ps2/ps2input.o \
-	$(srcdir)/backends/platform/ps2/ps2pad.o \
-	$(srcdir)/backends/platform/ps2/savefilemgr.o \
-	$(srcdir)/backends/platform/ps2/fileio.o \
-	$(srcdir)/backends/platform/ps2/asyncfio.o \
-	$(srcdir)/backends/platform/ps2/icon.o \
-	$(srcdir)/backends/platform/ps2/cd.o \
-	$(srcdir)/backends/platform/ps2/eecodyvdfs.o \
-	$(srcdir)/backends/platform/ps2/rpckbd.o \
-	$(srcdir)/backends/platform/ps2/systemps2.o \
-	$(srcdir)/backends/platform/ps2/ps2mutex.o \
-	$(srcdir)/backends/platform/ps2/ps2time.o \
-	$(srcdir)/backends/platform/ps2/ps2debug.o
-
-MODULE_DIRS += .
-
-include $(srcdir)/Makefile.common
-
-LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -T $(PS2SDK)/ee/startup/linkfile
-LDFLAGS += -L $(PS2GDB)/lib  -L $(PS2SDK)/ee/lib -L .
-LDFLAGS += $(addprefix -L$(PS2_EXTRA),$(PS2_EXTRA_LIBS))
-LDFLAGS += -lmc -lpad -lmouse -lhdd -lpoweroff -lsjpcm -lmad -ltremor -lz -lm -lc -lfileXio -lps2gdbStub -lps2ip -ldebug -lkernel -lstdc++
-
-all: $(TARGET)
-
-$(TARGET): $(OBJS)
-	$(LD) $^ $(LDFLAGS) -o $@
diff --git a/backends/platform/ps2/Makefile.ps2 b/backends/platform/ps2/Makefile.ps2
index d6ce08a..f1a99b3 100644
--- a/backends/platform/ps2/Makefile.ps2
+++ b/backends/platform/ps2/Makefile.ps2
@@ -1,12 +1,9 @@
-# $Header: Exp $
- include $(PS2SDK)/Defs.make
+# SCUMMVM-PS2 MakeFile
 
-PS2_EXTRA = /works/devel/ps2/sdk-extra
-PS2_EXTRA_INCS = /zlib/include /libmad/ee/include /SjPcm/ee/src /tremor
-PS2_EXTRA_LIBS = /zlib/lib /libmad/ee/lib /SjPcm/ee/lib /tremor/tremor
 
-ENABLED=STATIC_PLUGIN
+# Use only this section to modify how the makefile behaves ------------
 
+# Scummvm engine config: choose which engines are enabled
 ENABLE_SCUMM = $(ENABLED)
 ENABLE_SCUMM_7_8 = $(ENABLED)
 ENABLE_HE = $(ENABLED)
@@ -19,89 +16,178 @@ ENABLE_DRACI = $(ENABLED)
 ENABLE_DRASCULA = $(ENABLED)
 ENABLE_GOB = $(ENABLED)
 ENABLE_GROOVIE = $(ENABLED)
-# ENABLE_GROOVIE2 = $(ENABLED)
-ENABLE_HUGO = $(ENABLED)
+ENABLE_GROOVIE2 = $(ENABLED)
 ENABLE_IHNM = $(ENABLED)
 ENABLE_KYRA = $(ENABLED)
-# ENABLE_LOL = $(ENABLED)
+ENABLE_LOL = $(ENABLED)
 ENABLE_LURE = $(ENABLED)
-# ENABLE_M4 = $(ENABLED)
+ENABLE_M4 = $(ENABLED)
 ENABLE_MADE = $(ENABLED)
-ENABLE_MOHAWK = $(ENABLED)
 ENABLE_PARALLACTION = $(ENABLED)
 ENABLE_QUEEN = $(ENABLED)
 ENABLE_SAGA = $(ENABLED)
-# ENABLE_SAGA2 = $(ENABLED)
+ENABLE_SAGA2 = $(ENABLED)
 ENABLE_SCI = $(ENABLED)
-# ENABLE_SCI32 = $(ENABLED)
+ENABLE_SCI32 = $(ENABLED)
 ENABLE_SKY = $(ENABLED)
 ENABLE_SWORD1 = $(ENABLED)
 ENABLE_SWORD2 = $(ENABLED)
 ENABLE_TEENAGENT = $(ENABLED)
 ENABLE_TINSEL = $(ENABLED)
-ENABLE_TOON = $(ENABLED)
 ENABLE_TOUCHE = $(ENABLED)
 ENABLE_TUCKER = $(ENABLED)
 
+# Set to 1 to enable seeing the commands to gcc
+VERBOSE_BUILD=0
+# Set to 1 to enable, 0 to disable dynamic modules
+DYNAMIC_MODULES = 1
+# Set to 1 to enable debugging
+ENABLE_DEBUG = 0
+# Set to 1 to enable profiling
+ENABLE_PROFILING = 0
+# Set to 1 to disable HDD+NET
+DISABLE_NETWORK = 0
+# Set to 1 to enable, 0 to disable libmad and libogg
+USE_LIBMAD = 1
+USE_LIBOGG = 1
 
-HAVE_GCC3 = true
+# ---------------------------------------------------------------------
 
-CC      = ee-gcc
-CXX     = ee-g++
-AS      = ee-gcc
-LD      = ee-gcc
-AR      = ee-ar cru
-RANLIB  = ee-ranlib
-STRIP   = ee-strip
-MKDIR   = mkdir -p
-RM      = rm -f
 
+# General variables
 srcdir = ../../..
 VPATH = $(srcdir)
-INCDIR = ../../../
-# DEPDIR = .deps
-
-DEFINES  = -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_ZLIB -DFORCE_RTL -DDISABLE_SAVEGAME_SORTING -D_EE -D__PLAYSTATION2__ -G2 -O2 -Wall -Wno-multichar -fno-rtti -fno-exceptions # -DNO_ADAPTOR
-# for release builds:
-#DEFINES += -DRELEASE_BUILD
-
-INCLUDES  = $(addprefix -I$(PS2_EXTRA),$(PS2_EXTRA_INCS))
-INCLUDES += -I $(PS2SDK)/ee/include -I $(PS2SDK)/common/include -I ./common -I . -I $(srcdir) -I $(srcdir)/engines
-
-CXX_UPDATE_DEP_FLAG = -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP
-
-TARGET = elf/scummvm.elf
+TARGET = scummvm.elf
+# PS2 SDK location variables
+# PS2SDK = /works/tools/devel/ps2/sdk
+
+# Check PS2SDK presence
+ifeq ($(PS2SDK),)
+$(error $$(PS2SDK) needs to be set.)
+endif
+
+# Variables for common Scummvm makefile
+CC     = ee-gcc
+CXX    = ee-g++
+FLAGS  = -pedantic -Wall -W
+FLAGS += -Wcast-qual -Wconversion -Wpointer-arith -Wshadow -Wwrite-strings
+FLAGS += -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-unused-parameter
+CFLAGS = $(FLAGS) -std=c99
+CXXFLAGS = $(FLAGS) -Wnon-virtual-dtor -Wno-reorder -fno-exceptions -fno-rtti
+
+DEFINES  = -D_EE -D__PLAYSTATION2__ -DUSE_ZLIB -DFORCE_RTL -DDATA_PATH=\"host:data\"
+DEFINES += -DDISABLE_SAVEGAME_SORTING -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE -DDISABLE_DOSBOX_OPL -DDISABLE_SID -DDISABLE_NES_APU
+
+INCDIR   := $(PS2SDK)/ee/include $(PS2SDK)/common/include $(PS2SDK)/ports/include . $(srcdir) $(srcdir)/engines
+INCLUDES := $(addprefix -I, $(INCDIR))
+DEPDIR = .deps
+MODULE_DIRS += ./
+MKDIR	= mkdir -p
+RM	= rm -f
+RM_REC	= rm -rf
+AR      = ee-ar cru
+RANLIB  = ee-ranlib
+STRIP   = ee-strip
+AS      = ee-gcc
+LD      = ee-gcc
+HAVE_GCC3 = true
+CXX_UPDATE_DEP_FLAG = -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" -MQ "$@" -MP
+
+# Variables for dynamic plugin building
+PLUGIN_PREFIX =
+PLUGIN_SUFFIX = .plg
+PLUGIN_EXTRA_DEPS = $(TARGET)
+PLUGIN_LDFLAGS  = -nostartfiles $(srcdir)/backends/plugins/elf/version.o -Wl,-q,--just-symbols,$(TARGET),--retain-symbols-file,$(srcdir)/backends/plugins/elf/plugin.syms
+PLUGIN_LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -Wl,-T$(srcdir)/backends/plugins/ps2/plugin.ld -lstdc++ -lc
+
+# Test for adding different libs
+ifeq ($(USE_LIBMAD),1)
+DEFINES += -DUSE_MAD
+LIBS	+= -lmad
+endif
+ifeq ($(USE_LIBOGG), 1)
+DEFINES += -DUSE_VORBIS -DUSE_TREMOR
+LIBS	+= -ltremor
+endif
+
+# Test for dynamic plugins
+ifeq ($(DYNAMIC_MODULES),1)
+ENABLED = DYNAMIC_PLUGIN
+DEFINES += -DDYNAMIC_MODULES -DUSE_ELF_LOADER -DMIPS_TARGET -DUNCACHED_PLUGINS -DPLUGIN_DIRECTORY=\"host:plugins\"
+PRE_OBJS_FLAGS = -Wl,--whole-archive
+POST_OBJS_FLAGS = -Wl,--no-whole-archive
+else
+ENABLED = STATIC_PLUGIN
+endif
+
+# Test for debug
+ifeq ($(ENABLE_DEBUG),1)
+FLAGS += -G2 -g
+DEFINES += -D__PS2_DEBUG__
+LIBS += -lps2gdbStub -lps2ip -ldebug
+else
+FLAGS += -G2 -O2 -s -Wuninitialized
+DEFINES += -DRELEASE_BUILD
+# LDFLAGS += -s
+endif
+
+# Test for profiling
+ifeq ($(ENABLE_PROFILING),1)
+DEFINES += -DENABLE_PROFILING
+CXXFLAGS += -pg -g
+LDFLAGS += -pg
+endif
+
+# Test for net support
+ifeq ($(DISABLE_NETWORK),1)
+DEFINES += -DNO_ADAPTOR
+endif
+
+# PS2 LIBS
+PS2LIBS = -lmc -lpad -lmouse -lhdd -lpoweroff -lsjpcm -lz -lm -lc -lfileXio -lkernel -lstdc++
+
+# Add in PS2SDK includes and libraries.
+LIBS += $(PS2LIBS)
 
 OBJS := $(srcdir)/backends/platform/ps2/DmaPipe.o \
-	$(srcdir)/backends/platform/ps2/Gs2dScreen.o \
-	$(srcdir)/backends/platform/ps2/irxboot.o \
-	$(srcdir)/backends/platform/ps2/ps2input.o \
-	$(srcdir)/backends/platform/ps2/ps2pad.o \
-	$(srcdir)/backends/platform/ps2/savefilemgr.o \
-	$(srcdir)/backends/platform/ps2/fileio.o \
-	$(srcdir)/backends/platform/ps2/asyncfio.o \
-	$(srcdir)/backends/platform/ps2/icon.o \
-	$(srcdir)/backends/platform/ps2/cd.o \
-	$(srcdir)/backends/platform/ps2/eecodyvdfs.o \
-	$(srcdir)/backends/platform/ps2/rpckbd.o \
-	$(srcdir)/backends/platform/ps2/systemps2.o \
-	$(srcdir)/backends/platform/ps2/ps2mutex.o \
-	$(srcdir)/backends/platform/ps2/ps2time.o \
-	$(srcdir)/backends/platform/ps2/ps2debug.o
-
-MODULE_DIRS += .
+        $(srcdir)/backends/platform/ps2/Gs2dScreen.o \
+        $(srcdir)/backends/platform/ps2/irxboot.o \
+        $(srcdir)/backends/platform/ps2/ps2input.o \
+        $(srcdir)/backends/platform/ps2/ps2pad.o \
+        $(srcdir)/backends/platform/ps2/savefilemgr.o \
+        $(srcdir)/backends/platform/ps2/fileio.o \
+        $(srcdir)/backends/platform/ps2/asyncfio.o \
+        $(srcdir)/backends/platform/ps2/icon.o \
+        $(srcdir)/backends/platform/ps2/cd.o \
+        $(srcdir)/backends/platform/ps2/eecodyvdfs.o \
+        $(srcdir)/backends/platform/ps2/rpckbd.o \
+        $(srcdir)/backends/platform/ps2/systemps2.o \
+        $(srcdir)/backends/platform/ps2/ps2mutex.o \
+        $(srcdir)/backends/platform/ps2/ps2time.o \
+        $(srcdir)/backends/platform/ps2/ps2debug.o
+
+ifeq ($(DYNAMIC_MODULES),1)
+OBJS += $(srcdir)/backends/plugins/elf/elf-loader.o \
+        $(srcdir)/backends/plugins/elf/elf-provider.o \
+        $(srcdir)/backends/plugins/elf/shorts-segment-manager.o \
+        $(srcdir)/backends/plugins/elf/memory-manager.o \
+        $(srcdir)/backends/plugins/elf/mips-loader.o \
+        $(srcdir)/backends/plugins/elf/version.o
+endif
 
 BACKEND := ps2
 
+# Include common Scummvm makefile
 include $(srcdir)/Makefile.common
 
+LDFLAGS += -L$(PS2SDK)/ee/lib -L$(PS2SDK)/ports/lib
+ifeq ($(DYNAMIC_MODULES),1)
+LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -Wl,-T$(srcdir)/backends/plugins/ps2/main_prog.ld
+else
 LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -T $(PS2SDK)/ee/startup/linkfile
-LDFLAGS += -L $(PS2SDK)/ee/lib -L .
-LDFLAGS += $(addprefix -L$(PS2_EXTRA),$(PS2_EXTRA_LIBS))
-LDFLAGS += -lmc -lpad -lmouse -lhdd -lpoweroff -lsjpcm -lmad -ltremor -lz -lm -lc -lfileXio -lkernel -lstdc++
-LDFLAGS += -s
+endif
 
 all: $(TARGET)
 
 $(TARGET): $(OBJS)
-	$(LD) $^ $(LDFLAGS) -o $@
+	$(LD) $(PRE_OBJS_FLAGS) $(OBJS) $(POST_OBJS_FLAGS) $(LDFLAGS) $(LIBS) -o $@
diff --git a/backends/platform/ps2/module.mk b/backends/platform/ps2/module.mk
index bf95a55..7bcc60e 100644
--- a/backends/platform/ps2/module.mk
+++ b/backends/platform/ps2/module.mk
@@ -2,20 +2,20 @@ MODULE := backends/platform/ps2
 
 MODULE_OBJS := \
 	DmaPipe.o \
-    Gs2dScreen.o \
-    irxboot.o \
+	Gs2dScreen.o \
+	irxboot.o \
 	ps2input.o \
 	ps2pad.o \
 	savefilemgr.o \
-    fileio.o \
-    asyncfio.o \
+	fileio.o \
+	asyncfio.o \
 	icon.o \
-    cd.o \
-    eecodyvdfs.o \
-    rpckbd.o \
-    systemps2.o \
-    ps2mutex.o \
-    ps2time.o \
+	cd.o \
+	eecodyvdfs.o \
+	rpckbd.o \
+	systemps2.o \
+	ps2mutex.o \
+	ps2time.o \
 	ps2debug.o
 
 # We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.


Commit: 1cbb90d8ea82e728fa8ead8a4004dc53f3a75764
    https://github.com/scummvm/scummvm/commit/1cbb90d8ea82e728fa8ead8a4004dc53f3a75764
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-18T13:48:37-05:00

Commit Message:
PS2: modular IRX drivers loading

Changed paths:
    backends/fs/ps2/ps2-fs.cpp
    backends/platform/ps2/irxboot.cpp
    backends/platform/ps2/irxboot.h
    backends/platform/ps2/systemps2.cpp
    backends/platform/ps2/systemps2.h



diff --git a/backends/fs/ps2/ps2-fs.cpp b/backends/fs/ps2/ps2-fs.cpp
index 3a86cb3..1c35d15 100644
--- a/backends/fs/ps2/ps2-fs.cpp
+++ b/backends/fs/ps2/ps2-fs.cpp
@@ -333,7 +333,8 @@ bool Ps2FilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hi
 		return false;
 
 	if (_isRoot) {
-		list.push_back(new Ps2FilesystemNode("cdfs:"));
+		if (g_systemPs2->cdPresent())
+			list.push_back(new Ps2FilesystemNode("cdfs:"));
 
 		if (g_systemPs2->hddPresent())
 			list.push_back(new Ps2FilesystemNode("pfs0:"));
@@ -341,7 +342,7 @@ bool Ps2FilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hi
 		if (g_systemPs2->usbMassPresent())
 			list.push_back(new Ps2FilesystemNode("mass:"));
 
-		if (g_systemPs2->getBootDevice()==HOST_DEV || g_systemPs2->netPresent())
+		if (g_systemPs2->netPresent())
 			list.push_back(new Ps2FilesystemNode("host:"));
 
 		if (g_systemPs2->mcPresent())
diff --git a/backends/platform/ps2/irxboot.cpp b/backends/platform/ps2/irxboot.cpp
index aa904d4..ee52687 100644
--- a/backends/platform/ps2/irxboot.cpp
+++ b/backends/platform/ps2/irxboot.cpp
@@ -34,37 +34,65 @@
 
 static const char hddArg[] = "-o" "\0" "8" "\0" "-n" "\0" "20";
 static const char pfsArg[] = "-m" "\0" "2" "\0" "-o" "\0" "32" "\0" "-n" "\0" "72"; // "\0" "-debug";
-static const char netArg[] = "192.168.0.10" "\0" "255.255.255.0" "\0" "192.168.0.1";
-
-IrxFile irxFiles[] = {
-	{ "SIO2MAN", BIOS, NOTHING, NULL, 0 },
-	{ "MCMAN",   BIOS, NOTHING, NULL, 0 },
-	{ "MCSERV",  BIOS, NOTHING, NULL, 0 },
-	{ "PADMAN",  BIOS, NOTHING, NULL, 0 },
-	{ "LIBSD",   BIOS, NOTHING, NULL, 0 },
-
-	{ "IOMANX.IRX",   SYSTEM, NOTHING, NULL, 0 },
-	{ "FILEXIO.IRX",  SYSTEM, NOTHING, NULL, 0 },
-	{ "CODYVDFS.IRX", SYSTEM, NOTHING, NULL, 0 },
+static const char netArg[] = "192.168.1.20" "\0" "255.255.255.0" "\0" "192.168.1.1"; // TODO: set in ScummVM.ini
+
+IrxFile irxCore[] = { // core modules
+	// Memory Card
+	{ "SIO2MAN",      BIOS, NOTHING, NULL, 0 },
+	{ "MCMAN",        BIOS, NOTHING, NULL, 0 },
+	{ "MCSERV",       BIOS, NOTHING, NULL, 0 },
+	// Joypad
+	{ "PADMAN",       BIOS, NOTHING, NULL, 0 },
+	// Sound
+	{ "LIBSD",        BIOS, NOTHING, NULL, 0 },
 	{ "SJPCM.IRX",    SYSTEM, NOTHING, NULL, 0 },
+	// Files I/O
+	{ "IOMANX.IRX",   SYSTEM, NOTHING, NULL, 0 },
+	{ "FILEXIO.IRX",  SYSTEM, NOTHING, NULL, 0 }
+};
+
+IrxFile irxCdrom[] = { // cdrom modules
+	// CD-Rom FS
+	{ "CODYVDFS.IRX", SYSTEM, CD_DRIVER, NULL, 0 }
+};
 
+IrxFile irxUSB[] = { // USB mass
+	// USB drv & key
 	{ "USBD.IRX",     USB | OPTIONAL | DEPENDANCY, USB_DRIVER, NULL, 0 },
-	{ "USB_MASS.IRX", USB | OPTIONAL, MASS_DRIVER, NULL, 0 },
+	{ "USB_MASS.IRX", USB | OPTIONAL, MASS_DRIVER, NULL, 0 }
+};
+
+IrxFile irxInput[] = { // USB input
+	// USB mouse & kbd
 	{ "PS2MOUSE.IRX", USB | OPTIONAL, MOUSE_DRIVER, NULL, 0 },
-	{ "RPCKBD.IRX",   USB | OPTIONAL, KBD_DRIVER, NULL, 0 },
-#ifndef NO_ADAPTOR
+	{ "RPCKBD.IRX",   USB | OPTIONAL, KBD_DRIVER, NULL, 0 }
+};
+
+IrxFile irxHDD[] = { // modules to support HDD
+	// hdd modules
 	{ "POWEROFF.IRX", HDD | OPTIONAL | NOT_HOST | DEPENDANCY, HDD_DRIVER, NULL, 0 },
 	{ "PS2DEV9.IRX",  HDD | OPTIONAL | NOT_HOST | DEPENDANCY, HDD_DRIVER, NULL, 0 },
 	{ "PS2ATAD.IRX",  HDD | OPTIONAL | DEPENDANCY, HDD_DRIVER, NULL, 0 },
 	{ "PS2HDD.IRX",   HDD | OPTIONAL | DEPENDANCY, HDD_DRIVER, hddArg, sizeof(hddArg) },
-	{ "PS2FS.IRX",    HDD | OPTIONAL | DEPENDANCY, HDD_DRIVER, pfsArg, sizeof(pfsArg) },
+	{ "PS2FS.IRX",    HDD | OPTIONAL | DEPENDANCY, HDD_DRIVER, pfsArg, sizeof(pfsArg) }
+};
+
+IrxFile irxNet[] = { // modules to support NET
+	// net modules
 	{ "PS2IP.IRX",    NET | OPTIONAL | NOT_HOST | DEPENDANCY, NET_DRIVER, NULL, 0 },
 	{ "PS2SMAP.IRX",  NET | OPTIONAL | NOT_HOST | DEPENDANCY, NET_DRIVER, netArg, sizeof(netArg) },
 	{ "PS2HOST.IRX",  NET | OPTIONAL | NOT_HOST | DEPENDANCY, NET_DRIVER, NULL, 0 }
-#endif
 };
 
-static const int numIrxFiles = sizeof(irxFiles) / sizeof(irxFiles[0]);
+IrxFile *irxType[IRX_MAX] = { irxCore, irxCdrom, irxUSB, irxInput, irxHDD, irxNet };
+
+static const int numIrx[IRX_MAX] = { sizeof(irxCore) / sizeof(IrxFile),
+                                     sizeof(irxCdrom) / sizeof(IrxFile),
+                                     sizeof(irxUSB) / sizeof(IrxFile),
+                                     sizeof(irxInput) / sizeof(IrxFile),
+                                     sizeof(irxHDD) / sizeof(IrxFile),
+                                     sizeof(irxNet) / sizeof(IrxFile)
+};
 
 PS2Device detectBootPath(const char *elfPath, char *bootPath) {
 
@@ -113,12 +141,19 @@ PS2Device detectBootPath(const char *elfPath, char *bootPath) {
 	return device;
 }
 
-int loadIrxModules(int device, const char *irxPath, IrxReference **modules) {
+int loadIrxModules(int device, const char *irxPath, IrxReference **modules, IrxType type) {
+
+	IrxReference *resModules;
+	IrxReference *curModule;
+	IrxFile *irxFiles;
+	int numFiles;
 
-	IrxReference *resModules = (IrxReference *)malloc(numIrxFiles * sizeof(IrxReference));
-	IrxReference *curModule = resModules;
+	irxFiles = irxType[type];
+	numFiles = numIrx[type];
+	resModules = (IrxReference *)malloc(numFiles * sizeof(IrxReference));
+	curModule = resModules;	
 
-	for (int i = 0; i < numIrxFiles; i++) {
+	for (int i = 0; i < numFiles; i++) {
 		curModule->fileRef = irxFiles + i;
 		if ((device == HOST_DEV) && (irxFiles[i].flags & NOT_HOST))
 			continue;
@@ -191,7 +226,7 @@ int loadIrxModules(int device, const char *irxPath, IrxReference **modules) {
 							pos++;
 					}
 					// and skip any remaining modules that depend on the missing one, too.
-					while ((i < numIrxFiles - 1) && ((irxFiles[i + 1].flags & TYPEMASK) == (curModule->fileRef->flags & TYPEMASK)))
+					while ((i < numFiles - 1) && ((irxFiles[i + 1].flags & TYPEMASK) == (curModule->fileRef->flags & TYPEMASK)))
 						i++;
 					// the module that actually failed (curModule) is kept in the array for displaying an error message
 				}
diff --git a/backends/platform/ps2/irxboot.h b/backends/platform/ps2/irxboot.h
index 81b47a3..f8b451f 100644
--- a/backends/platform/ps2/irxboot.h
+++ b/backends/platform/ps2/irxboot.h
@@ -25,6 +25,16 @@
 
 #include "common/scummsys.h"
 
+enum IrxType {
+	IRX_CORE = 0,
+	IRX_CDROM,
+	IRX_USB,
+	IRX_INPUT,
+	IRX_HDD,
+	IRX_NET,
+	IRX_MAX
+};
+
 enum IrxFlags {
 	BIOS = 0,
 	SYSTEM = 1,
@@ -40,6 +50,7 @@ enum IrxFlags {
 
 enum IrxPurpose {
 	NOTHING,
+	CD_DRIVER,
 	HDD_DRIVER,
 	USB_DRIVER,
 	MOUSE_DRIVER,
@@ -81,6 +92,6 @@ struct IrxReference {
 	int errorCode;
 };
 
-int loadIrxModules(int device, const char *irxPath, IrxReference **modules);
+int loadIrxModules(int device, const char *irxPath, IrxReference **modules, IrxType type);
 
 #endif // __IRXBOOT_H__
diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index abea696..2f6130c 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -50,7 +50,6 @@
 #include "backends/platform/ps2/cd.h"
 #include "backends/platform/ps2/fileio.h"
 #include "backends/platform/ps2/Gs2dScreen.h"
-#include "backends/platform/ps2/irxboot.h"
 #include "backends/platform/ps2/ps2debug.h"
 #include "backends/platform/ps2/ps2input.h"
 #include "backends/platform/ps2/savefilemgr.h"
@@ -189,8 +188,6 @@ void gluePowerOffCallback(void *system) {
 
 void OSystem_PS2::startIrxModules(int numModules, IrxReference *modules) {
 
-	_usbMassLoaded = _useMouse = _useKbd = _useHdd = _useNet = false;
-
 	int res = 0, rv = 0;
 	for (int i = 0; i < numModules; i++) {
 		if (modules[i].loc == IRX_FILE) {
@@ -216,6 +213,9 @@ void OSystem_PS2::startIrxModules(int numModules, IrxReference *modules) {
 						case KBD_DRIVER:
 							_useKbd = true;
 							break;
+						case CD_DRIVER:
+							_useCd = true;
+							break;
 						case HDD_DRIVER:
 							_useHdd = true;
 							break;
@@ -252,9 +252,67 @@ void OSystem_PS2::startIrxModules(int numModules, IrxReference *modules) {
 	sioprintf("UsbMass: %sloaded\n", _usbMassLoaded ? "" : "not ");
 	sioprintf("Mouse:   %sloaded\n", _useMouse ? "" : "not ");
 	sioprintf("Kbd:     %sloaded\n", _useKbd ? "" : "not ");
+	sioprintf("Cd:      %sloaded\n", _useCd ? "" : "not ");
 	sioprintf("Hdd:     %sloaded\n", _useHdd ? "" : "not ");
 }
 
+bool OSystem_PS2::loadDrivers(IrxType type)
+{
+	IrxReference *modules;
+	int numModules;
+	int res;
+
+	numModules = loadIrxModules(_bootDevice, _bootPath, &modules, type);
+	startIrxModules(numModules, modules);
+
+	switch (type) {
+	case IRX_CORE:
+		/* Init I/O */
+		if ((res = fileXioInit()) < 0) {
+			msgPrintf(FOREVER, "FXIO init failed: %d", res);
+			quit();
+		}
+		/* Init sound */
+		if ((res = SjPCM_Init(0)) < 0) {
+			msgPrintf(FOREVER, "SjPCM bind failed: %d\n", res);
+			quit();
+		}
+	break;
+
+	case IRX_CDROM:
+		/* Init CDROM & RTC Clock */
+		if ((res = initCdvdFs()) < 0) {
+			msgPrintf(FOREVER, "CoDyVDfs bind failed: %d", res);
+			quit();
+		}
+		sioprintf("Reading RTC\n");
+		readRtcTime(); /* depends on CDROM driver! */
+	break;
+
+	case IRX_HDD:
+		/* Check HD is available and formatted */
+		if ((hddCheckPresent() < 0) || (hddCheckFormatted() < 0)) {
+			_useHdd = false;
+		}
+		else {
+			poweroffInit();
+			poweroffSetCallback(gluePowerOffCallback, this);
+		
+			if (fio.mount("pfs0:", "hdd0:+ScummVM", 0) >= 0)
+				printf("Successfully mounted!\n");
+			else
+				_useHdd = false;
+		}
+	break;
+
+	default:
+		/* zzz */
+	break;
+	}
+
+	return true;
+}
+
 OSystem_PS2::OSystem_PS2(const char *elfPath) {
 	_soundStack = _timerStack = NULL;
 	_printY = 0;
@@ -262,6 +320,7 @@ OSystem_PS2::OSystem_PS2(const char *elfPath) {
 	_systemQuit = false;
 	_modeChanged = false;
 	_screenChangeCount = 0;
+	_mouseVisible = false;
 
 	_screen = new Gs2dScreen(320, 200, TV_DONT_CARE);
 
@@ -272,10 +331,8 @@ OSystem_PS2::OSystem_PS2(const char *elfPath) {
 	_bootPath = (char *)malloc(128);
 	_bootDevice = detectBootPath(elfPath, _bootPath);
 
-	IrxReference *modules;
-	int numModules = loadIrxModules(_bootDevice, _bootPath, &modules);
-
 	if (_bootDevice != HOST_DEV) {
+		// TODO: reset funx
 		sioprintf("Resetting IOP.\n");
 		cdvdInit(CDVD_EXIT);
 		cdvdExit();
@@ -298,50 +355,20 @@ OSystem_PS2::OSystem_PS2(const char *elfPath) {
 		// TODO: ps2link 1.46 will stall on "poweroff" init / cb
 	}
 
-	startIrxModules(numModules, modules);
+	_usbMassLoaded = _useMouse = _useKbd = _useCd = _useHdd = _useNet = false;
 
-	int res;
-	if ((res = fileXioInit()) < 0) {
-		msgPrintf(FOREVER, "FXIO Init failed: %d", res);
-		quit();
-	}
-
-	if ((res = initCdvdFs()) < 0) {
-		msgPrintf(FOREVER, "CoDyVDfs bind failed: %d", res);
-		quit();
-	}
-
-	if ((res = SjPCM_Init(0)) < 0) {
-		msgPrintf(FOREVER, "SjPCM Bind failed: %d\n", res);
-		quit();
-	}
-
-	if (_useHdd) {
-		if ((hddCheckPresent() < 0) || (hddCheckFormatted() < 0))
-			_useHdd = false;
-
-		//hddPreparePoweroff();
-		poweroffInit();
-
-		//hddSetUserPoweroffCallback(gluePowerOffCallback, this);
-		poweroffSetCallback(gluePowerOffCallback, this);
-	}
+	loadDrivers(IRX_CORE);
+	loadDrivers(IRX_CDROM);
+	// loadDrivers(IRX_USB); // why they only load correctly post HDD ?
+	// loadDrivers(IRX_INPUT);
+	#ifndef NO_ADAPTOR
+	loadDrivers(IRX_HDD);
+	loadDrivers(IRX_NET);
+	#endif
+	loadDrivers(IRX_USB);
+        loadDrivers(IRX_INPUT);
 
 	fileXioSetBlockMode(FXIO_NOWAIT);
-
-	_mouseVisible = false;
-
-	sioprintf("reading RTC\n");
-	readRtcTime();
-
-	if (_useHdd) {
-		// TODO : make partition path configurable
-		if (fio.mount("pfs0:", "hdd0:+ScummVM", 0) >= 0)
-			printf("Successfully mounted!\n");
-		else
-			_useHdd = false;
-	}
-
 	initMutexes();
 }
 
@@ -510,6 +537,10 @@ bool OSystem_PS2::mcPresent(void) {
 	return false;
 }
 
+bool OSystem_PS2::cdPresent(void) {
+	return _useCd;
+}
+
 bool OSystem_PS2::hddPresent(void) {
 	return _useHdd;
 }
@@ -528,7 +559,11 @@ bool OSystem_PS2::usbMassPresent(void) {
 }
 
 bool OSystem_PS2::netPresent(void) {
-	return _useNet;
+	if (_bootDevice == HOST_DEV || _useNet) {
+		return true;
+	}
+
+	return false;
 }
 
 void OSystem_PS2::initSize(uint width, uint height, const Graphics::PixelFormat *format) {
@@ -829,7 +864,7 @@ void OSystem_PS2::quit(void) {
 			"   li $3, 0x04;"
 			"   syscall;"
 			"   nop;"
-        );
+		);
 */
 
 /*
diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h
index 0ae6b2d..773068b 100644
--- a/backends/platform/ps2/systemps2.h
+++ b/backends/platform/ps2/systemps2.h
@@ -25,6 +25,7 @@
 
 #include "common/system.h"
 #include "backends/base-backend.h"
+#include "backends/platform/ps2/irxboot.h"
 #include "graphics/palette.h"
 
 class Gs2dScreen;
@@ -119,6 +120,7 @@ public:
 	void powerOffCallback(void);
 
 	bool mcPresent(void);
+	bool cdPresent(void);
 	bool hddPresent(void);
 	bool usbMassPresent(void);
 	bool netPresent(void);
@@ -127,6 +129,7 @@ public:
 	int getBootDevice() { return _bootDevice; }
 
 private:
+	bool loadDrivers(IrxType type);
 	void startIrxModules(int numModules, IrxReference *modules);
 
 	void initMutexes(void);
@@ -136,7 +139,7 @@ private:
 	Audio::MixerImpl *_scummMixer;
 
 	bool _mouseVisible;
-	bool _useMouse, _useKbd, _useHdd, _usbMassLoaded, _useNet;
+	bool _useMouse, _useKbd, _useCd, _useHdd, _usbMassLoaded, _useNet;
 
 	Gs2dScreen *_screen;
 	Ps2Input *_input;


Commit: ca2f0f0067a53c468e6eb86a27e87a56ef2f60a5
    https://github.com/scummvm/scummvm/commit/ca2f0f0067a53c468e6eb86a27e87a56ef2f60a5
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-18T13:48:48-05:00

Commit Message:
PS2: added [PlayStation2] section to scummvm.ini

Changed paths:
    backends/platform/ps2/systemps2.cpp
    backends/platform/ps2/systemps2.h



diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index 2f6130c..c301ec8 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -263,6 +263,7 @@ bool OSystem_PS2::loadDrivers(IrxType type)
 	int res;
 
 	numModules = loadIrxModules(_bootDevice, _bootPath, &modules, type);
+	// TODO: for IRX_NET allows override IP addr
 	startIrxModules(numModules, modules);
 
 	switch (type) {
@@ -297,14 +298,14 @@ bool OSystem_PS2::loadDrivers(IrxType type)
 		else {
 			poweroffInit();
 			poweroffSetCallback(gluePowerOffCallback, this);
-		
-			if (fio.mount("pfs0:", "hdd0:+ScummVM", 0) >= 0)
-				printf("Successfully mounted!\n");
-			else
-				_useHdd = false;
 		}
 	break;
 
+	case IRX_NET:
+		if (_bootDevice == HOST_DEV) // net is pre-loaded on host
+			_useNet = true;      // so we need to set by hand
+	break;
+
 	default:
 		/* zzz */
 	break;
@@ -358,15 +359,7 @@ OSystem_PS2::OSystem_PS2(const char *elfPath) {
 	_usbMassLoaded = _useMouse = _useKbd = _useCd = _useHdd = _useNet = false;
 
 	loadDrivers(IRX_CORE);
-	loadDrivers(IRX_CDROM);
-	// loadDrivers(IRX_USB); // why they only load correctly post HDD ?
-	// loadDrivers(IRX_INPUT);
-	#ifndef NO_ADAPTOR
-	loadDrivers(IRX_HDD);
-	loadDrivers(IRX_NET);
-	#endif
-	loadDrivers(IRX_USB);
-        loadDrivers(IRX_INPUT);
+	loadDrivers(IRX_CDROM); // consider CDROM as "core", as RTC depends on it
 
 	fileXioSetBlockMode(FXIO_NOWAIT);
 	initMutexes();
@@ -393,6 +386,58 @@ void OSystem_PS2::init(void) {
 	fillScreen(0);
 }
 
+void OSystem_PS2::config(void) {
+	#ifndef NO_ADAPTOR
+	if (ConfMan.hasKey("hdd_part", "PlayStation2")) { // "hdd" ?
+		const char *hdd = ConfMan.get("hdd_part", "PlayStation2").c_str();
+
+		if ( !strcmp(hdd, "0") || !strcmp(hdd, "no") || !strcmp(hdd, "disable") ) {
+			_useHdd = false;
+		}
+		else {
+			loadDrivers(IRX_HDD);
+			hddMount(hdd);
+		}
+	}
+	else { // check for HDD and assume partition is +ScummVM
+		loadDrivers(IRX_HDD);
+		hddMount("ScummVM");
+	}
+
+	if (ConfMan.hasKey("net_addr", "PlayStation2")) { // "net" ?
+		const char *net = ConfMan.get("net_addr", "PlayStation2").c_str();
+
+		if ( !strcmp(net, "0") || !strcmp(net, "no") || !strcmp(net, "disable") ) {
+			_useNet = false;
+		}
+		else {
+			loadDrivers(IRX_NET);
+			// TODO: netInit("xxx.xxx.xxx.xxx");
+		}
+	}
+	else { // setup net - IP hardcoded 192.168.1.20
+		loadDrivers(IRX_NET);
+	}
+	#endif
+
+	// why USB drivers only load correctly post HDD ?
+	if (ConfMan.hasKey("usb_mass", "PlayStation2")) { // "usb" ?
+		const char *usb = ConfMan.get("usb_mass", "PlayStation2").c_str();
+
+		if ( !strcmp(usb, "0") || !strcmp(usb, "no") || !strcmp(usb, "disable") ) {
+			_usbMassLoaded = false;
+		}
+		else {
+			loadDrivers(IRX_USB);
+			loadDrivers(IRX_INPUT);
+		}
+	}
+	else { // load USB drivers (mass & input(
+		loadDrivers(IRX_USB);
+		loadDrivers(IRX_INPUT);
+	}
+}
+
 OSystem_PS2::~OSystem_PS2(void) {
 	free(_bootPath);
 	free(_configFile);
@@ -559,15 +604,37 @@ bool OSystem_PS2::usbMassPresent(void) {
 }
 
 bool OSystem_PS2::netPresent(void) {
-	if (_bootDevice == HOST_DEV || _useNet) {
+	if (_useNet) 
 		return true;
-	}
 
 	return false;
 }
 
+bool OSystem_PS2::hddMount(const char *partition) {
+	char name[64] = "hdd0:+ScummVM";
+
+	if (partition)
+		strcpy(name+6, partition);
+
+	if (fio.mount("pfs0:", name, 0) >= 0) {
+		printf("Successfully mounted (%s)!\n", name);
+		return true;
+	}
+	else {
+		printf("Failed to mount (%s).\n", name);
+		_useHdd = false;
+		return false;
+	}
+}
+
 void OSystem_PS2::initSize(uint width, uint height, const Graphics::PixelFormat *format) {
 	printf("initializing new size: (%d/%d)...", width, height);
+
+	/* ugly hack: we know we can parse ScummVM.ini now */
+	if (!_screenChangeCount) { // first round
+		config();
+	}
+
 	_screen->newScreenSize(width, height);
 	_screen->setMouseXy(width / 2, height / 2);
 	_input->newRange(0, 0, width - 1, height - 1);
diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h
index 773068b..2307014 100644
--- a/backends/platform/ps2/systemps2.h
+++ b/backends/platform/ps2/systemps2.h
@@ -52,6 +52,7 @@ public:
 	virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format);
 
 	void init(void);
+	void config(void);
 
 	virtual int16 getHeight(void);
 	virtual int16 getWidth(void);
@@ -124,6 +125,7 @@ public:
 	bool hddPresent(void);
 	bool usbMassPresent(void);
 	bool netPresent(void);
+	bool hddMount(const char *partition);
 
 	bool runningFromHost(void);
 	int getBootDevice() { return _bootDevice; }


Commit: beee456c688330e044b5ec32e5860f9b3ab4ff2e
    https://github.com/scummvm/scummvm/commit/beee456c688330e044b5ec32e5860f9b3ab4ff2e
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-18T13:49:07-05:00

Commit Message:
PS2: support for different gfx modes

Changed paths:
    backends/platform/ps2/Gs2dScreen.cpp
    backends/platform/ps2/Gs2dScreen.h
    backends/platform/ps2/GsDefs.h
    backends/platform/ps2/systemps2.cpp



diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp
index da1cce3..c1d6b6e 100644
--- a/backends/platform/ps2/Gs2dScreen.cpp
+++ b/backends/platform/ps2/Gs2dScreen.cpp
@@ -44,12 +44,49 @@ enum Buffers {
 	PRINTF
 };
 
+/*
+	Supported modes:
+
+	Mode #1 = SDTV progressive (NTSC: 224p / PAL: 256p)
+	Mode #2 = SDTV interlaced  (NTSC: 448i / PAL: 512i) <- default
+	Mode #3 = EDTV progressive (NTSC: 480p / PAL: 576p)
+	Mode #4 = HDTV progressive (720p)
+	Mode #5 = HDTV interlaced  (1080i)
+	Mode #6 = VESA (640x480 at 60)
+	Mode #7 = VESA (800x600 at 60)
+	Mode #8 = VESA (1024x768 at 60)
+*/
+
+static ps2_mode_t ps2_mode[] = {
+
+	// -> w, h, interlaced, pitch, mode, vck, magh, magv, dx, dy
+
+	/* #1 : SDTV - progressive */
+	{ 640, 224, 0, 640, 0x02, 2560, 4, 0, 160 /*158*/, 25 /*22*/ }, /* NTSC */
+	{ 640, 256, 0, 640, 0x03, 2560, 4, 0, 170 /*163*/, 35 /*36*/ }, /* PAL */
+
+	/* #2 : SDTV - interlaced */
+	{ 640, 448, 1, 640, 0x02, 2560, 4, 0, 156 /*158*/, 50 /*45*/ }, /* NTSC */
+	{ 640, 512, 1, 640, 0x03, 2560, 4, 0, 170 /*163*/, 70 /*72*/ }, /* PAL */
+
+	/* #3 : EDTV */
+	{ 720, 480, 0, 768, 0x50, 1440, 2, 0, 58, 35 }, /* NTSC */
+	/* { 720, 576, 0, 768, 0x53, 1440, 2, 0, 62, 45 }, */ /* PAL : full */
+	/* { 656, 576, 0, 704, 0x53, 1312, 2, 0, 62, 45 }, */ /* PAL : redux @ (0,0) */
+	{ 656, 576, 0, 704, 0x53, 1312, 2, 0, 78 /*314*/, 45 }, /* PAL : redux @ center'd */
+
+	/* #4/#5 : HDTV */
+	{ 1280,  720, 0, 1280, 0x52, 1280, 1, 0, 76 /*302*/, 24 },
+	{ 1920, 1080, 1, 1920, 0x51, 1920, 1, 0, 60 /*236*/ /*238*/, 40 },
+
+	/* #6/#7/#8 : VESA 4:3 @ 60Hz */
+	{ 640, 480, 0,  640, 0x1A, 1280, 2, 0, 70 /*276*/, 34 },
+	{ 800, 600, 0,  832, 0x2B, 1600, 2, 0, 105 /*420*/, 26 },
+	{ 1024, 768, 0, 1024, 0x3B, 2048, 2, 0, 144 /*580*/, 34 }
+};
+
 #define ANIM_STACK_SIZE (1024 * 32)
 
-#define DEFAULT_PAL_X		175
-#define DEFAULT_PAL_Y		72 // 60
-#define DEFAULT_NTSC_X		165
-#define DEFAULT_NTSC_Y		45
 #define ORG_X 256
 #define ORG_Y 256
 #define ORIGIN_X (ORG_X << 4)
@@ -103,7 +140,8 @@ int vblankEndHandler(int cause) {
 
 void createAnimThread(Gs2dScreen *screen);
 
-Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode mode) {
+Gs2dScreen::Gs2dScreen(uint16 width, uint16 height) {
+
 	_systemQuit = false;
 	ee_sema_t newSema;
 	newSema.init_count = 1;
@@ -131,7 +169,7 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode mode) {
 	_pitch = (width + 127) & ~127;
 
 	_screenBuf = (uint8 *)memalign(64, _width * _height);
-	_overlayBuf = (uint16 *)memalign(64, _width * _height * 2);
+	_overlayBuf = (uint16 *)memalign(64, _pitch * _height * 2);
 	_clut = (uint32 *)memalign(64, 256 * 4);
 
 	memset(_screenBuf, 0, _width * _height);
@@ -139,32 +177,102 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode mode) {
 	_clut[1] = GS_RGBA(0xC0, 0xC0, 0xC0, 0);
 	clearOverlay();
 
-	if (mode == TV_DONT_CARE) {
-#if 1
 	char romver[8];
+	uint16 biosver;
 	int fd = fioOpen("rom0:ROMVER", O_RDONLY);
 	fioRead(fd, &romver, 8);
 	fioClose(fd);
+	biosver=atoi(romver);
+	printf("ROMVER = %s\n", romver);
+	printf("ver = %d\n", atoi(romver));
+
+	if (!_tvMode) { // determine TV standard first
+		if (ConfMan.hasKey("tv_mode", "PlayStation2")) {
+			const char *tvname = ConfMan.get("tv_mode", "PlayStation2").c_str();
+
+			if (strcmp("ntsc", tvname) == 0) {
+				_tvMode = 2;
+			}
+			else if (strcmp("pal", tvname) == 0) {
+				_tvMode = 1;
+			}
+			else
+				_tvMode = 0;
+		}
+
+		if (!_tvMode) {
+			if (romver[4] == 'E')
+				_tvMode = TV_PAL;
+			else
+				_tvMode = TV_NTSC;
 
-	if (romver[4] == 'E')
-		_tvMode = TV_PAL;
-	else
-		_tvMode = TV_NTSC;
-#else
-		if (PAL_NTSC_FLAG == 'E')
-			_tvMode = TV_PAL;
+			printf("Auto-detect TV mode: PSX:%c PS2:%c\n", *(char *)(0x1FC7FF52), romver[4]);
+		}
+	}
+
+	uint8 mode;
+	if (!_gfxMode) { // determine GFX mode next
+		if (ConfMan.hasKey("gfx_mode", "PlayStation2")) {
+			_gfxMode = ConfMan.getInt("gfx_mode", "PlayStation2");
+			// TODO: free more video mem to support these modes
+			if (_gfxMode == 4 || _gfxMode == 5) {
+				printf("Not enough video mem: using EDTV (3)\n");
+				_gfxMode = 3;
+			}
+			else
+			if (_gfxMode == 7 || _gfxMode == 8) {
+				printf("Not enough video mem: using VGA (6)\n");
+				_gfxMode = 6;
+			}
+
+			if (_gfxMode < 1 || _gfxMode > 8) _gfxMode = 2;
+			else
+			if (_gfxMode == 4 || _gfxMode == 5) _tvMode = TV_HDTV;
+			else
+			if (_gfxMode > 5) _tvMode = TV_VESA;
+		}
 		else
-			_tvMode = TV_NTSC;
-#endif
-	} else
-		_tvMode = mode;
+			_gfxMode = 2;
+	}
 
-	// _tvMode = TV_NTSC;
-	printf("Setting up %s mode\n", (_tvMode == TV_PAL) ? "PAL" : "NTSC");
+	// Remap Mode Index
+	mode = _gfxMode;
+	if (_tvMode == TV_NTSC) {
+		mode = (mode * 2) - 1;
+	}
+	else if (_tvMode == TV_PAL) {
+		mode = (mode * 2);
+	}
+	else if (_tvMode == TV_HDTV) {
+		mode += 3;
+	}
+	else /* VESA */ {
+		_tvMode = TV_VESA;
+		mode += 3;
+	}
+	mode--;
+
+	switch (_tvMode) {
+	case TV_NTSC:
+		printf("Setting up TV mode: NTSC\n");
+	break;
+	case TV_PAL:
+		printf("Setting up TV mode: PAL\n");
+	break;
+	case TV_HDTV:
+		printf("Setting up TV mode: HDTV\n");
+	break;
+	case TV_VESA:
+		printf("Setting up TV mode: VESA\n");
+	break;
+	}
+
+	_tvWidth = ps2_mode[mode].w;
+	_tvHeight = ps2_mode[mode].h;
+	_tvPitch = ps2_mode[mode].pitch;
+
+	printf("Setting up GFX mode: %d x %d\n", _tvWidth, _tvHeight);
 
-	// set screen size, 640x512 for pal, 640x448 for ntsc
-	_tvWidth = 640;
-	_tvHeight = ((_tvMode == TV_PAL) ? 512 /*544*/ : 448);
 	kFullScreen[0].z = kFullScreen[1].z = 0;
 	kFullScreen[0].x = ORIGIN_X;
 	kFullScreen[0].y = ORIGIN_Y;
@@ -177,7 +285,7 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode mode) {
 	_texCoords[1].u = SCALE(_width);
 	_texCoords[1].v = SCALE(_height);
 
-	uint32 tvFrameSize = _tvWidth * _tvHeight * 4;  // 32 bits per pixel
+	uint32 tvFrameSize = _tvPitch * _tvHeight * 4;  // 32 bits per pixel
 
 	// setup frame buffer pointers
 	_frameBufPtr[0] = 0;
@@ -216,22 +324,39 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode mode) {
 	GS_CSR = 0;
 	GsPutIMR(0x7F00);
 
-	uint16 dispPosX, dispPosY;
 
-	if (_tvMode == TV_PAL) {
-		SetGsCrt(GS_INTERLACED, 3, 0);
-		dispPosX = DEFAULT_PAL_X;
-		dispPosY = DEFAULT_PAL_Y;
-	} else {
-		SetGsCrt(GS_INTERLACED, 2, 0);
-		dispPosX = DEFAULT_NTSC_X;
-		dispPosY = DEFAULT_NTSC_Y;
+	if (biosver < 220 && ps2_mode[mode].mode == 0x53) { // EDTV PAL : mode not in BIOS < 2.20
+	                                                    // no worries... we work in magic ;-)
+		/* 720x576p */
+		asm ("di");
+		asm ("sync.l; sync.p");
+		GS_PMODE = 0;
+		asm ("sync.l; sync.p");
+		GS_SMODE1 = 0x1742890504;
+		asm ("sync.l; sync.p");
+		GS_SMODE2 = 0;
+		GS_SYNCH1 = 0x402E02003C827;
+		asm ("sync.l; sync.p");
+		GS_SYNCH2 = 0x19CA67;
+		asm ("sync.l; sync.p");
+		GS_SYNCV = 0xA9000002700005;
+		asm ("sync.l; sync.p");
+		GS_SRFSH = 4;
+		asm ("sync.l; sync.p");
+		GS_SMODE1 = 0x1742880504;
+		asm ("sync.l; sync.p");
+		asm ("sync.l; sync.p");
+		GS_SMODE2 = 0;
+		asm("ei");
+	}
+	else { // BIOS
+		SetGsCrt(ps2_mode[mode].interlaced, ps2_mode[mode].mode, 0); // ps2_mode[mode].interlaced);
 	}
 
 	asm("di");
 	GS_PMODE = GS_SET_PMODE(1, 0, 1, 1, 0, 255);
 	GS_BGCOLOUR = GS_RGBA(0, 0, 0, 0);
-	GS_DISPLAY1 = GS_SET_DISPLAY(_tvWidth, _tvHeight, dispPosX, dispPosY);
+	GS_DISPLAY1 = GS_SET_DISPLAY_MODE(ps2_mode[mode]);
 	asm("ei");
 
 	_curDrawBuf = 0;
@@ -239,7 +364,7 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode mode) {
 	_dmaPipe->setOrigin(ORIGIN_X, ORIGIN_Y);
 	_dmaPipe->setConfig(1, 0, 1);
 	_dmaPipe->setScissorRect(0, 0, _tvWidth - 1, _tvHeight - 1);
-	_dmaPipe->setDrawBuffer(_frameBufPtr[_curDrawBuf], _tvWidth, GS_PSMCT24, 0);
+	_dmaPipe->setDrawBuffer(_frameBufPtr[_curDrawBuf], _tvPitch, GS_PSMCT24, 0);
 	_dmaPipe->flush();
 
 	_clutChanged = _screenChanged = _overlayChanged = true;
@@ -507,10 +632,10 @@ void Gs2dScreen::updateScreen(void) {
 		WaitSema(g_DmacSema);	// wait for dma transfer, if there's one running
 		WaitSema(g_VblankSema); // wait if there's already an image waiting for vblank
 
-		g_DmacCmd = GS_SET_DISPFB(_frameBufPtr[_curDrawBuf], _tvWidth, GS_PSMCT24); // put it here for dmac/vblank handler
+		g_DmacCmd = GS_SET_DISPFB(_frameBufPtr[_curDrawBuf], _tvPitch, GS_PSMCT24); // put it here for dmac/vblank handler
 		_dmaPipe->flush();
 		_curDrawBuf ^= 1;
-		_dmaPipe->setDrawBuffer(_frameBufPtr[_curDrawBuf], _tvWidth, GS_PSMCT24, 0);
+		_dmaPipe->setDrawBuffer(_frameBufPtr[_curDrawBuf], _tvPitch, GS_PSMCT24, 0);
 	} else
 		_dmaPipe->flush();
 	SignalSema(_screenSema);
@@ -752,10 +877,10 @@ void Gs2dScreen::playAnim(void) {
 
 				drawY += LINE_SPACE;
 			}
-			g_DmacCmd = GS_SET_DISPFB(_frameBufPtr[_curDrawBuf], _tvWidth, GS_PSMCT24); // put it here for dmac/vblank handler
+			g_DmacCmd = GS_SET_DISPFB(_frameBufPtr[_curDrawBuf], _tvPitch, GS_PSMCT24); // put it here for dmac/vblank handler
 			_dmaPipe->flush();
 			_curDrawBuf ^= 1;
-			_dmaPipe->setDrawBuffer(_frameBufPtr[_curDrawBuf], _tvWidth, GS_PSMCT24, 0);
+			_dmaPipe->setDrawBuffer(_frameBufPtr[_curDrawBuf], _tvPitch, GS_PSMCT24, 0);
 			_dmaPipe->setAlphaBlend(DEST_COLOR, ZERO_COLOR, SOURCE_ALPHA, SOURCE_COLOR, 0);
 
 			SignalSema(_screenSema);
diff --git a/backends/platform/ps2/Gs2dScreen.h b/backends/platform/ps2/Gs2dScreen.h
index ce65387..258ced6 100644
--- a/backends/platform/ps2/Gs2dScreen.h
+++ b/backends/platform/ps2/Gs2dScreen.h
@@ -25,6 +25,7 @@
 
 #include "sysdefs.h"
 #include "backends/base-backend.h"
+#include "common/config-manager.h"
 
 #include "backends/platform/ps2/DmaPipe.h"
 #include "graphics/surface.h"
@@ -32,7 +33,9 @@
 enum TVMode {
 	TV_DONT_CARE = 0,
 	TV_PAL,
-	TV_NTSC
+	TV_NTSC,
+	TV_HDTV, /* internal */
+	TV_VESA  /* internal */
 };
 
 enum GsInterlace {
@@ -42,7 +45,7 @@ enum GsInterlace {
 
 class Gs2dScreen {
 public:
-	Gs2dScreen(uint16 width, uint16 height, TVMode mode);
+	Gs2dScreen(uint16 width, uint16 height);
 	~Gs2dScreen(void);
 	void newScreenSize(uint16 width, uint16 height);
 	// uint8 tvMode(void);
@@ -85,8 +88,10 @@ private:
 	void createAnimTextures(void);
 
 	DmaPipe *_dmaPipe;
+	uint8 _gfxMode;
 	uint8 _tvMode;
 	uint16 _tvWidth, _tvHeight;
+	uint16 _tvPitch;
 	GsVertex _blitCoords[2];
 	TexVertex _texCoords[2];
 
diff --git a/backends/platform/ps2/GsDefs.h b/backends/platform/ps2/GsDefs.h
index 4da08ae..e5174d3 100644
--- a/backends/platform/ps2/GsDefs.h
+++ b/backends/platform/ps2/GsDefs.h
@@ -35,6 +35,13 @@
 #define GS_DISPLAY1      *((volatile uint64 *)0x12000080)
 #define GS_BGCOLOUR      *((volatile uint64 *)0x120000E0)
 
+#define GS_SMODE1        *((volatile uint64 *)0x12000010)
+#define GS_SMODE2        *((volatile uint64 *)0x12000020)
+#define GS_SYNCH1        *((volatile uint64 *)0x12000040)
+#define GS_SYNCH2        *((volatile uint64 *)0x12000050)
+#define GS_SYNCV         *((volatile uint64 *)0x12000060)
+#define GS_SRFSH         *((volatile uint64 *)0x12000030)
+
 enum GS_CSR_FIELDS {
 	CSR_SIGNAL = 1 << 0,
 	CSR_FINISH = 1 << 1,
@@ -44,6 +51,19 @@ enum GS_CSR_FIELDS {
 	CSR_RESET  = 1 << 9
 };
 
+typedef struct {
+	u16 w;
+	u16 h;
+	u16 interlaced;
+	u16 pitch;
+	u16 mode;
+	u16 vclk;
+	u16 magh;
+	u16 magv;
+	u16 dx;
+	u16 dy;
+} ps2_mode_t;
+
 #define GS_SET_PMODE(readC1, readC2, alphaSel, alphaOut, alphaBlend, alphaFixed) \
 	((readC1) | ((readC2) << 1) | ((alphaSel) << 5) | ((alphaOut) << 6) | ((alphaBlend) << 7) | ((alphaFixed) << 8))
 
@@ -52,6 +72,10 @@ enum GS_CSR_FIELDS {
 	((((2560 + (width - 1)) / width) - 1)<<23) | \
 	(ypos << 12) | (xpos * (2560 / width)))
 
+#define GS_SET_DISPLAY_MODE(mode) \
+	(((uint64)(mode.h - 1) << 44) | ((uint64)(mode.vclk - 1) << 32) | \
+	((mode.magh - 1) << 23) | (mode.dy << 12) | (mode.dx << 2))
+
 #define GS_SET_DISPFB(frameBufPtr, frameBufWidth, psm) \
 	(((frameBufPtr) / 8192) | (((frameBufWidth) / 64) << 9) | ((psm) << 15))
 
diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index c301ec8..ed1c437 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -323,11 +323,11 @@ OSystem_PS2::OSystem_PS2(const char *elfPath) {
 	_screenChangeCount = 0;
 	_mouseVisible = false;
 
-	_screen = new Gs2dScreen(320, 200, TV_DONT_CARE);
+	// _screen = new Gs2dScreen(320, 200, TV_DONT_CARE); // moved to ::initSize
 
 	sioprintf("Initializing system...\n");
 
-	_screen->wantAnim(true);
+	// _screen->wantAnim(true);
 
 	_bootPath = (char *)malloc(128);
 	_bootDevice = detectBootPath(elfPath, _bootPath);
@@ -382,8 +382,8 @@ void OSystem_PS2::init(void) {
 	prepMC();
 	makeConfigPath();
 
-	_screen->wantAnim(false);
-	fillScreen(0);
+	// _screen->wantAnim(false);
+	// fillScreen(0);
 }
 
 void OSystem_PS2::config(void) {
@@ -633,6 +633,8 @@ void OSystem_PS2::initSize(uint width, uint height, const Graphics::PixelFormat
 	/* ugly hack: we know we can parse ScummVM.ini now */
 	if (!_screenChangeCount) { // first round
 		config();
+		_screen = new Gs2dScreen(width, height);
+		fillScreen(0);
 	}
 
 	_screen->newScreenSize(width, height);


Commit: 27735638c200b9b91dd44b9ed45fd16508cefb4f
    https://github.com/scummvm/scummvm/commit/27735638c200b9b91dd44b9ed45fd16508cefb4f
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-18T13:49:30-05:00

Commit Message:
PS2: ps2pad.cpp - fixed duplicate switch case

Changed paths:
    backends/platform/ps2/ps2pad.cpp



diff --git a/backends/platform/ps2/ps2pad.cpp b/backends/platform/ps2/ps2pad.cpp
index 22c3f42..65f3c8c 100644
--- a/backends/platform/ps2/ps2pad.cpp
+++ b/backends/platform/ps2/ps2pad.cpp
@@ -51,9 +51,6 @@ void Ps2Pad::initPad(void) {
 	} else {
 		if (checkPadReady(_port, _slot)) {
 			switch (_padStatus) {
-				case STAT_NONE:
-					printf("Pad Status is None. Shouldn't happen\n");
-					break;
 				case STAT_OPEN:
 					_padStatus = STAT_DETECT;
 					break;


Commit: 066c2825a6233d8c435f77471856ecf94d2f6047
    https://github.com/scummvm/scummvm/commit/066c2825a6233d8c435f77471856ecf94d2f6047
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-18T13:49:45-05:00

Commit Message:
PS2: converted malloc(x) -> memalign(64, x)

Changed paths:
    backends/platform/ps2/Gs2dScreen.cpp
    backends/platform/ps2/icon.cpp
    backends/platform/ps2/irxboot.cpp
    backends/platform/ps2/systemps2.cpp



diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp
index c1d6b6e..d478805 100644
--- a/backends/platform/ps2/Gs2dScreen.cpp
+++ b/backends/platform/ps2/Gs2dScreen.cpp
@@ -378,7 +378,7 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height) {
 	ee_thread_t animThread, thisThread;
 	ReferThreadStatus(GetThreadId(), &thisThread);
 
-	_animStack = malloc(ANIM_STACK_SIZE);
+	_animStack = memalign(64, ANIM_STACK_SIZE);
 	animThread.initial_priority = thisThread.current_priority - 3;
 	animThread.stack      = _animStack;
 	animThread.stack_size = ANIM_STACK_SIZE;
diff --git a/backends/platform/ps2/icon.cpp b/backends/platform/ps2/icon.cpp
index bda4843..22c5462 100644
--- a/backends/platform/ps2/icon.cpp
+++ b/backends/platform/ps2/icon.cpp
@@ -937,7 +937,7 @@ uint16 PS2Icon::decompressData(uint16 **data) {
 	uint16 inPos = 1;
 	const uint16 *rleData = (const uint16 *)_rleIcoData;
 	uint16 resSize = rleData[0];
-	uint16 *resData = (uint16 *)malloc(resSize * sizeof(uint16));
+	uint16 *resData = (uint16 *)memalign(64, resSize * sizeof(uint16));
 	uint16 outPos = 0;
 
 	while (outPos < resSize) {
diff --git a/backends/platform/ps2/irxboot.cpp b/backends/platform/ps2/irxboot.cpp
index ee52687..dcdf404 100644
--- a/backends/platform/ps2/irxboot.cpp
+++ b/backends/platform/ps2/irxboot.cpp
@@ -150,7 +150,7 @@ int loadIrxModules(int device, const char *irxPath, IrxReference **modules, IrxT
 
 	irxFiles = irxType[type];
 	numFiles = numIrx[type];
-	resModules = (IrxReference *)malloc(numFiles * sizeof(IrxReference));
+	resModules = (IrxReference *)memalign(64, numFiles * sizeof(IrxReference));
 	curModule = resModules;	
 
 	for (int i = 0; i < numFiles; i++) {
@@ -160,7 +160,7 @@ int loadIrxModules(int device, const char *irxPath, IrxReference **modules, IrxT
 
 		if ((irxFiles[i].flags & TYPEMASK) == BIOS) {
 			curModule->loc = IRX_FILE;
-			curModule->path = (char *)malloc(32);
+			curModule->path = (char *)memalign(64, 32);
 			sprintf(curModule->path, "rom0:%s", irxFiles[i].name);
 			curModule->buffer = NULL;
 			curModule->size = 0;
@@ -169,7 +169,7 @@ int loadIrxModules(int device, const char *irxPath, IrxReference **modules, IrxT
 			curModule->errorCode = 0;
 		} else {
 			curModule->loc = IRX_BUFFER;
-			curModule->path = (char *)malloc(256);
+			curModule->path = (char *)memalign(64, 256);
 
 			sprintf(curModule->path, "%s%s%s", irxPath, irxFiles[i].name, (device == CD_DEV) ? ";1" : "");
 			int fd = fioOpen(curModule->path, O_RDONLY);
diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index ed1c437..e19aa46 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -329,7 +329,7 @@ OSystem_PS2::OSystem_PS2(const char *elfPath) {
 
 	// _screen->wantAnim(true);
 
-	_bootPath = (char *)malloc(128);
+	_bootPath = (char *)memalign(64, 128);
 	_bootDevice = detectBootPath(elfPath, _bootPath);
 
 	if (_bootDevice != HOST_DEV) {
@@ -456,8 +456,8 @@ void OSystem_PS2::initTimer(void) {
 	ee_thread_t timerThread, soundThread, thisThread;
 	ReferThreadStatus(GetThreadId(), &thisThread);
 
-	_timerStack = (uint8 *)malloc(TIMER_STACK_SIZE);
-	_soundStack = (uint8 *)malloc(SOUND_STACK_SIZE);
+	_timerStack = (uint8 *)memalign(64, TIMER_STACK_SIZE);
+	_soundStack = (uint8 *)memalign(64, SOUND_STACK_SIZE);
 
 	// give timer thread a higher priority than main thread
 	timerThread.initial_priority = thisThread.current_priority - 1;
@@ -1030,7 +1030,7 @@ void OSystem_PS2::makeConfigPath() {
 			src = ps2_fopen("cdfs:ScummVM.ini", "r");
 			if (src) {
 				size = ((Ps2File *)src)->size();
-				buf = (char *)malloc(size);
+				buf = (char *)memalign(64, size);
 				ps2_fread(buf, size, 1, src);
 				ps2_fclose(src);
 


Commit: 61aaf9bafbc86fa26ab377815c62cdcd3332a925
    https://github.com/scummvm/scummvm/commit/61aaf9bafbc86fa26ab377815c62cdcd3332a925
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-18T13:50:09-05:00

Commit Message:
PS2: reverted createPixelFormat to _overlayFormat

     <1555> alpha is otherwise broken with classic theme

Changed paths:
    backends/platform/ps2/Gs2dScreen.cpp



diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp
index d478805..e2bda3c 100644
--- a/backends/platform/ps2/Gs2dScreen.cpp
+++ b/backends/platform/ps2/Gs2dScreen.cpp
@@ -311,12 +311,12 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height) {
 	_overlayFormat.rLoss = 3;
 	_overlayFormat.gLoss = 3;
 	_overlayFormat.bLoss = 3;
-	_overlayFormat.aLoss = 7; // 8
+	_overlayFormat.aLoss = 8; // 7
 
 	_overlayFormat.rShift = 0;
 	_overlayFormat.gShift = 5;
 	_overlayFormat.bShift = 10;
-	_overlayFormat.aShift = 15; // 0
+	_overlayFormat.aShift = 0; // 15
 
 	// setup hardware now.
 	GS_CSR = CSR_RESET; // Reset GS
@@ -652,8 +652,8 @@ void Gs2dScreen::hideOverlay(void) {
 }
 
 Graphics::PixelFormat Gs2dScreen::getOverlayFormat(void) {
-	// return _overlayFormat;
-	return Graphics::createPixelFormat<1555>();
+	return _overlayFormat;
+	// return Graphics::createPixelFormat<1555>();
 }
 
 int16 Gs2dScreen::getOverlayWidth(void) {


Commit: d211d579a2666f39e9af79b2f4d39e289167e948
    https://github.com/scummvm/scummvm/commit/d211d579a2666f39e9af79b2f4d39e289167e948
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-18T13:50:19-05:00

Commit Message:
PS2: do not assume _tvMode and _gfxMode are init 0

Changed paths:
    backends/platform/ps2/Gs2dScreen.cpp



diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp
index e2bda3c..4d4143e 100644
--- a/backends/platform/ps2/Gs2dScreen.cpp
+++ b/backends/platform/ps2/Gs2dScreen.cpp
@@ -164,6 +164,9 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height) {
 	EnableIntc(INT_VBLANK_END);
 	EnableDmac(2);
 
+	_tvMode = 0; // force detection
+	_gfxMode = 0;
+
 	_width = width;
 	_height = height;
 	_pitch = (width + 127) & ~127;


Commit: 001e3f76587cc52817db87a232c955aca281d5b9
    https://github.com/scummvm/scummvm/commit/001e3f76587cc52817db87a232c955aca281d5b9
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-19T00:51:02-05:00

Commit Message:
PS2: modified sword25 loslib.cpp to support PS2

Changed paths:
    engines/sword25/util/lua/loslib.cpp



diff --git a/engines/sword25/util/lua/loslib.cpp b/engines/sword25/util/lua/loslib.cpp
index 25bfa2d..055dfdf 100644
--- a/engines/sword25/util/lua/loslib.cpp
+++ b/engines/sword25/util/lua/loslib.cpp
@@ -113,6 +113,9 @@ static int getfield (lua_State *L, const char *key, int d) {
 
 
 static int os_date (lua_State *L) {
+  #ifdef __PLAYSTATION2__ // missing: gmtime & strftime
+  lua_pushnil(L);
+  #else
   const char *s = luaL_optstring(L, 1, "%c");
   // FIXME: Rewrite the code below to use OSystem::getTimeAndDate
   // Alternatively, remove it, if sword25 does not use it.
@@ -160,6 +163,7 @@ static int os_date (lua_State *L) {
     }
     luaL_pushresult(&b);
   }
+  #endif
   return 1;
 }
 
@@ -167,6 +171,9 @@ static int os_date (lua_State *L) {
 static int os_time (lua_State *L) {
   // FIXME: Rewrite the code below to use OSystem::getTimeAndDate.
   // Alternatively, remove it, if sword25 does not use it.
+  #ifdef __PLAYSTATION2__ // missing: mktime
+  lua_pushnil(L);
+  #else
   time_t t;
   if (lua_isnoneornil(L, 1))  /* called without args? */
     t = time(NULL);  /* get current time */
@@ -187,6 +194,7 @@ static int os_time (lua_State *L) {
     lua_pushnil(L);
   else
     lua_pushnumber(L, (lua_Number)t);
+  #endif
   return 1;
 }
 
@@ -195,8 +203,10 @@ static int os_difftime (lua_State *L) {
   // FIXME: difftime is not portable, unfortunately.
   // So we either have to replace this code, or just remove it,
   // depending on whether sword25 actually uses it.
+  #ifndef __PLAYSTATION2__ // missing: difftime
   lua_pushnumber(L, difftime((time_t)(luaL_checknumber(L, 1)),
                              (time_t)(luaL_optnumber(L, 2, 0))));
+  #endif
   return 1;
 }
 


Commit: 90d1e99968c6f997a9b5a8a66e4f11901d4484bf
    https://github.com/scummvm/scummvm/commit/90d1e99968c6f997a9b5a8a66e4f11901d4484bf
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-19T01:45:21-05:00

Commit Message:
PS2: added missing default engines to Makefile.ps2

Changed paths:
    backends/platform/ps2/Makefile.ps2



diff --git a/backends/platform/ps2/Makefile.ps2 b/backends/platform/ps2/Makefile.ps2
index f1a99b3..364f93e 100644
--- a/backends/platform/ps2/Makefile.ps2
+++ b/backends/platform/ps2/Makefile.ps2
@@ -4,41 +4,64 @@
 # Use only this section to modify how the makefile behaves ------------
 
 # Scummvm engine config: choose which engines are enabled
-ENABLE_SCUMM = $(ENABLED)
-ENABLE_SCUMM_7_8 = $(ENABLED)
-ENABLE_HE = $(ENABLED)
 ENABLE_AGI = $(ENABLED)
 ENABLE_AGOS = $(ENABLED)
-ENABLE_AGOS2 = $(ENABLED)
+ENABLE_AGOS2 = 1 
+# ENABLE_AVALANCHE = $(ENABLED)
+ENABLE_CGE = $(ENABLED)
 ENABLE_CINE = $(ENABLED)
+ENABLE_COMPOSER = $(ENABLED)
 ENABLE_CRUISE = $(ENABLED)
 ENABLE_DRACI = $(ENABLED)
 ENABLE_DRASCULA = $(ENABLED)
+ENABLE_DREAMWEB = $(ENABLED)
+# ENABLE_FULLPIPE = $(ENABLED)
 ENABLE_GOB = $(ENABLED)
 ENABLE_GROOVIE = $(ENABLED)
-ENABLE_GROOVIE2 = $(ENABLED)
-ENABLE_IHNM = $(ENABLED)
+# ENABLE_GROOVIE2 = $(ENABLED)
+# ENABLE_HOPKINS = $(ENABLED)
+ENABLE_HUGO = $(ENABLED)
 ENABLE_KYRA = $(ENABLED)
-ENABLE_LOL = $(ENABLED)
+ENABLE_LOL = 1
+ENABLE_EOB = 1
+# ENABLE_LASTEXPRESS = $(ENABLED)
 ENABLE_LURE = $(ENABLED)
-ENABLE_M4 = $(ENABLED)
 ENABLE_MADE = $(ENABLED)
+ENABLE_MOHAWK = $(ENABLED)
+# ENABLE_CSTIME = $(ENABLED)
+# ENABLE_RIVEN = $(ENABLED)
+# ENABLE_MYST = $(ENABLED)
+ENABLE_MORTEVIELLE = $(ENABLED)
+ENABLE_NEVERHOOD = $(ENABLED)
 ENABLE_PARALLACTION = $(ENABLED)
+# ENABLE_PEGASUS = $(ENABLED)
 ENABLE_QUEEN = $(ENABLED)
 ENABLE_SAGA = $(ENABLED)
-ENABLE_SAGA2 = $(ENABLED)
+ENABLE_IHNM = 1
+# ENABLE_SAGA2 = $(ENABLED)
 ENABLE_SCI = $(ENABLED)
-ENABLE_SCI32 = $(ENABLED)
+# ENABLE_SCI32 = $(ENABLED)
+ENABLE_SCUMM = $(ENABLED)
+ENABLE_SCUMM_7_8 = 1
+ENABLE_HE = 1
 ENABLE_SKY = $(ENABLED)
 ENABLE_SWORD1 = $(ENABLED)
 ENABLE_SWORD2 = $(ENABLED)
+# ENABLE_SWORD25 = $(ENABLED)
 ENABLE_TEENAGENT = $(ENABLED)
+# ENABLE_TESTBED = $(ENABLED)
 ENABLE_TINSEL = $(ENABLED)
+ENABLE_TOLTECS = $(ENABLED)
+# ENABLE_TONY = $(ENABLED)
+ENABLE_TOON = $(ENABLED)
 ENABLE_TOUCHE = $(ENABLED)
+ENABLE_TSAGE = $(ENABLED)
 ENABLE_TUCKER = $(ENABLED)
+# ENABLE_WINTERMUTE = $(ENABLED)
+# ENABLE_ZVISION = $(ENABLED)
 
 # Set to 1 to enable seeing the commands to gcc
-VERBOSE_BUILD=0
+VERBOSE_BUILD = 0
 # Set to 1 to enable, 0 to disable dynamic modules
 DYNAMIC_MODULES = 1
 # Set to 1 to enable debugging


Commit: b69a2c81a7b0ed535e23e91928bc8ba193db744a
    https://github.com/scummvm/scummvm/commit/b69a2c81a7b0ed535e23e91928bc8ba193db744a
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-19T12:53:55-05:00

Commit Message:
PS2: scummsys.h (u)int64 is "long" for PS2

Changed paths:
    common/scummsys.h



diff --git a/common/scummsys.h b/common/scummsys.h
index 48dffc5..56cd42d 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -405,8 +405,13 @@
 	typedef unsigned int uint32;
 	typedef signed int int32;
 	typedef unsigned int uint;
+	#ifdef __PLAYSTATION2__
+	typedef signed long int64;
+	typedef unsigned long uint64;
+	#else
 	typedef signed long long int64;
 	typedef unsigned long long uint64;
+	#endif
 #endif
 
 


Commit: 4ccdb3e2a30ead1fa015437306b046b69b69035b
    https://github.com/scummvm/scummvm/commit/4ccdb3e2a30ead1fa015437306b046b69b69035b
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-23T18:33:15-05:00

Commit Message:
Merge branch 'master' of git://github.com/scummvm/scummvm

Changed paths:
  A engines/fullpipe/scenes/scene38.cpp
  A engines/fullpipe/scenes/sceneFinal.cpp
    Makefile
    backends/fs/amigaos4/amigaos4-fs.cpp
    backends/fs/amigaos4/amigaos4-fs.h
    backends/fs/wii/wii-fs-factory.cpp
    backends/fs/wii/wii-fs.cpp
    backends/fs/wii/wii-fs.h
    backends/graphics/graphics.h
    backends/graphics/opengl/debug.cpp
    backends/graphics/opengl/opengl-graphics.h
    backends/graphics/openglsdl/openglsdl-graphics.cpp
    backends/graphics/sdl/sdl-graphics.cpp
    backends/graphics/sdl/sdl-graphics.h
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp
    backends/graphics/surfacesdl/surfacesdl-graphics.h
    backends/platform/android/gfx.cpp
    backends/platform/android/texture.cpp
    backends/platform/android/texture.h
    backends/platform/sdl/posix/posix.cpp
    backends/platform/sdl/sdl.cpp
    backends/platform/wii/main.cpp
    backends/platform/wii/osystem_events.cpp
    backends/platform/wii/wii.mk
    backends/taskbar/unity/unity-taskbar.cpp
    backends/taskbar/unity/unity-taskbar.h
    base/main.cpp
    configure
    devtools/create_project/config.h
    engines/agos/agos.h
    engines/agos/animation.cpp
    engines/agos/detection.cpp
    engines/agos/res.cpp
    engines/agos/res_snd.cpp
    engines/agos/saveload.cpp
    engines/agos/subroutine.cpp
    engines/avalanche/avalanche.cpp
    engines/avalanche/avalanche.h
    engines/avalanche/avalot.cpp
    engines/avalanche/avalot.h
    engines/avalanche/dialogs.cpp
    engines/avalanche/dialogs.h
    engines/avalanche/graphics.h
    engines/engine.cpp
    engines/engine.h
    engines/fullpipe/constants.h
    engines/fullpipe/fullpipe.h
    engines/fullpipe/lift.cpp
    engines/fullpipe/modal.h
    engines/fullpipe/module.mk
    engines/fullpipe/scenes.cpp
    engines/fullpipe/scenes.h
    engines/tinsel/tinsel.cpp
    engines/tinsel/tinsel.h
    engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
    engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
    engines/wintermute/configure.engine
    engines/wintermute/graphics/transparent_surface.cpp
    engines/wintermute/video/video_theora_player.cpp





Commit: 487e642d00e3282a83e7510d356ff684f0c1aa51
    https://github.com/scummvm/scummvm/commit/487e642d00e3282a83e7510d356ff684f0c1aa51
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-23T18:34:26-05:00

Commit Message:
PS2: Support for latest SDK with -D__NEW_PS2SDK__

Changed paths:
    backends/platform/ps2/Gs2dScreen.cpp
    backends/platform/ps2/Makefile.ps2
    backends/platform/ps2/systemps2.cpp



diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp
index 4d4143e..8015eab 100644
--- a/backends/platform/ps2/Gs2dScreen.cpp
+++ b/backends/platform/ps2/Gs2dScreen.cpp
@@ -378,7 +378,12 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height) {
 	createAnimTextures();
 
 	// create animation thread
+	#ifdef __NEW_PS2SDK__
+	ee_thread_t animThread;
+	ee_thread_status_t thisThread;
+	#else
 	ee_thread_t animThread, thisThread;
+	#endif
 	ReferThreadStatus(GetThreadId(), &thisThread);
 
 	_animStack = memalign(64, ANIM_STACK_SIZE);
@@ -395,7 +400,11 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height) {
 
 void Gs2dScreen::quit(void) {
 	_systemQuit = true;
+	#ifdef __NEW_PS2SDK__
+	ee_thread_status_t statAnim;
+	#else
 	ee_thread_t statAnim;
+	#endif
 	do { // wait until thread called ExitThread()
 		SignalSema(g_AnimSema);
 		ReferThreadStatus(_animTid, &statAnim);
diff --git a/backends/platform/ps2/Makefile.ps2 b/backends/platform/ps2/Makefile.ps2
index 364f93e..2ee47c9 100644
--- a/backends/platform/ps2/Makefile.ps2
+++ b/backends/platform/ps2/Makefile.ps2
@@ -98,7 +98,7 @@ FLAGS += -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-unused-paramete
 CFLAGS = $(FLAGS) -std=c99
 CXXFLAGS = $(FLAGS) -Wnon-virtual-dtor -Wno-reorder -fno-exceptions -fno-rtti
 
-DEFINES  = -D_EE -D__PLAYSTATION2__ -DUSE_ZLIB -DFORCE_RTL -DDATA_PATH=\"host:data\"
+DEFINES  = -D_EE -D__PLAYSTATION2__ -D__NEW_PS2SDK__ -DUSE_ZLIB -DFORCE_RTL -DDATA_PATH=\"host:data\"
 DEFINES += -DDISABLE_SAVEGAME_SORTING -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE -DDISABLE_DOSBOX_OPL -DDISABLE_SID -DDISABLE_NES_APU
 
 INCDIR   := $(PS2SDK)/ee/include $(PS2SDK)/common/include $(PS2SDK)/ports/include . $(srcdir) $(srcdir)/engines
diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index e19aa46..80130fc 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -111,7 +111,11 @@ extern "C" int scummvm_main(int argc, char *argv[]);
 
 extern "C" int main(int argc, char *argv[]) {
 	SifInitRpc(0);
+	#ifdef __NEW_PS2SDK__
+	ee_thread_status_t thisThread;
+	#else
 	ee_thread_t thisThread;
+	#endif
 	int tid = GetThreadId();
 	ReferThreadStatus(tid, &thisThread);
 
@@ -452,8 +456,12 @@ void OSystem_PS2::initTimer(void) {
 	g_TimerThreadSema = CreateSema(&threadSema);
 	g_SoundThreadSema = CreateSema(&threadSema);
 	assert((g_TimerThreadSema >= 0) && (g_SoundThreadSema >= 0));
-
+	#ifdef __NEW_PS2SDK__
+	ee_thread_t timerThread, soundThread;
+	ee_thread_status_t thisThread;
+	#else
 	ee_thread_t timerThread, soundThread, thisThread;
+	#endif
 	ReferThreadStatus(GetThreadId(), &thisThread);
 
 	_timerStack = (uint8 *)memalign(64, TIMER_STACK_SIZE);
@@ -885,7 +893,11 @@ void OSystem_PS2::quit(void) {
 		//setTimerCallback(NULL, 0);
 		_screen->wantAnim(false);
 		_systemQuit = true;
+		#ifdef __NEW_PS2SDK__
+		ee_thread_status_t statSound, statTimer;
+		#else
 		ee_thread_t statSound, statTimer;
+		#endif
 		printf("Waiting for timer and sound thread to end\n");
 		do {	// wait until both threads called ExitThread()
 			ReferThreadStatus(_timerTid, &statTimer);


Commit: ab3a1b5e0cfa2090cb0c9df3cf18dfc3fb057bc9
    https://github.com/scummvm/scummvm/commit/ab3a1b5e0cfa2090cb0c9df3cf18dfc3fb057bc9
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-23T18:34:37-05:00

Commit Message:
PS2: commented "offending" free in startIrxModules

TODO: investigate stack corruption due to double free
TODO: review modules loader fallback logic

Changed paths:
    backends/platform/ps2/systemps2.cpp



diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index 80130fc..e800c6c 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -245,13 +245,13 @@ void OSystem_PS2::startIrxModules(int numModules, IrxReference *modules) {
 			}
 
 			if (modules[i].buffer)
-				free(modules[i].buffer);
+				; // free(modules[i].buffer);
 		} else {
 			sioprintf("module %d of %d damaged, loc %d, path %s\n", i, numModules, modules[i].loc, modules[i].path);
 		}
-		free(modules[i].path);
+		// free(modules[i].path);
 	}
-	free(modules);
+	// free(modules);
 	sioprintf("done\n");
 	sioprintf("UsbMass: %sloaded\n", _usbMassLoaded ? "" : "not ");
 	sioprintf("Mouse:   %sloaded\n", _useMouse ? "" : "not ");


Commit: c16c6653a112307d4f5ded3c3533f9621a945cb3
    https://github.com/scummvm/scummvm/commit/c16c6653a112307d4f5ded3c3533f9621a945cb3
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-23T18:34:44-05:00

Commit Message:
PS2: Improved support for profiling (gprof) build

Changed paths:
    backends/platform/ps2/Makefile.ps2
    backends/platform/ps2/fileio.cpp
    backends/platform/ps2/systemps2.cpp



diff --git a/backends/platform/ps2/Makefile.ps2 b/backends/platform/ps2/Makefile.ps2
index 2ee47c9..7b010e8 100644
--- a/backends/platform/ps2/Makefile.ps2
+++ b/backends/platform/ps2/Makefile.ps2
@@ -145,19 +145,19 @@ endif
 
 # Test for debug
 ifeq ($(ENABLE_DEBUG),1)
-FLAGS += -G2 -g
 DEFINES += -D__PS2_DEBUG__
+FLAGS += -G2 -g
 LIBS += -lps2gdbStub -lps2ip -ldebug
 else
-FLAGS += -G2 -O2 -s -Wuninitialized
 DEFINES += -DRELEASE_BUILD
+FLAGS += -G2 -O2 -s -Wuninitialized
 # LDFLAGS += -s
 endif
 
 # Test for profiling
 ifeq ($(ENABLE_PROFILING),1)
 DEFINES += -DENABLE_PROFILING
-CXXFLAGS += -pg -g
+FLAGS += -G2 -pg -g
 LDFLAGS += -pg
 endif
 
diff --git a/backends/platform/ps2/fileio.cpp b/backends/platform/ps2/fileio.cpp
index 1ec16a3..cc1da2e 100644
--- a/backends/platform/ps2/fileio.cpp
+++ b/backends/platform/ps2/fileio.cpp
@@ -409,7 +409,10 @@ uint32 Ps2File::read(void *dest, uint32 len) {
 				break; // EOF
 		}
 	}
+#ifndef ENABLE_PROFILING
+	// doesn't play nice with -pg
 	cacheReadAhead();
+#endif
 #ifdef __PS2_FILE_SEMA__
 	SignalSema(_sema);
 #endif
diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index e800c6c..f3807ea 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -150,6 +150,10 @@ extern "C" int main(int argc, char *argv[]) {
 
 	g_systemPs2->quit();
 
+#ifdef ENABLE_PROFILING
+	// make sure we can flush "gmon.out"
+	fileXioSetBlockMode(FXIO_WAIT);
+#endif
 	// control never gets here
 	return res;
 }
@@ -467,15 +471,25 @@ void OSystem_PS2::initTimer(void) {
 	_timerStack = (uint8 *)memalign(64, TIMER_STACK_SIZE);
 	_soundStack = (uint8 *)memalign(64, SOUND_STACK_SIZE);
 
+	// gprof doesn't cope with higher thread priority too well
+	#ifdef ENABLE_PROFILING
+	timerThread.initial_priority = thisThread.current_priority;
+	#else
 	// give timer thread a higher priority than main thread
 	timerThread.initial_priority = thisThread.current_priority - 1;
+	#endif
 	timerThread.stack            = _timerStack;
 	timerThread.stack_size       = TIMER_STACK_SIZE;
 	timerThread.func             = (void *)systemTimerThread;
 	timerThread.gp_reg           = &_gp;
 
+	// gprof doesn't cope with higher thread priority too well
+	#ifdef ENABLE_PROFILING
+	soundThread.initial_priority = thisThread.current_priority;
+	#else
 	// soundthread's priority is higher than main- and timerthread
 	soundThread.initial_priority = thisThread.current_priority - 2;
+	#endif
 	soundThread.stack            = _soundStack;
 	soundThread.stack_size       = SOUND_STACK_SIZE;
 	soundThread.func             = (void *)systemSoundThread;
@@ -883,7 +897,10 @@ void OSystem_PS2::quit(void) {
 	printf("OSystem_PS2::quit called\n");
 	if (_bootDevice == HOST_DEV) {
 		printf("OSystem_PS2::quit (HOST)\n");
+		#ifndef ENABLE_PROFILING
 		SleepThread();
+		#endif
+		// exit(0);
 	} else {
 		printf("OSystem_PS2::quit (bootdev=%d)\n", _bootDevice);
 		if (_useHdd) {


Commit: 6487c362a1909b10886ee95f4f91109a7808fd33
    https://github.com/scummvm/scummvm/commit/6487c362a1909b10886ee95f4f91109a7808fd33
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-23T18:34:51-05:00

Commit Message:
PS2: Init Ps2Input after USB drivers are loaded

Changed paths:
    backends/platform/ps2/systemps2.cpp



diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index f3807ea..5f3edd3 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -384,9 +384,6 @@ void OSystem_PS2::init(void) {
 	sioprintf("Starting SavefileManager\n");
 	_savefileManager = new Ps2SaveFileManager(this, _screen);
 
-	sioprintf("Initializing ps2Input\n");
-	_input = new Ps2Input(this, _useMouse, _useKbd);
-
 	prepMC();
 	makeConfigPath();
 
@@ -438,11 +435,15 @@ void OSystem_PS2::config(void) {
 		else {
 			loadDrivers(IRX_USB);
 			loadDrivers(IRX_INPUT);
+			sioprintf("Initializing ps2Input\n");
+			_input = new Ps2Input(this, _useMouse, _useKbd);
 		}
 	}
 	else { // load USB drivers (mass & input(
 		loadDrivers(IRX_USB);
 		loadDrivers(IRX_INPUT);
+		sioprintf("Initializing ps2Input\n");
+		_input = new Ps2Input(this, _useMouse, _useKbd);
 	}
 }
 


Commit: 5e36716be5dc55d2fbf0d417b03e065bd09f7946
    https://github.com/scummvm/scummvm/commit/5e36716be5dc55d2fbf0d417b03e065bd09f7946
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-23T18:34:58-05:00

Commit Message:
PS2: Made it quieter unless -DLOGORRHEIC is set

Changed paths:
    backends/fs/ps2/ps2-fs.cpp
    backends/fs/ps2/ps2-fs.h
    backends/platform/ps2/Makefile.ps2
    backends/platform/ps2/asyncfio.h
    backends/platform/ps2/fileio.cpp
    backends/platform/ps2/ps2debug.cpp
    backends/platform/ps2/ps2debug.h
    backends/platform/ps2/savefilemgr.cpp
    backends/platform/ps2/systemps2.cpp



diff --git a/backends/fs/ps2/ps2-fs.cpp b/backends/fs/ps2/ps2-fs.cpp
index 1c35d15..edf7874 100644
--- a/backends/fs/ps2/ps2-fs.cpp
+++ b/backends/fs/ps2/ps2-fs.cpp
@@ -21,9 +21,9 @@
 
 #if defined(__PLAYSTATION2__)
 
-// Disable symbol overrides so that we can use system headers.
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-
+// Disable symbol overrides so that we can use "FILE"
+#define FORBIDDEN_SYMBOL_EXCEPTION_FILE
+#define FORBIDDEN_SYMBOL_EXCEPTION_printf
 
 #include "backends/fs/ps2/ps2-fs.h"
 
@@ -57,13 +57,13 @@ const char *_lastPathComponent(const Common::String &str) {
 
 	cur++;
 
-	// printf("lastPathComponent path=%s token=%s\n", start, cur);
+	// dbg_printf("lastPathComponent path=%s token=%s\n", start, cur);
 
 	return cur;
 }
 
 Ps2FilesystemNode::Ps2FilesystemNode() {
-	printf("NEW FSNODE()\n");
+	dbg_printf("NEW FSNODE()\n");
 
 	_isHere = true;
 	_isDirectory = true;
@@ -74,7 +74,7 @@ Ps2FilesystemNode::Ps2FilesystemNode() {
 }
 
 Ps2FilesystemNode::Ps2FilesystemNode(const Common::String &path) {
-	printf("NEW FSNODE(%s)\n", path.c_str());
+	dbg_printf("NEW FSNODE(%s)\n", path.c_str());
 
 	_path = path;
 
@@ -106,7 +106,7 @@ Ps2FilesystemNode::Ps2FilesystemNode(const Common::String &path) {
 }
 
 Ps2FilesystemNode::Ps2FilesystemNode(const Common::String &path, bool verify) {
-	printf("NEW FSNODE(%s, %d)\n", path.c_str(), verify);
+	dbg_printf("NEW FSNODE(%s, %d)\n", path.c_str(), verify);
 
 	_path = path;
 
@@ -163,24 +163,24 @@ void Ps2FilesystemNode::doverify(void) {
 
 	_verified = true;
 
-	printf(" verify: %s -> ", _path.c_str());
+	dbg_printf(" verify: %s -> ", _path.c_str());
 
 #if 0
 	if (_path.empty()) {
-		printf("PlayStation 2 Root !\n");
+		dbg_printf("PlayStation 2 Root !\n");
 		_verified = true;
 		return;
 	}
 
 	if (_path.lastChar() == ':') {
-		printf("Dev: %s\n", _path.c_str());
+		dbg_printf("Dev: %s\n", _path.c_str());
 		_verified = true;
 		return;
 	}
 #endif
 
 	if (_path[3] != ':' && _path[4] != ':') {
-		printf("relative path !\n");
+		dbg_printf("relative path !\n");
 		_isHere = false;
 		_isDirectory = false;
 		return;
@@ -203,7 +203,7 @@ void Ps2FilesystemNode::doverify(void) {
 		fileXioWaitAsync(FXIO_WAIT, &fd);
 
 		if (!fd) {
-			printf("  yes [stat]\n");
+			dbg_printf("  yes [stat]\n");
 			return true;
 		}
 	break;
@@ -217,11 +217,11 @@ void Ps2FilesystemNode::doverify(void) {
 #if 1
 	fd = fio.open(_path.c_str(), O_RDONLY);
 
-	printf("_path = %s -- fio.open -> %d\n", _path.c_str(), fd);
+	dbg_printf("_path = %s -- fio.open -> %d\n", _path.c_str(), fd);
 
 	if (fd >=0) {
 		fio.close(fd);
-		printf("  yes [open]\n");
+		dbg_printf("  yes [open]\n");
 		_isHere = true;
 		if (medium==MC_DEV && _path.lastChar()=='/')
 			_isDirectory = true;
@@ -233,7 +233,7 @@ void Ps2FilesystemNode::doverify(void) {
 	fd = fio.dopen(_path.c_str());
 	if (fd >=0) {
 		fio.dclose(fd);
-		printf("  yes [dopen]\n");
+		dbg_printf("  yes [dopen]\n");
 		_isHere = true;
 		_isDirectory = true;
 		return;
@@ -266,13 +266,13 @@ void Ps2FilesystemNode::doverify(void) {
 	_isHere = false;
 	_isDirectory = false;
 
-	printf("  no\n");
+	dbg_printf("  no\n");
 	return;
 }
 
 AbstractFSNode *Ps2FilesystemNode::getChild(const Common::String &n) const {
 
-	printf("getChild : %s\n", n.c_str());
+	dbg_printf("getChild : %s\n", n.c_str());
 
 	if (!_isDirectory)
 		return NULL;
@@ -327,7 +327,7 @@ AbstractFSNode *Ps2FilesystemNode::getChild(const Common::String &n) const {
 bool Ps2FilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hidden) const {
 	//TODO: honor the hidden flag
 
-	// printf("getChildren\n");
+	// dbg_printf("getChildren\n");
 
 	if (!_isDirectory)
 		return false;
@@ -357,7 +357,7 @@ bool Ps2FilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hi
 		else
 			fd = fio.dopen(_path.c_str());
 
-		// printf("dopen = %d\n", fd);
+		// dbg_printf("dopen = %d\n", fd);
 
 		if (fd >= 0) {
 			iox_dirent_t dirent;
@@ -399,7 +399,7 @@ bool Ps2FilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hi
 }
 
 AbstractFSNode *Ps2FilesystemNode::getParent() const {
-	// printf("Ps2FilesystemNode::getParent : path = %s\n", _path.c_str());
+	// dbg_printf("Ps2FilesystemNode::getParent : path = %s\n", _path.c_str());
 
 	if (_isRoot)
 		return new Ps2FilesystemNode(this); // FIXME : 0 ???
@@ -411,7 +411,7 @@ AbstractFSNode *Ps2FilesystemNode::getParent() const {
 	const char *end = _lastPathComponent(_path);
 
 	Common::String str(start, end - start);
-	// printf("  parent = %s\n", str.c_str());
+	// dbg_printf("  parent = %s\n", str.c_str());
 
 	return new Ps2FilesystemNode(str, true);
 }
diff --git a/backends/fs/ps2/ps2-fs.h b/backends/fs/ps2/ps2-fs.h
index df78f9f..8573ac2 100644
--- a/backends/fs/ps2/ps2-fs.h
+++ b/backends/fs/ps2/ps2-fs.h
@@ -69,12 +69,12 @@ public:
 	virtual Common::String getPath() const { return _path; }
 
 	virtual bool exists() const {
-		// printf("%s : is %d\n", _path.c_str(), _isHere);
+		// dbg_printf("%s : is %d\n", _path.c_str(), _isHere);
 		return _isHere;
 	}
 
 	virtual bool isDirectory() const {
-		// printf("%s : dir %d\n", _path.c_str(), _isDirectory);
+		// dbg_printf("%s : dir %d\n", _path.c_str(), _isDirectory);
 		return _isDirectory;
 	}
 
diff --git a/backends/platform/ps2/Makefile.ps2 b/backends/platform/ps2/Makefile.ps2
index 7b010e8..3631c65 100644
--- a/backends/platform/ps2/Makefile.ps2
+++ b/backends/platform/ps2/Makefile.ps2
@@ -100,6 +100,7 @@ CXXFLAGS = $(FLAGS) -Wnon-virtual-dtor -Wno-reorder -fno-exceptions -fno-rtti
 
 DEFINES  = -D_EE -D__PLAYSTATION2__ -D__NEW_PS2SDK__ -DUSE_ZLIB -DFORCE_RTL -DDATA_PATH=\"host:data\"
 DEFINES += -DDISABLE_SAVEGAME_SORTING -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE -DDISABLE_DOSBOX_OPL -DDISABLE_SID -DDISABLE_NES_APU
+# DEFINES += -DLOGORRHEIC
 
 INCDIR   := $(PS2SDK)/ee/include $(PS2SDK)/common/include $(PS2SDK)/ports/include . $(srcdir) $(srcdir)/engines
 INCLUDES := $(addprefix -I, $(INCDIR))
diff --git a/backends/platform/ps2/asyncfio.h b/backends/platform/ps2/asyncfio.h
index 31684d4..fbc0005 100644
--- a/backends/platform/ps2/asyncfio.h
+++ b/backends/platform/ps2/asyncfio.h
@@ -23,6 +23,9 @@
 #define MAX_HANDLES 32
 #include <sys/stat.h>
 
+#undef chdir // we define our own
+#undef mkdir
+
 class AsyncFio {
 public:
 	AsyncFio(void);
diff --git a/backends/platform/ps2/fileio.cpp b/backends/platform/ps2/fileio.cpp
index cc1da2e..b204d3f 100644
--- a/backends/platform/ps2/fileio.cpp
+++ b/backends/platform/ps2/fileio.cpp
@@ -20,8 +20,9 @@
  *
  */
 
-// Disable symbol overrides so that we can use system headers.
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
+// Disable symbol overrides so that we can use "FILE"
+#define FORBIDDEN_SYMBOL_EXCEPTION_FILE
+#define FORBIDDEN_SYMBOL_EXCEPTION_printf
 
 #include "backends/platform/ps2/fileio.h"
 
@@ -78,12 +79,12 @@ Ps2File::~Ps2File() {
 			fio.seek(_fd, 0, SEEK_SET);
 			fio.write(_fd, _cacheBuf, _filePos);
 			w = fio.sync(_fd);
-			printf("flushed wbuf: %x of %x\n", w, _filePos);
+			dbg_printf("flushed wbuf: %x of %x\n", w, _filePos);
 		}
 
 		fio.close(_fd);
 		uint32 r = fio.sync(_fd);
-		printf("close [%d] - sync'd = %d\n", _fd, r);
+		dbg_printf("close [%d] - sync'd = %d\n", _fd, r);
 	}
 
 	free(_cacheBuf);
@@ -97,7 +98,7 @@ bool Ps2File::open(const char *name, int mode) {
 #if 1
 	_fd = fio.open(name, mode);
 
-	printf("open %s [%d]\n", name, _fd);
+	dbg_printf("open %s [%d]\n", name, _fd);
 
 	if (_fd >= 0) {
 		_mode = mode;
@@ -110,9 +111,9 @@ bool Ps2File::open(const char *name, int mode) {
 		else
 			_fileSize = 0;
 
-		printf("  _mode = %x\n", _mode);
-		printf("  _fileSize = %d\n", _fileSize);
-		// printf("  _filePos = %d\n", _filePos);
+		dbg_printf("  _mode = %x\n", _mode);
+		dbg_printf("  _fileSize = %d\n", _fileSize);
+		// dbg_printf("  _filePos = %d\n", _filePos);
 
 		return true;
 	}
@@ -130,7 +131,7 @@ bool Ps2File::open(const char *name, int mode) {
 		if (_fileSize && mode != O_RDONLY) {
 			fio.read(_fd, _cacheBuf, _fileSize);
 			r = fio.sync(_fd);
-			printf(" sz=%d, read=%d\n", _fileSize, r);
+			dbg_printf(" sz=%d, read=%d\n", _fileSize, r);
 			assert(r == _fileSize);
 		}
 
@@ -141,7 +142,7 @@ bool Ps2File::open(const char *name, int mode) {
 
 	_fd = fio.open(name, mode);
 
-	printf("open %s [%d]\n", name, _fd);
+	dbg_printf("open %s [%d]\n", name, _fd);
 
 	if (_fd >= 0) {
 		_mode = mode;
@@ -160,16 +161,16 @@ bool Ps2File::open(const char *name, int mode) {
 			if (mode != O_RDONLY) {
 				fio.read(_fd, _cacheBuf, _fileSize);
 				r = fio.sync(_fd);
-				printf(" sz=%d, read=%d\n", _fileSize, r);
+				dbg_printf(" sz=%d, read=%d\n", _fileSize, r);
 				assert(r == _fileSize);
 				// _fileSize = fio.seek(_fd, 0, SEEK_END);
 			}
 			#endif
 		}
 
-		printf("  _mode = %x\n", _mode);
-		printf("  _fileSize = %d\n", _fileSize);
-		printf("  _filePos = %d\n", _filePos);
+		dbg_printf("  _mode = %x\n", _mode);
+		dbg_printf("  _fileSize = %d\n", _fileSize);
+		dbg_printf("  _filePos = %d\n", _filePos);
 
 		return true;
 	} else
@@ -208,7 +209,7 @@ bool Ps2File::eof() {
 #ifdef __PS2_FILE_SEMA__
 	SignalSema(_sema);
 
-	// printf(" EOF [%d] : %d of %d  -> %d\n", _fd, _filePos, _fileSize, res);
+	// dbg_printf(" EOF [%d] : %d of %d  -> %d\n", _fd, _filePos, _fileSize, res);
 #endif
 	return res;
 }
@@ -255,8 +256,8 @@ int Ps2File::seek(int32 offset, int origin) {
 		_eof = true;
 	}
 
-	// printf("seek [%d]  %d  %d\n", _fd, offset, origin);
-	// printf("  res = %d\n", res);
+	// dbg_printf("seek [%d]  %d  %d\n", _fd, offset, origin);
+	// dbg_printf("  res = %d\n", res);
 
 #ifdef __PS2_FILE_SEMA__
 	SignalSema(_sema);
@@ -338,8 +339,8 @@ uint32 Ps2File::read(void *dest, uint32 len) {
 #endif
 
 #ifdef __PS2_FILE_DEBUG__
-	printf("read (1) : _filePos = %d\n", _filePos);
-	printf("read (1) : _cachePos = %d\n", _cachePos);
+	dbg_printf("read (1) : _filePos = %d\n", _filePos);
+	dbg_printf("read (1) : _cachePos = %d\n", _cachePos);
 #endif
 
 	if (len == 0) {
@@ -476,7 +477,7 @@ uint32 PS2FileStream::write(const void *ptr, uint32 len) {
 }
 
 bool PS2FileStream::flush() {
-	// printf("flush not implemented\n");
+	// dbg_printf("flush not implemented\n");
 	return true;
 }
 
@@ -484,7 +485,7 @@ bool PS2FileStream::err() const {
 	bool errVal = _handle->getErr();
 
 	if (errVal) {
-		printf("ferror -> %d\n", errVal);
+		dbg_printf("ferror -> %d\n", errVal);
 	}
 
 	return errVal;
@@ -504,7 +505,7 @@ FILE *ps2_fopen(const char *fname, const char *mode) {
 	Ps2File *file = new Ps2File();
 	int _mode = O_RDONLY;
 
-	printf("fopen(%s, %s)\n", fname, mode);
+	dbg_printf("fopen(%s, %s)\n", fname, mode);
 
 	if (mode[0] == 'r' && mode [1] == 'w')
 		_mode = O_RDWR;
diff --git a/backends/platform/ps2/ps2debug.cpp b/backends/platform/ps2/ps2debug.cpp
index 300e183..3e689f5 100644
--- a/backends/platform/ps2/ps2debug.cpp
+++ b/backends/platform/ps2/ps2debug.cpp
@@ -22,10 +22,10 @@
 
 #include "ps2debug.h"
 #include <stdio.h>
-#include <stdlib.h>
 #include <sio.h>
 
 void sioprintf(const char *zFormat, ...) {
+	#if 0 // doesn't seem to work with ps2link...
 	va_list ap;
 	char resStr[2048];
 
@@ -43,4 +43,5 @@ void sioprintf(const char *zFormat, ...) {
 			sio_putc(*pos);
 		pos++;
 	}
+	#endif
 }
diff --git a/backends/platform/ps2/ps2debug.h b/backends/platform/ps2/ps2debug.h
index 02831e06..1d29274 100644
--- a/backends/platform/ps2/ps2debug.h
+++ b/backends/platform/ps2/ps2debug.h
@@ -23,7 +23,13 @@
 #ifndef __PS2DEBUG_H__
 #define __PS2DEBUG_H__
 
-#define dbg_printf printf
+#ifdef LOGORRHEIC
+  #define FORBIDDEN_SYMBOL_EXCEPTION_printf
+  // #define dbg_printf sio_printf
+  #define dbg_printf printf
+#else
+  #define dbg_printf(...) /* ... */
+#endif
 
 void sioprintf(const char *zFormat, ...);
 
diff --git a/backends/platform/ps2/savefilemgr.cpp b/backends/platform/ps2/savefilemgr.cpp
index 2bd4bcb..e1bb7d1 100644
--- a/backends/platform/ps2/savefilemgr.cpp
+++ b/backends/platform/ps2/savefilemgr.cpp
@@ -21,8 +21,6 @@
  */
 
 #define FORBIDDEN_SYMBOL_EXCEPTION_printf
-#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir
-#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
 
 #include "common/config-manager.h"
 #include "common/zlib.h"
@@ -37,6 +35,7 @@
 #include "savefilemgr.h"
 #include "Gs2dScreen.h"
 #include "ps2temp.h"
+#include "ps2debug.h"
 
 extern AsyncFio fio;
 
@@ -57,20 +56,20 @@ bool Ps2SaveFileManager::mcCheck(const char *path) {
 
 	// int res;
 
-	printf("mcCheck\n");
+	dbg_printf("mcCheck\n");
 
 	if (!dir.exists()) {
-		printf("! exist -> create : ");
+		dbg_printf("! exist -> create : ");
 #ifdef __USE_LIBMC__
-		printf("%s\n", path+4);
+		dbg_printf("%s\n", path+4);
 		// WaitSema(_sema);
 		mcSync(0, NULL, NULL);
 		mcMkDir(0 /*port*/, 0 /*slot*/,	path+4);
 		mcSync(0, NULL, &res);
-		printf("sync : %d\n", res);
+		dbg_printf("sync : %d\n", res);
 		// SignalSema(_sema);
 #else
-		printf("%s\n", path);
+		dbg_printf("%s\n", path);
 		fio.mkdir(path);
 #endif
 	}
@@ -108,7 +107,7 @@ Common::InSaveFile *Ps2SaveFileManager::openForLoading(const Common::String &fil
 		}
 		else {
 			char temp[32];
-			printf("MC : filename = %s\n", filename.c_str());
+			dbg_printf("MC : filename = %s\n", filename.c_str());
 			strcpy(temp, filename.c_str());
 
 			// mcSplit(temp, game, ext);
@@ -149,7 +148,7 @@ Common::OutSaveFile *Ps2SaveFileManager::openForSaving(const Common::String &fil
 	Common::FSNode savePath(ConfMan.get("savepath")); // TODO: is this fast?
 	Common::WriteStream *sf;
 
-	printf("openForSaving : %s\n", filename.c_str());
+	dbg_printf("openForSaving : %s\n", filename.c_str());
 
 	if (!savePath.exists() || !savePath.isDirectory())
 		return NULL;
@@ -240,7 +239,7 @@ Common::StringArray Ps2SaveFileManager::listSavefiles(const Common::String &patt
 	if (!savePath.exists() || !savePath.isDirectory())
 		return Common::StringArray();
 
-	printf("listSavefiles = %s\n", pattern.c_str());
+	dbg_printf("listSavefiles = %s\n", pattern.c_str());
 
 	if (_mc) {
 		strcpy(temp, pattern.c_str());
@@ -263,7 +262,7 @@ Common::StringArray Ps2SaveFileManager::listSavefiles(const Common::String &patt
 	Common::ArchiveMemberList savefiles;
 	Common::StringArray results;
 
-	printf("dir = %s --- reg = %s\n", _dir.c_str(), search.c_str());
+	dbg_printf("dir = %s --- reg = %s\n", _dir.c_str(), search.c_str());
 
 	if (dir.listMatchingMembers(savefiles, search) > 0) {
 		for (Common::ArchiveMemberList::const_iterator file = savefiles.begin(); file != savefiles.end(); ++file) {
@@ -272,11 +271,11 @@ Common::StringArray Ps2SaveFileManager::listSavefiles(const Common::String &patt
 				temp[3] = '\0';
 				sprintf(path, "%s.%s", game, temp);
 				results.push_back(path);
-				printf(" --> found = %s -> %s\n", (*file)->getName().c_str(), path);
+				dbg_printf(" --> found = %s -> %s\n", (*file)->getName().c_str(), path);
 			}
 			else {
 				results.push_back((*file)->getName());
-				printf(" --> found = %s\n", (*file)->getName().c_str());
+				dbg_printf(" --> found = %s\n", (*file)->getName().c_str());
 			}
 		}
 	}
diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index 5f3edd3..cbb1c47 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -20,8 +20,9 @@
  *
  */
 
-// Disable symbol overrides so that we can use system headers.
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
+// Disable symbol overrides so that we can use "FILE"
+#define FORBIDDEN_SYMBOL_EXCEPTION_FILE
+#define FORBIDDEN_SYMBOL_EXCEPTION_printf
 
 #include <kernel.h>
 #include <stdio.h>
@@ -640,18 +641,18 @@ bool OSystem_PS2::hddMount(const char *partition) {
 		strcpy(name+6, partition);
 
 	if (fio.mount("pfs0:", name, 0) >= 0) {
-		printf("Successfully mounted (%s)!\n", name);
+		dbg_printf("Successfully mounted (%s)!\n", name);
 		return true;
 	}
 	else {
-		printf("Failed to mount (%s).\n", name);
+		dbg_printf("Failed to mount (%s).\n", name);
 		_useHdd = false;
 		return false;
 	}
 }
 
 void OSystem_PS2::initSize(uint width, uint height, const Graphics::PixelFormat *format) {
-	printf("initializing new size: (%d/%d)...", width, height);
+	dbg_printf("initializing new size: (%d/%d)...", width, height);
 
 	/* ugly hack: we know we can parse ScummVM.ini now */
 	if (!_screenChangeCount) { // first round
@@ -670,7 +671,7 @@ void OSystem_PS2::initSize(uint width, uint height, const Graphics::PixelFormat
 
 	_modeChanged = true;
 	_screenChangeCount++;
-	printf("done\n");
+	dbg_printf("done\n");
 }
 
 void OSystem_PS2::setPalette(const byte *colors, uint start, uint num) {
@@ -695,7 +696,7 @@ void OSystem_PS2::updateScreen(void) {
 
 void OSystem_PS2::displayMessageOnOSD(const char *msg) {
 	/* TODO : check */
-	printf("displayMessageOnOSD: %s\n", msg);
+	dbg_printf("displayMessageOnOSD: %s\n", msg);
 }
 
 uint32 OSystem_PS2::getMillis(bool skipRecord) {
@@ -895,15 +896,14 @@ void OSystem_PS2::powerOffCallback(void) {
 }
 
 void OSystem_PS2::quit(void) {
-	printf("OSystem_PS2::quit called\n");
+	dbg_printf("OSystem_PS2::quit called\n");
 	if (_bootDevice == HOST_DEV) {
-		printf("OSystem_PS2::quit (HOST)\n");
+		dbg_printf("OSystem_PS2::quit (HOST)\n");
 		#ifndef ENABLE_PROFILING
 		SleepThread();
 		#endif
-		// exit(0);
 	} else {
-		printf("OSystem_PS2::quit (bootdev=%d)\n", _bootDevice);
+		dbg_printf("OSystem_PS2::quit (bootdev=%d)\n", _bootDevice);
 		if (_useHdd) {
 			driveStandby();
 			fio.umount("pfs0:");
@@ -916,17 +916,17 @@ void OSystem_PS2::quit(void) {
 		#else
 		ee_thread_t statSound, statTimer;
 		#endif
-		printf("Waiting for timer and sound thread to end\n");
+		dbg_printf("Waiting for timer and sound thread to end\n");
 		do {	// wait until both threads called ExitThread()
 			ReferThreadStatus(_timerTid, &statTimer);
 			ReferThreadStatus(_soundTid, &statSound);
 		} while ((statSound.status != 0x10) || (statTimer.status != 0x10));
-		printf("Done\n");
+		dbg_printf("Done\n");
 		DeleteThread(_timerTid);
 		DeleteThread(_soundTid);
 		free(_timerStack);
 		free(_soundStack);
-		printf("Stopping timer\n");
+		dbg_printf("Stopping timer\n");
 		DisableIntc(INT_TIMER0);
 		RemoveIntcHandler(INT_TIMER0, _intrId);
 
@@ -935,7 +935,7 @@ void OSystem_PS2::quit(void) {
 
 		padEnd(); // stop pad library
 		cdvdInit(CDVD_EXIT);
-		printf("resetting iop\n");
+		dbg_printf("resetting iop\n");
 		SifIopReset(NULL, 0);
 		SifExitRpc();
 		while (!SifIopSync());
@@ -973,7 +973,7 @@ void OSystem_PS2::quit(void) {
 */
 		#else
 		// reset + load ELF from CD
-		printf("Restarting ScummVM\n");
+		dbg_printf("Restarting ScummVM\n");
 		LoadExecPS2("cdrom0:\\SCUMMVM.ELF", 0, NULL);
 		#endif
 	}
@@ -990,12 +990,12 @@ bool OSystem_PS2::prepMC() {
 	if (!mcPresent())
 		return prep;
 
-	printf("prepMC 0\n");
+	dbg_printf("prepMC 0\n");
 	// Common::String str("mc0:ScummVM/")
 	// Common::FSNode scumDir(str);
 	Common::FSNode scumDir("mc0:ScummVM/");
 
-	printf("prepMC 00\n");
+	dbg_printf("prepMC 00\n");
 
 	if (!scumDir.exists()) {
 		uint16 *data, size;
@@ -1003,11 +1003,11 @@ bool OSystem_PS2::prepMC() {
 		PS2Icon _ico;
 		mcIcon icon;
 
-		printf("prepMC I\n");
+		dbg_printf("prepMC I\n");
 
 		size = _ico.decompressData(&data);
 
-		printf("prepMC II\n");
+		dbg_printf("prepMC II\n");
 
 		_ico.setup(&icon);
 
@@ -1022,21 +1022,21 @@ bool OSystem_PS2::prepMC() {
 		fio.mkdir("mc0:ScummVM");
 		f = ps2_fopen("mc0:ScummVM/scummvm.icn", "w");
 
-		printf("f = %p\n", (const void *)f);
+		dbg_printf("f = %p\n", (const void *)f);
 
 		ps2_fwrite(data, size, 2, f);
 		ps2_fclose(f);
 
 		f = ps2_fopen("mc0:ScummVM/icon.sys", "w");
 
-		printf("f = %p\n", (const void *)f);
+		dbg_printf("f = %p\n", (const void *)f);
 
 		ps2_fwrite(&icon, sizeof(icon), 1, f);
 		ps2_fclose(f);
 #endif
 		free(data);
 
-		printf("prepMC II\n");
+		dbg_printf("prepMC II\n");
 
 		prep = true;
 	}
@@ -1104,6 +1104,5 @@ Common::String OSystem_PS2::getDefaultConfigFileName() {
 }
 
 void OSystem_PS2::logMessage(LogMessageType::Type type, const char *message) {
-	printf("%s", message);
-	sioprintf("%s", message);
+	dbg_printf("%s", message);
 }


Commit: 0f264e2d739977629c146724658ad60f7fa55044
    https://github.com/scummvm/scummvm/commit/0f264e2d739977629c146724658ad60f7fa55044
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-23T18:35:09-05:00

Commit Message:
PS2: Added compact Makefile.ps2.dev for debug

Changed paths:
  A backends/platform/ps2/Makefile.ps2.dev



diff --git a/backends/platform/ps2/Makefile.ps2.dev b/backends/platform/ps2/Makefile.ps2.dev
new file mode 100644
index 0000000..cd9432e
--- /dev/null
+++ b/backends/platform/ps2/Makefile.ps2.dev
@@ -0,0 +1,170 @@
+# SCUMMVM-PS2 MakeFile
+
+
+# Use only this section to modify how the makefile behaves ------------
+
+# Scummvm engine config: choose which engines are enabled
+ENABLE_SCUMM = $(ENABLED)
+ENABLE_SCUMM_7_8 = 1
+# ENABLE_HE = 1
+ENABLE_SCI = $(ENABLED)
+# ENABLE_SCI32 = $(ENABLED)
+# ENABLE_SKY = $(ENABLED)
+# ENABLE_SWORD1 = $(ENABLED)
+# ENABLE_SWORD2 = $(ENABLED)
+
+# Set to 1 to enable seeing the commands to gcc
+VERBOSE_BUILD = 1
+# Set to 1 to enable, 0 to disable dynamic modules
+DYNAMIC_MODULES = 0
+# Set to 1 to enable debugging
+ENABLE_DEBUG = 0
+# Set to 1 to enable profiling
+ENABLE_PROFILING = 1
+# Set to 1 to disable HDD+NET
+DISABLE_NETWORK = 0
+# Set to 1 to enable, 0 to disable libmad and libogg
+USE_LIBMAD = 1
+USE_LIBOGG = 1
+
+# ---------------------------------------------------------------------
+
+
+# General variables
+srcdir = ../../..
+VPATH = $(srcdir)
+TARGET = scummvm.elf
+# PS2 SDK location variables
+# PS2SDK = /works/tools/devel/ps2/sdk
+
+# Check PS2SDK presence
+ifeq ($(PS2SDK),)
+$(error $$(PS2SDK) needs to be set.)
+endif
+
+# Variables for common Scummvm makefile
+CC     = ee-gcc
+CXX    = ee-g++
+FLAGS  = -pedantic -Wall -W
+FLAGS += -Wcast-qual -Wconversion -Wpointer-arith -Wshadow -Wwrite-strings
+FLAGS += -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-unused-parameter
+CFLAGS = $(FLAGS) -std=c99
+CXXFLAGS = $(FLAGS) -Wnon-virtual-dtor -Wno-reorder -fno-exceptions -fno-rtti
+
+DEFINES  = -D_EE -D__PLAYSTATION2__ -D__NEW_PS2SDK__ -DUSE_ZLIB -DFORCE_RTL -DDATA_PATH=\"host:data\"
+DEFINES += -DDISABLE_SAVEGAME_SORTING -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE -DDISABLE_DOSBOX_OPL -DDISABLE_SID -DDISABLE_NES_APU
+# DEFINES += -DLOGORRHEIC
+
+INCDIR   := $(PS2SDK)/ee/include $(PS2SDK)/common/include $(PS2SDK)/ports/include . $(srcdir) $(srcdir)/engines
+INCLUDES := $(addprefix -I, $(INCDIR))
+DEPDIR = .deps
+MODULE_DIRS += ./
+MKDIR	= mkdir -p
+RM	= rm -f
+RM_REC	= rm -rf
+AR      = ee-ar cru
+RANLIB  = ee-ranlib
+STRIP   = ee-strip
+AS      = ee-gcc
+LD      = ee-gcc
+HAVE_GCC3 = true
+CXX_UPDATE_DEP_FLAG = -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" -MQ "$@" -MP
+
+# Variables for dynamic plugin building
+PLUGIN_PREFIX =
+PLUGIN_SUFFIX = .plg
+PLUGIN_EXTRA_DEPS = $(TARGET)
+PLUGIN_LDFLAGS  = -nostartfiles $(srcdir)/backends/plugins/elf/version.o -Wl,-q,--just-symbols,$(TARGET),--retain-symbols-file,$(srcdir)/backends/plugins/elf/plugin.syms
+PLUGIN_LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -Wl,-T$(srcdir)/backends/plugins/ps2/plugin.ld -lstdc++ -lc
+
+# Test for adding different libs
+ifeq ($(USE_LIBMAD),1)
+DEFINES += -DUSE_MAD
+LIBS	+= -lmad
+endif
+ifeq ($(USE_LIBOGG), 1)
+DEFINES += -DUSE_VORBIS -DUSE_TREMOR
+LIBS	+= -ltremor
+endif
+
+# Test for dynamic plugins
+ifeq ($(DYNAMIC_MODULES),1)
+ENABLED = DYNAMIC_PLUGIN
+DEFINES += -DDYNAMIC_MODULES -DUSE_ELF_LOADER -DMIPS_TARGET -DUNCACHED_PLUGINS -DPLUGIN_DIRECTORY=\"host:plugins\"
+PRE_OBJS_FLAGS = -Wl,--whole-archive
+POST_OBJS_FLAGS = -Wl,--no-whole-archive
+else
+ENABLED = STATIC_PLUGIN
+endif
+
+# Test for debug
+ifeq ($(ENABLE_DEBUG),1)
+DEFINES += -D__PS2_DEBUG__
+FLAGS += -G2 -g
+LIBS += -lps2gdbStub -lps2ip -ldebug
+else
+DEFINES += -DRELEASE_BUILD
+FLAGS += -G2 -O2 -s -Wuninitialized
+# LDFLAGS += -s
+endif
+
+# Test for profiling
+ifeq ($(ENABLE_PROFILING),1)
+DEFINES += -DENABLE_PROFILING
+FLAGS += -G2 -pg -g
+LDFLAGS += -pg
+endif
+
+# Test for net support
+ifeq ($(DISABLE_NETWORK),1)
+DEFINES += -DNO_ADAPTOR
+endif
+
+# PS2 LIBS
+PS2LIBS = -lmc -lpad -lmouse -lhdd -lpoweroff -lsjpcm -lz -lm -lc -lfileXio -lkernel -lstdc++
+
+# Add in PS2SDK includes and libraries.
+LIBS += $(PS2LIBS)
+
+OBJS := $(srcdir)/backends/platform/ps2/DmaPipe.o \
+        $(srcdir)/backends/platform/ps2/Gs2dScreen.o \
+        $(srcdir)/backends/platform/ps2/irxboot.o \
+        $(srcdir)/backends/platform/ps2/ps2input.o \
+        $(srcdir)/backends/platform/ps2/ps2pad.o \
+        $(srcdir)/backends/platform/ps2/savefilemgr.o \
+        $(srcdir)/backends/platform/ps2/fileio.o \
+        $(srcdir)/backends/platform/ps2/asyncfio.o \
+        $(srcdir)/backends/platform/ps2/icon.o \
+        $(srcdir)/backends/platform/ps2/cd.o \
+        $(srcdir)/backends/platform/ps2/eecodyvdfs.o \
+        $(srcdir)/backends/platform/ps2/rpckbd.o \
+        $(srcdir)/backends/platform/ps2/systemps2.o \
+        $(srcdir)/backends/platform/ps2/ps2mutex.o \
+        $(srcdir)/backends/platform/ps2/ps2time.o \
+        $(srcdir)/backends/platform/ps2/ps2debug.o
+
+ifeq ($(DYNAMIC_MODULES),1)
+OBJS += $(srcdir)/backends/plugins/elf/elf-loader.o \
+        $(srcdir)/backends/plugins/elf/elf-provider.o \
+        $(srcdir)/backends/plugins/elf/shorts-segment-manager.o \
+        $(srcdir)/backends/plugins/elf/memory-manager.o \
+        $(srcdir)/backends/plugins/elf/mips-loader.o \
+        $(srcdir)/backends/plugins/elf/version.o
+endif
+
+BACKEND := ps2
+
+# Include common Scummvm makefile
+include $(srcdir)/Makefile.common
+
+LDFLAGS += -L$(PS2SDK)/ee/lib -L$(PS2SDK)/ports/lib
+ifeq ($(DYNAMIC_MODULES),1)
+LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -Wl,-T$(srcdir)/backends/plugins/ps2/main_prog.ld
+else
+LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -T $(PS2SDK)/ee/startup/linkfile
+endif
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS)
+	$(LD) $(PRE_OBJS_FLAGS) $(OBJS) $(POST_OBJS_FLAGS) $(LDFLAGS) $(LIBS) -o $@


Commit: c65464a43ba61bf92446e0d6dc033bfd7e677022
    https://github.com/scummvm/scummvm/commit/c65464a43ba61bf92446e0d6dc033bfd7e677022
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-23T19:05:39-05:00

Commit Message:
PS2: Added support for latest SDK in configure

Changed paths:
    configure



diff --git a/configure b/configure
index 1de0e65..4a94748 100755
--- a/configure
+++ b/configure
@@ -2260,6 +2260,7 @@ case $_host_os in
 		CXXFLAGS="$CXXFLAGS -G2"
 		DEFINES="$DEFINES -D_EE"
 		DEFINES="$DEFINES -D__PLAYSTATION2__"
+		DEFINES="$DEFINES -D__NEW_PS2SDK__"
 		;;
 	ps3)
 		# Force use of SDL and freetype from the ps3 toolchain


Commit: 68836e00c9259b441628071f47f558e5f0bd0e45
    https://github.com/scummvm/scummvm/commit/68836e00c9259b441628071f47f558e5f0bd0e45
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-23T19:30:48-05:00

Commit Message:
PS2: Added README.PS2

Changed paths:
  A backends/platform/ps2/README.PS2



diff --git a/backends/platform/ps2/README.PS2 b/backends/platform/ps2/README.PS2
new file mode 100644
index 0000000..141a79e
--- /dev/null
+++ b/backends/platform/ps2/README.PS2
@@ -0,0 +1,189 @@
+Dear PS2 ScummVM enthusiast user,
+
+here you will find the latest and the greatest PS2 backend ever!
+
+
+                         *** Release Notes ***
+
+Released 2 builds: SCUMMVM.ELF and SCUMMVM-S.ELF. The latter has engine
+modules statically linked into (that's what the "-S" is for), the former
+uses dynamic modules (uncached). The dynamic one is much faster to start
+and has more resources available for the games. The catch is that games
+detection, when you are adding a new one, is painstakingly slow...
+(as it needs to load, test, unload the plugins one by one).
+
+Until we have an optimization for that in place I would suggest you add
+new games with "SCUMMVM-S.ELF", and when you are done adding you then
+play them with "SCUMMVM.ELF", as this will give you the best of both.
+
+We no longer have a separate ELF build with hdd & net adapter disabled,
+as we now do it in the smart way, allowing users to disable it in their
+ScummVM.ini. See under in "Configuration" for details.
+
+We also have an improved Makefile.ps2 in ps2 folder which will allow
+you to create: static, dynamic, profile and debug build version.
+
+You can now also cleanly compile using "configure" and specifying:
+
+./configure --backend=ps2 --host=ps2 ...
+
+
+                         *** Installation ***
+
+Some media drivers require all capitalized letter, so to be on the
+safe side store the files (SCUMMVM.ELF and *.IRX) in upper case.
+
+Here comes a full list of the required *.IRX (don't worry they are all
+provided pre-compiled in the binary release ;-)
+
+ IOMANX.IRX
+ FILEXIO.IRX
+ CODYVDFS.IRX
+ SJPCM.IRX
+ USBD.IRX
+ USB_MASS.IRX
+ PS2MOUSE.IRX
+ RPCKBD.IRX
+ POWEROFF.IRX
+ PS2DEV9.IRX
+ PS2ATAD.IRX
+ PS2HDD.IRX
+ PS2FS.IRX
+ PS2IP.IRX
+ PS2SMAP.IRX
+ PS2HOST.IRX
+
+Make sure they are all stored in the folder that contains your SCUMMVM.ELF!
+
+If you are starting ScummVM from CD/DVD then it will look for ScummVM.ini
+a ScummVM.ini on the media folder from where you started SCUMMVM.ELF.
+
+Notes:
+
+ - depending on the media you install Scummvm/PS2 onto, it might be
+   picky about files cases, so I'd leave those *.IRX uppercase and
+   scummmodern.zip lower ;0)
+
+ - make sure you selected a save path before you start playing!
+
+ - we added PS2IPS.IRX in case you wanted to test a debug build
+   (use Makefile.gdb)
+
+
+                          *** Configuration ***
+
+There is now a [PlayStation2] section in ScummVM.ini which can be used
+to make your wildest dreams come true ;-)
+
+It accepts these entries:
+
+tv_mode = [pal] [ntsc]
+gfx_mode = [mode number] [*]
+hdd_part = [partition name] [disable]
+net_addr = [PS2 IP addr] [**]
+usb_mass = [0] [disable]
+
+[*] Currently supported gfx modes are:
+
+ # 1 -> SDTV progressive (NTSC: 224p / PAL: 256p)
+ # 2 -> SDTV interlaced  (NTSC: 448i / PAL: 512i) <- default
+ # 3 -> EDTV progressive (NTSC: 480p / PAL: 576p)
+ # 6 -> VESA (640x480 at 60)
+
+If no tv_mode is specified it will be autodected based on PS2 model.
+
+The non-interlaced (progressive) modes look much better and sharper.
+You can check the difference starting COMI and choosing About from
+the GMM (press "start" then choose "about"). You can easily see the
+difference between progressive and interlaced in scrolling text.
+
+You can use mode 6 (VGA 640x480) if you are connecting your PS2 to
+a RGB monitor. Some TVs also supports this signal.
+
+We also do some bad-ass things, like detecting the BIOS version and
+setting the GS registers by hand, for console models where a mode
+is not supported ;-)
+
+If SCUMMVM.ELF hangs at start for you try disabling the adapter by
+setting in ScummVM.ini
+
+hdd_part = 0
+net_addr = 0
+
+You can now also choose the hdd partition used for ScummVM games
+(default "+ScummVM") passing it as an argument to hdd_part:
+
+hdd_part = MyPartition  (witout the "+")
+
+If you have an adapter with hdd & net, but you don't use them you
+can just set both to 0 to disable, and have a leaner and meaner
+ScummVM booting much faster!
+
+[**] TODO
+
+                             *** Remote ***
+
+You will need "PS2IP.IRX", "PS2SMAP.IRX" and "PS2HOST.IRX" drivers too
+in the folder where you are starting SCUMMVM.ELF if you want to use
+the remote capability.
+
+The IP 192.168.1.20 (ps2link default) is hardcoded in the source as
+"netArg" in irxboot.cpp, feel free to modify it to match your network
+configuration.
+
+In a future release you will be able to set in ScummVM.ini using
+
+net_addr = xxx.yyy.zzz.www
+
+If you are starting SCUMMVM.ELF over the net using ps2client then you
+are already set. If you are starting it in any other way, then you
+will have to "export" the folder where you are storing ScummVM games
+and data by starting ps2client from inside that folder. Eg. from a
+terminal:
+
+> ./ps2client -h [your ps2 ip] listen
+
+Do this -after- ScummVM is up and running otherwise it will fail to
+establish a connection.
+
+
+                           *** Gamepad ***
+
+The mapping is:
+
+Start Button         -   GMM
+R1                   -   'y'
+L1                   -   'n'
+R2                   -   '.'
+L2                   -   Numpad 0
+Triangle             -   Escape
+Square               -   Enter
+Cross                -   Left mouse button
+Circle               -   Right mouse button
+
+
+                            *** Bugs ***
+
+Though we made our best to make this release as bug free as possible
+there are still a few bugs left:
+
+ - file handling speed : (not really a bug, but a nuisance) : there
+   is probably space for some more optimization in the current file
+   management. The only case when it really bogs me it's when you
+   try to select a saved game and there is some lag.
+
+   Some game will start faster too when this is optimized.
+
+ - feel free to add your bug, suggestion, secret wish to this list!
+
+ - SCI games have smooth audio and intro, but moving the pointer
+   and in-game animation speed might be a challenge.
+
+ - it has been reported USB media greater than 8 GB might not work
+
+Now enough reading, rush to your PlayStation2 and start playing!
+
+Are you still reading?
+
+Have a lot of fun,
+  -Max Lingua


Commit: 4592e0b586829fade4a5c800672849e693a0d151
    https://github.com/scummvm/scummvm/commit/4592e0b586829fade4a5c800672849e693a0d151
Author: Max Lingua (max.lingua at gmail.com)
Date: 2014-01-24T19:27:41-05:00

Commit Message:
Merge remote-tracking branch 'local/master'

Changed paths:
  A backends/platform/ps2/Makefile.ps2.dev
  A backends/platform/ps2/README.PS2
  R backends/platform/ps2/Makefile.gdb
    Makefile.common
    backends/fs/ps2/ps2-fs.cpp
    backends/fs/ps2/ps2-fs.h
    backends/platform/ps2/DmaPipe.cpp
    backends/platform/ps2/Gs2dScreen.cpp
    backends/platform/ps2/Gs2dScreen.h
    backends/platform/ps2/GsDefs.h
    backends/platform/ps2/Makefile.ps2
    backends/platform/ps2/asyncfio.cpp
    backends/platform/ps2/asyncfio.h
    backends/platform/ps2/cd.c
    backends/platform/ps2/eecodyvdfs.h
    backends/platform/ps2/fileio.cpp
    backends/platform/ps2/fileio.h
    backends/platform/ps2/icon.cpp
    backends/platform/ps2/iop/CoDyVDfs/common/codyvdirx.h
    backends/platform/ps2/iop/CoDyVDfs/iop/cdtypes.h
    backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.c
    backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.h
    backends/platform/ps2/iop/CoDyVDfs/iop/fiofs.c
    backends/platform/ps2/iop/CoDyVDfs/iop/rpcfs.c
    backends/platform/ps2/iop/rpckbd/include/ps2kbd.h
    backends/platform/ps2/iop/rpckbd/src/ps2kbd.c
    backends/platform/ps2/irxboot.cpp
    backends/platform/ps2/irxboot.h
    backends/platform/ps2/module.mk
    backends/platform/ps2/ps2debug.cpp
    backends/platform/ps2/ps2debug.h
    backends/platform/ps2/ps2input.cpp
    backends/platform/ps2/ps2input.h
    backends/platform/ps2/ps2pad.cpp
    backends/platform/ps2/ps2time.cpp
    backends/platform/ps2/rpckbd.c
    backends/platform/ps2/savefilemgr.cpp
    backends/platform/ps2/sysdefs.h
    backends/platform/ps2/systemps2.cpp
    backends/platform/ps2/systemps2.h
    backends/plugins/elf/version.cpp
    base/version.cpp
    common/scummsys.h
    configure
    engines/dialogs.cpp
    engines/sword25/util/lua/loslib.cpp





Commit: c3ffbd884a2d917aede6020c4ae1ee4a13d7f861
    https://github.com/scummvm/scummvm/commit/c3ffbd884a2d917aede6020c4ae1ee4a13d7f861
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2014-04-28T21:20:42+03:00

Commit Message:
Merge pull request #426 from sunmax/master

PS2: Pull request to master for latest PS2 code

Changed paths:
  A backends/platform/ps2/Makefile.ps2.dev
  A backends/platform/ps2/README.PS2
  R backends/platform/ps2/Makefile.gdb
    Makefile.common
    backends/fs/ps2/ps2-fs.cpp
    backends/fs/ps2/ps2-fs.h
    backends/platform/ps2/DmaPipe.cpp
    backends/platform/ps2/Gs2dScreen.cpp
    backends/platform/ps2/Gs2dScreen.h
    backends/platform/ps2/GsDefs.h
    backends/platform/ps2/Makefile.ps2
    backends/platform/ps2/asyncfio.cpp
    backends/platform/ps2/asyncfio.h
    backends/platform/ps2/cd.c
    backends/platform/ps2/eecodyvdfs.h
    backends/platform/ps2/fileio.cpp
    backends/platform/ps2/fileio.h
    backends/platform/ps2/icon.cpp
    backends/platform/ps2/iop/CoDyVDfs/common/codyvdirx.h
    backends/platform/ps2/iop/CoDyVDfs/iop/cdtypes.h
    backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.c
    backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.h
    backends/platform/ps2/iop/CoDyVDfs/iop/fiofs.c
    backends/platform/ps2/iop/CoDyVDfs/iop/rpcfs.c
    backends/platform/ps2/iop/rpckbd/include/ps2kbd.h
    backends/platform/ps2/iop/rpckbd/src/ps2kbd.c
    backends/platform/ps2/irxboot.cpp
    backends/platform/ps2/irxboot.h
    backends/platform/ps2/module.mk
    backends/platform/ps2/ps2debug.cpp
    backends/platform/ps2/ps2debug.h
    backends/platform/ps2/ps2input.cpp
    backends/platform/ps2/ps2input.h
    backends/platform/ps2/ps2pad.cpp
    backends/platform/ps2/ps2time.cpp
    backends/platform/ps2/rpckbd.c
    backends/platform/ps2/savefilemgr.cpp
    backends/platform/ps2/sysdefs.h
    backends/platform/ps2/systemps2.cpp
    backends/platform/ps2/systemps2.h
    backends/plugins/elf/version.cpp
    base/version.cpp
    common/scummsys.h
    configure
    engines/dialogs.cpp
    engines/sword25/util/lua/loslib.cpp









More information about the Scummvm-git-logs mailing list