From 17e8a6f220eb524bfebe07067266799268b45e04 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Thu, 9 Jan 2014 20:57:17 -0500 Subject: PS2: cleaned cast (X*) -> (X *) --- backends/platform/ps2/Gs2dScreen.cpp | 2 +- backends/platform/ps2/Gs2dScreen.h | 2 +- backends/platform/ps2/GsDefs.h | 12 ++++---- backends/platform/ps2/asyncfio.cpp | 4 +-- backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.c | 10 +++---- backends/platform/ps2/iop/CoDyVDfs/iop/fiofs.c | 8 +++--- backends/platform/ps2/iop/CoDyVDfs/iop/rpcfs.c | 12 ++++---- backends/platform/ps2/iop/rpckbd/src/ps2kbd.c | 4 +-- backends/platform/ps2/sysdefs.h | 34 +++++++++++------------ backends/platform/ps2/systemps2.cpp | 6 ++-- 10 files changed, 47 insertions(+), 47 deletions(-) diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp index 58667c0230..3a90c19f3c 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 1a70dad170..c9b9b5401c 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 fab0c40b35..9e7bab7052 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 3f20349107..7e06172722 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 e55e62853b..932d589a3b 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 f0a06f927b..5c5cbf94ef 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 5b760faa06..983ae38716 100644 --- a/backends/platform/ps2/iop/CoDyVDfs/iop/rpcfs.c +++ b/backends/platform/ps2/iop/CoDyVDfs/iop/rpcfs.c @@ -69,11 +69,11 @@ void *rpcReadClock(void *data) { void *driveStop(void *data) { if (CdStop() == 1) { if (CdSync(0) == 0) { - *(int*)data = CdGetError(); + *(int *)data = CdGetError(); } else - *(int*)data = -0x100; + *(int *)data = -0x100; } else - *(int*)data = -0x101; + *(int *)data = -0x101; return data; } @@ -81,11 +81,11 @@ void *driveStandby(void *data) { int type; if (CdStandby() == 1) { if (CdSync(0) == 0) { - *(int*)data = CdGetError(); + *(int *)data = CdGetError(); } else - *(int*)data = -0x100; + *(int *)data = -0x100; } else - *(int*)data = -0x101; + *(int *)data = -0x101; do { // wait until drive detected disc type type = CdGetDiskType(); diff --git a/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c b/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c index 7266afdce5..838ce9fe85 100644 --- a/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c +++ b/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c @@ -1089,7 +1089,7 @@ void *ps2kbd_rpc_server(int fno, void *data, int size) { ps2kbd_rpc_flushbuffer(); break; case KBD_RPC_SETLEDS: - ps2kbd_rpc_setleds(*(u8*) data); + ps2kbd_rpc_setleds(*(u8 *) data); break; case KBD_RPC_RESETKEYMAP: ps2kbd_rpc_resetkeymap(); @@ -1129,7 +1129,7 @@ int ps2kbd_init_rpc(void) { int th; param.attr = 0x02000000; - param.thread = (void*)ps2kbd_start_rpc; + param.thread = (void *)ps2kbd_start_rpc; param.priority = 40; param.stacksize = 0x800; param.option = 0; diff --git a/backends/platform/ps2/sysdefs.h b/backends/platform/ps2/sysdefs.h index 0114402233..a4ada47015 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 a7d782b07c..9882974f18 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) { -- cgit v1.2.3 From 14f3a09c8ccb1b821924234ce4e330382ef5d5ab Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Thu, 9 Jan 2014 21:06:26 -0500 Subject: PS2: used C++ const_cast<...> where appropriate --- backends/platform/ps2/asyncfio.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backends/platform/ps2/asyncfio.cpp b/backends/platform/ps2/asyncfio.cpp index 7e06172722..357ca955b1 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(_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(_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(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(_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(_runningOp)) == FXIO_COMPLETE) { _runningOp = NULL; retVal = true; } else -- cgit v1.2.3 From b75c7f6bc4a7245ab88fca760ad303df7e5da7ef Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Thu, 9 Jan 2014 21:22:07 -0500 Subject: PS2: added missing casts --- backends/platform/ps2/cd.c | 4 ++-- backends/platform/ps2/rpckbd.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backends/platform/ps2/cd.c b/backends/platform/ps2/cd.c index cd44b3d034..1c54174c1d 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 0bb45208f5..e7975ab484 100644 --- a/backends/platform/ps2/rpckbd.c +++ b/backends/platform/ps2/rpckbd.c @@ -17,7 +17,7 @@ #include #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; -- cgit v1.2.3 From e73027f2b8891eb84abd700c7832efd0dcbf0898 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Fri, 10 Jan 2014 00:50:58 -0500 Subject: PS2: fixed tabs and alignment --- backends/platform/ps2/DmaPipe.cpp | 8 +- backends/platform/ps2/Gs2dScreen.cpp | 26 ++-- backends/platform/ps2/GsDefs.h | 148 ++++++++++----------- backends/platform/ps2/asyncfio.cpp | 2 +- backends/platform/ps2/cd.c | 38 +++--- backends/platform/ps2/eecodyvdfs.h | 2 +- backends/platform/ps2/fileio.h | 14 +- .../platform/ps2/iop/CoDyVDfs/common/codyvdirx.h | 14 +- backends/platform/ps2/iop/CoDyVDfs/iop/cdtypes.h | 88 ++++++------ backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.c | 62 ++++----- backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.h | 28 ++-- backends/platform/ps2/iop/CoDyVDfs/iop/fiofs.c | 6 +- backends/platform/ps2/iop/rpckbd/include/ps2kbd.h | 4 +- backends/platform/ps2/ps2input.cpp | 70 +++++----- backends/platform/ps2/ps2input.h | 2 +- backends/platform/ps2/ps2pad.cpp | 2 +- backends/platform/ps2/ps2time.cpp | 6 +- backends/platform/ps2/savefilemgr.cpp | 8 +- backends/platform/ps2/systemps2.cpp | 44 +++--- backends/platform/ps2/systemps2.h | 26 ++-- 20 files changed, 299 insertions(+), 299 deletions(-) diff --git a/backends/platform/ps2/DmaPipe.cpp b/backends/platform/ps2/DmaPipe.cpp index a346a67566..f3622ea2e5 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 3a90c19f3c..cecc08d631 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 9e7bab7052..4da08ae301 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 357ca955b1..0197ce33f8 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 1c54174c1d..e08437d34f 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 1d43fb662f..fc959e32d6 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 afa2ca1f24..57c4a263d2 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 e94e7dc8d6..59b4975702 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 ad86631cfd..66c583794f 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 932d589a3b..2a94560843 100644 --- a/backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.c +++ b/backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.c @@ -59,7 +59,7 @@ int verifyDriveReady(void) { return -1; // drive still not ready } } - if (mediaType == DISC_NONE) + if (mediaType == DISC_NONE) return -1; return 0; } @@ -72,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 b9f1edc194..93124f9037 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 5c5cbf94ef..611211a715 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 07d9c3d7f9..6bef7caefa 100644 --- a/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h +++ b/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h @@ -87,8 +87,8 @@ typedef struct _kbd_keymap #define KBD_RPC_SETSPECIALMAP 7 /* Sets the special key mapping */ #define KBD_RPC_FLUSHBUFFER 9 /* Flush the internal buffer, probably best after a keymap change */ #define KBD_RPC_RESETKEYMAP 10 /* Reset keymaps to default states */ -#define KBD_RPC_READKEY 11 -#define KBD_RPC_READRAW 12 +#define KBD_RPC_READKEY 11 +#define KBD_RPC_READRAW 12 /* Note on keymaps. In normal keymap a 0 would indicate no key */ /* Key maps are represented by 3 256*8bit tables. First table maps USB key to a char when not shifted */ diff --git a/backends/platform/ps2/ps2input.cpp b/backends/platform/ps2/ps2input.cpp index 6f36c5ff90..e840bb2f19 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 b97daac042..5014feba82 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 607b614691..60787bb796 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 1cddd230a0..3c9e4fb995 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 46af42e193..2bd4bcba45 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 9882974f18..abea69604b 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 3ba40a70f9..0ae6b2da57 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 -- cgit v1.2.3 From 00b2e12897345298406abe17318dd130887fe353 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Fri, 10 Jan 2014 00:55:03 -0500 Subject: PS2: Ps2Pad::initPad added case STAT_NONE --- backends/platform/ps2/ps2pad.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backends/platform/ps2/ps2pad.cpp b/backends/platform/ps2/ps2pad.cpp index 60787bb796..22c3f4258c 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 { -- cgit v1.2.3 From 8e009b447b3c43a4164cae98c0857eb6e0c72489 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Fri, 10 Jan 2014 01:00:18 -0500 Subject: PS2: renamed animThread -> playAnim to avoid shadowing --- backends/platform/ps2/Gs2dScreen.cpp | 4 ++-- backends/platform/ps2/Gs2dScreen.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp index cecc08d631..31e073a25f 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 c9b9b5401c..4945200d3a 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); -- cgit v1.2.3 From 623a0e7d619944fb390aaed55ea53eb1d7cd42db Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Fri, 10 Jan 2014 01:07:21 -0500 Subject: PS2: use createPixelFormat for overlay format --- backends/platform/ps2/Gs2dScreen.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp index 31e073a25f..53b620a591 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) { -- cgit v1.2.3 From 7287448e896010f247102a9c0283e4510b83fced Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Fri, 10 Jan 2014 01:16:55 -0500 Subject: PS2: commented out unused Gs2dScreen::tvMode --- backends/platform/ps2/Gs2dScreen.cpp | 4 ++-- backends/platform/ps2/Gs2dScreen.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp index 53b620a591..da1cce35e0 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 4945200d3a..ce6538753d 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); -- cgit v1.2.3 From d687417da5d67a4886e1af4a13a4ed6ec66180f2 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Fri, 10 Jan 2014 17:53:29 -0500 Subject: Makefile.common: added QUIET_CC --- Makefile.common | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile.common b/Makefile.common index b56300a115..31bb83edc1 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 -- cgit v1.2.3 From a2313aef6635bb553e6bded3e1bd9ee7f2cf3621 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Fri, 10 Jan 2014 18:17:32 -0500 Subject: configure: enhanced PS2 support --- configure | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/configure b/configure index db78feb43e..f6fbad5ffe 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\\\"" ;; -- cgit v1.2.3 From 7dc0a54c5dcca7e86e88de513521961df67c812e Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Fri, 10 Jan 2014 18:28:43 -0500 Subject: PS2: beautified & simplified version on screen --- base/version.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/base/version.cpp b/base/version.cpp index c55bd63323..43fa6878d6 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 -- cgit v1.2.3 From 33b22acc5de3a93f1b6c82077a02f74110b879ef Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Fri, 10 Jan 2014 18:28:43 -0500 Subject: PS2: beautified & simplified version on screen --- base/version.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/version.cpp b/base/version.cpp index 43fa6878d6..8d087e0622 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 -- cgit v1.2.3 From 263a0972a3d4fcf53fa6e7272b9df2cc13a12d24 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Fri, 10 Jan 2014 18:39:57 -0500 Subject: PS2: removed plugins cksum deps on build time --- backends/plugins/elf/version.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/backends/plugins/elf/version.cpp b/backends/plugins/elf/version.cpp index 9f64870500..c4f37e0099 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 -- cgit v1.2.3 From 5ba543468863968c9f93a8840ff8472903cccc80 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Fri, 10 Jan 2014 18:39:57 -0500 Subject: PS2: removed plugins cksum deps on build time --- backends/plugins/elf/version.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backends/plugins/elf/version.cpp b/backends/plugins/elf/version.cpp index c4f37e0099..a2c1971109 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__ ; -- cgit v1.2.3 From a960ec7adf0547e4a872f29cb645b5f02dc7558c Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Fri, 10 Jan 2014 18:48:48 -0500 Subject: PS2: snprintf hack to fix scumm.plg --- engines/dialogs.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engines/dialogs.cpp b/engines/dialogs.cpp index c884075093..1713b99dd1 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()) { -- cgit v1.2.3 From fb69d8eddcb2a29bace9a2fa7723068e2eb1b6fe Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Sat, 11 Jan 2014 21:13:04 -0500 Subject: PS2: enhanced Makefile.ps2 (incl. modules & debug) --- backends/platform/ps2/Makefile.gdb | 104 ------------------- backends/platform/ps2/Makefile.ps2 | 204 ++++++++++++++++++++++++++----------- backends/platform/ps2/module.mk | 20 ++-- 3 files changed, 155 insertions(+), 173 deletions(-) delete mode 100644 backends/platform/ps2/Makefile.gdb diff --git a/backends/platform/ps2/Makefile.gdb b/backends/platform/ps2/Makefile.gdb deleted file mode 100644 index 8ca47cd9f1..0000000000 --- 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 d6ce08ae84..f1a99b39a6 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 bf95a5501d..7bcc60e58d 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. -- cgit v1.2.3 From 1cbb90d8ea82e728fa8ead8a4004dc53f3a75764 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Sun, 12 Jan 2014 20:08:50 -0500 Subject: PS2: modular IRX drivers loading --- backends/fs/ps2/ps2-fs.cpp | 5 +- backends/platform/ps2/irxboot.cpp | 81 +++++++++++++++------- backends/platform/ps2/irxboot.h | 13 +++- backends/platform/ps2/systemps2.cpp | 133 +++++++++++++++++++++++------------- backends/platform/ps2/systemps2.h | 5 +- 5 files changed, 161 insertions(+), 76 deletions(-) diff --git a/backends/fs/ps2/ps2-fs.cpp b/backends/fs/ps2/ps2-fs.cpp index 3a86cb3d9c..1c35d1562a 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 aa904d4f5b..ee52687d95 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 81b47a37c6..f8b451f6d2 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 abea69604b..2f6130cf4f 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 0ae6b2da57..773068bdef 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; -- cgit v1.2.3 From ca2f0f0067a53c468e6eb86a27e87a56ef2f60a5 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Thu, 16 Jan 2014 16:11:27 -0500 Subject: PS2: added [PlayStation2] section to scummvm.ini --- backends/platform/ps2/systemps2.cpp | 99 +++++++++++++++++++++++++++++++------ backends/platform/ps2/systemps2.h | 2 + 2 files changed, 85 insertions(+), 16 deletions(-) diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp index 2f6130cf4f..c301ec8d39 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 773068bdef..2307014908 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; } -- cgit v1.2.3 From beee456c688330e044b5ec32e5860f9b3ab4ff2e Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Fri, 17 Jan 2014 01:03:34 -0500 Subject: PS2: support for different gfx modes --- backends/platform/ps2/Gs2dScreen.cpp | 205 ++++++++++++++++++++++++++++------- backends/platform/ps2/Gs2dScreen.h | 9 +- backends/platform/ps2/GsDefs.h | 24 ++++ backends/platform/ps2/systemps2.cpp | 10 +- 4 files changed, 202 insertions(+), 46 deletions(-) diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp index da1cce35e0..c1d6b6e5ac 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@60) + Mode #7 = VESA (800x600@60) + Mode #8 = VESA (1024x768@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 ce6538753d..258ced627e 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 4da08ae301..e5174d3ef7 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 c301ec8d39..ed1c437f01 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); -- cgit v1.2.3 From 27735638c200b9b91dd44b9ed45fd16508cefb4f Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Fri, 17 Jan 2014 21:11:17 -0500 Subject: PS2: ps2pad.cpp - fixed duplicate switch case --- backends/platform/ps2/ps2pad.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/backends/platform/ps2/ps2pad.cpp b/backends/platform/ps2/ps2pad.cpp index 22c3f4258c..65f3c8ce4d 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; -- cgit v1.2.3 From 066c2825a6233d8c435f77471856ecf94d2f6047 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Sat, 18 Jan 2014 00:12:49 -0500 Subject: PS2: converted malloc(x) -> memalign(64, x) --- backends/platform/ps2/Gs2dScreen.cpp | 2 +- backends/platform/ps2/icon.cpp | 2 +- backends/platform/ps2/irxboot.cpp | 6 +++--- backends/platform/ps2/systemps2.cpp | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp index c1d6b6e5ac..d478805e82 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 bda4843647..22c546231c 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 ee52687d95..dcdf404fbe 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 ed1c437f01..e19aa46abc 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); -- cgit v1.2.3 From 61aaf9bafbc86fa26ab377815c62cdcd3332a925 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Sat, 18 Jan 2014 00:35:58 -0500 Subject: PS2: reverted createPixelFormat to _overlayFormat <1555> alpha is otherwise broken with classic theme --- backends/platform/ps2/Gs2dScreen.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp index d478805e82..e2bda3c89c 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) { -- cgit v1.2.3 From d211d579a2666f39e9af79b2f4d39e289167e948 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Sat, 18 Jan 2014 02:10:18 -0500 Subject: PS2: do not assume _tvMode and _gfxMode are init 0 --- backends/platform/ps2/Gs2dScreen.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp index e2bda3c89c..4d4143e860 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; -- cgit v1.2.3 From 001e3f76587cc52817db87a232c955aca281d5b9 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Sat, 18 Jan 2014 20:11:33 -0500 Subject: PS2: modified sword25 loslib.cpp to support PS2 --- engines/sword25/util/lua/loslib.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/engines/sword25/util/lua/loslib.cpp b/engines/sword25/util/lua/loslib.cpp index 25bfa2d1b5..055dfdf19e 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; } -- cgit v1.2.3 From 90d1e99968c6f997a9b5a8a66e4f11901d4484bf Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Sat, 18 Jan 2014 19:54:42 -0500 Subject: PS2: added missing default engines to Makefile.ps2 --- backends/platform/ps2/Makefile.ps2 | 45 ++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/backends/platform/ps2/Makefile.ps2 b/backends/platform/ps2/Makefile.ps2 index f1a99b39a6..364f93e52a 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 -- cgit v1.2.3 From b69a2c81a7b0ed535e23e91928bc8ba193db744a Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Sun, 19 Jan 2014 12:53:55 -0500 Subject: PS2: scummsys.h (u)int64 is "long" for PS2 --- common/scummsys.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/scummsys.h b/common/scummsys.h index 48dffc53a6..56cd42d723 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 -- cgit v1.2.3 From 487e642d00e3282a83e7510d356ff684f0c1aa51 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Thu, 23 Jan 2014 00:34:00 -0500 Subject: PS2: Support for latest SDK with -D__NEW_PS2SDK__ --- backends/platform/ps2/Gs2dScreen.cpp | 9 +++++++++ backends/platform/ps2/Makefile.ps2 | 2 +- backends/platform/ps2/systemps2.cpp | 14 +++++++++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp index 4d4143e860..8015eab08f 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 364f93e52a..2ee47c9a4d 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 e19aa46abc..80130fc679 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); -- cgit v1.2.3 From ab3a1b5e0cfa2090cb0c9df3cf18dfc3fb057bc9 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Thu, 23 Jan 2014 01:02:05 -0500 Subject: PS2: commented "offending" free in startIrxModules TODO: investigate stack corruption due to double free TODO: review modules loader fallback logic --- backends/platform/ps2/systemps2.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp index 80130fc679..e800c6cb21 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 "); -- cgit v1.2.3 From c16c6653a112307d4f5ded3c3533f9621a945cb3 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Thu, 23 Jan 2014 01:29:30 -0500 Subject: PS2: Improved support for profiling (gprof) build --- backends/platform/ps2/Makefile.ps2 | 6 +++--- backends/platform/ps2/fileio.cpp | 3 +++ backends/platform/ps2/systemps2.cpp | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/backends/platform/ps2/Makefile.ps2 b/backends/platform/ps2/Makefile.ps2 index 2ee47c9a4d..7b010e8440 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 1ec16a3817..cc1da2e511 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 e800c6cb21..f3807ea91f 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) { -- cgit v1.2.3 From 6487c362a1909b10886ee95f4f91109a7808fd33 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Thu, 23 Jan 2014 16:32:33 -0500 Subject: PS2: Init Ps2Input after USB drivers are loaded --- backends/platform/ps2/systemps2.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp index f3807ea91f..5f3edd345a 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); } } -- cgit v1.2.3 From 5e36716be5dc55d2fbf0d417b03e065bd09f7946 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Thu, 23 Jan 2014 18:15:42 -0500 Subject: PS2: Made it quieter unless -DLOGORRHEIC is set --- backends/fs/ps2/ps2-fs.cpp | 42 +++++++++++++++--------------- backends/fs/ps2/ps2-fs.h | 4 +-- backends/platform/ps2/Makefile.ps2 | 1 + backends/platform/ps2/asyncfio.h | 3 +++ backends/platform/ps2/fileio.cpp | 45 ++++++++++++++++---------------- backends/platform/ps2/ps2debug.cpp | 3 ++- backends/platform/ps2/ps2debug.h | 8 +++++- backends/platform/ps2/savefilemgr.cpp | 25 +++++++++--------- backends/platform/ps2/systemps2.cpp | 49 +++++++++++++++++------------------ 9 files changed, 95 insertions(+), 85 deletions(-) diff --git a/backends/fs/ps2/ps2-fs.cpp b/backends/fs/ps2/ps2-fs.cpp index 1c35d1562a..edf787418f 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 df78f9f68a..8573ac271a 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 7b010e8440..3631c653f6 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 31684d4349..fbc0005373 100644 --- a/backends/platform/ps2/asyncfio.h +++ b/backends/platform/ps2/asyncfio.h @@ -23,6 +23,9 @@ #define MAX_HANDLES 32 #include +#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 cc1da2e511..b204d3f8bb 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 300e18316f..3e689f53e1 100644 --- a/backends/platform/ps2/ps2debug.cpp +++ b/backends/platform/ps2/ps2debug.cpp @@ -22,10 +22,10 @@ #include "ps2debug.h" #include -#include #include 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 02831e0623..1d29274d91 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 2bd4bcba45..e1bb7d178d 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 5f3edd345a..cbb1c47191 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 #include @@ -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); } -- cgit v1.2.3 From 0f264e2d739977629c146724658ad60f7fa55044 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Thu, 23 Jan 2014 18:16:41 -0500 Subject: PS2: Added compact Makefile.ps2.dev for debug --- backends/platform/ps2/Makefile.ps2.dev | 170 +++++++++++++++++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 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 0000000000..cd9432e2df --- /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 $@ -- cgit v1.2.3 From c65464a43ba61bf92446e0d6dc033bfd7e677022 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Thu, 23 Jan 2014 19:04:19 -0500 Subject: PS2: Added support for latest SDK in configure --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 1de0e65630..4a9474846a 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 -- cgit v1.2.3 From 68836e00c9259b441628071f47f558e5f0bd0e45 Mon Sep 17 00:00:00 2001 From: Max Lingua Date: Thu, 23 Jan 2014 19:30:48 -0500 Subject: PS2: Added README.PS2 --- backends/platform/ps2/README.PS2 | 189 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100644 backends/platform/ps2/README.PS2 diff --git a/backends/platform/ps2/README.PS2 b/backends/platform/ps2/README.PS2 new file mode 100644 index 0000000000..141a79eaca --- /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@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 -- cgit v1.2.3 From 579c343d1361801c936eedae50d956018a7d83f4 Mon Sep 17 00:00:00 2001 From: lukaslw Date: Sat, 8 Mar 2014 00:31:27 +0100 Subject: DRACI: Saving improvements (item in hand and hero position). --- engines/draci/game.cpp | 23 ++++++++++++++++++++++- engines/draci/game.h | 7 ++++++- engines/draci/saveload.cpp | 7 ++++--- engines/draci/saveload.h | 2 +- engines/draci/script.cpp | 17 +++++++++++++++-- 5 files changed, 48 insertions(+), 8 deletions(-) diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index e5ff1f079a..98777a7eca 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -926,10 +926,12 @@ void Game::inventoryDraw() { void Game::inventoryReload() { // Make sure all items are loaded into memory (e.g., after loading a // savegame) by re-putting them on the same spot in the inventory. + GameItem *tempItem = _currentItem; for (uint i = 0; i < kInventorySlots; ++i) { putItem(_inventory[i], i); } setPreviousItemPosition(0); + _currentItem = tempItem; } void Game::inventorySwitch(int keycode) { @@ -1572,7 +1574,7 @@ Game::~Game() { delete[] _items; } -void Game::DoSync(Common::Serializer &s) { +void Game::DoSync(Common::Serializer &s, uint8 saveVersion) { s.syncAsUint16LE(_currentRoom._roomNum); for (uint i = 0; i < _info._numObjects; ++i) { @@ -1603,6 +1605,25 @@ void Game::DoSync(Common::Serializer &s) { s.syncAsSint16LE(_dialogueVars[i]); } + if(saveVersion >= 2) { + setPositionLoaded(true); + if (s.isSaving()) { + s.syncAsSint16LE(_hero.x); + s.syncAsSint16LE(_hero.y); + + int handItemID = _currentItem ? _currentItem->_absNum : -1; + s.syncAsSint16LE(handItemID); + } else { + s.syncAsSint16LE(_heroLoading.x); + s.syncAsSint16LE(_heroLoading.y); + + int handItemID = -1; + s.syncAsSint16LE(handItemID); + _currentItem = getItem(handItemID); + } + } else { + _currentItem = 0; + } } static double real_to_double(byte real[6]) { diff --git a/engines/draci/game.h b/engines/draci/game.h index 4a8f3de269..d3ae36e816 100644 --- a/engines/draci/game.h +++ b/engines/draci/game.h @@ -215,6 +215,7 @@ public: void walkHero(int x, int y, SightDirection dir); // start walking and leave callback as is void setHeroPosition(const Common::Point &p); const Common::Point &getHeroPosition() const { return _hero; } + const Common::Point &getHeroLoadingPosition() const { return _heroLoading; } void positionAnimAsHero(Animation *anim); void positionHeroAsAnim(Animation *anim); @@ -290,6 +291,8 @@ public: void setExitLoop(bool exit) { _shouldExitLoop = exit; } bool isReloaded() const { return _isReloaded; } void setIsReloaded(bool value) { _isReloaded = value; } + bool isPositionLoaded() { return _isPositionLoaded; } + void setPositionLoaded(bool value) { _isPositionLoaded = value; } void setSpeechTiming(uint tick, uint duration); void shiftSpeechAndFadeTick(int delta); @@ -327,7 +330,7 @@ public: void setEnableSpeedText(bool value) { _enableSpeedText = value; } bool getEnableSpeedText() const { return _enableSpeedText; } - void DoSync(Common::Serializer &s); + void DoSync(Common::Serializer &s, uint8 saveVersion); private: void updateOrdinaryCursor(); @@ -352,6 +355,7 @@ private: GameInfo _info; Common::Point _hero; + Common::Point _heroLoading; int *_variables; Person *_persons; @@ -395,6 +399,7 @@ private: bool _shouldQuit; bool _shouldExitLoop; bool _isReloaded; + bool _isPositionLoaded; uint _speechTick; uint _speechDuration; diff --git a/engines/draci/saveload.cpp b/engines/draci/saveload.cpp index 31ac63b791..3e7f8651c1 100644 --- a/engines/draci/saveload.cpp +++ b/engines/draci/saveload.cpp @@ -45,7 +45,8 @@ bool readSavegameHeader(Common::InSaveFile *in, DraciSavegameHeader &header) { return false; header.version = in->readByte(); - if (header.version != DRACI_SAVEGAME_VERSION) + // Version 1 is compatible with Version 2 + if (header.version > DRACI_SAVEGAME_VERSION) return false; // Read in the string @@ -106,7 +107,7 @@ Common::Error saveSavegameData(int saveGameIdx, const Common::String &saveName, } else { // Create the remainder of the savegame Common::Serializer s(NULL, f); - vm._game->DoSync(s); + vm._game->DoSync(s, header.version); f->finalize(); delete f; @@ -140,7 +141,7 @@ Common::Error loadSavegameData(int saveGameIdx, DraciEngine *vm) { // Synchronise the remaining data of the savegame Common::Serializer s(f, NULL); - vm->_game->DoSync(s); + vm->_game->DoSync(s, header.version); delete f; // Post-processing diff --git a/engines/draci/saveload.h b/engines/draci/saveload.h index 8b38ccb94f..6f951a3409 100644 --- a/engines/draci/saveload.h +++ b/engines/draci/saveload.h @@ -29,7 +29,7 @@ namespace Draci { -#define DRACI_SAVEGAME_VERSION 1 +#define DRACI_SAVEGAME_VERSION 2 struct DraciSavegameHeader { uint8 version; diff --git a/engines/draci/script.cpp b/engines/draci/script.cpp index 97dde39809..1149cdf717 100644 --- a/engines/draci/script.cpp +++ b/engines/draci/script.cpp @@ -634,8 +634,16 @@ void Script::stayOn(const Common::Array ¶ms) { return; } - int x = params[0]; - int y = params[1]; + int x, y; + Common::Point afterLoadingPos = _vm->_game->getHeroLoadingPosition(); + if(_vm->_game->isPositionLoaded() == true) { + x = afterLoadingPos.x; + y = afterLoadingPos.y; + } + else { + x = params[0]; + y = params[1]; + } SightDirection dir = static_cast (params[2]); // Jumps into the given position regardless of the walking map. @@ -670,6 +678,11 @@ void Script::walkOnPlay(const Common::Array ¶ms) { return; } + if(_vm->_game->isPositionLoaded() == true) { + _vm->_game->setPositionLoaded(false); + return; + } + int x = params[0]; int y = params[1]; SightDirection dir = static_cast (params[2]); -- cgit v1.2.3 From 41285953605c0bc7a42988eff3b6f6de1038cda2 Mon Sep 17 00:00:00 2001 From: lukaslw Date: Sat, 8 Mar 2014 16:24:17 +0100 Subject: DRACI: Fading out improvements. --- engines/draci/game.cpp | 32 ++++++++++++++++++-------------- engines/draci/game.h | 1 + 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index 98777a7eca..3a335f249a 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -72,6 +72,7 @@ Game::Game(DraciEngine *vm) : _vm(vm), _walkingState(vm) { _fadePhases = 0; _fadePhase = 0; _fadeTick = 0; + _isFadeOut = 1; _mouseChangeTick = 0; _enableQuickHero = 0; _wantQuickHero = 0; @@ -216,6 +217,7 @@ void Game::start() { // init scripts. This flag was turned on to skip the rest of // those programs. Don't call loop(), because the // location may have changed. + fadePalette(true); continue; } @@ -478,6 +480,7 @@ void Game::handleDialogueLoop() { } void Game::fadePalette(bool fading_out) { + _isFadeOut = fading_out; const byte *startPal = NULL; const byte *endPal = _currentRoom._palette >= 0 ? _vm->_paletteArchive->getFile(_currentRoom._palette)->_data @@ -551,6 +554,19 @@ void Game::advanceAnimationsAndTestLoopExit() { _vm->_anims->drawScene(_vm->_screen->getSurface()); _vm->_screen->copyToScreen(); _vm->_system->delayMillis(kTimeUnit); + if(_isFadeOut) { + fadePalette(false); + // Set cursor state + // Need to do this after we set the palette since the cursors use it + if (_currentRoom._mouseOn) { + debugC(6, kDraciLogicDebugLevel, "Mouse: ON"); + _vm->_mouse->cursorOn(); + _vm->_mouse->setCursorType(kNormalCursor); + } else { + debugC(6, kDraciLogicDebugLevel, "Mouse: OFF"); + _vm->_mouse->cursorOff(); + } + } // If the hero has arrived at his destination, after even the last // phase was correctly animated, run the callback. @@ -598,6 +614,8 @@ void Game::loop(LoopSubstatus substatus, bool shouldExit) { break; } + advanceAnimationsAndTestLoopExit(); + if (_vm->_mouse->isCursorOn()) { // Find animation under cursor and the game object // corresponding to it @@ -629,8 +647,6 @@ void Game::loop(LoopSubstatus substatus, bool shouldExit) { } } - advanceAnimationsAndTestLoopExit(); - } while (!shouldExitLoop()); setLoopSubstatus(kOuterLoop); @@ -1435,7 +1451,6 @@ void Game::enterNewRoom() { _vm->_screen->setPalette(NULL, 0, kNumColors); _vm->_anims->drawScene(_vm->_screen->getSurface()); _vm->_screen->copyToScreen(); - fadePalette(false); // Run the program for the gate the dragon came through debugC(6, kDraciLogicDebugLevel, "Running program for gate %d", _newGate); @@ -1448,17 +1463,6 @@ void Game::enterNewRoom() { // Don't immediately switch to the map or inventory even if the mouse // position tell us to. _mouseChangeTick = kMouseDoNotSwitch; - - // Set cursor state - // Need to do this after we set the palette since the cursors use it - if (_currentRoom._mouseOn) { - debugC(6, kDraciLogicDebugLevel, "Mouse: ON"); - _vm->_mouse->cursorOn(); - _vm->_mouse->setCursorType(kNormalCursor); - } else { - debugC(6, kDraciLogicDebugLevel, "Mouse: OFF"); - _vm->_mouse->cursorOff(); - } } void Game::positionAnimAsHero(Animation *anim) { diff --git a/engines/draci/game.h b/engines/draci/game.h index d3ae36e816..638c979d61 100644 --- a/engines/draci/game.h +++ b/engines/draci/game.h @@ -413,6 +413,7 @@ private: int _fadePhases; int _fadePhase; uint _fadeTick; + bool _isFadeOut; int _mouseChangeTick; bool _enableQuickHero; -- cgit v1.2.3 From 43e3a58c2cdba50e30a0eb8e758e1baa90b890c3 Mon Sep 17 00:00:00 2001 From: lukaslw Date: Tue, 11 Mar 2014 16:42:53 +0100 Subject: DRACI: Hero postion in first new room after loading. --- engines/draci/script.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engines/draci/script.cpp b/engines/draci/script.cpp index 1149cdf717..09c74f5e0d 100644 --- a/engines/draci/script.cpp +++ b/engines/draci/script.cpp @@ -700,6 +700,10 @@ void Script::newRoom(const Common::Array ¶ms) { return; } + if(_vm->_game->isPositionLoaded() == true) { + _vm->_game->setPositionLoaded(false); + } + int room = params[0] - 1; int gate = params[1] - 1; -- cgit v1.2.3 From 718d45db5fa3bfae7b7a008e220b2bac704b7817 Mon Sep 17 00:00:00 2001 From: JenniBee Date: Sat, 22 Mar 2014 12:10:42 -0400 Subject: SCI: Add detection entries for many more fan games. --- engines/sci/detection_tables.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h index e97db04a8f..e7304f8d90 100644 --- a/engines/sci/detection_tables.h +++ b/engines/sci/detection_tables.h @@ -4020,12 +4020,14 @@ static const struct ADGameDescription SciGameDescriptions[] = { #endif // ENABLE_SCI32 // SCI Fanmade Games + FANMADE("120 Degrees Below Zero", "57f6135bd073802215c9b97f32d6aea3", 504, "03adf530a34557dfc20f848c9572f4d0", 320749), FANMADE("Al Pond: Island Quest 2", "4cba6a5a4c8f66f21935ed78b0511a92", 870, "876587dc9a5ec569287a3dc4b29139d8", 613769), FANMADE("Al Pond 2: Island Quest", "9625372e710d1a95d2027b48f9e325af", 1506, "a0f9aa65b9bf3d8703adff5a621f243c", 889843), FANMADE("Al Pond 2: Island Quest (Updated)", "64be277cdcc6aafce7d9f26e88ad31a8", 1500, "571547228a212d63315f0c114cf48d54", 885241), FANMADE("Another DG Game: I Want My C64 Back", "4a8ca7ca2abd18899ef856f47665e2e9", 588, "12ff558d20c72e42cc6adb408f34d6d8", 150513), FANMADE_L("Another DG Game: I Want My C64 Back", "13dc1d9ebc57daf8895412eee5e39fea", 576, "e2ad60b3a280171429db5c85f158f84a", 141697, Common::FR_FRA), FANMADE("Aquarius: An Aquatic Experience", "2e23bc3b82f22a454be202ea593fb478", 480, "01555c8de683d25405bda270aa1ff014", 272372), + FANMADE("Betrayed Alliance", "b1f43f496a83cb8503f290a838b26242", 4062, "e637255aae6191ee92b9e843ad276288", 2367197), FANMADE("Bluntman and Chronic (Politically Correct Version)", "c3ef9fa6c7c5fb840078bf28d87c7f8b", 1362, "441636a9f6f86710844868fded868ee7", 596688), FANMADE("Cascade Quest", "c94efc10d18c040b6e22a1dc6d3adfe1", 3468, "8ada33dfa945f81531e5508240b573de", 1432195), FANMADE("Circus Quest", "35871f6b4e1df56af4113c0203a0b223", 630, "7d6f97d7935d8733f488d4cb74315e5b", 279627), @@ -4033,26 +4035,37 @@ static const struct ADGameDescription SciGameDescriptions[] = { FANMADE("Curt's Quest 1.1", "54084c29346683296e45ef32d7ae74f3", 1128, "c851182cdf6fc6a81b840f4d4875f1a0", 302000), FANMADE("Demo Quest", "c89a0c9e0a4e4af0ecedb300a3b31dbf", 384, "a32f3495ba24764cba091119cc3f1e13", 160098), FANMADE("Dr. Jummybummy's Space Adventure 2", "6ae6cb7de423f51736d9487b4ca0c6da", 810, "26e5b563f578e104d79689f36568b7cf", 394670), + FANMADE("Edy Oliver into the Cave of Whistling Skulls Demo", "eba0a0e86768ee3f14e78fecbc5af011", 2388, "4f6eab79a0f7980960eed101ab8122ad", 2601551), + FANMADE("Footsteps Sound Demo", "d9dabee6e1550b1fdb793f442f227738", 372, "06561df40dea49c6e84184e0ba6f19cb", 114212), FANMADE_L("Grostesteing: Plus Mechant que Jamais", "ec9a97ccb134f69249f6ea8b16c13d8e", 1500, "b869f5f11bfe2ab5f67f4f0c618f2ce1", 464657, Common::FR_FRA), // FIXME: Accent FANMADE("Humanoid Demo", "97d8331293a6d57e8bad58c1efc89a63", 624, "fb354b9abe64011b12159e45d724633f", 452320), + FANMADE("Island of Secrets Demo 0.3", "61279176c3e4530fec9b578877aecda7", 504, "7f4ed7a81b86bea22c62bc98e6d9ec39", 197790), FANMADE("Jim’s Quest 1: The Phantom Thesis", "0af50be1d3f0cb77a09137709a76ef4f", 960, "9c042c136548b20d9183495668e03526", 496446), + FANMADE("King's Quest II SCI Pre-Alpha Version", "cdea1c081022e7697a1afffb1d2f9f6a", 2646, "fb2ce39002c3e05f3d83533638dea105", 2310356), FANMADE("Knight's Quest Demo 1.0", "5e816edf993956752ed06fccfeeae6d9", 1260, "959321f88a22905fa1f8c6d897874744", 703836), FANMADE("LockerGnome Quest", "3eeff9130206cad0c4e1551e2b9dd2c5", 420, "ae05ca90806fd90cc43f147c82d3547c", 158906), + FANMADE("LockerGnome Quest Redux", "55b0081dbdd77a07807c76cec3606970", 492, "75c9c5e8a475a7b5f1a6cb18edad67f2", 168069), FANMADE("New Year's Mystery", "e4dcab1b1d3cb4a2c070a07a9c9589e0", 708, "e00ca5e44fd4e98d8174b467b31b0f21", 295425), FANMADE("New Year's Mystery (Updated)", "efd1beb5120293725065c95959144f81", 714, "b3bd3c2372ed6efa28adb12403c4c31a", 305027), FANMADE("Ocean Battle", "c2304a0568e0eb84f8e9a0915f01170a", 408, "46c520c1ac9b63528854d0f58c7e1b74", 142234), FANMADE("Osama", "db8f1710453cfbecf4214b2946970043", 390, "7afd75d4620dedf97a84ae8f0a7523cf", 123827), FANMADE("Quest for the Cheat", "a359d4cf27f98264b42b55c017671214", 882, "8a943029f73c4bc85d454b7f473455ba", 455209), + FANMADE("Robust Parse Demo 1.2", "c956d40b6eb42292ec328c510acb11d8", 540, "26f092bab5ec4490737d8463fd3ebbd5", 229044), FANMADE("SCI Capture the Flag", "4cd679a51d93b8b27c6b38d81be24b8b", 432, "98ae1f6ed7b4c21f88addbf643dd1d2f", 147878), FANMADE("SCI Companion Template", "ad54d4f504086cd597aa2348d0aa3b09", 354, "6798b7b601ce8154c1d1bc0f0edcdd18", 113061), + FANMADE("SCI Logging Demo", "615c30c1445ea9349847e8868312a674", 558, "2df6858526177612ef9473e7af5b31c6", 171012), + FANMADE("SCI Narration Demo", "731f4f2b726a13c153380af08da16591", 360, "38c80558fb942e8568f011d4a1a4af59", 109789), FANMADE("SCI Programming April 2010 Competition Template", "36e5c4011dd7c92e1ae4c6fede7d698d", 456, "20c87fbb7f73e2a3eb2c5dfab4d76b5a", 142221), FANMADE("SCI Studio Template 3.0", "ca0dc8d586e0a8670b7621cde090b532", 354, "58a48ee692a86c0575e6bd0b00a92b9a", 113097), FANMADE("SCI Quest", "9067e1f1e54436d2dbfce855524bc84a", 552, "ffa7d355cd9223f245289108a696bcd2", 149634), FANMADE("SCI-Man", "3ab85bd39a86c11f85781764f9db09bb", 468, "bb8f9992f504a242bf0860e3588e150b", 131810), - FANMADE("The Black Cauldron", "5e1ff2833c7f33ebcfa456ba836e2067", 2592, "2f8e6264d2db91bb54982ab8aa18b3b4", 1881839), + FANMADE("Text Views Demo", "ad0485a96470566517f184ff5dd049f8", 372, "727b946b37588ed334737732c55007c4", 115788), + FANMADE("The Black Cauldron Demo", "5e1ff2833c7f33ebcfa456ba836e2067", 2592, "2f8e6264d2db91bb54982ab8aa18b3b4", 1881839), + FANMADE("The Black Cauldron Final", "cbb4705f0cd73760996e5b27aae54f6a", 2484, "fc3bcaa7783b91bb78faefa345c6b3d9", 1677293), FANMADE("The Farm Nightmare", "fb6cbfddaa7c055e2c3d8cf4c683a7db", 906, "50655e8b8925f717e698e08f006f40be", 338303), FANMADE("The Gem Scenario", "ef5f61f4d2c6d31122d3e2baf89ad976", 642, "2f16be390dd90c3d7ca1c8a594ac0bfa", 244794), FANMADE("The Legend of the Lost Jewel", "ba1bca315e3818c5626eda51bcfbcccf", 636, "9b0736d69924af0cff32a0f78db96855", 300398), + FANMADE("Winter Wonderland", "c1ffaf8327462effd4ad21eeed9eea59", 504, "5d48666dc62f90d852a1d0de6e69195f", 305076), // FIXME: The vga demo does not have a resource.000/001 file. //FANMADE_V("SCI VGA Demo", "00b1abd87bad356b90fcdfcb6132c26f", 8, "", 0, 0), -- cgit v1.2.3 From 80d34a8a7cc6960006bc90f80686c2241f60226f Mon Sep 17 00:00:00 2001 From: Zerophase Date: Mon, 31 Mar 2014 00:43:54 -0500 Subject: GUI: Add Tab cycling to TabWidget Tab and Shift-Tab can now cycle between each Tab of the Edit Game menu. --- gui/dialog.cpp | 13 ++++++++++++- gui/widgets/tab.cpp | 27 ++++++++++++++++++++++++--- gui/widgets/tab.h | 2 ++ 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/gui/dialog.cpp b/gui/dialog.cpp index ec392a877a..fa4e508494 100644 --- a/gui/dialog.cpp +++ b/gui/dialog.cpp @@ -250,7 +250,18 @@ void Dialog::handleKeyDown(Common::KeyState state) { close(); } - // TODO: tab/shift-tab should focus the next/previous focusable widget + if (state.keycode == Common::KEYCODE_TAB) { + // TODO: Maybe add Tab behaviours for all widgets too. + // searches through widgets on screen for tab widget + Widget *w = _firstWidget; + while (w) { + if (w->_type == kTabWidget) + if (w->handleKeyDown(state)) + return; + + w = w->_next; + } + } } void Dialog::handleKeyUp(Common::KeyState state) { diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp index a8b3f5450d..87c6b652d3 100644 --- a/gui/widgets/tab.cpp +++ b/gui/widgets/tab.cpp @@ -226,12 +226,33 @@ void TabWidget::handleMouseDown(int x, int y, int button, int clickCount) { } bool TabWidget::handleKeyDown(Common::KeyState state) { - // TODO: maybe there should be a way to switch between tabs - // using the keyboard? E.g. Alt-Shift-Left/Right-Arrow or something - // like that. + if (state.hasFlags(Common::KBD_SHIFT) && state.keycode == Common::KEYCODE_TAB) + adjustTabs(-1); + else if (state.keycode == Common::KEYCODE_TAB) + adjustTabs(1); + return Widget::handleKeyDown(state); } +void TabWidget::adjustTabs(int value) { + // determine which tab is next + int tabID = _activeTab + value; + if (tabID >= (int)_tabs.size()) + tabID = 0; + else if (tabID < 0) + tabID = ((int)_tabs.size() - 1); + + // If tabbing moves the last tab out of sight slide tabs over + if ((tabID * _tabWidth) > (_w - getAbsX())) + _firstVisibleTab++; + else if (tabID == 0) + _firstVisibleTab = tabID; + + // If a tab was clicked, switch to that pane + if (tabID >= 0 && tabID < (int)_tabs.size()) + setActiveTab(tabID); +} + void TabWidget::reflowLayout() { Widget::reflowLayout(); diff --git a/gui/widgets/tab.h b/gui/widgets/tab.h index 38aa089eb5..08f29f9929 100644 --- a/gui/widgets/tab.h +++ b/gui/widgets/tab.h @@ -109,6 +109,8 @@ protected: virtual void drawWidget(); virtual Widget *findWidget(int x, int y); + + virtual void adjustTabs(int value); }; } // End of namespace GUI -- cgit v1.2.3 From 5df3c14eba68e299d270e773194608808adaa1ae Mon Sep 17 00:00:00 2001 From: Zerophase Date: Tue, 1 Apr 2014 05:42:16 -0500 Subject: GUI: Fix tab cycling when total tabs increase. Tab cycling ignores tab width, and slides correctly for larger tab counts. --- gui/widgets/tab.cpp | 18 +++++++++--------- gui/widgets/tab.h | 3 +++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp index 87c6b652d3..3ba6be8166 100644 --- a/gui/widgets/tab.cpp +++ b/gui/widgets/tab.cpp @@ -227,9 +227,9 @@ void TabWidget::handleMouseDown(int x, int y, int button, int clickCount) { bool TabWidget::handleKeyDown(Common::KeyState state) { if (state.hasFlags(Common::KBD_SHIFT) && state.keycode == Common::KEYCODE_TAB) - adjustTabs(-1); + adjustTabs(-kAheadTab); else if (state.keycode == Common::KEYCODE_TAB) - adjustTabs(1); + adjustTabs(kAheadTab); return Widget::handleKeyDown(state); } @@ -242,15 +242,15 @@ void TabWidget::adjustTabs(int value) { else if (tabID < 0) tabID = ((int)_tabs.size() - 1); - // If tabbing moves the last tab out of sight slide tabs over - if ((tabID * _tabWidth) > (_w - getAbsX())) + // slides _firstVisibleTab forward to the correct tab + while (_firstVisibleTab < tabID - kMaxTabs) _firstVisibleTab++; - else if (tabID == 0) - _firstVisibleTab = tabID; - // If a tab was clicked, switch to that pane - if (tabID >= 0 && tabID < (int)_tabs.size()) - setActiveTab(tabID); + // slide _firstVisibleTab backwards to the correct tab + while (tabID < _firstVisibleTab) + _firstVisibleTab--; + + setActiveTab(tabID); } void TabWidget::reflowLayout() { diff --git a/gui/widgets/tab.h b/gui/widgets/tab.h index 08f29f9929..bf4176887c 100644 --- a/gui/widgets/tab.h +++ b/gui/widgets/tab.h @@ -38,6 +38,9 @@ class TabWidget : public Widget { typedef Common::Array TabList; protected: + const int kMaxTabs = 5; + const int kAheadTab = 1; + int _activeTab; int _firstVisibleTab; TabList _tabs; -- cgit v1.2.3 From 5c12e09ed1e2c2b83d74d824a941220b8faa11c9 Mon Sep 17 00:00:00 2001 From: Zerophase Date: Sun, 6 Apr 2014 19:56:55 -0500 Subject: GUI: Tab cycling handles multiple themes. First visible tab moves up when a theme's width cannot fit another tab. --- gui/widgets/tab.cpp | 16 +++++++++------- gui/widgets/tab.h | 8 +++++--- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp index 3ba6be8166..756781a04b 100644 --- a/gui/widgets/tab.cpp +++ b/gui/widgets/tab.cpp @@ -183,6 +183,7 @@ void TabWidget::setActiveTab(int tabID) { } _activeTab = tabID; _firstWidget = _tabs[tabID].firstWidget; + _boss->draw(); } } @@ -227,28 +228,29 @@ void TabWidget::handleMouseDown(int x, int y, int button, int clickCount) { bool TabWidget::handleKeyDown(Common::KeyState state) { if (state.hasFlags(Common::KBD_SHIFT) && state.keycode == Common::KEYCODE_TAB) - adjustTabs(-kAheadTab); + adjustTabs(kTabBackwards); else if (state.keycode == Common::KEYCODE_TAB) - adjustTabs(kAheadTab); + adjustTabs(kTabForwards); return Widget::handleKeyDown(state); } void TabWidget::adjustTabs(int value) { - // determine which tab is next + // Determine which tab is next int tabID = _activeTab + value; if (tabID >= (int)_tabs.size()) tabID = 0; else if (tabID < 0) tabID = ((int)_tabs.size() - 1); - // slides _firstVisibleTab forward to the correct tab - while (_firstVisibleTab < tabID - kMaxTabs) + // Slides _firstVisibleTab forward to the correct tab + int maxTabsOnScreen = (_w / _tabWidth); + if (tabID >= maxTabsOnScreen && (_firstVisibleTab + maxTabsOnScreen) < (int)_tabs.size()) _firstVisibleTab++; - // slide _firstVisibleTab backwards to the correct tab + // Slides _firstVisibleTab backwards to the correct tab while (tabID < _firstVisibleTab) - _firstVisibleTab--; + _firstVisibleTab--; setActiveTab(tabID); } diff --git a/gui/widgets/tab.h b/gui/widgets/tab.h index bf4176887c..a01ee2d9dc 100644 --- a/gui/widgets/tab.h +++ b/gui/widgets/tab.h @@ -28,6 +28,11 @@ #include "common/array.h" namespace GUI { + +enum { + kTabForwards = 1, + kTabBackwards = -1 +}; class TabWidget : public Widget { typedef Common::String String; @@ -38,9 +43,6 @@ class TabWidget : public Widget { typedef Common::Array TabList; protected: - const int kMaxTabs = 5; - const int kAheadTab = 1; - int _activeTab; int _firstVisibleTab; TabList _tabs; -- cgit v1.2.3 From 8230577153fb15ee588ca3b7e0d43b1e13e49eaa Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 25 Apr 2014 14:30:51 +0300 Subject: FULLPIPE: Implement MGM::recalcOffsets() --- engines/fullpipe/motion.cpp | 46 ++++++++++++++++++++------------------------- engines/fullpipe/motion.h | 2 +- 2 files changed, 21 insertions(+), 27 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index f40c1ae08b..ca20e1f4be 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -2182,9 +2182,8 @@ void MGM::clearMovements2(int idx) { } int MGM::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop) { -#if 0 MGMItem *item = _items[idx]; - int subIdx = st1idx + st2idx * item->staticsListCount; + int subIdx = st1idx + st2idx * item->statics.size(); if (st1idx == st2idx) { memset(&item->subItems[subIdx], 0, sizeof(item->subItems[subIdx])); @@ -2196,8 +2195,8 @@ int MGM::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop) { Common::Point point; - for (int i = 0; i < item->movementListCount; i++) { - mov = item->movements1[i]; + for (int i = 0; i < item->movements1.size(); i++) { + Movement *mov = item->movements1[i]; if (mov->_staticsObj1 == item->statics[st1idx]) { if (!item->movements2[i] && (!flop || mov->_field_50)) { @@ -2205,22 +2204,21 @@ int MGM::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop) { int stidx = getStaticsIndex(idx, item->movements1[i]->_staticsObj2); int recalc = recalcOffsets(idx, stidx, st2idx, flip, flop); + int sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size(); + int newsz = sz + item->subItems[stidx + 6 * st2idx * _items[idx]->statics.size()]->field_C; if (recalc >= 0) { - if (!item->subItems[subIdx].movement || item->subItems[subIdx].field_8 > recalc + 1 || - (item->subItems[subIdx].field_8 == recalc + 1 && item->subItems[subIdx].field_C > v20) { - item->subItems[subIdx].movement = mov; - item->subItems[subIdx].staticsIndex = stidx; - item->subItems[subIdx].field_8 = recalc + 1; - - int sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size(); - - item->subItems[subIdx].field_C = sz + item->subItems[stidx + 6 * st2idx * _items[idx].staticsListCount]->field_C; + if (!item->subItems[subIdx]->movement || item->subItems[subIdx]->field_8 > recalc + 1 || + (item->subItems[subIdx]->field_8 == recalc + 1 && item->subItems[subIdx]->field_C > newsz)) { + item->subItems[subIdx]->movement = mov; + item->subItems[subIdx]->staticsIndex = stidx; + item->subItems[subIdx]->field_8 = recalc + 1; + item->subItems[subIdx]->field_C = newsz; - mov->calcSomeXY(&point, 0); + mov->calcSomeXY(point, 0); - item->subItems[subIdx].x = item->subItems[stidx + 6 * st2idx * _items[idx].staticsListCount]->x + point.x; - item->subItems[subIdx].y = item->subItems[stidx + 6 * st2idx * _items[idx].staticsListCount]->y + point.y; + item->subItems[subIdx]->x = item->subItems[stidx + 6 * st2idx * _items[idx]->statics.size()]->x + point.x; + item->subItems[subIdx]->y = item->subItems[stidx + 6 * st2idx * _items[idx]->statics.size()]->y + point.y; } } } @@ -2235,17 +2233,17 @@ int MGM::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop) { if (recalc >= 0) { if (!item->subItems[subIdx]->movement || item->subItems[subIdx]->field_8 > recalc + 1) { item->subItems[subIdx]->movement = mov; - item->subItems[subIdx].staticsIndex = stidx; - item->subItems[subIdx].field_8 = recalc + 1; + item->subItems[subIdx]->staticsIndex = stidx; + item->subItems[subIdx]->field_8 = recalc + 1; int sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size(); - item->subItems[subIdx].field_C = sz + item->subItems[stidx + 6 * st2idx * _items[idx].staticsListCount]->field_C; + item->subItems[subIdx]->field_C = sz + item->subItems[stidx + 6 * st2idx * _items[idx]->statics.size()]->field_C; - mov->calcSomeXY(&point, 0); + mov->calcSomeXY(point, 0); - item->subItems[subIdx].x = item->subItems[stidx + 6 * st2idx * _items[idx].staticsListCount]->x - point.x; - item->subItems[subIdx].y = item->subItems[stidx + 6 * st2idx * _items[idx].staticsListCount]->y - point.y; + item->subItems[subIdx]->x = item->subItems[stidx + 6 * st2idx * _items[idx]->statics.size()]->x - point.x; + item->subItems[subIdx]->y = item->subItems[stidx + 6 * st2idx * _items[idx]->statics.size()]->y - point.y; } } } @@ -2257,10 +2255,6 @@ int MGM::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop) { return item->subItems[subIdx]->field_8; return -1; -#endif - warning("STUB: MGM::recalcOffsets()"); - - return 0; } Common::Point *MGM::calcLength(Common::Point *pRes, Movement *mov, int x, int y, int *mult, int *len, int flag) { diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 96442cac51..a5c93cecfc 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -138,7 +138,7 @@ struct MGMItem { Common::Array subItems; Common::Array statics; Common::Array movements1; - Common::Array movements2; + Common::Array movements2; MGMItem(); }; -- cgit v1.2.3 From 58648b08948129aafa9c678a18834052254f5b11 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 25 Apr 2014 22:30:10 +0300 Subject: FULLPIPE: Implement StaticANIObject::changeStatics1() --- engines/fullpipe/motion.cpp | 6 ++++++ engines/fullpipe/motion.h | 1 + engines/fullpipe/statics.cpp | 30 ++++++++++++++++++++++++++---- engines/fullpipe/statics.h | 2 +- 4 files changed, 34 insertions(+), 5 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index ca20e1f4be..9ae8acda84 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -1824,6 +1824,12 @@ void MGM::clear() { _items.clear(); } +MessageQueue *MGM::genMQ(StaticANIObject *ani, int staticsIndex, int staticsId, int *resStatId, Common::Point **pointArr) { + warning("STUB: MGM::genMQ()"); + + return 0; +} + MGMItem::MGMItem() { objId = 0; } diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index a5c93cecfc..8bcbf4deac 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -178,6 +178,7 @@ public: int recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop); Common::Point *calcLength(Common::Point *point, Movement *mov, int x, int y, int *mult, int *len, int flag); ExCommand2 *buildExCommand2(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len); + MessageQueue *genMQ(StaticANIObject *ani, int staticsIndex, int staticsId, int *resStatId, Common::Point **pointArr); }; struct MctlLadderMovementVars { diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index a3a160b5b2..4d813d3b0b 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -277,8 +277,11 @@ void StaticANIObject::deleteFromGlobalMessageQueue() { } } -void StaticANIObject::queueMessageQueue(MessageQueue *mq) { - if (isIdle() && !(_flags & 0x80)) { +bool StaticANIObject::queueMessageQueue(MessageQueue *mq) { + if (_flags & 0x80) + return false; + + if (isIdle()) { deleteFromGlobalMessageQueue(); _messageQueueId = 0; _messageNum = 0; @@ -296,6 +299,8 @@ void StaticANIObject::queueMessageQueue(MessageQueue *mq) { _messageQueueId = 0; } } + + return true; } void StaticANIObject::restartMessageQueue(MessageQueue *mq) { @@ -1019,9 +1024,26 @@ void StaticANIObject::adjustSomeXY() { } MessageQueue *StaticANIObject::changeStatics1(int msgNum) { - warning("STUB: StaticANIObject::changeStatics1(%d)", msgNum); + g_fp->_mgm->addItem(_id); - return 0; + MessageQueue *mq = g_fp->_mgm->genMQ(this, msgNum, 0, 0, 0); + + if (!mq) + return 0; + + if (mq->getCount() <= 0) { + g_fp->_globalMessageQueueList->addMessageQueue(mq); + + if (_flags & 1) + _messageQueueId = mq->_id; + } else { + if (!queueMessageQueue(mq)) + return 0; + + g_fp->_globalMessageQueueList->addMessageQueue(mq); + } + + return mq; } void StaticANIObject::changeStatics2(int objId) { diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h index 89703965cd..d5e7d533a7 100644 --- a/engines/fullpipe/statics.h +++ b/engines/fullpipe/statics.h @@ -217,7 +217,7 @@ public: void setAlpha(int alpha); void deleteFromGlobalMessageQueue(); - void queueMessageQueue(MessageQueue *msg); + bool queueMessageQueue(MessageQueue *msg); void restartMessageQueue(MessageQueue *msg); MessageQueue *getMessageQueue(); bool trySetMessageQueue(int msgNum, int qId); -- cgit v1.2.3 From 324aa1a9410b0e2299a847c124f3a8dd994acbc1 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 26 Apr 2014 10:10:09 +0300 Subject: FULLPIPE: Implement MGM::genMQ() --- engines/fullpipe/motion.cpp | 81 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 79 insertions(+), 2 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 9ae8acda84..d62178a9fa 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -1825,9 +1825,86 @@ void MGM::clear() { } MessageQueue *MGM::genMQ(StaticANIObject *ani, int staticsIndex, int staticsId, int *resStatId, Common::Point **pointArr) { - warning("STUB: MGM::genMQ()"); + int idx = getItemIndexById(ani->_id); - return 0; + if (idx == -1) + return 0; + + int stid = staticsId; + + if (!staticsId) { + if (ani->_movement) { + stid = ani->_movement->_staticsObj2->_staticsId; + } else { + if (!ani->_statics) + return 0; + + stid = ani->_statics->_staticsId; + } + } + + if (stid == staticsIndex) + return new MessageQueue(g_fp->_globalMessageQueueList->compact()); + + int startidx = getStaticsIndexById(idx, stid); + int endidx = getStaticsIndexById(idx, staticsIndex); + int subidx = startidx + endidx * _items[idx]->statics.size(); + + if (!_items[idx]->subItems[subidx]->movement) { + clearMovements2(idx); + recalcOffsets(idx, startidx, endidx, 0, 1); + } + + if (!_items[idx]->subItems[subidx]->movement) + return 0; + + MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact()); + Common::Point point; + ExCommand *ex; + + int i = 0; + do { + subidx = startidx + endidx * _items[idx]->statics.size(); + + _items[idx]->subItems[subidx]->movement->calcSomeXY(point, 0); + + if (pointArr) { + int sz; + + if (_items[idx]->subItems[subidx]->movement->_currMovement) + sz = _items[idx]->subItems[subidx]->movement->_currMovement->_dynamicPhases.size(); + else + sz = _items[idx]->subItems[subidx]->movement->_dynamicPhases.size(); + + ex = new ExCommand2(20, ani->_id, &pointArr[i], sz); + + ex->_messageNum = _items[idx]->subItems[subidx]->movement->_id; + } else { + ex = new ExCommand(ani->_id, 1, _items[idx]->subItems[subidx]->movement->_id, 0, 0, 0, 1, 0, 0, 0); + } + + ex->_keyCode = ani->_okeyCode; + ex->_field_3C = 1; + ex->_field_24 = 1; + + mq->addExCommandToEnd(ex); + + if (resStatId) + *resStatId = _items[idx]->subItems[subidx]->movement->_id; + + startidx = _items[idx]->subItems[subidx]->staticsIndex; + + int step; + + if (_items[idx]->subItems[subidx]->movement->_currMovement) + step = _items[idx]->subItems[subidx]->movement->_currMovement->_dynamicPhases.size(); + else + step = _items[idx]->subItems[subidx]->movement->_dynamicPhases.size(); + + i++; + } while (startidx != endidx); + + return mq; } MGMItem::MGMItem() { -- cgit v1.2.3 From 49b6498d2212fa666ba0f6da9a2ec594ba7995e5 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 26 Apr 2014 10:39:34 +0300 Subject: FULLPIPE: Implement MGM::genMovement() --- engines/fullpipe/motion.cpp | 85 ++++++++++++++++++++++++--------------------- engines/fullpipe/motion.h | 1 + 2 files changed, 47 insertions(+), 39 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index d62178a9fa..d6604d8305 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -1964,15 +1964,10 @@ int MGM::getItemIndexById(int objId) { } MessageQueue *MGM::genMovement(MGMInfo *mgminfo) { - warning("STUB: MGM::genMovement()"); - - return 0; - -#if 0 if (!mgminfo->ani) return 0; - mov = mgminfo->ani->_movement; + Movement *mov = mgminfo->ani->_movement; if (!mov && !mgminfo->ani->_statics) return 0; @@ -1984,14 +1979,17 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) { mgminfo->staticsId1 = mgminfo->ani->_statics->_staticsId; } + Common::Point point; + if (!(mgminfo->flags & 0x10) || !(mgminfo->flags & 0x20)) { int nx = mgminfo->ani->_ox; int ny = mgminfo->ani->_oy; if (mgminfo->ani->_movement) { - mgminfo->ani->calcNextStep(&point2); - nx += point2.x; - ny += point2.y; + mgminfo->ani->calcNextStep(&point); + + nx += point.x; + ny += point.y; } if (!(mgminfo->flags & 0x10)) @@ -2006,40 +2004,37 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) { if (!mov) return 0; - itemIdx = getItemIndexById(mgminfo->ani->_id); - subIdx = getStaticsIndexById(itemIdx, mgminfo->staticsId1); - st2idx = getStaticsIndexById(itemIdx, mov->_staticsObj1->_staticsId); - st1idx = getStaticsIndexById(itemIdx, mov->_staticsObj2->_staticsId); - subOffset = getStaticsIndexById(itemIdx, mgminfo->staticsId2); + int itemIdx = getItemIndexById(mgminfo->ani->_id); + int subIdx = getStaticsIndexById(itemIdx, mgminfo->staticsId1); + int st2idx = getStaticsIndexById(itemIdx, mov->_staticsObj1->_staticsId); + int st1idx = getStaticsIndexById(itemIdx, mov->_staticsObj2->_staticsId); + int subOffset = getStaticsIndexById(itemIdx, mgminfo->staticsId2); clearMovements2(itemIdx); recalcOffsets(itemIdx, subIdx, st2idx, 0, 1); clearMovements2(itemIdx); recalcOffsets(itemIdx, st1idx, subOffset, 0, 1); - v71 = (Message *)(28 * itemIdx); - v16 = items[itemIdx].objId; - v17 = *(_DWORD *)(v16 + offsetof(MGMItem, staticsListCount)); - off = *(_DWORD *)(v16 + offsetof(MGMItem, subItems)); - v18 = (MGMSubItem *)(off + 24 * (subIdx + st2idx * v17)); - x1 = (int)&v18->movement->go.CObject.vmt; - v19 = (MGMSubItem *)(off + 24 * (st1idx + subOffset * v17)); - v69 = (LONG)&v19->movement->go.CObject.vmt; + MGMSubItem *sub1 = _items[itemIdx]->subItems[subIdx + st2idx * _items[itemIdx]->statics.size()]; + MGMSubItem *sub2 = _items[itemIdx]->subItems[st1idx + subOffset * _items[itemIdx]->statics.size()]; - if (subIdx != st2idx && !x1) + if (subIdx != st2idx && !sub1->movement) return 0; - if (st1idx != subOffset && !v69) + if (st1idx != subOffset && !sub2->movement) return 0; - int n1x = mgminfo->x1 - mgminfo->x2 - v18->x - v19->x; - int n1y = mgminfo->y1 - mgminfo->y2 - v18->y - v19->y; + int n1x = mgminfo->x1 - mgminfo->x2 - sub1->x - sub2->x; + int n1y = mgminfo->y1 - mgminfo->y2 - sub1->y - sub2->y; + + Common::Point point1; - mov->calcSomeXY(&point1, 0); + mov->calcSomeXY(point1, 0); int n2x = point1.x; int n2y = point1.y; int mult; + int len; if (mgminfo->flags & 0x40) { mult = mgminfo->field_10; @@ -2056,20 +2051,20 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) { len = -1; n2x = mult * point1.x; n1x = mult * point1.x; - mgminfo->x1 = mgminfo->x2 + mult * point1.x + v18->x + v19->x; + mgminfo->x1 = mgminfo->x2 + mult * point1.x + sub1->x + sub2->x; } if (!(mgminfo->flags & 4)) { n2y = mult * point1.y; n1y = mult * point1.y; len = -1; - mgminfo->y1 = mgminfo->y2 + mult * point1.y + v18->y + v19->y; + mgminfo->y1 = mgminfo->y2 + mult * point1.y + sub1->y + sub2->y; } int px = 0; int py = 0; - if (x1) { + if (sub1->movement) { px = countPhases(itemIdx, subIdx, st2idx, 1); py = countPhases(itemIdx, subIdx, st2idx, 2); } @@ -2084,13 +2079,14 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) { py += mov->countPhasesWithFlag(len, 2); } - if (v69) { + if (sub2->movement) { px += countPhases(itemIdx, st1idx, subOffset, 1); py += countPhases(itemIdx, st1idx, subOffset, 2); } int dx1 = n1x - n2x; int dy1 = n1y - n2y; + int x1, y1; if (px) { x1 = (int)((double)dx1 / (double)px); @@ -2104,6 +2100,8 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) { y1 = 0; } + Common::Point x2, y2; + y2.x = dx1 - px * x1; y2.y = dy1 - py * y1; @@ -2120,16 +2118,19 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) { MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact()); ExCommand2 *ex2; - for (v42 = subIdx; v42 != st2idx; v42 = v43->staticsIndex) { - v43 = &(*(MGMSubItem **)((char *)&this->items->subItems + (unsigned int)v71))[v42 + st2idx * *(int *)((char *)&this->items->staticsListCount + (unsigned int)v71)]; - ex2 = buildExCommand2(v43->movement, mgminfo->ani->go._id, x1, y1, &x2, &y2, -1); + for (int i = subIdx; i != st2idx;) { + MGMSubItem *s = _items[itemIdx]->subItems[i + subOffset * _items[itemIdx]->statics.size()]; + + ex2 = buildExCommand2(s->movement, mgminfo->ani->_id, x1, y1, &x2, &y2, -1); ex2->_parId = mq->_id; ex2->_keyCode = mgminfo->ani->_okeyCode; mq->addExCommandToEnd(ex2); + + i = s->staticsIndex; } - for (i = 0; i < mult; ++i) { + for (int i = 0; i < mult; ++i) { int plen; if (i == mult - 1) @@ -2144,14 +2145,16 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) { mq->addExCommandToEnd(ex2); } - for (j = st1idx; j != subOffset; j = v50->staticsIndex) { - v50 = &(*(MGMSubItem **)((char *)&this->items->subItems + (unsigned int)v71))[j + subOffset * *(int *)((char *)&this->items->staticsListCount + (unsigned int)v71)]; + for (int j = st1idx; j != subOffset;) { + MGMSubItem *s = _items[itemIdx]->subItems[j + subOffset * _items[itemIdx]->statics.size()]; - ex2 = buildExCommand2(v50->movement, mgminfo->ani->_id, x1, y1, &x2, &y2, -1); + ex2 = buildExCommand2(s->movement, mgminfo->ani->_id, x1, y1, &x2, &y2, -1); ex2->_parId = mq->_id; ex2->_keyCode = mgminfo->ani->_okeyCode; mq->addExCommandToEnd(ex2); + + j = s->staticsIndex; } ExCommand *ex = new ExCommand(mgminfo->ani->_id, 5, -1, mgminfo->x1, mgminfo->y1, 0, 1, 0, 0, 0); @@ -2164,9 +2167,13 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) { mq->addExCommandToEnd(ex); return mq; -#endif } +int MGM::countPhases(int idx, int subIdx, int subOffset, int flag) { + warning("STUB: MGM::countPhases"); + + return 0; +} void MGM::updateAnimStatics(StaticANIObject *ani, int staticsId) { if (getItemIndexById(ani->_id) == -1) return; diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 8bcbf4deac..6d6335b5cf 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -179,6 +179,7 @@ public: Common::Point *calcLength(Common::Point *point, Movement *mov, int x, int y, int *mult, int *len, int flag); ExCommand2 *buildExCommand2(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len); MessageQueue *genMQ(StaticANIObject *ani, int staticsIndex, int staticsId, int *resStatId, Common::Point **pointArr); + int countPhases(int idx, int subIdx, int subOffset, int flag); }; struct MctlLadderMovementVars { -- cgit v1.2.3 From 8d15423f42933d6cc58ea53d26a059135508cfed Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 26 Apr 2014 10:45:01 +0300 Subject: FULLPIPE: Implement MGM::countPhases() --- engines/fullpipe/motion.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index d6604d8305..397af298dd 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -2169,10 +2169,22 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) { return mq; } -int MGM::countPhases(int idx, int subIdx, int subOffset, int flag) { - warning("STUB: MGM::countPhases"); +int MGM::countPhases(int idx, int subIdx, int endIdx, int flag) { + int res = 0; - return 0; + if (endIdx < 0) + return 0; + + while (subIdx != endIdx) { + if (subIdx < 0) + break; + + res += _items[idx]->subItems[subIdx + endIdx * _items[idx]->statics.size()]->movement->countPhasesWithFlag(-1, flag); + + subIdx = _items[idx]->subItems[subIdx + 6 * endIdx * _items[idx]->statics.size()]->staticsIndex; + } + + return res; } void MGM::updateAnimStatics(StaticANIObject *ani, int staticsId) { if (getItemIndexById(ani->_id) == -1) -- cgit v1.2.3 From 20f14713dab4452420a19e63ec0648d834001dcf Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 26 Apr 2014 12:03:58 +0300 Subject: FULLPIPE: Implement MGM::refreshOffsets() --- engines/fullpipe/motion.cpp | 20 ++++++++++++++++++++ engines/fullpipe/motion.h | 1 + 2 files changed, 21 insertions(+) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 397af298dd..d2eaf0674f 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -2359,6 +2359,26 @@ int MGM::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop) { return -1; } +int MGM::refreshOffsets(int objectId, int idx1, int idx2) { + int idx = getItemIndexById(objectId); + + if (idx != -1) { + int from = getStaticsIndexById(idx, idx1); + int to = getStaticsIndexById(idx, idx2); + + MGMSubItem *sub = _items[idx]->subItems[from + to * _items[idx]->statics.size()]; + + if (sub->movement) { + idx = sub->field_8; + } else { + clearMovements2(idx); + idx = recalcOffsets(idx, from, to, 0, 1); + } + } + + return idx; +} + Common::Point *MGM::calcLength(Common::Point *pRes, Movement *mov, int x, int y, int *mult, int *len, int flag) { Common::Point point; diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 6d6335b5cf..4d92fd7fed 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -180,6 +180,7 @@ public: ExCommand2 *buildExCommand2(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len); MessageQueue *genMQ(StaticANIObject *ani, int staticsIndex, int staticsId, int *resStatId, Common::Point **pointArr); int countPhases(int idx, int subIdx, int subOffset, int flag); + int refreshOffsets(int objectId, int idx1, int idx2); }; struct MctlLadderMovementVars { -- cgit v1.2.3 From c55398cd4bf07dc21b557339fe37cde61a2bcaa4 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 26 Apr 2014 12:08:37 +0300 Subject: FULLPIPE: Implement clearGlobalMessageQueueList() --- engines/fullpipe/messages.cpp | 4 ++++ engines/fullpipe/messages.h | 1 + 2 files changed, 5 insertions(+) diff --git a/engines/fullpipe/messages.cpp b/engines/fullpipe/messages.cpp index 9c8f5ac4e2..8257d1459f 100644 --- a/engines/fullpipe/messages.cpp +++ b/engines/fullpipe/messages.cpp @@ -699,6 +699,10 @@ void GlobalMessageQueueList::addMessageQueue(MessageQueue *msg) { push_back(msg); } +void clearGlobalMessageQueueList() { + g_fp->_globalMessageQueueList->clear(); +} + void clearGlobalMessageQueueList1() { clearMessages(); diff --git a/engines/fullpipe/messages.h b/engines/fullpipe/messages.h index da579d58c0..e6f7f05150 100644 --- a/engines/fullpipe/messages.h +++ b/engines/fullpipe/messages.h @@ -193,6 +193,7 @@ void clearMessageHandlers(); void processMessages(); void updateGlobalMessageQueue(int id, int objid); void clearMessages(); +void clearGlobalMessageQueueList(); void clearGlobalMessageQueueList1(); bool chainQueue(int queueId, int flags); -- cgit v1.2.3 From da23bd077243d80bef4c7cb759a5fe40a64eb76e Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 26 Apr 2014 12:18:53 +0300 Subject: FULLPIPE: Implement global_messageHandler_KickMetal() --- engines/fullpipe/constants.h | 5 +++++ engines/fullpipe/messagehandlers.cpp | 25 ++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h index 8f3f587714..f76a12fb2b 100644 --- a/engines/fullpipe/constants.h +++ b/engines/fullpipe/constants.h @@ -43,6 +43,8 @@ namespace Fullpipe { #define MV_LFT_OPEN 1048 #define MV_MAN_GOLADDER 451 #define MV_MAN_GOLADDER2 2844 +#define MV_MAN_HMRKICK 1028 +#define MV_MAN_HMRKICK_COINLESS 1445 #define MV_MAN_LIFTDOWN 1052 #define MV_MAN_LIFTUP 1051 #define MV_MAN_LOOKUP 4773 @@ -219,8 +221,11 @@ namespace Fullpipe { #define SC_MAINMENU 4620 #define SC_MAP 5222 #define SC_TITLES 5166 +#define SND_CMN_015 3139 #define SND_CMN_031 3516 #define SND_CMN_032 3517 +#define SND_CMN_054 4762 +#define SND_CMN_055 4763 #define SND_CMN_060 4921 #define SND_CMN_061 4922 #define SND_CMN_070 5199 diff --git a/engines/fullpipe/messagehandlers.cpp b/engines/fullpipe/messagehandlers.cpp index 17af2bf4fd..bc757bcb98 100644 --- a/engines/fullpipe/messagehandlers.cpp +++ b/engines/fullpipe/messagehandlers.cpp @@ -38,7 +38,30 @@ void global_messageHandler_KickStucco() { } void global_messageHandler_KickMetal() { - warning("STUB: global_messageHandler_KickMetal()"); + Movement *mov = g_fp->_aniMan->getMovementById(MV_MAN_HMRKICK); + + int end = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size(); + + for (int i = 0; i < end; i++) { + ExCommand *ex = mov->getDynamicPhaseByIndex(i)->_exCommand; + + if (ex) + if (ex->_messageKind == 35) + if (ex->_messageNum == SND_CMN_054 || ex->_messageNum == SND_CMN_055) + ex->_messageNum = SND_CMN_015; + } + + mov = g_fp->_aniMan->getMovementById(MV_MAN_HMRKICK_COINLESS); + end = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size(); + + for (int i = 0; i < end; i++) { + ExCommand *ex = mov->getDynamicPhaseByIndex(i)->_exCommand; + + if (ex) + if (ex->_messageKind == 35) + if (ex->_messageNum == SND_CMN_054 || ex->_messageNum == SND_CMN_055) + ex->_messageNum = SND_CMN_015; + } } int global_messageHandler1(ExCommand *cmd) { -- cgit v1.2.3 From 04ca386e6808e66d97f60d66c45954699ec8ef26 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 26 Apr 2014 12:23:37 +0300 Subject: FULLPIPE: Implement global_messageHandler_KickStucco() --- engines/fullpipe/messagehandlers.cpp | 39 ++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/engines/fullpipe/messagehandlers.cpp b/engines/fullpipe/messagehandlers.cpp index bc757bcb98..15aa78d342 100644 --- a/engines/fullpipe/messagehandlers.cpp +++ b/engines/fullpipe/messagehandlers.cpp @@ -34,12 +34,47 @@ namespace Fullpipe { void global_messageHandler_KickStucco() { - warning("STUB: global_messageHandler_KickStucco()"); + Movement *mov = g_fp->_aniMan->getMovementById(MV_MAN_HMRKICK); + int end = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size(); + bool flip = false; + + for (int i = 0; i < end; i++) { + ExCommand *ex = mov->getDynamicPhaseByIndex(i)->_exCommand; + + if (ex) + if (ex->_messageKind == 35) + if (ex->_messageNum == SND_CMN_015) { + if (flip) { + ex->_messageNum = SND_CMN_055; + } else { + ex->_messageNum = SND_CMN_054; + flip = true; + } + } + } + + mov = g_fp->_aniMan->getMovementById(MV_MAN_HMRKICK_COINLESS); + end = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size(); + flip = false; + + for (int i = 0; i < end; i++) { + ExCommand *ex = mov->getDynamicPhaseByIndex(i)->_exCommand; + + if (ex) + if (ex->_messageKind == 35) + if (ex->_messageNum == SND_CMN_015) { + if (flip) { + ex->_messageNum = SND_CMN_055; + } else { + ex->_messageNum = SND_CMN_054; + flip = true; + } + } + } } void global_messageHandler_KickMetal() { Movement *mov = g_fp->_aniMan->getMovementById(MV_MAN_HMRKICK); - int end = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size(); for (int i = 0; i < end; i++) { -- cgit v1.2.3 From cb565e9eafc34b26d160dd4c5c4cf64e05872498 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 26 Apr 2014 13:13:07 +0300 Subject: FULLPIPE: Implement FullpipeEngine::toggleMute() --- engines/fullpipe/sound.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index aa91f25087..03e350bf85 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -158,7 +158,11 @@ void FullpipeEngine::stopAllSounds() { } void FullpipeEngine::toggleMute() { - warning("STUB: FullpipeEngine::toggleMute()"); + if (g_fp->_soundEnabled) { + g_fp->_sfxVolume = g_fp->_sfxVolume != -10000 ? -10000 : 0; + + updateSoundVolume(); + } } void FullpipeEngine::playSound(int id, int flag) { -- cgit v1.2.3 From aad1d556d657bdb39c1cd0b896f90cd09d5dd5aa Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 26 Apr 2014 13:18:55 +0300 Subject: FULLPIPE: Implement FullpipeEngine::updateSoundVolume() --- engines/fullpipe/sound.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index 03e350bf85..774c687d54 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -208,7 +208,10 @@ void FullpipeEngine::stopAllSoundInstances(int id) { } void FullpipeEngine::updateSoundVolume() { - debug(3, "STUB FullpipeEngine::updateSoundVolume()"); + for (int i = 0; i < _currSoundListCount; i++) + for (int j = 0; i < _currSoundList1[i]->getCount(); j++) { + g_fp->_currSoundList1[i]->getSoundByIndex(j)->setPanAndVolume(g_fp->_sfxVolume, 0); + } } void FullpipeEngine::setMusicVolume(int vol) { -- cgit v1.2.3 From fd8eb9a0e39ebeaa8f0bc69577e1d0cd4e94b8a6 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 26 Apr 2014 14:02:04 +0300 Subject: FULLPIPE: Implement FullpipeEngine::processArcade() --- engines/fullpipe/input.cpp | 33 +++++++++++++++++++++++++++++++++ engines/fullpipe/scenes.cpp | 4 ---- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/engines/fullpipe/input.cpp b/engines/fullpipe/input.cpp index 0678d15368..3d6f53c7f3 100644 --- a/engines/fullpipe/input.cpp +++ b/engines/fullpipe/input.cpp @@ -275,6 +275,8 @@ void FullpipeEngine::updateCursorCommon() { } void FullpipeEngine::initArcadeKeys(const char *varname) { + _arcadeKeys.clear(); + GameVar *var = getGameLoaderGameVar()->getSubVarByName(varname)->getSubVarByName("KEYPOS"); if (!var) @@ -294,6 +296,37 @@ void FullpipeEngine::initArcadeKeys(const char *varname) { } } +void FullpipeEngine::processArcade(ExCommand *cmd) { + if (!g_fp->_aniMan2) + return; + + int idx; + + if (cmd->_sceneClickX <= g_fp->_aniMan2->_ox) { + for (idx = _arcadeKeys.size() - 1; idx >= 0; idx--) { + if (_arcadeKeys[idx]->x < g_fp->_aniMan2->_ox) + break; + } + + if (idx < 0) + return; + } else { + for (idx = 0; idx < _arcadeKeys.size(); idx++) { + if (_arcadeKeys[idx]->x > g_fp->_aniMan2->_ox) + break; + } + + if (idx >= _arcadeKeys.size()) + return; + } + + cmd->_sceneClickX = _arcadeKeys[idx]->x; + cmd->_sceneClickY = _arcadeKeys[idx]->y; + + cmd->_x = cmd->_sceneClickX - g_fp->_sceneRect.left; + cmd->_y = cmd->_sceneClickY - g_fp->_sceneRect.top; +} + void FullpipeEngine::setArcadeOverlay(int picId) { Common::Point point; Common::Point point2; diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp index 47c6a3c8cd..7420c1b1cf 100644 --- a/engines/fullpipe/scenes.cpp +++ b/engines/fullpipe/scenes.cpp @@ -1106,10 +1106,6 @@ int defaultUpdateCursor() { return g_fp->_cursorId; } -void FullpipeEngine::processArcade(ExCommand *ex) { - warning("STUB: FullpipeEngine::processArcade()"); -} - void FullpipeEngine::updateMapPiece(int mapId, int update) { for (int i = 0; i < 200; i++) { int hiWord = (_mapTable[i] >> 16) & 0xffff; -- cgit v1.2.3 From d12d69631d9a01dcf06d06b5271034769117035a Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 26 Apr 2014 14:22:50 +0300 Subject: FULLPIPE: Implement FullpipeEngine::playTrack() --- engines/fullpipe/fullpipe.cpp | 12 ++++++++++ engines/fullpipe/fullpipe.h | 11 +++++++++ engines/fullpipe/sound.cpp | 56 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+) diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index 246510e227..5369c05de7 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -104,6 +104,18 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc) _musicAllowed = -1; _musicGameVar = 0; + _musicMinDelay = 0; + _musicMaxDelay = 0; + _musicLocal = 0; + _trackStartDelay = 0; + + memset(_sceneTracks, 0, sizeof(_sceneTracks)); + memset(_trackName, 0, sizeof(_trackName)); + memset(_sceneTracksCurrentTrack, 0, sizeof(_sceneTracksCurrentTrack)); + + _numSceneTracks = 0; + _sceneTrackHasSequence = false; + _sceneTrackIsPlaying = false; _aniMan = 0; _aniMan2 = 0; diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index 5718b16ab3..989971eaab 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -151,6 +151,16 @@ public: int _currSoundListCount; bool _soundEnabled; bool _flgSoundList; + char _sceneTracks[10][260]; + int _numSceneTracks; + bool _sceneTrackHasSequence; + int _musicMinDelay; + int _musicMaxDelay; + int _musicLocal; + char _trackName[2600]; + int _trackStartDelay; + char _sceneTracksCurrentTrack[260]; + bool _sceneTrackIsPlaying; void stopAllSounds(); void toggleMute(); @@ -300,6 +310,7 @@ public: GameVar *_musicGameVar; Audio::SoundHandle _sceneTrackHandle; + public: bool _isSaveAllowed; diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index 774c687d54..10d020b494 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -182,6 +182,62 @@ void FullpipeEngine::playSound(int id, int flag) { void FullpipeEngine::playTrack(GameVar *sceneVar, const char *name, bool delayed) { warning("STUB: FullpipeEngine::playTrack(var, %s, %d)", name, delayed); +#if 0 + stopSoundStream2(); + + if (soundStream3) + FSOUND_Stream_Stop(soundStream4); +#endif + + if (g_fp->_musicLocal) + stopAllSoundStreams(); + + GameVar *var = sceneVar->getSubVarByName(name); + + memset(g_fp->_sceneTracks, 0, sizeof(g_fp->_sceneTracks)); + + g_fp->_numSceneTracks = 0; + g_fp->_sceneTrackHasSequence = false; + + if (!var) + return; + + g_fp->_musicGameVar = var; + + GameVar *tr = var->getSubVarByName("TRACKS"); + if (tr) { + GameVar *sub = tr->_subVars; + + while (sub) { + if (g_fp->_musicAllowed & sub->_value.intValue) { + strcpy(g_fp->_sceneTracks[g_fp->_numSceneTracks], sub->_varName); + + g_fp->_numSceneTracks++; + } + + sub = sub->_nextVarObj; + } + } + + g_fp->_musicMinDelay = var->getSubVarAsInt("MINDELAY"); + g_fp->_musicMaxDelay = var->getSubVarAsInt("MAXDELAY"); + g_fp->_musicLocal = var->getSubVarAsInt("LOCAL"); + + GameVar *seq = var->getSubVarByName("SEQUENCE"); + if (seq) { + g_fp->_sceneTrackHasSequence = true; + + strcpy(g_fp->_trackName, seq->_value.stringValue); + } + + if (delayed) { + if (g_fp->_sceneTrackIsPlaying && g_fp->_numSceneTracks == 1) { + if (strcmp(g_fp->_sceneTracksCurrentTrack, g_fp->_sceneTracks[0])) + stopAllSoundStreams(); + } + + g_fp->_trackStartDelay = var->getSubVarAsInt("STARTDELAY"); + } } void global_messageHandler_handleSound(ExCommand *cmd) { -- cgit v1.2.3 From 81b24d0c4042cec0b11fff73c5594f386c06418e Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 26 Apr 2014 14:34:12 +0300 Subject: FULLPIPE: Proper implementation of FullpipeEngine::startSceneTrack() --- engines/fullpipe/fullpipe.h | 2 ++ engines/fullpipe/sound.cpp | 37 +++++++++++++++++++++++++++++++------ 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index 989971eaab..27505252ab 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -166,7 +166,9 @@ public: void toggleMute(); void playSound(int id, int flag); void playTrack(GameVar *sceneVar, const char *name, bool delayed); + int getSceneTrack(); void startSceneTrack(); + void startSoundStream1(char *trackName); void stopSoundStream2(); void stopAllSoundStreams(); void stopAllSoundInstances(int id); diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index 10d020b494..8071129e5c 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -131,16 +131,41 @@ void FullpipeEngine::setSceneMusicParameters(GameVar *var) { } void FullpipeEngine::startSceneTrack() { - // TODO: Finish this + if (!g_fp->_sceneTrackIsPlaying && g_fp->_numSceneTracks > 0) { + if (g_fp->_trackStartDelay > 0) { + g_fp->_trackStartDelay--; + } else { + int trackNum = getSceneTrack(); + + if (trackNum == -1) { + strcpy(g_fp->_sceneTracksCurrentTrack, "silence"); + + g_fp->_trackStartDelay = 2880; + g_fp->_sceneTrackIsPlaying = 0; + } else { + strcpy(g_fp->_sceneTracksCurrentTrack, g_fp->_sceneTracks[trackNum]); + + startSoundStream1(g_fp->_sceneTracksCurrentTrack); + + g_fp->_sceneTrackIsPlaying = 1; + } + } + } +} + +int FullpipeEngine::getSceneTrack() { + warning("STUB: FullpipeEngine::getSceneTrack()"); + + return -1; +} + +void FullpipeEngine::startSoundStream1(char *trackName) { + stopAllSoundStreams(); + #ifdef USE_VORBIS if (g_fp->_mixer->isSoundHandleActive(_sceneTrackHandle)) return; - GameVar *musicTrackVar = _musicGameVar->getSubVarByName("MUSIC")->getSubVarByName("TRACKS")->_subVars; - if (!musicTrackVar) - return; - - char *trackName = musicTrackVar->_varName; Common::File *track = new Common::File(); if (!track->open(trackName)) { warning("Could not open %s", trackName); -- cgit v1.2.3 From e804b8fa2c6f7f60523b19b5fdc96371d009b729 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 26 Apr 2014 14:43:08 +0300 Subject: FULLPIPE: Implement FullpipeEngine::getSceneTrack() --- engines/fullpipe/sound.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index 8071129e5c..1d58f8bc16 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -154,9 +154,31 @@ void FullpipeEngine::startSceneTrack() { } int FullpipeEngine::getSceneTrack() { - warning("STUB: FullpipeEngine::getSceneTrack()"); + int res; - return -1; + if (_sceneTrackHasSequence) { + int num = _musicGameVar->getSubVarAsInt("TRACKS"); + + if (_trackName[num + 1] == 's') { // 'silence' + res = -1; + } else { + res = _trackName[num + 1] - '0'; + + if (res < 0 || res >= _numSceneTracks) + res = 0; + } + + int track = num + 1; + + if (!_trackName[num + 2]) + track = 0; + + _musicGameVar->setSubVarAsInt("TRACKS", track); + } else { + res = _numSceneTracks * (_updateTicks % 10) / 10; + } + + return res; } void FullpipeEngine::startSoundStream1(char *trackName) { -- cgit v1.2.3 From 4598f48fd6a42501e545e275d08b3ec0aadb96a6 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 26 Apr 2014 14:47:18 +0300 Subject: FULLPIPE: Remove redundant object casts --- engines/fullpipe/sound.cpp | 76 ++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index 1d58f8bc16..fd84bcde43 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -131,23 +131,23 @@ void FullpipeEngine::setSceneMusicParameters(GameVar *var) { } void FullpipeEngine::startSceneTrack() { - if (!g_fp->_sceneTrackIsPlaying && g_fp->_numSceneTracks > 0) { - if (g_fp->_trackStartDelay > 0) { - g_fp->_trackStartDelay--; + if (!_sceneTrackIsPlaying && _numSceneTracks > 0) { + if (_trackStartDelay > 0) { + _trackStartDelay--; } else { int trackNum = getSceneTrack(); if (trackNum == -1) { - strcpy(g_fp->_sceneTracksCurrentTrack, "silence"); + strcpy(_sceneTracksCurrentTrack, "silence"); - g_fp->_trackStartDelay = 2880; - g_fp->_sceneTrackIsPlaying = 0; + _trackStartDelay = 2880; + _sceneTrackIsPlaying = 0; } else { - strcpy(g_fp->_sceneTracksCurrentTrack, g_fp->_sceneTracks[trackNum]); + strcpy(_sceneTracksCurrentTrack, _sceneTracks[trackNum]); - startSoundStream1(g_fp->_sceneTracksCurrentTrack); + startSoundStream1(_sceneTracksCurrentTrack); - g_fp->_sceneTrackIsPlaying = 1; + _sceneTrackIsPlaying = true; } } } @@ -185,7 +185,7 @@ void FullpipeEngine::startSoundStream1(char *trackName) { stopAllSoundStreams(); #ifdef USE_VORBIS - if (g_fp->_mixer->isSoundHandleActive(_sceneTrackHandle)) + if (_mixer->isSoundHandleActive(_sceneTrackHandle)) return; Common::File *track = new Common::File(); @@ -195,26 +195,27 @@ void FullpipeEngine::startSoundStream1(char *trackName) { return; } Audio::RewindableAudioStream *ogg = Audio::makeVorbisStream(track, DisposeAfterUse::YES); - g_fp->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_sceneTrackHandle, ogg); + _mixer->playStream(Audio::Mixer::kMusicSoundType, &_sceneTrackHandle, ogg); #endif } void FullpipeEngine::stopAllSounds() { // TODO: Differences from stopAllSoundStreams() - g_fp->_mixer->stopAll(); + _mixer->stopAll(); } void FullpipeEngine::toggleMute() { - if (g_fp->_soundEnabled) { - g_fp->_sfxVolume = g_fp->_sfxVolume != -10000 ? -10000 : 0; + if (_soundEnabled) { + _sfxVolume = _sfxVolume != -10000 ? -10000 : 0; updateSoundVolume(); } } void FullpipeEngine::playSound(int id, int flag) { - SoundList *soundList = g_fp->_currentScene->_soundList; + SoundList *soundList = _currentScene->_soundList; Sound *sound = soundList->getSoundById(id); + if (!sound) { warning("playSound: Can't find sound with ID %d", id); return; @@ -224,7 +225,7 @@ void FullpipeEngine::playSound(int id, int flag) { Audio::RewindableAudioStream *wav = Audio::makeWAVStream(dataStream, DisposeAfterUse::YES); Audio::AudioStream *audioStream = new Audio::LoopingAudioStream(wav, (flag == 1) ? 0 : 1); Audio::SoundHandle handle = sound->getHandle(); - g_fp->_mixer->playStream(Audio::Mixer::kSFXSoundType, &handle, audioStream); + _mixer->playStream(Audio::Mixer::kSFXSoundType, &handle, audioStream); } void FullpipeEngine::playTrack(GameVar *sceneVar, const char *name, bool delayed) { @@ -236,54 +237,55 @@ void FullpipeEngine::playTrack(GameVar *sceneVar, const char *name, bool delayed FSOUND_Stream_Stop(soundStream4); #endif - if (g_fp->_musicLocal) + if (_musicLocal) stopAllSoundStreams(); GameVar *var = sceneVar->getSubVarByName(name); - memset(g_fp->_sceneTracks, 0, sizeof(g_fp->_sceneTracks)); + memset(_sceneTracks, 0, sizeof(_sceneTracks)); - g_fp->_numSceneTracks = 0; - g_fp->_sceneTrackHasSequence = false; + _numSceneTracks = 0; + _sceneTrackHasSequence = false; if (!var) return; - g_fp->_musicGameVar = var; + _musicGameVar = var; GameVar *tr = var->getSubVarByName("TRACKS"); if (tr) { GameVar *sub = tr->_subVars; while (sub) { - if (g_fp->_musicAllowed & sub->_value.intValue) { - strcpy(g_fp->_sceneTracks[g_fp->_numSceneTracks], sub->_varName); + if (_musicAllowed & sub->_value.intValue) { + strcpy(_sceneTracks[_numSceneTracks], sub->_varName); - g_fp->_numSceneTracks++; + _numSceneTracks++; } sub = sub->_nextVarObj; } } - g_fp->_musicMinDelay = var->getSubVarAsInt("MINDELAY"); - g_fp->_musicMaxDelay = var->getSubVarAsInt("MAXDELAY"); - g_fp->_musicLocal = var->getSubVarAsInt("LOCAL"); + _musicMinDelay = var->getSubVarAsInt("MINDELAY"); + _musicMaxDelay = var->getSubVarAsInt("MAXDELAY"); + _musicLocal = var->getSubVarAsInt("LOCAL"); GameVar *seq = var->getSubVarByName("SEQUENCE"); + if (seq) { - g_fp->_sceneTrackHasSequence = true; + _sceneTrackHasSequence = true; - strcpy(g_fp->_trackName, seq->_value.stringValue); + strcpy(_trackName, seq->_value.stringValue); } if (delayed) { - if (g_fp->_sceneTrackIsPlaying && g_fp->_numSceneTracks == 1) { - if (strcmp(g_fp->_sceneTracksCurrentTrack, g_fp->_sceneTracks[0])) + if (_sceneTrackIsPlaying && _numSceneTracks == 1) { + if (strcmp(_sceneTracksCurrentTrack, _sceneTracks[0])) stopAllSoundStreams(); } - g_fp->_trackStartDelay = var->getSubVarAsInt("STARTDELAY"); + _trackStartDelay = var->getSubVarAsInt("STARTDELAY"); } } @@ -297,15 +299,17 @@ void FullpipeEngine::stopSoundStream2() { void FullpipeEngine::stopAllSoundStreams() { // TODO: Differences from stopAllSounds() - g_fp->_mixer->stopAll(); + _mixer->stopAll(); } void FullpipeEngine::stopAllSoundInstances(int id) { - SoundList *soundList = g_fp->_currentScene->_soundList; + SoundList *soundList = _currentScene->_soundList; + for (int i = 0; i < soundList->getCount(); i++) { Sound *sound = soundList->getSoundByIndex(i); + if (sound->getId() == id) { - g_fp->_mixer->stopHandle(sound->getHandle()); + _mixer->stopHandle(sound->getHandle()); } } } @@ -313,7 +317,7 @@ void FullpipeEngine::stopAllSoundInstances(int id) { void FullpipeEngine::updateSoundVolume() { for (int i = 0; i < _currSoundListCount; i++) for (int j = 0; i < _currSoundList1[i]->getCount(); j++) { - g_fp->_currSoundList1[i]->getSoundByIndex(j)->setPanAndVolume(g_fp->_sfxVolume, 0); + _currSoundList1[i]->getSoundByIndex(j)->setPanAndVolume(_sfxVolume, 0); } } -- cgit v1.2.3 From ba14a54d791bb59442c172a0f966a5b13b6a569b Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 26 Apr 2014 15:00:36 +0300 Subject: FULLPIPE: Implement FullpipeEngine::setSceneMusicParameters() --- engines/fullpipe/sound.cpp | 59 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index fd84bcde43..d0f8fbd21b 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -123,11 +123,62 @@ void Sound::setPanAndVolume(int vol, int pan) { warning("STUB: Sound::setPanAndVolume"); } -void FullpipeEngine::setSceneMusicParameters(GameVar *var) { +void FullpipeEngine::setSceneMusicParameters(GameVar *gvar) { warning("STUB: FullpipeEngine::setSceneMusicParameters()"); - // TODO: Finish this (MINDELAY, MAXDELAY, LOCAL, SEQUENCE, STARTDELAY etc) - stopAllSoundStreams(); +#if 0 + stopSoundStream2(); + + if (soundStream3) + FSOUND_Stream_Stop(soundStream4); +#endif + + if (_musicLocal) + stopAllSoundStreams(); + + GameVar *var = gvar->getSubVarByName("MUSIC"); + + memset(_sceneTracks, 0, sizeof(_sceneTracks)); + + _numSceneTracks = 0; + _sceneTrackHasSequence = false; + + if (!var) + return; + _musicGameVar = var; + + GameVar *tr = var->getSubVarByName("TRACKS"); + if (tr) { + GameVar *sub = tr->_subVars; + + while (sub) { + if (_musicAllowed & sub->_value.intValue) { + strcpy(_sceneTracks[_numSceneTracks], sub->_varName); + + _numSceneTracks++; + } + + sub = sub->_nextVarObj; + } + } + + _musicMinDelay = var->getSubVarAsInt("MINDELAY"); + _musicMaxDelay = var->getSubVarAsInt("MAXDELAY"); + _musicLocal = var->getSubVarAsInt("LOCAL"); + + GameVar *seq = var->getSubVarByName("SEQUENCE"); + + if (seq) { + _sceneTrackHasSequence = true; + + strcpy(_trackName, seq->_value.stringValue); + } + + if (_musicLocal) + stopAllSoundStreams(); + + if (!_sceneTrackIsPlaying || _musicLocal) + _trackStartDelay = var->getSubVarAsInt("STARTDELAY"); } void FullpipeEngine::startSceneTrack() { @@ -182,6 +233,8 @@ int FullpipeEngine::getSceneTrack() { } void FullpipeEngine::startSoundStream1(char *trackName) { + warning("STUB: FullpipeEngine::startSoundStream1(%s)", trackName); + stopAllSoundStreams(); #ifdef USE_VORBIS -- cgit v1.2.3 From 2f10c8ec55e5e8f43f6932199ec3bc402e0ec139 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 26 Apr 2014 15:06:23 +0300 Subject: FULLPIPE: Proper implementation of FullpipeEngine::playSound() --- engines/fullpipe/sound.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index d0f8fbd21b..628d352e54 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -266,13 +266,20 @@ void FullpipeEngine::toggleMute() { } void FullpipeEngine::playSound(int id, int flag) { - SoundList *soundList = _currentScene->_soundList; - Sound *sound = soundList->getSoundById(id); + Sound *sound = 0; + + for (int i = 0; i < _currSoundListCount; i++) { + sound = _currSoundList1[i]->getSoundById(id); + + if (sound) + break; + } if (!sound) { warning("playSound: Can't find sound with ID %d", id); return; } + byte *soundData = sound->loadData(); Common::MemoryReadStream *dataStream = new Common::MemoryReadStream(soundData, sound->getDataSize()); Audio::RewindableAudioStream *wav = Audio::makeWAVStream(dataStream, DisposeAfterUse::YES); -- cgit v1.2.3 From 4d81792b450370af8061b1422399a22bd56c1df0 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 26 Apr 2014 16:25:01 +0300 Subject: FULLPIPE: Implement global_messageHandler_handleSound() --- engines/fullpipe/sound.cpp | 48 +++++++++++++++++++++++++++++++++++++++++++++- engines/fullpipe/sound.h | 6 ++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index 628d352e54..8280d64b6e 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -26,6 +26,7 @@ #include "fullpipe/scene.h" #include "fullpipe/sound.h" #include "fullpipe/ngiarchive.h" +#include "fullpipe/messages.h" #include "common/memstream.h" #include "audio/audiostream.h" #include "audio/decoders/vorbis.h" @@ -80,6 +81,7 @@ Sound::Sound() { _objectId = 0; memset(_directSoundBuffers, 0, sizeof(_directSoundBuffers)); _description = 0; + _volume = 100; } Sound::~Sound() { @@ -123,6 +125,24 @@ void Sound::setPanAndVolume(int vol, int pan) { warning("STUB: Sound::setPanAndVolume"); } +void Sound::play(int flag) { + warning("STUB: Sound::play()"); +} + +void Sound::freeSound() { + warning("STUB: Sound::freeSound()"); +} + +int Sound::getVolume() { + warning("STUB: Sound::getVolume()"); + + return _volume; +} + +void Sound::stop() { + warning("STUB: Sound::stop()"); +} + void FullpipeEngine::setSceneMusicParameters(GameVar *gvar) { warning("STUB: FullpipeEngine::setSceneMusicParameters()"); #if 0 @@ -350,7 +370,33 @@ void FullpipeEngine::playTrack(GameVar *sceneVar, const char *name, bool delayed } void global_messageHandler_handleSound(ExCommand *cmd) { - debug(0, "STUB: global_messageHandler_handleSound()"); + if (!g_fp->_soundEnabled) + return; + + Sound *snd = 0; + + for (int i = 0; i < g_fp->_currSoundListCount; i++) + snd = g_fp->_currSoundList1[i]->getSoundByIndex(i); + + if (!snd) + return; + + if (cmd->_field_14 & 1) { + if (!g_fp->_flgSoundList && (cmd->_field_14 & 4)) + snd->freeSound(); + + snd->updateVolume(); + + if (snd->_objectId && g_fp->_currentScene->getStaticANIObject1ById(snd->_objectId, -1)) + snd->setPanAndVolumeByStaticAni(); + else + snd->setPanAndVolume(g_fp->_sfxVolume, 0); + + if (snd->getVolume() > -3500) + snd->play(cmd->_keyCode); + } else if (cmd->_field_14 & 2) { + snd->stop(); + } } void FullpipeEngine::stopSoundStream2() { diff --git a/engines/fullpipe/sound.h b/engines/fullpipe/sound.h index e284e5efab..21d9d825a0 100644 --- a/engines/fullpipe/sound.h +++ b/engines/fullpipe/sound.h @@ -32,6 +32,7 @@ class Sound : public MemoryObject { int _directSoundBuffers[7]; byte *_soundData; Audio::SoundHandle _handle; + int _volume; public: int16 _objectId; @@ -46,6 +47,11 @@ public: int getId() const { return _id; } Audio::SoundHandle getHandle() const { return _handle; } + void play(int flag); + void freeSound(); + int getVolume(); + void stop(); + void setPanAndVolumeByStaticAni(); void setPanAndVolume(int vol, int pan); }; -- cgit v1.2.3 From e25195d8f5bffbeb7d84785311437aa19c345f03 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 26 Apr 2014 17:00:11 +0300 Subject: FULLPIPE: Implement Sound::play() --- engines/fullpipe/sound.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index 8280d64b6e..271b103c03 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -126,7 +126,17 @@ void Sound::setPanAndVolume(int vol, int pan) { } void Sound::play(int flag) { - warning("STUB: Sound::play()"); + Audio::SoundHandle handle = getHandle(); + + if (g_fp->_mixer->isSoundHandleActive(handle)) + return; + + byte *soundData = loadData(); + Common::MemoryReadStream *dataStream = new Common::MemoryReadStream(soundData, getDataSize()); + Audio::RewindableAudioStream *wav = Audio::makeWAVStream(dataStream, DisposeAfterUse::YES); + Audio::AudioStream *audioStream = new Audio::LoopingAudioStream(wav, (flag == 1) ? 0 : 1); + + g_fp->_mixer->playStream(Audio::Mixer::kSFXSoundType, &handle, audioStream); } void Sound::freeSound() { @@ -300,12 +310,7 @@ void FullpipeEngine::playSound(int id, int flag) { return; } - byte *soundData = sound->loadData(); - Common::MemoryReadStream *dataStream = new Common::MemoryReadStream(soundData, sound->getDataSize()); - Audio::RewindableAudioStream *wav = Audio::makeWAVStream(dataStream, DisposeAfterUse::YES); - Audio::AudioStream *audioStream = new Audio::LoopingAudioStream(wav, (flag == 1) ? 0 : 1); - Audio::SoundHandle handle = sound->getHandle(); - _mixer->playStream(Audio::Mixer::kSFXSoundType, &handle, audioStream); + sound->play(flag); } void FullpipeEngine::playTrack(GameVar *sceneVar, const char *name, bool delayed) { -- cgit v1.2.3 From 452f939cbabd6680b0be6a3d3f6e393cb43939d5 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 26 Apr 2014 17:32:41 +0300 Subject: FULLPIPE: Implement Sound::freeSound() and Sound::stop() --- engines/fullpipe/sound.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index 271b103c03..10ae376a32 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -140,7 +140,9 @@ void Sound::play(int flag) { } void Sound::freeSound() { - warning("STUB: Sound::freeSound()"); + stop(); + + free(_soundData); } int Sound::getVolume() { @@ -150,7 +152,7 @@ int Sound::getVolume() { } void Sound::stop() { - warning("STUB: Sound::stop()"); + g_fp->_mixer->stopHandle(_handle); } void FullpipeEngine::setSceneMusicParameters(GameVar *gvar) { -- cgit v1.2.3 From ecdda5acdf919abe9c6803f8db470505fe425a20 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 26 Apr 2014 17:34:24 +0300 Subject: FULLPIPE: Implement Sound() destructor --- engines/fullpipe/sound.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index 10ae376a32..294be17e9d 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -85,7 +85,9 @@ Sound::Sound() { } Sound::~Sound() { - warning("STUB: Sound::~Sound()"); + freeSound(); + + free(_description); } bool Sound::load(MfcArchive &file, NGIArchive *archive) { -- cgit v1.2.3 From 533b4accb2a9eb7d421b973ac196f602618906eb Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 26 Apr 2014 21:45:41 +0300 Subject: FULLPIPE: Fixed Sound::getVolume() --- engines/fullpipe/sound.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index 294be17e9d..9126fdb7ea 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -148,9 +148,7 @@ void Sound::freeSound() { } int Sound::getVolume() { - warning("STUB: Sound::getVolume()"); - - return _volume; + return g_fp->_mixer->getChannelVolume(_handle) * 39; // 0..10000 } void Sound::stop() { -- cgit v1.2.3 From 64800b2ac286d5aebc3ae16b60f651cf92db35b6 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 26 Apr 2014 21:58:20 +0300 Subject: FULLPIPE: Implement SoundList::getSoundItemById() --- engines/fullpipe/sound.cpp | 16 ++++++++++++++-- engines/fullpipe/sound.h | 8 +------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index 9126fdb7ea..8c71446438 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -74,6 +74,18 @@ bool SoundList::loadFile(const char *fname, char *libname) { return load(archive, libname); } +Sound *SoundList::getSoundItemById(int id) { + if (_soundItemsCount == 0) { + return _soundItems[0]->getId() != id ? 0 : _soundItems[0]; + } + + for (int i = 0; i < _soundItemsCount; i++) { + if (_soundItems[i]->getId() == id) + return _soundItems[i]; + } + return NULL; +} + Sound::Sound() { _id = 0; _directSoundBuffer = 0; @@ -301,7 +313,7 @@ void FullpipeEngine::playSound(int id, int flag) { Sound *sound = 0; for (int i = 0; i < _currSoundListCount; i++) { - sound = _currSoundList1[i]->getSoundById(id); + sound = _currSoundList1[i]->getSoundItemById(id); if (sound) break; @@ -383,7 +395,7 @@ void global_messageHandler_handleSound(ExCommand *cmd) { Sound *snd = 0; for (int i = 0; i < g_fp->_currSoundListCount; i++) - snd = g_fp->_currSoundList1[i]->getSoundByIndex(i); + snd = g_fp->_currSoundList1[i]->getSoundItemById(cmd->_messageNum); if (!snd) return; diff --git a/engines/fullpipe/sound.h b/engines/fullpipe/sound.h index 21d9d825a0..14e766f5bb 100644 --- a/engines/fullpipe/sound.h +++ b/engines/fullpipe/sound.h @@ -69,13 +69,7 @@ class SoundList : public CObject { int getCount() { return _soundItemsCount; } Sound *getSoundByIndex(int idx) { return _soundItems[idx]; } - Sound *getSoundById(int id) { - for (int i = 0; i < _soundItemsCount; i++) { - if (_soundItems[i]->getId() == id) - return _soundItems[i]; - } - return NULL; - } + Sound *getSoundItemById(int id); }; } // End of namespace Fullpipe -- cgit v1.2.3 From eaee951a2f4f6adf4be603a302134efa8c501183 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 26 Apr 2014 23:32:27 +0300 Subject: FULLPIPE: Implement Sound::setPanAndVolume() --- engines/fullpipe/sound.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index 8c71446438..c337209cf6 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -136,7 +136,8 @@ void Sound::setPanAndVolumeByStaticAni() { } void Sound::setPanAndVolume(int vol, int pan) { - warning("STUB: Sound::setPanAndVolume"); + g_fp->_mixer->setChannelVolume(_handle, vol / 39); // 0..10000 + g_fp->_mixer->setChannelBalance(_handle, pan / 78); // -10000..10000 } void Sound::play(int flag) { -- cgit v1.2.3 From 10d3017737080e9f769d0625a7cb5790fb465dc6 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 27 Apr 2014 11:07:41 +0300 Subject: FULLPIPE: Proper implementation of FullpipeEngine::stopAllSoundInstances() --- engines/fullpipe/sound.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index c337209cf6..3c13bad854 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -429,14 +429,11 @@ void FullpipeEngine::stopAllSoundStreams() { } void FullpipeEngine::stopAllSoundInstances(int id) { - SoundList *soundList = _currentScene->_soundList; - - for (int i = 0; i < soundList->getCount(); i++) { - Sound *sound = soundList->getSoundByIndex(i); + for (int i = 0; i < _currSoundListCount; i++) { + Sound *sound = _currSoundList1[i]->getSoundItemById(id); - if (sound->getId() == id) { - _mixer->stopHandle(sound->getHandle()); - } + if (sound) + sound->stop(); } } -- cgit v1.2.3 From cf97b2ec9ecac5ab0edbdd34dca051c550cada37 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 27 Apr 2014 11:59:29 +0300 Subject: FULLPIPE: Implement StaticANIObject::calcStepLen() --- engines/fullpipe/statics.cpp | 25 +++++++++++++++++++++++++ engines/fullpipe/statics.h | 1 + 2 files changed, 26 insertions(+) diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index 4d813d3b0b..f1abac5778 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -1369,6 +1369,31 @@ bool StaticANIObject::startAnim(int movementId, int messageQueueId, int dynPhase return true; } +Common::Point *StaticANIObject::calcStepLen(Common::Point *p) { + if (_movement) { + Common::Point point; + + _movement->calcSomeXY(point, 0); + + p->x = point.x; + p->y = point.y; + + int idx = _stepArray.getCurrPointIndex() - _movement->_currDynamicPhaseIndex - 1; + + if (idx >= 0) { + _stepArray.getPoint(&point, idx, _movement->_currDynamicPhaseIndex + 2); + + p->x += point.x; + p->y += point.y; + } + } else { + p->x = 0; + p->y = 0; + } + + return p; +} + Statics::Statics() { _staticsId = 0; _picture = 0; diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h index d5e7d533a7..d678957163 100644 --- a/engines/fullpipe/statics.h +++ b/engines/fullpipe/statics.h @@ -246,6 +246,7 @@ public: void draw2(); MovTable *countMovements(); + Common::Point *calcStepLen(Common::Point *p); void setSpeed(int speed); void updateStepPos(); -- cgit v1.2.3 From a3859041bf492a2c926dadc7324c1fe811fbbf86 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 27 Apr 2014 12:37:48 +0300 Subject: FULLPIPE: Implement ModalSaveGame::ModalSaveGame() --- engines/fullpipe/modal.cpp | 14 ++++++++++++-- engines/fullpipe/modal.h | 17 +++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 65274bfcf1..79d348c8b8 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -1446,10 +1446,20 @@ bool ModalQuery::init(int counterdiff) { } ModalSaveGame::ModalSaveGame() { - warning("STUB: ModalSaveGame::ModalSaveGame()"); - _oldBgX = 0; _oldBgY = 0; + + _bgr = 0; + _okD = 0; + _okL = 0; + _cancelD = 0; + _cancelL = 0; + _emptyD = 0; + _emptyL = 0; + _queryRes = -1; + _rect = g_fp->_sceneRect; + _queryDlg = 0; + _mode = 1; } void ModalSaveGame::setScene(Scene *sc) { diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h index f7264057fb..15f89d6d93 100644 --- a/engines/fullpipe/modal.h +++ b/engines/fullpipe/modal.h @@ -251,9 +251,26 @@ public: void setScene(Scene *sc); void setup(Scene *sc, int mode); + Common::Rect _rect; int _oldBgX; int _oldBgY; + PictureObject *_bgr; + PictureObject *_okD; + PictureObject *_okL; + PictureObject *_cancelD; + PictureObject *_cancelL; + PictureObject *_emptyD; + PictureObject *_emptyL; + PictureObject *_fullD; + PictureObject *_fullL; + Scene *_menuScene; + int _mode; + ModalQuery *_queryDlg; + Common::Array _filenames; + Common::Array _arrayL; + Common::Array _arrayD; + int _queryRes; }; -- cgit v1.2.3 From d5bc560d66dc90bf0223bfe862fd3334c2cd4b1e Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 27 Apr 2014 12:39:37 +0300 Subject: FULLPIPE: Implement ModalSaveGame destructor --- engines/fullpipe/modal.cpp | 8 ++++++++ engines/fullpipe/modal.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 79d348c8b8..1fe12b941a 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -1462,6 +1462,14 @@ ModalSaveGame::ModalSaveGame() { _mode = 1; } +ModalSaveGame::~ModalSaveGame() { + g_fp->_sceneRect = _rect; + + _arrayD.clear(); + _arrayL.clear(); + _filenames.clear(); +} + void ModalSaveGame::setScene(Scene *sc) { warning("STUB: ModalSaveGame::setScene()"); } diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h index 15f89d6d93..435e1fd748 100644 --- a/engines/fullpipe/modal.h +++ b/engines/fullpipe/modal.h @@ -240,7 +240,7 @@ private: class ModalSaveGame : public BaseModalObject { public: ModalSaveGame(); - virtual ~ModalSaveGame() {} + virtual ~ModalSaveGame(); virtual bool pollEvent() { return true; } virtual bool handleMessage(ExCommand *message) { return false; } -- cgit v1.2.3 From 91a38398825190a2f1ee0e4b104a369b90f9f2c1 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 27 Apr 2014 12:42:28 +0300 Subject: FULLPIPE: Implement ModalSaveGame::getSaveName() --- engines/fullpipe/modal.cpp | 12 ++++++++++++ engines/fullpipe/modal.h | 1 + 2 files changed, 13 insertions(+) diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 1fe12b941a..4d71f4e69f 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -1467,6 +1467,10 @@ ModalSaveGame::~ModalSaveGame() { _arrayD.clear(); _arrayL.clear(); + + for (uint i = 0; i < _filenames.size(); i++) + free(_filenames[i]); + _filenames.clear(); } @@ -1478,6 +1482,14 @@ void ModalSaveGame::setup(Scene *sc, int mode) { warning("STUB: ModalSaveGame::setup()"); } +char *ModalSaveGame::getSaveName() { + if (_queryRes < 0) + return 0; + + return _filenames[_queryRes]; +} + + void FullpipeEngine::openHelp() { if (!_modalObject) { ModalHelp *help = new ModalHelp; diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h index 435e1fd748..4748041010 100644 --- a/engines/fullpipe/modal.h +++ b/engines/fullpipe/modal.h @@ -251,6 +251,7 @@ public: void setScene(Scene *sc); void setup(Scene *sc, int mode); + char *getSaveName(); Common::Rect _rect; int _oldBgX; -- cgit v1.2.3 From de9ab9d088d545835c983df5966c167d757a895f Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 27 Apr 2014 12:52:57 +0300 Subject: FULLPIPE: More code to ModalSaveGame --- engines/fullpipe/modal.cpp | 8 +++++++- engines/fullpipe/modal.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 4d71f4e69f..36dd0066df 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -1475,7 +1475,13 @@ ModalSaveGame::~ModalSaveGame() { } void ModalSaveGame::setScene(Scene *sc) { - warning("STUB: ModalSaveGame::setScene()"); + _queryRes = -1; + _menuScene = sc; +} + +void ModalSaveGame::processKey(int key) { + if (key == 27) + _queryRes = 0; } void ModalSaveGame::setup(Scene *sc, int mode) { diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h index 4748041010..bd6cc18ac1 100644 --- a/engines/fullpipe/modal.h +++ b/engines/fullpipe/modal.h @@ -250,6 +250,7 @@ public: void setScene(Scene *sc); void setup(Scene *sc, int mode); + void processKey(int key); char *getSaveName(); -- cgit v1.2.3 From bee65c0b8efa328c0e08b0ec80ac8e1b74f1fbd5 Mon Sep 17 00:00:00 2001 From: Keith Kaisershot Date: Sun, 27 Apr 2014 20:38:57 -0400 Subject: PEGASUS: Fix repeated audio analysis video when leaving after defeating Sinclair --- engines/pegasus/neighborhood/caldoria/caldoria.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/pegasus/neighborhood/caldoria/caldoria.cpp b/engines/pegasus/neighborhood/caldoria/caldoria.cpp index 7977c17f12..709a4fefed 100644 --- a/engines/pegasus/neighborhood/caldoria/caldoria.cpp +++ b/engines/pegasus/neighborhood/caldoria/caldoria.cpp @@ -907,7 +907,7 @@ void Caldoria::arriveAtCaldoria49() { setCurrentAlternate(kAltCaldoriaNormal); // Need to force the loop to play. - if (GameState.getCurrentDirection() == kNorth) { + if (GameState.getCurrentDirection() == kNorth && !GameState.getCaldoriaSinclairShot()) { GameState.setCaldoriaFuseTimeLimit(kSinclairShootsTimeLimit); startExtraSequence(kCa49NorthVoiceAnalysis, kExtraCompletedFlag, kFilterNoInput); } -- cgit v1.2.3 From cfcd3fd780254b60abe1eea43f1de18494d65582 Mon Sep 17 00:00:00 2001 From: Keith Kaisershot Date: Sun, 27 Apr 2014 21:12:34 -0400 Subject: PEGASUS: Set volume in more places --- engines/pegasus/menu.cpp | 2 ++ engines/pegasus/neighborhood/caldoria/caldoria.cpp | 2 ++ engines/pegasus/neighborhood/caldoria/caldoriabomb.cpp | 15 +++++++++++++++ engines/pegasus/neighborhood/caldoria/caldoriabomb.h | 3 +++ .../pegasus/neighborhood/caldoria/caldoriamessages.cpp | 6 ++++++ engines/pegasus/neighborhood/caldoria/caldoriamessages.h | 2 ++ engines/pegasus/neighborhood/mars/mars.cpp | 11 +++++++++++ engines/pegasus/neighborhood/neighborhood.cpp | 11 ++++++++++- engines/pegasus/neighborhood/neighborhood.h | 2 ++ engines/pegasus/neighborhood/norad/delta/globegame.cpp | 5 +++++ engines/pegasus/neighborhood/norad/delta/globegame.h | 2 ++ engines/pegasus/neighborhood/norad/delta/noraddelta.cpp | 7 +++++++ engines/pegasus/neighborhood/norad/delta/noraddelta.h | 2 ++ engines/pegasus/pegasus.cpp | 7 +++++++ 14 files changed, 76 insertions(+), 1 deletion(-) diff --git a/engines/pegasus/menu.cpp b/engines/pegasus/menu.cpp index e55c006f86..4bbda8fd93 100644 --- a/engines/pegasus/menu.cpp +++ b/engines/pegasus/menu.cpp @@ -227,6 +227,7 @@ MainMenu::MainMenu() : GameMenu(kMainMenuID), _menuBackground(0), _overviewButto _menuLoop.attachFader(&_menuFader); _menuLoop.initFromAIFFFile("Sounds/Main Menu.aiff"); + _menuFader.setMasterVolume(((PegasusEngine *)g_engine)->getAmbienceLevel()); updateDisplay(); } @@ -736,6 +737,7 @@ DeathMenu::DeathMenu(const DeathReason deathReason) : GameMenu(kDeathMenuID), _d _largeSelect.startDisplaying(); } else { _triumphSound.initFromQuickTime("Sounds/Caldoria/Galactic Triumph"); + _triumphSound.setVolume(((PegasusEngine *)g_engine)->getAmbienceLevel()); _triumphSound.playSound(); } diff --git a/engines/pegasus/neighborhood/caldoria/caldoria.cpp b/engines/pegasus/neighborhood/caldoria/caldoria.cpp index 709a4fefed..9d2d6723a9 100644 --- a/engines/pegasus/neighborhood/caldoria/caldoria.cpp +++ b/engines/pegasus/neighborhood/caldoria/caldoria.cpp @@ -196,6 +196,8 @@ void Caldoria::start() { if (!pullbackMovie->loadFile("Images/Caldoria/Pullback.movie")) error("Could not load pullback movie"); + pullbackMovie->setVolume(MIN(_vm->getSoundFXLevel(), 0xFF)); + // Draw the first frame so we can fade to it const Graphics::Surface *frame = pullbackMovie->decodeNextFrame(); assert(frame); diff --git a/engines/pegasus/neighborhood/caldoria/caldoriabomb.cpp b/engines/pegasus/neighborhood/caldoria/caldoriabomb.cpp index abf34d3863..c964e3458b 100644 --- a/engines/pegasus/neighborhood/caldoria/caldoriabomb.cpp +++ b/engines/pegasus/neighborhood/caldoria/caldoriabomb.cpp @@ -1167,6 +1167,18 @@ CaldoriaBomb::~CaldoriaBomb() { delete[] _bombLevel[i]; } +void CaldoriaBomb::setSoundFXLevel(const uint16) { + // The transition sounds between levels are ambience, so overwrite what + // Neighborhood::setSoundFXLevel does and keep using the ambience volume level + if (_timer.isRunning()) + _owner->_navMovie.setVolume(((PegasusEngine *)g_engine)->getAmbienceLevel()); +} + +void CaldoriaBomb::setAmbienceLevel(const uint16 level) { + if (_timer.isRunning()) + _owner->_navMovie.setVolume(level); +} + void CaldoriaBomb::openInteraction() { _grid.moveElementTo(kCaldoriaBombGridLeft, kCaldoriaBombGridTop); _grid.setDisplayOrder(kCaldoriaBombGridOrder); @@ -1234,6 +1246,7 @@ void CaldoriaBomb::receiveNotification(Notification *notification, const Notific _timer.start(); _currentLevel = 0; _lastVertex = -1; + _owner->_navMovie.setVolume(((PegasusEngine *)g_engine)->getAmbienceLevel()); startBombAmbient("Sounds/Caldoria/BmbLoop1.22K.AIFF"); break; case kCaldoria56BombStage2: @@ -1258,6 +1271,7 @@ void CaldoriaBomb::receiveNotification(Notification *notification, const Notific _grid.hide(); _timer.stop(); _timer.hide(); + _owner->_navMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel()); _owner->loadLoopSound1(""); _owner->playDeathExtra(kCaldoria56BombExplodes, kDeathNuclearExplosion); } @@ -1411,6 +1425,7 @@ void CaldoriaBomb::handleInput(const Input &input, const Hotspot *hotspot) { _timer.stop(); _grid.hide(); _timer.hide(); + _owner->_navMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel()); _owner->startExtraSequence(kCaldoria56BombStage7, kExtraCompletedFlag, kFilterNoInput); break; } diff --git a/engines/pegasus/neighborhood/caldoria/caldoriabomb.h b/engines/pegasus/neighborhood/caldoria/caldoriabomb.h index 5bb39b4122..ba6d1e8998 100644 --- a/engines/pegasus/neighborhood/caldoria/caldoriabomb.h +++ b/engines/pegasus/neighborhood/caldoria/caldoriabomb.h @@ -122,6 +122,9 @@ public: CaldoriaBomb(Neighborhood *, NotificationManager *); virtual ~CaldoriaBomb(); + void setSoundFXLevel(const uint16); + void setAmbienceLevel(const uint16); + long getNumHints(); Common::String getHintMovie(uint); void doSolve(); diff --git a/engines/pegasus/neighborhood/caldoria/caldoriamessages.cpp b/engines/pegasus/neighborhood/caldoria/caldoriamessages.cpp index a3ce97d438..2ae990d775 100644 --- a/engines/pegasus/neighborhood/caldoria/caldoriamessages.cpp +++ b/engines/pegasus/neighborhood/caldoria/caldoriamessages.cpp @@ -24,6 +24,7 @@ */ #include "pegasus/gamestate.h" +#include "pegasus/pegasus.h" #include "pegasus/neighborhood/neighborhood.h" #include "pegasus/neighborhood/caldoria/caldoria.h" #include "pegasus/neighborhood/caldoria/caldoriamessages.h" @@ -45,6 +46,10 @@ void CaldoriaMessages::openInteraction() { _messageNumber = 1; } +void CaldoriaMessages::setSoundFXLevel(const uint16 fxLevel) { + _messageMovie.setVolume(fxLevel); +} + void CaldoriaMessages::initInteraction() { GameInteraction::_owner->startExtraSequence(kCaBedroomVidPhone, kExtraCompletedFlag, kFilterNoInput); } @@ -101,6 +106,7 @@ void CaldoriaMessages::play1Message(uint messageNumber) { GameState.setCaldoriaSeenMessages(true); } + _messageMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel()); _messageMovie.moveElementTo(kCaldoriaMessageLeft, kCaldoriaMessageTop); _messageMovie.setDisplayOrder(kCaldoriaMessagesOrder); _messageMovie.startDisplaying(); diff --git a/engines/pegasus/neighborhood/caldoria/caldoriamessages.h b/engines/pegasus/neighborhood/caldoria/caldoriamessages.h index 955fe10ce9..b2fc7c3bf9 100644 --- a/engines/pegasus/neighborhood/caldoria/caldoriamessages.h +++ b/engines/pegasus/neighborhood/caldoria/caldoriamessages.h @@ -41,6 +41,8 @@ public: CaldoriaMessages(Neighborhood *, const NotificationID, NotificationManager *); virtual ~CaldoriaMessages() {} + void setSoundFXLevel(const uint16); + protected: void openInteraction(); void initInteraction(); diff --git a/engines/pegasus/neighborhood/mars/mars.cpp b/engines/pegasus/neighborhood/mars/mars.cpp index f7493dbe75..df5a75541c 100644 --- a/engines/pegasus/neighborhood/mars/mars.cpp +++ b/engines/pegasus/neighborhood/mars/mars.cpp @@ -2402,6 +2402,8 @@ void Mars::doCanyonChase() { if (!video->loadFile("Images/Mars/M44ESA.movie")) error("Could not load interface->shuttle transition video"); + video->setVolume(MIN(_vm->getSoundFXLevel(), 0xFF)); + video->start(); while (!_vm->shouldQuit() && !video->endOfVideo()) { @@ -2612,6 +2614,7 @@ void Mars::startUpFromFinishedSpaceChase() { kShuttleJunkTop, false); initOneMovie(&_explosions, "Images/Mars/Explosions.movie", kShuttleWeaponFrontOrder, 0, 0, false); + _explosions.setVolume(_vm->getSoundFXLevel()); _explosionCallBack.initCallBack(&_explosions, kCallBackAtExtremes); _energyBeam.initShuttleWeapon(); @@ -2650,6 +2653,7 @@ void Mars::startUpFromFinishedSpaceChase() { initOneMovie(&_canyonChaseMovie, "Images/Mars/M98EAS.movie", kShuttleTractorBeamMovieOrder, kShuttleWindowLeft, kShuttleWindowTop, true); + _canyonChaseMovie.setVolume(_vm->getSoundFXLevel()); _canyonChaseMovie.setTime(_canyonChaseMovie.getDuration()); _canyonChaseMovie.redrawMovieWorld(); } @@ -2725,6 +2729,7 @@ void Mars::startUpFromSpaceChase() { kShuttleJunkTop, false); initOneMovie(&_explosions, "Images/Mars/Explosions.movie", kShuttleWeaponFrontOrder, 0, 0, false); + _explosions.setVolume(_vm->getSoundFXLevel()); _explosionCallBack.initCallBack(&_explosions, kCallBackAtExtremes); _energyBeam.initShuttleWeapon(); @@ -2788,6 +2793,10 @@ void Mars::startUpFromSpaceChase() { void Mars::setSoundFXLevel(const uint16 level) { Neighborhood::setSoundFXLevel(level); + if (GameState.getCurrentRoomAndView() == MakeRoomView(kMars48, kEast) && + !GameState.getMarsAvoidedReactorRobot()) + _loop2Fader.setMasterVolume(level); + if (_canyonChaseMovie.isMovieValid()) _canyonChaseMovie.setVolume(level); @@ -2842,6 +2851,7 @@ void Mars::marsTimerExpired(MarsTimerEvent &event) { initOneMovie(&_junk, "Images/Mars/Junk.movie", kShuttleJunkOrder, kShuttleJunkLeft, kShuttleJunkTop, false); initOneMovie(&_explosions, "Images/Mars/Explosions.movie", kShuttleWeaponFrontOrder, 0, 0, false); + _explosions.setVolume(_vm->getSoundFXLevel()); _explosionCallBack.initCallBack(&_explosions, kCallBackAtExtremes); _energyBeam.initShuttleWeapon(); @@ -3175,6 +3185,7 @@ void Mars::spaceChaseClick(const Input &input, const HotSpotID id) { // Shameless reuse of a variable :P initOneMovie(&_canyonChaseMovie, "Images/Mars/M98EAS.movie", kShuttleTractorBeamMovieOrder, kShuttleWindowLeft, kShuttleWindowTop, true); + _canyonChaseMovie.setVolume(_vm->getSoundFXLevel()); _canyonChaseMovie.redrawMovieWorld(); playMovieSegment(&_canyonChaseMovie, 0, _canyonChaseMovie.getDuration()); diff --git a/engines/pegasus/neighborhood/neighborhood.cpp b/engines/pegasus/neighborhood/neighborhood.cpp index 320fbdabaa..c9be349694 100644 --- a/engines/pegasus/neighborhood/neighborhood.cpp +++ b/engines/pegasus/neighborhood/neighborhood.cpp @@ -1495,7 +1495,15 @@ void Neighborhood::loadLoopSound2(const Common::String &soundName, uint16 volume if (!_loop2SoundString.empty()) { _soundLoop2.initFromAIFFFile(_loop2SoundString); _soundLoop2.loopSound(); - _loop2Fader.setMasterVolume(_vm->getAmbienceLevel()); + // HACK: Some ambient loops are actually sound effects, like Ares waiting at + // the reactor and Poseidon at the launch console. Detect these and use the + // SFX volume instead of ambience. + if (soundName == "Sounds/Mars/Robot Loop.aiff" || + soundName == "Sounds/Norad/Breathing Typing.22K.AIFF" || + soundName == "Sounds/Norad/N54NAS.32K.AIFF") + _loop2Fader.setMasterVolume(_vm->getSoundFXLevel()); + else + _loop2Fader.setMasterVolume(_vm->getAmbienceLevel()); _loop2Fader.setFaderValue(0); faderMove.makeTwoKnotFaderSpec(fadeScale, 0, 0, fadeIn, volume); _loop2Fader.startFaderSync(faderMove); @@ -1580,6 +1588,7 @@ void Neighborhood::closeCroppedMovie() { void Neighborhood::playCroppedMovieOnce(const Common::String &movieName, CoordType left, CoordType top, const InputBits interruptionFilter) { openCroppedMovie(movieName, left, top); + _croppedMovie.setVolume(_vm->getSoundFXLevel()); _croppedMovie.redrawMovieWorld(); _croppedMovie.start(); diff --git a/engines/pegasus/neighborhood/neighborhood.h b/engines/pegasus/neighborhood/neighborhood.h index 3c1c5eac92..f7f2b038c6 100644 --- a/engines/pegasus/neighborhood/neighborhood.h +++ b/engines/pegasus/neighborhood/neighborhood.h @@ -91,6 +91,7 @@ struct QueueRequest { bool operator==(const QueueRequest &arg1, const QueueRequest &arg2); bool operator!=(const QueueRequest &arg1, const QueueRequest &arg2); +class CaldoriaBomb; class GameInteraction; class Item; class Neighborhood; @@ -109,6 +110,7 @@ protected: typedef Common::Queue NeighborhoodActionQueue; class Neighborhood : public IDObject, public NotificationReceiver, public InputHandler, public Idler { +friend class CaldoriaBomb; friend class StriderCallBack; public: diff --git a/engines/pegasus/neighborhood/norad/delta/globegame.cpp b/engines/pegasus/neighborhood/norad/delta/globegame.cpp index 0b95e9bc2b..5c321a8e8a 100644 --- a/engines/pegasus/neighborhood/norad/delta/globegame.cpp +++ b/engines/pegasus/neighborhood/norad/delta/globegame.cpp @@ -453,8 +453,13 @@ GlobeGame::GlobeGame(Neighborhood *handler) : GameInteraction(kNoradGlobeGameInt _neighborhoodNotification = handler->getNeighborhoodNotification(); } +void GlobeGame::setSoundFXLevel(const uint16 fxLevel) { + _monitorMovie.setVolume(fxLevel); +} + void GlobeGame::openInteraction() { _monitorMovie.initFromMovieFile("Images/Norad Delta/N79 Left Monitor"); + _monitorMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel()); _monitorMovie.moveElementTo(kGlobeMonitorLeft, kGlobeMonitorTop); _monitorMovie.setDisplayOrder(kGlobeMonitorLayer); _monitorMovie.startDisplaying(); diff --git a/engines/pegasus/neighborhood/norad/delta/globegame.h b/engines/pegasus/neighborhood/norad/delta/globegame.h index 73ed48866f..93235a1784 100644 --- a/engines/pegasus/neighborhood/norad/delta/globegame.h +++ b/engines/pegasus/neighborhood/norad/delta/globegame.h @@ -98,6 +98,8 @@ public: GlobeGame(Neighborhood *); virtual ~GlobeGame() {} + void setSoundFXLevel(const uint16); + void handleInput(const Input &, const Hotspot *); void clickInHotspot(const Input &, const Hotspot *); void activateHotspots(); diff --git a/engines/pegasus/neighborhood/norad/delta/noraddelta.cpp b/engines/pegasus/neighborhood/norad/delta/noraddelta.cpp index 1eea2f0156..b6ce700132 100644 --- a/engines/pegasus/neighborhood/norad/delta/noraddelta.cpp +++ b/engines/pegasus/neighborhood/norad/delta/noraddelta.cpp @@ -863,6 +863,13 @@ void NoradDelta::doSolve() { } } +void NoradDelta::setSoundFXLevel(const uint16 level) { + Neighborhood::setSoundFXLevel(level); + + if (GameState.getCurrentRoomAndView() == MakeRoomView(kNorad54North, kNorth)) + _loop2Fader.setMasterVolume(level); +} + Common::String NoradDelta::getSoundSpotsName() { return "Sounds/Norad/Norad Delta Spots"; } diff --git a/engines/pegasus/neighborhood/norad/delta/noraddelta.h b/engines/pegasus/neighborhood/norad/delta/noraddelta.h index 11065f2c9d..2f276a8a7d 100644 --- a/engines/pegasus/neighborhood/norad/delta/noraddelta.h +++ b/engines/pegasus/neighborhood/norad/delta/noraddelta.h @@ -68,6 +68,8 @@ public: bool canSolve(); void doSolve(); + void setSoundFXLevel(const uint16); + void doorOpened(); protected: diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp index a0ec12a7c4..0010180d8d 100644 --- a/engines/pegasus/pegasus.cpp +++ b/engines/pegasus/pegasus.cpp @@ -307,6 +307,7 @@ void PegasusEngine::runIntro() { Video::VideoDecoder *video = new Video::QuickTimeDecoder(); if (video->loadFile(_introDirectory + "/BandaiLogo.movie")) { + video->setVolume(MIN(getAmbienceLevel(), 0xFF)); video->start(); while (!shouldQuit() && !video->endOfVideo() && !skipped) { @@ -338,6 +339,8 @@ void PegasusEngine::runIntro() { if (!video->loadFile(_introDirectory + "/Big Movie.movie")) error("Could not load intro movie"); + video->setVolume(MIN(getAmbienceLevel(), 0xFF)); + video->seek(Audio::Timestamp(0, 10 * 600, 600)); video->start(); @@ -794,6 +797,8 @@ void PegasusEngine::introTimerExpired() { if (!video->loadFile(_introDirectory + "/LilMovie.movie")) error("Failed to load little movie"); + video->setVolume(MIN(getAmbienceLevel(), 0xFF)); + bool saveAllowed = swapSaveAllowed(false); bool openAllowed = swapLoadAllowed(false); @@ -941,6 +946,8 @@ void PegasusEngine::doGameMenuCommand(const GameMenuCommand command) { if (!video->loadFile(_introDirectory + "/Closing.movie")) error("Could not load closing movie"); + video->setVolume(MIN(getSoundFXLevel(), 0xFF)); + uint16 x = (640 - video->getWidth() * 2) / 2; uint16 y = (480 - video->getHeight() * 2) / 2; -- cgit v1.2.3 From 277a712f0b6835a54c2ee9373b06ff6db42eb7f9 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sun, 27 Apr 2014 21:18:45 -0400 Subject: PEGASUS: Fix a Norad Delta door locked sound Based on a patch by Keith Kaisershot --- engines/pegasus/neighborhood/norad/delta/noraddelta.cpp | 11 +++++++++++ engines/pegasus/neighborhood/norad/delta/noraddelta.h | 1 + 2 files changed, 12 insertions(+) diff --git a/engines/pegasus/neighborhood/norad/delta/noraddelta.cpp b/engines/pegasus/neighborhood/norad/delta/noraddelta.cpp index b6ce700132..ee047d72b2 100644 --- a/engines/pegasus/neighborhood/norad/delta/noraddelta.cpp +++ b/engines/pegasus/neighborhood/norad/delta/noraddelta.cpp @@ -514,6 +514,17 @@ void NoradDelta::openDoor() { } } +void NoradDelta::cantMoveThatWay(CanOpenDoorReason reason) { + // WORKAROUND: The door outside the launch console room isn't treated as a door, + // so play the correct sound. + if (reason == kCantMoveBlocked && GameState.getCurrentRoomAndView() == MakeRoomView(kNorad67, kNorth)) { + cantOpenDoor(kCantOpenLocked); + return; + } + + Neighborhood::cantMoveThatWay(reason); +} + void NoradDelta::activateHotspots() { Norad::activateHotspots(); diff --git a/engines/pegasus/neighborhood/norad/delta/noraddelta.h b/engines/pegasus/neighborhood/norad/delta/noraddelta.h index 2f276a8a7d..591fd691a2 100644 --- a/engines/pegasus/neighborhood/norad/delta/noraddelta.h +++ b/engines/pegasus/neighborhood/norad/delta/noraddelta.h @@ -92,6 +92,7 @@ protected: void arriveAtNorad79West(); TimeValue getViewTime(const RoomID, const DirectionConstant); void openDoor(); + void cantMoveThatWay(CanMoveForwardReason); void activateHotspots(); void clickInHotspot(const Input &, const Hotspot *); void receiveNotification(Notification *, const NotificationFlags); -- cgit v1.2.3 From 5a966eef390ef6d8e56bd5afa42ab6871b484417 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 28 Apr 2014 08:18:10 +0300 Subject: FULLPIPE: Implement ModalSaveGame::init() --- engines/fullpipe/modal.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ engines/fullpipe/modal.h | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 36dd0066df..459c714984 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -1484,6 +1484,47 @@ void ModalSaveGame::processKey(int key) { _queryRes = 0; } +bool ModalSaveGame::init(int counterdiff) { + if (_queryDlg) { + if (!_queryDlg->init(counterdiff)) { + if (!_queryDlg->getQueryResult()) + _queryRes = -1; + + delete _queryDlg; + _queryDlg = 0; + } + + return true; + } + + if (_queryRes == -1) + return true; + + g_fp->_sceneRect = _rect; + + if (g_fp->_currentScene) { + g_fp->_currentScene->_x = _oldBgX; + g_fp->_currentScene->_y = _oldBgY; + } + + if (!_queryRes) { + ModalMainMenu *m = new ModalMainMenu; + + g_fp->_modalObject = m; + + m->_parentObj = _parentObj; + m->_screct = _rect; + m->_bgX = _oldBgX; + m->_bgY = _oldBgY; + + delete this; + + return true; + } + + return false; +} + void ModalSaveGame::setup(Scene *sc, int mode) { warning("STUB: ModalSaveGame::setup()"); } diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h index bd6cc18ac1..e2962ab595 100644 --- a/engines/fullpipe/modal.h +++ b/engines/fullpipe/modal.h @@ -244,7 +244,7 @@ public: virtual bool pollEvent() { return true; } virtual bool handleMessage(ExCommand *message) { return false; } - virtual bool init(int counterdiff) { return true; } + virtual bool init(int counterdiff); virtual void update() {} virtual void saveload() {} -- cgit v1.2.3 From 0c1b0cd09738283e2aa68e3db1d5d7535a3eff25 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 28 Apr 2014 20:35:18 +0300 Subject: FULLPIPE: Fix warnings --- engines/fullpipe/input.cpp | 4 ++-- engines/fullpipe/motion.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/fullpipe/input.cpp b/engines/fullpipe/input.cpp index 3d6f53c7f3..8135eefde3 100644 --- a/engines/fullpipe/input.cpp +++ b/engines/fullpipe/input.cpp @@ -303,7 +303,7 @@ void FullpipeEngine::processArcade(ExCommand *cmd) { int idx; if (cmd->_sceneClickX <= g_fp->_aniMan2->_ox) { - for (idx = _arcadeKeys.size() - 1; idx >= 0; idx--) { + for (idx = (int)_arcadeKeys.size() - 1; idx >= 0; idx--) { if (_arcadeKeys[idx]->x < g_fp->_aniMan2->_ox) break; } @@ -311,7 +311,7 @@ void FullpipeEngine::processArcade(ExCommand *cmd) { if (idx < 0) return; } else { - for (idx = 0; idx < _arcadeKeys.size(); idx++) { + for (idx = 0; idx < (int)_arcadeKeys.size(); idx++) { if (_arcadeKeys[idx]->x > g_fp->_aniMan2->_ox) break; } diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index d2eaf0674f..35da154570 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -1894,14 +1894,14 @@ MessageQueue *MGM::genMQ(StaticANIObject *ani, int staticsIndex, int staticsId, startidx = _items[idx]->subItems[subidx]->staticsIndex; - int step; + uint step; if (_items[idx]->subItems[subidx]->movement->_currMovement) step = _items[idx]->subItems[subidx]->movement->_currMovement->_dynamicPhases.size(); else step = _items[idx]->subItems[subidx]->movement->_dynamicPhases.size(); - i++; + i += step; } while (startidx != endidx); return mq; @@ -2297,7 +2297,7 @@ int MGM::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop) { Common::Point point; - for (int i = 0; i < item->movements1.size(); i++) { + for (uint i = 0; i < item->movements1.size(); i++) { Movement *mov = item->movements1[i]; if (mov->_staticsObj1 == item->statics[st1idx]) { -- cgit v1.2.3 From 31b094892aae7572cd027efd53ad63a635ffeb04 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 28 Apr 2014 20:38:08 +0300 Subject: FULLPIPE: Fix one more warning --- engines/fullpipe/input.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/fullpipe/input.cpp b/engines/fullpipe/input.cpp index 8135eefde3..7c97461a24 100644 --- a/engines/fullpipe/input.cpp +++ b/engines/fullpipe/input.cpp @@ -316,7 +316,7 @@ void FullpipeEngine::processArcade(ExCommand *cmd) { break; } - if (idx >= _arcadeKeys.size()) + if (idx >= (int)_arcadeKeys.size()) return; } -- cgit v1.2.3 From b3de0843a9cd66e133a33b467da1f6ba1a572db9 Mon Sep 17 00:00:00 2001 From: lukaslw Date: Thu, 6 Mar 2014 04:20:47 +0100 Subject: DRACI: Opening inventory during movements and actions. --- engines/draci/game.cpp | 20 +++++++++++++++++--- engines/draci/game.h | 1 + engines/draci/walking.cpp | 8 ++++++-- engines/draci/walking.h | 5 +++++ 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index 3a335f249a..b98593c8a4 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -891,9 +891,6 @@ void Game::putItem(GameItem *item, int position) { void Game::inventoryInit() { // Pause all "background" animations _vm->_anims->pauseAnimations(); - if (_walkingState.isActive()) { - walkHero(_hero.x, _hero.y, kDirectionLast); - } // Draw the inventory and the current items inventoryDraw(); @@ -904,6 +901,13 @@ void Game::inventoryInit() { // Set the appropriate loop status setLoopStatus(kStatusInventory); + if (_walkingState.isActive()) { + _walkingState.stopWalking(); + walkHero(_hero.x, _hero.y, kDirectionLast); + } else { + _lastTarget = _hero; + } + // Don't return from the inventory mode immediately if the mouse is out. _mouseChangeTick = kMouseDoNotSwitch; } @@ -922,6 +926,10 @@ void Game::inventoryDone() { } } + // Start moving to last target + walkHero(_lastTarget.x, _lastTarget.y, kDirectionLast); + _walkingState.callbackLast(); + // Reset item under cursor _itemUnderCursor = NULL; @@ -1208,6 +1216,12 @@ void Game::walkHero(int x, int y, SightDirection dir) { debug(1, "Unreachable point [%d,%d]", target.x, target.y); return; } + + // Save point of player's last target. + if(_loopStatus != kStatusInventory) { + _lastTarget = target; + } + _walkingMap.obliquePath(shortestPath, &obliquePath); debugC(2, kDraciWalkingDebugLevel, "Walking path lengths: shortest=%d oblique=%d", shortestPath.size(), obliquePath.size()); if (_vm->_showWalkingMap) { diff --git a/engines/draci/game.h b/engines/draci/game.h index 638c979d61..53a472a552 100644 --- a/engines/draci/game.h +++ b/engines/draci/game.h @@ -356,6 +356,7 @@ private: Common::Point _hero; Common::Point _heroLoading; + Common::Point _lastTarget; int *_variables; Person *_persons; diff --git a/engines/draci/walking.cpp b/engines/draci/walking.cpp index 1467ecee35..1670c9a029 100644 --- a/engines/draci/walking.cpp +++ b/engines/draci/walking.cpp @@ -439,8 +439,8 @@ void WalkingState::startWalking(const Common::Point &p1, const Common::Point &p2 } void WalkingState::setCallback(const GPL2Program *program, uint16 offset) { - _callback = program; - _callbackOffset = offset; + _callback = _callbackLast = program; + _callbackOffset = _callbackOffsetLast = offset; } void WalkingState::callback() { @@ -454,6 +454,10 @@ void WalkingState::callback() { _vm->_script->runWrapper(originalCallback, _callbackOffset, true, false); } +void WalkingState::callbackLast() { + setCallback(_callbackLast, _callbackOffsetLast); +} + bool WalkingState::continueWalkingOrClearPath() { const bool stillWalking = continueWalking(); if (!stillWalking) { diff --git a/engines/draci/walking.h b/engines/draci/walking.h index ee2b48d083..fcdef3830e 100644 --- a/engines/draci/walking.h +++ b/engines/draci/walking.h @@ -110,6 +110,8 @@ public: _lastAnimPhase = 0; _turningFinished = 0; _callbackOffset = 0; + _callbackOffsetLast = 0; + _callbackLast = 0; stopWalking(); } @@ -124,6 +126,7 @@ public: void setCallback(const GPL2Program *program, uint16 offset); void callback(); + void callbackLast(); bool isActive() const { return _path.size() > 0; } @@ -157,7 +160,9 @@ private: bool _turningFinished; const GPL2Program *_callback; + const GPL2Program *_callbackLast; uint16 _callbackOffset; + uint16 _callbackOffsetLast; // Initiates turning of the dragon into the direction for the next // segment / after walking. Returns false when there is nothing left -- cgit v1.2.3 From ad842e61da920952e1583c7d88e252fac43e4f6c Mon Sep 17 00:00:00 2001 From: lukaslw Date: Tue, 11 Mar 2014 17:10:11 +0100 Subject: DRACI: Inventory opening after finished callback. --- engines/draci/game.cpp | 2 +- engines/draci/walking.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index b98593c8a4..4893b0fe34 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -1218,7 +1218,7 @@ void Game::walkHero(int x, int y, SightDirection dir) { } // Save point of player's last target. - if(_loopStatus != kStatusInventory) { + if (_loopStatus != kStatusInventory) { _lastTarget = target; } diff --git a/engines/draci/walking.cpp b/engines/draci/walking.cpp index 1670c9a029..6914898ec1 100644 --- a/engines/draci/walking.cpp +++ b/engines/draci/walking.cpp @@ -452,6 +452,8 @@ void WalkingState::callback() { const GPL2Program &originalCallback = *_callback; _callback = NULL; _vm->_script->runWrapper(originalCallback, _callbackOffset, true, false); + _callbackLast = NULL; + _callbackOffset = NULL; } void WalkingState::callbackLast() { -- cgit v1.2.3 From bfc9afbb3290a05b442ffbb5c467ccdf559b722e Mon Sep 17 00:00:00 2001 From: D G Turner Date: Tue, 29 Apr 2014 03:26:53 +0100 Subject: PS2: Add support for building against old SDK if PS2SDK_OLD envvar set. This will allow compilation using the older SDK until the buildbot PS2 toolchain SDK can be upgraded and we can confirm the newer SDK builds are working correctly. --- configure | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure b/configure index b901943c7e..f0c01cea42 100755 --- a/configure +++ b/configure @@ -2316,7 +2316,9 @@ case $_host_os in CXXFLAGS="$CXXFLAGS -G2" DEFINES="$DEFINES -D_EE" DEFINES="$DEFINES -D__PLAYSTATION2__" - DEFINES="$DEFINES -D__NEW_PS2SDK__" + if test -z "$PS2SDK_OLD"; then + DEFINES="$DEFINES -D__NEW_PS2SDK__" + fi ;; ps3) # Force use of SDL and freetype from the ps3 toolchain -- cgit v1.2.3 From 0698ae4a0728403f6f5140b6521185ff3c007c8c Mon Sep 17 00:00:00 2001 From: D G Turner Date: Tue, 29 Apr 2014 03:40:45 +0100 Subject: SCI: Disable detection of "SCI Narration Demo" fangame. This is not supported as it requires network access to use the Google Translate API, which is not supported by OSystem. --- engines/sci/detection_tables.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h index e7304f8d90..8c5f9be425 100644 --- a/engines/sci/detection_tables.h +++ b/engines/sci/detection_tables.h @@ -4054,7 +4054,10 @@ static const struct ADGameDescription SciGameDescriptions[] = { FANMADE("SCI Capture the Flag", "4cd679a51d93b8b27c6b38d81be24b8b", 432, "98ae1f6ed7b4c21f88addbf643dd1d2f", 147878), FANMADE("SCI Companion Template", "ad54d4f504086cd597aa2348d0aa3b09", 354, "6798b7b601ce8154c1d1bc0f0edcdd18", 113061), FANMADE("SCI Logging Demo", "615c30c1445ea9349847e8868312a674", 558, "2df6858526177612ef9473e7af5b31c6", 171012), +#ifdef 0 + // Disabled as this requires network access to the Google Translate API, which is not available as OSystem has no network API. FANMADE("SCI Narration Demo", "731f4f2b726a13c153380af08da16591", 360, "38c80558fb942e8568f011d4a1a4af59", 109789), +#endif FANMADE("SCI Programming April 2010 Competition Template", "36e5c4011dd7c92e1ae4c6fede7d698d", 456, "20c87fbb7f73e2a3eb2c5dfab4d76b5a", 142221), FANMADE("SCI Studio Template 3.0", "ca0dc8d586e0a8670b7621cde090b532", 354, "58a48ee692a86c0575e6bd0b00a92b9a", 113097), FANMADE("SCI Quest", "9067e1f1e54436d2dbfce855524bc84a", 552, "ffa7d355cd9223f245289108a696bcd2", 149634), -- cgit v1.2.3 From c81099d3900ceb5e2eacd60770735ae9f6d706f3 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 29 Apr 2014 07:51:57 +0300 Subject: FULLPIPE: Implement ModalSaveGame::setup() --- engines/fullpipe/constants.h | 42 ++++++++++++++++++ engines/fullpipe/modal.cpp | 102 ++++++++++++++++++++++++++++++++++++++++--- engines/fullpipe/modal.h | 16 ++++++- 3 files changed, 154 insertions(+), 6 deletions(-) diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h index f76a12fb2b..b257fca949 100644 --- a/engines/fullpipe/constants.h +++ b/engines/fullpipe/constants.h @@ -292,6 +292,48 @@ namespace Fullpipe { #define PIC_MOV_CANCEL 5345 #define PIC_MOV_OK 5344 +// Saveload dialog +#define PIC_MLD_BGR 4645 +#define PIC_MLD_CANCEL_D 4648 +#define PIC_MLD_CANCEL_L 4649 +#define PIC_MLD_OK_D 4646 +#define PIC_MLD_OK_L 4647 +#define PIC_MSV_0_D 4643 +#define PIC_MSV_0_L 4644 +#define PIC_MSV_1_D 4651 +#define PIC_MSV_1_L 4660 +#define PIC_MSV_2_D 4652 +#define PIC_MSV_2_L 4661 +#define PIC_MSV_3_D 4653 +#define PIC_MSV_3_L 4662 +#define PIC_MSV_4_D 4654 +#define PIC_MSV_4_L 4663 +#define PIC_MSV_5_D 4655 +#define PIC_MSV_5_L 4664 +#define PIC_MSV_6_D 4656 +#define PIC_MSV_6_L 4665 +#define PIC_MSV_7_D 4657 +#define PIC_MSV_7_L 4666 +#define PIC_MSV_8_D 4658 +#define PIC_MSV_8_L 4667 +#define PIC_MSV_9_D 4659 +#define PIC_MSV_9_L 4668 +#define PIC_MSV_BGR 4634 +#define PIC_MSV_CANCEL_D 4637 +#define PIC_MSV_CANCEL_L 4638 +#define PIC_MSV_DOTS_D 4670 +#define PIC_MSV_DOTS_L 4669 +#define PIC_MSV_DOT_D 5188 +#define PIC_MSV_DOT_L 5189 +#define PIC_MSV_EMPTY_D 4639 +#define PIC_MSV_EMPTY_L 4640 +#define PIC_MSV_FULL_D 4641 +#define PIC_MSV_FULL_L 4642 +#define PIC_MSV_OK_D 4635 +#define PIC_MSV_OK_L 4636 +#define PIC_MSV_SPACE_D 5190 +#define PIC_MSV_SPACE_L 5191 + // Intro #define ANI_IN1MAN 5110 #define MSG_INTR_ENDINTRO 5139 diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 459c714984..906e4e6896 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -1468,10 +1468,10 @@ ModalSaveGame::~ModalSaveGame() { _arrayD.clear(); _arrayL.clear(); - for (uint i = 0; i < _filenames.size(); i++) - free(_filenames[i]); + for (uint i = 0; i < _files.size(); i++) + free(_files[i]); - _filenames.clear(); + _files.clear(); } void ModalSaveGame::setScene(Scene *sc) { @@ -1526,16 +1526,108 @@ bool ModalSaveGame::init(int counterdiff) { } void ModalSaveGame::setup(Scene *sc, int mode) { - warning("STUB: ModalSaveGame::setup()"); + _files.clear(); + _arrayL.clear(); + _arrayD.clear(); + _mode = mode; + + if (mode) { + _bgr = sc->getPictureObjectById(PIC_MSV_BGR, 0); + _cancelD = sc->getPictureObjectById(PIC_MSV_CANCEL_D, 0); + _cancelL = sc->getPictureObjectById(PIC_MSV_CANCEL_L, 0); + _okD = sc->getPictureObjectById(PIC_MSV_OK_D, 0); + _okL = sc->getPictureObjectById(PIC_MSV_OK_L, 0); + _emptyD = sc->getPictureObjectById(PIC_MSV_EMPTY_D, 0); + _emptyL = sc->getPictureObjectById(PIC_MSV_EMPTY_L, 0); + } else { + _bgr = sc->getPictureObjectById(PIC_MLD_BGR, 0); + _cancelD = sc->getPictureObjectById(PIC_MLD_CANCEL_D, 0); + _cancelL = sc->getPictureObjectById(PIC_MLD_CANCEL_L, 0); + _okD = sc->getPictureObjectById(PIC_MLD_OK_D, 0); + _okL = sc->getPictureObjectById(PIC_MLD_OK_L, 0); + _emptyD = sc->getPictureObjectById(PIC_MSV_EMPTY_D, 0); + _emptyL = sc->getPictureObjectById(PIC_MSV_EMPTY_D, 0); + } + + _fullD = sc->getPictureObjectById(PIC_MSV_FULL_D, 0); + _fullL = sc->getPictureObjectById(PIC_MSV_FULL_L, 0); + _queryRes = -1; + + _arrayL.push_back(sc->getPictureObjectById(PIC_MSV_0_D, 0)); + _arrayD.push_back(sc->getPictureObjectById(PIC_MSV_0_L, 0)); + _arrayL.push_back(sc->getPictureObjectById(PIC_MSV_1_D, 0)); + _arrayD.push_back(sc->getPictureObjectById(PIC_MSV_1_L, 0)); + _arrayL.push_back(sc->getPictureObjectById(PIC_MSV_2_D, 0)); + _arrayD.push_back(sc->getPictureObjectById(PIC_MSV_2_L, 0)); + _arrayL.push_back(sc->getPictureObjectById(PIC_MSV_3_D, 0)); + _arrayD.push_back(sc->getPictureObjectById(PIC_MSV_3_L, 0)); + _arrayL.push_back(sc->getPictureObjectById(PIC_MSV_4_D, 0)); + _arrayD.push_back(sc->getPictureObjectById(PIC_MSV_4_L, 0)); + _arrayL.push_back(sc->getPictureObjectById(PIC_MSV_5_D, 0)); + _arrayD.push_back(sc->getPictureObjectById(PIC_MSV_5_L, 0)); + _arrayL.push_back(sc->getPictureObjectById(PIC_MSV_6_D, 0)); + _arrayD.push_back(sc->getPictureObjectById(PIC_MSV_6_L, 0)); + _arrayL.push_back(sc->getPictureObjectById(PIC_MSV_7_D, 0)); + _arrayD.push_back(sc->getPictureObjectById(PIC_MSV_7_L, 0)); + _arrayL.push_back(sc->getPictureObjectById(PIC_MSV_8_D, 0)); + _arrayD.push_back(sc->getPictureObjectById(PIC_MSV_8_L, 0)); + _arrayL.push_back(sc->getPictureObjectById(PIC_MSV_9_D, 0)); + _arrayD.push_back(sc->getPictureObjectById(PIC_MSV_9_L, 0)); + _arrayL.push_back(sc->getPictureObjectById(PIC_MSV_DOTS_D, 0)); + _arrayD.push_back(sc->getPictureObjectById(PIC_MSV_DOTS_L, 0)); + _arrayL.push_back(sc->getPictureObjectById(PIC_MSV_DOT_D, 0)); + _arrayD.push_back(sc->getPictureObjectById(PIC_MSV_DOT_L, 0)); + _arrayL.push_back(sc->getPictureObjectById(PIC_MSV_SPACE_D, 0)); + _arrayD.push_back(sc->getPictureObjectById(PIC_MSV_SPACE_L, 0)); + + Common::Point point; + + int x = _bgr->_ox + _bgr->getDimensions(&point)->x / 2; + int y = _bgr->_oy + 90; + bool flag = false; + int w; + FileInfo *fileinfo; + + for (int i = 0; i < 7; i++) { + fileinfo = new FileInfo; + + snprintf(fileinfo->filename, 160, "save%02d.sav", i); + + if (!getFileInfo(fileinfo->filename, fileinfo) || flag) { + flag = true; + w = _emptyD->getDimensions(&point)->x; + } else { + w = 0; + + for (int j = 0; j < 16; j++) { + _arrayL[j]->getDimensions(&point); + w += point.x + 2; + } + } + + fileinfo->fx1 = x - w / 2; + fileinfo->fx2 = x + w / 2; + fileinfo->fy1 = y; + fileinfo->fy2 = y + _emptyD->getDimensions(&point)->y; + + _files.push_back(fileinfo); + + y = fileinfo->fy2 + 3; + } } char *ModalSaveGame::getSaveName() { if (_queryRes < 0) return 0; - return _filenames[_queryRes]; + return _files[_queryRes]->filename; } +bool ModalSaveGame::getFileInfo(char *filename, FileInfo *fileinfo) { + warning("STUB: ModalSaveGame::getFileInfo()"); + + return false; +} void FullpipeEngine::openHelp() { if (!_modalObject) { diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h index e2962ab595..aced31573b 100644 --- a/engines/fullpipe/modal.h +++ b/engines/fullpipe/modal.h @@ -29,6 +29,19 @@ class PictureObject; class Picture; class Sound; +struct FileInfo { + char filename[260]; + int fi_104; + int day; + int month; + int year; + int time; + int fx1; + int fx2; + int fy1; + int fy2; +}; + class BaseModalObject { public: @@ -253,6 +266,7 @@ public: void processKey(int key); char *getSaveName(); + bool getFileInfo(char *filename, FileInfo *fileinfo); Common::Rect _rect; int _oldBgX; @@ -269,7 +283,7 @@ public: Scene *_menuScene; int _mode; ModalQuery *_queryDlg; - Common::Array _filenames; + Common::Array _files; Common::Array _arrayL; Common::Array _arrayD; int _queryRes; -- cgit v1.2.3 From 36879872915e04a08aa7e9b3e0b39c5a72369132 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 29 Apr 2014 08:14:43 +0300 Subject: FULLPIPE: Fix ModalSaveGame::setup() --- engines/fullpipe/modal.cpp | 6 +++--- engines/fullpipe/modal.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 906e4e6896..bba5df0cd5 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -1584,17 +1584,17 @@ void ModalSaveGame::setup(Scene *sc, int mode) { int x = _bgr->_ox + _bgr->getDimensions(&point)->x / 2; int y = _bgr->_oy + 90; - bool flag = false; int w; FileInfo *fileinfo; for (int i = 0; i < 7; i++) { fileinfo = new FileInfo; + memset(fileinfo, 0, sizeof(FileInfo)); snprintf(fileinfo->filename, 160, "save%02d.sav", i); - if (!getFileInfo(fileinfo->filename, fileinfo) || flag) { - flag = true; + if (!getFileInfo(fileinfo->filename, fileinfo)) { + fileinfo->empty = true; w = _emptyD->getDimensions(&point)->x; } else { w = 0; diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h index aced31573b..a214b1c639 100644 --- a/engines/fullpipe/modal.h +++ b/engines/fullpipe/modal.h @@ -31,7 +31,7 @@ class Sound; struct FileInfo { char filename[260]; - int fi_104; + bool empty; int day; int month; int year; -- cgit v1.2.3 From 55127114349219d57b7a9143a5d3d9bfd97e3e88 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 29 Apr 2014 09:39:24 +0200 Subject: CGE: Replace magic numbers with defines. --- engines/cge/cge.cpp | 2 +- engines/cge/vga13h.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp index 3f7aa4abc9..7058314b9d 100644 --- a/engines/cge/cge.cpp +++ b/engines/cge/cge.cpp @@ -219,7 +219,7 @@ Common::Error CGEEngine::run() { } // Initialize graphics using following: - initGraphics(320, 200, false); + initGraphics(kScrWidth, kScrHeight, false); // Setup necessary game objects init(); diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index d5e1be5122..d7dccd2c65 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -819,14 +819,14 @@ void Vga::update() { _setPal = false; } if (_vm->_showBoundariesFl) { - Vga::_page[0]->hLine(0, 200 - kPanHeight, 320, 0xee); + Vga::_page[0]->hLine(0, kScrHeight - kPanHeight, kScrWidth, 0xee); if (_vm->_barriers[_vm->_now]._horz != 255) { for (int i = 0; i < 8; i++) - Vga::_page[0]->vLine((_vm->_barriers[_vm->_now]._horz * 8) + i, 0, 200, 0xff); + Vga::_page[0]->vLine((_vm->_barriers[_vm->_now]._horz * 8) + i, 0, kScrHeight, 0xff); } if (_vm->_barriers[_vm->_now]._vert != 255) { for (int i = 0; i < 4; i++) - Vga::_page[0]->hLine(0, 80 + (_vm->_barriers[_vm->_now]._vert * 4) + i, 320, 0xff); + Vga::_page[0]->hLine(0, 80 + (_vm->_barriers[_vm->_now]._vert * 4) + i, kScrWidth, 0xff); } } -- cgit v1.2.3