winCE part 2 - still gui.cpp and scummvm.cpp left
svn-id: r3752
This commit is contained in:
parent
d8ca3d2987
commit
d8adad386f
6 changed files with 319 additions and 14 deletions
56
gapi_keys.h
Normal file
56
gapi_keys.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
#ifdef _WIN32_WCE
|
||||
|
||||
typedef void (*pAction)();
|
||||
|
||||
enum ActionType {
|
||||
ACTION_NONE = 0,
|
||||
ACTION_PAUSE = 1,
|
||||
ACTION_SAVE = 2,
|
||||
ACTION_QUIT = 3,
|
||||
ACTION_SKIP = 4,
|
||||
ACTION_HIDE = 5,
|
||||
ACTION_KEYBOARD = 6,
|
||||
ACTION_SOUND = 7,
|
||||
ACTION_RIGHTCLICK = 8
|
||||
};
|
||||
|
||||
struct oneAction {
|
||||
unsigned char action_key;
|
||||
int action_type;
|
||||
};
|
||||
|
||||
|
||||
#define NUMBER_ACTIONS 5
|
||||
#define TOTAL_ACTIONS 8
|
||||
|
||||
#define GAPI_KEY_BASE 1000
|
||||
#define GAPI_KEY_VKA 1
|
||||
#define GAPI_KEY_VKB 2
|
||||
#define GAPI_KEY_VKC 3
|
||||
#define GAPI_KEY_VKSTART 4
|
||||
#define GAPI_KEY_CALENDAR 5
|
||||
#define GAPI_KEY_CONTACTS 6
|
||||
#define GAPI_KEY_INBOX 7
|
||||
#define GAPI_KEY_ITASK 8
|
||||
|
||||
#define INTERNAL_KEY_CALENDAR 0xc1
|
||||
#define INTERNAL_KEY_CONTACTS 0xc2
|
||||
#define INTERNAL_KEY_INBOX 0xc3
|
||||
#define INTERNAL_KEY_ITASK 0xc4
|
||||
|
||||
void GAPIKeysInit(pAction*);
|
||||
void GAPIKeysGetReference(void);
|
||||
const unsigned char getGAPIKeyMapping(short);
|
||||
const char* getGAPIKeyName(unsigned char);
|
||||
struct oneAction* getAction(int);
|
||||
void processAction (short);
|
||||
void clearActionKey (unsigned char);
|
||||
const unsigned char* getActionKeys(void);
|
||||
void setActionKeys(unsigned char *);
|
||||
const char* getActionName(int);
|
||||
void setActionTypes(unsigned char *);
|
||||
const unsigned char* getActionTypes();
|
||||
void setNextType(int);
|
||||
void setPreviousType(int);
|
||||
|
||||
#endif
|
|
@ -1159,7 +1159,9 @@ void Scumm::drawEnqueuedObject(EnqueuedObject *eo) {
|
|||
|
||||
assert(ptr);
|
||||
ptr = findResource(IMxx_tags[eo->l], ptr);
|
||||
assert(ptr);
|
||||
// assert(ptr);
|
||||
if (!ptr) /* FIXME: Sam and Max highway subgame */
|
||||
return;
|
||||
bomp = findResourceData(MKID('BOMP'), ptr);
|
||||
|
||||
bdd.srcwidth = READ_LE_UINT16(&((BompHeader*)bomp)->width);
|
||||
|
|
227
saveload.cpp
227
saveload.cpp
|
@ -30,8 +30,24 @@ struct SaveGameHeader {
|
|||
char name[32];
|
||||
};
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
// Support for "old" savegames (made with 2501 CVS build)
|
||||
// Can be useful for other ports too :)
|
||||
|
||||
#define VER_V8 8
|
||||
#define VER_V7 7
|
||||
|
||||
#define CURRENT_VER VER_V8
|
||||
|
||||
static uint32 _current_version = CURRENT_VER;
|
||||
|
||||
#else
|
||||
|
||||
#define CURRENT_VER 7
|
||||
|
||||
#endif
|
||||
|
||||
bool Scumm::saveState(int slot, bool compat) {
|
||||
char filename[256];
|
||||
SerializerStream out;
|
||||
|
@ -47,7 +63,16 @@ bool Scumm::saveState(int slot, bool compat) {
|
|||
|
||||
hdr.type = MKID('SCVM');
|
||||
hdr.size = 0;
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
hdr.ver = _current_version;
|
||||
|
||||
#else
|
||||
|
||||
hdr.ver = CURRENT_VER;
|
||||
|
||||
#endif
|
||||
|
||||
out.fwrite(&hdr, sizeof(hdr), 1);
|
||||
|
||||
|
@ -79,12 +104,27 @@ bool Scumm::loadState(int slot, bool compat) {
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
if (hdr.ver != VER_V8 && hdr.ver != VER_V7) {
|
||||
|
||||
#else
|
||||
|
||||
if (hdr.ver != CURRENT_VER) {
|
||||
|
||||
#endif
|
||||
|
||||
warning("Invalid version of '%s'", filename);
|
||||
out.fclose();
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
_current_version = hdr.ver;
|
||||
|
||||
#endif
|
||||
|
||||
memcpy(_saveLoadName, hdr.name, sizeof(hdr.name));
|
||||
|
||||
pauseSounds(true);
|
||||
|
@ -144,14 +184,24 @@ bool Scumm::loadState(int slot, bool compat) {
|
|||
}
|
||||
|
||||
void Scumm::makeSavegameName(char *out, int slot, bool compatible) {
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
|
||||
#if !defined(__APPLE__CW)
|
||||
const char *dir = getenv("SCUMMVM_SAVEPATH");
|
||||
if (dir==NULL) dir="";
|
||||
#else
|
||||
const char *dir = "";
|
||||
#endif
|
||||
|
||||
/* snprintf should be used here, but it's not portable enough */
|
||||
sprintf(out, "%s%s.%c%.2d", dir, _exe_name, compatible ? 'c': 's', slot);
|
||||
|
||||
#else
|
||||
|
||||
sprintf(out, "%s%s.%c%.2d", _savegame_dir, _exe_name, compatible ? 'c': 's', slot);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Scumm::getSavegameName(int slot, char *desc) {
|
||||
|
@ -172,8 +222,17 @@ bool Scumm::getSavegameName(int slot, char *desc) {
|
|||
strcpy(desc, "Invalid savegame");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (hdr.ver != CURRENT_VER) {
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
if (hdr.ver != VER_V8 && hdr.ver != VER_V7) {
|
||||
|
||||
#else
|
||||
|
||||
if (hdr.ver != CURRENT_VER) {
|
||||
|
||||
#endif
|
||||
|
||||
strcpy(desc, "Invalid version");
|
||||
return false;
|
||||
}
|
||||
|
@ -306,7 +365,130 @@ void Scumm::saveOrLoad(Serializer *s) {
|
|||
MKEND()
|
||||
};
|
||||
|
||||
const SaveLoadEntry mainEntries[] = {
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
const SaveLoadEntry mainEntries1[] = {
|
||||
MKLINE(Scumm,_scrWidth,sleUint16),
|
||||
MKLINE(Scumm,_scrHeight,sleUint16),
|
||||
MKLINE(Scumm,_ENCD_offs,sleUint32),
|
||||
MKLINE(Scumm,_EXCD_offs,sleUint32),
|
||||
MKLINE(Scumm,_IM00_offs,sleUint32),
|
||||
MKLINE(Scumm,_CLUT_offs,sleUint32),
|
||||
MKLINE(Scumm,_EPAL_offs,sleUint32),
|
||||
MKLINE(Scumm,_PALS_offs,sleUint32),
|
||||
MKLINE(Scumm,_curPalIndex,sleByte),
|
||||
MKLINE(Scumm,_currentRoom,sleByte),
|
||||
MKLINE(Scumm,_roomResource,sleByte),
|
||||
MKLINE(Scumm,_numObjectsInRoom,sleByte),
|
||||
MKLINE(Scumm,_currentScript,sleByte),
|
||||
MKARRAY(Scumm,_localScriptList[0],sleUint32,NUM_LOCALSCRIPT),
|
||||
MKARRAY(Scumm,vm.localvar[0][0],sleUint16,NUM_SCRIPT_SLOT*17),
|
||||
MKARRAY(Scumm,_resourceMapper[0],sleByte,128),
|
||||
MKARRAY(Scumm,charset._colorMap[0],sleByte,16),
|
||||
MKARRAY(Scumm,_charsetData[0][0],sleByte,10*16),
|
||||
MKLINE(Scumm,_curExecScript,sleUint16),
|
||||
MKEND()
|
||||
};
|
||||
|
||||
const SaveLoadEntry mainEntries2V8[] = {
|
||||
|
||||
MKLINE(Scumm,camera._dest.x,sleInt16),
|
||||
MKLINE(Scumm,camera._dest.y,sleInt16),
|
||||
MKLINE(Scumm,camera._cur.x,sleInt16),
|
||||
MKLINE(Scumm,camera._cur.y,sleInt16),
|
||||
MKLINE(Scumm,camera._last.x,sleInt16),
|
||||
MKLINE(Scumm,camera._last.y,sleInt16),
|
||||
MKLINE(Scumm,camera._accel.x,sleInt16),
|
||||
MKLINE(Scumm,camera._accel.y,sleInt16),
|
||||
MKLINE(Scumm,_screenStartStrip,sleInt16),
|
||||
MKLINE(Scumm,_screenEndStrip,sleInt16),
|
||||
MKLINE(Scumm,camera._mode,sleByte),
|
||||
MKLINE(Scumm,camera._follows,sleByte),
|
||||
MKLINE(Scumm,camera._leftTrigger,sleInt16),
|
||||
MKLINE(Scumm,camera._rightTrigger,sleInt16),
|
||||
MKLINE(Scumm,camera._movingToActor,sleUint16),
|
||||
MKEND()
|
||||
};
|
||||
|
||||
const SaveLoadEntry mainEntries2V7[] = {
|
||||
MKLINE(Scumm,camera._dest.x,sleInt16),
|
||||
MKLINE(Scumm,camera._cur.x,sleInt16),
|
||||
MKLINE(Scumm,camera._last.x,sleInt16),
|
||||
MKLINE(Scumm,_screenStartStrip,sleInt16),
|
||||
MKLINE(Scumm,_screenEndStrip,sleInt16),
|
||||
MKLINE(Scumm,camera._mode,sleByte),
|
||||
MKLINE(Scumm,camera._follows,sleByte),
|
||||
MKLINE(Scumm,camera._leftTrigger,sleInt16),
|
||||
MKLINE(Scumm,camera._rightTrigger,sleInt16),
|
||||
MKLINE(Scumm,camera._movingToActor,sleUint16),
|
||||
MKEND()
|
||||
};
|
||||
|
||||
const SaveLoadEntry mainEntries3[] = {
|
||||
|
||||
MKLINE(Scumm,_actorToPrintStrFor,sleByte),
|
||||
MKLINE(Scumm,_charsetColor,sleByte),
|
||||
/* XXX Convert into word next time format changes */
|
||||
MKLINE(Scumm,charset._bufPos,sleByte),
|
||||
MKLINE(Scumm,_haveMsg,sleByte),
|
||||
MKLINE(Scumm,_useTalkAnims,sleByte),
|
||||
|
||||
MKLINE(Scumm,_talkDelay,sleInt16),
|
||||
MKLINE(Scumm,_defaultTalkDelay,sleInt16),
|
||||
MKLINE(Scumm,_numInMsgStack,sleInt16),
|
||||
MKLINE(Scumm,_sentenceNum,sleByte),
|
||||
|
||||
MKLINE(Scumm,vm.cutSceneStackPointer,sleByte),
|
||||
MKARRAY(Scumm,vm.cutScenePtr[0],sleUint32,5),
|
||||
MKARRAY(Scumm,vm.cutSceneScript[0],sleByte,5),
|
||||
MKARRAY(Scumm,vm.cutSceneData[0],sleInt16,5),
|
||||
MKLINE(Scumm,vm.cutSceneScriptIndex,sleInt16),
|
||||
|
||||
/* nest */
|
||||
MKLINE(Scumm,_numNestedScripts,sleByte),
|
||||
MKLINE(Scumm,_userPut,sleByte),
|
||||
MKLINE(Scumm,_cursorState,sleByte),
|
||||
MKLINE(Scumm,gdi._cursorActive,sleByte),
|
||||
MKLINE(Scumm,gdi._currentCursor,sleByte),
|
||||
|
||||
MKLINE(Scumm,_doEffect,sleByte),
|
||||
MKLINE(Scumm,_switchRoomEffect,sleByte),
|
||||
MKLINE(Scumm,_newEffect,sleByte),
|
||||
MKLINE(Scumm,_switchRoomEffect2,sleByte),
|
||||
MKLINE(Scumm,_BgNeedsRedraw,sleByte),
|
||||
|
||||
MKARRAY(Scumm,gfxUsageBits[0],sleUint32,200),
|
||||
MKLINE(Scumm,gdi._transparency,sleByte),
|
||||
MKARRAY(Scumm,_currentPalette[0],sleByte,768),
|
||||
/* virtscr */
|
||||
|
||||
MKARRAY(Scumm,charset._buffer[0],sleByte,256),
|
||||
|
||||
MKLINE(Scumm,_egoPositioned,sleByte),
|
||||
|
||||
MKARRAY(Scumm,gdi._imgBufOffs[0],sleUint16,4),
|
||||
MKLINE(Scumm,gdi._numZBuffer,sleByte),
|
||||
|
||||
MKLINE(Scumm,_screenEffectFlag,sleByte),
|
||||
|
||||
MKLINE(Scumm,_randSeed1,sleUint32),
|
||||
MKLINE(Scumm,_randSeed2,sleUint32),
|
||||
|
||||
/* XXX: next time the save game format changes,
|
||||
* convert _shakeEnabled to boolean and add a _shakeFrame field */
|
||||
MKLINE(Scumm,_shakeEnabled,sleInt16),
|
||||
|
||||
MKLINE(Scumm,_keepText,sleByte),
|
||||
|
||||
MKLINE(Scumm,_screenB,sleUint16),
|
||||
MKLINE(Scumm,_screenH,sleUint16),
|
||||
|
||||
MKEND()
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
const SaveLoadEntry mainEntries[] = {
|
||||
MKLINE(Scumm,_scrWidth,sleUint16),
|
||||
MKLINE(Scumm,_scrHeight,sleUint16),
|
||||
MKLINE(Scumm,_ENCD_offs,sleUint32),
|
||||
|
@ -403,6 +585,8 @@ void Scumm::saveOrLoad(Serializer *s) {
|
|||
MKEND()
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
const SaveLoadEntry scriptSlotEntries[] = {
|
||||
MKLINE(ScriptSlot,offs,sleUint32),
|
||||
MKLINE(ScriptSlot,delay,sleInt32),
|
||||
|
@ -468,9 +652,30 @@ void Scumm::saveOrLoad(Serializer *s) {
|
|||
int var120Backup;
|
||||
int var98Backup;
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
s->saveLoadEntries(this, mainEntries1);
|
||||
s->saveLoadEntries(this, (_current_version == VER_V8 ? mainEntries2V8 : mainEntries2V7));
|
||||
s->saveLoadEntries(this, mainEntries3);
|
||||
|
||||
#else
|
||||
|
||||
s->saveLoadEntries(this,mainEntries);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
// Probably not necessary anymore with latest NUM_ACTORS values
|
||||
|
||||
s->saveLoadArrayOf(actor, (_current_version == VER_V8 ? NUM_ACTORS : 13), sizeof(actor[0]), actorEntries);
|
||||
|
||||
#else
|
||||
|
||||
s->saveLoadArrayOf(actor, NUM_ACTORS, sizeof(actor[0]), actorEntries);
|
||||
|
||||
#endif
|
||||
|
||||
s->saveLoadArrayOf(vm.slot, NUM_SCRIPT_SLOT, sizeof(vm.slot[0]), scriptSlotEntries);
|
||||
s->saveLoadArrayOf(_objs, _numLocalObjects, sizeof(_objs[0]), objectEntries);
|
||||
s->saveLoadArrayOf(_verbs, _numVerbs, sizeof(_verbs[0]), verbEntries);
|
||||
|
@ -570,6 +775,22 @@ void Serializer::saveLoadBytes(void *b, int len) {
|
|||
_saveLoadStream.fread(b, 1, len);
|
||||
}
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
// Perhaps not necessary anymore with latest checks
|
||||
|
||||
bool Serializer::checkEOFLoadStream() {
|
||||
if (!fseek(_saveLoadStream.out, 1, SEEK_CUR))
|
||||
return true;
|
||||
if (feof(_saveLoadStream.out))
|
||||
return true;
|
||||
fseek(_saveLoadStream.out, -1, SEEK_CUR);
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void Serializer::saveUint32(uint32 d) {
|
||||
uint32 e = FROM_LE_32(d);
|
||||
saveLoadBytes(&e,4);
|
||||
|
|
21
scumm.h
21
scumm.h
|
@ -28,8 +28,13 @@
|
|||
#define Point SCUMM_Point
|
||||
#endif
|
||||
|
||||
#define SCUMMVM_VERSION "0.1.0 devel"
|
||||
#define SCUMMVM_VERSION "0.2.0 devel"
|
||||
#ifdef _WIN32_WCE
|
||||
// Additional build information for easier bug report
|
||||
|
||||
#define POCKETSCUMM_BUILD "031302"
|
||||
#define SCUMMVM_CVS "031002"
|
||||
#endif
|
||||
#define SWAP(a,b) do{int tmp=a; a=b; b=tmp; } while(0)
|
||||
#define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0]))
|
||||
|
||||
|
@ -48,7 +53,8 @@ enum {
|
|||
NUM_SCRIPT_SLOT = 25,
|
||||
NUM_LOCALSCRIPT = 60,
|
||||
NUM_SHADOW_PALETTE = 8,
|
||||
MAX_ACTORS = 30
|
||||
MAX_ACTORS = 30,
|
||||
KEY_SET_OPTIONS = 3456 // WinCE
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -890,7 +896,7 @@ struct Scumm {
|
|||
void *_sfxFile;
|
||||
char *_exe_name;
|
||||
char *_gameDataPath;
|
||||
|
||||
char *_savegame_dir;
|
||||
int akos_findManyDirection(int16 ManyDirection, uint16 facing);
|
||||
|
||||
byte _saveLoadFlag;
|
||||
|
@ -901,7 +907,7 @@ struct Scumm {
|
|||
byte _resFilePathId;
|
||||
|
||||
bool _soundsPaused;
|
||||
|
||||
bool _soundsPaused2;
|
||||
bool _useTalkAnims;
|
||||
|
||||
char *_resFilePrefix;
|
||||
|
@ -1071,7 +1077,11 @@ struct Scumm {
|
|||
|
||||
int16 _palManipStart;
|
||||
int16 _palManipEnd;
|
||||
int16 _palManipCounter;
|
||||
int16 _palManipCounter;
|
||||
|
||||
int16 _sound_volume_master;
|
||||
int16 _sound_volume_music;
|
||||
int16 _sound_volume_sfx;
|
||||
|
||||
struct {
|
||||
byte mode[rtNumTypes];
|
||||
|
@ -1746,6 +1756,7 @@ struct Scumm {
|
|||
void removeObjectFromRoom(int obj);
|
||||
void decodeParseString();
|
||||
void pauseGame(bool user);
|
||||
// FIXME void setOptions(void);
|
||||
void shutDown(int i);
|
||||
void lock(int type, int i);
|
||||
void unlock(int type, int i);
|
||||
|
|
|
@ -124,7 +124,12 @@ void AdlibSoundDriver::init(SoundEngine *eng) {
|
|||
}
|
||||
|
||||
_adlib_reg_cache = (byte*)calloc(256,1);
|
||||
_opl = OPLCreate(OPL_TYPE_YM3812,3579545,22050);
|
||||
|
||||
#ifdef _WIN32_WCE // Poor WIN32 won't handle 22050 well !
|
||||
_opl = OPLCreate(OPL_TYPE_YM3812,3579545,11025);
|
||||
#else
|
||||
_opl = OPLCreate(OPL_TYPE_YM3812,3579545,22050);
|
||||
#endif
|
||||
adlib_write(1,0x20);
|
||||
adlib_write(8,0x40);
|
||||
adlib_write(0xBD, 0x00);
|
||||
|
|
|
@ -28,12 +28,17 @@ int num_mix;
|
|||
#define TICKS_PER_BEAT 480
|
||||
|
||||
#ifdef USE_ADLIB
|
||||
#define TEMPO_BASE 0x1924E0
|
||||
#define HARDWARE_TYPE 1
|
||||
#ifdef _WIN32_WCE
|
||||
#define TEMPO_BASE 0x1F0000 * 2 // Sampled down to 11 kHz
|
||||
#else
|
||||
#define TEMPO_BASE 0x1924E0
|
||||
#endif
|
||||
#define HARDWARE_TYPE 1
|
||||
#else
|
||||
#define TEMPO_BASE 0x400000
|
||||
#define HARDWARE_TYPE 5
|
||||
#define TEMPO_BASE 0x400000
|
||||
#define HARDWARE_TYPE 5
|
||||
#endif
|
||||
|
||||
#define SYSEX_ID 0x7D
|
||||
#define SPECIAL_CHANNEL 9
|
||||
|
||||
|
@ -2111,6 +2116,11 @@ int SoundEngine::save_or_load(Serializer *ser) {
|
|||
stop_all_sounds();
|
||||
}
|
||||
|
||||
#ifdef _WIN32_WCE // Don't break savegames made with andys' build
|
||||
if (!ser->isSaving() && ser->checkEOFLoadStream())
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
ser->_ref_me = this;
|
||||
ser->_saveload_ref = ser->isSaving() ? ((void*)&saveReference) : ((void*)&loadReference);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue