本文整理汇总了C++中READ_BE_UINT16函数的典型用法代码示例。如果您正苦于以下问题:C++ READ_BE_UINT16函数的具体用法?C++ READ_BE_UINT16怎么用?C++ READ_BE_UINT16使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了READ_BE_UINT16函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: READ_BE_UINT16
void AGOSEngine::dumpVgaFile(const byte *vga) {
const byte *pp;
const byte *p;
int16 count;
pp = vga;
p = pp + READ_BE_UINT16(pp + 10) + 20;
count = READ_BE_UINT16(&((const VgaFile1Header_Common *) p)->animationCount);
p = pp + READ_BE_UINT16(&((const VgaFile1Header_Common *) p)->animationTable);
while (--count >= 0) {
uint16 id = READ_BE_UINT16(&((const AnimationHeader_WW *) p)->id);
dumpVgaScriptAlways(vga + READ_BE_UINT16(&((const AnimationHeader_WW *) p)->scriptOffs), id / 100, id);
p += sizeof(AnimationHeader_WW);
}
pp = vga;
p = pp + READ_BE_UINT16(pp + 10) + 20;
count = READ_BE_UINT16(&((const VgaFile1Header_Common *) p)->imageCount);
p = pp + READ_BE_UINT16(&((const VgaFile1Header_Common *) p)->imageTable);
while (--count >= 0) {
uint16 id = READ_BE_UINT16(&((const ImageHeader_WW *) p)->id);
dumpVgaScriptAlways(vga + READ_BE_UINT16(&((const ImageHeader_WW *) p)->scriptOffs), id / 100, id);
p += sizeof(ImageHeader_WW);
}
}
开发者ID:havlenapetr,项目名称:Scummvm,代码行数:29,代码来源:debug.cpp
示例2: lock
void IMuseDigital::getLipSync(int soundId, int syncId, int32 msPos, int32 &width, int32 &height) {
int32 sync_size;
byte *sync_ptr;
msPos /= 16;
if (msPos < 65536) {
Common::StackLock lock(_mutex, "IMuseDigital::getLipSync()");
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
Track *track = _track[l];
if (track->used && !track->toBeRemoved && (track->soundId == soundId)) {
_sound->getSyncSizeAndPtrById(track->soundDesc, syncId, sync_size, &sync_ptr);
if ((sync_size != 0) && (sync_ptr != NULL)) {
sync_size /= 4;
while (sync_size--) {
if (READ_BE_UINT16(sync_ptr) >= msPos)
break;
sync_ptr += 4;
}
if (sync_size < 0)
sync_ptr -= 4;
else
if (READ_BE_UINT16(sync_ptr) > msPos)
sync_ptr -= 4;
width = sync_ptr[2];
height = sync_ptr[3];
return;
}
}
}
}
}
开发者ID:BenCastricum,项目名称:scummvm,代码行数:32,代码来源:dimuse_script.cpp
示例3: debug
void SfxPlayer::loadSfxModule(uint16_t resNum, uint16_t delay, uint8_t pos) {
debug(DBG_SND, "SfxPlayer::loadSfxModule(0x%X, %d, %d)", resNum, delay, pos);
MutexStack(sys, _mutex);
MemEntry *me = &res->_memList[resNum];
if (me->state == 1 && me->type == Resource::RT_MUSIC) {
_resNum = resNum;
memset(&_sfxMod, 0, sizeof(SfxModule));
_sfxMod.curOrder = pos;
_sfxMod.numOrder = READ_BE_UINT16(me->bufPtr + 0x3E);
debug(DBG_SND, "SfxPlayer::loadSfxModule() curOrder = 0x%X numOrder = 0x%X", _sfxMod.curOrder, _sfxMod.numOrder);
for (int i = 0; i < 0x80; ++i) {
_sfxMod.orderTable[i] = *(me->bufPtr + 0x40 + i);
}
if (delay == 0) {
_delay = READ_BE_UINT16(me->bufPtr);
} else {
_delay = delay;
}
_delay = _delay * 60 / 7050;
_sfxMod.data = me->bufPtr + 0xC0;
debug(DBG_SND, "SfxPlayer::loadSfxModule() eventDelay = %d ms", _delay);
prepareInstruments(me->bufPtr + 2);
} else {
warning("SfxPlayer::loadSfxModule() ec=0x%X", 0xF8);
}
}
开发者ID:crito,项目名称:Another-World-Bytecode-Interpreter,代码行数:30,代码来源:sfxplayer.cpp
示例4: loadRel
void loadRel(char *pRelName) {
uint16 numEntry;
uint16 i;
byte *ptr;
checkDataDisk(-1);
for (i = 0; i < NUM_MAX_REL; i++) {
if (relTable[i].data) {
free(relTable[i].data);
relTable[i].data = NULL;
relTable[i].size = 0;
}
}
ptr = readBundleFile(findFileInBundle(pRelName));
setMouseCursor(MOUSE_CURSOR_DISK);
numEntry = READ_BE_UINT16(ptr); ptr += 2;
assert(numEntry <= NUM_MAX_REL);
for (i = 0; i < numEntry; i++) {
relTable[i].size = READ_BE_UINT16(ptr); ptr += 2;
relTable[i].obj1Param1 = READ_BE_UINT16(ptr); ptr += 2;
relTable[i].obj1Param2 = READ_BE_UINT16(ptr); ptr += 2;
relTable[i].obj2Param = READ_BE_UINT16(ptr); ptr += 2;
}
for (i = 0; i < numEntry; i++) {
if (relTable[i].size) {
relTable[i].data = (byte *)malloc(relTable[i].size);
assert(relTable[i].data);
memcpy(relTable[i].data, ptr, relTable[i].size);
ptr += relTable[i].size;
}
}
#ifdef DUMP_SCRIPTS
{
uint16 s;
char buffer[256];
for (s = 0; s < numEntry; s++) {
if (relTable[s].size) {
sprintf(buffer, "%s_%03d.txt", pRelName, s);
decompileScript(relTable[s].data, NULL, relTable[s].size, s);
dumpScript(buffer);
}
}
}
#endif
}
开发者ID:iPodLinux-Community,项目名称:iScummVM,代码行数:58,代码来源:rel.cpp
示例5: loadRel
/*! \todo Is script size of 0 valid?
* \todo Fix script dump code
*/
void loadRel(char *pRelName) {
uint16 numEntry;
uint16 i;
uint16 size, p1, p2, p3;
byte *ptr, *dataPtr;
checkDataDisk(-1);
objectScripts.clear();
relTable.clear();
ptr = dataPtr = readBundleFile(findFileInBundle(pRelName));
setMouseCursor(MOUSE_CURSOR_DISK);
numEntry = READ_BE_UINT16(ptr); ptr += 2;
for (i = 0; i < numEntry; i++) {
size = READ_BE_UINT16(ptr); ptr += 2;
p1 = READ_BE_UINT16(ptr); ptr += 2;
p2 = READ_BE_UINT16(ptr); ptr += 2;
p3 = READ_BE_UINT16(ptr); ptr += 2;
RawObjectScriptPtr tmp(new RawObjectScript(size, p1, p2, p3));
assert(tmp);
relTable.push_back(tmp);
}
for (i = 0; i < numEntry; i++) {
size = relTable[i]->_size;
// TODO: delete the test?
if (size) {
relTable[i]->setData(*scriptInfo, ptr);
ptr += size;
}
}
free(dataPtr);
#ifdef DUMP_SCRIPTS
{
uint16 s;
char buffer[256];
for (s = 0; s < numEntry; s++) {
if (relTable[s]->_size) {
sprintf(buffer, "%s_%03d.txt", pRelName, s);
decompileScript((const byte *)relTable[s]->getString(0), relTable[s]->_size, s);
dumpScript(buffer);
}
}
}
#endif
}
开发者ID:havlenapetr,项目名称:Scummvm,代码行数:58,代码来源:rel.cpp
示例6: debug
bool Player_V3M::loadMusic(const byte *ptr) {
Common::MacResManager resource;
bool found = false;
for (int i = 0; i < ARRAYSIZE(loomFileNames); i++) {
if (resource.open(loomFileNames[i])) {
found = true;
break;
}
}
if (!found) {
return false;
}
if (ptr[4] != 's' || ptr[5] != 'o') {
// Like the original we ignore all sound resources which do not have
// a 'so' tag in them.
// See bug #3602239 ("Mac Loom crashes using opening spell on
// gravestone") for a case where this is required. Loom Mac tries to
// play resource 11 here. This resource is no Mac sound resource
// though, it is a PC Speaker resource. A test with the original
// interpreter also has shown that no sound is played while the
// screen is shaking.
debug(5, "Player_V3M::loadMusic: Skipping unknown music type %02X%02X", ptr[4], ptr[5]);
resource.close();
return false;
}
uint i;
for (i = 0; i < 5; i++) {
int instrument = READ_BE_UINT16(ptr + 20 + 2 * i);
int offset = READ_BE_UINT16(ptr + 30 + 2 * i);
_channel[i]._looped = false;
_channel[i]._length = READ_BE_UINT16(ptr + offset + 4) * 3;
_channel[i]._data = ptr + offset + 6;
_channel[i]._pos = 0;
_channel[i]._pitchModifier = 0;
_channel[i]._velocity = 0;
_channel[i]._remaining = 0;
_channel[i]._notesLeft = true;
Common::SeekableReadStream *stream = resource.getResource(RES_SND, instrument);
if (_channel[i].loadInstrument(stream)) {
debug(6, "Player_V3M::loadMusic: Channel %d - Loaded Instrument %d (%s)", i, instrument, resource.getResName(RES_SND, instrument).c_str());
} else {
resource.close();
return false;
}
}
resource.close();
return true;
}
开发者ID:bradparks,项目名称:scummvm,代码行数:55,代码来源:player_v3m.cpp
示例7: playSoundRaw
void playSoundRaw(uint8_t channel, const uint8_t *data, uint16_t freq, uint8_t volume) {
int len = READ_BE_UINT16(data) * 2;
const int loopLen = READ_BE_UINT16(data + 2) * 2;
if (loopLen != 0) {
len = loopLen;
}
uint8_t *sample = convertToWav(data + 8, freq, len);
if (sample) {
playSoundWav(channel, sample, volume, (loopLen != 0) ? -1 : 0);
free(sample);
}
}
开发者ID:vanfanel,项目名称:rawgl,代码行数:12,代码来源:mixer.cpp
示例8: warning
void Sound::playSound(uint16 sound, uint16 volume, uint8 channel) {
if (channel == 0)
_mixer->stopID(SOUND_CH0);
else
_mixer->stopID(SOUND_CH1);
if (!_soundData) {
warning("Sound::playSound(%04X, %04X) called with a section having been loaded", sound, volume);
return;
}
if (sound > _soundsTotal) {
debug(5, "Sound::playSound %d ignored, only %d sfx in file", sound, _soundsTotal);
return;
}
volume = (volume & 0x7F) << 1;
sound &= 0xFF;
// Note: All those tables are big endian. Don't ask me why. *sigh*
// Use the sample rate from game data, see bug #1507757.
uint16 sampleRate = READ_BE_UINT16(_sampleRates + (sound << 2));
if (sampleRate > 11025)
sampleRate = 11025;
uint32 dataOfs = READ_BE_UINT16(_sfxInfo + (sound << 3) + 0) << 4;
uint32 dataSize = READ_BE_UINT16(_sfxInfo + (sound << 3) + 2);
uint32 dataLoop = READ_BE_UINT16(_sfxInfo + (sound << 3) + 6);
dataOfs += _sfxBaseOfs;
Audio::SeekableAudioStream *stream = Audio::makeRawStream(_soundData + dataOfs, dataSize, sampleRate,
Audio::FLAG_UNSIGNED, DisposeAfterUse::NO);
Audio::AudioStream *output = 0;
if (dataLoop) {
uint32 loopSta = dataSize - dataLoop;
uint32 loopEnd = dataSize;
output = Audio::makeLoopingAudioStream(stream, Audio::Timestamp(0, loopSta, sampleRate),
Audio::Timestamp(0, loopEnd, sampleRate), 0);
} else {
output = stream;
}
if (channel == 0)
_mixer->playStream(Audio::Mixer::kSFXSoundType, &_ingameSound0, output, SOUND_CH0, volume, 0);
else
_mixer->playStream(Audio::Mixer::kSFXSoundType, &_ingameSound1, output, SOUND_CH1, volume, 0);
}
开发者ID:St0rmcrow,项目名称:scummvm,代码行数:49,代码来源:sound.cpp
示例9: loadCt
byte loadCt(const char *ctName) {
uint16 header[32];
strcpy(currentCtName, ctName);
byte *ptr = readBundleFile(findFileInBundle(ctName));
if (gameType == Cine::GID_OS) {
uint16 bpp = READ_BE_UINT16(ptr); ptr += 2;
if (bpp == 8) {
ptr += 3 * 256;
loadCtHigh(ptr);
} else {
ptr += 32;
gfxResetRawPage(page3Raw);
gfxConvertSpriteToRaw(page3Raw, ptr, 160, 200);
}
} else {
loadRelatedPalette(ctName);
assert(strstr(ctName, ".NEO"));
Common::MemoryReadStream readS(ptr, 32);
for (int i = 0; i < 16; i++) {
header[i] = readS.readUint16BE();
}
gfxConvertSpriteToRaw(page3Raw, ptr + 0x80, 160, 200);
}
return 0;
}
开发者ID:iPodLinux-Community,项目名称:iScummVM,代码行数:33,代码来源:bg.cpp
示例10: READ_BE_UINT16
void SoundManager::regenbruit() {
int i = 69876;
for (int j = 0; j < 100; j++) {
_cfiphBuffer[j] = READ_BE_UINT16(&_noiseBuf[i]);
i += 2;
}
}
开发者ID:project-cabal,项目名称:cabal,代码行数:7,代码来源:sound.cpp
示例11: sprintf
/**
* This function does noting but load a raw resource into memory,
* if further decoding is required, it must be done by another
* routine. NULL is returned if unsucsessfull.
*/
uint8 *AgiLoader_v2::loadVolRes(struct AgiDir *agid) {
uint8 *data = NULL;
char x[MAXPATHLEN], *path;
Common::File fp;
unsigned int sig;
sprintf(x, "vol.%i", agid->volume);
path = x;
debugC(3, kDebugLevelResources, "Vol res: path = %s", path);
if (agid->offset != _EMPTY && fp.open(path)) {
debugC(3, kDebugLevelResources, "loading resource at offset %d", agid->offset);
fp.seek(agid->offset, SEEK_SET);
fp.read(&x, 5);
if ((sig = READ_BE_UINT16((uint8 *) x)) == 0x1234) {
agid->len = READ_LE_UINT16((uint8 *) x + 3);
data = (uint8 *) calloc(1, agid->len + 32);
if (data != NULL) {
fp.read(data, agid->len);
} else {
exit(1);
}
} else {
warning("AgiLoader_v2::loadVolRes: bad signature %04x", sig);
return 0;
}
fp.close();
} else {
// we have a bad volume resource
// set that resource to NA
agid->offset = _EMPTY;
}
return data;
}
开发者ID:Templier,项目名称:scummvm-test,代码行数:40,代码来源:loader_v2.cpp
示例12: assert
int Graphics::drawChar16(uint8 *dst, int dstPitch, uint8 chr, int x, int y, uint16 color) {
dst += y * dstPitch + x;
uint8 color1 = color & 0xFF;
uint8 color2 = color >> 8;
assert(chr >= 32 && chr < 32 + _fontSize);
const uint8 *chrData = _fontData + _fontOffs[chr - 32];
int chrHeight = chrData[1];
int chrWidth = chrData[2];
chrData += 3;
while (chrHeight--) {
int shiftCount = 0;
int mask = 0;
for (int i = 0; i < chrWidth; ++i) {
if (shiftCount == 0) {
mask = READ_BE_UINT16(chrData); chrData += 2;
shiftCount = 8;
}
int b = (mask & 0xC000) >> 14;
mask <<= 2;
--shiftCount;
if (b) {
if (b & 2) {
dst[i] = color2;
} else {
dst[i] = color1;
}
}
}
dst += dstPitch;
}
return chrWidth;
}
开发者ID:St0rmcrow,项目名称:scummvm,代码行数:32,代码来源:graphics.cpp
示例13: READ_BE_UINT16
void Player::handlePattern(uint8_t channel, uint8_t *&data, Pattern *pat) {
pat->note_1 = READ_BE_UINT16(data + 0);
pat->note_2 = READ_BE_UINT16(data + 2);
data += 4;
if (pat->note_1 != 0xFFFD) {
uint16_t sample = (pat->note_2 & 0xF000) >> 12;
if (sample != 0) {
uint8_t *ptr = _sfxMod.samples[sample - 1].buf.buf;
fprintf(stdout, "Preparing sample %d ptr = %p\n", sample, ptr);
if (ptr != 0) {
pat->sample_volume = _sfxMod.samples[sample - 1].volume;
pat->sample_start = 8;
pat->sample_buffer = ptr;
pat->period_value = READ_BE_UINT16(ptr) * 2;
uint16_t loopLen = READ_BE_UINT16(ptr + 2) * 2;
if (loopLen != 0) {
pat->loopPos = pat->period_value;
pat->loopData = ptr;
pat->loopLen = loopLen;
} else {
pat->loopPos = 0;
pat->loopData = 0;
pat->loopLen = 0;
}
int16_t m = pat->sample_volume;
uint8_t effect = pat->note_2 & 0x0F00;
fprintf(stdout, "effect = %d\n", effect);
if (effect == 5) { // volume up
uint8_t volume = (pat->note_2 & 0xFF);
m += volume;
if (m > 0x3F) {
m = 0x3F;
}
} else if (effect == 6) { // volume down
uint8_t volume = (pat->note_2 & 0xFF);
m -= volume;
if (m < 0) {
m = 0;
}
}
Mix_setChannelVolume(channel, m);
pat->sample_volume = m;
}
}
}
开发者ID:cyxx,项目名称:rawgl,代码行数:45,代码来源:main.cpp
示例14: memset
void SfxPlayer::prepareInstruments(const uint8_t *p) {
memset(_sfxMod.samples, 0, sizeof(_sfxMod.samples));
for (int i = 0; i < 15; ++i) {
SfxInstrument *ins = &_sfxMod.samples[i];
uint16_t resNum = READ_BE_UINT16(p); p += 2;
if (resNum != 0) {
ins->volume = READ_BE_UINT16(p);
MemEntry *me = &_res->_memList[resNum];
if (me->status == Resource::STATUS_LOADED && me->type == 0) {
ins->data = me->bufPtr;
debug(DBG_SND, "Loaded instrument 0x%X n=%d volume=%d", resNum, i, ins->volume);
} else {
error("Error loading instrument 0x%X", resNum);
}
}
p += 2; // skip volume
}
}
开发者ID:vanfanel,项目名称:rawgl,代码行数:18,代码来源:sfxplayer.cpp
示例15: getSciVersion
void Kernel::loadSelectorNames() {
Resource *r = _resMan->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SELECTORS), 0);
bool oldScriptHeader = (getSciVersion() == SCI_VERSION_0_EARLY);
// Starting with KQ7, Mac versions have a BE name table. GK1 Mac and earlier (and all
// other platforms) always use LE.
bool isBE = (g_sci->getPlatform() == Common::kPlatformMacintosh && getSciVersion() >= SCI_VERSION_2_1
&& g_sci->getGameId() != GID_GK1);
if (!r) { // No such resource?
// Check if we have a table for this game
// Some demos do not have a selector table
Common::StringArray staticSelectorTable = checkStaticSelectorNames();
if (staticSelectorTable.empty())
error("Kernel: Could not retrieve selector names");
else
warning("No selector vocabulary found, using a static one");
for (uint32 i = 0; i < staticSelectorTable.size(); i++) {
_selectorNames.push_back(staticSelectorTable[i]);
if (oldScriptHeader)
_selectorNames.push_back(staticSelectorTable[i]);
}
return;
}
int count = (isBE ? READ_BE_UINT16(r->data) : READ_LE_UINT16(r->data)) + 1; // Counter is slightly off
for (int i = 0; i < count; i++) {
int offset = isBE ? READ_BE_UINT16(r->data + 2 + i * 2) : READ_LE_UINT16(r->data + 2 + i * 2);
int len = isBE ? READ_BE_UINT16(r->data + offset) : READ_LE_UINT16(r->data + offset);
Common::String tmp((const char *)r->data + offset + 2, len);
_selectorNames.push_back(tmp);
//debug("%s", tmp.c_str());
// Early SCI versions used the LSB in the selector ID as a read/write
// toggle. To compensate for that, we add every selector name twice.
if (oldScriptHeader)
_selectorNames.push_back(tmp);
}
}
开发者ID:CobaltBlues,项目名称:scummvm,代码行数:44,代码来源:kernel.cpp
示例16: while
void SmushDecoder::handleIACT(const byte *src, int32 size) {
int32 bsize = size - 18;
const byte *d_src = src + 18;
while (bsize > 0) {
if (_IACTpos >= 2) {
int32 len = READ_BE_UINT16(_IACToutput) + 2;
len -= _IACTpos;
if (len > bsize) {
memcpy(_IACToutput + _IACTpos, d_src, bsize);
_IACTpos += bsize;
bsize = 0;
} else {
byte *output_data = new byte[4096];
memcpy(_IACToutput + _IACTpos, d_src, len);
byte *dst = output_data;
byte *d_src2 = _IACToutput;
d_src2 += 2;
int32 count = 1024;
byte variable1 = *d_src2++;
byte variable2 = variable1 / 16;
variable1 &= 0x0f;
do {
byte value;
value = *(d_src2++);
if (value == 0x80) {
*dst++ = *d_src2++;
*dst++ = *d_src2++;
} else {
int16 val = (int8)value << variable2;
*dst++ = val >> 8;
*dst++ = (byte)(val);
}
value = *(d_src2++);
if (value == 0x80) {
*dst++ = *d_src2++;
*dst++ = *d_src2++;
} else {
int16 val = (int8)value << variable1;
*dst++ = val >> 8;
*dst++ = (byte)(val);
}
} while (--count);
if (!_stream) {
_stream = Audio::makeQueuingAudioStream(22050, true);
g_system->getMixer()->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, _stream);
}
_stream->queueBuffer(output_data, 0x1000, DisposeAfterUse::YES, Audio::FLAG_STEREO | Audio::FLAG_16BITS);
bsize -= len;
d_src += len;
_IACTpos = 0;
}
} else {
if (bsize > 1 && _IACTpos == 0) {
开发者ID:frnknstn,项目名称:residualvm,代码行数:56,代码来源:smush_decoder.cpp
示例17: memset
void SfxPlayer::handlePattern(uint8_t channel, const uint8_t *data) {
SfxPattern pat;
memset(&pat, 0, sizeof(SfxPattern));
pat.note_1 = READ_BE_UINT16(data + 0);
pat.note_2 = READ_BE_UINT16(data + 2);
if (pat.note_1 != 0xFFFD) {
uint16_t sample = (pat.note_2 & 0xF000) >> 12;
if (sample != 0) {
uint8_t *ptr = _sfxMod.samples[sample - 1].data;
if (ptr != 0) {
debug(DBG_SND, "SfxPlayer::handlePattern() preparing sample %d", sample);
pat.sampleVolume = _sfxMod.samples[sample - 1].volume;
pat.sampleStart = 8;
pat.sampleBuffer = ptr;
pat.sampleLen = READ_BE_UINT16(ptr) * 2;
uint16_t loopLen = READ_BE_UINT16(ptr + 2) * 2;
if (loopLen != 0) {
pat.loopPos = pat.sampleLen;
pat.loopData = ptr;
pat.loopLen = loopLen;
} else {
pat.loopPos = 0;
pat.loopData = 0;
pat.loopLen = 0;
}
int16_t m = pat.sampleVolume;
uint8_t effect = (pat.note_2 & 0x0F00) >> 8;
if (effect == 5) { // volume up
uint8_t volume = (pat.note_2 & 0xFF);
m += volume;
if (m > 0x3F) {
m = 0x3F;
}
} else if (effect == 6) { // volume down
uint8_t volume = (pat.note_2 & 0xFF);
m -= volume;
if (m < 0) {
m = 0;
}
}
mixer->setChannelVolume(channel, m);
pat.sampleVolume = m;
}
开发者ID:crito,项目名称:Another-World-Bytecode-Interpreter,代码行数:43,代码来源:sfxplayer.cpp
示例18: f
void ExtractCine::unpackAllResourceFiles(const Common::Filename &filename) {
Common::File f(filename, "rb");
uint32 unpackedSize, packedSize;
{
char header[8];
f.read_throwsOnError(header, 8);
if (memcmp(header, "ABASECP", 7) == 0) {
unpackedSize = f.readUint32BE();
packedSize = f.readUint32BE();
} else {
unpackedSize = packedSize = f.pos(); /* Get file size */
f.seek(0, SEEK_SET);
}
}
assert(unpackedSize >= packedSize);
uint8 *buf = (uint8 *)calloc(unpackedSize, 1);
assert(buf);
f.read_throwsOnError(buf, packedSize);
if (packedSize != unpackedSize) {
CineUnpacker cineUnpacker;
if (!cineUnpacker.unpack(buf, packedSize, buf, unpackedSize)) {
error("Failed to unpack 'vol.cnf' data");
}
}
unsigned int resourceFilesCount = READ_BE_UINT16(&buf[0]);
unsigned int entrySize = READ_BE_UINT16(&buf[2]);
print("--- Unpacking all %d resource files from 'vol.cnf' (entrySize = %d):", resourceFilesCount, entrySize);
char resourceFileName[9];
for (unsigned int i = 0; i < resourceFilesCount; ++i) {
memcpy(resourceFileName, &buf[4 + i * entrySize], 8);
resourceFileName[8] = 0;
Common::File fpResFile(resourceFileName, "rb");
print("--- Unpacking resource file %s:", resourceFileName);
unpackFile(fpResFile);
}
free(buf);
}
开发者ID:CobaltBlues,项目名称:scummvm-tools,代码行数:43,代码来源:extract_cine.cpp
示例19: loadObject
void loadObject(char *pObjectName) {
debug(5, "loadObject(\"%s\")", pObjectName);
uint16 numEntry;
uint16 entrySize;
uint16 i;
byte *ptr, *dataPtr;
checkDataDisk(-1);
ptr = dataPtr = readBundleFile(findFileInBundle(pObjectName));
setMouseCursor(MOUSE_CURSOR_DISK);
numEntry = READ_BE_UINT16(ptr); ptr += 2;
entrySize = READ_BE_UINT16(ptr); ptr += 2;
assert(numEntry <= NUM_MAX_OBJECT);
for (i = 0; i < numEntry; i++) {
if (g_cine->_objectTable[i].costume != -2 && g_cine->_objectTable[i].costume != -3) { // flag is keep?
Common::MemoryReadStream readS(ptr, entrySize);
g_cine->_objectTable[i].x = readS.readSint16BE();
g_cine->_objectTable[i].y = readS.readSint16BE();
g_cine->_objectTable[i].mask = readS.readUint16BE();
g_cine->_objectTable[i].frame = readS.readSint16BE();
g_cine->_objectTable[i].costume = readS.readSint16BE();
readS.read(g_cine->_objectTable[i].name, 20);
g_cine->_objectTable[i].part = readS.readUint16BE();
}
ptr += entrySize;
}
if (!strcmp(pObjectName, "INTRO.OBJ")) {
for (i = 0; i < 10; i++) {
g_cine->_objectTable[i].costume = 0;
}
}
free(dataPtr);
}
开发者ID:33d,项目名称:scummvm,代码行数:42,代码来源:object.cpp
示例20: disableBox
// Elvira 2 and Waxworks specific
void AGOSEngine::doMenuStrip(uint menuNum) {
uint i;
const uint var = (getGameType() == GType_WW) ? 11 : 1;
for (i = 111; i != 115; i++)
disableBox(i);
for (i = var; i != (var + 5); i++)
_variableArray[i] = 0;
byte *srcPtr = _menuBase;
while (menuNum--) {
while (READ_BE_UINT16(srcPtr) != 0)
srcPtr += 2;
srcPtr += 2;
}
uint id = 111;
uint v = var;
while (READ_BE_UINT16(srcPtr) != 0) {
uint verb = READ_BE_UINT16(srcPtr);
_variableArray[v] = verb;
HitArea *ha = findBox(id);
if (ha != NULL) {
ha->flags &= ~kBFBoxDead;
ha->verb = verb;
}
id++;
srcPtr += 2;
v++;
}
_variableArray[var + 4] = id - 111;
if (getGameType() == GType_WW) {
setWindowImageEx(2, 102);
} else {
setWindowImageEx(2, 103);
}
}
开发者ID:rayzer86,项目名称:scummvm,代码行数:43,代码来源:menus.cpp
注:本文中的READ_BE_UINT16函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论