Remove trailing whitespaces.

svn-id: r18604
This commit is contained in:
Eugene Sandulenko 2005-07-30 21:11:48 +00:00
parent 86ab70b149
commit 6b4484472b
560 changed files with 11703 additions and 11703 deletions

View file

@ -65,7 +65,7 @@ static Err AppStartCheckNotify() {
UInt32 romVersion; UInt32 romVersion;
Err err; Err err;
err = FtrGet(sysFtrCreator, sysFtrNumNotifyMgrVersion, &romVersion); err = FtrGet(sysFtrCreator, sysFtrNumNotifyMgrVersion, &romVersion);
if (!err) { if (!err) {
UInt16 cardNo; UInt16 cardNo;
LocalID dbID; LocalID dbID;
@ -111,13 +111,13 @@ static Err AppStartLoadSkin() {
if (err) if (err)
FrmCustomAlert(FrmWarnAlert,"No skin found.\nScummVM will start in direct mode.",0,0); FrmCustomAlert(FrmWarnAlert,"No skin found.\nScummVM will start in direct mode.",0,0);
//FrmCustomAlert(FrmErrorAlert,"No skin found.\nPlease install a skin and restart ScummVM.",0,0); //FrmCustomAlert(FrmErrorAlert,"No skin found.\nPlease install a skin and restart ScummVM.",0,0);
return err; return err;
} }
static Err AppStartCheckMathLib() { static Err AppStartCheckMathLib() {
Err e = MathlibInit(); Err e = MathlibInit();
switch (e) { switch (e) {
case errNone: case errNone:
break; break;
@ -128,7 +128,7 @@ static Err AppStartCheckMathLib() {
FrmCustomAlert(FrmErrorAlert,"Can't open MathLib !",0,0); FrmCustomAlert(FrmErrorAlert,"Can't open MathLib !",0,0);
break; break;
} }
return e; return e;
} }
@ -143,7 +143,7 @@ void WinScreenGetPitch() {
WinScreenGetAttribute(winScreenRowBytes, &(gVars->screenPitch)); WinScreenGetAttribute(winScreenRowBytes, &(gVars->screenPitch));
if (OPTIONS_TST(kOptMode16Bit)) if (OPTIONS_TST(kOptMode16Bit))
gVars->screenPitch /= 2; // this value is used only in-game and in 8bit mode, so if we are in 16Bit 8bit = 16bit/2 gVars->screenPitch /= 2; // this value is used only in-game and in 8bit mode, so if we are in 16Bit 8bit = 16bit/2
// FIXME : hack for TT3 simulator (and real ?) return 28 on landscape mode // FIXME : hack for TT3 simulator (and real ?) return 28 on landscape mode
if (gVars->screenPitch < gVars->screenFullWidth) if (gVars->screenPitch < gVars->screenFullWidth)
gVars->screenPitch = gVars->screenFullWidth; gVars->screenPitch = gVars->screenFullWidth;
@ -175,12 +175,12 @@ void PINGetScreenDimensions() {
gVars->screenFullHeight = y << 1; gVars->screenFullHeight = y << 1;
OPTIONS_SET(kOptModeWide); OPTIONS_SET(kOptModeWide);
if (curOrientation == sysOrientationLandscape || if (curOrientation == sysOrientationLandscape ||
curOrientation == sysOrientationReverseLandscape curOrientation == sysOrientationReverseLandscape
) )
OPTIONS_SET(kOptModeLandscape); OPTIONS_SET(kOptModeLandscape);
StatShow(); StatShow();
PINSetInputAreaState(pinInputAreaOpen); PINSetInputAreaState(pinInputAreaOpen);
PINSetInputTriggerState(pinInputTriggerDisabled); PINSetInputTriggerState(pinInputTriggerDisabled);
@ -208,7 +208,7 @@ static void AppStartCheckScreenSize() {
SilkLibResizeDispWin(slkRefNum, silkResizeMax); SilkLibResizeDispWin(slkRefNum, silkResizeMax);
HRWinGetWindowExtent(gVars->HRrefNum, &gVars->screenFullWidth, &gVars->screenFullHeight); HRWinGetWindowExtent(gVars->HRrefNum, &gVars->screenFullWidth, &gVars->screenFullHeight);
SilkLibResizeDispWin(slkRefNum, silkResizeNormal); SilkLibResizeDispWin(slkRefNum, silkResizeNormal);
SilkLibDisableResize(slkRefNum); SilkLibDisableResize(slkRefNum);
} else { } else {
VskSetState(slkRefNum, vskStateEnable, (gVars->slkVersion == vskVersionNum2 ? vskResizeVertically : vskResizeHorizontally)); VskSetState(slkRefNum, vskStateEnable, (gVars->slkVersion == vskVersionNum2 ? vskResizeVertically : vskResizeHorizontally));
@ -218,7 +218,7 @@ static void AppStartCheckScreenSize() {
VskSetState(slkRefNum, vskStateEnable, vskResizeDisable); VskSetState(slkRefNum, vskStateEnable, vskResizeDisable);
OPTIONS_SET((version == vskVersionNum3 ? kOptModeLandscape : kOptNone)); OPTIONS_SET((version == vskVersionNum3 ? kOptModeLandscape : kOptNone));
} }
OPTIONS_SET(kOptModeWide); OPTIONS_SET(kOptModeWide);
// Tapwave Zodiac and other DIA API compatible devices // Tapwave Zodiac and other DIA API compatible devices
@ -226,7 +226,7 @@ static void AppStartCheckScreenSize() {
} else { } else {
PINGetScreenDimensions(); PINGetScreenDimensions();
} }
WinScreenGetPitch(); WinScreenGetPitch();
} }
@ -261,7 +261,7 @@ static void AppStartSetMemory() {
min(kMemScummNewCostGames, 2500000); min(kMemScummNewCostGames, 2500000);
min(kMemSimon1Games, 1000000); min(kMemSimon1Games, 1000000);
min(kMemSimon2Games, 2000000); min(kMemSimon2Games, 2000000);
} }
#undef threshold #undef threshold
@ -352,7 +352,7 @@ Err AppStart(void) {
gPrefs->debug = false; gPrefs->debug = false;
gPrefs->exitLauncher = true; gPrefs->exitLauncher = true;
gPrefs->stdPalette = OPTIONS_TST(kOptDeviceOS5); gPrefs->stdPalette = OPTIONS_TST(kOptDeviceOS5);
} else { } else {
PrefGetAppPreferences(appFileCreator, appPrefID, gPrefs, &dataSize, true); PrefGetAppPreferences(appFileCreator, appPrefID, gPrefs, &dataSize, true);
} }
@ -362,7 +362,7 @@ Err AppStart(void) {
error = AppStartCheckHRmode(); error = AppStartCheckHRmode();
if (error) return (error); if (error) return (error);
// error = AppStartLoadSkin(); // error = AppStartLoadSkin();
// if (error) return (error); // if (error) return (error);
bDirectMode = (AppStartLoadSkin() != errNone); bDirectMode = (AppStartLoadSkin() != errNone);
@ -410,8 +410,8 @@ static Err AppStopCheckNotify()
{ {
UInt32 romVersion; UInt32 romVersion;
Err err; Err err;
err = FtrGet(sysFtrCreator, sysFtrNumNotifyMgrVersion, &romVersion); err = FtrGet(sysFtrCreator, sysFtrNumNotifyMgrVersion, &romVersion);
if (!err) { if (!err) {
UInt16 cardNo; UInt16 cardNo;
LocalID dbID; LocalID dbID;
@ -424,7 +424,7 @@ static Err AppStopCheckNotify()
SysNotifyUnregister(cardNo, dbID, sysNotifyDisplayResizedEvent, sysNotifyNormalPriority); SysNotifyUnregister(cardNo, dbID, sysNotifyDisplayResizedEvent, sysNotifyNormalPriority);
} }
} }
return err; return err;
} }
@ -437,7 +437,7 @@ void AppStop(void) {
// Close and move Game list database // Close and move Game list database
GamCloseDatabase(false); GamCloseDatabase(false);
// Write the saved preferences / saved-state information. This data // Write the saved preferences / saved-state information. This data
// will saved during a HotSync backup. // will saved during a HotSync backup.
SavePrefs(); SavePrefs();

View file

@ -17,7 +17,7 @@ void ArgsAdd(Char **argvP, const Char *argP, const Char *parmP, UInt8 *countArgP
UInt16 len2 = 0; UInt16 len2 = 0;
UInt16 len1 = StrLen(argP); UInt16 len1 = StrLen(argP);
if (len1 > 0) { if (len1 > 0) {
if (parmP) if (parmP)
len2 = StrLen(parmP); len2 = StrLen(parmP);
@ -25,7 +25,7 @@ void ArgsAdd(Char **argvP, const Char *argP, const Char *parmP, UInt8 *countArgP
newArg = MemHandleNew(len1 + len2 + 1); // +1 = NULL CHAR newArg = MemHandleNew(len1 + len2 + 1); // +1 = NULL CHAR
*argvP = (Char *)MemHandleLock(newArg); *argvP = (Char *)MemHandleLock(newArg);
StrCopy(*argvP, argP); StrCopy(*argvP, argP);
if (parmP) if (parmP)
StrCat(*argvP, parmP); StrCat(*argvP, parmP);
} }
@ -44,7 +44,7 @@ void ArgsFree(Char **argvP) {
MemHandleUnlock(oldH); MemHandleUnlock(oldH);
MemHandleFree(oldH); MemHandleFree(oldH);
} }
oldH = MemPtrRecoverHandle(argvP); oldH = MemPtrRecoverHandle(argvP);
MemHandleUnlock(oldH); MemHandleUnlock(oldH);
MemHandleFree(oldH); MemHandleFree(oldH);

View file

@ -10,8 +10,8 @@
extern "C" extern "C"
unsigned long PNO_Main( unsigned long PNO_Main(
const void *emulStateP, const void *emulStateP,
void *userData68KP, void *userData68KP,
Call68KFuncType *call68KFuncP); Call68KFuncType *call68KFuncP);
unsigned long PNO_Main(const void *emulStateP, void *userData68KP, Call68KFuncType *call68KFuncP) { unsigned long PNO_Main(const void *emulStateP, void *userData68KP, Call68KFuncType *call68KFuncP) {
@ -41,7 +41,7 @@ unsigned long PNO_Main(const void *emulStateP, void *userData68KP, Call68KFuncTy
#endif #endif
}; };
// needed before making any OS calls using the // needed before making any OS calls using the
// PACEInterface library // PACEInterface library
InitPACEInterface(emulStateP, call68KFuncP); InitPACEInterface(emulStateP, call68KFuncP);

View file

@ -47,6 +47,6 @@ UInt32 Display_blit(void *userData68KP) {
dstBuf += dstPitch; dstBuf += dstPitch;
} }
} }
return 0; return 0;
} }

View file

@ -23,6 +23,6 @@ UInt32 OSystem_CopyRectToScreen(void *userData68KP) {
buf += pitch; buf += pitch;
} while (--h); } while (--h);
} }
return 0; return 0;
} }

View file

@ -22,6 +22,6 @@ UInt32 Screen_decompressRLE0(void *userData68KP) {
dest += skip; dest += skip;
} }
} }
return 0; return 0;
} }

View file

@ -22,6 +22,6 @@ UInt32 Screen_decompressRLE7(void *userData68KP) {
dest += code; dest += code;
} }
} }
return 0; return 0;
} }

View file

@ -21,6 +21,6 @@ UInt32 Screen_drawSprite(void *userData68KP) {
sprData += sprPitch; sprData += sprPitch;
dest += _scrnSizeX; dest += _scrnSizeX;
} }
return 0; return 0;
} }

View file

@ -21,7 +21,7 @@ UInt32 Gdi_drawStripToScreen(void *userData68KP) {
// Compose the text over the game graphics // Compose the text over the game graphics
for (int h = 0; h < height; ++h) { for (int h = 0; h < height; ++h) {
for (int w = 0; w < width; ++w) { for (int w = 0; w < width; ++w) {
if (text[w] == CHARSET_MASK_TRANSPARENCY) if (text[w] == CHARSET_MASK_TRANSPARENCY)
dst[w] = src[w]; dst[w] = src[w];
else else
dst[w] = text[w]; dst[w] = text[w];
@ -30,6 +30,6 @@ UInt32 Gdi_drawStripToScreen(void *userData68KP) {
dst += _vm_screenWidth; dst += _vm_screenWidth;
text += _textSurface_pitch; text += _textSurface_pitch;
} }
return 0; return 0;
} }

View file

@ -49,6 +49,6 @@ UInt32 Screen_fastShrink(void *userData68KP) {
xCnt += 2; xCnt += 2;
} }
} }
return 0; return 0;
} }

View file

@ -1,5 +1,5 @@
#ifndef __MACROS_H__ #ifndef __MACROS_H__
#define __MACROS_H__ #define __MACROS_H__
#ifndef DISABLE_ARM #ifndef DISABLE_ARM
// macros for ARM calls // macros for ARM calls
@ -14,7 +14,7 @@
#define ARM_ADDM(member) dataARM.member = member; #define ARM_ADDM(member) dataARM.member = member;
#define ARM_ADDV(member, var) dataARM.member = var; #define ARM_ADDV(member, var) dataARM.member = var;
#define ARM_INIT(id) PnoType pno = { id, &dataARM }; #define ARM_INIT(id) PnoType pno = { id, &dataARM };
#define ARM_GETM(member) member = dataARM.member; #define ARM_GETM(member) member = dataARM.member;
#define ARM_GETV(member, var) var = dataARM.member; #define ARM_GETV(member, var) var = dataARM.member;
@ -33,7 +33,7 @@
#define ARM_CALL_VALUE(rsc, data, var) ARM(rsc).alignedHeader->userDataP = (UInt32)data; \ #define ARM_CALL_VALUE(rsc, data, var) ARM(rsc).alignedHeader->userDataP = (UInt32)data; \
var = PceNativeCall(ARM(rsc).pnoDesc.entry, ARM(rsc).alignedHeader); var = PceNativeCall(ARM(rsc).pnoDesc.entry, ARM(rsc).alignedHeader);
#else #else
// no ARM = empty definition // no ARM = empty definition
#define ARM_START(TYPE) #define ARM_START(TYPE)
@ -68,7 +68,7 @@
#define GET_XPTR(var, dst, src, TYPE) \ #define GET_XPTR(var, dst, src, TYPE) \
dst.var = (TYPE *)ReadUnaligned32(&src->var); dst.var = (TYPE *)ReadUnaligned32(&src->var);
#define GET_X32(var, dst, src) \ #define GET_X32(var, dst, src) \
dst.var = ReadUnaligned32(&src->var); dst.var = ReadUnaligned32(&src->var);

View file

@ -96,7 +96,7 @@ typedef struct {
typedef struct { typedef struct {
void *v1; // struct v1 * void *v1; // struct v1 *
const byte *_srcptr; const byte *_srcptr;
int _height; int _height;
@ -118,11 +118,11 @@ typedef struct {
typedef struct { typedef struct {
int width; int width;
int height; int height;
const byte *src; const byte *src;
byte *dst; byte *dst;
const byte *text; const byte *text;
int _vm_screenWidth; int _vm_screenWidth;
uint16 vs_pitch; uint16 vs_pitch;
uint16 _textSurface_pitch; uint16 _textSurface_pitch;

View file

@ -11,7 +11,7 @@
UInt32 CostumeRenderer_proc3(void *userData68KP) { UInt32 CostumeRenderer_proc3(void *userData68KP) {
// import variables // import variables
V1Type v1; V1Type v1;
SETPTRV (V1CodecType * , v1, v1comp ) SETPTRV (V1CodecType * , v1, v1comp )
SETPTR (const byte * ,_srcptr ) SETPTR (const byte * ,_srcptr )
@ -27,7 +27,7 @@ UInt32 CostumeRenderer_proc3(void *userData68KP) {
SETPTR (byte * ,_shadow_table ) SETPTR (byte * ,_shadow_table )
SETPTR (byte * ,_palette ) SETPTR (byte * ,_palette )
SET8 (byte ,_shadow_mode ) SET8 (byte ,_shadow_mode )
MSETPTR (const byte * ,scaletable ) MSETPTR (const byte * ,scaletable )
MSET8 (byte ,mask ) MSET8 (byte ,mask )
MSET8 (byte ,shr ) MSET8 (byte ,shr )

View file

@ -71,6 +71,6 @@ UInt32 Screen_renderParallax(void *userData68KP) {
} }
} }
} }
return 0; return 0;
} }

View file

@ -19,6 +19,6 @@ UInt32 Screen_draw(void *userData68KP) {
dest++; dest++;
src++; src++;
} }
return 0; return 0;
} }

View file

@ -24,7 +24,7 @@ UInt32 OSystem_updateScreen_wideLandscape(void *userData68KP) {
MemMove(dst, dst - 480, 480); MemMove(dst, dst - 480, 480);
dst += 480; dst += 480;
} }
return 0; return 0;
} }

View file

@ -38,6 +38,6 @@ UInt32 OSystem_updateScreen_widePortrait(void *userData68KP) {
MemMove(dst, dst - WIDE_PITCH, 300); // 300 = 200 x 1.5 MemMove(dst, dst - WIDE_PITCH, 300); // 300 = 200 x 1.5
dst += WIDE_PITCH; dst += WIDE_PITCH;
} }
return 0; return 0;
} }

View file

@ -5,7 +5,7 @@
enum { enum {
GBVARS_GUIFONT_INDEX = 0, GBVARS_GUIFONT_INDEX = 0,
GBVARS_FONTBITS_INDEX GBVARS_FONTBITS_INDEX
}; };
// Scumm // Scumm
enum { enum {
@ -56,7 +56,7 @@ enum {
GBVARS_SPANISHVIDEOFONT_INDEX, GBVARS_SPANISHVIDEOFONT_INDEX,
GBVARS_VIDEOFONT_INDEX, GBVARS_VIDEOFONT_INDEX,
GBVARS_SIMON1CURSOR_INDEX GBVARS_SIMON1CURSOR_INDEX
// GBVARS_SIMON2CURSORS_INDEX // GBVARS_SIMON2CURSORS_INDEX
}; };
// Queen // Queen
enum { enum {

View file

@ -54,7 +54,7 @@ void DefaultCDPlayer::update() {
// not fully played // not fully played
if (_sys->getMillis() < _defTrackEndFrame) if (_sys->getMillis() < _defTrackEndFrame)
return; return;
if (_defLoops == 0) if (_defLoops == 0)
return; return;
@ -77,14 +77,14 @@ void DefaultCDPlayer::stop() { /* Stop CD Audio in 1/10th of a second */
void DefaultCDPlayer::play(int track, int num_loops, int start_frame, int duration) { void DefaultCDPlayer::play(int track, int num_loops, int start_frame, int duration) {
if (!num_loops && !start_frame) if (!num_loops && !start_frame)
return; return;
UInt32 fullLength; UInt32 fullLength;
_defLoops = num_loops; _defLoops = num_loops;
start_frame = TO_MSECS(start_frame); start_frame = TO_MSECS(start_frame);
duration = TO_MSECS(duration); duration = TO_MSECS(duration);
// frame in milli-seconds // frame in milli-seconds
_defStopTime = 0; _defStopTime = 0;
fullLength = start_frame + gVars->CD.defaultTrackLength * 1000; fullLength = start_frame + gVars->CD.defaultTrackLength * 1000;
@ -96,7 +96,7 @@ void DefaultCDPlayer::play(int track, int num_loops, int start_frame, int durati
} else { } else {
_defTrackLength = fullLength; _defTrackLength = fullLength;
} }
// try to play the track // try to play the track
_defTrackEndFrame = _sys->getMillis() + _defTrackLength; _defTrackEndFrame = _sys->getMillis() + _defTrackLength;
} }

View file

@ -19,30 +19,30 @@
* $Header$ * $Header$
* *
*/ */
#ifndef CD_DEFAULT_H #ifndef CD_DEFAULT_H
#define CD_DEFAULT_H #define CD_DEFAULT_H
#include "cdaudio.h" #include "cdaudio.h"
class DefaultCDPlayer : public CDAudio { class DefaultCDPlayer : public CDAudio {
public: public:
DefaultCDPlayer(OSystem *sys); DefaultCDPlayer(OSystem *sys);
bool init(); bool init();
void release(); void release();
bool poll(); bool poll();
void update(); void update();
void play(int track, int num_loops, int start_frame, int duration); void play(int track, int num_loops, int start_frame, int duration);
void stop(); void stop();
private: private:
OSystem *_sys; OSystem *_sys;
// cdrom // cdrom
UInt16 _defLoops; UInt16 _defLoops;
UInt32 _defStopTime, _defTrackEndFrame, _defTrackLength; UInt32 _defStopTime, _defTrackEndFrame, _defTrackLength;
}; };
#endif #endif

View file

@ -47,7 +47,7 @@ bool MsaCDPlayer::init() {
if (!(error = FtrGet(sonySysFtrCreator, sonySysFtrNumSysInfoP, (UInt32*)&sonySysFtrSysInfoP))) { if (!(error = FtrGet(sonySysFtrCreator, sonySysFtrNumSysInfoP, (UInt32*)&sonySysFtrSysInfoP))) {
// not found with audio adapter ?! // not found with audio adapter ?!
//if (sonySysFtrSysInfoP->libr & sonySysFtrSysInfoLibrMsa) { //if (sonySysFtrSysInfoP->libr & sonySysFtrSysInfoLibrMsa) {
if ((error = SysLibFind(sonySysLibNameMsa, &_msaRefNum))) if ((error = SysLibFind(sonySysLibNameMsa, &_msaRefNum)))
if (error == sysErrLibNotFound) if (error == sysErrLibNotFound)
error = SysLibLoad(sonySysFileTMsaLib, sonySysFileCMsaLib, &_msaRefNum); error = SysLibLoad(sonySysFileTMsaLib, sonySysFileCMsaLib, &_msaRefNum);
@ -57,11 +57,11 @@ bool MsaCDPlayer::init() {
// this doesn't work the same way on build-in MP3 device and external MP3 devices // this doesn't work the same way on build-in MP3 device and external MP3 devices
if (!error) { if (!error) {
//MsaLibClose(_msaRefNum, msaLibOpenModeAlbum); // close the lib if we previously let it open (?) Need to add Notify for sonySysNotifyMsaEnforceOpenEvent just in case ... //MsaLibClose(_msaRefNum, msaLibOpenModeAlbum); // close the lib if we previously let it open (?) Need to add Notify for sonySysNotifyMsaEnforceOpenEvent just in case ...
error = MsaLibOpen(_msaRefNum, msaLibOpenModeAlbum); error = MsaLibOpen(_msaRefNum, msaLibOpenModeAlbum);
//if (error == msaErrAlreadyOpen) //if (error == msaErrAlreadyOpen)
// error = MsaLibEnforceOpen(_msaRefNum, msaLibOpenModeAlbum, appFileCreator); // error = MsaLibEnforceOpen(_msaRefNum, msaLibOpenModeAlbum, appFileCreator);
//error = (error != msaErrStillOpen) ? error : errNone; //error = (error != msaErrStillOpen) ? error : errNone;
} }
//} //}
@ -147,7 +147,7 @@ void MsaCDPlayer::update() {
} }
MsaStop(_msaRefNum, true); MsaStop(_msaRefNum, true);
if (_msaLoops == 0) if (_msaLoops == 0)
return; return;
@ -185,13 +185,13 @@ void MsaCDPlayer::play(int track, int num_loops, int start_frame, int duration)
if (!num_loops && !start_frame) if (!num_loops && !start_frame)
return; return;
_msaTrack = track + gVars->CD.firstTrack - 1; // first track >= 1 ?, not 0 (0=album) _msaTrack = track + gVars->CD.firstTrack - 1; // first track >= 1 ?, not 0 (0=album)
_msaLoops = num_loops; _msaLoops = num_loops;
_msaStartFrame = TO_MSECS(start_frame); _msaStartFrame = TO_MSECS(start_frame);
_msaDuration = TO_MSECS(duration); _msaDuration = TO_MSECS(duration);
Err e; Err e;
MemHandle trackH; MemHandle trackH;
// stop current play if any // stop current play if any
@ -206,19 +206,19 @@ void MsaCDPlayer::play(int track, int num_loops, int start_frame, int duration)
MsaTime msaTime; MsaTime msaTime;
MsaTrackInfo *trackP; MsaTrackInfo *trackP;
UInt32 SU, fullLength; UInt32 SU, fullLength;
// FIXME (?) : this enable MsaSuToTime to return the right value in some cases // FIXME (?) : this enable MsaSuToTime to return the right value in some cases
MsaPlay(_msaRefNum, _msaTrack, 0, msa_PBRATE_SP); MsaPlay(_msaRefNum, _msaTrack, 0, msa_PBRATE_SP);
MsaStop(_msaRefNum, true); MsaStop(_msaRefNum, true);
// get the msa time // get the msa time
trackP = (MsaTrackInfo *)MemHandleLock(trackH); trackP = (MsaTrackInfo *)MemHandleLock(trackH);
MsaSuToTime(_msaRefNum, trackP->totalsu, &msaTime); MsaSuToTime(_msaRefNum, trackP->totalsu, &msaTime);
SU = trackP->totalsu; SU = trackP->totalsu;
MemPtrUnlock(trackP); MemPtrUnlock(trackP);
MemHandleFree(trackH); MemHandleFree(trackH);
// MSA frame in milli-seconds // MSA frame in milli-seconds
fullLength = FROM_MIN(msaTime.minute); fullLength = FROM_MIN(msaTime.minute);
fullLength += FROM_SEC(msaTime.second); fullLength += FROM_SEC(msaTime.second);
fullLength += msaTime.frame; fullLength += msaTime.frame;
@ -231,7 +231,7 @@ void MsaCDPlayer::play(int track, int num_loops, int start_frame, int duration)
} else { } else {
_msaTrackLength = fullLength; _msaTrackLength = fullLength;
} }
// try to play the track // try to play the track
if (start_frame == 0 && duration == 0) { if (start_frame == 0 && duration == 0) {
MsaPlay(_msaRefNum, _msaTrack, 0, msa_PBRATE_SP); MsaPlay(_msaRefNum, _msaTrack, 0, msa_PBRATE_SP);
@ -241,7 +241,7 @@ void MsaCDPlayer::play(int track, int num_loops, int start_frame, int duration)
_msaTrackStartSu = (UInt32) ((float)(_msaStartFrame) / ((float)fullLength / (float)SU)); _msaTrackStartSu = (UInt32) ((float)(_msaStartFrame) / ((float)fullLength / (float)SU));
_msaTrackEndSu = (UInt32) ((float)(_msaTrackLength) / ((float)fullLength / (float)SU)); _msaTrackEndSu = (UInt32) ((float)(_msaTrackLength) / ((float)fullLength / (float)SU));
_msaTrackEndSu += _msaTrackStartSu; _msaTrackEndSu += _msaTrackStartSu;
if (_msaTrackEndSu > SU) if (_msaTrackEndSu > SU)
_msaTrackEndSu = SU; _msaTrackEndSu = SU;

View file

@ -19,30 +19,30 @@
* $Header$ * $Header$
* *
*/ */
#ifndef CD_MSA_H #ifndef CD_MSA_H
#define CD_MSA_H #define CD_MSA_H
#include "cdaudio.h" #include "cdaudio.h"
class MsaCDPlayer : public CDAudio { class MsaCDPlayer : public CDAudio {
public: public:
MsaCDPlayer(OSystem *sys); MsaCDPlayer(OSystem *sys);
bool init(); bool init();
void release(); void release();
bool poll(); bool poll();
void update(); void update();
void play(int track, int num_loops, int start_frame, int duration); void play(int track, int num_loops, int start_frame, int duration);
void stop(); void stop();
private: private:
void initInternal(); void initInternal();
OSystem *_sys; OSystem *_sys;
UInt16 _msaRefNum; UInt16 _msaRefNum;
// cdrom // cdrom
AlbumInfoType _msaAlbum; AlbumInfoType _msaAlbum;
UInt16 _msaLoops; UInt16 _msaLoops;
@ -57,5 +57,5 @@
UInt32 _msaTrackLength; UInt32 _msaTrackLength;
}; };
#endif #endif

View file

@ -49,7 +49,7 @@ UInt32 PckTunesCDPlayer::getStatus() {
EventType e; EventType e;
UInt32 status; UInt32 status;
PocketTunesAction *pAction = (PocketTunesAction*)MemPtrNew (sizeof(PocketTunesAction)); PocketTunesAction *pAction = (PocketTunesAction*)MemPtrNew (sizeof(PocketTunesAction));
if (!pAction) if (!pAction)
return kPtunesStopped; return kPtunesStopped;
@ -60,9 +60,9 @@ UInt32 PckTunesCDPlayer::getStatus() {
status = pAction->data.getStatusAction.status; status = pAction->data.getStatusAction.status;
else else
status = kPtunesStopped; status = kPtunesStopped;
MemPtrFree(pAction); MemPtrFree(pAction);
return status; return status;
} }
UInt32 PckTunesCDPlayer::getPosition(UInt32 deflt) { UInt32 PckTunesCDPlayer::getPosition(UInt32 deflt) {
@ -78,7 +78,7 @@ UInt32 PckTunesCDPlayer::getPosition(UInt32 deflt) {
pAction->action = kPocketTunesActionGetValue; pAction->action = kPocketTunesActionGetValue;
pAction->data.getValueAction.which = kPtunesValueSongPosition; pAction->data.getValueAction.which = kPtunesValueSongPosition;
EvtGetEvent(&e, evtNoWait); EvtGetEvent(&e, evtNoWait);
if (PocketTunesCallSynch(pAction) == errNone) if (PocketTunesCallSynch(pAction) == errNone)
value = pAction->data.getValueAction.value; value = pAction->data.getValueAction.value;
@ -112,22 +112,22 @@ UInt32 PckTunesCDPlayer::getDuration() {
EventType e; EventType e;
UInt32 value; UInt32 value;
PocketTunesAction *pAction = (PocketTunesAction*)MemPtrNew (sizeof(PocketTunesAction)); PocketTunesAction *pAction = (PocketTunesAction*)MemPtrNew (sizeof(PocketTunesAction));
if (!pAction) if (!pAction)
return gVars->CD.defaultTrackLength; return gVars->CD.defaultTrackLength;
pAction->action = kPocketTunesActionGetValue; pAction->action = kPocketTunesActionGetValue;
pAction->data.getValueAction.which = kPtunesValueSongDuration; pAction->data.getValueAction.which = kPtunesValueSongDuration;
EvtGetEvent(&e, evtNoWait); EvtGetEvent(&e, evtNoWait);
if (PocketTunesCallSynch(pAction) == errNone) if (PocketTunesCallSynch(pAction) == errNone)
value = pAction->data.getValueAction.value; value = pAction->data.getValueAction.value;
else else
value = gVars->CD.defaultTrackLength; value = gVars->CD.defaultTrackLength;
MemPtrFree(pAction); MemPtrFree(pAction);
return value; return value;
} }
bool PckTunesCDPlayer::poll() { bool PckTunesCDPlayer::poll() {
@ -186,7 +186,7 @@ void PckTunesCDPlayer::play(int track, int num_loops, int start_frame, int durat
EventType e; EventType e;
Char nameP[256], fileP[100]; Char nameP[256], fileP[100];
Char *ext[] = { "mp3", "ogg" }; Char *ext[] = { "mp3", "ogg" };
// if (duration > 0) // if (duration > 0)
// duration += 5; // duration += 5;
@ -197,9 +197,9 @@ void PckTunesCDPlayer::play(int track, int num_loops, int start_frame, int durat
// stop current play if any // stop current play if any
VFSVolumeGetLabel(gVars->volRefNum, nameP, 256); VFSVolumeGetLabel(gVars->volRefNum, nameP, 256);
StrPrintF(fileP, "/Palm/Programs/ScummVM/Audio/%s_%03ld.%s", gameP, (track + gVars->CD.firstTrack - 1), ext[gVars->CD.format]); StrPrintF(fileP, "/Palm/Programs/ScummVM/Audio/%s_%03ld.%s", gameP, (track + gVars->CD.firstTrack - 1), ext[gVars->CD.format]);
if (PocketTunesOpenFile(nameP, fileP, 0) == errNone) { if (PocketTunesOpenFile(nameP, fileP, 0) == errNone) {
EvtGetEvent(&e, evtNoWait); EvtGetEvent(&e, evtNoWait);
PocketTunesPauseIfPlaying(); PocketTunesPauseIfPlaying();

View file

@ -19,39 +19,39 @@
* $Header$ * $Header$
* *
*/ */
#ifndef CD_POCKETTUNES_H #ifndef CD_POCKETTUNES_H
#define CD_POCKETTUNES_H #define CD_POCKETTUNES_H
#include "cdaudio.h" #include "cdaudio.h"
#include "pockettunes.h" #include "pockettunes.h"
class PckTunesCDPlayer : public CDAudio { class PckTunesCDPlayer : public CDAudio {
public: public:
PckTunesCDPlayer(OSystem *sys); PckTunesCDPlayer(OSystem *sys);
bool init(); bool init();
void release(); void release();
bool poll(); bool poll();
void update(); void update();
void play(int track, int num_loops, int start_frame, int duration); void play(int track, int num_loops, int start_frame, int duration);
void stop(); void stop();
private: private:
OSystem *_sys; OSystem *_sys;
Char gameP[15]; Char gameP[15];
UInt32 getStatus(); UInt32 getStatus();
void setPosition(UInt32 value); void setPosition(UInt32 value);
UInt32 getDuration(); UInt32 getDuration();
UInt32 getPosition(UInt32 deft); UInt32 getPosition(UInt32 deft);
Boolean _isPlaying; Boolean _isPlaying;
// cdrom // cdrom
UInt16 _pckLoops, _pckTrack; UInt16 _pckLoops, _pckTrack;
UInt32 _pckTrackStartFrame, _pckTrackEndFrame; UInt32 _pckTrackStartFrame, _pckTrackEndFrame;
UInt32 _pckStopTime, _pckTrackDuration; UInt32 _pckStopTime, _pckTrackDuration;
}; };
#endif #endif

View file

@ -19,7 +19,7 @@
* $Header$ * $Header$
* *
*/ */
#ifndef CDAUDIO_H #ifndef CDAUDIO_H
#define CDAUDIO_H #define CDAUDIO_H
@ -34,7 +34,7 @@
#define FROM_SEC(secs) ((UInt32)((secs) * 1000)) #define FROM_SEC(secs) ((UInt32)((secs) * 1000))
class CDAudio { class CDAudio {
public: public:
CDAudio() { CDAudio() {
_isInitialized = false; _isInitialized = false;
_volumeLevel = 100; _volumeLevel = 100;
@ -42,7 +42,7 @@ public:
virtual bool init() = 0; virtual bool init() = 0;
virtual void release() = 0; virtual void release() = 0;
// OSystem functions // OSystem functions
virtual bool poll() = 0; virtual bool poll() = 0;
virtual void play(int track, int num_loops, int start_frame, int duration) = 0; virtual void play(int track, int num_loops, int start_frame, int duration) = 0;

View file

@ -19,7 +19,7 @@
* $Header$ * $Header$
* *
*/ */
#include <PalmOS.h> #include <PalmOS.h>
#include <string.h> #include <string.h>
@ -36,7 +36,7 @@ void PalmFatalError(const Char *err) {
// unlock to show the alert box // unlock to show the alert box
if (gVars->screenLocked) if (gVars->screenLocked)
WinScreenUnlock(); WinScreenUnlock();
if (OPTIONS_TST(kOptModeHiDensity)) if (OPTIONS_TST(kOptModeHiDensity))
WinSetCoordinateSystem(kCoordinatesStandard); WinSetCoordinateSystem(kCoordinatesStandard);
@ -78,10 +78,10 @@ UInt16 StrReplace(Char *ioStr, UInt16 inMaxLen, const Char *inParamStr, const Ch
UInt16 l2 = 0; UInt16 l2 = 0;
UInt16 l3 = StrLen(ioStr); UInt16 l3 = StrLen(ioStr);
UInt16 next = 0; UInt16 next = 0;
if (inParamStr) if (inParamStr)
l2 = StrLen(inParamStr); // can be null to know how many occur. l2 = StrLen(inParamStr); // can be null to know how many occur.
while (((found = StrStr(ioStr+next, fndParamStr)) != NULL) && (!quit)) { while (((found = StrStr(ioStr+next, fndParamStr)) != NULL) && (!quit)) {
occurences++; occurences++;
newLength = (StrLen(ioStr) - l1 + l2); newLength = (StrLen(ioStr) - l1 + l2);
@ -98,7 +98,7 @@ UInt16 StrReplace(Char *ioStr, UInt16 inMaxLen, const Char *inParamStr, const Ch
} else } else
next = found - ioStr + l1; next = found - ioStr + l1;
} }
if (inParamStr) if (inParamStr)
ioStr[l3 + l2*occurences - l1*occurences] = 0; ioStr[l3 + l2*occurences - l1*occurences] = 0;

View file

@ -57,13 +57,13 @@ static UInt16 CardSlotFormInit(Boolean display, Boolean bDraw) {
if (err || StrLen(labelP) == 0) { // if no label try to retreive card type if (err || StrLen(labelP) == 0) { // if no label try to retreive card type
VolumeInfoType volInfo; VolumeInfoType volInfo;
err = VFSVolumeInfo(volRefNum, &volInfo); err = VFSVolumeInfo(volRefNum, &volInfo);
if (!err) { if (!err) {
ExpCardInfoType info; ExpCardInfoType info;
err = ExpCardInfo(volInfo.slotRefNum, &info); err = ExpCardInfo(volInfo.slotRefNum, &info);
StrCopy(labelP, info.deviceClassStr); StrCopy(labelP, info.deviceClassStr);
} }
if (err) // if err default name if (err) // if err default name
StrPrintF(labelP,"Other Card %ld", other++); StrPrintF(labelP,"Other Card %ld", other++);
} }
@ -72,7 +72,7 @@ static UInt16 CardSlotFormInit(Boolean display, Boolean bDraw) {
cards = MemHandleNew(sizeof(CardInfoType)); cards = MemHandleNew(sizeof(CardInfoType));
else else
MemHandleResize(cards, MemHandleSize(cards) + sizeof(CardInfoType)); MemHandleResize(cards, MemHandleSize(cards) + sizeof(CardInfoType));
cardsInfo = (CardInfoType *)MemHandleLock(cards); cardsInfo = (CardInfoType *)MemHandleLock(cards);
cardsInfo[counter].volRefNum = volRefNum; cardsInfo[counter].volRefNum = volRefNum;
StrCopy(cardsInfo[counter].nameP, labelP); StrCopy(cardsInfo[counter].nameP, labelP);
@ -87,7 +87,7 @@ static UInt16 CardSlotFormInit(Boolean display, Boolean bDraw) {
ControlType *cck1P, *cck2P, *cck3P; ControlType *cck1P, *cck2P, *cck3P;
UInt16 index; UInt16 index;
Int16 selected = -1; Int16 selected = -1;
CardInfoType *cardsInfo; CardInfoType *cardsInfo;
MemHandle items = NULL; MemHandle items = NULL;
@ -108,7 +108,7 @@ static UInt16 CardSlotFormInit(Boolean display, Boolean bDraw) {
itemsText = (Char **)MemHandleLock(items); itemsText = (Char **)MemHandleLock(items);
itemsText[index] = cardsInfo[index].nameP; itemsText[index] = cardsInfo[index].nameP;
MemHandleUnlock(items); MemHandleUnlock(items);
if (cardsInfo[index].volRefNum == gPrefs->card.volRefNum) if (cardsInfo[index].volRefNum == gPrefs->card.volRefNum)
selected = index; selected = index;
} }
@ -168,7 +168,7 @@ static void CardSlotFormExit(Boolean bSave) {
cardsInfo = (CardInfoType *)itemsList; cardsInfo = (CardInfoType *)itemsList;
cards = MemPtrRecoverHandle(cardsInfo); cards = MemPtrRecoverHandle(cardsInfo);
items = MemPtrRecoverHandle(itemsText); items = MemPtrRecoverHandle(itemsText);
itemsText = NULL; itemsText = NULL;
itemsList = NULL; itemsList = NULL;
} else { } else {
@ -239,7 +239,7 @@ Boolean CardSlotFormHandleEvent(EventPtr eventP) {
Boolean handled = false; Boolean handled = false;
switch (eventP->eType) { switch (eventP->eType) {
case frmOpenEvent: case frmOpenEvent:
CardSlotFormInit(true, true); CardSlotFormInit(true, true);
handled = true; handled = true;
@ -260,7 +260,7 @@ Boolean CardSlotFormHandleEvent(EventPtr eventP) {
case CardSlotCancelButton: case CardSlotCancelButton:
CardSlotFormExit(false); CardSlotFormExit(false);
break; break;
case CardSlotMoveCheckbox: case CardSlotMoveCheckbox:
CardSlotFromShowHideOptions(); CardSlotFromShowHideOptions();
break; break;
@ -271,13 +271,13 @@ Boolean CardSlotFormHandleEvent(EventPtr eventP) {
default: default:
break; break;
} }
return handled; return handled;
} }
UInt16 parseCards() { UInt16 parseCards() {
UInt16 volRefNum = CardSlotFormInit(false, false); UInt16 volRefNum = CardSlotFormInit(false, false);
CardSlotFormExit(false); CardSlotFormExit(false);
return volRefNum; return volRefNum;
} }

View file

@ -33,7 +33,7 @@ static void GameTabInit(GameInfoType *gameInfoP) {
nameP = (Char *)MemHandleLock(nameH); nameP = (Char *)MemHandleLock(nameH);
pathP = (Char *)MemHandleLock(pathH); pathP = (Char *)MemHandleLock(pathH);
gameP = (Char *)MemHandleLock(gameH); gameP = (Char *)MemHandleLock(gameH);
if (gameInfoP) { if (gameInfoP) {
LstSetSelection(list1P, gameInfoP->engine); LstSetSelection(list1P, gameInfoP->engine);
StrCopy(nameP, gameInfoP->nameP); StrCopy(nameP, gameInfoP->nameP);
@ -102,7 +102,7 @@ static Err GameTabSave(GameInfoType *gameInfoP) {
StrCat(gameInfoP->pathP, "/"); StrCat(gameInfoP->pathP, "/");
} }
return errNone; return errNone;
} }
@ -110,7 +110,7 @@ static void DisplayInit(GameInfoType *gameInfoP) {
ListType *list1P; ListType *list1P;
list1P = (ListType *)GetObjectPtr(TabGameDisplayGfxListList); list1P = (ListType *)GetObjectPtr(TabGameDisplayGfxListList);
if (gameInfoP) { if (gameInfoP) {
LstSetSelection(list1P, gameInfoP->gfxMode); LstSetSelection(list1P, gameInfoP->gfxMode);
CtlSetValue((ControlType *)GetObjectPtr(TabGameDisplayFilterCheckbox), gameInfoP->filter); CtlSetValue((ControlType *)GetObjectPtr(TabGameDisplayFilterCheckbox), gameInfoP->filter);
@ -129,7 +129,7 @@ static void DisplayInit(GameInfoType *gameInfoP) {
static Err DisplaySave(GameInfoType *gameInfoP) { static Err DisplaySave(GameInfoType *gameInfoP) {
ListType *list1P; ListType *list1P;
ControlType *cck6P, *cck7P, *cck8P; ControlType *cck6P, *cck7P, *cck8P;
FormType *frmP = FrmGetActiveForm(); FormType *frmP = FrmGetActiveForm();
@ -137,7 +137,7 @@ static Err DisplaySave(GameInfoType *gameInfoP) {
cck6P = (ControlType *)GetObjectPtr(TabGameDisplayFilterCheckbox); cck6P = (ControlType *)GetObjectPtr(TabGameDisplayFilterCheckbox);
cck7P = (ControlType *)GetObjectPtr(TabGameDisplayFullscreenCheckbox); cck7P = (ControlType *)GetObjectPtr(TabGameDisplayFullscreenCheckbox);
cck8P = (ControlType *)GetObjectPtr(TabGameDisplayAspectRatioCheckbox); cck8P = (ControlType *)GetObjectPtr(TabGameDisplayAspectRatioCheckbox);
if (!gameInfoP) { if (!gameInfoP) {
} else { } else {
gameInfoP->gfxMode = LstGetSelection(list1P); gameInfoP->gfxMode = LstGetSelection(list1P);
@ -145,7 +145,7 @@ static Err DisplaySave(GameInfoType *gameInfoP) {
gameInfoP->fullscreen = CtlGetValue(cck7P); gameInfoP->fullscreen = CtlGetValue(cck7P);
gameInfoP->aspectRatio = CtlGetValue(cck8P); gameInfoP->aspectRatio = CtlGetValue(cck8P);
} }
return errNone; return errNone;
} }
@ -213,7 +213,7 @@ static void OptionsInit(GameInfoType *gameInfoP) {
static Err OptionsSave(GameInfoType *gameInfoP) { static Err OptionsSave(GameInfoType *gameInfoP) {
FieldType *fld4P, *fld5P, *fld6P; FieldType *fld4P, *fld5P, *fld6P;
ControlType *cck1P, *cck2P, *cck3P, *cck4P, *cck5P; ControlType *cck1P, *cck2P, *cck3P, *cck4P, *cck5P;
ListType *list2P, *list3P; ListType *list2P, *list3P;
FormType *frmP = FrmGetActiveForm(); FormType *frmP = FrmGetActiveForm();
@ -247,7 +247,7 @@ static Err OptionsSave(GameInfoType *gameInfoP) {
} else { } else {
gameInfoP->language = LstGetSelection(list2P); gameInfoP->language = LstGetSelection(list2P);
gameInfoP->platform = LstGetSelection(list3P); gameInfoP->platform = LstGetSelection(list3P);
gameInfoP->autoLoad = CtlGetValue(cck1P); gameInfoP->autoLoad = CtlGetValue(cck1P);
gameInfoP->bootParam = CtlGetValue(cck2P); gameInfoP->bootParam = CtlGetValue(cck2P);
gameInfoP->setPlatform = CtlGetValue(cck3P); gameInfoP->setPlatform = CtlGetValue(cck3P);
@ -258,7 +258,7 @@ static Err OptionsSave(GameInfoType *gameInfoP) {
gameInfoP->bootValue = StrAToI(FldGetTextPtr(fld5P)); gameInfoP->bootValue = StrAToI(FldGetTextPtr(fld5P));
gameInfoP->talkValue = StrAToI(FldGetTextPtr(fld6P)); gameInfoP->talkValue = StrAToI(FldGetTextPtr(fld6P));
} }
return errNone; return errNone;
} }
@ -323,19 +323,19 @@ static void GameManSave(UInt16 index) {
newGameInfo.version = curItemVersion; newGameInfo.version = curItemVersion;
newGameInfo.icnID = 0xFFFF; newGameInfo.icnID = 0xFFFF;
newGameInfo.selected = true; newGameInfo.selected = true;
// default sound data // default sound data
newGameInfo.musicInfo.volume.master = 192; newGameInfo.musicInfo.volume.master = 192;
newGameInfo.musicInfo.volume.music = 192; newGameInfo.musicInfo.volume.music = 192;
newGameInfo.musicInfo.volume.sfx = 192; newGameInfo.musicInfo.volume.sfx = 192;
newGameInfo.musicInfo.volume.speech = 192; newGameInfo.musicInfo.volume.speech = 192;
newGameInfo.musicInfo.volume.audiocd = 50; newGameInfo.musicInfo.volume.audiocd = 50;
newGameInfo.musicInfo.sound.tempo = 100; newGameInfo.musicInfo.sound.tempo = 100;
newGameInfo.musicInfo.sound.defaultTrackLength = 10; newGameInfo.musicInfo.sound.defaultTrackLength = 10;
newGameInfo.musicInfo.sound.firstTrack = 1; newGameInfo.musicInfo.sound.firstTrack = 1;
} }
GameTabSave(&newGameInfo); GameTabSave(&newGameInfo);
DisplaySave(&newGameInfo); DisplaySave(&newGameInfo);
OptionsSave(&newGameInfo); OptionsSave(&newGameInfo);
@ -349,14 +349,14 @@ static void GameManSave(UInt16 index) {
{ {
RectangleType rArea; RectangleType rArea;
UInt16 posIndex, maxView; UInt16 posIndex, maxView;
// get the sorted index // get the sorted index
index = GamGetSelected(); index = GamGetSelected();
// if new item is out of the list bounds, change current list pos // if new item is out of the list bounds, change current list pos
SknGetListBounds(&rArea, NULL); SknGetListBounds(&rArea, NULL);
maxView = rArea.extent.y / sknInfoListItemSize; maxView = rArea.extent.y / sknInfoListItemSize;
posIndex = gPrefs->listPosition; posIndex = gPrefs->listPosition;
// if out of the current list position // if out of the current list position
if (!(index >= posIndex && index < (posIndex + maxView))) if (!(index >= posIndex && index < (posIndex + maxView)))
gPrefs->listPosition = index; // this value is corrected in SknUpdateList if needed gPrefs->listPosition = index; // this value is corrected in SknUpdateList if needed
@ -373,7 +373,7 @@ static void GameManSave(UInt16 index) {
* FUNCTION: EditGameFormInit * FUNCTION: EditGameFormInit
* FUNCTION: EditGameFormHandleEvent * FUNCTION: EditGameFormHandleEvent
* *
* DESCRIPTION: * DESCRIPTION:
* *
* REVISION HISTORY: * REVISION HISTORY:
* *
@ -451,7 +451,7 @@ Boolean EditGameFormHandleEvent(EventPtr eventP) {
TabDeleteTabs(myTabP); TabDeleteTabs(myTabP);
FrmReturnToMain(); FrmReturnToMain();
break; break;
case GameEditDeleteButton: case GameEditDeleteButton:
EditGameFormDelete(false); EditGameFormDelete(false);
break; break;
@ -482,6 +482,6 @@ Boolean EditGameFormHandleEvent(EventPtr eventP) {
default: default:
break; break;
} }
return handled; return handled;
} }

View file

@ -29,7 +29,7 @@ static Boolean ScummVMTabSave() {
FormPtr frmP; FormPtr frmP;
fld1P = (FieldType *)GetObjectPtr(TabScummVMDebugLevelField); fld1P = (FieldType *)GetObjectPtr(TabScummVMDebugLevelField);
cckP[3] = (ControlType *)GetObjectPtr(TabScummVMDebugCheckbox); cckP[3] = (ControlType *)GetObjectPtr(TabScummVMDebugCheckbox);
cckP[6] = (ControlType *)GetObjectPtr(TabScummVMDemoCheckbox); cckP[6] = (ControlType *)GetObjectPtr(TabScummVMDemoCheckbox);
cckP[9] = (ControlType *)GetObjectPtr(TabScummVMCopyProtectionCheckbox); cckP[9] = (ControlType *)GetObjectPtr(TabScummVMCopyProtectionCheckbox);
@ -49,7 +49,7 @@ static Boolean ScummVMTabSave() {
gPrefs->altIntro = CtlGetValue(cckP[10]); gPrefs->altIntro = CtlGetValue(cckP[10]);
gPrefs->debugLevel = StrAToI(FldGetTextPtr(fld1P)); gPrefs->debugLevel = StrAToI(FldGetTextPtr(fld1P));
return true; return true;
} }
@ -125,7 +125,7 @@ static void PalmOSTabInit() {
static void MiscFormSave() { static void MiscFormSave() {
PalmOSTabSave(); PalmOSTabSave();
if (!ScummVMTabSave()) return; if (!ScummVMTabSave()) return;
TabDeleteTabs(myTabP); TabDeleteTabs(myTabP);
FrmReturnToMain(); FrmReturnToMain();
} }
@ -176,7 +176,7 @@ Boolean MiscFormHandleEvent(EventPtr eventP) {
case (MiscForm + 2) : case (MiscForm + 2) :
lastTab = (eventP->data.ctlSelect.controlID - MiscForm - 1); lastTab = (eventP->data.ctlSelect.controlID - MiscForm - 1);
TabSetActive(frmP, myTabP, lastTab); TabSetActive(frmP, myTabP, lastTab);
#ifndef DISABLE_LIGHTSPEED #ifndef DISABLE_LIGHTSPEED
if (!LS_Installed()) if (!LS_Installed())
#endif #endif
@ -210,6 +210,6 @@ Boolean MiscFormHandleEvent(EventPtr eventP) {
default: default:
break; break;
} }
return handled; return handled;
} }

View file

@ -27,7 +27,7 @@ static void SkinsFormInit(Boolean bDraw) {
Char nameP[32]; Char nameP[32];
itemsText = NULL; itemsText = NULL;
// parse and save skins // parse and save skins
Err err = DmGetNextDatabaseByTypeCreator(true, &stateInfo, 'skin', appFileCreator, false, &cardNo, &dbID); Err err = DmGetNextDatabaseByTypeCreator(true, &stateInfo, 'skin', appFileCreator, false, &cardNo, &dbID);
while (!err && dbID) { while (!err && dbID) {
@ -38,14 +38,14 @@ static void SkinsFormInit(Boolean bDraw) {
skins = MemHandleNew(sizeof(SkinInfoType)); skins = MemHandleNew(sizeof(SkinInfoType));
else else
MemHandleResize(skins, MemHandleSize(skins) + sizeof(SkinInfoType)); MemHandleResize(skins, MemHandleSize(skins) + sizeof(SkinInfoType));
skinsInfo = (SkinInfoType *)MemHandleLock(skins); skinsInfo = (SkinInfoType *)MemHandleLock(skins);
StrCopy(skinsInfo[numSkins].nameP, nameP); StrCopy(skinsInfo[numSkins].nameP, nameP);
skinsInfo[numSkins].cardNo = cardNo; skinsInfo[numSkins].cardNo = cardNo;
skinsInfo[numSkins].dbID = dbID; skinsInfo[numSkins].dbID = dbID;
MemHandleUnlock(skins); MemHandleUnlock(skins);
numSkins++; numSkins++;
} }
err = DmGetNextDatabaseByTypeCreator(false, &stateInfo, 'skin', appFileCreator, false, &cardNo, &dbID); err = DmGetNextDatabaseByTypeCreator(false, &stateInfo, 'skin', appFileCreator, false, &cardNo, &dbID);
} }
@ -69,7 +69,7 @@ static void SkinsFormInit(Boolean bDraw) {
itemsText = (Char **)MemHandleLock(items); itemsText = (Char **)MemHandleLock(items);
itemsText[index] = skinsInfo[index].nameP; itemsText[index] = skinsInfo[index].nameP;
MemHandleUnlock(items); MemHandleUnlock(items);
if ( gPrefs->skin.cardNo == skinsInfo[index].cardNo && if ( gPrefs->skin.cardNo == skinsInfo[index].cardNo &&
gPrefs->skin.dbID == skinsInfo[index].dbID && gPrefs->skin.dbID == skinsInfo[index].dbID &&
StrCompare(gPrefs->skin.nameP, skinsInfo[index].nameP) == 0) StrCompare(gPrefs->skin.nameP, skinsInfo[index].nameP) == 0)
@ -106,7 +106,7 @@ static void SkinsFormExit(Boolean bSave) {
listP = (ListType *)GetObjectPtr(SkinsSkinList); listP = (ListType *)GetObjectPtr(SkinsSkinList);
selected = LstGetSelection(listP); selected = LstGetSelection(listP);
if (bSave && selected == -1) { // may never occured... if (bSave && selected == -1) { // may never occured...
FrmCustomAlert(FrmWarnAlert, "You didn't select a skin.", 0, 0); FrmCustomAlert(FrmWarnAlert, "You didn't select a skin.", 0, 0);
return; return;
@ -115,24 +115,24 @@ static void SkinsFormExit(Boolean bSave) {
skinsInfo = (SkinInfoType *)itemsList; skinsInfo = (SkinInfoType *)itemsList;
skins = MemPtrRecoverHandle(skinsInfo); skins = MemPtrRecoverHandle(skinsInfo);
items = MemPtrRecoverHandle(itemsText); items = MemPtrRecoverHandle(itemsText);
itemsText = NULL; itemsText = NULL;
itemsList = NULL; itemsList = NULL;
itemsType = ITEM_TYPE_UNKNOWN; itemsType = ITEM_TYPE_UNKNOWN;
if (bSave) { if (bSave) {
ControlType *cck1P; ControlType *cck1P;
StrCopy(gPrefs->skin.nameP, skinsInfo[selected].nameP); StrCopy(gPrefs->skin.nameP, skinsInfo[selected].nameP);
gPrefs->skin.cardNo = skinsInfo[selected].cardNo; gPrefs->skin.cardNo = skinsInfo[selected].cardNo;
gPrefs->skin.dbID = skinsInfo[selected].dbID; gPrefs->skin.dbID = skinsInfo[selected].dbID;
/* DmOpenRef skinDB = SknOpenSkin(); /* DmOpenRef skinDB = SknOpenSkin();
UInt32 depth = SknGetDepth(skinDB); UInt32 depth = SknGetDepth(skinDB);
SknCloseSkin(skinDB); SknCloseSkin(skinDB);
if (depth != 8 && depth != 16) depth = 8; if (depth != 8 && depth != 16) depth = 8;
if (depth == 16 && !OPTIONS_TST(kOptMode16Bit)) { if (depth == 16 && !OPTIONS_TST(kOptMode16Bit)) {
FrmCustomAlert(FrmInfoAlert, "You can only use 8bit skin on your device.", 0, 0); FrmCustomAlert(FrmInfoAlert, "You can only use 8bit skin on your device.", 0, 0);
gPrefs->skin.cardNo = cardNo; gPrefs->skin.cardNo = cardNo;
@ -226,7 +226,7 @@ Boolean SkinsFormHandleEvent(EventPtr eventP) {
Boolean handled = false; Boolean handled = false;
switch (eventP->eType) { switch (eventP->eType) {
case frmOpenEvent: case frmOpenEvent:
SkinsFormInit(true); SkinsFormInit(true);
handled = true; handled = true;
@ -247,11 +247,11 @@ Boolean SkinsFormHandleEvent(EventPtr eventP) {
case SkinsCancelButton: case SkinsCancelButton:
SkinsFormExit(false); SkinsFormExit(false);
break; break;
case SkinsBeamButton: case SkinsBeamButton:
SkinsFormBeam(); SkinsFormBeam();
break; break;
case SkinsDeleteButton: case SkinsDeleteButton:
SkinsFormDelete(); SkinsFormDelete();
break; break;
@ -262,6 +262,6 @@ Boolean SkinsFormHandleEvent(EventPtr eventP) {
default: default:
break; break;
} }
return handled; return handled;
} }

View file

@ -42,7 +42,7 @@ void GetMemory(UInt32* storageMemoryP, UInt32* dynamicMemoryP, UInt32 *storageFr
UInt32 dynamicFree = 0; UInt32 dynamicFree = 0;
// Iterate through each card to support devices with multiple cards. // Iterate through each card to support devices with multiple cards.
nCards = MemNumCards(); nCards = MemNumCards();
for (cardNo = 0; cardNo < nCards; cardNo++) { for (cardNo = 0; cardNo < nCards; cardNo++) {
// Iterate through the RAM heaps on a card (excludes ROM). // Iterate through the RAM heaps on a card (excludes ROM).
@ -51,7 +51,7 @@ void GetMemory(UInt32* storageMemoryP, UInt32* dynamicMemoryP, UInt32 *storageFr
heapID = MemHeapID(cardNo, i); heapID = MemHeapID(cardNo, i);
// Calculate the total memory and free memory of the heap. // Calculate the total memory and free memory of the heap.
MemHeapFreeBytes(heapID, &free, &max); MemHeapFreeBytes(heapID, &free, &max);
// If the heap is dynamic, increment the dynamic memory total. // If the heap is dynamic, increment the dynamic memory total.
if (MemHeapDynamic(heapID)) { if (MemHeapDynamic(heapID)) {
dynamicMemory += MemHeapSize(heapID); dynamicMemory += MemHeapSize(heapID);
@ -89,10 +89,10 @@ static void SystemTabDraw() {
GetMemory(&sm, &dm, &sf, &df); GetMemory(&sm, &dm, &sf, &df);
stack = GetStackSize(); stack = GetStackSize();
WinSetTextColor(UIColorGetTableEntryIndex(UIObjectForeground)); WinSetTextColor(UIColorGetTableEntryIndex(UIObjectForeground));
FntSetFont(stdFont); FntSetFont(stdFont);
StrIToA(num, dm); StrIToA(num, dm);
x = 147 - FntCharsWidth(num, StrLen(num)) + 5; x = 147 - FntCharsWidth(num, StrLen(num)) + 5;
WinDrawChars(num, StrLen(num), x, 12 + 30); WinDrawChars(num, StrLen(num), x, 12 + 30);
@ -182,6 +182,6 @@ Boolean InfoFormHandleEvent(EventPtr eventP) {
default: default:
break; break;
} }
return handled; return handled;
} }

View file

@ -25,7 +25,7 @@ static Err BeamMe() {
err = SendDatabase(0, dbID, "ScummVM.prc", "\nPlay your favorite LucasArts games"); err = SendDatabase(0, dbID, "ScummVM.prc", "\nPlay your favorite LucasArts games");
else else
err = DmGetLastErr(); err = DmGetLastErr();
return err; return err;
} }
@ -90,7 +90,7 @@ static Boolean MainFormDoCommand(UInt16 command)
FrmPopupForm(InfoForm); FrmPopupForm(InfoForm);
handled = true; handled = true;
break; break;
case MainGamesMusicSound: case MainGamesMusicSound:
FrmPopupForm(MusicForm); FrmPopupForm(MusicForm);
handled = true; handled = true;
@ -115,7 +115,7 @@ static Boolean MainFormDoCommand(UInt16 command)
* *
* FUNCTION: MainFormHandleEvent * FUNCTION: MainFormHandleEvent
* *
* DESCRIPTION: This routine is the event handler for the * DESCRIPTION: This routine is the event handler for the
* "MainForm" of this application. * "MainForm" of this application.
* *
* PARAMETERS: eventP - a pointer to an EventType structure * PARAMETERS: eventP - a pointer to an EventType structure
@ -136,7 +136,7 @@ static Boolean PenDownRepeat() {
if (penDown && sknLastOn) { if (penDown && sknLastOn) {
RectangleType r; RectangleType r;
DmOpenRef skinDBP; DmOpenRef skinDBP;
skinDBP = SknOpenSkin(); skinDBP = SknOpenSkin();
SknGetObjectBounds(skinDBP, sknLastOn, &r); SknGetObjectBounds(skinDBP, sknLastOn, &r);
@ -145,14 +145,14 @@ static Boolean PenDownRepeat() {
SknSetState(skinDBP, sknLastOn, sknStateSelected); SknSetState(skinDBP, sknLastOn, sknStateSelected);
SknShowObject(skinDBP, sknLastOn); SknShowObject(skinDBP, sknLastOn);
} }
switch (sknLastOn) { switch (sknLastOn) {
case skinSliderUpArrow: case skinSliderUpArrow:
case skinSliderDownArrow: case skinSliderDownArrow:
handled = SknProcessArrowAction(sknLastOn); handled = SknProcessArrowAction(sknLastOn);
break; break;
} }
} else { } else {
if (SknGetState(skinDBP, sknLastOn) != sknStateNormal) { if (SknGetState(skinDBP, sknLastOn) != sknStateNormal) {
SknSetState(skinDBP, sknLastOn, sknStateNormal); SknSetState(skinDBP, sknLastOn, sknStateNormal);
@ -162,7 +162,7 @@ static Boolean PenDownRepeat() {
SknCloseSkin(skinDBP); SknCloseSkin(skinDBP);
} }
return handled; return handled;
} }
@ -173,7 +173,7 @@ Boolean MainFormHandleEvent(EventPtr eventP)
FormPtr frmP; FormPtr frmP;
Coord x,y; Coord x,y;
DmOpenRef skinDBP; DmOpenRef skinDBP;
switch (eventP->eType) { switch (eventP->eType) {
case frmUpdateEvent: case frmUpdateEvent:
{ {
@ -216,11 +216,11 @@ Boolean MainFormHandleEvent(EventPtr eventP)
//gPrefs->card.volRefNum = parseCards(true); //gPrefs->card.volRefNum = parseCards(true);
FrmPopupForm(CardSlotForm); FrmPopupForm(CardSlotForm);
break; break;
case MainAboutButton: case MainAboutButton:
FrmPopupForm(InfoForm); FrmPopupForm(InfoForm);
break; break;
// case MainListTypeSelTrigger: // case MainListTypeSelTrigger:
// FrmList(eventP, MainListTypeList); // FrmList(eventP, MainListTypeList);
// break; // break;
@ -232,7 +232,7 @@ Boolean MainFormHandleEvent(EventPtr eventP)
x = eventP->screenX; x = eventP->screenX;
y = eventP->screenY; y = eventP->screenY;
lastIndex = dmMaxRecordIndex; // enable select/unselect list item lastIndex = dmMaxRecordIndex; // enable select/unselect list item
if (sknLastOn != skinButtonNone) { if (sknLastOn != skinButtonNone) {
RectangleType r; RectangleType r;
skinDBP = SknOpenSkin(); skinDBP = SknOpenSkin();
@ -240,7 +240,7 @@ Boolean MainFormHandleEvent(EventPtr eventP)
SknSetState(skinDBP, sknLastOn, sknStateNormal); SknSetState(skinDBP, sknLastOn, sknStateNormal);
SknShowObject(skinDBP, sknLastOn); SknShowObject(skinDBP, sknLastOn);
SknCloseSkin(skinDBP); SknCloseSkin(skinDBP);
if (RctPtInRectangle(x*2, y*2, &r)) { if (RctPtInRectangle(x*2, y*2, &r)) {
switch (sknLastOn) { switch (sknLastOn) {
case skinButtonGameAdd: case skinButtonGameAdd:
@ -297,7 +297,7 @@ Boolean MainFormHandleEvent(EventPtr eventP)
case skinButtonGameDelete: case skinButtonGameDelete:
case skinButtonGameAudio: case skinButtonGameAudio:
SknSetState(skinDBP, sknLastOn, sknStateSelected); SknSetState(skinDBP, sknLastOn, sknStateSelected);
SknShowObject(skinDBP, sknLastOn); SknShowObject(skinDBP, sknLastOn);
if (gPrefs->soundClick) if (gPrefs->soundClick)
SndPlaySystemSound(sndClick); SndPlaySystemSound(sndClick);
handled = true; handled = true;
@ -309,7 +309,7 @@ Boolean MainFormHandleEvent(EventPtr eventP)
SknSelect(x, y); SknSelect(x, y);
} }
break; break;
case keyDownEvent: case keyDownEvent:
if ( (eventP->data.keyDown.chr >= 'a' && eventP->data.keyDown.chr <= 'z') || if ( (eventP->data.keyDown.chr >= 'a' && eventP->data.keyDown.chr <= 'z') ||
(eventP->data.keyDown.chr >= 'A' && eventP->data.keyDown.chr <= 'Z')) { (eventP->data.keyDown.chr >= 'A' && eventP->data.keyDown.chr <= 'Z')) {
@ -319,7 +319,7 @@ Boolean MainFormHandleEvent(EventPtr eventP)
} }
} }
break; break;
default: default:
handled = PenDownRepeat(); handled = PenDownRepeat();
} }

View file

@ -19,7 +19,7 @@ static Boolean MusicTabSave() {
FieldType *fld1P; FieldType *fld1P;
UInt16 tempo; UInt16 tempo;
FormPtr frmP; FormPtr frmP;
frmP = FrmGetActiveForm(); frmP = FrmGetActiveForm();
cck1P = (ControlType *)GetObjectPtr(TabMusicMusicCheckbox); cck1P = (ControlType *)GetObjectPtr(TabMusicMusicCheckbox);
@ -40,7 +40,7 @@ static Boolean MusicTabSave() {
musicInfoP->sound.drvMusic = LstGetSelection(list1P); musicInfoP->sound.drvMusic = LstGetSelection(list1P);
musicInfoP->sound.tempo = tempo; musicInfoP->sound.tempo = tempo;
return true; return true;
} }
@ -87,7 +87,7 @@ static void SoundTabSave() {
static void SoundTabInit() { static void SoundTabInit() {
ControlType *cck1P; ControlType *cck1P;
ListType *list1P; ListType *list1P;
cck1P = (ControlType *)GetObjectPtr(TabSoundSoundCheckbox); cck1P = (ControlType *)GetObjectPtr(TabSoundSoundCheckbox);
list1P = (ListType *)GetObjectPtr(TabSoundRateList); list1P = (ListType *)GetObjectPtr(TabSoundRateList);
@ -103,7 +103,7 @@ static Boolean AudioCDTabSave() {
ListType *list1P, *list2P; ListType *list1P, *list2P;
UInt16 firstTrack; UInt16 firstTrack;
FormPtr frmP; FormPtr frmP;
frmP = FrmGetActiveForm(); frmP = FrmGetActiveForm();
cck3P = (ControlType *)GetObjectPtr(TabAudioCDMP3Checkbox); cck3P = (ControlType *)GetObjectPtr(TabAudioCDMP3Checkbox);
@ -111,7 +111,7 @@ static Boolean AudioCDTabSave() {
fld3P = (FieldType *)GetObjectPtr(TabAudioCDFirstTrackField); fld3P = (FieldType *)GetObjectPtr(TabAudioCDFirstTrackField);
list1P = (ListType *)GetObjectPtr(TabAudioCDDriverList); list1P = (ListType *)GetObjectPtr(TabAudioCDDriverList);
list2P = (ListType *)GetObjectPtr(TabAudioCDFormatList); list2P = (ListType *)GetObjectPtr(TabAudioCDFormatList);
firstTrack = StrAToI(FldGetTextPtr(fld3P)); firstTrack = StrAToI(FldGetTextPtr(fld3P));
if (firstTrack < 1 || firstTrack > 999) { if (firstTrack < 1 || firstTrack > 999) {
TabSetActive(frmP, myTabP, 2); TabSetActive(frmP, myTabP, 2);
@ -127,7 +127,7 @@ static Boolean AudioCDTabSave() {
musicInfoP->sound.defaultTrackLength = StrAToI(FldGetTextPtr(fld2P)); musicInfoP->sound.defaultTrackLength = StrAToI(FldGetTextPtr(fld2P));
musicInfoP->sound.firstTrack = firstTrack; musicInfoP->sound.firstTrack = firstTrack;
return true; return true;
} }
@ -168,13 +168,13 @@ static void AudioCDTabInit() {
// Volume // Volume
static void VolumeTabSave() { static void VolumeTabSave() {
SliderControlType *slid1P, *slid2P, *slid3P, *slid4P, *slid5P; SliderControlType *slid1P, *slid2P, *slid3P, *slid4P, *slid5P;
slid1P = (SliderControlType *)GetObjectPtr(TabVolumeMasterSliderControl); slid1P = (SliderControlType *)GetObjectPtr(TabVolumeMasterSliderControl);
slid2P = (SliderControlType *)GetObjectPtr(TabVolumeMusicSliderControl); slid2P = (SliderControlType *)GetObjectPtr(TabVolumeMusicSliderControl);
slid3P = (SliderControlType *)GetObjectPtr(TabVolumeSfxSliderControl); slid3P = (SliderControlType *)GetObjectPtr(TabVolumeSfxSliderControl);
slid4P = (SliderControlType *)GetObjectPtr(TabVolumeSpeechSliderControl); slid4P = (SliderControlType *)GetObjectPtr(TabVolumeSpeechSliderControl);
slid5P = (SliderControlType *)GetObjectPtr(TabVolumeAudioCDSliderControl); slid5P = (SliderControlType *)GetObjectPtr(TabVolumeAudioCDSliderControl);
CtlGetSliderValues ((ControlType *)slid1P, 0, 0, 0, &musicInfoP->volume.master); CtlGetSliderValues ((ControlType *)slid1P, 0, 0, 0, &musicInfoP->volume.master);
CtlGetSliderValues ((ControlType *)slid2P, 0, 0, 0, &musicInfoP->volume.music); CtlGetSliderValues ((ControlType *)slid2P, 0, 0, 0, &musicInfoP->volume.music);
CtlGetSliderValues ((ControlType *)slid3P, 0, 0, 0, &musicInfoP->volume.sfx); CtlGetSliderValues ((ControlType *)slid3P, 0, 0, 0, &musicInfoP->volume.sfx);
@ -185,7 +185,7 @@ static void VolumeTabSave() {
static void VolumeTabInit() { static void VolumeTabInit() {
SliderControlType *slid1P, *slid2P, *slid3P, *slid4P, *slid5P; SliderControlType *slid1P, *slid2P, *slid3P, *slid4P, *slid5P;
UInt16 value; UInt16 value;
slid1P = (SliderControlType *)GetObjectPtr(TabVolumeMasterSliderControl); slid1P = (SliderControlType *)GetObjectPtr(TabVolumeMasterSliderControl);
slid2P = (SliderControlType *)GetObjectPtr(TabVolumeMusicSliderControl); slid2P = (SliderControlType *)GetObjectPtr(TabVolumeMusicSliderControl);
slid3P = (SliderControlType *)GetObjectPtr(TabVolumeSfxSliderControl); slid3P = (SliderControlType *)GetObjectPtr(TabVolumeSfxSliderControl);
@ -238,7 +238,7 @@ static void MusicFormInit(UInt16 index) {
recordH = DmQueryRecord(gameDB, index); recordH = DmQueryRecord(gameDB, index);
gameInfoP = (GameInfoType *)MemHandleLock(recordH); gameInfoP = (GameInfoType *)MemHandleLock(recordH);
if (!gameInfoP) { if (!gameInfoP) {
FrmCustomAlert(FrmErrorAlert, "An error occured.",0,0); FrmCustomAlert(FrmErrorAlert, "An error occured.",0,0);
return; return;
@ -280,7 +280,7 @@ Boolean MusicFormHandleEvent(EventPtr eventP) {
MusicFormInit(GamGetSelected()); MusicFormInit(GamGetSelected());
handled = true; handled = true;
break; break;
case ctlSelectEvent: case ctlSelectEvent:
switch (eventP->data.ctlSelect.controlID) switch (eventP->data.ctlSelect.controlID)
{ {
@ -291,14 +291,14 @@ Boolean MusicFormHandleEvent(EventPtr eventP) {
lastTab = (eventP->data.ctlSelect.controlID - MusicForm - 1); lastTab = (eventP->data.ctlSelect.controlID - MusicForm - 1);
TabSetActive(frmP, myTabP, lastTab); TabSetActive(frmP, myTabP, lastTab);
break; break;
case TabMusicDriverPopTrigger: case TabMusicDriverPopTrigger:
FrmList(eventP, TabMusicDriverList); FrmList(eventP, TabMusicDriverList);
FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabMusicDriverList)); FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabMusicDriverList));
if (!OPTIONS_TST(kOptDeviceZodiac) && !OPTIONS_TST(kOptSonyPa1LibAPI)) { if (!OPTIONS_TST(kOptDeviceZodiac) && !OPTIONS_TST(kOptSonyPa1LibAPI)) {
ListType *list1P = (ListType *)GetObjectPtr(TabMusicDriverList); ListType *list1P = (ListType *)GetObjectPtr(TabMusicDriverList);
if (LstGetSelection(list1P) == 1) { if (LstGetSelection(list1P) == 1) {
FrmCustomAlert(FrmInfoAlert, "There is no built-in MIDI support on your device.", 0, 0); FrmCustomAlert(FrmInfoAlert, "There is no built-in MIDI support on your device.", 0, 0);
LstSetSelection(list1P, 0); LstSetSelection(list1P, 0);
@ -310,7 +310,7 @@ Boolean MusicFormHandleEvent(EventPtr eventP) {
case TabSoundRatePopTrigger: case TabSoundRatePopTrigger:
FrmList(eventP, TabSoundRateList); FrmList(eventP, TabSoundRateList);
FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabSoundRateList)); FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabSoundRateList));
if (!OPTIONS_TST(kOptPalmSoundAPI)) { if (!OPTIONS_TST(kOptPalmSoundAPI)) {
ListType *list1P = (ListType *)GetObjectPtr(TabSoundRateList); ListType *list1P = (ListType *)GetObjectPtr(TabSoundRateList);
@ -358,6 +358,6 @@ Boolean MusicFormHandleEvent(EventPtr eventP) {
default: default:
break; break;
} }
return handled; return handled;
} }

View file

@ -11,15 +11,15 @@ TabType *TabNewTabs(UInt16 cnt) {
newP->count = 0; newP->count = 0;
newP->width = 0; newP->width = 0;
newP->tabs = new TabDataType[cnt]; newP->tabs = new TabDataType[cnt];
return newP; return newP;
} }
void TabDeleteTabs(TabType *tabP) { void TabDeleteTabs(TabType *tabP) {
UInt16 cnt, num; UInt16 cnt, num;
num = MemPtrSize(tabP->tabs) / sizeof(TabDataType); num = MemPtrSize(tabP->tabs) / sizeof(TabDataType);
for (cnt = 0; cnt < num; cnt++) for (cnt = 0; cnt < num; cnt++)
FrmDeleteForm(tabP->tabs[cnt].srcP); FrmDeleteForm(tabP->tabs[cnt].srcP);
delete tabP->tabs; delete tabP->tabs;
@ -34,14 +34,14 @@ Err TabAddContent(FormType **frmP, TabType *tabP, const Char *nameP, UInt16 rscI
Coord x, y, w, h; Coord x, y, w, h;
UInt16 id; UInt16 id;
RectangleType r; RectangleType r;
dstP = (void **)frmP; dstP = (void **)frmP;
srcP = FrmInitForm(rscID); srcP = FrmInitForm(rscID);
objNum = FrmGetNumberOfObjects(srcP); objNum = FrmGetNumberOfObjects(srcP);
// save tab data // save tab data
// it's required to keep to source forms active // it's required to keep to source forms active
// while the tab form is not close for list data ptr (items text) // while the tab form is not close for list data ptr (items text)
// TODO : fix this ! // TODO : fix this !
@ -61,7 +61,7 @@ Err TabAddContent(FormType **frmP, TabType *tabP, const Char *nameP, UInt16 rscI
ControlType *addP = CtlNewControl(dstP, (FrmGetFormId(*frmP) + tabP->count), buttonCtl, nameP, x, y, w, h, stdFont, 0, true); ControlType *addP = CtlNewControl(dstP, (FrmGetFormId(*frmP) + tabP->count), buttonCtl, nameP, x, y, w, h, stdFont, 0, true);
CtlGlueSetFrameStyle(addP, noButtonFrame); CtlGlueSetFrameStyle(addP, noButtonFrame);
tabP->width += w + 1; tabP->width += w + 1;
// create tab content // create tab content
for (cnt = 0; cnt < objNum; cnt++) { for (cnt = 0; cnt < objNum; cnt++) {
objP = FrmGetObjectPtr(srcP, cnt); objP = FrmGetObjectPtr(srcP, cnt);
@ -86,7 +86,7 @@ Err TabAddContent(FormType **frmP, TabType *tabP, const Char *nameP, UInt16 rscI
UInt16 items = LstGetNumberOfItems((ListType *)objP); UInt16 items = LstGetNumberOfItems((ListType *)objP);
UInt16 trigger = id - 1; UInt16 trigger = id - 1;
trigger = (FrmGetObjectIndex((FormType *)*dstP, trigger) != frmInvalidObjectId) ? trigger : 0; trigger = (FrmGetObjectIndex((FormType *)*dstP, trigger) != frmInvalidObjectId) ? trigger : 0;
LstNewList(dstP, id, x, y, w, h, font, visible, trigger); LstNewList(dstP, id, x, y, w, h, font, visible, trigger);
newP = (ListType *)FrmGetObjectPtr((FormType *)*dstP, FrmGetObjectIndex((FormType *)*dstP, id)); newP = (ListType *)FrmGetObjectPtr((FormType *)*dstP, FrmGetObjectIndex((FormType *)*dstP, id));
LstSetListChoices(newP, itemsP, items); LstSetListChoices(newP, itemsP, items);
@ -174,25 +174,25 @@ void TabSetActive(FormType *frmP, TabType *tabP, UInt16 num) {
// set tabs size // set tabs size
for (cnt = 0; cnt < tabP->count; cnt++) { for (cnt = 0; cnt < tabP->count; cnt++) {
idx = FrmGetObjectIndex (frmP, (FrmGetFormId(frmP) + cnt + 1)); idx = FrmGetObjectIndex (frmP, (FrmGetFormId(frmP) + cnt + 1));
if (idx != frmInvalidObjectId) { if (idx != frmInvalidObjectId) {
FrmGetObjectBounds(frmP, idx, &r); FrmGetObjectBounds(frmP, idx, &r);
r.topLeft.y = (num == cnt) ? 17 : 17; r.topLeft.y = (num == cnt) ? 17 : 17;
r.extent.y = (num == cnt) ? 12 : 11; r.extent.y = (num == cnt) ? 12 : 11;
FrmSetObjectBounds(frmP, idx, &r); FrmSetObjectBounds(frmP, idx, &r);
if (num == cnt) { if (num == cnt) {
RGBColorType yellow = {0,255,192,0}; RGBColorType yellow = {0,255,192,0};
r.topLeft.y -= 1; r.topLeft.y -= 1;
WinSetForeColor(UIColorGetTableEntryIndex(UIObjectFrame)); WinSetForeColor(UIColorGetTableEntryIndex(UIObjectFrame));
WinDrawRectangleFrame(simpleFrame, &r); WinDrawRectangleFrame(simpleFrame, &r);
WinSetForeColor(WinRGBToIndex(&yellow)); WinSetForeColor(WinRGBToIndex(&yellow));
WinDrawLine(r.topLeft.x, r.topLeft.y, r.topLeft.x + r.extent.x - 1, r.topLeft.y); WinDrawLine(r.topLeft.x, r.topLeft.y, r.topLeft.x + r.extent.x - 1, r.topLeft.y);
FrmShowObject(frmP, idx); FrmShowObject(frmP, idx);
} else { } else {
WinSetForeColor(UIColorGetTableEntryIndex(UIObjectFrame)); WinSetForeColor(UIColorGetTableEntryIndex(UIObjectFrame));
WinDrawRectangleFrame(simpleFrame, &r); WinDrawRectangleFrame(simpleFrame, &r);
} }
} }
} }

View file

@ -38,7 +38,7 @@ DmOpenRef gameDB = NULL;
static Err GamUpdateList() { static Err GamUpdateList() {
if (gameDB) { if (gameDB) {
UInt16 numRecs = DmNumRecords(gameDB); UInt16 numRecs = DmNumRecords(gameDB);
if (numRecs > 0) { if (numRecs > 0) {
MemHandle tmpH; MemHandle tmpH;
UInt32 version, size; UInt32 version, size;
@ -57,7 +57,7 @@ static Err GamUpdateList() {
GameInfoType gitCur; GameInfoType gitCur;
void *tmpP; void *tmpP;
FormPtr ofmP, frmP; FormPtr ofmP, frmP;
// show dialog // show dialog
ofmP = FrmGetActiveForm(); ofmP = FrmGetActiveForm();
frmP = FrmInitForm(ConvertForm); frmP = FrmInitForm(ConvertForm);
@ -73,25 +73,25 @@ static Err GamUpdateList() {
version == itemVersion_25) { version == itemVersion_25) {
for (index = 0; index < numRecs; index++) { for (index = 0; index < numRecs; index++) {
// get old data // get old data
tmpH = DmQueryRecord(gameDB, index); tmpH = DmQueryRecord(gameDB, index);
tmpP = MemHandleLock(tmpH); tmpP = MemHandleLock(tmpH);
MemMove(&gitCur, tmpP, MemHandleSize(tmpH)); MemMove(&gitCur, tmpP, MemHandleSize(tmpH));
MemHandleUnlock(tmpH); MemHandleUnlock(tmpH);
if (version != itemVersion_30) { if (version != itemVersion_30) {
gitCur.musicInfo.volume.master = 192; gitCur.musicInfo.volume.master = 192;
gitCur.musicInfo.volume.music = 192; gitCur.musicInfo.volume.music = 192;
gitCur.musicInfo.volume.sfx = 192; gitCur.musicInfo.volume.sfx = 192;
gitCur.musicInfo.volume.speech = 192; gitCur.musicInfo.volume.speech = 192;
gitCur.musicInfo.volume.audiocd = 50; gitCur.musicInfo.volume.audiocd = 50;
gitCur.musicInfo.sound.tempo = 100; gitCur.musicInfo.sound.tempo = 100;
gitCur.musicInfo.sound.defaultTrackLength = 10; gitCur.musicInfo.sound.defaultTrackLength = 10;
gitCur.musicInfo.sound.firstTrack = 1; gitCur.musicInfo.sound.firstTrack = 1;
} }
gitCur.engine = 0; gitCur.engine = 0;
// simply resize the old record // simply resize the old record
@ -100,13 +100,13 @@ static Err GamUpdateList() {
DmWrite(tmpP, 0, &gitCur, sizeof(GameInfoType)); DmWrite(tmpP, 0, &gitCur, sizeof(GameInfoType));
MemPtrUnlock(tmpP); MemPtrUnlock(tmpP);
} }
} else if (version == itemVersion_20) { } else if (version == itemVersion_20) {
// need conversion from V2 -> V2.7 // need conversion from V2 -> V2.7
GameInfoTypeV2 git0; GameInfoTypeV2 git0;
for (index = 0; index < numRecs; index++) { for (index = 0; index < numRecs; index++) {
// get old data // get old data
tmpH = DmQueryRecord(gameDB, index); tmpH = DmQueryRecord(gameDB, index);
tmpP = MemHandleLock(tmpH); tmpP = MemHandleLock(tmpH);
@ -121,7 +121,7 @@ static Err GamUpdateList() {
StrCopy(gitCur.pathP, git0.pathP); StrCopy(gitCur.pathP, git0.pathP);
StrCopy(gitCur.gameP, git0.gameP); StrCopy(gitCur.gameP, git0.gameP);
gitCur.gfxMode = git0.gfxMode; gitCur.gfxMode = git0.gfxMode;
gitCur.autoLoad = git0.autoLoad; gitCur.autoLoad = git0.autoLoad;
gitCur.bootParam = git0.bootParam; gitCur.bootParam = git0.bootParam;
gitCur.setPlatform = git0.setPlatform; gitCur.setPlatform = git0.setPlatform;
@ -139,11 +139,11 @@ static Err GamUpdateList() {
gitCur.musicInfo.volume.sfx = 192; gitCur.musicInfo.volume.sfx = 192;
gitCur.musicInfo.volume.speech = 192; gitCur.musicInfo.volume.speech = 192;
gitCur.musicInfo.volume.audiocd = 50; gitCur.musicInfo.volume.audiocd = 50;
gitCur.musicInfo.sound.tempo = 100; gitCur.musicInfo.sound.tempo = 100;
gitCur.musicInfo.sound.defaultTrackLength = 10; gitCur.musicInfo.sound.defaultTrackLength = 10;
gitCur.musicInfo.sound.firstTrack = 1; gitCur.musicInfo.sound.firstTrack = 1;
gitCur.engine = 0; gitCur.engine = 0;
tmpH = DmResizeRecord(gameDB, index, sizeof(GameInfoType)); // TODO : check error on resize tmpH==NULL tmpH = DmResizeRecord(gameDB, index, sizeof(GameInfoType)); // TODO : check error on resize tmpH==NULL
@ -156,7 +156,7 @@ static Err GamUpdateList() {
GameInfoTypeV0 git0; GameInfoTypeV0 git0;
for (index = 0; index < numRecs; index++) { for (index = 0; index < numRecs; index++) {
// get old data // get old data
tmpH = DmQueryRecord(gameDB, index); tmpH = DmQueryRecord(gameDB, index);
tmpP = MemHandleLock(tmpH); tmpP = MemHandleLock(tmpH);
@ -171,7 +171,7 @@ static Err GamUpdateList() {
StrCopy(gitCur.pathP, git0.pathP); StrCopy(gitCur.pathP, git0.pathP);
StrCopy(gitCur.gameP, git0.gameP); StrCopy(gitCur.gameP, git0.gameP);
gitCur.gfxMode = git0.gfxMode; gitCur.gfxMode = git0.gfxMode;
gitCur.autoLoad = git0.autoLoad; gitCur.autoLoad = git0.autoLoad;
gitCur.bootParam = git0.bootParam; gitCur.bootParam = git0.bootParam;
gitCur.setPlatform = git0.amiga; // amiga become platform amiga/atari-st/machintosh gitCur.setPlatform = git0.amiga; // amiga become platform amiga/atari-st/machintosh
@ -189,11 +189,11 @@ static Err GamUpdateList() {
gitCur.musicInfo.volume.sfx = 192; gitCur.musicInfo.volume.sfx = 192;
gitCur.musicInfo.volume.speech = 192; gitCur.musicInfo.volume.speech = 192;
gitCur.musicInfo.volume.audiocd = 50; gitCur.musicInfo.volume.audiocd = 50;
gitCur.musicInfo.sound.tempo = 100; gitCur.musicInfo.sound.tempo = 100;
gitCur.musicInfo.sound.defaultTrackLength = 10; gitCur.musicInfo.sound.defaultTrackLength = 10;
gitCur.musicInfo.sound.firstTrack = 1; gitCur.musicInfo.sound.firstTrack = 1;
gitCur.engine = 0; gitCur.engine = 0;
tmpH = DmResizeRecord(gameDB, index, sizeof(GameInfoType)); // TODO : check error on resize tmpH==NULL tmpH = DmResizeRecord(gameDB, index, sizeof(GameInfoType)); // TODO : check error on resize tmpH==NULL
@ -207,10 +207,10 @@ static Err GamUpdateList() {
FrmDeleteForm(frmP); FrmDeleteForm(frmP);
if (ofmP) if (ofmP)
FrmReturnToForm(MainForm); FrmReturnToForm(MainForm);
} }
} }
} }
return errNone; return errNone;
} }
@ -223,7 +223,7 @@ Err GamOpenDatabase() {
err = DmCreateDatabase(0, "ScummVM-Data", appFileCreator, 'DATA', false); err = DmCreateDatabase(0, "ScummVM-Data", appFileCreator, 'DATA', false);
if (!err) { if (!err) {
gameDB = DmOpenDatabaseByTypeCreator( 'DATA', appFileCreator, dmModeReadWrite); gameDB = DmOpenDatabaseByTypeCreator( 'DATA', appFileCreator, dmModeReadWrite);
if (!gameDB) if (!gameDB)
err = DmGetLastErr(); err = DmGetLastErr();
} }
@ -241,7 +241,7 @@ void GamImportDatabase() {
if (gPrefs->card.volRefNum != sysInvalidRefNum && gPrefs->card.moveDB) { if (gPrefs->card.volRefNum != sysInvalidRefNum && gPrefs->card.moveDB) {
FileRef file; FileRef file;
Err e; Err e;
e = VFSFileOpen(gPrefs->card.volRefNum, "/Palm/Programs/ScummVM/listdata.pdb", vfsModeRead, &file); e = VFSFileOpen(gPrefs->card.volRefNum, "/Palm/Programs/ScummVM/listdata.pdb", vfsModeRead, &file);
if (!e) { if (!e) {
UInt16 oCardNo, nCardNo; UInt16 oCardNo, nCardNo;
@ -254,7 +254,7 @@ void GamImportDatabase() {
gPrefs->card.moveDB = false; gPrefs->card.moveDB = false;
return; return;
} }
// get current db info and rename it // get current db info and rename it
DmOpenDatabaseInfo(gameDB, &oDbID, 0, 0, &oCardNo, 0); DmOpenDatabaseInfo(gameDB, &oDbID, 0, 0, &oCardNo, 0);
GamCloseDatabase(true); GamCloseDatabase(true);
@ -273,7 +273,7 @@ void GamCloseDatabase(Boolean ignoreCardParams) {
if (gameDB) { if (gameDB) {
LocalID dbID; LocalID dbID;
UInt16 cardNo; UInt16 cardNo;
DmOpenDatabaseInfo(gameDB, &dbID, 0, 0, &cardNo, 0); DmOpenDatabaseInfo(gameDB, &dbID, 0, 0, &cardNo, 0);
DmCloseDatabase(gameDB); DmCloseDatabase(gameDB);
@ -309,13 +309,13 @@ void GamUnselect() {
UInt16 index; UInt16 index;
index = GamGetSelected(); index = GamGetSelected();
if (index != dmMaxRecordIndex) { if (index != dmMaxRecordIndex) {
Boolean newValue; Boolean newValue;
recordH = DmGetRecord(gameDB, index); recordH = DmGetRecord(gameDB, index);
game = (GameInfoType *)MemHandleLock(recordH); game = (GameInfoType *)MemHandleLock(recordH);
newValue = false; newValue = false;
DmWrite(game, OffsetOf(GameInfoType,selected), &newValue, sizeof(Boolean)); DmWrite(game, OffsetOf(GameInfoType,selected), &newValue, sizeof(Boolean));
@ -329,7 +329,7 @@ UInt16 GamGetSelected() {
GameInfoType *game; GameInfoType *game;
Boolean selected; Boolean selected;
UInt16 index = DmNumRecords(gameDB)-1; UInt16 index = DmNumRecords(gameDB)-1;
while (index != (UInt16)-1) { while (index != (UInt16)-1) {
record = DmQueryRecord(gameDB, index); record = DmQueryRecord(gameDB, index);
game = (GameInfoType *)MemHandleLock(record); game = (GameInfoType *)MemHandleLock(record);
@ -356,7 +356,7 @@ Boolean GamJumpTo(Char letter) {
while (index < maxIndex) { while (index < maxIndex) {
record = DmGetRecord(gameDB, index); record = DmGetRecord(gameDB, index);
game = (GameInfoType *)MemHandleLock(record); game = (GameInfoType *)MemHandleLock(record);
if (tolower(game->nameP[0]) == tolower(letter)) { if (tolower(game->nameP[0]) == tolower(letter)) {
found = true; found = true;
@ -370,7 +370,7 @@ Boolean GamJumpTo(Char letter) {
GamUnselect(); GamUnselect();
DmWrite(game, OffsetOf(GameInfoType,selected), &newValue, sizeof(Boolean)); DmWrite(game, OffsetOf(GameInfoType,selected), &newValue, sizeof(Boolean));
if (index < gPrefs->listPosition || index >= (gPrefs->listPosition + maxView)) if (index < gPrefs->listPosition || index >= (gPrefs->listPosition + maxView))
gPrefs->listPosition = index; gPrefs->listPosition = index;
} }
@ -380,7 +380,7 @@ Boolean GamJumpTo(Char letter) {
DmReleaseRecord (gameDB, index, 0); DmReleaseRecord (gameDB, index, 0);
index++; index++;
if (found) if (found)
return found; return found;
} }

View file

@ -88,7 +88,7 @@ typedef struct {
UInt16 speech; UInt16 speech;
UInt16 audiocd; UInt16 audiocd;
} volume; } volume;
struct { struct {
// midi // midi
Boolean multiMidi; Boolean multiMidi;
@ -127,13 +127,13 @@ typedef struct {
UInt16 talkValue; UInt16 talkValue;
UInt8 platform; UInt8 platform;
UInt8 language; // |- v2.5 UInt8 language; // |- v2.5
Boolean filter; // v2.6 Boolean filter; // v2.6
Boolean fullscreen; // | Boolean fullscreen; // |
Boolean aspectRatio; // |- v2.7 Boolean aspectRatio; // |- v2.7
MusicInfoType musicInfo;// v3.0 MusicInfoType musicInfo;// v3.0
UInt8 engine; // |- v3.1 UInt8 engine; // |- v3.1
} GameInfoType; } GameInfoType;

View file

@ -42,14 +42,14 @@ enum {
kOpt5WayNavigator = 1 << 0x0A, kOpt5WayNavigator = 1 << 0x0A,
kOptPalmSoundAPI = 1 << 0x0B, kOptPalmSoundAPI = 1 << 0x0B,
kOptSonyPa1LibAPI = 1 << 0x0C, kOptSonyPa1LibAPI = 1 << 0x0C,
kOptDeviceProcX86 = 1 << 0x1F // DEBUG only kOptDeviceProcX86 = 1 << 0x1F // DEBUG only
}; };
enum { enum {
kMemScummOldCostGames = 0, kMemScummOldCostGames = 0,
kMemScummNewCostGames, kMemScummNewCostGames,
kMemSimon1Games, kMemSimon1Games,
kMemSimon2Games, kMemSimon2Games,
kMemGamesCount kMemGamesCount
@ -101,15 +101,15 @@ typedef struct {
UInt8 *pageAddr1; UInt8 *pageAddr1;
UInt8 *pageAddr2; UInt8 *pageAddr2;
} flipping; } flipping;
struct { struct {
Boolean enable; Boolean enable;
UInt8 driver, format; UInt8 driver, format;
UInt16 defaultTrackLength; UInt16 defaultTrackLength;
UInt16 firstTrack; UInt16 firstTrack;
UInt16 volume; UInt16 volume;
} CD; } CD;
} GlobalsDataType, *GlobalsDataPtr; } GlobalsDataType, *GlobalsDataPtr;
extern GlobalsDataPtr gVars; extern GlobalsDataPtr gVars;

View file

@ -9,7 +9,7 @@
// _twBmpV3 = offscreen bitmap, must be set before this call // _twBmpV3 = offscreen bitmap, must be set before this call
Err ZodiacInit(void **ptrP, Int32 w, Int32 h) { Err ZodiacInit(void **ptrP, Int32 w, Int32 h) {
Err e; Err e;
TwGfxSurfaceInfoType surface = { TwGfxSurfaceInfoType surface = {
sizeof(TwGfxSurfaceInfoType), sizeof(TwGfxSurfaceInfoType),
w, h, w * 2, w, h, w * 2,

View file

@ -5,15 +5,15 @@
static void PnoInit(DmResID resID,PNOInitType *pnoP) { static void PnoInit(DmResID resID,PNOInitType *pnoP) {
// Load and allocate PNO // Load and allocate PNO
MemHandle armH = DmGetResource('ARMC', resID); MemHandle armH = DmGetResource('ARMC', resID);
if (armH) { if (armH) {
MemPtr armP = MemHandleLock(armH); MemPtr armP = MemHandleLock(armH);
PnoLoad(&pnoP->pnoDesc, armP); PnoLoad(&pnoP->pnoDesc, armP);
MemPtrUnlock(armP); MemPtrUnlock(armP);
DmReleaseResource(armH); DmReleaseResource(armH);
// Init PNO // Init PNO
PnoEntryHeader *header = (PnoEntryHeader *)ALIGN_4BYTE(pnoP->headerBuffer); PnoEntryHeader *header = (PnoEntryHeader *)ALIGN_4BYTE(pnoP->headerBuffer);
pnoP->alignedHeader = header; pnoP->alignedHeader = header;
header->r10Value = pnoP->pnoDesc.r10Value; header->r10Value = pnoP->pnoDesc.r10Value;

View file

@ -23,7 +23,7 @@ void MathlibRelease() {
if (MathLibRef != sysInvalidRefNum) { if (MathLibRef != sysInvalidRefNum) {
MathLibClose(MathLibRef, &useCount); MathLibClose(MathLibRef, &useCount);
if (!useCount) if (!useCount)
SysLibRemove(MathLibRef); SysLibRemove(MathLibRef);
} }

View file

@ -7,7 +7,7 @@ static UInt16 autoOffDelay;
void PalmInit(UInt8 init) { void PalmInit(UInt8 init) {
// set screen depth // set screen depth
UInt32 depth = 8; UInt32 depth = 8;
WinScreenMode(winScreenModeSet, NULL, NULL, &depth, NULL); WinScreenMode(winScreenModeSet, NULL, NULL, &depth, NULL);
if (init & INIT_AUTOOFF) { if (init & INIT_AUTOOFF) {
@ -27,12 +27,12 @@ Err PalmHRInit(UInt32 depth) {
UInt32 width = 320; UInt32 width = 320;
UInt32 height = 320; UInt32 height = 320;
Boolean color = true; Boolean color = true;
e = WinScreenMode (winScreenModeSet, &width, &height, &depth, &color); e = WinScreenMode (winScreenModeSet, &width, &height, &depth, &color);
if (!e) { if (!e) {
UInt32 attr; UInt32 attr;
WinScreenGetAttribute(winScreenDensity, &attr); WinScreenGetAttribute(winScreenDensity, &attr);
e = (attr != kDensityDouble); e = (attr != kDensityDouble);
} }

View file

@ -13,7 +13,7 @@ UInt16 SilkInit(UInt32 *retVersion) {
if (sonySysFtrSysInfoP->libr & sonySysFtrSysInfoLibrSilk) { if (sonySysFtrSysInfoP->libr & sonySysFtrSysInfoLibrSilk) {
if ((e = SysLibFind(sonySysLibNameSilk, &slkRefNum))) if ((e = SysLibFind(sonySysLibNameSilk, &slkRefNum)))
if (e == sysErrLibNotFound) if (e == sysErrLibNotFound)
e = SysLibLoad(sonySysFileTSilkLib, sonySysFileCSilkLib, &slkRefNum); e = SysLibLoad(sonySysFileTSilkLib, sonySysFileCSilkLib, &slkRefNum);
if (!e) { if (!e) {
@ -37,7 +37,7 @@ UInt16 SilkInit(UInt32 *retVersion) {
version = 0; version = 0;
slkRefNum = sysInvalidRefNum; slkRefNum = sysInvalidRefNum;
} }
*retVersion = version; *retVersion = version;
return slkRefNum; return slkRefNum;
} }
@ -66,12 +66,12 @@ UInt16 SonyHRInit(UInt32 depth) {
} }
if (e) HRrefNum = sysInvalidRefNum; if (e) HRrefNum = sysInvalidRefNum;
if (HRrefNum != sysInvalidRefNum) { if (HRrefNum != sysInvalidRefNum) {
UInt32 width = hrWidth; UInt32 width = hrWidth;
UInt32 height = hrHeight; UInt32 height = hrHeight;
Boolean color = true; Boolean color = true;
e = HRWinScreenMode(HRrefNum, winScreenModeSet, &width, &height, &depth, &color); e = HRWinScreenMode(HRrefNum, winScreenModeSet, &width, &height, &depth, &color);
// error ? release and return an invalid reference number // error ? release and return an invalid reference number
if (e) { if (e) {

View file

@ -52,11 +52,11 @@ void ModDelete() {
static void ModSetStack(UInt32 newSize, UInt16 cardNo, LocalID dbID) { static void ModSetStack(UInt32 newSize, UInt16 cardNo, LocalID dbID) {
DmOpenRef dbRef = DmOpenDatabase(cardNo, dbID, dmModeReadWrite); DmOpenRef dbRef = DmOpenDatabase(cardNo, dbID, dmModeReadWrite);
if (dbRef) { if (dbRef) {
MemHandle pref = DmGetResource('pref',0); MemHandle pref = DmGetResource('pref',0);
UInt32 size = 0; UInt32 size = 0;
if (pref) { if (pref) {
SysAppPrefsType *data = (SysAppPrefsType *)MemHandleLock(pref); SysAppPrefsType *data = (SysAppPrefsType *)MemHandleLock(pref);
size = data->stackSize; size = data->stackSize;
@ -71,7 +71,7 @@ static void ModSetStack(UInt32 newSize, UInt16 cardNo, LocalID dbID) {
MemPtrUnlock(data); MemPtrUnlock(data);
DmReleaseResource(pref); DmReleaseResource(pref);
} }
DmCloseDatabase(dbRef); DmCloseDatabase(dbRef);
} }
} }
@ -84,7 +84,7 @@ static Err ModImport(UInt16 volRefNum, UInt8 engine) {
{ "sword1" }, { "sword1" },
{ "sky" } { "sky" }
}; };
char filename[256]; char filename[256];
UInt16 dum1; UInt16 dum1;
UInt32 dum2; UInt32 dum2;
@ -147,10 +147,10 @@ Boolean StartScummVM() {
FormPtr frmP = FrmInitForm(EngineForm); FormPtr frmP = FrmInitForm(EngineForm);
whichButton = FrmDoDialog(frmP); whichButton = FrmDoDialog(frmP);
FrmDeleteForm(frmP); FrmDeleteForm(frmP);
if (whichButton == EngineCancelButton) if (whichButton == EngineCancelButton)
return false; return false;
engine = (whichButton - Engine0Button); engine = (whichButton - Engine0Button);
} else { } else {
@ -168,7 +168,7 @@ Boolean StartScummVM() {
StrCopy(pathP,gameInfoP->pathP); StrCopy(pathP,gameInfoP->pathP);
else else
StrCat(pathP,gameInfoP->pathP); StrCat(pathP,gameInfoP->pathP);
/* // path exists ? /* // path exists ?
if (!checkPath(pathP)) { if (!checkPath(pathP)) {
MemHandleUnlock(recordH); MemHandleUnlock(recordH);
@ -252,7 +252,7 @@ Boolean StartScummVM() {
case 5: case 5:
ArgsAdd(&argvP[argc], "--platform=", "windows", &argc); ArgsAdd(&argvP[argc], "--platform=", "windows", &argc);
break; break;
} }
} }
// subtitles // subtitles
@ -300,7 +300,7 @@ Boolean StartScummVM() {
ArgsAdd(&argvP[argc], "-e", "towns", &argc); ArgsAdd(&argvP[argc], "-e", "towns", &argc);
case 5: // AdLib case 5: // AdLib
ArgsAdd(&argvP[argc], "-e", "adlib", &argc); ArgsAdd(&argvP[argc], "-e", "adlib", &argc);
} }
} }
else // NULL as default else // NULL as default
ArgsAdd(&argvP[argc], "-e", "null", &argc); ArgsAdd(&argvP[argc], "-e", "null", &argc);
@ -347,13 +347,13 @@ Boolean StartScummVM() {
StrIToA(num, gPrefs->debugLevel); StrIToA(num, gPrefs->debugLevel);
ArgsAdd(&argvP[argc], "-d", num, &argc); ArgsAdd(&argvP[argc], "-d", num, &argc);
} }
if (engine == ENGINE_QUEEN || engine == ENGINE_SKY) { if (engine == ENGINE_QUEEN || engine == ENGINE_SKY) {
// alternative intro ? // alternative intro ?
if (gPrefs->altIntro) if (gPrefs->altIntro)
ArgsAdd(&argvP[argc], "--alt-intro", NULL, &argc); ArgsAdd(&argvP[argc], "--alt-intro", NULL, &argc);
} }
if (engine == ENGINE_SCUMM) { if (engine == ENGINE_SCUMM) {
// copy protection ? // copy protection ?
if (gPrefs->copyProtection) if (gPrefs->copyProtection)
@ -370,7 +370,7 @@ Boolean StartScummVM() {
lightspeed= (gPrefs->lightspeed.enable ? gPrefs->lightspeed.mode : 255); lightspeed= (gPrefs->lightspeed.enable ? gPrefs->lightspeed.mode : 255);
toLauncher= (gPrefs->exitLauncher); toLauncher= (gPrefs->exitLauncher);
// gVars values // gVars values
// (gVars->HRrefNum defined in checkHRmode on Clié) // (gVars->HRrefNum defined in checkHRmode on Clié)
gVars->screenLocked = false; gVars->screenLocked = false;
gVars->volRefNum = gPrefs->card.volRefNum; gVars->volRefNum = gPrefs->card.volRefNum;
@ -379,7 +379,7 @@ Boolean StartScummVM() {
// user params // user params
HWR_RSTALL(); HWR_RSTALL();
if (!gPrefs->autoOff) if (!gPrefs->autoOff)
HWR_SET(INIT_AUTOOFF); HWR_SET(INIT_AUTOOFF);

View file

@ -31,12 +31,12 @@ static void dummy(Boolean){};
void StdioInit(UInt16 volRefNum, const Char *output, LedProc ledProc) { void StdioInit(UInt16 volRefNum, const Char *output, LedProc ledProc) {
gStdioVolRefNum = volRefNum; gStdioVolRefNum = volRefNum;
if (ledProc) if (ledProc)
gStdioLedProc = ledProc; gStdioLedProc = ledProc;
else else
gStdioLedProc = dummy; gStdioLedProc = dummy;
VFSFileDelete(gStdioVolRefNum, output); VFSFileDelete(gStdioVolRefNum, output);
VFSFileCreate(gStdioVolRefNum, output); VFSFileCreate(gStdioVolRefNum, output);
VFSFileOpen (gStdioVolRefNum, output,vfsModeWrite, &gStdioOutput); VFSFileOpen (gStdioVolRefNum, output,vfsModeWrite, &gStdioOutput);
@ -48,7 +48,7 @@ void StdioRelease() {
UInt16 fclose(FileRef *stream) { UInt16 fclose(FileRef *stream) {
Err error = VFSFileClose(*stream); Err error = VFSFileClose(*stream);
if (error == errNone) if (error == errNone)
MemPtrFree(stream); MemPtrFree(stream);
@ -89,7 +89,7 @@ Int16 fgetc(FileRef *stream) {
UInt32 numBytesRead; UInt32 numBytesRead;
Err e; Err e;
Char c; Char c;
e = VFSFileRead(*stream, 1, &c, &numBytesRead); e = VFSFileRead(*stream, 1, &c, &numBytesRead);
return (int)(!e ? c : EOF); return (int)(!e ? c : EOF);
} }
@ -102,14 +102,14 @@ Char *fgets(Char *s, UInt32 n, FileRef *stream) {
if (error == errNone || error == vfsErrFileEOF) { if (error == errNone || error == vfsErrFileEOF) {
UInt32 reset = 0; UInt32 reset = 0;
Char *endLine = StrChr(s, '\n'); Char *endLine = StrChr(s, '\n');
if (endLine >= s) { if (endLine >= s) {
reset = (endLine - s); reset = (endLine - s);
s[reset] = 0; s[reset] = 0;
reset = numBytesRead - (reset + 1); reset = numBytesRead - (reset + 1);
VFSFileSeek(*stream, vfsOriginCurrent, -reset); VFSFileSeek(*stream, vfsOriginCurrent, -reset);
} }
return s; return s;
} }
#ifdef _DEBUG_STDIO #ifdef _DEBUG_STDIO
@ -143,7 +143,7 @@ FileRef *fopen(const Char *filename, const Char *type) {
Err err; Err err;
UInt16 openMode; UInt16 openMode;
FileRef *fileRefP = (FileRef *)MemPtrNew(sizeof(FileRef *)); FileRef *fileRefP = (FileRef *)MemPtrNew(sizeof(FileRef *));
if (StrCompare(type,"r")==0) if (StrCompare(type,"r")==0)
openMode = vfsModeRead; openMode = vfsModeRead;
else if (StrCompare(type,"rb")==0) else if (StrCompare(type,"rb")==0)
@ -280,7 +280,7 @@ UInt32 ftell(FileRef *stream) {
e = VFSFileTell(*stream,&filePos); e = VFSFileTell(*stream,&filePos);
if (e != errNone) if (e != errNone)
return e; return e;
return filePos; return filePos;
} }
@ -323,7 +323,7 @@ Int32 sprintf(Char* s, const Char* formatStr, ...) {
va_start(va, formatStr); va_start(va, formatStr);
count = vsprintf(s, formatStr, va); count = vsprintf(s, formatStr, va);
va_end(va); va_end(va);
return count; return count;
} }
@ -335,7 +335,7 @@ Int32 snprintf(Char* s, UInt32 len, const Char* formatStr, ...) {
va_start(va, formatStr); va_start(va, formatStr);
count = vsprintf(s, formatStr, va); count = vsprintf(s, formatStr, va);
va_end(va); va_end(va);
return count; return count;
} }
@ -354,11 +354,11 @@ static Char *StrIToBase(Char *s, Int32 i, UInt8 b) {
Char o; Char o;
Int16 c, n = 0; Int16 c, n = 0;
Int32 div, mod; Int32 div, mod;
do { do {
div = i / b; div = i / b;
mod = i % b; mod = i % b;
s[n++] = *(conv + mod); s[n++] = *(conv + mod);
i = div; i = div;
@ -384,7 +384,7 @@ static Char *StrIToBase(Char *s, Int32 i, UInt8 b) {
static void StrProcC_(Char *ioStr, UInt16 maxLen) { static void StrProcC_(Char *ioStr, UInt16 maxLen) {
Char *found; Char *found;
Int16 length; Int16 length;
while (found = StrStr(ioStr, "`c`")) { while (found = StrStr(ioStr, "`c`")) {
if (found[3] == 0) { // if next char is NULL if (found[3] == 0) { // if next char is NULL
length = maxLen - (found - ioStr + 2); length = maxLen - (found - ioStr + 2);
@ -398,10 +398,10 @@ static void StrProcXO(Char *ioStr, UInt16 maxLen, Char *tmp) {
Char *found, *last, mod, fill; Char *found, *last, mod, fill;
Int16 len, count, next; Int16 len, count, next;
Int32 val; Int32 val;
while (found = StrChr(ioStr, '`')) { while (found = StrChr(ioStr, '`')) {
last = StrChr(found + 1, '`'); last = StrChr(found + 1, '`');
if (!last) if (!last)
return; return;
@ -417,7 +417,7 @@ static void StrProcXO(Char *ioStr, UInt16 maxLen, Char *tmp) {
// x and X always 8char on palmos ... o set to 8char (not supported on palmos) // x and X always 8char on palmos ... o set to 8char (not supported on palmos)
while (found[next] == '0' || found[next] == ' ') // WARNING : reduce size only (TODO ?) while (found[next] == '0' || found[next] == ' ') // WARNING : reduce size only (TODO ?)
next++; next++;
// convert to base 8 // convert to base 8
if (mod == 'o') { if (mod == 'o') {
StrNCopy(tmp, found + next, 8 - next); StrNCopy(tmp, found + next, 8 - next);
@ -434,7 +434,7 @@ static void StrProcXO(Char *ioStr, UInt16 maxLen, Char *tmp) {
if ((8 - next) > count) if ((8 - next) > count)
count = 8 - next; count = 8 - next;
if (count == 0) if (count == 0)
count = 1; count = 1;
@ -455,12 +455,12 @@ static void StrProcXO(Char *ioStr, UInt16 maxLen, Char *tmp) {
Int32 vsprintf(Char* s, const Char* formatStr, _Palm_va_list argParam) { Int32 vsprintf(Char* s, const Char* formatStr, _Palm_va_list argParam) {
Char format[256], result[256], tmp[32]; Char format[256], result[256], tmp[32];
Char *found, *mod, *num; Char *found, *mod, *num;
UInt32 next; UInt32 next;
Boolean zero; Boolean zero;
Int16 count, len; Int16 count, len;
MemSet(format, sizeof(format), 'x'); MemSet(format, sizeof(format), 'x');
MemSet(result, sizeof(result), 'y'); MemSet(result, sizeof(result), 'y');
MemSet(tmp, sizeof(tmp), 'z'); MemSet(tmp, sizeof(tmp), 'z');
@ -470,7 +470,7 @@ Int32 vsprintf(Char* s, const Char* formatStr, _Palm_va_list argParam) {
while (found = StrChr(format + next, '%')) { while (found = StrChr(format + next, '%')) {
mod = found + 1; mod = found + 1;
if (*mod == '%') { // just a % ? if (*mod == '%') { // just a % ?
mod++; mod++;
@ -479,7 +479,7 @@ Int32 vsprintf(Char* s, const Char* formatStr, _Palm_va_list argParam) {
*mod == '-' || *mod == '-' ||
*mod == ' ' ) // skip *mod == ' ' ) // skip
mod++; mod++;
if (*mod == '0' || if (*mod == '0' ||
*mod == '.' ) { *mod == '.' ) {
*mod++ = '0'; *mod++ = '0';
@ -487,12 +487,12 @@ Int32 vsprintf(Char* s, const Char* formatStr, _Palm_va_list argParam) {
} else { } else {
zero = false; zero = false;
} }
num = mod; num = mod;
while ( *mod >= '0' && while ( *mod >= '0' &&
*mod <= '9' ) // search format char *mod <= '9' ) // search format char
mod++; mod++;
// get the numeric value // get the numeric value
if (num < mod) { if (num < mod) {
StrNCopy(tmp, num, mod - num); StrNCopy(tmp, num, mod - num);
@ -514,19 +514,19 @@ Int32 vsprintf(Char* s, const Char* formatStr, _Palm_va_list argParam) {
} else { } else {
len = 0; len = 0;
switch (*mod) { switch (*mod) {
case 'x': case 'x':
case 'X': case 'X':
case 'o': case 'o':
tmp[0] = '`'; tmp[0] = '`';
tmp[1] = (zero) ? '0' : ' '; tmp[1] = (zero) ? '0' : ' ';
tmp[2] = *mod; tmp[2] = *mod;
StrIToA(tmp + 3, count); StrIToA(tmp + 3, count);
len += StrLen(tmp); len += StrLen(tmp);
tmp[len++] = '`'; tmp[len++] = '`';
tmp[len] = 0; tmp[len] = 0;
if (*mod == 'o') { // set as base 10 num and convert later if (*mod == 'o') { // set as base 10 num and convert later
*mod = 'd'; *mod = 'd';
count = 8; // force 8char count = 8; // force 8char
@ -534,7 +534,7 @@ Int32 vsprintf(Char* s, const Char* formatStr, _Palm_va_list argParam) {
break; break;
} }
StrNCopy(tmp + len, found, (num - found)); StrNCopy(tmp + len, found, (num - found));
len += (num - found); len += (num - found);
@ -542,12 +542,12 @@ Int32 vsprintf(Char* s, const Char* formatStr, _Palm_va_list argParam) {
StrIToA(tmp + len, count); StrIToA(tmp + len, count);
len += StrLen(tmp + len); len += StrLen(tmp + len);
} }
if (*mod == 'd' || if (*mod == 'd' ||
*mod == 'i' || *mod == 'i' ||
*mod == 'x' || *mod == 'x' ||
*mod == 'X' || *mod == 'X' ||
*mod == 'u' *mod == 'u'
) { ) {
tmp[len++] = 'l'; tmp[len++] = 'l';
} }
@ -561,15 +561,15 @@ Int32 vsprintf(Char* s, const Char* formatStr, _Palm_va_list argParam) {
StrNCopy(found, tmp, StrLen(tmp)); StrNCopy(found, tmp, StrLen(tmp));
mod = found + StrLen(tmp); mod = found + StrLen(tmp);
} }
next = (mod - format); next = (mod - format);
} }
// Copy result in a temp buffer to process last formats // Copy result in a temp buffer to process last formats
StrVPrintF(result, format, argParam); StrVPrintF(result, format, argParam);
StrProcC_(result, 256); StrProcC_(result, 256);
StrProcXO(result, 256, tmp); StrProcXO(result, 256, tmp);
StrCopy(s, result); StrCopy(s, result);
return StrLen(s); return StrLen(s);
} }

View file

@ -24,21 +24,21 @@
void *bsearch(const void *key, const void *base, UInt32 nmemb, UInt32 size, int (*compar)(const void *, const void *)) { void *bsearch(const void *key, const void *base, UInt32 nmemb, UInt32 size, int (*compar)(const void *, const void *)) {
Int32 position; Int32 position;
if (SysBinarySearch(base, nmemb, size, (SearchFuncPtr)compar, key, 0, &position, true)) if (SysBinarySearch(base, nmemb, size, (SearchFuncPtr)compar, key, 0, &position, true))
return (void *)((UInt32)base + size * position); return (void *)((UInt32)base + size * position);
return NULL; return NULL;
} }
long strtol(const char *s, char **endptr, int base) { long strtol(const char *s, char **endptr, int base) {
// WARNING : only base = 10 supported // WARNING : only base = 10 supported
long val = StrAToI(s); long val = StrAToI(s);
if (endptr) { if (endptr) {
Char str[maxStrIToALen]; Char str[maxStrIToALen];
StrIToA(str, val); StrIToA(str, val);
if (StrNCompare(s, str, StrLen(str)) == 0) if (StrNCompare(s, str, StrLen(str)) == 0)
*endptr = (char *)s + StrLen(str); *endptr = (char *)s + StrLen(str);
} }
@ -65,18 +65,18 @@ Err free(MemPtr memP) {
} }
MemPtr realloc(MemPtr oldP, UInt32 size) { MemPtr realloc(MemPtr oldP, UInt32 size) {
if (oldP != NULL) if (oldP != NULL)
if (MemPtrResize(oldP,size) == 0) if (MemPtrResize(oldP,size) == 0)
return oldP; return oldP;
MemPtr newP = MemPtrNew(size); MemPtr newP = MemPtrNew(size);
if (oldP!=NULL) if (oldP!=NULL)
{ {
MemMove(newP,oldP,MemPtrSize(oldP)); MemMove(newP,oldP,MemPtrSize(oldP));
MemPtrFree(oldP); MemPtrFree(oldP);
} }
return newP; return newP;
} }

View file

@ -27,14 +27,14 @@ void *memchr(const void *s, int c, UInt32 n) {
for(chr = 0; chr < n;chr++,((UInt8 *)s)++) for(chr = 0; chr < n;chr++,((UInt8 *)s)++)
if ( *((UInt8 *)s) == c) if ( *((UInt8 *)s) == c)
return (void *)s; return (void *)s;
return NULL; return NULL;
} }
UInt32 strspn(const char *s1, const char *s2) { UInt32 strspn(const char *s1, const char *s2) {
UInt32 chr = 0; UInt32 chr = 0;
while ( chr < strlen(s1) && while ( chr < strlen(s1) &&
strchr(s2, s1[chr]) ) strchr(s2, s1[chr]) )
chr++; chr++;
@ -88,13 +88,13 @@ Char *strtok(Char *str, const Char *sep) {
Char *strpbrk(const Char *s1, const Char *s2) { Char *strpbrk(const Char *s1, const Char *s2) {
Char *found; Char *found;
UInt32 n; UInt32 n;
for (n=0; n <= StrLen(s2); n++) { for (n=0; n <= StrLen(s2); n++) {
found = StrChr(s1, s2[n]); found = StrChr(s1, s2[n]);
if (found) if (found)
return found; return found;
} }
return NULL; return NULL;
} }
@ -107,7 +107,7 @@ Char *strrchr(const Char *s, int c) {
return (Char *)(s+chr); return (Char *)(s+chr);
return NULL; return NULL;
} }
Char *strdup(const Char *s1) { Char *strdup(const Char *s1) {
Char* buf = (Char *)MemPtrNew(StrLen(s1)+1); Char* buf = (Char *)MemPtrNew(StrLen(s1)+1);

View file

@ -29,10 +29,10 @@ time_t time(time_t *tloc) {
DateTimeType Epoch = {1, 0, 0, 1, 1, 1970, 0}; // form 1/1/1904 12AM to 1/1/1970 12AM DateTimeType Epoch = {1, 0, 0, 1, 1, 1970, 0}; // form 1/1/1904 12AM to 1/1/1970 12AM
secs -= TimDateTimeToSeconds (&Epoch); secs -= TimDateTimeToSeconds (&Epoch);
if (tloc) if (tloc)
*tloc = secs; *tloc = secs;
return (secs); return (secs);
} }
@ -47,7 +47,7 @@ struct tm *localtime(const time_t *timer) {
secs += TimDateTimeToSeconds(&Epoch); secs += TimDateTimeToSeconds(&Epoch);
TimSecondsToDateTime (secs, &dt); TimSecondsToDateTime (secs, &dt);
tmDate.tm_sec = dt.second; tmDate.tm_sec = dt.second;
tmDate.tm_min = dt.minute; tmDate.tm_min = dt.minute;
tmDate.tm_hour = dt.hour; tmDate.tm_hour = dt.hour;
@ -55,6 +55,6 @@ struct tm *localtime(const time_t *timer) {
tmDate.tm_mon = dt.month - 1; tmDate.tm_mon = dt.month - 1;
tmDate.tm_year = dt.year - 1900; tmDate.tm_year = dt.year - 1900;
tmDate.tm_wday = dt.weekDay; tmDate.tm_wday = dt.weekDay;
return &tmDate; return &tmDate;
} }

View file

@ -27,7 +27,7 @@ const Char *gUnistdCWD = NULL;
// currently used only to retreive savepath // currently used only to retreive savepath
Char *getcwd(Char *buf, UInt32 size) { Char *getcwd(Char *buf, UInt32 size) {
Char *copy = buf; Char *copy = buf;
if (gUnistdCWD) { if (gUnistdCWD) {
if (!copy) if (!copy)
copy = (Char *)MemPtrNew(StrLen(gUnistdCWD)); // this may never occured copy = (Char *)MemPtrNew(StrLen(gUnistdCWD)); // this may never occured

View file

@ -19,5 +19,5 @@
* $Header$ * $Header$
* *
*/ */
#include "string.h" #include "string.h"

View file

@ -43,8 +43,8 @@ typedef UInt32 size_t;
#define vsnprintf(a,b,c,d) vsprintf(a,c,d) #define vsnprintf(a,b,c,d) vsprintf(a,c,d)
#define getc(a) fgetc(a) #define getc(a) fgetc(a)
#define SEEK_SET vfsOriginBeginning #define SEEK_SET vfsOriginBeginning
#define SEEK_CUR vfsOriginCurrent #define SEEK_CUR vfsOriginCurrent
#define SEEK_END vfsOriginEnd #define SEEK_END vfsOriginEnd
UInt16 fclose (FileRef *stream); UInt16 fclose (FileRef *stream);

View file

@ -27,6 +27,6 @@
extern const Char *gUnistdCWD; extern const Char *gUnistdCWD;
Char *getcwd(Char *buf, UInt32 size); Char *getcwd(Char *buf, UInt32 size);
#endif #endif

View file

@ -34,7 +34,7 @@ void run(int argc, char *argv[]) {
// create file for printf, warnings, etc... // create file for printf, warnings, etc...
StdioInit(gVars->volRefNum, "/PALM/Programs/ScummVM/scumm.log", DrawStatus); StdioInit(gVars->volRefNum, "/PALM/Programs/ScummVM/scumm.log", DrawStatus);
gUnistdCWD = SCUMMVM_SAVEPATH; gUnistdCWD = SCUMMVM_SAVEPATH;
// init hardware // init hardware
if (HWR_INIT(INIT_PA1LIB)) Pa1libInit(); if (HWR_INIT(INIT_PA1LIB)) Pa1libInit();
if (HWR_INIT(INIT_VIBRATOR)) gVars->vibrator = RumbleInit(); if (HWR_INIT(INIT_VIBRATOR)) gVars->vibrator = RumbleInit();
@ -59,7 +59,7 @@ void run(int argc, char *argv[]) {
if (HWR_INIT(INIT_ARM)) ARMRelease(); if (HWR_INIT(INIT_ARM)) ARMRelease();
if (HWR_INIT(INIT_VIBRATOR)) RumbleRelease(); if (HWR_INIT(INIT_VIBRATOR)) RumbleRelease();
if (HWR_INIT(INIT_PA1LIB)) Pa1libRelease(); if (HWR_INIT(INIT_PA1LIB)) Pa1libRelease();
// close log file // close log file
StdioRelease(); StdioRelease();
@ -85,7 +85,7 @@ static UInt32 ModulesPalmMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags)
LocalID dbID; LocalID dbID;
LaunchParamType *lp = (LaunchParamType *)cmdPBP; LaunchParamType *lp = (LaunchParamType *)cmdPBP;
gVars = lp->gVars; gVars = lp->gVars;
argvP = lp->args.argv; argvP = lp->args.argv;
@ -105,7 +105,7 @@ static UInt32 ModulesPalmMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags)
// MemPtrSetOwner(gVars, ownerID); // MemPtrSetOwner(gVars, ownerID);
// ArgsSetOwner(argvP, ownerID); // will be freed by main(...) // ArgsSetOwner(argvP, ownerID); // will be freed by main(...)
// MemPtrFree(lp); // will be freed by the system on exit // MemPtrFree(lp); // will be freed by the system on exit
run(lp->args.argc, argvP); run(lp->args.argc, argvP);
cardNo = 0; cardNo = 0;

View file

@ -15,7 +15,7 @@ typedef struct {
UInt8 argc; UInt8 argc;
Char **argv; Char **argv;
} args; } args;
GlobalsDataPtr gVars; GlobalsDataPtr gVars;
} LaunchParamType; } LaunchParamType;

View file

@ -119,7 +119,7 @@ void OSystem_PALMOS::setWindowCaption(const char *caption) {
// erase the screen // erase the screen
WinEraseWindow(); WinEraseWindow();
if (_useHRmode) { if (_useHRmode) {
y = 160 - (h >> 1) - 10; y = 160 - (h >> 1) - 10;
HRFntSetFont(gVars->HRrefNum,hrTinyBoldFont); HRFntSetFont(gVars->HRrefNum,hrTinyBoldFont);
@ -140,7 +140,7 @@ void OSystem_PALMOS::setWindowCaption(const char *caption) {
size = 2; size = 2;
h = (h - 2) / 2 + 2; h = (h - 2) / 2 + 2;
} }
BitmapTypeV3 *bmp2P; BitmapTypeV3 *bmp2P;
BitmapType *bmp1P = BmpCreate(320, (h << 1), 8, NULL, &e); BitmapType *bmp1P = BmpCreate(320, (h << 1), 8, NULL, &e);
WinHandle tmpH = WinCreateBitmapWindow(bmp1P, &e); WinHandle tmpH = WinCreateBitmapWindow(bmp1P, &e);
@ -206,7 +206,7 @@ void OSystem_PALMOS::quit() {
free(_currentPalette); free(_currentPalette);
free(_mouseBackupP); free(_mouseBackupP);
free(_mouseDataP); free(_mouseDataP);
if (_cdPlayer) { if (_cdPlayer) {
_cdPlayer->release(); _cdPlayer->release();
_cdPlayer = NULL; _cdPlayer = NULL;
@ -224,9 +224,9 @@ OSystem_PALMOS::OSystem_PALMOS() {
_paletteDirtyStart = 0; _paletteDirtyStart = 0;
_paletteDirtyEnd = 0; _paletteDirtyEnd = 0;
memset(&_sound, 0, sizeof(SoundDataType)); memset(&_sound, 0, sizeof(SoundDataType));
_currentPalette = NULL; _currentPalette = NULL;
_modeChanged = false; _modeChanged = false;
_gfxLoaded = false; _gfxLoaded = false;
@ -234,7 +234,7 @@ OSystem_PALMOS::OSystem_PALMOS() {
_lastKeyPressed = kLastKeyNone; _lastKeyPressed = kLastKeyNone;
_lastKeyRepeat = 100; _lastKeyRepeat = 100;
_lastKeyModifier = MD_NONE; _lastKeyModifier = MD_NONE;
_useNumPad = false; _useNumPad = false;
_showBatLow = false; _showBatLow = false;
@ -248,14 +248,14 @@ OSystem_PALMOS::OSystem_PALMOS() {
_currentPalette = (RGBColorType*)calloc(sizeof(RGBColorType), 256); _currentPalette = (RGBColorType*)calloc(sizeof(RGBColorType), 256);
_mouseBackupP = (byte*)malloc(MAX_MOUSE_W * MAX_MOUSE_H); _mouseBackupP = (byte*)malloc(MAX_MOUSE_W * MAX_MOUSE_H);
// overlay // overlay
_tmpScreenP = NULL; _tmpScreenP = NULL;
_tmpBackupP = NULL; _tmpBackupP = NULL;
// HiRes // HiRes
_useHRmode = (gVars->HRrefNum != sysInvalidRefNum); _useHRmode = (gVars->HRrefNum != sysInvalidRefNum);
// mouse emu // mouse emu
// TODO : add UX50 arrow keys // TODO : add UX50 arrow keys
if (OPTIONS_TST(kOpt5WayNavigator)) { if (OPTIONS_TST(kOpt5WayNavigator)) {
@ -272,7 +272,7 @@ OSystem_PALMOS::OSystem_PALMOS() {
_keyMouse.bitButLeft= keyBitHard3|0x00100000; // keyBitRockerCenter on TwKeys.h but conflict with palmnavigator.h _keyMouse.bitButLeft= keyBitHard3|0x00100000; // keyBitRockerCenter on TwKeys.h but conflict with palmnavigator.h
} }
_keyMask = (_keyMouse.bitUp | _keyMouse.bitDown | _keyMouse.bitLeft | _keyMouse.bitRight | _keyMouse.bitButLeft); _keyMask = (_keyMouse.bitUp | _keyMouse.bitDown | _keyMouse.bitLeft | _keyMouse.bitRight | _keyMouse.bitButLeft);
// enable cdrom ? // enable cdrom ?
_cdPlayer = NULL; _cdPlayer = NULL;
if (gVars->CD.enable) { if (gVars->CD.enable) {
@ -287,7 +287,7 @@ OSystem_PALMOS::OSystem_PALMOS() {
_cdPlayer = new PckTunesCDPlayer(this); _cdPlayer = new PckTunesCDPlayer(this);
break; break;
} }
if (_cdPlayer) { if (_cdPlayer) {
if (!_cdPlayer->init()) { if (!_cdPlayer->init()) {
_cdPlayer->release(); _cdPlayer->release();
@ -295,7 +295,7 @@ OSystem_PALMOS::OSystem_PALMOS() {
} }
} }
} }
// sound // sound
memset(&_sound,0,sizeof(SoundDataType)); memset(&_sound,0,sizeof(SoundDataType));
} }

View file

@ -72,7 +72,7 @@ public:
bool setGraphicsMode(int mode); bool setGraphicsMode(int mode);
int getGraphicsMode() const; int getGraphicsMode() const;
int getDefaultGraphicsMode() const; int getDefaultGraphicsMode() const;
int getOutputSampleRate() const; int getOutputSampleRate() const;
bool openCD(int drive); bool openCD(int drive);
void setWindowCaption(const char *caption); // TODO : _inGame = true = don't set void setWindowCaption(const char *caption); // TODO : _inGame = true = don't set
@ -111,17 +111,17 @@ public:
// Shaking is used in SCUMM. Set current shake position. // Shaking is used in SCUMM. Set current shake position.
void setShakePos(int shake_pos); void setShakePos(int shake_pos);
// Get the number of milliseconds since the program was started. // Get the number of milliseconds since the program was started.
uint32 getMillis(); uint32 getMillis();
// Delay for a specified amount of milliseconds // Delay for a specified amount of milliseconds
void delayMillis(uint msecs); void delayMillis(uint msecs);
// Get the next event. // Get the next event.
// Returns true if an event was retrieved. // Returns true if an event was retrieved.
bool pollEvent(Event &event); bool pollEvent(Event &event);
void SimulateArrowKeys(Event &event, Int8 iHoriz, Int8 iVert); void SimulateArrowKeys(Event &event, Int8 iHoriz, Int8 iVert);
/** @name Sound */ /** @name Sound */
@ -133,14 +133,14 @@ public:
* @param param an arbitrary parameter which is stored and passed to proc. * @param param an arbitrary parameter which is stored and passed to proc.
*/ */
bool setSoundCallback(SoundProc proc, void *param); bool setSoundCallback(SoundProc proc, void *param);
/** /**
* Remove any audio callback previously set via setSoundCallback, thus effectively * Remove any audio callback previously set via setSoundCallback, thus effectively
* stopping all audio output immediately. * stopping all audio output immediately.
* @see setSoundCallback * @see setSoundCallback
*/ */
void clearSoundCallback(); void clearSoundCallback();
//@} //@}
// Poll cdrom status // Poll cdrom status
// Returns true if cd audio is playing // Returns true if cd audio is playing
@ -239,9 +239,9 @@ private:
int _current_shake_pos; int _current_shake_pos;
int _new_shake_pos; int _new_shake_pos;
byte _mouseKeyColor; byte _mouseKeyColor;
UInt32 _exit_delay; UInt32 _exit_delay;
struct { struct {
uint32 duration, nextExpiry; uint32 duration, nextExpiry;
bool active; bool active;
@ -258,10 +258,10 @@ private:
void draw_mouse(); void draw_mouse();
void undraw_mouse(); void undraw_mouse();
void sound_handler(); void sound_handler();
void timer_handler(UInt32 current_msecs); void timer_handler(UInt32 current_msecs);
void getCoordinates(EventPtr event, Coord *x, Coord *y); void getCoordinates(EventPtr event, Coord *x, Coord *y);
void draw1BitGfx(UInt16 id, Int32 x, Int32 y, Boolean clear); void draw1BitGfx(UInt16 id, Int32 x, Int32 y, Boolean clear);
@ -283,12 +283,12 @@ private:
enum { enum {
kLastKeyNone = 0, kLastKeyNone = 0,
kLastKeyMouse = 1 << 0, kLastKeyMouse = 1 << 0,
kLastKeyCalc = 1 << 30, kLastKeyCalc = 1 << 30,
kLastKeyAny = 1 << 31 kLastKeyAny = 1 << 31
}; };
UInt32 _keyMask; UInt32 _keyMask;
struct { struct {
UInt32 bitUp; UInt32 bitUp;
@ -301,7 +301,7 @@ private:
Int32 _lastKeyPressed; Int32 _lastKeyPressed;
UInt32 _lastKeyRepeat; UInt32 _lastKeyRepeat;
UInt8 _lastKeyModifier; UInt8 _lastKeyModifier;
Boolean _useNumPad; Boolean _useNumPad;
Boolean _useHRmode; Boolean _useHRmode;
@ -311,7 +311,7 @@ private:
void init_intern(); void init_intern();
}; };
Err HwrDisplayPalette(UInt8 operation, Int16 startIndex, Err HwrDisplayPalette(UInt8 operation, Int16 startIndex,
UInt16 paletteEntries, RGBColorType *tableP) UInt16 paletteEntries, RGBColorType *tableP)
SYS_TRAP(sysTrapHwrDisplayPalette); SYS_TRAP(sysTrapHwrDisplayPalette);

View file

@ -75,7 +75,7 @@ void OSystem_PALMOS::getCoordinates(EventPtr event, Coord *x, Coord *y) {
// wide landscape // wide landscape
if (OPTIONS_TST(kOptModeLandscape)) { if (OPTIONS_TST(kOptModeLandscape)) {
// zodiac have mutliple ratio // zodiac have mutliple ratio
if (OPTIONS_TST(kOptDeviceZodiac)) { if (OPTIONS_TST(kOptDeviceZodiac)) {
Int32 w,h; Int32 w,h;
@ -94,7 +94,7 @@ void OSystem_PALMOS::getCoordinates(EventPtr event, Coord *x, Coord *y) {
// wide portrait, only for 320x200 // wide portrait, only for 320x200
} else { } else {
*y = ((event->screenX - _screenOffset.y) << 1) / 3; *y = ((event->screenX - _screenOffset.y) << 1) / 3;
*x = 320 - ((event->screenY - _screenOffset.x) << 1) / 3 - 1; *x = 320 - ((event->screenY - _screenOffset.x) << 1) / 3 - 1;
} }
// normal coord // normal coord
@ -137,12 +137,12 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
sy = -1; sy = -1;
else if (keyCurrentState & _keyMouse.bitDown) else if (keyCurrentState & _keyMouse.bitDown)
sy = +1; sy = +1;
if (keyCurrentState & _keyMouse.bitLeft) if (keyCurrentState & _keyMouse.bitLeft)
sx = -1; sx = -1;
else if (keyCurrentState & _keyMouse.bitRight) else if (keyCurrentState & _keyMouse.bitRight)
sx = +1; sx = +1;
SimulateArrowKeys(event, sx, sy); SimulateArrowKeys(event, sx, sy);
updateScreen(); updateScreen();
updateCD(); updateCD();
@ -161,7 +161,7 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
if (ev.eType == keyDownEvent) { if (ev.eType == keyDownEvent) {
switch (ev.data.keyDown.chr) { switch (ev.data.keyDown.chr) {
// ESC key // ESC key
case vchrLaunch: case vchrLaunch:
_lastKeyPressed = kLastKeyNone; _lastKeyPressed = kLastKeyNone;
@ -170,7 +170,7 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
event.kbd.ascii = 27; event.kbd.ascii = 27;
event.kbd.flags = 0; event.kbd.flags = 0;
return true; return true;
// F5 = menu // F5 = menu
case vchrJogPushRepeat: case vchrJogPushRepeat:
case vchrMenu: case vchrMenu:
@ -204,7 +204,7 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
return true; return true;
case vchrJogPushedUp: case vchrJogPushedUp:
case vchrJogPushedDown: // hot swap gfx mode case vchrJogPushedDown: // hot swap gfx mode
if (_initMode == GFX_WIDE) if (_initMode == GFX_WIDE)
hotswap_gfx_mode(_mode == GFX_WIDE ? GFX_NORMAL: GFX_WIDE); hotswap_gfx_mode(_mode == GFX_WIDE ? GFX_NORMAL: GFX_WIDE);
else else
@ -238,7 +238,7 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
if (OPTIONS_TST(kOptPalmSoundAPI) && _sound.active) if (OPTIONS_TST(kOptPalmSoundAPI) && _sound.active)
SndStreamPause(*((SndStreamRef *)_sound.handle), true); SndStreamPause(*((SndStreamRef *)_sound.handle), true);
break; break;
case vchrLateWakeup: case vchrLateWakeup:
// resume the sound thread if any // resume the sound thread if any
if (OPTIONS_TST(kOptPalmSoundAPI) && _sound.active) if (OPTIONS_TST(kOptPalmSoundAPI) && _sound.active)
@ -265,7 +265,7 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
event.kbd.ascii = 27; event.kbd.ascii = 27;
event.kbd.flags = 0; event.kbd.flags = 0;
return true; return true;
// F5 = menu // F5 = menu
case vchrHard3: case vchrHard3:
_lastKeyPressed = kLastKeyNone; _lastKeyPressed = kLastKeyNone;
@ -279,10 +279,10 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
} }
// prevent crash when alarm is raised // prevent crash when alarm is raised
handled = ((ev.eType == keyDownEvent) && handled = ((ev.eType == keyDownEvent) &&
(ev.data.keyDown.modifiers & commandKeyMask) && (ev.data.keyDown.modifiers & commandKeyMask) &&
((ev.data.keyDown.chr == vchrAttnStateChanged) || ((ev.data.keyDown.chr == vchrAttnStateChanged) ||
(ev.data.keyDown.chr == vchrAttnUnsnooze))); (ev.data.keyDown.chr == vchrAttnUnsnooze)));
// graffiti strokes, auto-off, etc... // graffiti strokes, auto-off, etc...
if (!handled) if (!handled)
@ -299,7 +299,7 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
if (ev.data.keyDown.chr == vchrCommand && (ev.data.keyDown.modifiers & commandKeyMask)) { if (ev.data.keyDown.chr == vchrCommand && (ev.data.keyDown.modifiers & commandKeyMask)) {
_lastKeyModifier++; _lastKeyModifier++;
_lastKeyModifier %= 4; _lastKeyModifier %= 4;
if (_lastKeyModifier) if (_lastKeyModifier)
draw1BitGfx((kDrawKeyState + _lastKeyModifier - 1), 2, _screenHeight + 2, true); draw1BitGfx((kDrawKeyState + _lastKeyModifier - 1), 2, _screenHeight + 2, true);
else else
@ -312,14 +312,14 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
if (_lastKeyModifier == MD_CMD) b = KBD_CTRL|KBD_ALT; if (_lastKeyModifier == MD_CMD) b = KBD_CTRL|KBD_ALT;
if (_lastKeyModifier == MD_ALT) b = KBD_ALT; if (_lastKeyModifier == MD_ALT) b = KBD_ALT;
if (_lastKeyModifier == MD_CTRL) b = KBD_CTRL; if (_lastKeyModifier == MD_CTRL) b = KBD_CTRL;
keycode = ev.data.keyDown.chr; keycode = ev.data.keyDown.chr;
// F1 -> F10 key // F1 -> F10 key
if (keycode >= '0' && keycode <= '9' && b == (KBD_CTRL|KBD_ALT)) { if (keycode >= '0' && keycode <= '9' && b == (KBD_CTRL|KBD_ALT)) {
keycode = keycode == '0' ? 324 : (315 + keycode - '1'); keycode = keycode == '0' ? 324 : (315 + keycode - '1');
b = 0; b = 0;
} else if ((keycode == 'z' && b == KBD_CTRL) || (b == KBD_ALT && keycode == 'x')) { } else if ((keycode == 'z' && b == KBD_CTRL) || (b == KBD_ALT && keycode == 'x')) {
event.type = EVENT_QUIT; event.type = EVENT_QUIT;
return true; return true;
@ -343,12 +343,12 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
setFeatureState(kFeatureFullscreenMode, !_fullscreen); setFeatureState(kFeatureFullscreenMode, !_fullscreen);
#endif #endif
} }
event.type = EVENT_KEYDOWN; event.type = EVENT_KEYDOWN;
event.kbd.keycode = keycode; event.kbd.keycode = keycode;
event.kbd.ascii = keycode; //(keycode>='a' && keycode<='z' && (event.kbd.flags & KBD_SHIFT) ? keycode &~ 0x20 : keycode); event.kbd.ascii = keycode; //(keycode>='a' && keycode<='z' && (event.kbd.flags & KBD_SHIFT) ? keycode &~ 0x20 : keycode);
event.kbd.flags = b; event.kbd.flags = b;
if (_lastKeyModifier) { if (_lastKeyModifier) {
_lastKeyModifier = MD_NONE; _lastKeyModifier = MD_NONE;
draw1BitGfx(kDrawKeyState, 2, getHeight() + 2, false); draw1BitGfx(kDrawKeyState, 2, getHeight() + 2, false);
@ -383,10 +383,10 @@ bool OSystem_PALMOS::pollEvent(Event &event) {
if (y >= y2 && y < (y2 + 34) && x >= x2 && x < (x2 + 40)) { // numpad location if (y >= y2 && y < (y2 + 34) && x >= x2 && x < (x2 + 40)) { // numpad location
UInt8 key = '1'; UInt8 key = '1';
key += 9 - ( (3 - ((x - x2) / 13)) + (3 * ((y - y2) / 11)) ); key += 9 - ( (3 - ((x - x2) / 13)) + (3 * ((y - y2) / 11)) );
_lastEvent = keyDownEvent; _lastEvent = keyDownEvent;
_lastKeyPressed = kLastKeyNone; _lastKeyPressed = kLastKeyNone;
event.type = EVENT_KEYDOWN; event.type = EVENT_KEYDOWN;
event.kbd.keycode = key; event.kbd.keycode = key;
event.kbd.ascii = key; event.kbd.ascii = key;

View file

@ -68,7 +68,7 @@ bool OSystem_PALMOS::setGraphicsMode(int mode) {
case GFX_WIDE: case GFX_WIDE:
_setMode = mode; _setMode = mode;
break; break;
default: default:
warning("unknown gfx mode %d", mode); warning("unknown gfx mode %d", mode);
_setMode = GFX_NORMAL; _setMode = GFX_NORMAL;
@ -103,10 +103,10 @@ void OSystem_PALMOS::initSize(uint w, uint h, int overlayScale) {
SysSetOrientationTriggerState(sysOrientationTriggerDisabled); SysSetOrientationTriggerState(sysOrientationTriggerDisabled);
set_mouse_pos(200,150); set_mouse_pos(200,150);
unload_gfx_mode(); unload_gfx_mode();
// force WIDE mode for 640x480 games // force WIDE mode for 640x480 games
if (h == 480) if (h == 480)
_setMode = GFX_WIDE; _setMode = GFX_WIDE;
@ -145,14 +145,14 @@ void OSystem_PALMOS::load_gfx_mode() {
// get the actual palette // get the actual palette
WinPalette(winPaletteGet, 0, 256, _currentPalette); WinPalette(winPaletteGet, 0, 256, _currentPalette);
// set only if _mode not changed // set only if _mode not changed
const byte startupPalette[] = { const byte startupPalette[] = {
0 ,0 ,0 ,0, 0 ,0 ,0 ,0,
0 ,0 ,171,0, 0 ,0 ,171,0,
0 ,171, 0 ,0, 0 ,171, 0 ,0,
0 ,171,171,0, 0 ,171,171,0,
171 ,0 ,0 ,0, 171 ,0 ,0 ,0,
171 ,0 ,171,0, 171 ,0 ,171,0,
171 ,87 ,0 ,0, 171 ,87 ,0 ,0,
171 ,171,171,0, 171 ,171,171,0,
@ -267,7 +267,7 @@ void OSystem_PALMOS::load_gfx_mode() {
_offScreenP = WinScreenLock(winLockErase) + _screenOffset.addr; _offScreenP = WinScreenLock(winLockErase) + _screenOffset.addr;
_screenP = _offScreenP; _screenP = _offScreenP;
_offScreenH = WinGetDisplayWindow(); _offScreenH = WinGetDisplayWindow();
_screenH = _offScreenH; _screenH = _offScreenH;
_renderer_proc = &OSystem_PALMOS::updateScreen_flipping; _renderer_proc = &OSystem_PALMOS::updateScreen_flipping;
break; break;
case GFX_WIDE: case GFX_WIDE:
@ -287,11 +287,11 @@ void OSystem_PALMOS::load_gfx_mode() {
_screenP = (byte *)(BmpGetBits(WinGetBitmap(_screenH))); _screenP = (byte *)(BmpGetBits(WinGetBitmap(_screenH)));
_renderer_proc = &OSystem_PALMOS::updateScreen_wideZodiac; _renderer_proc = &OSystem_PALMOS::updateScreen_wideZodiac;
} else } else
#endif #endif
{ {
gVars->screenLocked = true; gVars->screenLocked = true;
_screenP = WinScreenLock(winLockErase) + _screenOffset.addr; _screenP = WinScreenLock(winLockErase) + _screenOffset.addr;
_renderer_proc = (OPTIONS_TST(kOptModeLandscape)) ? _renderer_proc = (OPTIONS_TST(kOptModeLandscape)) ?
&OSystem_PALMOS::updateScreen_wideLandscape : &OSystem_PALMOS::updateScreen_wideLandscape :
&OSystem_PALMOS::updateScreen_widePortrait; &OSystem_PALMOS::updateScreen_widePortrait;
@ -324,7 +324,7 @@ void OSystem_PALMOS::load_gfx_mode() {
_gfxLoaded = true; _gfxLoaded = true;
} }
} }
void OSystem_PALMOS::unload_gfx_mode() { void OSystem_PALMOS::unload_gfx_mode() {
@ -407,25 +407,25 @@ void OSystem_PALMOS::hotswap_gfx_mode(int mode) {
DmWrite(dst, offset, src, _screenWidth); DmWrite(dst, offset, src, _screenWidth);
offset += _screenWidth; offset += _screenWidth;
src += _offScreenPitch; src += _offScreenPitch;
} while (--h); } while (--h);
_modeChanged = true; _modeChanged = true;
// reset offscreen pitch // reset offscreen pitch
_offScreenPitch = gVars->screenPitch; _offScreenPitch = gVars->screenPitch;
// free old mode memory // free old mode memory
unload_gfx_mode(); unload_gfx_mode();
// load new gfx mode // load new gfx mode
_mode = mode; _mode = mode;
load_gfx_mode(); load_gfx_mode();
// restore offscreen // restore offscreen
WinPalette(winPaletteSet, 0, 256, _currentPalette); WinPalette(winPaletteSet, 0, 256, _currentPalette);
clearScreen(); clearScreen();
copyRectToScreen(_tmpHotSwapP, _screenWidth, 0, 0, _screenWidth, _screenHeight); copyRectToScreen(_tmpHotSwapP, _screenWidth, 0, 0, _screenWidth, _screenHeight);
_modeChanged = false; _modeChanged = false;
// force palette update // force palette update
_paletteDirtyStart = 0; _paletteDirtyStart = 0;
_paletteDirtyEnd = 256; _paletteDirtyEnd = 256;
@ -483,7 +483,7 @@ byte OSystem_PALMOS::RGBToColor(uint8 r, uint8 g, uint8 b) {
} }
} }
} }
return color; return color;
} }
@ -549,7 +549,7 @@ void OSystem_PALMOS::copyRectToScreen(const byte *buf, int pitch, int x, int y,
void OSystem_PALMOS::updateScreen() { void OSystem_PALMOS::updateScreen() {
// Check whether the palette was changed in the meantime and update the // Check whether the palette was changed in the meantime and update the
// screen surface accordingly. // screen surface accordingly.
if (_paletteDirtyEnd != 0) { if (_paletteDirtyEnd != 0) {
UInt8 oldCol; UInt8 oldCol;
@ -563,11 +563,11 @@ void OSystem_PALMOS::updateScreen() {
oldCol = gVars->indicator.on; oldCol = gVars->indicator.on;
gVars->indicator.on = RGBToColor(0,255,0); gVars->indicator.on = RGBToColor(0,255,0);
if (oldCol != gVars->indicator.on) { if (oldCol != gVars->indicator.on) {
// redraw if needed // redraw if needed
if (_lastKeyModifier) if (_lastKeyModifier)
draw1BitGfx((kDrawKeyState + _lastKeyModifier - 1), 2, getHeight() + 2, true); draw1BitGfx((kDrawKeyState + _lastKeyModifier - 1), 2, getHeight() + 2, true);
if(_useNumPad) if(_useNumPad)
draw1BitGfx(kDrawNumPad, (getWidth() >> 1) - 32, getHeight() + 2, true); draw1BitGfx(kDrawNumPad, (getWidth() >> 1) - 32, getHeight() + 2, true);
@ -583,7 +583,7 @@ void OSystem_PALMOS::updateScreen() {
byte *src = _tmpScreenP; byte *src = _tmpScreenP;
byte *dst = _offScreenP; byte *dst = _offScreenP;
UInt16 h = _screenHeight; UInt16 h = _screenHeight;
do { do {
memcpy(dst, src, _screenWidth); memcpy(dst, src, _screenWidth);
dst += _offScreenPitch; dst += _offScreenPitch;
@ -600,7 +600,7 @@ void OSystem_PALMOS::draw1BitGfx(UInt16 id, Int32 x, Int32 y, Boolean show) {
return; return;
MemHandle hTemp = DmGetResource(bitmapRsc, id); MemHandle hTemp = DmGetResource(bitmapRsc, id);
if (hTemp) { if (hTemp) {
BitmapType *bmTemp; BitmapType *bmTemp;
UInt32 *bmData; UInt32 *bmData;
@ -619,12 +619,12 @@ void OSystem_PALMOS::draw1BitGfx(UInt16 id, Int32 x, Int32 y, Boolean show) {
if (next) if (next)
blocks++; blocks++;
for (ih = 0; ih < h; ih++) { // line for (ih = 0; ih < h; ih++) { // line
for (ib = 0; ib < blocks; ib++) { // 32pix block for (ib = 0; ib < blocks; ib++) { // 32pix block
next = w - (ib << 5); next = w - (ib << 5);
next = MIN(next, (Coord)32); next = MIN(next, (Coord)32);
for (iw = 0; iw < next; iw++) { // row for (iw = 0; iw < next; iw++) { // row
*scr++ = ((*bmData & (1 << (31 - iw))) && show) ? *scr++ = ((*bmData & (1 << (31 - iw))) && show) ?

View file

@ -26,7 +26,7 @@
bool OSystem_PALMOS::showMouse(bool visible) { bool OSystem_PALMOS::showMouse(bool visible) {
if (_mouseVisible == visible) if (_mouseVisible == visible)
return visible; return visible;
bool last = _mouseVisible; bool last = _mouseVisible;
_mouseVisible = visible; _mouseVisible = visible;
@ -133,7 +133,7 @@ void OSystem_PALMOS::draw_mouse() {
} else { } else {
int offset = y * _screenWidth + x; int offset = y * _screenWidth + x;
dst = _tmpScreenP; dst = _tmpScreenP;
while (h > 0) { while (h > 0) {
width = w; width = w;
while (width > 0) { while (width > 0) {

View file

@ -35,7 +35,7 @@ void OSystem_PALMOS::showOverlay() {
DmWrite(dst, offset, src, _screenWidth); DmWrite(dst, offset, src, _screenWidth);
offset += _screenWidth; offset += _screenWidth;
src += _offScreenPitch; src += _offScreenPitch;
} while (--h); } while (--h);
_overlayVisible = true; _overlayVisible = true;
clearOverlay(); clearOverlay();
@ -109,9 +109,9 @@ void OSystem_PALMOS::copyRectToOverlay(const byte *buf, int pitch, int x, int y,
/* RectangleType mouse = {_mouseCurState.x, _mouseCurState.y, _mouseCurState.w, _mouseCurState.h}; /* RectangleType mouse = {_mouseCurState.x, _mouseCurState.y, _mouseCurState.w, _mouseCurState.h};
RectangleType copy = {x, y, w, h}; RectangleType copy = {x, y, w, h};
RectangleType result; RectangleType result;
RctGetIntersection(&mouse, &copy, &result); RctGetIntersection(&mouse, &copy, &result);
if (result.extent.x !=0 && result.extent.y !=0)*/ if (result.extent.x !=0 && result.extent.y !=0)*/
undraw_mouse(); undraw_mouse();
} }

View file

@ -84,10 +84,10 @@ void OSystem_PALMOS::updateScreen_wideZodiac() {
// clear bottom // clear bottom
RctSetRectangle(&r, 0, _screenOffset.y + h, 480, _current_shake_pos); RctSetRectangle(&r, 0, _screenOffset.y + h, 480, _current_shake_pos);
WinFillRectangle(&r, 0); WinFillRectangle(&r, 0);
destRect.y += _new_shake_pos; destRect.y += _new_shake_pos;
_screenOffset.y += _new_shake_pos; _screenOffset.y += _new_shake_pos;
rumblePack(_new_shake_pos >= 3); rumblePack(_new_shake_pos >= 3);
_current_shake_pos = _new_shake_pos; _current_shake_pos = _new_shake_pos;
} }
@ -95,7 +95,7 @@ void OSystem_PALMOS::updateScreen_wideZodiac() {
// update screen // update screen
WinSetDrawWindow(WinGetDisplayWindow()); WinSetDrawWindow(WinGetDisplayWindow());
e = TwGfxDrawPalmBitmap((TwGfxSurfaceType *)_twSrc, &destPoint, (BitmapPtr)_twBmpV3); e = TwGfxDrawPalmBitmap((TwGfxSurfaceType *)_twSrc, &destPoint, (BitmapPtr)_twBmpV3);
e = TwGfxStretchBlt2((TwGfxSurfaceType *)_twDst, &destRect, (TwGfxSurfaceType *)_twSrc, &srcRect, twGfxStretchFast| (gVars->filter ? twGfxStretchSmooth : 0)); e = TwGfxStretchBlt2((TwGfxSurfaceType *)_twDst, &destRect, (TwGfxSurfaceType *)_twSrc, &srcRect, twGfxStretchFast| (gVars->filter ? twGfxStretchSmooth : 0));
} }
#endif #endif
@ -114,13 +114,13 @@ void OSystem_PALMOS::updateScreen_widePortrait() {
// clear bottom // clear bottom
RctSetRectangle(&r, _screenOffset.y + 300, 0, _current_shake_pos, 480); RctSetRectangle(&r, _screenOffset.y + 300, 0, _current_shake_pos, 480);
WinFillRectangle(&r, 0); WinFillRectangle(&r, 0);
dst += _new_shake_pos; dst += _new_shake_pos;
rumblePack(_new_shake_pos >= 3); rumblePack(_new_shake_pos >= 3);
_current_shake_pos = _new_shake_pos; _current_shake_pos = _new_shake_pos;
} }
// update screen // update screen
ARM_START(WideType) ARM_START(WideType)
ARM_INIT(COMMON_WPORTRAIT) ARM_INIT(COMMON_WPORTRAIT)
@ -177,13 +177,13 @@ void OSystem_PALMOS::updateScreen_wideLandscape() {
// clear bottom // clear bottom
RctSetRectangle(&r, 0, _screenOffset.y + 300, 480, _current_shake_pos); RctSetRectangle(&r, 0, _screenOffset.y + 300, 480, _current_shake_pos);
WinFillRectangle(&r, 0); WinFillRectangle(&r, 0);
dst += _new_shake_pos * 480; dst += _new_shake_pos * 480;
rumblePack(_new_shake_pos >= 3); rumblePack(_new_shake_pos >= 3);
_current_shake_pos = _new_shake_pos; _current_shake_pos = _new_shake_pos;
} }
// update screen // update screen
ARM_START(WideType) ARM_START(WideType)
ARM_INIT(COMMON_WLANDSCAPE) ARM_INIT(COMMON_WLANDSCAPE)

View file

@ -32,7 +32,7 @@ class PalmSaveFile : public Common::SaveFile {
public: public:
PalmSaveFile(const char *filename, bool saveOrLoad); PalmSaveFile(const char *filename, bool saveOrLoad);
~PalmSaveFile(); ~PalmSaveFile();
bool isOpen() const { return file != NULL; } bool isOpen() const { return file != NULL; }
uint32 read(void *buf, uint32 size); uint32 read(void *buf, uint32 size);
@ -56,15 +56,15 @@ PalmSaveFile::PalmSaveFile(const char *filename, bool saveOrLoad) {
if (file) { if (file) {
if (saveOrLoad) { if (saveOrLoad) {
_readWriteData = (byte *)malloc(MAX_BLOCK); _readWriteData = (byte *)malloc(MAX_BLOCK);
} else { } else {
// read : cache the whole file // read : cache the whole file
::fseek(file, 0, SEEK_END); ::fseek(file, 0, SEEK_END);
length = ::ftell(file); length = ::ftell(file);
::fseek(file, 0, SEEK_SET); ::fseek(file, 0, SEEK_SET);
_readWriteData = (byte *)malloc(length); _readWriteData = (byte *)malloc(length);
_readWritePos = 0; _readWritePos = 0;
if (_readWriteData) if (_readWriteData)
::fread(_readWriteData, 1, length, file); ::fread(_readWriteData, 1, length, file);
@ -76,7 +76,7 @@ PalmSaveFile::~PalmSaveFile() {
if (file) { if (file) {
if (_needDump) if (_needDump)
::fwrite(_readWriteData, _readWritePos, 1, file); ::fwrite(_readWriteData, _readWritePos, 1, file);
if (_readWriteData) if (_readWriteData)
free(_readWriteData); free(_readWriteData);

View file

@ -51,18 +51,18 @@ bool OSystem_PALMOS::setSoundCallback(SoundProc proc, void *param) {
_sound.active = true; // always true when we call this function _sound.active = true; // always true when we call this function
_sound.dataP = NULL; // required by sound_handler _sound.dataP = NULL; // required by sound_handler
_sound.handle = NULL; _sound.handle = NULL;
if (ConfMan.hasKey("output_rate")) if (ConfMan.hasKey("output_rate"))
_samplesPerSec = ConfMan.getInt("output_rate"); _samplesPerSec = ConfMan.getInt("output_rate");
else else
_samplesPerSec = 8000; // default value _samplesPerSec = 8000; // default value
// try to create sound stream // try to create sound stream
if (OPTIONS_TST(kOptPalmSoundAPI)) { if (OPTIONS_TST(kOptPalmSoundAPI)) {
void *sndFuncP; void *sndFuncP;
_sound.handle = MemPtrNew(sizeof(SndStreamRef)); _sound.handle = MemPtrNew(sizeof(SndStreamRef));
sndFuncP = sndCallback; sndFuncP = sndCallback;
Err e = SndStreamCreateExtended( Err e = SndStreamCreateExtended(
(SndStreamRef *)_sound.handle, (SndStreamRef *)_sound.handle,
@ -83,14 +83,14 @@ bool OSystem_PALMOS::setSoundCallback(SoundProc proc, void *param) {
_sound.set = false; _sound.set = false;
_sound.wait = true; _sound.wait = true;
success = (e == errNone); success = (e == errNone);
} else if (OPTIONS_TST(kOptSonyPa1LibAPI)) { } else if (OPTIONS_TST(kOptSonyPa1LibAPI)) {
static CallbackInfoType cbData; static CallbackInfoType cbData;
_sound.handle = MemPtrNew(sizeof(UInt8)); _sound.handle = MemPtrNew(sizeof(UInt8));
cbData.funcP = &ClieSoundCallback; cbData.funcP = &ClieSoundCallback;
cbData.dwUserData = (UInt32)&_sound; cbData.dwUserData = (UInt32)&_sound;
_sound.size = SND_BLOCK; _sound.size = SND_BLOCK;
_sound.set = false; _sound.set = false;
_sound.wait = true; _sound.wait = true;
@ -101,7 +101,7 @@ bool OSystem_PALMOS::setSoundCallback(SoundProc proc, void *param) {
Pa1Lib_adpcmOpen(ADPCM_8_KHZ, (UInt8 *)_sound.tmpP, MemPtrSize(_sound.tmpP), &cbData, (UInt8 *)_sound.handle); Pa1Lib_adpcmOpen(ADPCM_8_KHZ, (UInt8 *)_sound.tmpP, MemPtrSize(_sound.tmpP), &cbData, (UInt8 *)_sound.handle);
} }
// failed or not supported // failed or not supported
if (!success) { if (!success) {
_sound.size = SND_BLOCK; _sound.size = SND_BLOCK;
_sound.set = false; _sound.set = false;
@ -125,7 +125,7 @@ void OSystem_PALMOS::clearSoundCallback() {
free(_sound.tmpP); free(_sound.tmpP);
free(_sound.handle); free(_sound.handle);
} }
_sound.active = false; _sound.active = false;
_sound.dataP = NULL; _sound.dataP = NULL;
@ -139,9 +139,9 @@ void OSystem_PALMOS::sound_handler() {
if (!_sound.dataP) if (!_sound.dataP)
_sound.dataP = MemPtrNew(_sound.size); _sound.dataP = MemPtrNew(_sound.size);
((SoundProc)_sound.proc)(_sound.param, (byte *)_sound.dataP, _sound.size); ((SoundProc)_sound.proc)(_sound.param, (byte *)_sound.dataP, _sound.size);
if (OPTIONS_TST(kOptSonyPa1LibAPI)) { if (OPTIONS_TST(kOptSonyPa1LibAPI)) {
pcm2adpcm((Int16 *)_sound.dataP, (UInt8 *)_sound.tmpP, _sound.size); pcm2adpcm((Int16 *)_sound.dataP, (UInt8 *)_sound.tmpP, _sound.size);
_sound.set = Pa1Lib_adpcmStart(*((UInt8 *)_sound.handle), ADPCM_MODE_NONCONTINUOUS_PB|ADPCM_MODE_INTERRUPT_MODE); _sound.set = Pa1Lib_adpcmStart(*((UInt8 *)_sound.handle), ADPCM_MODE_NONCONTINUOUS_PB|ADPCM_MODE_INTERRUPT_MODE);
@ -174,7 +174,7 @@ void OSystem_PALMOS::playCD(int track, int num_loops, int start_frame, int durat
bool OSystem_PALMOS::pollCD() { bool OSystem_PALMOS::pollCD() {
if (!_cdPlayer) if (!_cdPlayer)
return false; return false;
return _cdPlayer->poll(); return _cdPlayer->poll();
} }

View file

@ -20,7 +20,7 @@ Boolean RumbleExists() {
exists = true; exists = true;
TwDeviceClose(hRumble); TwDeviceClose(hRumble);
} }
} else } else
#endif #endif
{ {
@ -49,7 +49,7 @@ void RumbleRun(Boolean active) {
} else { } else {
TwDeviceControl(hRumble, 'stop', 0, 0); TwDeviceControl(hRumble, 'stop', 0, 0);
} }
} else } else
#endif #endif
{ {
@ -81,7 +81,7 @@ Boolean RumbleInit() {
HwrVibrateAttributes(1, kHwrVibratePattern, &pattern); HwrVibrateAttributes(1, kHwrVibratePattern, &pattern);
HwrVibrateAttributes(1, kHwrVibrateDelay, &delay); HwrVibrateAttributes(1, kHwrVibrateDelay, &delay);
HwrVibrateAttributes(1, kHwrVibrateRepeatCount, &repeat); HwrVibrateAttributes(1, kHwrVibrateRepeatCount, &repeat);
done = true; done = true;
} }
} }
@ -93,7 +93,7 @@ void RumbleRelease() {
#ifndef DISABLE_TAPWAVE #ifndef DISABLE_TAPWAVE
if (OPTIONS_TST(kOptDeviceZodiac)) { if (OPTIONS_TST(kOptDeviceZodiac)) {
TwDeviceClose(hRumble); TwDeviceClose(hRumble);
} else } else
#endif #endif
{ {

View file

@ -105,7 +105,7 @@ static DmOpenRef GlbOpenInternal(const Char *nameP) {
if (dbID) { if (dbID) {
UInt32 dbType, dbCreator; UInt32 dbType, dbCreator;
Err e = DmDatabaseInfo(0, dbID, 0, 0, 0, 0, 0, 0, 0, 0, 0, &dbType, &dbCreator); Err e = DmDatabaseInfo(0, dbID, 0, 0, 0, 0, 0, 0, 0, 0, 0, &dbType, &dbCreator);
if (!e && dbType == 'GLBS' && dbCreator == appFileCreator) if (!e && dbType == 'GLBS' && dbCreator == appFileCreator)
return DmOpenDatabase(0, dbID, dmModeReadOnly); return DmOpenDatabase(0, dbID, dmModeReadOnly);
} }

View file

@ -37,7 +37,7 @@ MemPtr SknScreenLock(WinLockInitType initMode) {
if (!OPTIONS_TST(kOptDeviceZodiac)) { if (!OPTIONS_TST(kOptDeviceZodiac)) {
WinSetDrawWindow(WinGetDisplayWindow()); WinSetDrawWindow(WinGetDisplayWindow());
// WARNING : this doesn't work on < OS5 with 16bit mode // WARNING : this doesn't work on < OS5 with 16bit mode
return WinScreenLock(initMode); return WinScreenLock(initMode);
} }
Err e; Err e;
@ -81,13 +81,13 @@ static void SknGetListColors(DmOpenRef skinDBP, UInt8 *text, UInt8 *selected, UI
if (skinDBP) { if (skinDBP) {
colIndex = DmFindResource (skinDBP, sknColorsRsc, skinColors, NULL); colIndex = DmFindResource (skinDBP, sknColorsRsc, skinColors, NULL);
if (colIndex != (UInt16)-1) { if (colIndex != (UInt16)-1) {
colH = DmGetResourceIndex(skinDBP, colIndex); colH = DmGetResourceIndex(skinDBP, colIndex);
if (colH) { if (colH) {
colTemp = (UInt8 *)MemHandleLock(colH); colTemp = (UInt8 *)MemHandleLock(colH);
*text = colTemp[0]; *text = colTemp[0];
*selected = colTemp[1]; *selected = colTemp[1];
*background = colTemp[2]; *background = colTemp[2];
@ -113,7 +113,7 @@ static void SknCopyBits(DmOpenRef skinDBP, DmResID bitmapID, const RectangleType
if (index != (UInt16)-1) { if (index != (UInt16)-1) {
hTemp = DmGetResourceIndex(skinDBP,index); hTemp = DmGetResourceIndex(skinDBP,index);
if (hTemp) { if (hTemp) {
bmpTemp = (BitmapType *)MemHandleLock(hTemp); bmpTemp = (BitmapType *)MemHandleLock(hTemp);
BmpGlueGetDimensions(bmpTemp, &bw, &bh, 0); BmpGlueGetDimensions(bmpTemp, &bw, &bh, 0);
@ -129,7 +129,7 @@ static void SknCopyBits(DmOpenRef skinDBP, DmResID bitmapID, const RectangleType
cw = srcRect->extent.x; cw = srcRect->extent.x;
ch = srcRect->extent.y; ch = srcRect->extent.y;
} }
if (ch) { if (ch) {
WinGetClip(&old); WinGetClip(&old);
if (gVars->HRrefNum != sysInvalidRefNum) { if (gVars->HRrefNum != sysInvalidRefNum) {
@ -143,14 +143,14 @@ static void SknCopyBits(DmOpenRef skinDBP, DmResID bitmapID, const RectangleType
} else { } else {
Err e; Err e;
BitmapTypeV3 *bmp2P; BitmapTypeV3 *bmp2P;
// create an uncompressed version of the bitmap // create an uncompressed version of the bitmap
WinHandle win = WinCreateOffscreenWindow(bw, bh, screenFormat, &e); WinHandle win = WinCreateOffscreenWindow(bw, bh, screenFormat, &e);
WinHandle old = WinGetDrawWindow(); WinHandle old = WinGetDrawWindow();
WinSetDrawWindow(win); WinSetDrawWindow(win);
WinDrawBitmap(bmpTemp, 0, 0); WinDrawBitmap(bmpTemp, 0, 0);
WinSetDrawWindow(old); WinSetDrawWindow(old);
bmp2P = BmpCreateBitmapV3(WinGetBitmap(win), kDensityDouble, BmpGetBits(WinGetBitmap(win)), NULL); bmp2P = BmpCreateBitmapV3(WinGetBitmap(win), kDensityDouble, BmpGetBits(WinGetBitmap(win)), NULL);
copy.topLeft.x = destX / 2; copy.topLeft.x = destX / 2;
@ -183,7 +183,7 @@ void SknApplySkin() {
SknScreenLock(winLockCopy); SknScreenLock(winLockCopy);
skinDBP = SknOpenSkin(); skinDBP = SknOpenSkin();
if (gPrefs->card.volRefNum != sysInvalidRefNum) if (gPrefs->card.volRefNum != sysInvalidRefNum)
FrmShowObject(frmP, FrmGetObjectIndex (frmP, MainMSBitMap)); FrmShowObject(frmP, FrmGetObjectIndex (frmP, MainMSBitMap));
else else
@ -198,7 +198,7 @@ void SknApplySkin() {
SknCopyBits(skinDBP, skinBackgroundImageTop, 0, r.topLeft.x, r.topLeft.y); SknCopyBits(skinDBP, skinBackgroundImageTop, 0, r.topLeft.x, r.topLeft.y);
SknGetObjectBounds(skinDBP, skinBackgroundImageBottom, &r); SknGetObjectBounds(skinDBP, skinBackgroundImageBottom, &r);
SknCopyBits(skinDBP, skinBackgroundImageBottom, 0, r.topLeft.x, r.topLeft.y); SknCopyBits(skinDBP, skinBackgroundImageBottom, 0, r.topLeft.x, r.topLeft.y);
for (UInt16 resID = 1100; resID <= 7000; resID += 100) { for (UInt16 resID = 1100; resID <= 7000; resID += 100) {
SknSetState(skinDBP, resID, sknStateNormal); SknSetState(skinDBP, resID, sknStateNormal);
SknShowObject(skinDBP, resID); SknShowObject(skinDBP, resID);
@ -217,30 +217,30 @@ void SknGetObjectBounds(DmOpenRef skinDBP, DmResID resID, RectangleType *rP) {
UInt8 *strTemp; UInt8 *strTemp;
RctSetRectangle(rP, 0, 0, 0, 0); RctSetRectangle(rP, 0, 0, 0, 0);
if (skinDBP) { if (skinDBP) {
bmpIndex = DmFindResource (skinDBP, bitmapRsc, resID, NULL); bmpIndex = DmFindResource (skinDBP, bitmapRsc, resID, NULL);
if (bmpIndex != (UInt16)-1) { // if bmp exists if (bmpIndex != (UInt16)-1) { // if bmp exists
strIndex = DmFindResource (skinDBP, sknPosRsc, resID, NULL); strIndex = DmFindResource (skinDBP, sknPosRsc, resID, NULL);
if (strIndex != (UInt16)-1) { // if params exist if (strIndex != (UInt16)-1) { // if params exist
hBmp = DmGetResourceIndex(skinDBP,bmpIndex); hBmp = DmGetResourceIndex(skinDBP,bmpIndex);
if (hBmp) { if (hBmp) {
hStr = DmGetResourceIndex(skinDBP,strIndex); hStr = DmGetResourceIndex(skinDBP,strIndex);
if (hStr) { if (hStr) {
// buttons : state|x|y|w/h slider|draw mode|x1/y1 keep|x2/y2 keep slider // buttons : state|x|y|w/h slider|draw mode|x1/y1 keep|x2/y2 keep slider
// list (160mode) : state|x|y|w|h| // list (160mode) : state|x|y|w|h|
bmpTemp = (BitmapType *)MemHandleLock(hBmp); bmpTemp = (BitmapType *)MemHandleLock(hBmp);
strTemp = (UInt8 *)MemHandleLock(hStr); strTemp = (UInt8 *)MemHandleLock(hStr);
BmpGlueGetDimensions(bmpTemp, &(rP->extent.x), &(rP->extent.y), 0); BmpGlueGetDimensions(bmpTemp, &(rP->extent.x), &(rP->extent.y), 0);
rP->topLeft.x = strTemp[sknInfoPosX] * 2; rP->topLeft.x = strTemp[sknInfoPosX] * 2;
rP->topLeft.y = strTemp[sknInfoPosY] * 2; rP->topLeft.y = strTemp[sknInfoPosY] * 2;
MemPtrUnlock(strTemp); MemPtrUnlock(strTemp);
DmReleaseResource(hStr); DmReleaseResource(hStr);
} }
@ -270,20 +270,20 @@ UInt8 SknSetState(DmOpenRef skinDBP, DmResID resID, UInt8 newState) {
if (skinDBP) { if (skinDBP) {
index = DmFindResource (skinDBP, sknPosRsc, resID, NULL); index = DmFindResource (skinDBP, sknPosRsc, resID, NULL);
if (index != (UInt16)-1) { if (index != (UInt16)-1) {
hStr = DmGetResourceIndex(skinDBP, index); hStr = DmGetResourceIndex(skinDBP, index);
if (hStr) { if (hStr) {
strTemp = (UInt8 *)MemHandleLock(hStr); strTemp = (UInt8 *)MemHandleLock(hStr);
oldState = strTemp[sknInfoState]; oldState = strTemp[sknInfoState];
if (oldState != newState) { if (oldState != newState) {
DmWrite(strTemp, 0, &newState, 1); DmWrite(strTemp, 0, &newState, 1);
} }
MemPtrUnlock(strTemp); MemPtrUnlock(strTemp);
DmReleaseResource(hStr); DmReleaseResource(hStr);
} }
} }
} }
@ -299,19 +299,19 @@ UInt8 SknGetDepth(DmOpenRef skinDBP) {
if (skinDBP) { if (skinDBP) {
index = DmFindResource (skinDBP, sknDepthRsc, skinDepth, NULL); index = DmFindResource (skinDBP, sknDepthRsc, skinDepth, NULL);
if (index != (UInt16)-1) { if (index != (UInt16)-1) {
hStr = DmGetResourceIndex(skinDBP, index); hStr = DmGetResourceIndex(skinDBP, index);
if (hStr) { if (hStr) {
strTemp = (UInt8 *)MemHandleLock(hStr); strTemp = (UInt8 *)MemHandleLock(hStr);
depth = *strTemp; depth = *strTemp;
MemPtrUnlock(strTemp); MemPtrUnlock(strTemp);
DmReleaseResource(hStr); DmReleaseResource(hStr);
} }
} }
} }
return depth; return depth;
} }
@ -324,15 +324,15 @@ UInt8 SknGetState(DmOpenRef skinDBP, DmResID resID) {
if (skinDBP) { if (skinDBP) {
index = DmFindResource (skinDBP, sknPosRsc, resID, NULL); index = DmFindResource (skinDBP, sknPosRsc, resID, NULL);
if (index != (UInt16)-1) { if (index != (UInt16)-1) {
hStr = DmGetResourceIndex(skinDBP, index); hStr = DmGetResourceIndex(skinDBP, index);
if (hStr) { if (hStr) {
strTemp = (UInt8 *)MemHandleLock(hStr); strTemp = (UInt8 *)MemHandleLock(hStr);
oldState = strTemp[sknInfoState]; oldState = strTemp[sknInfoState];
MemPtrUnlock(strTemp); MemPtrUnlock(strTemp);
DmReleaseResource(hStr); DmReleaseResource(hStr);
} }
} }
} }
@ -358,7 +358,7 @@ void SknGetListBounds(RectangleType *rAreaP, RectangleType *rArea2xP) {
skinDBP = DmOpenDatabase(gPrefs->skin.cardNo, gPrefs->skin.dbID, dmModeReadOnly); skinDBP = DmOpenDatabase(gPrefs->skin.cardNo, gPrefs->skin.dbID, dmModeReadOnly);
if (skinDBP) { if (skinDBP) {
strIndex = DmFindResource (skinDBP, sknPosRsc, skinList, NULL); strIndex = DmFindResource (skinDBP, sknPosRsc, skinList, NULL);
if (strIndex != 0xFFFF) { // if params exist if (strIndex != 0xFFFF) { // if params exist
hStr = DmGetResourceIndex(skinDBP,strIndex); hStr = DmGetResourceIndex(skinDBP,strIndex);
if (hStr) { if (hStr) {
@ -368,7 +368,7 @@ void SknGetListBounds(RectangleType *rAreaP, RectangleType *rArea2xP) {
y = strTemp[sknInfoPosY]; y = strTemp[sknInfoPosY];
w = strTemp[sknInfoListWidth]; w = strTemp[sknInfoListWidth];
h = strTemp[sknInfoListSize] * sknInfoListItemSize; h = strTemp[sknInfoListSize] * sknInfoListItemSize;
if (rAreaP) if (rAreaP)
RctSetRectangle(rAreaP ,x, y, w, h); RctSetRectangle(rAreaP ,x, y, w, h);
if (rArea2xP) if (rArea2xP)
@ -376,7 +376,7 @@ void SknGetListBounds(RectangleType *rAreaP, RectangleType *rArea2xP) {
MemHandleUnlock(hStr); MemHandleUnlock(hStr);
DmReleaseResource(hStr); DmReleaseResource(hStr);
} }
} }
@ -447,7 +447,7 @@ void SknUpdateList() {
UInt8 txtColor, norColor, selColor, bkgColor; UInt8 txtColor, norColor, selColor, bkgColor;
UInt16 x,y; UInt16 x,y;
SknScreenLock(winLockCopy); SknScreenLock(winLockCopy);
SknGetListBounds(&rArea, &rArea2x); SknGetListBounds(&rArea, &rArea2x);
@ -461,7 +461,7 @@ void SknUpdateList() {
x = rCopy.topLeft.x; x = rCopy.topLeft.x;
y = rCopy.topLeft.y; y = rCopy.topLeft.y;
rCopy.topLeft.x -= rField.topLeft.x; rCopy.topLeft.x -= rField.topLeft.x;
rCopy.topLeft.y -= rField.topLeft.y; rCopy.topLeft.y -= rField.topLeft.y;
SknCopyBits(skinDBP, skinBackgroundImageTop, &rCopy, x, y); SknCopyBits(skinDBP, skinBackgroundImageTop, &rCopy, x, y);
// copy bottom bg // copy bottom bg
SknGetObjectBounds(skinDBP, skinBackgroundImageBottom, &rField); SknGetObjectBounds(skinDBP, skinBackgroundImageBottom, &rField);
@ -469,7 +469,7 @@ void SknUpdateList() {
x = rCopy.topLeft.x; x = rCopy.topLeft.x;
y = rCopy.topLeft.y; y = rCopy.topLeft.y;
rCopy.topLeft.x -= rField.topLeft.x; rCopy.topLeft.x -= rField.topLeft.x;
rCopy.topLeft.y -= rField.topLeft.y; rCopy.topLeft.y -= rField.topLeft.y;
SknCopyBits(skinDBP, skinBackgroundImageBottom, &rCopy, x, y); SknCopyBits(skinDBP, skinBackgroundImageBottom, &rCopy, x, y);
FntSetFont(stdFont); FntSetFont(stdFont);
@ -549,9 +549,9 @@ UInt16 SknCheckClick(DmOpenRef skinDBP, Coord mx, Coord my) {
} }
} }
} }
} }
return 0; return 0;
} }
@ -572,7 +572,7 @@ void SknSelect(Coord x, Coord y) {
if (index < DmNumRecords(gameDB)) { if (index < DmNumRecords(gameDB)) {
Boolean newValue; Boolean newValue;
oldIndex = GamGetSelected(); oldIndex = GamGetSelected();
if (oldIndex != index && oldIndex != dmMaxRecordIndex) if (oldIndex != index && oldIndex != dmMaxRecordIndex)
@ -586,7 +586,7 @@ void SknSelect(Coord x, Coord y) {
MemHandleUnlock(record); MemHandleUnlock(record);
DmReleaseRecord (gameDB, index, 0); DmReleaseRecord (gameDB, index, 0);
lastIndex = index; lastIndex = index;
SknUpdateList(); SknUpdateList();
} }

View file

@ -22,7 +22,7 @@
#ifndef __SKIN_H__ #ifndef __SKIN_H__
#define __SKIN_H__ #define __SKIN_H__
// skin // skin
#define sknInfoState 0 #define sknInfoState 0
#define sknInfoPosX 1 #define sknInfoPosX 1
#define sknInfoPosY 2 #define sknInfoPosY 2

View file

@ -30,11 +30,11 @@ void pcm2adpcm(Int16 *src, UInt8 *dst, UInt32 length) {
if (OPTIONS_TST(kOptDeviceARM)) { if (OPTIONS_TST(kOptDeviceARM)) {
PnoDescriptor pno; PnoDescriptor pno;
ARMPa1SndType userData = {src, dst, length}; ARMPa1SndType userData = {src, dst, length};
MemPtr armP = _PnoInit(ARM_PA1SND, &pno); MemPtr armP = _PnoInit(ARM_PA1SND, &pno);
_PnoCall(&pno, &userData); _PnoCall(&pno, &userData);
_PnoFree(&pno, armP); _PnoFree(&pno, armP);
return; return;
} }
*/ */
@ -49,7 +49,7 @@ void pcm2adpcm(Int16 *src, UInt8 *dst, UInt32 length) {
signal = 0; signal = 0;
step = 0x7F; step = 0x7F;
length >>= 3; // 16bit stereo -> 4bit mono length >>= 3; // 16bit stereo -> 4bit mono
do { do {
// high nibble // high nibble
@ -58,14 +58,14 @@ void pcm2adpcm(Int16 *src, UInt8 *dst, UInt32 length) {
src++; src++;
chan2 = ByteSwap16(*src); chan2 = ByteSwap16(*src);
src++; src++;
diff = ((chan1 + chan2) >> 1) - signal; diff = ((chan1 + chan2) >> 1) - signal;
#else #else
diff = ((*src++ + *src++) >> 1) - signal; diff = ((*src++ + *src++) >> 1) - signal;
#endif #endif
diff <<= 3; diff <<= 3;
diff /= step; diff /= step;
val = abs(diff) >> 1; val = abs(diff) >> 1;
if (val > 7) val = 7; if (val > 7) val = 7;
@ -85,7 +85,7 @@ void pcm2adpcm(Int16 *src, UInt8 *dst, UInt32 length) {
src++; src++;
chan2 = ByteSwap16(*src); chan2 = ByteSwap16(*src);
src++; src++;
diff = ((chan1 + chan2) >> 1) - signal; diff = ((chan1 + chan2) >> 1) - signal;
#else #else
diff = ((*src++ + *src++) >> 1) - signal; diff = ((*src++ + *src++) >> 1) - signal;

View file

@ -16,7 +16,7 @@ Err sndCallback(void* UserDataP, SndStreamRef stream, void* bufferP, UInt32 *buf
*dst++ = READ_LE_UINT32(src++); *dst++ = READ_LE_UINT32(src++);
*dst++ = READ_LE_UINT32(src++); *dst++ = READ_LE_UINT32(src++);
} }
snd->set = false; snd->set = false;
} else { } else {
snd->size = size; snd->size = size;

View file

@ -104,9 +104,9 @@ Err SendDatabase (UInt16 cardNo, LocalID dbID, Char *nameP, Char *descriptionP)
* minimum requirement. * minimum requirement.
* *
* PARAMETERS: requiredVersion - minimum rom version required * PARAMETERS: requiredVersion - minimum rom version required
* (see sysFtrNumROMVersion in SystemMgr.h * (see sysFtrNumROMVersion in SystemMgr.h
* for format) * for format)
* launchFlags - flags that indicate if the application * launchFlags - flags that indicate if the application
* UI is initialized. * UI is initialized.
* *
* RETURNED: error code or zero if rom is compatible * RETURNED: error code or zero if rom is compatible
@ -127,8 +127,8 @@ static Err RomVersionCompatible(UInt32 requiredVersion, UInt16 launchFlags)
(sysAppLaunchFlagNewGlobals | sysAppLaunchFlagUIApp)) (sysAppLaunchFlagNewGlobals | sysAppLaunchFlagUIApp))
{ {
FrmAlert (RomIncompatibleAlert); FrmAlert (RomIncompatibleAlert);
// Palm OS 1.0 will continuously relaunch this app unless we switch to // Palm OS 1.0 will continuously relaunch this app unless we switch to
// another safe one. // another safe one.
if (romVersion <= kPalmOS10Version) if (romVersion <= kPalmOS10Version)
{ {
@ -220,7 +220,7 @@ static Boolean AppHandleEvent(EventPtr eventP)
} }
return true; return true;
} }
return false; return false;
} }
@ -228,7 +228,7 @@ static Boolean AppHandleEvent(EventPtr eventP)
* *
* FUNCTION: AppEventLoop * FUNCTION: AppEventLoop
* *
* DESCRIPTION: This routine is the event loop for the application. * DESCRIPTION: This routine is the event loop for the application.
* *
* PARAMETERS: nothing * PARAMETERS: nothing
* *
@ -263,8 +263,8 @@ static void AppEventLoop(void)
* *
* DESCRIPTION: This is the main entry point for the application. * DESCRIPTION: This is the main entry point for the application.
* *
* PARAMETERS: cmd - word value specifying the launch code. * PARAMETERS: cmd - word value specifying the launch code.
* cmdPB - pointer to a structure that is associated with the launch code. * cmdPB - pointer to a structure that is associated with the launch code.
* launchFlags - word value providing extra information about the launch. * launchFlags - word value providing extra information about the launch.
* *
* RETURNED: Result of launch * RETURNED: Result of launch
@ -295,7 +295,7 @@ static void AppLaunchCmdNotify(UInt16 LaunchFlags, SysNotifyParamType * pData)
} }
} }
break; break;
case sysNotifyVolumeUnmountedEvent: case sysNotifyVolumeUnmountedEvent:
if (gPrefs) { if (gPrefs) {
CardSlotFormUpdate(); CardSlotFormUpdate();
@ -350,9 +350,9 @@ static UInt32 ScummVMPalmMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags)
#endif #endif
break; break;
case sysAppLaunchCmdNormalLaunch: case sysAppLaunchCmdNormalLaunch:
error = AppStart(); error = AppStart();
if (error) if (error)
goto end; goto end;
if (!bDirectMode) { if (!bDirectMode) {
@ -380,8 +380,8 @@ end:
* *
* DESCRIPTION: This is the main entry point for the application. * DESCRIPTION: This is the main entry point for the application.
* *
* PARAMETERS: cmd - word value specifying the launch code. * PARAMETERS: cmd - word value specifying the launch code.
* cmdPB - pointer to a structure that is associated with the launch code. * cmdPB - pointer to a structure that is associated with the launch code.
* launchFlags - word value providing extra information about the launch. * launchFlags - word value providing extra information about the launch.
* RETURNED: Result of launch * RETURNED: Result of launch
* *

View file

@ -19,7 +19,7 @@
* $Header$ * $Header$
* *
*/ */
#ifndef __START_H__ #ifndef __START_H__
#define __START_H__ #define __START_H__
@ -33,7 +33,7 @@ typedef struct {
//skin params //skin params
SkinInfoType skin; // card where is located the skin SkinInfoType skin; // card where is located the skin
Boolean soundClick; Boolean soundClick;
// //
Boolean vibrator; Boolean vibrator;
Boolean autoOff; Boolean autoOff;
@ -56,7 +56,7 @@ typedef struct {
Boolean copyProtection; Boolean copyProtection;
Boolean arm; Boolean arm;
Boolean altIntro; Boolean altIntro;
struct { struct {
Boolean enable; Boolean enable;
UInt8 mode; UInt8 mode;

View file

@ -24,7 +24,7 @@ Err HwrVibrateAttributes(Boolean set, UInt32 setting, void *value)
SYS_TRAP(sysTrapHwrVibrateAttributes); SYS_TRAP(sysTrapHwrVibrateAttributes);
/* to determine whether the vibrator is supported on a specific device, you /* to determine whether the vibrator is supported on a specific device, you
** need to make sure that you are running on PalmOS 4.x (so that the ** need to make sure that you are running on PalmOS 4.x (so that the
** trap exists), that the attention manager exists and you need to check ** trap exists), that the attention manager exists and you need to check
** whether HwrVibrateAttributes(0, 1, &active) returns an error code of ** whether HwrVibrateAttributes(0, 1, &active) returns an error code of
** 0. ('active' is a Boolean). ** 0. ('active' is a Boolean).
@ -42,14 +42,14 @@ Err HwrVibrateAttributes(Boolean set, UInt32 setting, void *value)
** value is in ticks (1/100 seconds) */ ** value is in ticks (1/100 seconds) */
#define kHwrVibrateRate 2 #define kHwrVibrateRate 2
/* *value points to a UInt32, specifying the pattern of vibrating /* *value points to a UInt32, specifying the pattern of vibrating
** **
** example: ** example:
** 0xFFFFFFFF stay on, no vibrating ** 0xFFFFFFFF stay on, no vibrating
** 0x0F0F0F0F vibrate four times in equal intervals ** 0x0F0F0F0F vibrate four times in equal intervals
** 0xAAAAAAAA vibrate really fast (not recommended) ** 0xAAAAAAAA vibrate really fast (not recommended)
** 0x0F0F0000 vibrate twice, then pause ** 0x0F0F0000 vibrate twice, then pause
*/ */
#define kHwrVibratePattern 3 #define kHwrVibratePattern 3
/* *value points to a UInt16, specifying the delay between two /* *value points to a UInt16, specifying the delay between two

View file

@ -87,28 +87,28 @@ class OSystem_Dreamcast : public OSystem {
// Set the bitmap that's used when drawing the cursor. // Set the bitmap that's used when drawing the cursor.
void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, byte keycolor, int cursorTargetScale); void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, byte keycolor, int cursorTargetScale);
// Shaking is used in SCUMM. Set current shake position. // Shaking is used in SCUMM. Set current shake position.
void setShakePos(int shake_pos); void setShakePos(int shake_pos);
// Get the number of milliseconds since the program was started. // Get the number of milliseconds since the program was started.
uint32 getMillis(); uint32 getMillis();
// Delay for a specified amount of milliseconds // Delay for a specified amount of milliseconds
void delayMillis(uint msecs); void delayMillis(uint msecs);
// Get the next event. // Get the next event.
// Returns true if an event was retrieved. // Returns true if an event was retrieved.
bool pollEvent(Event &event); bool pollEvent(Event &event);
// Set function that generates samples // Set function that generates samples
bool setSoundCallback(SoundProc proc, void *param); bool setSoundCallback(SoundProc proc, void *param);
void clearSoundCallback(); void clearSoundCallback();
// Determine the output sample rate. Audio data provided by the sound // Determine the output sample rate. Audio data provided by the sound
// callback will be played using this rate. // callback will be played using this rate.
int getOutputSampleRate() const; int getOutputSampleRate() const;
// Initialise the specified CD drive for audio playback. // Initialise the specified CD drive for audio playback.
bool openCD(int drive); bool openCD(int drive);
@ -118,7 +118,7 @@ class OSystem_Dreamcast : public OSystem {
// Play cdrom audio track // Play cdrom audio track
void playCD(int track, int num_loops, int start_frame, int duration); void playCD(int track, int num_loops, int start_frame, int duration);
// Stop cdrom audio track // Stop cdrom audio track
void stopCD(); void stopCD();

View file

@ -181,7 +181,7 @@ bool DLObject::relocate(int fd, unsigned long offset, unsigned long size)
} }
free(rela); free(rela);
return true; return true;
} }
@ -233,7 +233,7 @@ bool DLObject::load(int fd)
read(fd, segment, phdr.p_filesz) != phdr.p_filesz) { read(fd, segment, phdr.p_filesz) != phdr.p_filesz) {
seterror("Segment load failed."); seterror("Segment load failed.");
return false; return false;
} }
DBG("shoff = %d, shentsz = %d, shnum = %d\n", DBG("shoff = %d, shentsz = %d, shnum = %d\n",
ehdr.e_shoff, ehdr.e_shentsize, ehdr.e_shnum); ehdr.e_shoff, ehdr.e_shentsize, ehdr.e_shnum);
@ -309,7 +309,7 @@ bool DLObject::load(int fd)
free(shdr); free(shdr);
return false; return false;
} }
free(shdr); free(shdr);
return true; return true;
@ -351,7 +351,7 @@ bool DLObject::open(const char *path)
seterror("Missing ctors/dtors."); seterror("Missing ctors/dtors.");
dtors_start = dtors_end = NULL; dtors_start = dtors_end = NULL;
unload(); unload();
return false; return false;
} }
DBG("Calling constructors.\n"); DBG("Calling constructors.\n");
@ -390,7 +390,7 @@ void *DLObject::symbol(const char *name)
} }
seterror("Symbol \"%s\" not found.", name); seterror("Symbol \"%s\" not found.", name);
return NULL; return NULL;
} }

View file

@ -136,7 +136,7 @@ OSystem::MutexRef OSystem_Dreamcast::createMutex()
void OSystem_Dreamcast::lockMutex(MutexRef mutex) void OSystem_Dreamcast::lockMutex(MutexRef mutex)
{ {
} }
void OSystem_Dreamcast::unlockMutex(MutexRef mutex) void OSystem_Dreamcast::unlockMutex(MutexRef mutex)
{ {
} }
@ -226,7 +226,7 @@ int DCLauncherDialog::runModal()
// Set the game path. // Set the game path.
if(dir != NULL) if(dir != NULL)
ConfMan.set("path", dir, Common::ConfigManager::kTransientDomain); ConfMan.set("path", dir, Common::ConfigManager::kTransientDomain);
// Set the target. // Set the target.
_detector.setTarget(base); _detector.setTarget(base);

View file

@ -106,7 +106,7 @@ static void texture_memcpy64(void *dest, void *src, int cnt)
d[4] = *s++; d[4] = *s++;
d[5] = *s++; d[5] = *s++;
d[6] = *s++; d[6] = *s++;
d[7] = *s++; d[7] = *s++;
asm("pref @%0" : : "r" (d)); asm("pref @%0" : : "r" (d));
d += 8; d += 8;
} }
@ -224,7 +224,7 @@ void OSystem_Dreamcast::copyRectToScreen(const byte *buf, int pitch, int x, int
} }
bool OSystem_Dreamcast::showMouse(bool visible) bool OSystem_Dreamcast::showMouse(bool visible)
{ {
bool last = _ms_visible; bool last = _ms_visible;
_ms_visible = visible; _ms_visible = visible;
@ -243,12 +243,12 @@ void OSystem_Dreamcast::setMouseCursor(const byte *buf, uint w, uint h,
{ {
_ms_cur_w = w; _ms_cur_w = w;
_ms_cur_h = h; _ms_cur_h = h;
_ms_hotspot_x = hotspot_x; _ms_hotspot_x = hotspot_x;
_ms_hotspot_y = hotspot_y; _ms_hotspot_y = hotspot_y;
_ms_keycolor = keycolor; _ms_keycolor = keycolor;
if (_ms_buf) if (_ms_buf)
free(_ms_buf); free(_ms_buf);
@ -276,7 +276,7 @@ void OSystem_Dreamcast::updateScreen(void)
// while((*((volatile unsigned int *)(void*)0xa05f810c) & 0x3ff) != 200); // while((*((volatile unsigned int *)(void*)0xa05f810c) & 0x3ff) != 200);
// *((volatile unsigned int *)(void*)0xa05f8040) = 0xff0000; // *((volatile unsigned int *)(void*)0xa05f8040) = 0xff0000;
for( int y = 0; y<_screen_h; y++ ) for( int y = 0; y<_screen_h; y++ )
{ {
texture_memcpy64_pal( dst, src, _screen_w>>5, palette ); texture_memcpy64_pal( dst, src, _screen_w>>5, palette );
@ -318,11 +318,11 @@ void OSystem_Dreamcast::updateScreen(void)
TA_TEXTUREMODE_STRIDE|TA_TEXTUREMODE_ADDRESS(screen_tx[_screen_buffer]); TA_TEXTUREMODE_STRIDE|TA_TEXTUREMODE_ADDRESS(screen_tx[_screen_buffer]);
mypoly.red = mypoly.green = mypoly.blue = mypoly.alpha = 0; mypoly.red = mypoly.green = mypoly.blue = mypoly.alpha = 0;
ta_begin_frame(); ta_begin_frame();
// *((volatile unsigned int *)(void*)0xa05f8040) = 0x0000ff; // *((volatile unsigned int *)(void*)0xa05f8040) = 0x0000ff;
ta_commit_list(&mypoly); ta_commit_list(&mypoly);
myvertex.cmd = TA_CMD_VERTEX; myvertex.cmd = TA_CMD_VERTEX;
myvertex.ocolour = 0; myvertex.ocolour = 0;
myvertex.colour = 0; myvertex.colour = 0;
@ -357,7 +357,7 @@ void OSystem_Dreamcast::updateScreen(void)
} else { } else {
if(_overlay_fade > 0) if(_overlay_fade > 0)
_overlay_fade -= 0.125; _overlay_fade -= 0.125;
} }
if(_overlay_fade > 0.0) { if(_overlay_fade > 0.0) {
@ -372,11 +372,11 @@ void OSystem_Dreamcast::updateScreen(void)
TA_POLYMODE2_U_SIZE_512|TA_POLYMODE2_V_SIZE_512; TA_POLYMODE2_U_SIZE_512|TA_POLYMODE2_V_SIZE_512;
mypoly.texture = TA_TEXTUREMODE_ARGB4444|TA_TEXTUREMODE_NON_TWIDDLED| mypoly.texture = TA_TEXTUREMODE_ARGB4444|TA_TEXTUREMODE_NON_TWIDDLED|
TA_TEXTUREMODE_ADDRESS(ovl_tx[_overlay_buffer]); TA_TEXTUREMODE_ADDRESS(ovl_tx[_overlay_buffer]);
mypoly.red = mypoly.green = mypoly.blue = mypoly.alpha = 0.0; mypoly.red = mypoly.green = mypoly.blue = mypoly.alpha = 0.0;
ta_commit_list(&mypoly); ta_commit_list(&mypoly);
myvertex.cmd = TA_CMD_VERTEX; myvertex.cmd = TA_CMD_VERTEX;
myvertex.ocolour = 0; myvertex.ocolour = 0;
myvertex.colour = 0xffffff|(((int)(255*_overlay_fade))<<24); myvertex.colour = 0xffffff|(((int)(255*_overlay_fade))<<24);
@ -398,7 +398,7 @@ void OSystem_Dreamcast::updateScreen(void)
myvertex.u = 0.0; myvertex.u = 0.0;
myvertex.v = OVL_H*(1.0/512.0); myvertex.v = OVL_H*(1.0/512.0);
ta_commit_list(&myvertex); ta_commit_list(&myvertex);
myvertex.x += OVL_W*_xscale; myvertex.x += OVL_W*_xscale;
myvertex.u = OVL_W*(1.0/512.0); myvertex.u = OVL_W*(1.0/512.0);
myvertex.cmd |= TA_CMD_VERTEX_EOS; myvertex.cmd |= TA_CMD_VERTEX_EOS;
@ -453,7 +453,7 @@ void OSystem_Dreamcast::drawMouse(int xdraw, int ydraw, int w, int h,
commit_dummy_transpoly(); commit_dummy_transpoly();
return; return;
} }
mypoly.cmd = mypoly.cmd =
TA_CMD_POLYGON|TA_CMD_POLYGON_TYPE_TRANSPARENT|TA_CMD_POLYGON_SUBLIST| TA_CMD_POLYGON|TA_CMD_POLYGON_TYPE_TRANSPARENT|TA_CMD_POLYGON_SUBLIST|
TA_CMD_POLYGON_STRIPLENGTH_2|TA_CMD_POLYGON_PACKED_COLOUR|TA_CMD_POLYGON_TEXTURED; TA_CMD_POLYGON_STRIPLENGTH_2|TA_CMD_POLYGON_PACKED_COLOUR|TA_CMD_POLYGON_TEXTURED;
@ -466,9 +466,9 @@ void OSystem_Dreamcast::drawMouse(int xdraw, int ydraw, int w, int h,
TA_TEXTUREMODE_ADDRESS(mouse_tx[_mouse_buffer]); TA_TEXTUREMODE_ADDRESS(mouse_tx[_mouse_buffer]);
mypoly.red = mypoly.green = mypoly.blue = mypoly.alpha = 0; mypoly.red = mypoly.green = mypoly.blue = mypoly.alpha = 0;
ta_commit_list(&mypoly); ta_commit_list(&mypoly);
myvertex.cmd = TA_CMD_VERTEX; myvertex.cmd = TA_CMD_VERTEX;
myvertex.ocolour = 0; myvertex.ocolour = 0;
myvertex.colour = 0xffff00; myvertex.colour = 0xffff00;
@ -489,7 +489,7 @@ void OSystem_Dreamcast::drawMouse(int xdraw, int ydraw, int w, int h,
myvertex.u = 0.0; myvertex.u = 0.0;
myvertex.v = h*(1.0/MOUSE_H); myvertex.v = h*(1.0/MOUSE_H);
ta_commit_list(&myvertex); ta_commit_list(&myvertex);
myvertex.x += w*_xscale; myvertex.x += w*_xscale;
myvertex.u = w*(1.0/MOUSE_W); myvertex.u = w*(1.0/MOUSE_W);
myvertex.cmd |= TA_CMD_VERTEX_EOS; myvertex.cmd |= TA_CMD_VERTEX_EOS;

View file

@ -32,7 +32,7 @@ void Icon::create_vmicon(void *buffer)
for(int n = 0; n<16; n++) { for(int n = 0; n<16; n++) {
int p = palette[n]; int p = palette[n];
pal[n] = pal[n] =
((p>>16)&0xf000)| ((p>>16)&0xf000)|
((p>>12)&0x0f00)| ((p>>12)&0x0f00)|
((p>> 8)&0x00f0)| ((p>> 8)&0x00f0)|
@ -114,7 +114,7 @@ void Icon::draw(float x1, float y1, float x2, float y2, int pal,
myvertex.x = x2; myvertex.x = x2;
myvertex.v = 0.0; myvertex.v = 0.0;
myvertex.cmd |= TA_CMD_VERTEX_EOS; myvertex.cmd |= TA_CMD_VERTEX_EOS;
ta_commit_list(&myvertex); ta_commit_list(&myvertex);
} }
int Icon::find_unused_pixel() int Icon::find_unused_pixel()

View file

@ -66,7 +66,7 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y,
if(!(buttons & 2)) rmb++; if(!(buttons & 2)) rmb++;
if(!(buttons & 8)) newkey = 319; if(!(buttons & 8)) newkey = 319;
mouse_x += pad->cond.mouse.axis1; mouse_x += pad->cond.mouse.axis1;
mouse_y += pad->cond.mouse.axis2; mouse_y += pad->cond.mouse.axis2;
mouse_wheel += pad->cond.mouse.axis3; mouse_wheel += pad->cond.mouse.axis3;

View file

@ -132,6 +132,6 @@ void Label::draw(float x, float y, unsigned int argb, float scale)
myvertex.x = x+u*scale; myvertex.x = x+u*scale;
myvertex.u = 1.0; myvertex.u = 1.0;
myvertex.cmd |= TA_CMD_VERTEX_EOS; myvertex.cmd |= TA_CMD_VERTEX_EOS;
ta_commit_list(&myvertex); ta_commit_list(&myvertex);
} }

View file

@ -79,7 +79,7 @@ void draw_solid_quad(float x1, float y1, float x2, float y2,
myvertex.colour = c3; myvertex.colour = c3;
myvertex.x = x2; myvertex.x = x2;
myvertex.cmd |= TA_CMD_VERTEX_EOS; myvertex.cmd |= TA_CMD_VERTEX_EOS;
ta_commit_list(&myvertex); ta_commit_list(&myvertex);
} }
void draw_trans_quad(float x1, float y1, float x2, float y2, void draw_trans_quad(float x1, float y1, float x2, float y2,
@ -125,7 +125,7 @@ void draw_trans_quad(float x1, float y1, float x2, float y2,
myvertex.colour = c3; myvertex.colour = c3;
myvertex.x = x2; myvertex.x = x2;
myvertex.cmd |= TA_CMD_VERTEX_EOS; myvertex.cmd |= TA_CMD_VERTEX_EOS;
ta_commit_list(&myvertex); ta_commit_list(&myvertex);
} }
@ -198,7 +198,7 @@ static bool loadIcon(Game &game, Dir *dirs, int num_dirs)
for(int i=0; i<num_dirs; i++) for(int i=0; i<num_dirs; i++)
if(!strcmp(dirs[i].name, game.dir) && if(!strcmp(dirs[i].name, game.dir) &&
dirs[i].deficon[0]) { dirs[i].deficon[0]) {
sprintf(icofn, "%s%s", game.dir, dirs[i].deficon); sprintf(icofn, "%s%s", game.dir, dirs[i].deficon);
if(game.icon.load(icofn)) if(game.icon.load(icofn))
return true; return true;
break; break;
@ -240,7 +240,7 @@ static int findGames(Game *games, int max)
dirs[num_dirs].node = *entry; dirs[num_dirs].node = *entry;
num_dirs++; num_dirs++;
} }
} else } else
if(isIcon(*entry)) if(isIcon(*entry))
strcpy(dirs[curr_dir-1].deficon, entry->displayName().c_str()); strcpy(dirs[curr_dir-1].deficon, entry->displayName().c_str());
else if(curr_game < max && else if(curr_game < max &&
@ -303,7 +303,7 @@ void waitForDisk()
ta_txrelease(mark); ta_txrelease(mark);
return; return;
} }
ta_begin_frame(); ta_begin_frame();
drawBackground(); drawBackground();
@ -347,11 +347,11 @@ int gameMenu(Game *games, int num_games)
return -1; return -1;
ta_begin_frame(); ta_begin_frame();
drawBackground(); drawBackground();
ta_commit_end(); ta_commit_end();
float y = 40.0; float y = 40.0;
for(int i=top_game, cnt=0; cnt<10 && i<num_games; i++, cnt++) { for(int i=top_game, cnt=0; cnt<10 && i<num_games; i++, cnt++) {
int pal = 48+(i&15); int pal = 48+(i&15);
@ -375,7 +375,7 @@ int gameMenu(Game *games, int num_games)
setimask(15); setimask(15);
event = handleInput(locked_get_pads(), mousex, mousey, shiftFlags); event = handleInput(locked_get_pads(), mousex, mousey, shiftFlags);
setimask(mask); setimask(mask);
if(event==-OSystem::EVENT_LBUTTONDOWN || event==13 || event==319) { if(event==-OSystem::EVENT_LBUTTONDOWN || event==13 || event==319) {
int selected_game = top_game + selector_pos; int selected_game = top_game + selector_pos;
@ -384,15 +384,15 @@ int gameMenu(Game *games, int num_games)
unsigned int fade_colour = 0x00ffffff | ((255-fade)<<24); unsigned int fade_colour = 0x00ffffff | ((255-fade)<<24);
ta_begin_frame(); ta_begin_frame();
drawBackground(); drawBackground();
ta_commit_end(); ta_commit_end();
float y = 40.0; float y = 40.0;
if(fade < 256) if(fade < 256)
for(int i=top_game, cnt=0; cnt<10 && i<num_games; for(int i=top_game, cnt=0; cnt<10 && i<num_games;
i++, cnt++, y += 40.0) i++, cnt++, y += 40.0)
if(cnt != selector_pos) if(cnt != selector_pos)
drawGameLabel(games[i], 48+(i&15), 50.0, y, 0xffffff, fade); drawGameLabel(games[i], 48+(i&15), 50.0, y, 0xffffff, fade);

View file

@ -84,7 +84,7 @@ void SoftKeyboard::draw(float x, float y, int transp)
unsigned int bg_alpha_mask = (128-transp)<<24; unsigned int bg_alpha_mask = (128-transp)<<24;
draw_trans_quad(x, y, x+312.0, y+172.0, draw_trans_quad(x, y, x+312.0, y+172.0,
bg_alpha_mask|0x8080ff, bg_alpha_mask|0x8080ff, bg_alpha_mask|0x8080ff, bg_alpha_mask|0x8080ff,
bg_alpha_mask|0x8080ff, bg_alpha_mask|0x8080ff); bg_alpha_mask|0x8080ff, bg_alpha_mask|0x8080ff);
x0 = x += 4.0; x0 = x += 4.0;
y += 4.0; y += 4.0;

View file

@ -32,7 +32,7 @@ class OSystem_Dreamcast;
class SoftKeyboard : public Interactive class SoftKeyboard : public Interactive
{ {
private: private:
const OSystem_Dreamcast *os; const OSystem_Dreamcast *os;
Label labels[2][SK_NUM_KEYS]; Label labels[2][SK_NUM_KEYS];
byte shiftState; byte shiftState;

View file

@ -40,7 +40,7 @@ enum vmsaveResult {
VMSAVE_OK, VMSAVE_OK,
VMSAVE_NOVM, VMSAVE_NOVM,
VMSAVE_NOSPACE, VMSAVE_NOSPACE,
VMSAVE_WRITEERROR, VMSAVE_WRITEERROR,
}; };
@ -143,7 +143,7 @@ static bool tryLoad(char *&buffer, int &size, const char *filename, int vm)
return false; return false;
if(!vmsfs_open_file(&super, filename, &file)) if(!vmsfs_open_file(&super, filename, &file))
return false; return false;
buffer = new char[size = file.size]; buffer = new char[size = file.size];
if(vmsfs_read_file(&file, (unsigned char *)buffer, size)) if(vmsfs_read_file(&file, (unsigned char *)buffer, size))
@ -225,7 +225,7 @@ private:
void skip(uint32 offset); void skip(uint32 offset);
public: public:
InVMSave() InVMSave()
: pos(0), buffer(NULL) : pos(0), buffer(NULL)
{ } { }
@ -264,19 +264,19 @@ private:
uint32 write(const void *buf, uint32 cnt); uint32 write(const void *buf, uint32 cnt);
public: public:
OutVMSave(const char *_filename) OutVMSave(const char *_filename)
: pos(0) : pos(0)
{ {
strncpy(filename, _filename, 16); strncpy(filename, _filename, 16);
buffer = new char[size = MAX_SAVE_SIZE]; buffer = new char[size = MAX_SAVE_SIZE];
} }
~OutVMSave(); ~OutVMSave();
}; };
class VMSaveManager : public Common::SaveFileManager { class VMSaveManager : public Common::SaveFileManager {
public: public:
virtual Common::OutSaveFile *openForSaving(const char *filename) { virtual Common::OutSaveFile *openForSaving(const char *filename) {
return new OutVMSave(filename); return new OutVMSave(filename);
} }
@ -291,7 +291,7 @@ public:
return NULL; return NULL;
} }
} }
virtual void listSavefiles(const char *prefix, bool *marks, int num); virtual void listSavefiles(const char *prefix, bool *marks, int num);
}; };
@ -353,7 +353,7 @@ uint32 OutVMSave::write(const void *buf, uint32 cnt)
void VMSaveManager::listSavefiles(const char *prefix, bool *marks, int num) void VMSaveManager::listSavefiles(const char *prefix, bool *marks, int num)
{ {
memset(marks, false, num*sizeof(bool)); memset(marks, false, num*sizeof(bool));
for(int i=0; i<24; i++) for(int i=0; i<24; i++)
tryList(prefix, marks, num, i); tryList(prefix, marks, num, i);
} }

View file

@ -38,7 +38,7 @@ public:
TUid AppDllUid() const; TUid AppDllUid() const;
#ifdef EPOC_AS_APP #ifdef EPOC_AS_APP
TECompXL iECompXL; TECompXL iECompXL;
#endif #endif
}; };
#endif #endif

View file

@ -35,10 +35,10 @@ namespace GUI {
// SumthinWicked says: we either split our Actions like WinCE did with Pocket/Smartphone // SumthinWicked says: we either split our Actions like WinCE did with Pocket/Smartphone
// or we put them in this file separated by #ifdefs, this one is up to you, AnotherGuest :) // or we put them in this file separated by #ifdefs, this one is up to you, AnotherGuest :)
const Common::String actionNames[] = { const Common::String actionNames[] = {
"Up", "Up",
"Down", "Down",
"Left", "Left",
"Right", "Right",
"Left Click", "Left Click",
@ -48,8 +48,8 @@ const Common::String actionNames[] = {
"Zone", "Zone",
"FT Cheat", "FT Cheat",
"Swap character", "Swap character",
"Skip text", "Skip text",
"Pause", "Pause",
"Quit" "Quit"
}; };
@ -96,7 +96,7 @@ SymbianActions::SymbianActions(GameDetector &detector) :
void SymbianActions::initInstanceMain(OSystem *mainSystem) { void SymbianActions::initInstanceMain(OSystem *mainSystem) {
Actions::initInstanceMain(mainSystem); Actions::initInstanceMain(mainSystem);
// Mouse Up // Mouse Up
_action_enabled[ACTION_UP] = true; _action_enabled[ACTION_UP] = true;
@ -125,7 +125,7 @@ void SymbianActions::initInstanceGame() {
bool is_sky = (_detector->_targetName == "sky"); bool is_sky = (_detector->_targetName == "sky");
bool is_queen = (_detector->_targetName == "queen"); bool is_queen = (_detector->_targetName == "queen");
bool is_gob = (strncmp(_detector->_targetName.c_str(), "gob", 3) == 0); bool is_gob = (strncmp(_detector->_targetName.c_str(), "gob", 3) == 0);
Actions::initInstanceGame(); Actions::initInstanceGame();
// See if a right click mapping could be needed // See if a right click mapping could be needed
@ -134,7 +134,7 @@ void SymbianActions::initInstanceGame() {
// Initialize keys for different actions // Initialize keys for different actions
// Save // Save
if (is_simon || is_gob) if (is_simon || is_gob)
_action_enabled[ACTION_SAVE] = false; _action_enabled[ACTION_SAVE] = false;
else else
if (is_queen) { if (is_queen) {
@ -144,7 +144,7 @@ void SymbianActions::initInstanceGame() {
else else
if (is_sky) { if (is_sky) {
_action_enabled[ACTION_SAVE] = true; _action_enabled[ACTION_SAVE] = true;
_key_action[ACTION_SAVE].setAscii(63); _key_action[ACTION_SAVE].setAscii(63);
} }
else { else {
_action_enabled[ACTION_SAVE] = true; _action_enabled[ACTION_SAVE] = true;

View file

@ -70,7 +70,7 @@ public:
private: private:
SymbianActions(GameDetector &detector); SymbianActions(GameDetector &detector);
bool _right_click_needed; bool _right_click_needed;
}; };
} // namespace GUI } // namespace GUI

View file

@ -53,7 +53,7 @@ OSystem_SDL_Symbian::OSystem_SDL_Symbian() :_channels(0),_stereo_mix_buffer(0)
ConfMan.flushToDisk(); ConfMan.flushToDisk();
// Initialize global key mapping for Smartphones // Initialize global key mapping for Smartphones
GUI::Actions* actions = GUI::Actions::Instance(); GUI::Actions* actions = GUI::Actions::Instance();
actions->initInstanceMain(this); actions->initInstanceMain(this);
actions->loadMapping(); actions->loadMapping();
initZones(); initZones();
} }
@ -77,14 +77,14 @@ bool OSystem_SDL_Symbian::setGraphicsMode(const char *name) {
} }
/* /*
* SumthinWicked says: the stuff below is copied from common/scaler.cpp, * SumthinWicked says: the stuff below is copied from common/scaler.cpp,
* so we can skip compiling the scalers. ESDL still needs 1x and the scaler * so we can skip compiling the scalers. ESDL still needs 1x and the scaler
* architecture because we inherit from OSystem_SDL. * architecture because we inherit from OSystem_SDL.
*/ */
int gBitFormat = 565; int gBitFormat = 565;
void InitScalers(uint32 BitFormat) {} // called by OSystem_SDL functions, not relevant for ESDL void InitScalers(uint32 BitFormat) {} // called by OSystem_SDL functions, not relevant for ESDL
/** /**
* Trivial 'scaler' - in fact it doesn't do any scaling but just copies the * Trivial 'scaler' - in fact it doesn't do any scaling but just copies the
* source to the destination. * source to the destination.
*/ */
@ -100,7 +100,7 @@ void Normal1x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPit
bool OSystem_SDL_Symbian::setSoundCallback(SoundProc proc, void *param) { bool OSystem_SDL_Symbian::setSoundCallback(SoundProc proc, void *param) {
// First save the proc and param // First save the proc and param
_sound_proc_param = param; _sound_proc_param = param;
_sound_proc = proc; _sound_proc = proc;
SDL_AudioSpec desired; SDL_AudioSpec desired;
SDL_AudioSpec obtained; SDL_AudioSpec obtained;
@ -200,12 +200,12 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev,Event &event)
{ {
if(!GUI::Actions::Instance()->mappingActive() && ev.key.keysym.sym>SDLK_UNKNOWN) if(!GUI::Actions::Instance()->mappingActive() && ev.key.keysym.sym>SDLK_UNKNOWN)
for(TInt loop=0;loop<GUI::ACTION_LAST;loop++){ for(TInt loop=0;loop<GUI::ACTION_LAST;loop++){
if(GUI::Actions::Instance()->getMapping(loop) ==ev.key.keysym.sym && if(GUI::Actions::Instance()->getMapping(loop) ==ev.key.keysym.sym &&
GUI::Actions::Instance()->isEnabled(loop)){ GUI::Actions::Instance()->isEnabled(loop)){
// Create proper event instead // Create proper event instead
switch(loop) switch(loop)
{ {
case GUI::ACTION_UP: case GUI::ACTION_UP:
if(ev.type == SDL_KEYDOWN) if(ev.type == SDL_KEYDOWN)
{ {
_km.y_vel = -1; _km.y_vel = -1;
@ -218,7 +218,7 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev,Event &event)
} }
event.type = EVENT_MOUSEMOVE; event.type = EVENT_MOUSEMOVE;
fillMouseEvent(event, _km.x, _km.y); fillMouseEvent(event, _km.x, _km.y);
return true; return true;
case GUI::ACTION_DOWN: case GUI::ACTION_DOWN:
if(ev.type == SDL_KEYDOWN) if(ev.type == SDL_KEYDOWN)
{ {
@ -232,7 +232,7 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev,Event &event)
} }
event.type = EVENT_MOUSEMOVE; event.type = EVENT_MOUSEMOVE;
fillMouseEvent(event, _km.x, _km.y); fillMouseEvent(event, _km.x, _km.y);
return true; return true;
case GUI::ACTION_LEFT: case GUI::ACTION_LEFT:
if(ev.type == SDL_KEYDOWN) if(ev.type == SDL_KEYDOWN)
{ {
@ -272,8 +272,8 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev,Event &event)
case GUI::ACTION_ZONE: case GUI::ACTION_ZONE:
if(ev.type == SDL_KEYDOWN) if(ev.type == SDL_KEYDOWN)
{ {
int i; int i;
for (i=0; i<TOTAL_ZONES; i++) for (i=0; i<TOTAL_ZONES; i++)
if (_km.x >= _zones[i].x && _km.y >= _zones[i].y && if (_km.x >= _zones[i].x && _km.y >= _zones[i].y &&
_km.x <= _zones[i].x + _zones[i].width && _km.y <= _zones[i].y + _zones[i].height _km.x <= _zones[i].x + _zones[i].width && _km.y <= _zones[i].y + _zones[i].height
@ -287,7 +287,7 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev,Event &event)
_currentZone = 0; _currentZone = 0;
event.type = EVENT_MOUSEMOVE; event.type = EVENT_MOUSEMOVE;
fillMouseEvent(event, _mouseXZone[_currentZone],_mouseYZone[_currentZone]); fillMouseEvent(event, _mouseXZone[_currentZone],_mouseYZone[_currentZone]);
SDL_WarpMouse(event.mouse.x,event.mouse.y); SDL_WarpMouse(event.mouse.x,event.mouse.y);
} }
return true; return true;
case GUI::ACTION_SAVE: case GUI::ACTION_SAVE:
@ -301,7 +301,7 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev,Event &event)
ev.key.keysym.scancode= key.keycode(); ev.key.keysym.scancode= key.keycode();
ev.key.keysym.mod =(SDLMod) key.flags(); ev.key.keysym.mod =(SDLMod) key.flags();
return false; return false;
} }
case GUI::ACTION_QUIT:{ case GUI::ACTION_QUIT:{
GUI::MessageDialog alert("Do you want to quit ?", "Yes", "No"); GUI::MessageDialog alert("Do you want to quit ?", "Yes", "No");
if (alert.runModal() == GUI::kMessageOK) if (alert.runModal() == GUI::kMessageOK)

View file

@ -36,7 +36,7 @@ public:
const OSystem::GraphicsMode *getSupportedGraphicsModes() const; const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
bool setGraphicsMode(const char *name); bool setGraphicsMode(const char *name);
// Set function that generates samples // Set function that generates samples
/** /**
* This function is overridden by the symbian port in order to provide MONO audio * This function is overridden by the symbian port in order to provide MONO audio
* downmix is done by supplying our own audiocallback * downmix is done by supplying our own audiocallback

View file

@ -58,7 +58,7 @@ CEikAppUi* CScummVMDoc::CreateAppUiL() {
void CScummVMUi::HandleForegroundEventL(TBool aForeground) { void CScummVMUi::HandleForegroundEventL(TBool aForeground) {
if(aForeground) { if(aForeground) {
BringUpEmulatorL(); BringUpEmulatorL();
} }
} }
@ -81,7 +81,7 @@ void CScummVMUi::ConstructL() {
startFile = iEikonEnv->EikAppUi()->Application()->AppFullName(); startFile = iEikonEnv->EikAppUi()->Application()->AppFullName();
TParse parser; TParse parser;
parser.Set(startFile,NULL,NULL); parser.Set(startFile,NULL,NULL);
startFile = parser.DriveAndPath(); startFile = parser.DriveAndPath();
#ifndef __WINS__ #ifndef __WINS__
startFile.Append( _L("EScummVM.exe")); startFile.Append( _L("EScummVM.exe"));
@ -109,7 +109,7 @@ void CScummVMUi::ConstructL() {
if(iThreadWatch.Open(iThreadId)==KErrNone) { if(iThreadWatch.Open(iThreadId)==KErrNone) {
iWatcher = new (ELeave)CScummWatcher; iWatcher = new (ELeave)CScummWatcher;
iWatcher->iAppUi=this; iWatcher->iAppUi=this;
iThreadWatch.Logon(iWatcher->iStatus); iThreadWatch.Logon(iWatcher->iStatus);
} }
} }
@ -154,7 +154,7 @@ void CScummVMUi::HandleCommandL(TInt aCommand) {
thread.Close(); thread.Close();
} }
Exit(); Exit();
} }
break; break;
} }
} }

View file

@ -58,7 +58,7 @@ CEikAppUi* CScummVMDoc::CreateAppUiL() {
void CScummVMUi::HandleForegroundEventL(TBool aForeground) { void CScummVMUi::HandleForegroundEventL(TBool aForeground) {
if(aForeground) { if(aForeground) {
BringUpEmulatorL(); BringUpEmulatorL();
} }
} }
@ -81,7 +81,7 @@ void CScummVMUi::ConstructL() {
startFile = iEikonEnv->EikAppUi()->Application()->AppFullName(); startFile = iEikonEnv->EikAppUi()->Application()->AppFullName();
TParse parser; TParse parser;
parser.Set(startFile,NULL,NULL); parser.Set(startFile,NULL,NULL);
startFile = parser.DriveAndPath(); startFile = parser.DriveAndPath();
#ifndef __WINS__ #ifndef __WINS__
startFile.Append( _L("EScummVM.exe")); startFile.Append( _L("EScummVM.exe"));
@ -108,7 +108,7 @@ void CScummVMUi::ConstructL() {
if(iThreadWatch.Open(iThreadId)==KErrNone) { if(iThreadWatch.Open(iThreadId)==KErrNone) {
iWatcher = new (ELeave)CScummWatcher; iWatcher = new (ELeave)CScummWatcher;
iWatcher->iAppUi=this; iWatcher->iAppUi=this;
iThreadWatch.Logon(iWatcher->iStatus); iThreadWatch.Logon(iWatcher->iStatus);
} }
} }
@ -153,7 +153,7 @@ void CScummVMUi::HandleCommandL(TInt aCommand) {
thread.Close(); thread.Close();
} }
Exit(); Exit();
} }
break; break;
} }
} }

View file

@ -58,7 +58,7 @@ CEikAppUi* CScummVMDoc::CreateAppUiL() {
void CScummVMUi::HandleForegroundEventL(TBool aForeground) { void CScummVMUi::HandleForegroundEventL(TBool aForeground) {
if(aForeground) { if(aForeground) {
BringUpEmulatorL(); BringUpEmulatorL();
} }
} }
@ -81,7 +81,7 @@ void CScummVMUi::ConstructL() {
startFile = iEikonEnv->EikAppUi()->Application()->AppFullName(); startFile = iEikonEnv->EikAppUi()->Application()->AppFullName();
TParse parser; TParse parser;
parser.Set(startFile,NULL,NULL); parser.Set(startFile,NULL,NULL);
startFile = parser.DriveAndPath(); startFile = parser.DriveAndPath();
#ifndef __WINS__ #ifndef __WINS__
startFile.Append( _L("EScummVM.exe")); startFile.Append( _L("EScummVM.exe"));
@ -108,7 +108,7 @@ void CScummVMUi::ConstructL() {
if(iThreadWatch.Open(iThreadId)==KErrNone) { if(iThreadWatch.Open(iThreadId)==KErrNone) {
iWatcher = new (ELeave)CScummWatcher; iWatcher = new (ELeave)CScummWatcher;
iWatcher->iAppUi=this; iWatcher->iAppUi=this;
iThreadWatch.Logon(iWatcher->iStatus); iThreadWatch.Logon(iWatcher->iStatus);
} }
} }
@ -153,7 +153,7 @@ void CScummVMUi::HandleCommandL(TInt aCommand) {
thread.Close(); thread.Close();
} }
Exit(); Exit();
} }
break; break;
} }
} }

View file

@ -65,14 +65,14 @@
// somehow nobody has this function... // somehow nobody has this function...
#define hypot(a, b) sqrt((a)*(a) + (b)*(b)) #define hypot(a, b) sqrt((a)*(a) + (b)*(b))
// Symbian bsearch implementation is flawed // Symbian bsearch implementation is flawed
void inline *scumm_bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) { void inline *scumm_bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) {
size_t i; size_t i;
for (i=0; i<nmemb; i++) for (i=0; i<nmemb; i++)
if (compar(key, (void*)((size_t)base + size * i)) == 0) if (compar(key, (void*)((size_t)base + size * i)) == 0)
return (void*)((size_t)base + size * i); return (void*)((size_t)base + size * i);
return NULL; return NULL;
} }
#define bsearch scumm_bsearch #define bsearch scumm_bsearch

View file

@ -94,14 +94,14 @@ AmigaOSFilesystemNode::AmigaOSFilesystemNode(const String &p) {
ENTER(); ENTER();
int len = 0, offset = p.size(); int len = 0, offset = p.size();
assert(offset > 0); assert(offset > 0);
_sPath = p; _sPath = p;
// Extract last component from path // Extract last component from path
const char *str = p.c_str(); const char *str = p.c_str();
while (offset > 0 && (str[offset-1] == '/' || str[offset-1] == ':')) while (offset > 0 && (str[offset-1] == '/' || str[offset-1] == ':'))
offset--; offset--;
@ -109,7 +109,7 @@ AmigaOSFilesystemNode::AmigaOSFilesystemNode(const String &p) {
len++; len++;
offset--; offset--;
} }
_sDisplayName = String(str + offset, len); _sDisplayName = String(str + offset, len);
// Check whether it is a directory, and whether the file actually exists // Check whether it is a directory, and whether the file actually exists
@ -132,7 +132,7 @@ AmigaOSFilesystemNode::AmigaOSFilesystemNode(const String &p) {
if (_bIsDirectory) { if (_bIsDirectory) {
if (fib->fib_EntryType != ST_ROOT) if (fib->fib_EntryType != ST_ROOT)
_sPath += "/"; _sPath += "/";
_pFileLock = IDOS->DupLock(pLock); _pFileLock = IDOS->DupLock(pLock);
_bIsValid = (_pFileLock != 0); _bIsValid = (_pFileLock != 0);
} }

View file

@ -44,8 +44,8 @@
* And if we ever want to support devices with no FS in the classical sense (Palm...), * And if we ever want to support devices with no FS in the classical sense (Palm...),
* we can build upon this. * we can build upon this.
*/ */
/* /*
* TODO - Instead of starting with getRoot(), we should rather add a getDefaultDir() * TODO - Instead of starting with getRoot(), we should rather add a getDefaultDir()
* call that on Unix might return the current dir or the users home dir... * call that on Unix might return the current dir or the users home dir...
* i.e. the root dir is usually not the best starting point for browsing. * i.e. the root dir is usually not the best starting point for browsing.
@ -81,7 +81,7 @@ protected:
virtual AbstractFilesystemNode *parent() const = 0; virtual AbstractFilesystemNode *parent() const = 0;
/** /**
* This method is a rather ugly hack which is used internally by the * This method is a rather ugly hack which is used internally by the
* actual node implementions to wrap up raw nodes inside FilesystemNode * actual node implementions to wrap up raw nodes inside FilesystemNode
* objects. We probably want to get rid of this eventually and replace it * objects. We probably want to get rid of this eventually and replace it
* with a cleaner / more elegant solution, but for now it works. * with a cleaner / more elegant solution, but for now it works.

View file

@ -36,7 +36,7 @@ protected:
bool _isValid; bool _isValid;
bool _isPseudoRoot; bool _isPseudoRoot;
String _path; String _path;
public: public:
PalmOSFilesystemNode(); PalmOSFilesystemNode();
PalmOSFilesystemNode(const Char *path); PalmOSFilesystemNode(const Char *path);
@ -71,7 +71,7 @@ void PalmOSFilesystemNode::addFile(FSList &list, ListMode mode, const char *base
if (entry._isDirectory) if (entry._isDirectory)
entry._path += "/"; entry._path += "/";
entry._isValid = true; entry._isValid = true;
entry._isPseudoRoot = false; entry._isPseudoRoot = false;
list.push_back(wrap(new PalmOSFilesystemNode(&entry))); list.push_back(wrap(new PalmOSFilesystemNode(&entry)));
} }
@ -111,7 +111,7 @@ FSList PalmOSFilesystemNode::listDir(ListMode mode) const {
if (e) if (e)
return myList; return myList;
while(dirIterator != expIteratorStop) { while(dirIterator != expIteratorStop) {
e = VFSDirEntryEnumerate(handle, &dirIterator, &desc); e = VFSDirEntryEnumerate(handle, &dirIterator, &desc);
if (!e) { if (!e) {
@ -137,11 +137,11 @@ const char *lastPathComponent(const Common::String &str) {
AbstractFilesystemNode *PalmOSFilesystemNode::parent() const { AbstractFilesystemNode *PalmOSFilesystemNode::parent() const {
PalmOSFilesystemNode *p = 0; PalmOSFilesystemNode *p = 0;
if (!_isPseudoRoot) { if (!_isPseudoRoot) {
const char *start = _path.c_str(); const char *start = _path.c_str();
const char *end = lastPathComponent(_path); const char *end = lastPathComponent(_path);
p = new PalmOSFilesystemNode(); p = new PalmOSFilesystemNode();
p->_path = String(start, end - start); p->_path = String(start, end - start);
p->_isValid = true; p->_isValid = true;

View file

@ -45,7 +45,7 @@ protected:
bool _isDirectory; bool _isDirectory;
bool _isValid; bool _isValid;
String _path; String _path;
public: public:
POSIXFilesystemNode(); POSIXFilesystemNode();
POSIXFilesystemNode(const String &path); POSIXFilesystemNode(const String &path);
@ -64,11 +64,11 @@ public:
static const char *lastPathComponent(const Common::String &str) { static const char *lastPathComponent(const Common::String &str) {
const char *start = str.c_str(); const char *start = str.c_str();
const char *cur = start + str.size() - 2; const char *cur = start + str.size() - 2;
while (cur > start && *cur != '/') { while (cur > start && *cur != '/') {
--cur; --cur;
} }
return cur+1; return cur+1;
} }
@ -84,7 +84,7 @@ POSIXFilesystemNode::POSIXFilesystemNode() {
#ifndef __DC__ #ifndef __DC__
char buf[MAXPATHLEN]; char buf[MAXPATHLEN];
getcwd(buf, MAXPATHLEN); getcwd(buf, MAXPATHLEN);
_path = buf; _path = buf;
_displayName = lastPathComponent(_path); _displayName = lastPathComponent(_path);
_path += '/'; _path += '/';
@ -99,7 +99,7 @@ POSIXFilesystemNode::POSIXFilesystemNode() {
POSIXFilesystemNode::POSIXFilesystemNode(const String &p) { POSIXFilesystemNode::POSIXFilesystemNode(const String &p) {
int len = 0, offset = p.size(); int len = 0, offset = p.size();
struct stat st; struct stat st;
assert(offset > 0); assert(offset > 0);
_path = p; _path = p;
@ -147,7 +147,7 @@ FSList POSIXFilesystemNode::listDir(ListMode mode) const {
// Skip 'invisible' files // Skip 'invisible' files
if (dp->d_name[0] == '.') if (dp->d_name[0] == '.')
continue; continue;
POSIXFilesystemNode entry; POSIXFilesystemNode entry;
entry._displayName = dp->d_name; entry._displayName = dp->d_name;
entry._path = _path; entry._path = _path;

View file

@ -32,7 +32,7 @@ protected:
bool _isDirectory; bool _isDirectory;
bool _isRoot; bool _isRoot;
String _path; String _path;
public: public:
Ps2FilesystemNode(void); Ps2FilesystemNode(void);
Ps2FilesystemNode(const Ps2FilesystemNode *node); Ps2FilesystemNode(const Ps2FilesystemNode *node);
@ -109,7 +109,7 @@ FSList Ps2FilesystemNode::listDir(ListMode mode) const {
if (tocEntries[fCnt].filename[0] != '.') { // skip .. directory if (tocEntries[fCnt].filename[0] != '.') { // skip .. directory
dirEntry._isDirectory = (bool)(tocEntries[fCnt].fileProperties & 2); dirEntry._isDirectory = (bool)(tocEntries[fCnt].fileProperties & 2);
dirEntry._isRoot = false; dirEntry._isRoot = false;
dirEntry._path = _path; dirEntry._path = _path;
dirEntry._path += "/"; dirEntry._path += "/";
dirEntry._path += tocEntries[fCnt].filename; dirEntry._path += tocEntries[fCnt].filename;
@ -135,7 +135,7 @@ AbstractFilesystemNode *Ps2FilesystemNode::parent() const {
slash = cnt; slash = cnt;
cnt++; cnt++;
} }
p->_path = String(_path.c_str(), slash - _path.c_str()); p->_path = String(_path.c_str(), slash - _path.c_str());
p->_isDirectory = true; p->_isDirectory = true;
p->_displayName = slash + 1; p->_displayName = slash + 1;

View file

@ -21,7 +21,7 @@
* $Header$ * $Header$
*/ */
#if defined (__SYMBIAN32__) #if defined (__SYMBIAN32__)
#include "common/stdafx.h" #include "common/stdafx.h"
#include "../fs.h" #include "../fs.h"
@ -62,11 +62,11 @@ public:
static const char *lastPathComponent(const Common::String &str) { static const char *lastPathComponent(const Common::String &str) {
const char *start = str.c_str(); const char *start = str.c_str();
const char *cur = start + str.size() - 2; const char *cur = start + str.size() - 2;
while (cur > start && *cur != '\\') { while (cur > start && *cur != '\\') {
--cur; --cur;
} }
return cur+1; return cur+1;
} }
@ -88,7 +88,7 @@ SymbianFilesystemNode::SymbianFilesystemNode(bool aIsRoot) {
} }
// SumthinWicked says: added next function myself, since it was not in 0.7.1. // SumthinWicked says: added next function myself, since it was not in 0.7.1.
// might still be a little buggy, or simply the reason ScummVM can't run any // might still be a little buggy, or simply the reason ScummVM can't run any
// games on the phone yet :P // games on the phone yet :P
SymbianFilesystemNode::SymbianFilesystemNode(const String &path) { SymbianFilesystemNode::SymbianFilesystemNode(const String &path) {
if (path.size() == 0) if (path.size() == 0)
@ -121,7 +121,7 @@ FSList SymbianFilesystemNode::listDir(ListMode mode) const {
CEikonEnv::Static()->FsSession().DriveList(drivelist); CEikonEnv::Static()->FsSession().DriveList(drivelist);
for (int loop=0;loop<KMaxDrives;loop++) { for (int loop=0;loop<KMaxDrives;loop++) {
if(drivelist[loop]>0) { if(drivelist[loop]>0) {
SymbianFilesystemNode entry(false); SymbianFilesystemNode entry(false);
char drive_name[2]; char drive_name[2];
drive_name[0] = loop+'A'; drive_name[0] = loop+'A';
drive_name[1] = '\0'; drive_name[1] = '\0';
@ -149,17 +149,17 @@ FSList SymbianFilesystemNode::listDir(ListMode mode) const {
nameBuf.Copy(fileentry.iName); nameBuf.Copy(fileentry.iName);
SymbianFilesystemNode entry(false); SymbianFilesystemNode entry(false);
entry._isPseudoRoot = false; entry._isPseudoRoot = false;
entry._displayName =(char*)nameBuf.PtrZ(); entry._displayName =(char*)nameBuf.PtrZ();
entry._path = _path; entry._path = _path;
entry._path +=(char*)nameBuf.PtrZ(); entry._path +=(char*)nameBuf.PtrZ();
entry._isDirectory = fileentry.IsDir(); entry._isDirectory = fileentry.IsDir();
// Honor the chosen mode // Honor the chosen mode
if ((mode == kListFilesOnly && entry._isDirectory) || if ((mode == kListFilesOnly && entry._isDirectory) ||
(mode == kListDirectoriesOnly && !entry._isDirectory)) (mode == kListDirectoriesOnly && !entry._isDirectory))
continue; continue;
if (entry._isDirectory) if (entry._isDirectory)
entry._path += "\\"; entry._path += "\\";
myList.push_back(wrap(new SymbianFilesystemNode(&entry))); myList.push_back(wrap(new SymbianFilesystemNode(&entry)));

View file

@ -38,7 +38,7 @@ protected:
bool _isValid; bool _isValid;
bool _isPseudoRoot; bool _isPseudoRoot;
String _path; String _path;
public: public:
WindowsFilesystemNode(); WindowsFilesystemNode();
WindowsFilesystemNode(const String &path); WindowsFilesystemNode(const String &path);
@ -63,7 +63,7 @@ char* WindowsFilesystemNode::toAscii(TCHAR *x) {
#ifndef UNICODE #ifndef UNICODE
return (char*)x; return (char*)x;
#else #else
static char asciiString[MAX_PATH]; static char asciiString[MAX_PATH];
WideCharToMultiByte(CP_ACP, 0, x, _tcslen(x) + 1, asciiString, sizeof(asciiString), NULL, NULL); WideCharToMultiByte(CP_ACP, 0, x, _tcslen(x) + 1, asciiString, sizeof(asciiString), NULL, NULL);
return asciiString; return asciiString;
@ -128,7 +128,7 @@ WindowsFilesystemNode::WindowsFilesystemNode() {
_isValid = true; _isValid = true;
_path = "\\"; _path = "\\";
_isPseudoRoot = false; _isPseudoRoot = false;
#endif #endif
} }
WindowsFilesystemNode::WindowsFilesystemNode(const String &p) { WindowsFilesystemNode::WindowsFilesystemNode(const String &p) {
@ -179,9 +179,9 @@ FSList WindowsFilesystemNode::listDir(ListMode mode) const {
TCHAR drive_buffer[100]; TCHAR drive_buffer[100];
GetLogicalDriveStrings(sizeof(drive_buffer) / sizeof(TCHAR), drive_buffer); GetLogicalDriveStrings(sizeof(drive_buffer) / sizeof(TCHAR), drive_buffer);
for (TCHAR *current_drive = drive_buffer; *current_drive; for (TCHAR *current_drive = drive_buffer; *current_drive;
current_drive += _tcslen(current_drive) + 1) { current_drive += _tcslen(current_drive) + 1) {
WindowsFilesystemNode entry; WindowsFilesystemNode entry;
char drive_name[2]; char drive_name[2];
drive_name[0] = toAscii(current_drive)[0]; drive_name[0] = toAscii(current_drive)[0];

View file

@ -16,7 +16,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Header$ * $Header$
* *
@ -120,7 +120,7 @@ struct g_Namedregisters {
// Global stuff // Global stuff
// Register array. // Register array.
int g_Registers[50] = {1, 2, 3, 4 ,5, 6, 7, 8, 9, 10, int g_Registers[50] = {1, 2, 3, 4 ,5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 11, 12, 13, 14, 15, 16, 17, 18, 19,
21, 22, 23, 24, 25, 26, 27, 28, 29, 21, 22, 23, 24, 25, 26, 27, 28, 29,
31, 32, 33, 34, 35, 36, 37, 38, 39, 31, 32, 33, 34, 35, 36, 37, 38, 39,
@ -173,13 +173,13 @@ unsigned int DecodeInstruction(unsigned int uiInstruction, unsigned int PC);
int OpenUSB() int OpenUSB()
{ {
int iResult; int iResult;
g_CommDesc.port_kind = COMM_USB_D; g_CommDesc.port_kind = COMM_USB_D;
g_CommDesc.tr_mode = 1; g_CommDesc.tr_mode = 1;
g_CommDesc.tr_buf_size = PACKET_SIZE; g_CommDesc.tr_buf_size = PACKET_SIZE;
g_CommDesc.sz_pkt = PACKET_SIZE; g_CommDesc.sz_pkt = PACKET_SIZE;
g_CommDesc.isr_comm_ram = 0; g_CommDesc.isr_comm_ram = 0;
iResult = GpCommCreate(&g_CommDesc, &g_Comm); iResult = GpCommCreate(&g_CommDesc, &g_Comm);
return iResult; return iResult;
@ -222,7 +222,7 @@ void WaitACK()
} }
} }
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// Formats and sends a command to the server, // Formats and sends a command to the server,
// it also calculates checksum // it also calculates checksum
void SendCommand(unsigned char *pCommand) void SendCommand(unsigned char *pCommand)
{ {
@ -329,7 +329,7 @@ void HexToStringBW(char *pString, int iNumber)
pString[3] = HexDigits[(iNumber >> 8) & 0x0f]; pString[3] = HexDigits[(iNumber >> 8) & 0x0f];
pString[0] = HexDigits[(iNumber >> 4) & 0x0f]; pString[0] = HexDigits[(iNumber >> 4) & 0x0f];
pString[1] = HexDigits[(iNumber) & 0x0f]; pString[1] = HexDigits[(iNumber) & 0x0f];
pString[8] = 0; pString[8] = 0;
} }
@ -402,7 +402,7 @@ unsigned char StringToByte(char *pString)
case 'f': case 'f':
ucValue |= (0x0f); ucValue |= (0x0f);
break; break;
} }
} }
@ -418,7 +418,7 @@ void SendOffsets()
int a = 0;//(int)&__text_start; int a = 0;//(int)&__text_start;
int b = 0;//(int)&__data_start; int b = 0;//(int)&__data_start;
int c = 0;//(int)&__bss_start; int c = 0;//(int)&__bss_start;
PrintToString(String, "Text="); PrintToString(String, "Text=");
HexToString(&String[5], a); HexToString(&String[5], a);
PrintToString(&String[5+8], ";Data="); PrintToString(&String[5+8], ";Data=");
@ -449,23 +449,23 @@ void DumpRegisters()
HexToStringBW(&Buffer[i * 8], g_Registers[21 + i]); HexToStringBW(&Buffer[i * 8], g_Registers[21 + i]);
} }
Buffer[21*8] = 0; Buffer[21*8] = 0;
SendCommandSize((unsigned char *)Buffer, (21 * 8) + 4); SendCommandSize((unsigned char *)Buffer, (21 * 8) + 4);
} }
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// This function extracts an address from a string. // This function extracts an address from a string.
void *GetAddr(char *pBuffer) void *GetAddr(char *pBuffer)
{ {
int iAddr; int iAddr;
int i = 0; int i = 0;
iAddr = 0; iAddr = 0;
while (pBuffer[i] != ',') { while (pBuffer[i] != ',') {
iAddr = iAddr << 4; iAddr = iAddr << 4;
switch(pBuffer[i]) { switch(pBuffer[i]) {
case '0': case '0':
//iAddr |= //iAddr |=
break; break;
case '1': case '1':
iAddr |= (0x01); iAddr |= (0x01);
@ -531,7 +531,7 @@ int GetBytes(char *pBuffer)
iBytes = iBytes << 4; iBytes = iBytes << 4;
switch(pBuffer[i]) { switch(pBuffer[i]) {
case '0': case '0':
//iAddr |= //iAddr |=
break; break;
case '1': case '1':
iBytes |= 0x01; iBytes |= 0x01;
@ -580,7 +580,7 @@ int GetBytes(char *pBuffer)
break; break;
} }
i++; i++;
} }
return iBytes; return iBytes;
@ -613,7 +613,7 @@ void SendMemory(void *pAddr, int iBytes)
iData = *pData++; iData = *pData++;
g_TempBuffer[iBufferPos++] = HexDigits[(iData & 0xf0) >> 4]; g_TempBuffer[iBufferPos++] = HexDigits[(iData & 0xf0) >> 4];
g_TempBuffer[iBufferPos++] = HexDigits[(iData & 0x0f)]; g_TempBuffer[iBufferPos++] = HexDigits[(iData & 0x0f)];
} }
if (iBytes > 0) { if (iBytes > 0) {
// This mean that we have not yet sent our last command. // This mean that we have not yet sent our last command.
@ -711,7 +711,7 @@ void ISR() __attribute__ ((naked));
void ISR() void ISR()
{ {
// Lets snatch the registers! // Lets snatch the registers!
asm volatile(" \n" asm volatile(" \n"
" str r4, [%0, #0x10] \n" " str r4, [%0, #0x10] \n"
" str r5, [%0, #0x14] \n" " str r5, [%0, #0x14] \n"
@ -724,7 +724,7 @@ void ISR()
" str r12, [%0, #0x30] \n" " str r12, [%0, #0x30] \n"
" str r14, [%0, #0x3C] \n" " str r14, [%0, #0x3C] \n"
" @// skip 8 * 12byte(96bit) = 0x60 \n" " @// skip 8 * 12byte(96bit) = 0x60 \n"
" mov r4, %0 \n" " mov r4, %0 \n"
@ -738,10 +738,10 @@ void ISR()
" str r1, [r4, #0x48] \n" " str r1, [r4, #0x48] \n"
" str r1, [r4,#0xA0] \n" " str r1, [r4,#0xA0] \n"
" str r1, [r4,#0xA4] \n" " str r1, [r4,#0xA4] \n"
" mrs r1, CPSR \n" " mrs r1, CPSR \n"
" mov r2, r1 \n" " mov r2, r1 \n"
" @// Let us set the mode to supervisor so we can get r13 and r14 \n" " @// Let us set the mode to supervisor so we can get r13 and r14 \n"
" bic r1, r1, #0x1f \n" " bic r1, r1, #0x1f \n"
@ -755,15 +755,15 @@ void ISR()
" bic r2, r2, #0x80 \n" " bic r2, r2, #0x80 \n"
" msr CPSR_fsxc, r2 \n" " msr CPSR_fsxc, r2 \n"
" \n" " \n"
: :
: "r" (g_Registers) : "r" (g_Registers)
: "%0", "r1", "r2", "r4"); : "%0", "r1", "r2", "r4");
// Get Current CSPR and save LR // Get Current CSPR and save LR
asm volatile(" \n" asm volatile(" \n"
" mrs r0, CPSR \n" " mrs r0, CPSR \n"
@ -806,7 +806,7 @@ void ISR()
default: default:
g_iTrap = -1; g_iTrap = -1;
} }
#ifdef USE_PRINTF #ifdef USE_PRINTF
Printf("Trap@0x%x:%d", g_Registers[15], g_iTrap); Printf("Trap@0x%x:%d", g_Registers[15], g_iTrap);
@ -834,11 +834,11 @@ void ISR()
*/ */
SendBreakPoint(); SendBreakPoint();
BreakPoint(); BreakPoint();
//Printf("0x%x 0x%x", g_Registers[15], g_Registers[16]); //Printf("0x%x 0x%x", g_Registers[15], g_Registers[16]);
// Okay, it's time to continue. // Okay, it's time to continue.
switch (g_iTrap) { switch (g_iTrap) {
case MODE_USER: case MODE_USER:
//Printf("Dunno!!\n"); //Printf("Dunno!!\n");
@ -877,7 +877,7 @@ void ISR()
" ldr r0,[%0, #0x00] \n" " ldr r0,[%0, #0x00] \n"
" ldr r3,[%0, #0x0C] \n" " ldr r3,[%0, #0x0C] \n"
" subs pc, lr, #0x04 \n" " subs pc, lr, #0x04 \n"
" \n" " \n"
@ -918,7 +918,7 @@ void ISR()
: :
:"r" (g_Registers) :"r" (g_Registers)
:"r0"); :"r0");
break; break;
case MODE_SYSTEM: case MODE_SYSTEM:
@ -931,7 +931,7 @@ void ISR()
} }
} }
@ -992,7 +992,7 @@ void DEBUG_Print(char *pFormat, ...)
unsigned char MyChar; unsigned char MyChar;
if (!g_GDBConnected) return; if (!g_GDBConnected) return;
va_start(VaList , pFormat); va_start(VaList , pFormat);
vsnprintf(Temp, 0x100, pFormat , VaList); vsnprintf(Temp, 0x100, pFormat , VaList);
va_end(VaList); va_end(VaList);
@ -1026,7 +1026,7 @@ void BreakPoint()
void *pAddr; void *pAddr;
int iOffset; int iOffset;
int iBytes; int iBytes;
// Find out if we got here through a STEP command // Find out if we got here through a STEP command
if (g_LastWasStep) { if (g_LastWasStep) {
@ -1050,7 +1050,7 @@ void BreakPoint()
while(!bBreakLoop) { while(!bBreakLoop) {
iResult = RecvUSB(g_ReadBuffer, 0x100); iResult = RecvUSB(g_ReadBuffer, 0x100);
//Printf("%d\n", iResult); //Printf("%d\n", iResult);
if (iResult > 0) { if (iResult > 0) {
// If we recieve a package we can assume that GDB is connected.. or smth..:D // If we recieve a package we can assume that GDB is connected.. or smth..:D
g_GDBConnected = true; g_GDBConnected = true;
@ -1064,7 +1064,7 @@ void BreakPoint()
g_SendBuffer[4] = '+'; g_SendBuffer[4] = '+';
SendUSB((const void *)g_SendBuffer, 0x100); SendUSB((const void *)g_SendBuffer, 0x100);
WaitACK(); WaitACK();
// I can see that i get a bunch of '+' and '-' in the messages.. lets remove them. // I can see that i get a bunch of '+' and '-' in the messages.. lets remove them.
iOffsetAdd = 4; iOffsetAdd = 4;
while((g_ReadBuffer[iOffsetAdd] == '+') || (g_ReadBuffer[iOffsetAdd] == '-')) iOffsetAdd++; while((g_ReadBuffer[iOffsetAdd] == '+') || (g_ReadBuffer[iOffsetAdd] == '-')) iOffsetAdd++;
@ -1118,16 +1118,16 @@ void BreakPoint()
iOffset = FindChar(&g_ReadBuffer[iOffsetAdd + 2], ':'); iOffset = FindChar(&g_ReadBuffer[iOffsetAdd + 2], ':');
WriteMemory(pAddr, iBytes, &g_ReadBuffer[iOffsetAdd + 2 + iOffset + 1]); WriteMemory(pAddr, iBytes, &g_ReadBuffer[iOffsetAdd + 2 + iOffset + 1]);
SendCommand((unsigned char *)"OK"); SendCommand((unsigned char *)"OK");
} }
break; break;
case 'c': // continue case 'c': // continue
{ {
return; return;
} }
break; break;
case 's': // Stepping. case 's': // Stepping.
{ {
// Get the address of the next instruction. // Get the address of the next instruction.
@ -1164,7 +1164,7 @@ void BreakPoint()
} }
} }
break; break;
default: default:
UnSupportedCommand(); UnSupportedCommand();
break; break;
@ -1195,8 +1195,8 @@ unsigned int *GetNextInstruction(unsigned int *pAddr)
unsigned int uiNewPC = DecodeInstruction(uiInstruction, (unsigned int)pAddr); unsigned int uiNewPC = DecodeInstruction(uiInstruction, (unsigned int)pAddr);
return (unsigned int *)uiNewPC; return (unsigned int *)uiNewPC;
// Set new PC to pAddr + 4, because we really hope that is the case...:D // Set new PC to pAddr + 4, because we really hope that is the case...:D
iNewPC = (unsigned int)pAddr; iNewPC = (unsigned int)pAddr;
iNewPC += 4; // Next instruction (atleast in ARM mode, we don't support thumb yet) iNewPC += 4; // Next instruction (atleast in ARM mode, we don't support thumb yet)
@ -1227,9 +1227,9 @@ unsigned int *GetNextInstruction(unsigned int *pAddr)
iNewAddr *= 4; // Instruction size. iNewAddr *= 4; // Instruction size.
iNewPC = ((int)pAddr + iNewAddr + 8); iNewPC = ((int)pAddr + iNewAddr + 8);
} }
// Well, it might be a ldm(ea)? // Well, it might be a ldm(ea)?
if ((uiInstruction & 0xE000000) == 0x8000000) { if ((uiInstruction & 0xE000000) == 0x8000000) {
#ifdef USE_PRINTF #ifdef USE_PRINTF
Printf("LDM"); Printf("LDM");
@ -1261,28 +1261,28 @@ unsigned int *GetNextInstruction(unsigned int *pAddr)
uiRegVal = ((unsigned int *)g_Registers)[uiBaseRegister]; uiRegVal = ((unsigned int *)g_Registers)[uiBaseRegister];
// First, have a look at the U bit. // First, have a look at the U bit.
if ((uiInstruction & (1 << 23)) != 0) { if ((uiInstruction & (1 << 23)) != 0) {
// Transfer is made descending // Transfer is made descending
// Which also means that the PC is closest to the base register i just found out. // Which also means that the PC is closest to the base register i just found out.
// Lets check the P bit (If i'm supposed to increment before or after. // Lets check the P bit (If i'm supposed to increment before or after.
iPCOffset = iRegsbeforePC * 4; iPCOffset = iRegsbeforePC * 4;
if (((uiInstruction) & (1 << 24)) != 0) iPCOffset += 4; if (((uiInstruction) & (1 << 24)) != 0) iPCOffset += 4;
} else { } else {
// Transfer is done ascending // Transfer is done ascending
// Lets check the P bit (If i'm supposed to decrement before or after. // Lets check the P bit (If i'm supposed to decrement before or after.
if (((uiInstruction) & (1 << 24)) != 0) iPCOffset = -4; if (((uiInstruction) & (1 << 24)) != 0) iPCOffset = -4;
} }
iNewPC = *(unsigned int *)((((int)uiRegVal) + iPCOffset) & ~0x03); iNewPC = *(unsigned int *)((((int)uiRegVal) + iPCOffset) & ~0x03);
} }
} }
} }
// Check if it's a mov pc, Rn // Check if it's a mov pc, Rn
} }
return (unsigned int *)iNewPC; return (unsigned int *)iNewPC;
@ -1298,7 +1298,7 @@ bool CondWillExecute(unsigned int uiCond, unsigned int CSPR)
// This is true if Z is set in CSPR // This is true if Z is set in CSPR
if ((CSPR & (1 << 30)) != 0) return true; if ((CSPR & (1 << 30)) != 0) return true;
else return false; else return false;
break; break;
case 1: // NE case 1: // NE
// This should be true if Z is not set. // This should be true if Z is not set.
@ -1370,7 +1370,7 @@ bool CondWillExecute(unsigned int uiCond, unsigned int CSPR)
default: default:
break; break;
} }
} }
// I got the idea for this layout from the singlestep.c (found in eCos) // I got the idea for this layout from the singlestep.c (found in eCos)
@ -1395,7 +1395,7 @@ typedef struct
#define DPISR_R1 0 #define DPISR_R1 0
#define DPISR_R2 0 #define DPISR_R2 0
// Example <opcode> Rd, Rm, <shift> amount // Example <opcode> Rd, Rm, <shift> amount
typedef struct typedef struct
{ {
unsigned Rm : 4; // Rm unsigned Rm : 4; // Rm
unsigned resv3 : 1; // Reserved 3 (1) unsigned resv3 : 1; // Reserved 3 (1)
@ -1475,7 +1475,7 @@ typedef struct
unsigned S : 1; // B-bit unsigned S : 1; // B-bit
unsigned U : 1; // U-bit unsigned U : 1; // U-bit
unsigned p : 1; // P-bit unsigned p : 1; // P-bit
unsigned resv1 : 3; // Reserved 1 (100) unsigned resv1 : 3; // Reserved 1 (100)
unsigned cond : 4; // Condition unsigned cond : 4; // Condition
} lsm; // Load store multiple } lsm; // Load store multiple
@ -1563,7 +1563,7 @@ unsigned int DecodeBL(bl Instr, unsigned int PC);
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// //
unsigned int DecodeInstruction(unsigned int uiInstruction, unsigned int PC) unsigned int DecodeInstruction(unsigned int uiInstruction, unsigned int PC)
{ {
Instruction myInstruction; Instruction myInstruction;
@ -1585,7 +1585,7 @@ unsigned int DecodeInstruction(unsigned int uiInstruction, unsigned int PC)
(myInstruction.DPRRS.resv3 == DPRRS_R3)) return DecodeDPRRS(myInstruction.DPRRS, PC); (myInstruction.DPRRS.resv3 == DPRRS_R3)) return DecodeDPRRS(myInstruction.DPRRS, PC);
else if ((myInstruction.DPI.resv1 == DPI_R1)) return DecodeDPI(myInstruction.DPI, PC); else if ((myInstruction.DPI.resv1 == DPI_R1)) return DecodeDPI(myInstruction.DPI, PC);
else if ((myInstruction.LSIO.resv1 == LSIO_R1)) return DecodeLSIO(myInstruction.LSIO, PC); else if ((myInstruction.LSIO.resv1 == LSIO_R1)) return DecodeLSIO(myInstruction.LSIO, PC);
else if ((myInstruction.LSRO.resv1 == LSRO_R1) && else if ((myInstruction.LSRO.resv1 == LSRO_R1) &&
(myInstruction.LSRO.resv2 == LSRO_R2)) return DecodeLSRO(myInstruction.LSRO, PC); (myInstruction.LSRO.resv2 == LSRO_R2)) return DecodeLSRO(myInstruction.LSRO, PC);
else if (myInstruction.LSM.resv1 == LSM_R1) return DecodeLSM(myInstruction.LSM, PC); else if (myInstruction.LSM.resv1 == LSM_R1) return DecodeLSM(myInstruction.LSM, PC);
@ -1595,21 +1595,21 @@ unsigned int DecodeInstruction(unsigned int uiInstruction, unsigned int PC)
} }
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// //
unsigned int LSL(unsigned int uiValue, unsigned int uiSteps) unsigned int LSL(unsigned int uiValue, unsigned int uiSteps)
{ {
return uiValue << uiSteps; return uiValue << uiSteps;
} }
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// //
unsigned int LSR(unsigned int uiValue, unsigned int uiSteps) unsigned int LSR(unsigned int uiValue, unsigned int uiSteps)
{ {
return uiValue >> uiSteps; return uiValue >> uiSteps;
} }
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// //
// This one could be trickier since, i'm nor sure if a signed shift really is a signed shift. // This one could be trickier since, i'm nor sure if a signed shift really is a signed shift.
unsigned int ASR(unsigned int uiValue, unsigned int uiSteps) unsigned int ASR(unsigned int uiValue, unsigned int uiSteps)
{ {
@ -1625,7 +1625,7 @@ unsigned int ASR(unsigned int uiValue, unsigned int uiSteps)
} }
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// //
unsigned int ROR(unsigned int uiValue, unsigned int uiSteps) unsigned int ROR(unsigned int uiValue, unsigned int uiSteps)
{ {
unsigned int uiRetval; unsigned int uiRetval;
@ -1642,14 +1642,14 @@ unsigned int ROR(unsigned int uiValue, unsigned int uiSteps)
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// //
unsigned int Shift_Operand(unsigned int Rm, unsigned int amount, unsigned int shift) unsigned int Shift_Operand(unsigned int Rm, unsigned int amount, unsigned int shift)
{ {
unsigned int uiRegisterValue; unsigned int uiRegisterValue;
uiRegisterValue = g_Registers[Rm]; uiRegisterValue = g_Registers[Rm];
if (Rm == 0x0f) { if (Rm == 0x0f) {
// Rm is PC, and PC is offseted by 8. // Rm is PC, and PC is offseted by 8.
@ -1671,7 +1671,7 @@ unsigned int Shift_Operand(unsigned int Rm, unsigned int amount, unsigned int sh
case 3: // ROR case 3: // ROR
return ROR(uiRegisterValue, amount); return ROR(uiRegisterValue, amount);
break; break;
default: default:
break; break;
@ -1680,7 +1680,7 @@ unsigned int Shift_Operand(unsigned int Rm, unsigned int amount, unsigned int sh
} }
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// //
// Example <opcode> Rd, Rm, <shift> amount // Example <opcode> Rd, Rm, <shift> amount
unsigned int DecodeDPISR(dpisr Instr, unsigned int uiPC) unsigned int DecodeDPISR(dpisr Instr, unsigned int uiPC)
{ {
@ -1688,10 +1688,10 @@ unsigned int DecodeDPISR(dpisr Instr, unsigned int uiPC)
unsigned int uiRnVal = g_Registers[Instr.Rn]; unsigned int uiRnVal = g_Registers[Instr.Rn];
// Only do this i Pc is Rd // Only do this i Pc is Rd
if (Instr.Rd != 0x0f) return uiPC + 4; if (Instr.Rd != 0x0f) return uiPC + 4;
// The actual value that PC contains when executing this instruction is the instruction address+8 // The actual value that PC contains when executing this instruction is the instruction address+8
if (Instr.Rn == 0x0f) uiRnVal += 8; if (Instr.Rn == 0x0f) uiRnVal += 8;
@ -1702,11 +1702,11 @@ unsigned int DecodeDPISR(dpisr Instr, unsigned int uiPC)
case OPCODE_MVN: case OPCODE_MVN:
return ~uiOperand; return ~uiOperand;
case OPCODE_ADD: case OPCODE_ADD:
return uiRnVal + uiOperand; return uiRnVal + uiOperand;
case OPCODE_ADC: case OPCODE_ADC:
return uiRnVal + uiOperand + (((g_Registers[18] & (1 << 29))) == 0?0:1); return uiRnVal + uiOperand + (((g_Registers[18] & (1 << 29))) == 0?0:1);
case OPCODE_SUB: case OPCODE_SUB:
return uiRnVal - uiOperand; return uiRnVal - uiOperand;
case OPCODE_SBC: case OPCODE_SBC:
return uiRnVal - uiOperand - (((g_Registers[18] & (1 << 29))) == 0?1:0); return uiRnVal - uiOperand - (((g_Registers[18] & (1 << 29))) == 0?1:0);
case OPCODE_RSB: case OPCODE_RSB:
@ -1728,7 +1728,7 @@ unsigned int DecodeDPISR(dpisr Instr, unsigned int uiPC)
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// //
//dprrs; // Data Processing Register Register Shift //dprrs; // Data Processing Register Register Shift
// Example <opcode> Rd, Rn, Rm <shift> Rs // Example <opcode> Rd, Rn, Rm <shift> Rs
unsigned int DecodeDPRRS(dprrs Instr, unsigned int uiPC) unsigned int DecodeDPRRS(dprrs Instr, unsigned int uiPC)
@ -1752,11 +1752,11 @@ unsigned int DecodeDPRRS(dprrs Instr, unsigned int uiPC)
case OPCODE_MVN: case OPCODE_MVN:
return ~uiOperand; return ~uiOperand;
case OPCODE_ADD: case OPCODE_ADD:
return uiRnVal + uiOperand; return uiRnVal + uiOperand;
case OPCODE_ADC: case OPCODE_ADC:
return uiRnVal + uiOperand + (((g_Registers[18] & (1 << 29))) == 0?0:1); return uiRnVal + uiOperand + (((g_Registers[18] & (1 << 29))) == 0?0:1);
case OPCODE_SUB: case OPCODE_SUB:
return uiRnVal - uiOperand; return uiRnVal - uiOperand;
case OPCODE_SBC: case OPCODE_SBC:
return uiRnVal - uiOperand - (((g_Registers[18] & (1 << 29))) == 0?1:0); return uiRnVal - uiOperand - (((g_Registers[18] & (1 << 29))) == 0?1:0);
case OPCODE_RSB: case OPCODE_RSB:
@ -1778,7 +1778,7 @@ unsigned int DecodeDPRRS(dprrs Instr, unsigned int uiPC)
} }
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// //
// dpi; // Data processing immediate // dpi; // Data processing immediate
// example add r0, r1, (ror <immed>, <rotate * 2>) // example add r0, r1, (ror <immed>, <rotate * 2>)
unsigned int DecodeDPI(dpi Instr, unsigned int uiPC) unsigned int DecodeDPI(dpi Instr, unsigned int uiPC)
@ -1797,11 +1797,11 @@ unsigned int DecodeDPI(dpi Instr, unsigned int uiPC)
case OPCODE_MVN: case OPCODE_MVN:
return ~uiOperand; return ~uiOperand;
case OPCODE_ADD: case OPCODE_ADD:
return uiRnVal + uiOperand; return uiRnVal + uiOperand;
case OPCODE_ADC: case OPCODE_ADC:
return uiRnVal + uiOperand + (((g_Registers[18] & (1 << 29))) == 0?0:1); return uiRnVal + uiOperand + (((g_Registers[18] & (1 << 29))) == 0?0:1);
case OPCODE_SUB: case OPCODE_SUB:
return uiRnVal - uiOperand; return uiRnVal - uiOperand;
case OPCODE_SBC: case OPCODE_SBC:
return uiRnVal - uiOperand - (((g_Registers[18] & (1 << 29))) == 0?1:0); return uiRnVal - uiOperand - (((g_Registers[18] & (1 << 29))) == 0?1:0);
case OPCODE_RSB: case OPCODE_RSB:
@ -1823,7 +1823,7 @@ unsigned int DecodeDPI(dpi Instr, unsigned int uiPC)
} }
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// //
// lsio; // Load/store immediate offset // lsio; // Load/store immediate offset
// Example ldr Rd, [Rn, #<immed>] // Example ldr Rd, [Rn, #<immed>]
unsigned int DecodeLSIO(lsio Instr, unsigned int uiPC) unsigned int DecodeLSIO(lsio Instr, unsigned int uiPC)
@ -1840,7 +1840,7 @@ unsigned int DecodeLSIO(lsio Instr, unsigned int uiPC)
// Check if it's pre-indexed // Check if it's pre-indexed
if (Instr.p == 1){ if (Instr.p == 1){
if (Instr.U == 1) { if (Instr.U == 1) {
// Add offset // Add offset
uiRnValue += Instr.immed; uiRnValue += Instr.immed;
@ -1857,7 +1857,7 @@ unsigned int DecodeLSIO(lsio Instr, unsigned int uiPC)
} }
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// //
// lsro; // Load/Store register offset // lsro; // Load/Store register offset
// Example ldr Rd, [Rn + Rm lsl 5] // Example ldr Rd, [Rn + Rm lsl 5]
unsigned int DecodeLSRO(lsro Instr, unsigned int uiPC) unsigned int DecodeLSRO(lsro Instr, unsigned int uiPC)
@ -1876,7 +1876,7 @@ unsigned int DecodeLSRO(lsro Instr, unsigned int uiPC)
uiIndex = Shift_Operand(Instr.Rm, Instr.amount, Instr.shift); uiIndex = Shift_Operand(Instr.Rm, Instr.amount, Instr.shift);
if (Instr.p == 1){ if (Instr.p == 1){
if (Instr.U == 1) { if (Instr.U == 1) {
// Add offset // Add offset
uiRnValue += uiIndex; uiRnValue += uiIndex;
@ -1893,7 +1893,7 @@ unsigned int DecodeLSRO(lsro Instr, unsigned int uiPC)
} }
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// //
// lsm; // Load store multiple // lsm; // Load store multiple
// Example: ldm r0, {r1, r2, r3} // Example: ldm r0, {r1, r2, r3}
unsigned int DecodeLSM(lsm Instr, unsigned int uiPC) unsigned int DecodeLSM(lsm Instr, unsigned int uiPC)
@ -1922,7 +1922,7 @@ unsigned int DecodeLSM(lsm Instr, unsigned int uiPC)
for (int i = 0; i < 15; i++) { for (int i = 0; i < 15; i++) {
if ((Instr.regs & (1 << i)) != 0) uiOffsetToPC += 4; if ((Instr.regs & (1 << i)) != 0) uiOffsetToPC += 4;
} }
// If the P bit is set, it uses pre increment // If the P bit is set, it uses pre increment
if (Instr.p == 1) uiOffsetToPC += 4; if (Instr.p == 1) uiOffsetToPC += 4;
} }
@ -1935,7 +1935,7 @@ unsigned int DecodeLSM(lsm Instr, unsigned int uiPC)
} }
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// //
// bl; // Branch with link(optional) // bl; // Branch with link(optional)
unsigned int DecodeBL(bl Instr, unsigned int uiPC) unsigned int DecodeBL(bl Instr, unsigned int uiPC)
{ {

File diff suppressed because it is too large Load diff

Some files were not shown because too many files have changed in this diff Show more