ALL: Remove trailing whitespaces
This tries to make our code a bit more compliant with our code formatting conventions. For future use, this is the command I used: git ls-files "*.cpp" "*.h" | xargs sed -i -e 's/[ \t]*$//'
This commit is contained in:
parent
3853e76202
commit
88913c0139
314 changed files with 1761 additions and 1761 deletions
|
@ -127,7 +127,7 @@ int AACStream::readBuffer(int16 *buffer, const int numSamples) {
|
|||
// Dip into our remaining samples pool if it's available
|
||||
if (_remainingSamples) {
|
||||
samples = MIN<int>(numSamples, _remainingSamplesSize - _remainingSamplesPos);
|
||||
|
||||
|
||||
memcpy(buffer, _remainingSamples + _remainingSamplesPos, samples * 2);
|
||||
_remainingSamplesPos += samples;
|
||||
|
||||
|
|
|
@ -342,14 +342,14 @@ do { \
|
|||
_topNibble = true; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
||||
int DK3_ADPCMStream::readBuffer(int16 *buffer, const int numSamples) {
|
||||
int samples = 0;
|
||||
|
||||
assert((numSamples % 4) == 0);
|
||||
|
||||
while (samples < numSamples && !_stream->eos() && _stream->pos() < _endpos) {
|
||||
while (samples < numSamples && !_stream->eos() && _stream->pos() < _endpos) {
|
||||
if ((_stream->pos() % _blockAlign) == 0) {
|
||||
_stream->readUint16LE(); // Unknown
|
||||
uint16 rate = _stream->readUint16LE(); // Copy of rate
|
||||
|
|
|
@ -220,7 +220,7 @@ void QuickTimeAudioDecoder::setAudioStreamPos(const Timestamp &where) {
|
|||
// First, we need to track down what audio sample we need
|
||||
Audio::Timestamp curAudioTime = where.convertToFramerate(_tracks[_audioTrackIndex]->timeScale);
|
||||
uint32 sample = curAudioTime.totalNumberOfFrames();
|
||||
uint32 seekSample = sample;
|
||||
uint32 seekSample = sample;
|
||||
|
||||
if (!isOldDemuxing()) {
|
||||
// We shouldn't have audio samples that are a different duration
|
||||
|
@ -246,7 +246,7 @@ void QuickTimeAudioDecoder::setAudioStreamPos(const Timestamp &where) {
|
|||
|
||||
totalSamples += chunkSampleCount;
|
||||
}
|
||||
|
||||
|
||||
// Reposition the audio stream
|
||||
queueNextAudioChunk();
|
||||
if (sample != totalSamples) {
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace Common {
|
|||
namespace Audio {
|
||||
|
||||
class SeekableAudioStream;
|
||||
|
||||
|
||||
/**
|
||||
* Try to load a QuickTime sound file from the given file name and create a SeekableAudioStream
|
||||
* from that data.
|
||||
|
|
|
@ -229,7 +229,7 @@ MidiDriver::DeviceHandle MidiDriver::detectDevice(int flags) {
|
|||
if ((flags & MDT_MIDI) && !skipMidi) {
|
||||
// If a preferred MT32 or GM device has been selected that device gets returned if available.
|
||||
Common::String devStr;
|
||||
if (flags & MDT_PREFER_MT32)
|
||||
if (flags & MDT_PREFER_MT32)
|
||||
devStr = ConfMan.get("mt32_device");
|
||||
else if (flags & MDT_PREFER_GM)
|
||||
devStr = ConfMan.get("gm_device");
|
||||
|
@ -261,7 +261,7 @@ MidiDriver::DeviceHandle MidiDriver::detectDevice(int flags) {
|
|||
// If the preferred (expressly requested) device cannot be used we display a warning and continue.
|
||||
// Don't warn about the failing device if we did already (this becomes relevant if the failing
|
||||
// device is selected as preferred device and also as GM or MT-32 device).
|
||||
if (failedDevStr != getDeviceString(hdl, MidiDriver::kDeviceName)) {
|
||||
if (failedDevStr != getDeviceString(hdl, MidiDriver::kDeviceName)) {
|
||||
Common::String warningMsg = Common::String::format(_("The preferred audio device '%s' cannot be used. See log file for more information. Attempting to fall back to the next available device..."), getDeviceString(hdl, MidiDriver::kDeviceName).c_str());
|
||||
GUI::MessageDialog dialog(warningMsg);
|
||||
dialog.runModal();
|
||||
|
@ -285,7 +285,7 @@ MidiDriver::DeviceHandle MidiDriver::detectDevice(int flags) {
|
|||
}
|
||||
}
|
||||
|
||||
// Now we default to the first available device with music type 'MT_GM' if not
|
||||
// Now we default to the first available device with music type 'MT_GM' if not
|
||||
// MT-32 is preferred or if MT-32 is preferred but all other devices have failed.
|
||||
if (!(flags & MDT_PREFER_MT32) || flags == (MDT_PREFER_MT32 | MDT_MIDI)) {
|
||||
for (MusicPlugin::List::const_iterator m = p.begin(); m != p.end(); ++m) {
|
||||
|
|
|
@ -67,7 +67,7 @@ public:
|
|||
|
||||
void updateEnvelopeGenerator();
|
||||
|
||||
void setInstrument(uint8 *instr);
|
||||
void setInstrument(uint8 *instr);
|
||||
void setLevel(uint8 lvl);
|
||||
void setPitch(uint32 pt);
|
||||
void setBalance(uint8 blc);
|
||||
|
@ -272,12 +272,12 @@ private:
|
|||
static const uint8 _fmDefaultInstrument[];
|
||||
};
|
||||
|
||||
TownsAudioInterfaceInternal::TownsAudioInterfaceInternal(Audio::Mixer *mixer, TownsAudioInterface *owner, TownsAudioInterfacePluginDriver *driver, bool externalMutexHandling) :
|
||||
TownsAudioInterfaceInternal::TownsAudioInterfaceInternal(Audio::Mixer *mixer, TownsAudioInterface *owner, TownsAudioInterfacePluginDriver *driver, bool externalMutexHandling) :
|
||||
TownsPC98_FmSynth(mixer, kTypeTowns, externalMutexHandling),
|
||||
_fmInstruments(0), _pcmInstruments(0), _pcmChan(0), _waveTables(0), _waveTablesTotalDataSize(0),
|
||||
_baserate(55125.0f / (float)mixer->getOutputRate()), _tickLength(0), _timer(0), _drv(driver), _drvOwner(owner),
|
||||
_pcmSfxChanMask(0), _musicVolume(Audio::Mixer::kMaxMixerVolume), _sfxVolume(Audio::Mixer::kMaxMixerVolume),
|
||||
_outputVolumeFlags(0), _fmChanPlaying(0),
|
||||
_outputVolumeFlags(0), _fmChanPlaying(0),
|
||||
_numReservedChannels(0), _numWaveTables(0), _updateOutputVol(false), _ready(false) {
|
||||
|
||||
#define INTCB(x) &TownsAudioInterfaceInternal::intf_##x
|
||||
|
@ -431,7 +431,7 @@ void TownsAudioInterfaceInternal::releaseRef(TownsAudioInterface *owner) {
|
|||
return;
|
||||
|
||||
_refCount--;
|
||||
|
||||
|
||||
if (_refCount) {
|
||||
if (_refInstance)
|
||||
_refInstance->removePluginDriver(owner);
|
||||
|
@ -484,7 +484,7 @@ int TownsAudioInterfaceInternal::processCommand(int command, va_list &args) {
|
|||
|
||||
if (command < 0 || command > 81)
|
||||
return 4;
|
||||
|
||||
|
||||
Common::StackLock lock(_mutex);
|
||||
int res = (this->*_intfOpcodes[command])(args);
|
||||
|
||||
|
@ -564,7 +564,7 @@ void TownsAudioInterfaceInternal::nextTickEx(int32 *buffer, uint32 bufferSize) {
|
|||
}
|
||||
finOutL += oL;
|
||||
finOutR += oR;
|
||||
|
||||
|
||||
if (!(_pcmChan[ii]._activeKey || _pcmChan[ii]._activeEffect))
|
||||
_pcmChan[ii]._activeOutput = false;
|
||||
}
|
||||
|
@ -996,7 +996,7 @@ int TownsAudioInterfaceInternal::intf_setOutputMute(va_list &args) {
|
|||
if (mute & 2)
|
||||
memset(&_outputMute[12], 1, 4);
|
||||
if (mute & 1)
|
||||
memset(&_outputMute[8], 1, 4);
|
||||
memset(&_outputMute[8], 1, 4);
|
||||
|
||||
_outputMute[(f < 0x80) ? 11 : 15] = 0;
|
||||
f += f;
|
||||
|
@ -1009,8 +1009,8 @@ int TownsAudioInterfaceInternal::intf_setOutputMute(va_list &args) {
|
|||
_outputMute[(f < 0x80) ? 0 : 4] = 0;
|
||||
f += f;
|
||||
_outputMute[(f < 0x80) ? 1 : 5] = 0;
|
||||
f += f;
|
||||
|
||||
f += f;
|
||||
|
||||
updateOutputVolume();
|
||||
return 0;
|
||||
}
|
||||
|
@ -1581,7 +1581,7 @@ void TownsAudio_PcmChannel::clear() {
|
|||
_envTotalLevel = _envAttackRate = _envDecayRate = _envSustainLevel = _envSustainRate = _envReleaseRate = 0;
|
||||
_envStep = _envCurrentLevel = 0;
|
||||
|
||||
_envState = kEnvReady;
|
||||
_envState = kEnvReady;
|
||||
|
||||
_activeKey = _activeEffect = _activeOutput = _keyPressed = _reserved = false;
|
||||
|
||||
|
@ -1650,7 +1650,7 @@ void TownsAudio_PcmChannel::keyOn(uint8 note, uint8 velo, TownsAudio_WaveTable *
|
|||
_activeEffect = true;
|
||||
else
|
||||
_keyPressed = _activeKey = true;
|
||||
|
||||
|
||||
_activeOutput = true;
|
||||
}
|
||||
|
||||
|
@ -1742,7 +1742,7 @@ void TownsAudio_PcmChannel::setBalance(uint8 blc) {
|
|||
void TownsAudio_PcmChannel::updateOutput() {
|
||||
if (_activeKey || _activeEffect) {
|
||||
_pos += _step;
|
||||
|
||||
|
||||
if (&_data[_pos >> 11] >= _loopEnd) {
|
||||
if (_loopLen) {
|
||||
_pos -= _loopLen;
|
||||
|
@ -1811,7 +1811,7 @@ void TownsAudio_PcmChannel::setVelo(uint8 velo) {
|
|||
_envTotalLevel = ((_envTotalLevel * lvl) >> 14) & 0xff;
|
||||
_envSustainLevel = ((_envSustainLevel * lvl) >> 14) & 0xff;
|
||||
envAttack();
|
||||
_tl = (_envCurrentLevel >> 8) << 1;
|
||||
_tl = (_envCurrentLevel >> 8) << 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
void setupProgram(const uint8 *data, uint8 mLevelPara, uint8 tLevelPara);
|
||||
void setupEffects(int index, uint8 flags, const uint8 *effectData);
|
||||
void setModWheel(uint8 value);
|
||||
|
||||
|
||||
void connect(TownsMidiInputChannel *chan);
|
||||
void disconnect();
|
||||
|
||||
|
@ -100,7 +100,7 @@ private:
|
|||
uint8 _operator1Tl;
|
||||
uint8 _sustainNoteOff;
|
||||
int16 _duration;
|
||||
|
||||
|
||||
uint16 _freq;
|
||||
int16 _freqAdjust;
|
||||
|
||||
|
@ -134,7 +134,7 @@ public:
|
|||
void controlChange(byte control, byte value);
|
||||
void pitchBendFactor(byte value);
|
||||
void priority(byte value);
|
||||
void sysEx_customInstrument(uint32 type, const byte *instr);
|
||||
void sysEx_customInstrument(uint32 type, const byte *instr);
|
||||
|
||||
private:
|
||||
void controlModulationWheel(byte value);
|
||||
|
@ -145,7 +145,7 @@ private:
|
|||
void releasePedal();
|
||||
|
||||
TownsMidiOutputChannel *_out;
|
||||
|
||||
|
||||
uint8 *_instrument;
|
||||
uint8 _prg;
|
||||
uint8 _chanIndex;
|
||||
|
@ -175,7 +175,7 @@ private:
|
|||
class TownsMidiChanState {
|
||||
public:
|
||||
TownsMidiChanState();
|
||||
~TownsMidiChanState() {}
|
||||
~TownsMidiChanState() {}
|
||||
uint8 get(uint8 type);
|
||||
|
||||
uint8 unk1;
|
||||
|
@ -247,7 +247,7 @@ void TownsMidiOutputChannel::setupProgram(const uint8 *data, uint8 mLevelPara, u
|
|||
// music (unsuitable data is just forced into the wrong audio device).
|
||||
|
||||
static const uint8 mul[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 12, 12, 15, 15 };
|
||||
uint8 chan = _chanMap[_chan];
|
||||
uint8 chan = _chanMap[_chan];
|
||||
|
||||
uint8 mulAmsFms1 = _driver->_chanState[chan].mulAmsFms = data[0];
|
||||
uint8 tl1 = _driver->_chanState[chan].tl = (data[1] | 0x3f) - mLevelPara;
|
||||
|
@ -296,7 +296,7 @@ void TownsMidiOutputChannel::setupProgram(const uint8 *data, uint8 mLevelPara, u
|
|||
void TownsMidiOutputChannel::setupEffects(int index, uint8 flags, const uint8 *effectData) {
|
||||
uint16 effectMaxLevel[] = { 0x2FF, 0x1F, 0x07, 0x3F, 0x0F, 0x0F, 0x0F, 0x03, 0x3F, 0x0F, 0x0F, 0x0F, 0x03, 0x3E, 0x1F };
|
||||
uint8 effectType[] = { 0x1D, 0x1C, 0x1B, 0x00, 0x03, 0x04, 0x07, 0x08, 0x0D, 0x10, 0x11, 0x14, 0x15, 0x1e, 0x1f, 0x00 };
|
||||
|
||||
|
||||
EffectEnvelope *s = &_effectEnvelopes[index];
|
||||
EffectDef *d = &_effectDefs[index];
|
||||
|
||||
|
@ -354,7 +354,7 @@ void TownsMidiOutputChannel::connect(TownsMidiInputChannel *chan) {
|
|||
|
||||
void TownsMidiOutputChannel::disconnect() {
|
||||
keyOff();
|
||||
|
||||
|
||||
TownsMidiOutputChannel *p = _prev;
|
||||
TownsMidiOutputChannel *n = _next;
|
||||
|
||||
|
@ -448,10 +448,10 @@ int TownsMidiOutputChannel::advanceEffectEnvelope(EffectEnvelope *s, EffectDef *
|
|||
s->state = kEnvReady;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int32 t = s->currentLevel + s->incrPerStep;
|
||||
|
||||
|
||||
s->incrCountRem += s->incrPerStepRem;
|
||||
if (s->incrCountRem >= s->numSteps) {
|
||||
s->incrCountRem -= s->numSteps;
|
||||
|
@ -492,7 +492,7 @@ void TownsMidiOutputChannel::initNextEnvelopeState(EffectEnvelope *s) {
|
|||
|
||||
if (v & 0x80)
|
||||
e = _driver->randomValue(e);
|
||||
|
||||
|
||||
if (!e)
|
||||
e = 1;
|
||||
|
||||
|
@ -525,7 +525,7 @@ void TownsMidiOutputChannel::initNextEnvelopeState(EffectEnvelope *s) {
|
|||
|
||||
int16 TownsMidiOutputChannel::getEffectStartLevel(uint8 type) {
|
||||
uint8 chan = (type < 13) ? _chanMap2[_chan] : ((type < 26) ? _chanMap[_chan] : _chan);
|
||||
|
||||
|
||||
if (type == 28)
|
||||
return 15;
|
||||
else if (type == 29)
|
||||
|
@ -539,8 +539,8 @@ int16 TownsMidiOutputChannel::getEffectStartLevel(uint8 type) {
|
|||
uint8 res = (_driver->_chanState[chan].get(def[0] >> 5) & def[2]) >> def[1];
|
||||
if (def[3])
|
||||
res = def[3] - res;
|
||||
|
||||
return res;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
int TownsMidiOutputChannel::getEffectModLevel(int lvl, int mod) {
|
||||
|
@ -554,12 +554,12 @@ int TownsMidiOutputChannel::getEffectModLevel(int lvl, int mod) {
|
|||
return ((lvl + 1) * mod) >> 5;
|
||||
|
||||
if (mod < 0) {
|
||||
if (lvl < 0)
|
||||
if (lvl < 0)
|
||||
return _driver->_operatorLevelTable[((-lvl) << 5) - mod];
|
||||
else
|
||||
return -_driver->_operatorLevelTable[(lvl << 5) - mod];
|
||||
} else {
|
||||
if (lvl < 0)
|
||||
if (lvl < 0)
|
||||
return -_driver->_operatorLevelTable[((-lvl) << 5) + mod];
|
||||
else
|
||||
return _driver->_operatorLevelTable[((-lvl) << 5) + mod];
|
||||
|
@ -577,7 +577,7 @@ void TownsMidiOutputChannel::keyOff() {
|
|||
}
|
||||
|
||||
void TownsMidiOutputChannel::keyOnSetFreq(uint16 frq) {
|
||||
uint16 note = (frq << 1) >> 8;
|
||||
uint16 note = (frq << 1) >> 8;
|
||||
frq = (_freqMSB[note] << 11) | _freqLSB[note] ;
|
||||
out(0xa4, frq >> 8);
|
||||
out(0xa0, frq & 0xff);
|
||||
|
@ -701,7 +701,7 @@ void TownsMidiInputChannel::noteOff(byte note) {
|
|||
|
||||
void TownsMidiInputChannel::noteOn(byte note, byte velocity) {
|
||||
TownsMidiOutputChannel *oc = _driver->allocateOutputChannel(_priority);
|
||||
|
||||
|
||||
if (!oc)
|
||||
return;
|
||||
|
||||
|
@ -711,7 +711,7 @@ void TownsMidiInputChannel::noteOn(byte note, byte velocity) {
|
|||
oc->_note = note;
|
||||
oc->_sustainNoteOff = 0;
|
||||
oc->_duration = _instrument[29] * 63;
|
||||
|
||||
|
||||
oc->_operator1Tl = (_instrument[1] & 0x3f) + _driver->_operatorLevelTable[((velocity >> 1) << 5) + (_instrument[4] >> 2)];
|
||||
if (oc->_operator1Tl > 63)
|
||||
oc->_operator1Tl = 63;
|
||||
|
@ -840,7 +840,7 @@ MidiDriver_TOWNS::MidiDriver_TOWNS(Audio::Mixer *mixer) : _timerProc(0), _timerP
|
|||
_channels = new TownsMidiInputChannel*[32];
|
||||
for (int i = 0; i < 32; i++)
|
||||
_channels[i] = new TownsMidiInputChannel(this, i > 8 ? (i + 1) : i);
|
||||
|
||||
|
||||
_out = new TownsMidiOutputChannel*[6];
|
||||
for (int i = 0; i < 6; i++)
|
||||
_out[i] = new TownsMidiOutputChannel(this, i);
|
||||
|
@ -964,7 +964,7 @@ MidiChannel *MidiDriver_TOWNS::allocateChannel() {
|
|||
if (!_isOpen)
|
||||
return 0;
|
||||
|
||||
for (int i = 0; i < 32; ++i) {
|
||||
for (int i = 0; i < 32; ++i) {
|
||||
TownsMidiInputChannel *chan = _channels[i];
|
||||
if (chan->allocate())
|
||||
return chan;
|
||||
|
@ -1023,7 +1023,7 @@ TownsMidiOutputChannel *MidiDriver_TOWNS::allocateOutputChannel(uint8 pri) {
|
|||
res = _out[_allocCurPos];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (res)
|
||||
res->disconnect();
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ private:
|
|||
void updateOutputChannels();
|
||||
|
||||
TownsMidiOutputChannel *allocateOutputChannel(uint8 pri);
|
||||
|
||||
|
||||
int randomValue(int para);
|
||||
|
||||
TownsMidiInputChannel **_channels;
|
||||
|
@ -72,11 +72,11 @@ private:
|
|||
uint32 _tickCounter;
|
||||
uint8 _allocCurPos;
|
||||
uint8 _rand;
|
||||
|
||||
|
||||
bool _isOpen;
|
||||
|
||||
uint8 *_operatorLevelTable;
|
||||
|
||||
|
||||
const uint16 _baseTempo;
|
||||
};
|
||||
|
||||
|
|
|
@ -1265,7 +1265,7 @@ void TownsPC98_AudioDriver::fadeStep() {
|
|||
void TownsPC98_AudioDriver::pause() {
|
||||
_musicPlaying = false;
|
||||
}
|
||||
|
||||
|
||||
void TownsPC98_AudioDriver::cont() {
|
||||
_musicPlaying = true;
|
||||
}
|
||||
|
|
|
@ -1160,12 +1160,12 @@ int TownsPC98_FmSynth::readBuffer(int16 *buffer, const int numSamples) {
|
|||
for (int i = 0; i < 2; i++) {
|
||||
if (_timers[i].enabled && _timers[i].cb) {
|
||||
if (!_timers[i].smpTillCb) {
|
||||
|
||||
|
||||
if (locked && _externalMutex) {
|
||||
_mutex.unlock();
|
||||
locked = false;
|
||||
}
|
||||
|
||||
|
||||
(this->*_timers[i].cb)();
|
||||
|
||||
if (!locked && _externalMutex) {
|
||||
|
|
|
@ -564,8 +564,8 @@ bool MT32EmuMusicPlugin::checkDevice(MidiDriver::DeviceHandle) const {
|
|||
warning("The MT-32 emulator requires one of the two following file sets (not bundled with ScummVM):\n Either 'MT32_CONTROL.ROM' and 'MT32_PCM.ROM' or 'CM32L_CONTROL.ROM' and 'CM32L_PCM.ROM'");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Common::Error MT32EmuMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const {
|
||||
|
|
|
@ -113,7 +113,7 @@ public:
|
|||
* @return true if the CD drive was inited succesfully
|
||||
*/
|
||||
virtual bool openCD(int drive) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Poll CD status.
|
||||
* @return true if CD audio is playing
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
* The SDL event source.
|
||||
*/
|
||||
class SdlEventSource : public Common::EventSource {
|
||||
public:
|
||||
public:
|
||||
SdlEventSource();
|
||||
virtual ~SdlEventSource();
|
||||
|
||||
|
@ -69,7 +69,7 @@ protected:
|
|||
|
||||
/** Scroll lock state - since SDL doesn't track it */
|
||||
bool _scrollLock;
|
||||
|
||||
|
||||
/** Joystick */
|
||||
SDL_Joystick *_joystick;
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ void WebOSSdlEventSource::SDLModToOSystemKeyFlags(SDLMod mod,
|
|||
event.kbd.flags |= Common::KBD_SHIFT;
|
||||
if (mod & KMOD_CTRL)
|
||||
event.kbd.flags |= Common::KBD_CTRL;
|
||||
|
||||
|
||||
// Holding down the gesture area emulates the ALT key
|
||||
if (gestureDown)
|
||||
event.kbd.flags |= Common::KBD_ALT;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
|
||||
|
||||
#include "graphics/scaler/aspect.h" // for aspect2Real
|
||||
#include "graphics/scaler/aspect.h" // for aspect2Real
|
||||
#include "graphics/scaler/downscaler.h"
|
||||
|
||||
enum {
|
||||
|
|
|
@ -108,7 +108,7 @@ void GLTexture::refresh() {
|
|||
void GLTexture::allocBuffer(GLuint w, GLuint h) {
|
||||
_realWidth = w;
|
||||
_realHeight = h;
|
||||
|
||||
|
||||
if (w <= _textureWidth && h <= _textureHeight && !_refresh)
|
||||
// Already allocated a sufficiently large buffer
|
||||
return;
|
||||
|
|
|
@ -642,7 +642,7 @@ void OpenGLGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int
|
|||
|
||||
void OpenGLGraphicsManager::setCursorPalette(const byte *colors, uint start, uint num) {
|
||||
assert(colors);
|
||||
|
||||
|
||||
// Save the cursor palette
|
||||
memcpy(_cursorPalette + start * 3, colors, num * 3);
|
||||
|
||||
|
@ -1315,7 +1315,7 @@ bool OpenGLGraphicsManager::notifyEvent(const Common::Event &event) {
|
|||
bool OpenGLGraphicsManager::saveScreenshot(const char *filename) {
|
||||
int width = _videoMode.hardwareWidth;
|
||||
int height = _videoMode.hardwareHeight;
|
||||
|
||||
|
||||
// A line of a BMP image must have a size divisible by 4.
|
||||
// We calculate the padding bytes needed here.
|
||||
// Since we use a 3 byte per pixel mode, we can use width % 4 here, since
|
||||
|
@ -1358,7 +1358,7 @@ bool OpenGLGraphicsManager::saveScreenshot(const char *filename) {
|
|||
out.writeUint32LE(0);
|
||||
out.writeUint32LE(0);
|
||||
out.writeUint32LE(0);
|
||||
out.writeUint32LE(0);
|
||||
out.writeUint32LE(0);
|
||||
|
||||
// Write pixel data to BMP
|
||||
out.write(pixels, lineSize * height);
|
||||
|
@ -1423,9 +1423,9 @@ void OpenGLGraphicsManager::updateOSD() {
|
|||
dstX, dstY + i * lineHeight + vOffset + lineSpacing, width,
|
||||
0xFFFF, Graphics::kTextAlignCenter);
|
||||
}
|
||||
|
||||
|
||||
// Update the texture
|
||||
_osdTexture->updateBuffer(_osdSurface.pixels, _osdSurface.pitch, 0, 0,
|
||||
_osdTexture->updateBuffer(_osdSurface.pixels, _osdSurface.pitch, 0, 0,
|
||||
_osdSurface.w, _osdSurface.h);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -185,7 +185,7 @@ protected:
|
|||
|
||||
/**
|
||||
* Set the scale factor.
|
||||
*
|
||||
*
|
||||
* This can only be used in a GFX transaction.
|
||||
*
|
||||
* @param newScale New scale factor.
|
||||
|
@ -332,7 +332,7 @@ protected:
|
|||
GLTexture *_osdTexture;
|
||||
Graphics::Surface _osdSurface;
|
||||
uint8 _osdAlpha;
|
||||
uint32 _osdFadeStartTime;
|
||||
uint32 _osdFadeStartTime;
|
||||
bool _requireOSDUpdate;
|
||||
enum {
|
||||
kOSDFadeOutDelay = 2 * 1000,
|
||||
|
|
|
@ -306,7 +306,7 @@ bool OpenGLSdlGraphicsManager::loadGFXMode() {
|
|||
|
||||
int screenAspectRatio = _videoMode.screenWidth * 10000 / _videoMode.screenHeight;
|
||||
int desiredAspectRatio = getAspectRatio();
|
||||
|
||||
|
||||
// Do not downscale dimensions, only enlarge them if needed
|
||||
if (screenAspectRatio > desiredAspectRatio)
|
||||
_videoMode.hardwareHeight = (_videoMode.overlayWidth * 10000 + 5000) / desiredAspectRatio;
|
||||
|
@ -389,7 +389,7 @@ void OpenGLSdlGraphicsManager::internUpdateScreen() {
|
|||
OpenGLGraphicsManager::internUpdateScreen();
|
||||
|
||||
// Swap OpenGL buffers
|
||||
SDL_GL_SwapBuffers();
|
||||
SDL_GL_SwapBuffers();
|
||||
}
|
||||
|
||||
#ifdef USE_OSD
|
||||
|
@ -561,7 +561,7 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) {
|
|||
// Check if the desktop resolution has been detected
|
||||
if (_desktopWidth > 0 && _desktopHeight > 0)
|
||||
// If the new scale factor is too big, do not scale
|
||||
if (_videoMode.screenWidth * factor > _desktopWidth ||
|
||||
if (_videoMode.screenWidth * factor > _desktopWidth ||
|
||||
_videoMode.screenHeight * factor > _desktopHeight)
|
||||
return false;
|
||||
|
||||
|
@ -611,7 +611,7 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) {
|
|||
break;
|
||||
case Common::EVENT_KEYUP:
|
||||
return isHotkey(event);
|
||||
// HACK: Handle special SDL event
|
||||
// HACK: Handle special SDL event
|
||||
// The new screen size is saved on the mouse event as part of HACK,
|
||||
// there is no common resize event.
|
||||
case OSystem_SDL::kSdlEventResize:
|
||||
|
|
|
@ -100,7 +100,7 @@ public:
|
|||
|
||||
virtual void beginGFXTransaction();
|
||||
virtual OSystem::TransactionError endGFXTransaction();
|
||||
|
||||
|
||||
virtual int16 getHeight();
|
||||
virtual int16 getWidth();
|
||||
|
||||
|
@ -132,7 +132,7 @@ public:
|
|||
virtual void warpMouse(int x, int y);
|
||||
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL);
|
||||
virtual void setCursorPalette(const byte *colors, uint start, uint num);
|
||||
|
||||
|
||||
#ifdef USE_OSD
|
||||
virtual void displayMessageOnOSD(const char *msg);
|
||||
#endif
|
||||
|
@ -149,7 +149,7 @@ protected:
|
|||
/** Transparency level of the OSD */
|
||||
uint8 _osdAlpha;
|
||||
/** When to start the fade out */
|
||||
uint32 _osdFadeStartTime;
|
||||
uint32 _osdFadeStartTime;
|
||||
/** Enum with OSD options */
|
||||
enum {
|
||||
kOSDFadeOutDelay = 2 * 1000, /** < Delay before the OSD is faded out (in milliseconds) */
|
||||
|
|
|
@ -28,7 +28,7 @@ DoubleBufferSDLMixerManager::DoubleBufferSDLMixerManager()
|
|||
:
|
||||
_soundMutex(0), _soundCond(0), _soundThread(0),
|
||||
_soundThreadIsRunning(false), _soundThreadShouldQuit(false) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
DoubleBufferSDLMixerManager::~DoubleBufferSDLMixerManager() {
|
||||
|
|
|
@ -70,7 +70,7 @@ void SdlMixerManager::init() {
|
|||
warning("Could not open audio device: %s", SDL_GetError());
|
||||
|
||||
_mixer = new Audio::MixerImpl(g_system, desired.freq);
|
||||
assert(_mixer);
|
||||
assert(_mixer);
|
||||
_mixer->setReady(false);
|
||||
} else {
|
||||
debug(1, "Output sample rate: %d Hz", _obtained.freq);
|
||||
|
|
|
@ -73,7 +73,7 @@ protected:
|
|||
bool _audioSuspended;
|
||||
|
||||
/**
|
||||
* Returns the desired audio specification
|
||||
* Returns the desired audio specification
|
||||
*/
|
||||
virtual SDL_AudioSpec getAudioSpec(uint32 rate);
|
||||
|
||||
|
|
|
@ -30,17 +30,17 @@ class MutexManager;
|
|||
|
||||
/**
|
||||
* Base class for modular backends.
|
||||
*
|
||||
*
|
||||
* It wraps most functions to their manager equivalent, but not
|
||||
* all OSystem functions are implemented here.
|
||||
*
|
||||
*
|
||||
* A backend derivated from this class, will need to implement
|
||||
* these functions on its own:
|
||||
* OSystem::pollEvent()
|
||||
* OSystem::getMillis()
|
||||
* OSystem::delayMillis()
|
||||
* OSystem::getTimeAndDate()
|
||||
*
|
||||
*
|
||||
* And, it should also initialize all the managers variables
|
||||
* declared in this class, or override their related functions.
|
||||
*/
|
||||
|
@ -107,11 +107,11 @@ public:
|
|||
|
||||
/** @name Events and Time */
|
||||
//@{
|
||||
|
||||
|
||||
virtual Common::HardwareKeySet *getHardwareKeySet() { return 0; }
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
/** @name Mutex handling */
|
||||
//@{
|
||||
|
||||
|
|
|
@ -234,7 +234,7 @@ void OSystem_Dreamcast::logMessage(LogMessageType::Type type, const char *messag
|
|||
namespace DC_Flash {
|
||||
static int syscall_info_flash(int sect, int *info)
|
||||
{
|
||||
return (*(int (**)(int, void*, int, int))0x8c0000b8)(sect,info,0,0);
|
||||
return (*(int (**)(int, void*, int, int))0x8c0000b8)(sect,info,0,0);
|
||||
}
|
||||
|
||||
static int syscall_read_flash(int offs, void *buf, int cnt)
|
||||
|
@ -255,24 +255,24 @@ namespace DC_Flash {
|
|||
}
|
||||
return (unsigned short)~n;
|
||||
}
|
||||
|
||||
|
||||
static int flash_read_sector(int partition, int sec, unsigned char *dst)
|
||||
{
|
||||
int s, r, n, b, bmb, got=0;
|
||||
int info[2];
|
||||
char buf[64];
|
||||
char bm[64];
|
||||
|
||||
|
||||
if((r = syscall_info_flash(partition, info))<0)
|
||||
return r;
|
||||
|
||||
|
||||
if((r = syscall_read_flash(info[0], buf, 64))<0)
|
||||
return r;
|
||||
|
||||
|
||||
if(memcmp(buf, "KATANA_FLASH", 12) ||
|
||||
buf[16] != partition || buf[17] != 0)
|
||||
return -2;
|
||||
|
||||
|
||||
n = (info[1]>>6)-1-((info[1] + 0x7fff)>>15);
|
||||
bmb = n+1;
|
||||
for(b = 0; b < n; b++) {
|
||||
|
|
|
@ -51,7 +51,7 @@ static void drawPluginProgress(const Common::String &filename)
|
|||
ta_begin_frame();
|
||||
draw_solid_quad(80.0, 270.0, 560.0, 300.0,
|
||||
0xff808080, 0xff808080, 0xff808080, 0xff808080);
|
||||
draw_solid_quad(85.0, 275.0, 555.0, 295.0,
|
||||
draw_solid_quad(85.0, 275.0, 555.0, 295.0,
|
||||
0xff202020, 0xff202020, 0xff202020, 0xff202020);
|
||||
draw_solid_quad(85.0, 275.0, 85.0+470.0*ffree, 295.0,
|
||||
fcol, fcol, fcol, fcol);
|
||||
|
|
|
@ -33,7 +33,7 @@ void OSystem_SDL_Dingux::initBackend() {
|
|||
|
||||
// Create the graphics manager
|
||||
if (_graphicsManager == 0) {
|
||||
_graphicsManager = new DINGUXSdlGraphicsManager(_eventSource);
|
||||
_graphicsManager = new DINGUXSdlGraphicsManager(_eventSource);
|
||||
}
|
||||
|
||||
// Call parent implementation of this method
|
||||
|
|
|
@ -52,7 +52,7 @@ Common::OutSaveFile *GBAMPSaveFileManager::openForSaving(const Common::String &f
|
|||
fileSpec += filename;
|
||||
|
||||
// consolePrintf("Opening the file: %s\n", fileSpec.c_str());
|
||||
|
||||
|
||||
Common::WriteStream *stream = DS::DSFileStream::makeFromPath(fileSpec, true);
|
||||
// Use a write buffer
|
||||
stream = Common::wrapBufferedWriteStream(stream, SAVE_BUFFER_SIZE);
|
||||
|
@ -66,7 +66,7 @@ Common::InSaveFile *GBAMPSaveFileManager::openForLoading(const Common::String &f
|
|||
fileSpec += filename;
|
||||
|
||||
// consolePrintf("Opening the file: %s\n", fileSpec.c_str());
|
||||
|
||||
|
||||
return DS::DSFileStream::makeFromPath(fileSpec, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ protected:
|
|||
// FIXME: This must be left as "int" for now, to fix the sign-comparison problem
|
||||
// there is a little more work involved than an int->uint change
|
||||
int _cursorWidth, _cursorHeight;
|
||||
|
||||
|
||||
int _cursorKeycolor;
|
||||
|
||||
uint16 _overlayHeight, _overlayWidth;
|
||||
|
|
|
@ -162,7 +162,7 @@ bool OSystem_N64::pollEvent(Common::Event &event) {
|
|||
uint16 newButtons = 0;
|
||||
if (_controllerPort >= 0)
|
||||
newButtons = _ctrlData.c[_controllerPort].buttons; // Read from controller
|
||||
|
||||
|
||||
uint16 newMouseButtons = 0;
|
||||
if (_mousePort >= 0)
|
||||
newMouseButtons = _ctrlData.c[_mousePort].buttons;
|
||||
|
|
|
@ -324,18 +324,18 @@ inline void Cursor::setRendererModePalettized(bool palettized) {
|
|||
_renderer.setAlphaReverse(false);
|
||||
_renderer.setColorTest(false);
|
||||
} else { // 16 bits, no palette
|
||||
// Color test is an easy way for the hardware to make our keycolor
|
||||
// Color test is an easy way for the hardware to make our keycolor
|
||||
// transparent.
|
||||
_renderer.setColorTest(true);
|
||||
|
||||
_renderer.setColorTest(true);
|
||||
|
||||
// Alpha blending is not strictly required, but makes the cursor look
|
||||
// much better
|
||||
_renderer.setAlphaBlending(true);
|
||||
|
||||
|
||||
// Pixel formats without alpha (5650) are considered to have their alpha set.
|
||||
// Since pixel formats with alpha don't have their alpha bits set, we reverse
|
||||
// the alpha format for them so that 0 alpha is 1.
|
||||
if (_buffer.getPixelFormat() != PSPPixelFormat::Type_5650)
|
||||
if (_buffer.getPixelFormat() != PSPPixelFormat::Type_5650)
|
||||
_renderer.setAlphaReverse(true);
|
||||
else
|
||||
_renderer.setAlphaReverse(false);
|
||||
|
|
|
@ -389,31 +389,31 @@ void Buffer::copyToArray(byte *dst, int pitch) {
|
|||
|
||||
void Buffer::setSize(uint32 width, uint32 height, HowToSize textureOrSource/*=kSizeByTextureSize*/) {
|
||||
DEBUG_ENTER_FUNC();
|
||||
|
||||
|
||||
// We can size the buffer either by texture size (multiple of 2^n) or source size.
|
||||
// At higher sizes, increasing the texture size to 2^n is a waste of space. At these sizes kSizeBySourceSize should be used.
|
||||
|
||||
|
||||
_sourceSize.width = width;
|
||||
_sourceSize.height = height;
|
||||
|
||||
_textureSize.width = scaleUpToPowerOfTwo(width); // can only scale up to 512
|
||||
_textureSize.height = scaleUpToPowerOfTwo(height);
|
||||
|
||||
|
||||
if (textureOrSource == kSizeByTextureSize) {
|
||||
_width = _textureSize.width;
|
||||
_height = _textureSize.height;
|
||||
} else { // sizeBySourceSize
|
||||
_width = _sourceSize.width;
|
||||
_height = _sourceSize.height;
|
||||
|
||||
// adjust allocated width to be divisible by 32.
|
||||
|
||||
// adjust allocated width to be divisible by 32.
|
||||
// The GU can only handle multiples of 16 bytes. A 4 bit image x 32 will give us 16 bytes
|
||||
// We don't necessarily know the depth of the pixels here. So just make it divisible by 32.
|
||||
uint32 checkDiv = _width & 31;
|
||||
if (checkDiv)
|
||||
_width += 32 - checkDiv;
|
||||
}
|
||||
|
||||
|
||||
PSP_DEBUG_PRINT("width[%u], height[%u], texW[%u], texH[%u], sourceW[%d], sourceH[%d] %s\n", _width, _height, _textureSize.width, _textureSize.height, _sourceSize.width, _sourceSize.height, textureOrSource ? "size by source" : "size by texture");
|
||||
}
|
||||
|
||||
|
@ -558,10 +558,10 @@ void GuRenderer::render() {
|
|||
// Loop over patches of 512x512 pixel textures and draw them
|
||||
for (uint32 j = 0; j < _buffer->getSourceHeight(); j += 512) {
|
||||
_textureLoadOffset.y = j;
|
||||
|
||||
|
||||
for (uint32 i = 0; i < _buffer->getSourceWidth(); i += 512) {
|
||||
_textureLoadOffset.x = i;
|
||||
|
||||
|
||||
guLoadTexture();
|
||||
Vertex *vertices = guGetVertices();
|
||||
fillVertices(vertices);
|
||||
|
@ -573,8 +573,8 @@ void GuRenderer::render() {
|
|||
|
||||
inline void GuRenderer::guProgramDrawBehavior() {
|
||||
DEBUG_ENTER_FUNC();
|
||||
PSP_DEBUG_PRINT("blending[%s] colorTest[%s] reverseAlpha[%s] keyColor[%u]\n",
|
||||
_blending ? "on" : "off", _colorTest ? "on" : "off",
|
||||
PSP_DEBUG_PRINT("blending[%s] colorTest[%s] reverseAlpha[%s] keyColor[%u]\n",
|
||||
_blending ? "on" : "off", _colorTest ? "on" : "off",
|
||||
_alphaReverse ? "on" : "off", _keyColor);
|
||||
|
||||
if (_blending) {
|
||||
|
@ -591,7 +591,7 @@ inline void GuRenderer::guProgramDrawBehavior() {
|
|||
if (_colorTest) {
|
||||
sceGuEnable(GU_COLOR_TEST);
|
||||
sceGuColorFunc(GU_NOTEQUAL, // show only colors not equal to this color
|
||||
_keyColor,
|
||||
_keyColor,
|
||||
0x00ffffff); // match everything but alpha
|
||||
} else
|
||||
sceGuDisable(GU_COLOR_TEST);
|
||||
|
@ -663,10 +663,10 @@ inline void GuRenderer::guLoadTexture() {
|
|||
byte *startPoint = _buffer->getPixels();
|
||||
if (_textureLoadOffset.x)
|
||||
startPoint += _buffer->_pixelFormat.pixelsToBytes(_textureLoadOffset.x);
|
||||
if (_textureLoadOffset.y)
|
||||
if (_textureLoadOffset.y)
|
||||
startPoint += _buffer->getWidthInBytes() * _textureLoadOffset.y;
|
||||
|
||||
sceGuTexImage(0,
|
||||
|
||||
sceGuTexImage(0,
|
||||
_buffer->getTextureWidth(), // texture width (must be power of 2)
|
||||
_buffer->getTextureHeight(), // texture height (must be power of 2)
|
||||
_buffer->getWidth(), // width of a line of the image (to get to the next line)
|
||||
|
@ -698,7 +698,7 @@ void GuRenderer::fillVertices(Vertex *vertices) {
|
|||
// These coordinates describe an area within the texture. ie. we already loaded a square of texture,
|
||||
// now the coordinates within it are 0 to the edge of the area of the texture we want to draw
|
||||
float textureStartX = textureFix + _offsetInBuffer.x;
|
||||
float textureStartY = textureFix + _offsetInBuffer.y;
|
||||
float textureStartY = textureFix + _offsetInBuffer.y;
|
||||
|
||||
int textureLeftX = _drawSize.width - _textureLoadOffset.x;
|
||||
if (textureLeftX > 512)
|
||||
|
@ -720,7 +720,7 @@ void GuRenderer::fillVertices(Vertex *vertices) {
|
|||
float imageStartY = gapY + scaledOffsetOnScreenY + (scaleSourceToOutput(false, stretch(false, _textureLoadOffset.y)));
|
||||
|
||||
float imageEndX, imageEndY;
|
||||
|
||||
|
||||
imageEndX = imageStartX + scaleSourceToOutput(true, stretch(true, textureLeftX));
|
||||
imageEndY = imageStartY + scaleSourceToOutput(false, stretch(false, textureLeftY));
|
||||
|
||||
|
|
|
@ -171,12 +171,12 @@ protected:
|
|||
class GuRenderer {
|
||||
public:
|
||||
// Constructors
|
||||
GuRenderer() : _useGlobalScaler(false), _buffer(0), _palette(0),
|
||||
_blending(false), _alphaReverse(false), _colorTest(false),
|
||||
GuRenderer() : _useGlobalScaler(false), _buffer(0), _palette(0),
|
||||
_blending(false), _alphaReverse(false), _colorTest(false),
|
||||
_keyColor(0), _fullScreen(false), _stretch(false), _stretchX(1.0f), _stretchY(1.0f) {}
|
||||
GuRenderer(Buffer *buffer, Palette *palette) :
|
||||
_useGlobalScaler(false), _buffer(buffer), _palette(palette),
|
||||
_blending(false), _alphaReverse(false), _colorTest(false),
|
||||
GuRenderer(Buffer *buffer, Palette *palette) :
|
||||
_useGlobalScaler(false), _buffer(buffer), _palette(palette),
|
||||
_blending(false), _alphaReverse(false), _colorTest(false),
|
||||
_keyColor(0), _fullScreen(false), _stretch(false), _stretchX(1.0f), _stretchY(1.0f) {}
|
||||
static void setDisplayManager(DisplayManager *dm) { _displayManager = dm; } // Called by the Display Manager
|
||||
|
||||
|
|
|
@ -299,7 +299,7 @@ void DisplayManager::init() {
|
|||
#endif
|
||||
|
||||
// Init overlay since we never change the size
|
||||
_overlay->deallocate();
|
||||
_overlay->deallocate();
|
||||
_overlay->setBytesPerPixel(sizeof(OverlayColor));
|
||||
_overlay->setSize(PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT);
|
||||
_overlay->allocate();
|
||||
|
@ -432,13 +432,13 @@ bool DisplayManager::renderAll() {
|
|||
|
||||
_screen->render();
|
||||
_screen->setClean(); // clean out dirty bit
|
||||
|
||||
|
||||
if (_imageViewer->isVisible())
|
||||
_imageViewer->render();
|
||||
_imageViewer->setClean();
|
||||
|
||||
if (_overlay->isVisible())
|
||||
_overlay->render();
|
||||
_overlay->render();
|
||||
_overlay->setClean();
|
||||
|
||||
if (_cursor->isVisible())
|
||||
|
@ -448,7 +448,7 @@ bool DisplayManager::renderAll() {
|
|||
if (_keyboard->isVisible())
|
||||
_keyboard->render();
|
||||
_keyboard->setClean();
|
||||
|
||||
|
||||
_masterGuRenderer.guPostRender();
|
||||
|
||||
return true; // rendered successfully
|
||||
|
|
|
@ -72,7 +72,7 @@ private:
|
|||
*/
|
||||
class MasterGuRenderer : public PspThreadable {
|
||||
public:
|
||||
MasterGuRenderer() : _lastRenderTime(0), _renderFinished(true),
|
||||
MasterGuRenderer() : _lastRenderTime(0), _renderFinished(true),
|
||||
_renderSema(1, 1), _callbackId(-1) {}
|
||||
void guInit();
|
||||
void guPreRender();
|
||||
|
@ -108,7 +108,7 @@ public:
|
|||
KEEP_ASPECT_RATIO,
|
||||
STRETCHED_FULL_SCREEN
|
||||
};
|
||||
DisplayManager() : _screen(0), _cursor(0), _overlay(0), _keyboard(0),
|
||||
DisplayManager() : _screen(0), _cursor(0), _overlay(0), _keyboard(0),
|
||||
_imageViewer(0), _lastUpdateTime(0), _graphicsMode(0) {}
|
||||
~DisplayManager();
|
||||
|
||||
|
@ -127,7 +127,7 @@ public:
|
|||
void setOverlay(Overlay *overlay) { _overlay = overlay; }
|
||||
void setKeyboard(PSPKeyboard *keyboard) { _keyboard = keyboard; }
|
||||
void setImageViewer(ImageViewer *imageViewer) { _imageViewer = imageViewer; }
|
||||
|
||||
|
||||
void setSizeAndPixelFormat(uint width, uint height, const Graphics::PixelFormat *format);
|
||||
|
||||
// Getters
|
||||
|
|
|
@ -26,31 +26,31 @@
|
|||
#include <stdio.h>
|
||||
#include <png.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
|
||||
//void userWriteFn(png_structp png_ptr, png_bytep data, png_size_t length) {
|
||||
//}
|
||||
|
||||
//void userFlushFn(png_structp png_ptr) {
|
||||
//}
|
||||
|
||||
|
||||
// Dummy functions are pulled in so that we don't need to build the plugins with certain libs
|
||||
|
||||
|
||||
int dummyFunc() {
|
||||
|
||||
// For Broken Sword 2.5
|
||||
volatile int i;
|
||||
i = clock();
|
||||
rename("dummyA", "dummyB");
|
||||
|
||||
|
||||
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
png_set_write_fn(png_ptr, NULL, NULL, NULL);
|
||||
png_infop info_ptr;
|
||||
png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL);
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
|
||||
|
||||
// For lua's usage of libc: very heavy usage so it pulls in sockets?
|
||||
setsockopt(0, 0, 0, NULL, 0);
|
||||
getsockopt(0, 0, 0, NULL, NULL);
|
||||
|
||||
|
||||
return i;
|
||||
}
|
|
@ -34,45 +34,45 @@
|
|||
#include "backends/platform/psp/input.h"
|
||||
#include "backends/platform/psp/display_manager.h"
|
||||
#include "backends/platform/psp/display_client.h"
|
||||
#include "backends/platform/psp/image_viewer.h"
|
||||
#include "backends/platform/psp/png_loader.h"
|
||||
#include "backends/platform/psp/image_viewer.h"
|
||||
#include "backends/platform/psp/png_loader.h"
|
||||
#include "backends/platform/psp/thread.h"
|
||||
|
||||
static const char *imageName = "psp_image";
|
||||
#define PSP_SCREEN_HEIGHT 272
|
||||
#define PSP_SCREEN_WIDTH 480
|
||||
|
||||
|
||||
bool ImageViewer::load(int imageNum) {
|
||||
if (_init)
|
||||
unload();
|
||||
|
||||
|
||||
// build string
|
||||
char number[8];
|
||||
sprintf(number, "%d", imageNum);
|
||||
Common::String imageNameStr(imageName);
|
||||
Common::String imageNameStr(imageName);
|
||||
Common::String specificImageName = imageNameStr + Common::String(number) + Common::String(".png");
|
||||
|
||||
|
||||
// search for image file
|
||||
if (!SearchMan.hasFile(specificImageName)) {
|
||||
PSP_ERROR("file %s not found\n", specificImageName.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Common::ScopedPtr<Common::SeekableReadStream> file(SearchMan.createReadStreamForMember(specificImageName));
|
||||
|
||||
|
||||
_buffer = new Buffer();
|
||||
_palette = new Palette();
|
||||
_renderer = new GuRenderer();
|
||||
|
||||
|
||||
assert(_buffer);
|
||||
assert(_palette);
|
||||
assert(_renderer);
|
||||
|
||||
|
||||
// Load a PNG into our buffer and palette. Size it by the actual size of the image
|
||||
PngLoader image(file, *_buffer, *_palette, Buffer::kSizeBySourceSize);
|
||||
|
||||
|
||||
PngLoader::Status status = image.allocate(); // allocate the buffers for the file
|
||||
|
||||
|
||||
char error[100];
|
||||
if (status == PngLoader::BAD_FILE) {
|
||||
sprintf(error, "Cannot display %s. Not a proper PNG file", specificImageName.c_str());
|
||||
|
@ -89,29 +89,29 @@ bool ImageViewer::load(int imageNum) {
|
|||
if (!image.load()) {
|
||||
sprintf(error, "Cannot display %s. Not a proper PNG file", specificImageName.c_str());
|
||||
GUI::TimedMessageDialog dialog(error, 4000);
|
||||
dialog.runModal();
|
||||
dialog.runModal();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
setConstantRendererOptions();
|
||||
setFullScreenImageParams(); // prepare renderer for full screen view
|
||||
|
||||
|
||||
_imageNum = imageNum; // now we can say we displayed this image
|
||||
_init = true;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImageViewer::setConstantRendererOptions() {
|
||||
_renderer->setBuffer(_buffer);
|
||||
_renderer->setPalette(_palette);
|
||||
|
||||
|
||||
_renderer->setAlphaBlending(false);
|
||||
_renderer->setColorTest(false);
|
||||
_renderer->setUseGlobalScaler(false);
|
||||
_renderer->setStretch(true);
|
||||
_renderer->setOffsetInBuffer(0, 0);
|
||||
_renderer->setDrawWholeBuffer();
|
||||
_renderer->setDrawWholeBuffer();
|
||||
}
|
||||
|
||||
void ImageViewer::unload() {
|
||||
|
@ -130,32 +130,32 @@ void ImageViewer::resetOnEngineDone() {
|
|||
|
||||
void ImageViewer::setVisible(bool visible) {
|
||||
DEBUG_ENTER_FUNC();
|
||||
|
||||
|
||||
if (_visible == visible)
|
||||
return;
|
||||
|
||||
|
||||
// from here on, we're making the loader visible
|
||||
if (visible && g_engine) { // we can only run the image viewer when there's an engine
|
||||
g_engine->pauseEngine(true);
|
||||
|
||||
|
||||
load(_imageNum ? _imageNum : 1); // load the 1st image or the current
|
||||
}
|
||||
|
||||
if (visible && _init) { // we managed to load
|
||||
_visible = true;
|
||||
setViewerButtons(true);
|
||||
|
||||
|
||||
{ // so dialog goes out of scope, destroying all allocations
|
||||
GUI::TimedMessageDialog dialog("Image Viewer", 1000);
|
||||
dialog.runModal();
|
||||
}
|
||||
|
||||
|
||||
runLoop(); // only listen to viewer events
|
||||
} else { // we were asked to make invisible or failed to load
|
||||
_visible = false;
|
||||
unload();
|
||||
setViewerButtons(false);
|
||||
|
||||
|
||||
if (g_engine && g_engine->isPaused())
|
||||
g_engine->pauseEngine(false);
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ void ImageViewer::runLoop() {
|
|||
|
||||
void ImageViewer::setViewerButtons(bool active) {
|
||||
_inputHandler->setImageViewerMode(active);
|
||||
}
|
||||
}
|
||||
|
||||
void ImageViewer::loadNextImage() {
|
||||
if (!load(_imageNum+1)) { // try to load the next image
|
||||
|
@ -190,21 +190,21 @@ void ImageViewer::loadLastImage() {
|
|||
if (!load(_imageNum-1))
|
||||
if (!load(_imageNum))
|
||||
setVisible(false); // we can't even show the old image so hide
|
||||
}
|
||||
}
|
||||
setDirty();
|
||||
}
|
||||
|
||||
void ImageViewer::setFullScreenImageParams() {
|
||||
// we try to fit the image fullscreen at least in one dimension
|
||||
uint32 width = _buffer->getSourceWidth();
|
||||
uint32 height = _buffer->getSourceHeight();
|
||||
uint32 height = _buffer->getSourceHeight();
|
||||
|
||||
_centerX = PSP_SCREEN_WIDTH / 2.0f;
|
||||
_centerY = PSP_SCREEN_HEIGHT / 2.0f;
|
||||
|
||||
|
||||
// see if we fit width wise
|
||||
if (PSP_SCREEN_HEIGHT >= (int)((height * PSP_SCREEN_WIDTH) / (float)width)) {
|
||||
setZoom(PSP_SCREEN_WIDTH / (float)width);
|
||||
setZoom(PSP_SCREEN_WIDTH / (float)width);
|
||||
} else {
|
||||
setZoom(PSP_SCREEN_HEIGHT / (float)height);
|
||||
}
|
||||
|
@ -233,32 +233,32 @@ void ImageViewer::render() {
|
|||
break;
|
||||
}
|
||||
_renderer->render();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ImageViewer::modifyZoom(bool up) {
|
||||
float factor = _zoomFactor;
|
||||
if (up)
|
||||
if (up)
|
||||
factor += 0.1f;
|
||||
else // down
|
||||
factor -= 0.1f;
|
||||
|
||||
setZoom(factor);
|
||||
|
||||
setZoom(factor);
|
||||
}
|
||||
|
||||
void ImageViewer::setZoom(float value) {
|
||||
void ImageViewer::setZoom(float value) {
|
||||
if (value <= 0.0f) // don't want 0 or negative zoom
|
||||
return;
|
||||
|
||||
_zoomFactor = value;
|
||||
_renderer->setStretchXY(value, value);
|
||||
_renderer->setStretchXY(value, value);
|
||||
setOffsetParams();
|
||||
}
|
||||
|
||||
void ImageViewer::moveImageX(float val) {
|
||||
float newVal = _centerX + val;
|
||||
|
||||
if (newVal - (_visibleWidth / 2) > PSP_SCREEN_WIDTH - 4 || newVal + (_visibleWidth / 2) < 4)
|
||||
|
||||
if (newVal - (_visibleWidth / 2) > PSP_SCREEN_WIDTH - 4 || newVal + (_visibleWidth / 2) < 4)
|
||||
return;
|
||||
_centerX = newVal;
|
||||
setOffsetParams();
|
||||
|
@ -266,22 +266,22 @@ void ImageViewer::moveImageX(float val) {
|
|||
|
||||
void ImageViewer::moveImageY(float val) {
|
||||
float newVal = _centerY + val;
|
||||
|
||||
if (newVal - (_visibleHeight / 2) > PSP_SCREEN_HEIGHT - 4 || newVal + (_visibleHeight / 2) < 4)
|
||||
|
||||
if (newVal - (_visibleHeight / 2) > PSP_SCREEN_HEIGHT - 4 || newVal + (_visibleHeight / 2) < 4)
|
||||
return;
|
||||
_centerY = newVal;
|
||||
setOffsetParams();
|
||||
}
|
||||
|
||||
// Set the renderer with the proper offset on the screen
|
||||
// Set the renderer with the proper offset on the screen
|
||||
//
|
||||
void ImageViewer::setOffsetParams() {
|
||||
_visibleWidth = _zoomFactor * _buffer->getSourceWidth();
|
||||
_visibleHeight = _zoomFactor * _buffer->getSourceHeight();
|
||||
|
||||
_visibleHeight = _zoomFactor * _buffer->getSourceHeight();
|
||||
|
||||
int offsetX = _centerX - (int)(_visibleWidth * 0.5f);
|
||||
int offsetY = _centerY - (int)(_visibleHeight * 0.5f);
|
||||
|
||||
|
||||
_renderer->setOffsetOnScreen(offsetX, offsetY);
|
||||
setDirty();
|
||||
}
|
||||
|
@ -290,8 +290,8 @@ void ImageViewer::setOffsetParams() {
|
|||
//
|
||||
void ImageViewer::handleEvent(uint32 event) {
|
||||
DEBUG_ENTER_FUNC();
|
||||
|
||||
switch (event) {
|
||||
|
||||
switch (event) {
|
||||
case EVENT_HIDE:
|
||||
setVisible(false);
|
||||
break;
|
||||
|
|
|
@ -54,10 +54,10 @@ private:
|
|||
float _visibleHeight, _visibleWidth;
|
||||
float _centerX, _centerY;
|
||||
Event _movement;
|
||||
|
||||
|
||||
InputHandler *_inputHandler;
|
||||
DisplayManager *_displayManager;
|
||||
|
||||
|
||||
void setFullScreenImageParams();
|
||||
void loadNextImage();
|
||||
void loadLastImage();
|
||||
|
@ -66,19 +66,19 @@ private:
|
|||
void moveImageX(float val);
|
||||
void moveImageY(float val);
|
||||
bool load(int imageNum);
|
||||
void unload();
|
||||
void unload();
|
||||
void runLoop(); // to get total pausing we have to do our own loop
|
||||
|
||||
|
||||
void setZoom(float value);
|
||||
void setOffsetParams();
|
||||
void modifyZoom(bool up); // up or down
|
||||
void setVisible(bool visible);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
ImageViewer() : _buffer(0), _palette(0), _visible(false),
|
||||
_dirty(false), _init(false), _imageNum(0),
|
||||
_zoomFactor(0.0f), _visibleHeight(0.0f), _visibleWidth(0.0f),
|
||||
ImageViewer() : _buffer(0), _palette(0), _visible(false),
|
||||
_dirty(false), _init(false), _imageNum(0),
|
||||
_zoomFactor(0.0f), _visibleHeight(0.0f), _visibleWidth(0.0f),
|
||||
_centerX(0.0f), _centerY(0.0f), _movement(EVENT_MOVE_STOP),
|
||||
_inputHandler(0), _displayManager(0) {}
|
||||
~ImageViewer() { unload(); } // deallocate images
|
||||
|
@ -88,15 +88,15 @@ public:
|
|||
bool isDirty() { return _dirty; }
|
||||
void setDirty() { _dirty = true; }
|
||||
void setClean() { if (!_visible) // otherwise we want to keep rendering
|
||||
_dirty = false;
|
||||
}
|
||||
_dirty = false;
|
||||
}
|
||||
void resetOnEngineDone();
|
||||
|
||||
|
||||
void handleEvent(uint32 event);
|
||||
|
||||
|
||||
// pointer setters
|
||||
void setInputHandler(InputHandler *inputHandler) { _inputHandler = inputHandler; }
|
||||
void setInputHandler(InputHandler *inputHandler) { _inputHandler = inputHandler; }
|
||||
void setDisplayManager(DisplayManager *displayManager) { _displayManager = displayManager; }
|
||||
};
|
||||
|
||||
#endif /* PSP_IMAGE_VIEWER_H */
|
||||
#endif /* PSP_IMAGE_VIEWER_H */
|
|
@ -198,7 +198,7 @@ bool ButtonPad::getEvent(Common::Event &event, PspEvent &pspEvent, SceCtrlData &
|
|||
uint32 curButtonState = PSP_ALL_BUTTONS & pad.Buttons; // we only care about these
|
||||
|
||||
if (_combosEnabled)
|
||||
modifyButtonsForCombos(pad); // change buttons for combos
|
||||
modifyButtonsForCombos(pad); // change buttons for combos
|
||||
|
||||
return getEventFromButtonState(event, pspEvent, curButtonState);
|
||||
}
|
||||
|
@ -460,7 +460,7 @@ bool InputHandler::handlePspEvent(Common::Event &event, PspEvent &pspEvent) {
|
|||
/*case PSP_EVENT_CHANGE_SPEED:
|
||||
handleSpeedChange(pspEvent.data);
|
||||
break;*/
|
||||
case PSP_EVENT_IMAGE_VIEWER:
|
||||
case PSP_EVENT_IMAGE_VIEWER:
|
||||
_imageViewer->handleEvent(pspEvent.data);
|
||||
break;
|
||||
case PSP_EVENT_IMAGE_VIEWER_SET_BUTTONS:
|
||||
|
@ -530,7 +530,7 @@ void InputHandler::setImageViewerMode(bool active) {
|
|||
_nub.init();
|
||||
_buttonPad.enableCombos(true); // re-enable combos
|
||||
_buttonPad.initButtons();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InputHandler::setButtonsForImageViewer() {
|
||||
|
@ -538,32 +538,32 @@ void InputHandler::setButtonsForImageViewer() {
|
|||
|
||||
// Dpad
|
||||
_buttonPad.clearButtons();
|
||||
_buttonPad.getButton(ButtonPad::BTN_UP, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_ZOOM_IN,
|
||||
_buttonPad.getButton(ButtonPad::BTN_UP, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_ZOOM_IN,
|
||||
PSP_EVENT_NONE, false);
|
||||
_buttonPad.getButton(ButtonPad::BTN_DOWN, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_ZOOM_OUT,
|
||||
_buttonPad.getButton(ButtonPad::BTN_DOWN, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_ZOOM_OUT,
|
||||
PSP_EVENT_NONE, false);
|
||||
_buttonPad.getButton(ButtonPad::BTN_LEFT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_LAST_IMAGE,
|
||||
_buttonPad.getButton(ButtonPad::BTN_LEFT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_LAST_IMAGE,
|
||||
PSP_EVENT_NONE, false);
|
||||
_buttonPad.getButton(ButtonPad::BTN_RIGHT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_NEXT_IMAGE,
|
||||
PSP_EVENT_NONE, false);
|
||||
_buttonPad.getButton(ButtonPad::BTN_LTRIGGER, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
|
||||
_buttonPad.getButton(ButtonPad::BTN_RIGHT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_NEXT_IMAGE,
|
||||
PSP_EVENT_NONE, false);
|
||||
_buttonPad.getButton(ButtonPad::BTN_RTRIGGER, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
|
||||
_buttonPad.getButton(ButtonPad::BTN_LTRIGGER, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
|
||||
PSP_EVENT_NONE, false);
|
||||
_buttonPad.getButton(ButtonPad::BTN_START, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
|
||||
_buttonPad.getButton(ButtonPad::BTN_RTRIGGER, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
|
||||
PSP_EVENT_NONE, false);
|
||||
_buttonPad.getButton(ButtonPad::BTN_SELECT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
|
||||
_buttonPad.getButton(ButtonPad::BTN_START, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
|
||||
PSP_EVENT_NONE, false);
|
||||
_buttonPad.getButton(ButtonPad::BTN_SELECT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE,
|
||||
PSP_EVENT_NONE, false);
|
||||
|
||||
//Nub
|
||||
_nub.getPad().clearButtons();
|
||||
_nub.getPad().getButton(ButtonPad::BTN_UP, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_UP,
|
||||
_nub.getPad().getButton(ButtonPad::BTN_UP, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_UP,
|
||||
PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_STOP);
|
||||
_nub.getPad().getButton(ButtonPad::BTN_DOWN, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_DOWN,
|
||||
_nub.getPad().getButton(ButtonPad::BTN_DOWN, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_DOWN,
|
||||
PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_STOP);
|
||||
_nub.getPad().getButton(ButtonPad::BTN_LEFT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_LEFT,
|
||||
_nub.getPad().getButton(ButtonPad::BTN_LEFT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_LEFT,
|
||||
PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_STOP);
|
||||
_nub.getPad().getButton(ButtonPad::BTN_RIGHT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_RIGHT,
|
||||
_nub.getPad().getButton(ButtonPad::BTN_RIGHT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_RIGHT,
|
||||
PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_STOP);
|
||||
}
|
||||
|
||||
|
|
|
@ -122,16 +122,16 @@ public:
|
|||
ButtonPad();
|
||||
void initButtons(); // set the buttons to the mode that's selected
|
||||
void clearButtons(); // empty the buttons of all events
|
||||
|
||||
|
||||
bool getEvent(Common::Event &event, PspEvent &pspEvent, SceCtrlData &pad);
|
||||
bool getEventFromButtonState(Common::Event &event, PspEvent &pspEvent, uint32 buttonState);
|
||||
|
||||
|
||||
void setShifted(ShiftMode shifted) { _shifted = shifted; }
|
||||
void setPadMode(PspPadMode mode) { _padMode = mode; }
|
||||
bool isButtonDown() { return _prevButtonState; }
|
||||
|
||||
|
||||
void enableCombos(bool value) { _combosEnabled = value; }
|
||||
Button &getButton(ButtonType type, ShiftMode mode) { return _button[type][mode]; }
|
||||
Button &getButton(ButtonType type, ShiftMode mode) { return _button[type][mode]; }
|
||||
};
|
||||
|
||||
class Nub {
|
||||
|
@ -140,17 +140,17 @@ private:
|
|||
|
||||
ShiftMode _shifted;
|
||||
bool _dpadMode;
|
||||
|
||||
|
||||
ButtonPad _buttonPad; // private buttonpad for dpad mode
|
||||
|
||||
|
||||
int32 modifyNubAxisMotion(int32 input);
|
||||
void translateToDpadState(int dpadX, int dpadY, uint32 &buttonState); // convert nub data to dpad data
|
||||
public:
|
||||
Nub() : _shifted(UNSHIFTED), _dpadMode(false) { }
|
||||
void init() { _buttonPad.initButtons(); }
|
||||
void init() { _buttonPad.initButtons(); }
|
||||
|
||||
void setCursor(Cursor *cursor) { _cursor = cursor; }
|
||||
|
||||
|
||||
// setters
|
||||
void setDpadMode(bool active) { _dpadMode = active; }
|
||||
void setShifted(ShiftMode shifted) { _shifted = shifted; }
|
||||
|
@ -163,7 +163,7 @@ public:
|
|||
|
||||
class InputHandler {
|
||||
public:
|
||||
InputHandler() : _keyboard(0), _cursor(0), _imageViewer(0), _padMode(PAD_MODE_NORMAL),
|
||||
InputHandler() : _keyboard(0), _cursor(0), _imageViewer(0), _padMode(PAD_MODE_NORMAL),
|
||||
_lastPadCheckTime(0) {}
|
||||
// pointer setters
|
||||
void setKeyboard(PSPKeyboard *keyboard) { _keyboard = keyboard; }
|
||||
|
@ -175,7 +175,7 @@ public:
|
|||
void setImageViewerMode(bool active);
|
||||
|
||||
private:
|
||||
Nub _nub;
|
||||
Nub _nub;
|
||||
ButtonPad _buttonPad;
|
||||
|
||||
// Pointers to relevant other classes
|
||||
|
|
|
@ -83,7 +83,7 @@ void OSystem_PSP::initBackend() {
|
|||
_inputHandler.setKeyboard(&_keyboard);
|
||||
_inputHandler.setImageViewer(&_imageViewer);
|
||||
_inputHandler.init();
|
||||
|
||||
|
||||
// Set pointers for image viewer
|
||||
_imageViewer.setInputHandler(&_inputHandler);
|
||||
_imageViewer.setDisplayManager(&_displayManager);
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
PngLoader::Status PngLoader::allocate() {
|
||||
DEBUG_ENTER_FUNC();
|
||||
|
||||
|
||||
if (!findImageDimensions()) {
|
||||
PSP_ERROR("failed to get image dimensions\n");
|
||||
return BAD_FILE;
|
||||
|
@ -45,7 +45,7 @@ PngLoader::Status PngLoader::allocate() {
|
|||
_buffer->setSize(_width, _height, _sizeBy);
|
||||
|
||||
uint32 bitsPerPixel = _bitDepth * _channels;
|
||||
|
||||
|
||||
if (_paletteSize) { // 8 or 4-bit image
|
||||
if (bitsPerPixel == 4) {
|
||||
_buffer->setPixelFormat(PSPPixelFormat::Type_Palette_4bit);
|
||||
|
@ -130,7 +130,7 @@ bool PngLoader::basicImageLoad() {
|
|||
png_get_IHDR(_pngPtr, _infoPtr, (png_uint_32 *)&_width, (png_uint_32 *)&_height, &_bitDepth,
|
||||
&_colorType, &interlaceType, int_p_NULL, int_p_NULL);
|
||||
_channels = png_get_channels(_pngPtr, _infoPtr);
|
||||
|
||||
|
||||
if (_colorType & PNG_COLOR_MASK_PALETTE)
|
||||
_paletteSize = _infoPtr->num_palette;
|
||||
|
||||
|
@ -141,7 +141,7 @@ bool PngLoader::basicImageLoad() {
|
|||
bool PngLoader::findImageDimensions() {
|
||||
DEBUG_ENTER_FUNC();
|
||||
|
||||
bool status = basicImageLoad();
|
||||
bool status = basicImageLoad();
|
||||
|
||||
PSP_DEBUG_PRINT("width[%d], height[%d], paletteSize[%d], bitDepth[%d], channels[%d], rowBytes[%d]\n", _width, _height, _paletteSize, _bitDepth, _channels, _infoPtr->rowbytes);
|
||||
png_destroy_read_struct(&_pngPtr, &_infoPtr, png_infopp_NULL);
|
||||
|
@ -157,7 +157,7 @@ bool PngLoader::loadImageIntoBuffer() {
|
|||
if (!basicImageLoad()) {
|
||||
png_destroy_read_struct(&_pngPtr, &_infoPtr, png_infopp_NULL);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
png_set_strip_16(_pngPtr); // Strip off 16 bit channels in case they occur
|
||||
|
||||
if (_paletteSize) {
|
||||
|
@ -178,16 +178,16 @@ bool PngLoader::loadImageIntoBuffer() {
|
|||
}
|
||||
|
||||
uint32 rowBytes = png_get_rowbytes(_pngPtr, _infoPtr);
|
||||
|
||||
// there seems to be a bug in libpng where it doesn't increase the rowbytes or the
|
||||
|
||||
// there seems to be a bug in libpng where it doesn't increase the rowbytes or the
|
||||
// channel even after we add the alpha channel
|
||||
if (_channels == 3 && (rowBytes / _width) == 3) {
|
||||
_channels = 4;
|
||||
rowBytes = _width * _channels;
|
||||
}
|
||||
|
||||
rowBytes = _width * _channels;
|
||||
}
|
||||
|
||||
PSP_DEBUG_PRINT("rowBytes[%d], channels[%d]\n", rowBytes, _channels);
|
||||
|
||||
|
||||
unsigned char *line = (unsigned char*) malloc(rowBytes);
|
||||
if (!line) {
|
||||
png_destroy_read_struct(&_pngPtr, png_infopp_NULL, png_infopp_NULL);
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
Buffer::HowToSize sizeBy = Buffer::kSizeByTextureSize) :
|
||||
_file(file), _buffer(&buffer), _palette(&palette),
|
||||
_width(0), _height(0), _paletteSize(0),
|
||||
_bitDepth(0), _sizeBy(sizeBy), _pngPtr(0),
|
||||
_bitDepth(0), _sizeBy(sizeBy), _pngPtr(0),
|
||||
_infoPtr(0), _colorType(0), _channels(0) {}
|
||||
|
||||
PngLoader::Status allocate();
|
||||
|
|
|
@ -75,38 +75,38 @@ void PspDebugTrace(bool alsoToScreen, const char *format, ...) {
|
|||
#define GET_RET(retAddr) \
|
||||
asm volatile ("move %0,$ra\n\t" \
|
||||
: "=&r" (retAddr) : )
|
||||
|
||||
|
||||
#define GET_SP(stackPtr) \
|
||||
asm volatile ("move %0,$sp\n\t" \
|
||||
: "=&r" (stackPtr) : )
|
||||
|
||||
// Function to retrieve a backtrace for the MIPS processor
|
||||
// This is not trivial since the MIPS doesn't use a frame pointer.
|
||||
// This is not trivial since the MIPS doesn't use a frame pointer.
|
||||
// Takes the number of levels wanted above the calling function (included) and an array of void *
|
||||
//
|
||||
//
|
||||
void mipsBacktrace(uint32 levels, void **addresses) {
|
||||
// get the current return address
|
||||
// get the current return address
|
||||
register byte *retAddr;
|
||||
register byte *stackPointer;
|
||||
GET_RET(retAddr);
|
||||
GET_RET(retAddr);
|
||||
GET_SP(stackPointer);
|
||||
char string[100];
|
||||
|
||||
|
||||
if (!levels)
|
||||
return;
|
||||
|
||||
|
||||
memset(addresses, 0, sizeof(void *) * levels);
|
||||
|
||||
|
||||
uint32 curLevel = 0;
|
||||
|
||||
|
||||
const uint32 SP_SUBTRACT = 0x27bd8000; // The instruction to subtract from the SP looks like this
|
||||
const uint32 SP_SUB_HIGH_MASK = 0xffff8000; // The mask to check for the subtract SP instruction
|
||||
const uint32 SP_SUB_LOW_MASK = 0x0000ffff; // The mask that gives us how much was subtracted
|
||||
|
||||
|
||||
// make sure we go out of the stack of this current level
|
||||
// we already have the return address for this level from the register
|
||||
if (curLevel < levels) {
|
||||
void *thisFunc = (void *)mipsBacktrace;
|
||||
void *thisFunc = (void *)mipsBacktrace;
|
||||
for (uint32 *seekPtr = (uint32 *)thisFunc; ; seekPtr++) {
|
||||
if ((*seekPtr & SP_SUB_HIGH_MASK) == SP_SUBTRACT) {
|
||||
// we found the $sp subtraction at the beginning of the function
|
||||
|
@ -120,10 +120,10 @@ void mipsBacktrace(uint32 levels, void **addresses) {
|
|||
fputs(string, stderr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// keep scanning while more levels are requested
|
||||
while (curLevel < levels) {
|
||||
// now scan backwards from the return address to find the size of the stack
|
||||
|
@ -139,13 +139,13 @@ void mipsBacktrace(uint32 levels, void **addresses) {
|
|||
sprintf(string, "invalid retAddr %p\n", retAddr);
|
||||
fputs(string, stderr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
//sprintf(string, "retAddr[%p]\n", retAddr);
|
||||
//fputs(string, stderr);
|
||||
addresses[curLevel++] = retAddr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ void OSystem_MacOSX::addSysArchivesToSearchSet(Common::SearchSet &s, int priorit
|
|||
}
|
||||
|
||||
void OSystem_MacOSX::setupIcon() {
|
||||
// Don't set icon on OS X, as we use a nicer external icon there.
|
||||
// Don't set icon on OS X, as we use a nicer external icon there.
|
||||
}
|
||||
|
||||
bool OSystem_MacOSX::hasFeature(Feature f) {
|
||||
|
|
|
@ -47,7 +47,7 @@ typedef struct { int FAKE; } FAKE_FILE;
|
|||
|
||||
// Finally forbid FILE again (if it was forbidden to start with)
|
||||
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_FILE)
|
||||
#undef FILE
|
||||
#undef FILE
|
||||
#define FILE FORBIDDEN_SYMBOL_REPLACEMENT
|
||||
#endif
|
||||
|
||||
|
|
|
@ -376,7 +376,7 @@ void OSystem_SDL::setupIcon() {
|
|||
|
||||
if (sscanf(scummvm_icon[0], "%d %d %d %d", &w, &h, &ncols, &nbytes) != 4) {
|
||||
warning("Wrong format of scummvm_icon[0] (%s)", scummvm_icon[0]);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
if ((w > 512) || (h > 512) || (ncols > 255) || (nbytes > 1)) {
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "backends/events/sdl/sdl-events.h"
|
||||
#include "backends/log/log.h"
|
||||
|
||||
/**
|
||||
/**
|
||||
* Base OSystem class for all SDL ports.
|
||||
*/
|
||||
class OSystem_SDL : public ModularBackend {
|
||||
|
@ -38,7 +38,7 @@ public:
|
|||
OSystem_SDL();
|
||||
virtual ~OSystem_SDL();
|
||||
|
||||
/**
|
||||
/**
|
||||
* Pre-initialize backend. It should be called after
|
||||
* instantiating the backend. Early needed managers are
|
||||
* created here.
|
||||
|
|
|
@ -57,7 +57,7 @@ char *GetExecutablePath() {
|
|||
OSystem_SDL_Symbian::OSystem_SDL_Symbian()
|
||||
:
|
||||
_RFs(0) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
void OSystem_SDL_Symbian::init() {
|
||||
|
@ -171,7 +171,7 @@ Common::String OSystem_SDL_Symbian::getDefaultConfigFileName() {
|
|||
}
|
||||
|
||||
void OSystem_SDL_Symbian::setupIcon() {
|
||||
// Don't for Symbian: it uses the EScummVM.aif file for the icon.
|
||||
// Don't for Symbian: it uses the EScummVM.aif file for the icon.
|
||||
}
|
||||
|
||||
RFs& OSystem_SDL_Symbian::FsSession() {
|
||||
|
|
|
@ -621,7 +621,7 @@ Common::String OSystem_WINCE3::getSystemLanguage() const {
|
|||
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVCTRYNAME, ctryNameW, sizeof(ctryNameW)) != 0) {
|
||||
WideCharToMultiByte(CP_ACP, 0, langNameW, -1, langName, (wcslen(langNameW) + 1), NULL, NULL);
|
||||
WideCharToMultiByte(CP_ACP, 0, ctryNameW, -1, ctryName, (wcslen(ctryNameW) + 1), NULL, NULL);
|
||||
|
||||
|
||||
debug(1, "Trying to find posix locale name for %s_%s", langName, ctryName);
|
||||
while (posixMappingTable[i][0] && !localeFound) {
|
||||
if ( (!strcmp(posixMappingTable[i][0], langName) || !strcmp(posixMappingTable[i][0], "*")) &&
|
||||
|
|
|
@ -169,7 +169,7 @@ bool DLObject::loadSegment(Elf32_Phdr *phdr) {
|
|||
warning("elfloader: Out of memory.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
debug(2, "elfloader: Allocated segment @ %p", _segment);
|
||||
|
||||
// Get offset to load segment into
|
||||
|
@ -222,7 +222,7 @@ Elf32_Shdr * DLObject::loadSectionHeaders(Elf32_Ehdr *ehdr) {
|
|||
|
||||
int DLObject::findSymbolTableSection(Elf32_Ehdr *ehdr, Elf32_Shdr *shdr) {
|
||||
int SymbolTableSection = -1;
|
||||
|
||||
|
||||
// Loop over sections, looking for symbol table linked to a string table
|
||||
for (uint32 i = 0; i < ehdr->e_shnum; i++) {
|
||||
if (shdr[i].sh_type == SHT_SYMTAB &&
|
||||
|
@ -233,7 +233,7 @@ int DLObject::findSymbolTableSection(Elf32_Ehdr *ehdr, Elf32_Shdr *shdr) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return SymbolTableSection;
|
||||
}
|
||||
|
||||
|
@ -315,12 +315,12 @@ void DLObject::relocateSymbols(ptrdiff_t offset) {
|
|||
}
|
||||
|
||||
// Track the size of the plugin through memory manager without loading
|
||||
// the plugin into memory.
|
||||
// the plugin into memory.
|
||||
//
|
||||
void DLObject::trackSize(const char *path) {
|
||||
|
||||
|
||||
_file = Common::FSNode(path).createReadStream();
|
||||
|
||||
|
||||
if (!_file) {
|
||||
warning("elfloader: File %s not found.", path);
|
||||
return;
|
||||
|
@ -334,11 +334,11 @@ void DLObject::trackSize(const char *path) {
|
|||
_file = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ELFMemMan.trackPlugin(true); // begin tracking the plugin size
|
||||
|
||||
|
||||
// Load the segments
|
||||
for (uint32 i = 0; i < ehdr.e_phnum; i++) {
|
||||
for (uint32 i = 0; i < ehdr.e_phnum; i++) {
|
||||
debug(2, "elfloader: Loading segment %d", i);
|
||||
|
||||
if (!readProgramHeaders(&ehdr, &phdr, i)) {
|
||||
|
@ -351,7 +351,7 @@ void DLObject::trackSize(const char *path) {
|
|||
ELFMemMan.trackAlloc(phdr.p_align, phdr.p_memsz);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ELFMemMan.trackPlugin(false); // we're done tracking the plugin size
|
||||
|
||||
delete _file;
|
||||
|
@ -367,7 +367,7 @@ bool DLObject::load() {
|
|||
return false;
|
||||
|
||||
//Load the segments
|
||||
for (uint32 i = 0; i < ehdr.e_phnum; i++) {
|
||||
for (uint32 i = 0; i < ehdr.e_phnum; i++) {
|
||||
debug(2, "elfloader: Loading segment %d", i);
|
||||
|
||||
if (readProgramHeaders(&ehdr, &phdr, i) == false)
|
||||
|
@ -386,12 +386,12 @@ bool DLObject::load() {
|
|||
free(shdr);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!loadStringTable(shdr)) {
|
||||
free(shdr);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Offset by our segment allocated address
|
||||
// must use _segmentVMA here for multiple segments (MIPS)
|
||||
_segmentOffset = ptrdiff_t(_segment) - _segmentVMA;
|
||||
|
|
|
@ -100,7 +100,7 @@ DynamicPlugin::VoidFunc ELFPlugin::findSymbol(const char *symbol) {
|
|||
void ELFPlugin::trackSize() {
|
||||
// All we need to do is create our object, track its size, then delete it
|
||||
DLObject *obj = makeDLObject();
|
||||
|
||||
|
||||
obj->trackSize(_filename.c_str());
|
||||
delete obj;
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ void ELFPlugin::unloadPlugin() {
|
|||
PluginList ELFPluginProvider::getPlugins() {
|
||||
PluginList pl = FilePluginProvider::getPlugins();
|
||||
|
||||
#if defined(UNCACHED_PLUGINS) && !defined(ELF_NO_MEM_MANAGER)
|
||||
#if defined(UNCACHED_PLUGINS) && !defined(ELF_NO_MEM_MANAGER)
|
||||
// This static downcast is safe because all of the plugins must
|
||||
// be ELF plugins
|
||||
for (PluginList::iterator p = pl.begin(); p != pl.end(); ++p) {
|
||||
|
@ -190,8 +190,8 @@ PluginList ELFPluginProvider::getPlugins() {
|
|||
// The Memory Manager should now allocate space based on the information
|
||||
// it collected
|
||||
ELFMemMan.allocateHeap();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
return pl;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/scummsys.h"
|
||||
|
||||
#if defined(DYNAMIC_MODULES) && defined(USE_ELF_LOADER)
|
||||
|
||||
|
@ -28,12 +28,12 @@
|
|||
#include "common/debug.h"
|
||||
#include "common/util.h"
|
||||
#include <malloc.h>
|
||||
|
||||
DECLARE_SINGLETON(ELFMemoryManager);
|
||||
|
||||
ELFMemoryManager::ELFMemoryManager() :
|
||||
_heap(0), _heapSize(0), _heapAlign(0),
|
||||
_trackAllocs(false), _measuredSize(0), _measuredAlign(0),
|
||||
DECLARE_SINGLETON(ELFMemoryManager);
|
||||
|
||||
ELFMemoryManager::ELFMemoryManager() :
|
||||
_heap(0), _heapSize(0), _heapAlign(0),
|
||||
_trackAllocs(false), _measuredSize(0), _measuredAlign(0),
|
||||
_bytesAllocated(0) {}
|
||||
|
||||
ELFMemoryManager::~ELFMemoryManager() {
|
||||
|
@ -46,23 +46,23 @@ void ELFMemoryManager::trackPlugin(bool value) {
|
|||
|
||||
if (value == _trackAllocs)
|
||||
return;
|
||||
|
||||
|
||||
_trackAllocs = value;
|
||||
|
||||
|
||||
if (_trackAllocs) { // start measuring
|
||||
// start tracking allocations
|
||||
_measuredAlign = 0;
|
||||
|
||||
|
||||
} else { // we're done measuring
|
||||
// get the total allocated size
|
||||
uint32 measuredSize = _allocList.back().end() - _allocList.front().start;
|
||||
|
||||
_heapSize = MAX(_heapSize, measuredSize);
|
||||
_heapAlign = MAX(_heapAlign, _measuredAlign);
|
||||
|
||||
|
||||
_allocList.clear();
|
||||
_bytesAllocated = 0; // reset
|
||||
|
||||
|
||||
debug(2, "measured a plugin of size %d. Max size %d. Max align %d", measuredSize, _heapSize, _heapAlign);
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ void ELFMemoryManager::trackPlugin(bool value) {
|
|||
void ELFMemoryManager::trackAlloc(uint32 align, uint32 size) {
|
||||
if (!_measuredAlign)
|
||||
_measuredAlign = align;
|
||||
|
||||
|
||||
// use the allocate function to simulate allocation
|
||||
allocateOnHeap(align, size);
|
||||
}
|
||||
|
@ -79,20 +79,20 @@ void ELFMemoryManager::allocateHeap() {
|
|||
// The memory manager should only allocate once
|
||||
assert (!_heap);
|
||||
assert (_heapSize);
|
||||
|
||||
|
||||
// clear the list
|
||||
_allocList.clear();
|
||||
_bytesAllocated = 0;
|
||||
|
||||
|
||||
debug(2, "ELFMemoryManager: allocating %d bytes aligned at %d as the \
|
||||
plugin heap", _heapSize, _heapAlign);
|
||||
|
||||
|
||||
// prepare the heap
|
||||
if (_heapAlign)
|
||||
if (_heapAlign)
|
||||
_heap = ::memalign(_heapAlign, _heapSize);
|
||||
else
|
||||
_heap = ::malloc(_heapSize);
|
||||
|
||||
|
||||
assert(_heap);
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ void *ELFMemoryManager::pluginAllocate(uint32 size) {
|
|||
void *ELFMemoryManager::pluginAllocate(uint32 align, uint32 size) {
|
||||
if (_heap) {
|
||||
return allocateOnHeap(align, size);
|
||||
}
|
||||
}
|
||||
return ::memalign(align, size);
|
||||
}
|
||||
|
||||
|
@ -120,16 +120,16 @@ void ELFMemoryManager::pluginDeallocate(void *ptr) {
|
|||
// Allocate space for the request in our heap
|
||||
void *ELFMemoryManager::allocateOnHeap(uint32 align, uint32 size) {
|
||||
byte *lastAddress = (byte *)_heap;
|
||||
|
||||
|
||||
// We can't allow allocations smaller than sizeof(Allocation). This could
|
||||
// only be from non-plugin allocations and would cause infinite recursion
|
||||
// only be from non-plugin allocations and would cause infinite recursion
|
||||
// when allocating our Allocation in the list.
|
||||
if (size <= sizeof(Allocation))
|
||||
return 0;
|
||||
|
||||
|
||||
Common::List<Allocation>::iterator i;
|
||||
for (i = _allocList.begin(); i != _allocList.end(); i++) {
|
||||
if (i->start - lastAddress > (int)size)
|
||||
if (i->start - lastAddress > (int)size)
|
||||
break;
|
||||
lastAddress = i->end();
|
||||
// align to desired alignment
|
||||
|
@ -137,20 +137,20 @@ void *ELFMemoryManager::allocateOnHeap(uint32 align, uint32 size) {
|
|||
lastAddress = (byte *)( ((uint32)lastAddress + align - 1) & ~(align - 1) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check if we exceeded our heap limit
|
||||
// We skip this case if we're only tracking allocations
|
||||
if (!_trackAllocs && ((uint32)lastAddress + size > (uint32)_heap + _heapSize)) {
|
||||
debug(2, "failed to find space to allocate %d bytes", size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
_allocList.insert(i, Allocation(lastAddress, size));
|
||||
_bytesAllocated += size;
|
||||
|
||||
debug(7, "ELFMemoryManager: allocated %d bytes at %p. Total %d bytes",
|
||||
|
||||
debug(7, "ELFMemoryManager: allocated %d bytes at %p. Total %d bytes",
|
||||
size, lastAddress, _bytesAllocated);
|
||||
|
||||
|
||||
return lastAddress;
|
||||
}
|
||||
|
||||
|
@ -159,14 +159,14 @@ void ELFMemoryManager::deallocateFromHeap(void *ptr) {
|
|||
for (i = _allocList.begin(); i != _allocList.end(); i++) {
|
||||
if (i->start == ptr) {
|
||||
_bytesAllocated -= (*i).size;
|
||||
|
||||
debug(7, "ELFMemoryManager: freed %d bytes at %p. Total %d bytes",
|
||||
|
||||
debug(7, "ELFMemoryManager: freed %d bytes at %p. Total %d bytes",
|
||||
(*i).size, (*i).start, _bytesAllocated);
|
||||
|
||||
|
||||
_allocList.erase(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* defined(DYNAMIC_MODULES) && defined(USE_ELF_LOADER) */
|
||||
|
|
|
@ -30,17 +30,17 @@
|
|||
#include "common/singleton.h"
|
||||
#include "common/list.h"
|
||||
#include "common/mutex.h"
|
||||
|
||||
|
||||
/**
|
||||
* A 'foolproof' way to prevent memory fragmentation. This class is used to
|
||||
* serve as a permanent allocation to prevent the process of loading and
|
||||
* A 'foolproof' way to prevent memory fragmentation. This class is used to
|
||||
* serve as a permanent allocation to prevent the process of loading and
|
||||
* unloading plugins from causing heavy fragmentation.
|
||||
**/
|
||||
|
||||
|
||||
#define ELFMemMan ELFMemoryManager::instance()
|
||||
|
||||
|
||||
class ELFMemoryManager : public Common::Singleton<ELFMemoryManager> {
|
||||
public:
|
||||
public:
|
||||
void trackPlugin(bool value);
|
||||
void trackAlloc(uint32 align, uint32 size);
|
||||
|
||||
|
@ -49,7 +49,7 @@ public:
|
|||
void *pluginAllocate(uint32 size);
|
||||
void *pluginAllocate(uint32 align, uint32 size);
|
||||
void pluginDeallocate(void *ptr);
|
||||
|
||||
|
||||
private:
|
||||
friend class Common::Singleton<ELFMemoryManager>;
|
||||
|
||||
|
@ -58,7 +58,7 @@ private:
|
|||
|
||||
void *allocateOnHeap(uint32 align, uint32 size);
|
||||
void deallocateFromHeap(void *ptr);
|
||||
|
||||
|
||||
struct Allocation {
|
||||
byte *start;
|
||||
uint32 size;
|
||||
|
@ -70,17 +70,17 @@ private:
|
|||
void *_heap;
|
||||
uint32 _heapAlign; // alignment of the heap
|
||||
uint32 _heapSize; // size of the heap
|
||||
|
||||
|
||||
// tracking allocations
|
||||
bool _trackAllocs; // whether we are currently tracking
|
||||
uint32 _measuredSize;
|
||||
uint32 _measuredAlign;
|
||||
|
||||
uint32 _measuredSize;
|
||||
uint32 _measuredAlign;
|
||||
|
||||
// real allocations
|
||||
Common::List<Allocation> _allocList;
|
||||
uint32 _bytesAllocated;
|
||||
};
|
||||
|
||||
|
||||
#endif /* defined(DYNAMIC_MODULES) && defined(USE_ELF_LOADER) */
|
||||
|
||||
#endif /* ELF_MEMORY_MANAGER_H */
|
||||
|
|
|
@ -53,7 +53,7 @@ bool MIPSDLObject::relocate(Elf32_Off offset, Elf32_Word size, byte *relSegment)
|
|||
debug(2, "elfloader: Loaded relocation table. %d entries. base address=%p", cnt, relSegment);
|
||||
|
||||
Elf32_Addr adjustedMainSegment = Elf32_Addr(_segment) - _segmentVMA; // adjust for VMA offset
|
||||
|
||||
|
||||
bool seenHi16 = false; // For treating HI/LO16 commands
|
||||
int32 firstHi16 = -1; // Mark the point of the first hi16 seen
|
||||
Elf32_Addr ahl = 0; // Calculated addend
|
||||
|
@ -259,7 +259,7 @@ void MIPSDLObject::relocateSymbols(ptrdiff_t offset) {
|
|||
if (!ShortsMan.inGeneralSegment((char *)s->st_value)) {
|
||||
if (s->st_value < _segmentVMA)
|
||||
s->st_value = _segmentVMA; // deal with symbols referring to sections, which start before the VMA
|
||||
|
||||
|
||||
s->st_value += offset;
|
||||
|
||||
if (s->st_value < Elf32_Addr(_segment) || s->st_value > Elf32_Addr(_segment) + _segmentSize)
|
||||
|
@ -287,7 +287,7 @@ bool MIPSDLObject::loadSegment(Elf32_Phdr *phdr) {
|
|||
}
|
||||
|
||||
debug(2, "elfloader: Allocated segment @ %p", _segment);
|
||||
|
||||
|
||||
// Get offset to load segment into
|
||||
baseAddress = _segment;
|
||||
_segmentSize = phdr->p_memsz;
|
||||
|
|
|
@ -333,7 +333,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
|
|||
|
||||
PluginManager::instance().init();
|
||||
PluginManager::instance().loadAllPlugins(); // load plugins for cached plugin manager
|
||||
|
||||
|
||||
// If we received an invalid music parameter via command line we check this here.
|
||||
// We can't check this before loading the music plugins.
|
||||
// On the other hand we cannot load the plugins before we know the file paths (in case of external plugins).
|
||||
|
@ -385,7 +385,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
|
|||
system.getAudioCDManager();
|
||||
MusicManager::instance();
|
||||
Common::DebugManager::instance();
|
||||
|
||||
|
||||
// Init the event manager. As the virtual keyboard is loaded here, it must
|
||||
// take place after the backend is initiated and the screen has been setup
|
||||
system.getEventManager()->init();
|
||||
|
@ -424,8 +424,8 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
|
|||
PluginManager::instance().unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL, false);
|
||||
// reallocate the config manager to get rid of any fragmentation
|
||||
ConfMan.defragment();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// Did an error occur ?
|
||||
if (result.getCode() != Common::kNoError && result.getCode() != Common::kUserCanceled) {
|
||||
// Shows an informative error dialog if starting the selected game failed.
|
||||
|
|
|
@ -313,7 +313,7 @@ PluginManager &PluginManager::instance() {
|
|||
if (_instance)
|
||||
return *_instance;
|
||||
|
||||
#if defined(UNCACHED_PLUGINS) && defined(DYNAMIC_MODULES)
|
||||
#if defined(UNCACHED_PLUGINS) && defined(DYNAMIC_MODULES)
|
||||
_instance = new PluginManagerUncached();
|
||||
#else
|
||||
_instance = new PluginManager();
|
||||
|
@ -348,7 +348,7 @@ void PluginManager::addPluginProvider(PluginProvider *pp) {
|
|||
void PluginManagerUncached::init() {
|
||||
unloadAllPlugins();
|
||||
_allEnginePlugins.clear();
|
||||
|
||||
|
||||
// Resize our pluginsInMem list to prevent fragmentation
|
||||
_pluginsInMem[PLUGIN_TYPE_ENGINE].resize(2);
|
||||
unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL, false); // empty the engine plugins
|
||||
|
@ -357,7 +357,7 @@ void PluginManagerUncached::init() {
|
|||
pp != _providers.end();
|
||||
++pp) {
|
||||
PluginList pl((*pp)->getPlugins());
|
||||
|
||||
|
||||
for (PluginList::iterator p = pl.begin(); p != pl.end(); ++p) {
|
||||
// This is a 'hack' based on the assumption that we have no sound
|
||||
// file plugins. Currently this is the case. If it changes, we
|
||||
|
@ -365,15 +365,15 @@ void PluginManagerUncached::init() {
|
|||
// music or an engine plugin.
|
||||
if ((*pp)->isFilePluginProvider()) {
|
||||
_allEnginePlugins.push_back(*p);
|
||||
} else if ((*p)->loadPlugin()) { // and this is the proper method
|
||||
} else if ((*p)->loadPlugin()) { // and this is the proper method
|
||||
if ((*p)->getType() == PLUGIN_TYPE_ENGINE) {
|
||||
(*p)->unloadPlugin();
|
||||
_allEnginePlugins.push_back(*p);
|
||||
} else { // add non-engine plugins to the 'in-memory' list
|
||||
// these won't ever get unloaded
|
||||
addToPluginsInMemList(*p);
|
||||
addToPluginsInMemList(*p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -403,7 +403,7 @@ bool PluginManagerUncached::loadPluginFromGameId(const Common::String &gameId) {
|
|||
bool PluginManagerUncached::loadPluginByFileName(const Common::String &filename) {
|
||||
if (filename.empty())
|
||||
return false;
|
||||
|
||||
|
||||
unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL, false);
|
||||
|
||||
PluginList::iterator i;
|
||||
|
@ -417,7 +417,7 @@ bool PluginManagerUncached::loadPluginByFileName(const Common::String &filename)
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Update the config manager with a plugin file name that we found can handle
|
||||
* the game.
|
||||
**/
|
||||
|
@ -435,7 +435,7 @@ void PluginManagerUncached::updateConfigWithFileName(const Common::String &gameI
|
|||
}
|
||||
}
|
||||
|
||||
void PluginManagerUncached::loadFirstPlugin() {
|
||||
void PluginManagerUncached::loadFirstPlugin() {
|
||||
unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL, false);
|
||||
|
||||
// let's try to find one we can load
|
||||
|
@ -517,7 +517,7 @@ void PluginManager::addToPluginsInMemList(Plugin *plugin) {
|
|||
bool found = false;
|
||||
// The plugin is valid, see if it provides the same module as an
|
||||
// already loaded one and should replace it.
|
||||
|
||||
|
||||
PluginList::iterator pl = _pluginsInMem[plugin->getType()].begin();
|
||||
while (!found && pl != _pluginsInMem[plugin->getType()].end()) {
|
||||
if (!strcmp(plugin->getName(), (*pl)->getName())) {
|
||||
|
@ -542,7 +542,7 @@ void PluginManager::addToPluginsInMemList(Plugin *plugin) {
|
|||
|
||||
DECLARE_SINGLETON(EngineManager);
|
||||
|
||||
/**
|
||||
/**
|
||||
* This function works for both cached and uncached PluginManagers.
|
||||
* For the cached version, most of the logic here will short circuit.
|
||||
*
|
||||
|
@ -554,24 +554,24 @@ GameDescriptor EngineManager::findGame(const Common::String &gameName, const Eng
|
|||
|
||||
// First look for the game using the plugins in memory. This is critical
|
||||
// for calls coming from inside games
|
||||
result = findGameInLoadedPlugins(gameName, plugin);
|
||||
result = findGameInLoadedPlugins(gameName, plugin);
|
||||
if (!result.gameid().empty()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// Now look for the game using the gameId. This is much faster than scanning plugin
|
||||
// by plugin
|
||||
if (PluginMan.loadPluginFromGameId(gameName)) {
|
||||
result = findGameInLoadedPlugins(gameName, plugin);
|
||||
result = findGameInLoadedPlugins(gameName, plugin);
|
||||
if (!result.gameid().empty()) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// We failed to find it using the gameid. Scan the list of plugins
|
||||
PluginMan.loadFirstPlugin();
|
||||
do {
|
||||
result = findGameInLoadedPlugins(gameName, plugin);
|
||||
result = findGameInLoadedPlugins(gameName, plugin);
|
||||
if (!result.gameid().empty()) {
|
||||
// Update with new plugin file name
|
||||
PluginMan.updateConfigWithFileName(gameName);
|
||||
|
@ -582,7 +582,7 @@ GameDescriptor EngineManager::findGame(const Common::String &gameName, const Eng
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Find the game within the plugins loaded in memory
|
||||
**/
|
||||
GameDescriptor EngineManager::findGameInLoadedPlugins(const Common::String &gameName, const EnginePlugin **plugin) const {
|
||||
|
@ -594,7 +594,7 @@ GameDescriptor EngineManager::findGameInLoadedPlugins(const Common::String &game
|
|||
*plugin = 0;
|
||||
|
||||
EnginePlugin::List::const_iterator iter;
|
||||
|
||||
|
||||
for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
|
||||
result = (**iter)->findGame(gameName.c_str());
|
||||
if (!result.gameid().empty()) {
|
||||
|
|
|
@ -143,7 +143,7 @@ extern int pluginTypeVersions[PLUGIN_TYPE_MAX];
|
|||
// Abstract plugins
|
||||
|
||||
/**
|
||||
* Abstract base class for the plugin objects which handle plugins
|
||||
* Abstract base class for the plugin objects which handle plugins
|
||||
* instantiation. Subclasses for this may be used for engine plugins and other
|
||||
* types of plugins. An existing PluginObject refers to an executable file
|
||||
* loaded in memory and ready to run. The plugin, on the other hand, is just
|
||||
|
@ -310,7 +310,7 @@ protected:
|
|||
|
||||
bool tryLoadPlugin(Plugin *plugin);
|
||||
void addToPluginsInMemList(Plugin *plugin);
|
||||
|
||||
|
||||
static PluginManager *_instance;
|
||||
PluginManager();
|
||||
|
||||
|
@ -326,9 +326,9 @@ public:
|
|||
virtual void init() {}
|
||||
virtual void loadFirstPlugin() {}
|
||||
virtual bool loadNextPlugin() { return false; }
|
||||
virtual bool loadPluginFromGameId(const Common::String &gameId) { return false; }
|
||||
virtual void updateConfigWithFileName(const Common::String &gameId) {}
|
||||
|
||||
virtual bool loadPluginFromGameId(const Common::String &gameId) { return false; }
|
||||
virtual void updateConfigWithFileName(const Common::String &gameId) {}
|
||||
|
||||
// Functions used only by the cached PluginManager
|
||||
virtual void loadAllPlugins();
|
||||
void unloadAllPlugins();
|
||||
|
@ -338,7 +338,7 @@ public:
|
|||
const PluginList &getPlugins(PluginType t) { return _pluginsInMem[t]; }
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* Uncached version of plugin manager
|
||||
* Keeps only one dynamic plugin in memory at a time
|
||||
**/
|
||||
|
@ -349,15 +349,15 @@ protected:
|
|||
PluginList::iterator _currentPlugin;
|
||||
|
||||
PluginManagerUncached() {}
|
||||
bool loadPluginByFileName(const Common::String &filename);
|
||||
bool loadPluginByFileName(const Common::String &filename);
|
||||
|
||||
public:
|
||||
virtual void init();
|
||||
virtual void loadFirstPlugin();
|
||||
virtual bool loadNextPlugin();
|
||||
virtual bool loadPluginFromGameId(const Common::String &gameId);
|
||||
virtual void updateConfigWithFileName(const Common::String &gameId);
|
||||
|
||||
virtual bool loadPluginFromGameId(const Common::String &gameId);
|
||||
virtual void updateConfigWithFileName(const Common::String &gameId);
|
||||
|
||||
virtual void loadAllPlugins() {} // we don't allow this
|
||||
};
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ public:
|
|||
|
||||
static void defragment(); // move in memory to reduce fragmentation
|
||||
void copyFrom(ConfigManager &source);
|
||||
|
||||
|
||||
private:
|
||||
friend class Singleton<SingletonBaseType>;
|
||||
ConfigManager();
|
||||
|
|
|
@ -240,7 +240,7 @@ public:
|
|||
operator bool() const { return _pointer != 0; }
|
||||
|
||||
~ScopedPtr() {
|
||||
delete _pointer;
|
||||
delete _pointer;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -728,7 +728,7 @@ int QuickTimeParser::readESDS(Atom atom) {
|
|||
|
||||
byte tag;
|
||||
int length;
|
||||
|
||||
|
||||
readMP4Desc(_fd, tag, length);
|
||||
_fd->readUint16BE(); // id
|
||||
if (tag == kMP4ESDescTag)
|
||||
|
@ -736,7 +736,7 @@ int QuickTimeParser::readESDS(Atom atom) {
|
|||
|
||||
// Check if we've got the Config MPEG-4 header
|
||||
readMP4Desc(_fd, tag, length);
|
||||
if (tag != kMP4DecConfigDescTag)
|
||||
if (tag != kMP4DecConfigDescTag)
|
||||
return 0;
|
||||
|
||||
track->objectTypeMP4 = _fd->readByte();
|
||||
|
|
|
@ -136,7 +136,7 @@ bool NEResources::loadFromCompressedEXE(const String &fileName) {
|
|||
matchPos &= 0xFFF;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ private:
|
|||
uint32 offset;
|
||||
uint32 size;
|
||||
};
|
||||
|
||||
|
||||
typedef HashMap<WinResourceID, Resource, WinResourceID_Hash, WinResourceID_EqualTo> LangMap;
|
||||
typedef HashMap<WinResourceID, LangMap, WinResourceID_Hash, WinResourceID_EqualTo> NameMap;
|
||||
typedef HashMap<WinResourceID, NameMap, WinResourceID_Hash, WinResourceID_EqualTo> TypeMap;
|
||||
|
|
|
@ -743,7 +743,7 @@ int main(int argc, char *argv[]) {
|
|||
writeUint16BE(outFile, 0);
|
||||
writeUint16BE(outFile, kALnewscr_2d);
|
||||
writeUint16BE(outFile, 0);
|
||||
|
||||
|
||||
writeSByte(outFile, NUM_TUNES_1w);
|
||||
writeSByte(outFile, SILENCE_1w);
|
||||
writeSByte(outFile, TEST_SOUND_1w);
|
||||
|
|
|
@ -60,7 +60,7 @@ byte _palette[SIZE_PAL_ARRAY] = {
|
|||
V2, V2, V2 // BRIGHTWHITE
|
||||
};
|
||||
#else
|
||||
// Original paletter found in original exe.
|
||||
// Original paletter found in original exe.
|
||||
// Currently disabled, because the result is quite ugly!
|
||||
// Color table of nearest standard 16 colors in system static palette
|
||||
#define C1 191 // Low intensity value
|
||||
|
|
|
@ -415,7 +415,7 @@ bool extractKyraForestSeqData(PAKFile &out, const ExtractInformation *info, cons
|
|||
const uint8 *src = data;
|
||||
uint8 *dst = buffer;
|
||||
const PatchEntry *patchPos = patchData;
|
||||
|
||||
|
||||
while (dst < (buffer + outsize)) {
|
||||
if ((dst - buffer) == patchPos->pos) {
|
||||
*dst++ = patchPos->val;
|
||||
|
|
|
@ -48,7 +48,7 @@ void link(const char *destFilename, char **srcFilenames, int srcCount) {
|
|||
fwrite(headerStr, 1, 4, destFile);
|
||||
for (int i = 0; i <= srcCount; ++i)
|
||||
fwrite(&v, 1, 4, destFile);
|
||||
|
||||
|
||||
// Set up buffer for copying
|
||||
void *tempBuffer = malloc(BUFFER_SIZE);
|
||||
|
||||
|
@ -117,7 +117,7 @@ int main(int argc, char *argv[]) {
|
|||
// Change the extension
|
||||
strcpy(p, ".bin");
|
||||
}
|
||||
|
||||
|
||||
// Compile the specified source file
|
||||
bool result = Compile(argv[1], destFilename);
|
||||
return result ? 0 : 1;
|
||||
|
|
|
@ -44,7 +44,7 @@ enum CharCode {
|
|||
};
|
||||
|
||||
enum TokenCode {
|
||||
NO_TOKEN, WORD, NUMBER, IDENTIFIER, END_OF_FILE, END_OF_LINE,
|
||||
NO_TOKEN, WORD, NUMBER, IDENTIFIER, END_OF_FILE, END_OF_LINE,
|
||||
RW_DEFINE, RW_COLON, RW_SUB, RW_END, RW_OPCODE,
|
||||
ERROR
|
||||
};
|
||||
|
@ -58,7 +58,7 @@ struct Literal {
|
|||
union {
|
||||
int integer;
|
||||
} value;
|
||||
};
|
||||
};
|
||||
|
||||
struct SymbolEntry {
|
||||
char symbol[MAX_TOKEN_STRING_LENGTH];
|
||||
|
@ -109,12 +109,12 @@ struct OpcodeEntry {
|
|||
};
|
||||
|
||||
OpcodeEntry OpcodeList[OP_DUP + 1] = {
|
||||
{"HALT", OP_NO_PARAM}, {"IMM", OP_IMM_PARAM}, {"ZERO", OP_NO_PARAM}, {"ONE", OP_NO_PARAM},
|
||||
{"MINUSONE", OP_NO_PARAM}, {"STR", OP_IMM_PARAM}, {"DLOAD", OP_IMM_PARAM}, {"DSTORE", OP_IMM_PARAM},
|
||||
{"HALT", OP_NO_PARAM}, {"IMM", OP_IMM_PARAM}, {"ZERO", OP_NO_PARAM}, {"ONE", OP_NO_PARAM},
|
||||
{"MINUSONE", OP_NO_PARAM}, {"STR", OP_IMM_PARAM}, {"DLOAD", OP_IMM_PARAM}, {"DSTORE", OP_IMM_PARAM},
|
||||
{"PAL", OP_IMM_PARAM}, {"LOAD", OP_IMM_PARAM}, {"GLOAD", OP_IMM_PARAM}, {"STORE", OP_IMM_PARAM},
|
||||
{"GSTORE", OP_IMM_PARAM}, {"CALL", OP_IMM_PARAM}, {"LIBCALL", OP_IMM_PARAM}, {"RET", OP_NO_PARAM},
|
||||
{"ALLOC", OP_IMM_PARAM}, {"JUMP", OP_TRANSFER_PARAM}, {"JMPFALSE", OP_TRANSFER_PARAM},
|
||||
{"JMPTRUE", OP_TRANSFER_PARAM}, {"EQUAL", OP_NO_PARAM}, {"LESS", OP_NO_PARAM},
|
||||
{"JMPTRUE", OP_TRANSFER_PARAM}, {"EQUAL", OP_NO_PARAM}, {"LESS", OP_NO_PARAM},
|
||||
{"LEQUAL", OP_NO_PARAM}, {"NEQUAL", OP_NO_PARAM}, {"GEQUAL", OP_NO_PARAM},
|
||||
{"GREAT", OP_NO_PARAM}, {"PLUS", OP_NO_PARAM}, {"MINUS", OP_NO_PARAM},
|
||||
{"LOR", OP_NO_PARAM}, {"MULT", OP_NO_PARAM}, {"DIV", OP_IMM_PARAM}, {"MOD", OP_NO_PARAM},
|
||||
|
@ -418,7 +418,7 @@ void handle_define() {
|
|||
printf("Duplicate symbol encountered.\n");
|
||||
token = ERROR;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Store the new symbol name
|
||||
strcpy(symbolTable[symbolCount].symbol, token_string);
|
||||
|
@ -529,7 +529,7 @@ void handle_instruction() {
|
|||
printf("Incorrect opcode parameter encountered\n");
|
||||
token = ERROR;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Apply the correct opcode size to the previously stored opcode and save the byte(s)
|
||||
if (literal.value.integer <= 0xff) {
|
||||
|
@ -559,7 +559,7 @@ void handle_instruction() {
|
|||
printf("Incorrect opcode parameter encountered\n");
|
||||
token = ERROR;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Check to see if it's a backward jump to an existing label
|
||||
int idx = jumpIndexOf(token_string);
|
||||
|
@ -641,7 +641,7 @@ void handle_sub() {
|
|||
token = ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// If this is the first subroutine, start writing out the data
|
||||
if (subroutinesCount == 0)
|
||||
write_header();
|
||||
|
@ -681,7 +681,7 @@ void handle_sub() {
|
|||
// Save identifier, it's hopefully a jump symbol
|
||||
strcpy(jumpDests[jumpDestCount].name, token_string);
|
||||
get_token();
|
||||
if (token != RW_COLON)
|
||||
if (token != RW_COLON)
|
||||
token = ERROR;
|
||||
else {
|
||||
// Save the jump point
|
||||
|
@ -863,7 +863,7 @@ void get_special() {
|
|||
strToUpper(token_string);
|
||||
if (token_string[0] == '@')
|
||||
token = IDENTIFIER;
|
||||
else if (!is_reserved_word())
|
||||
else if (!is_reserved_word())
|
||||
token = ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -503,7 +503,7 @@ void doCompile(FILE *inf, FILE *debOutf, FILE *resOutf, TextFile *cptDef, FILE *
|
|||
fwrite(&tmp, 2, 1, debOutf);
|
||||
tmp = 0;
|
||||
fwrite(&tmp, 2, 1, debOutf);
|
||||
|
||||
|
||||
printf("DEBUG Output File Position: 0x%08lX\r\n", ftell(debOutf));
|
||||
printf("reset destination: %ld\n", ftell(debOutf));
|
||||
for (int cnt = 0; cnt < 6; cnt++) {
|
||||
|
|
|
@ -188,7 +188,7 @@ void AgiEngine::processEvents() {
|
|||
case Common::KEYCODE_KP5:
|
||||
if (_predictiveDialogRunning)
|
||||
key = event.kbd.ascii;
|
||||
else
|
||||
else
|
||||
key = KEY_STATIONARY;
|
||||
break;
|
||||
case Common::KEYCODE_PLUS:
|
||||
|
|
|
@ -473,7 +473,7 @@ bool AgiBase::canLoadGameStateCurrently() {
|
|||
bool AgiBase::canSaveGameStateCurrently() {
|
||||
if (getGameID() == GID_BC) // Technically in Black Cauldron we may save anytime
|
||||
return true;
|
||||
|
||||
|
||||
return (!(getGameType() == GType_PreAGI) && getflag(fMenusWork) && !_noSaveLoadAllowed && _game.inputEnabled);
|
||||
}
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ void SoundMgr::stopSound() {
|
|||
// not be any harm doing it, so do it anyway.
|
||||
if (_endflag != -1)
|
||||
_vm->setflag(_endflag, true);
|
||||
|
||||
|
||||
_endflag = -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -167,12 +167,12 @@ uint SoundGen2GS::generateOutput() {
|
|||
g->seg++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO: Advance vibrato here. The Apple IIGS uses a LFO with
|
||||
// triangle wave to modulate the frequency of both oscillators.
|
||||
// In Apple IIGS the vibrato and the envelope are updated at the
|
||||
// same time, so the vibrato speed depends on ENVELOPE_COEF.
|
||||
|
||||
|
||||
// Advance oscillators
|
||||
int s0 = 0;
|
||||
int s1 = 0;
|
||||
|
@ -202,12 +202,12 @@ uint SoundGen2GS::generateOutput() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Take envelope and MIDI volume information into account.
|
||||
// Also amplify.
|
||||
s0 *= vol * g->vel / 127 * 80 / 256;
|
||||
s1 *= vol * g->vel / 127 * 80 / 256;
|
||||
|
||||
|
||||
// Select output channel.
|
||||
if (g->osc[0].chn)
|
||||
outl += s0;
|
||||
|
@ -375,7 +375,7 @@ void SoundGen2GS::midiNoteOn(int channel, int note, int velocity) {
|
|||
IIgsGenerator* g = allocateGenerator();
|
||||
g->ins = _channels[channel].getInstrument();
|
||||
const IIgsInstrumentHeader* i = g->ins;
|
||||
|
||||
|
||||
// Pass information from the MIDI channel to the generator. Take
|
||||
// velocity into account, although simplistically.
|
||||
velocity *= 5 / 3;
|
||||
|
@ -385,7 +385,7 @@ void SoundGen2GS::midiNoteOn(int channel, int note, int velocity) {
|
|||
g->key = note;
|
||||
g->vel = velocity * _channels[channel].getVolume() / 127;
|
||||
g->chn = channel;
|
||||
|
||||
|
||||
// Instruments can define different samples to be used based on
|
||||
// what the key is. Find the correct samples for our key.
|
||||
int wa = 0;
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace Agi {
|
|||
// Apple IIGS to halt the corresponding oscillator immediately. We preprocess
|
||||
// the sample data by converting it to signed values and the instruments by
|
||||
// detecting prematurely stopping samples beforehand.
|
||||
//
|
||||
//
|
||||
// Note: None of the tested SIERRASTANDARD files have zeroes in them. So in
|
||||
// practice there is no need to check for them. However, they still do exist
|
||||
// in the sample resources.
|
||||
|
@ -263,7 +263,7 @@ private:
|
|||
uint _ticks; ///< MIDI ticks (60Hz)
|
||||
int16 *_out; ///< Output buffer
|
||||
uint _outSize; ///< Output buffer size
|
||||
|
||||
|
||||
static const int kSfxMidiChannel = 15; ///< MIDI channel used for playing sample resources
|
||||
};
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
// Timing is not perfect, yet. It plays correct, when I use the
|
||||
// Gravis-Midiplayer, but the songs are too fast when I use playmidi on
|
||||
// Linux.
|
||||
//
|
||||
//
|
||||
// Original program developed by Jens. Christian Restemeier
|
||||
//
|
||||
|
||||
|
@ -114,7 +114,7 @@ void SoundGenMIDI::endOfTrack() {
|
|||
|
||||
void SoundGenMIDI::play(int resnum) {
|
||||
MIDISound *track;
|
||||
|
||||
|
||||
stop();
|
||||
|
||||
_isGM = true;
|
||||
|
@ -153,7 +153,7 @@ unsigned char instr[] = {50, 51, 19};
|
|||
static void writeDelta(Common::MemoryWriteStreamDynamic *st, int32 delta) {
|
||||
int32 i;
|
||||
|
||||
i = delta >> 21; if (i > 0) st->writeByte((i & 127) | 128);
|
||||
i = delta >> 21; if (i > 0) st->writeByte((i & 127) | 128);
|
||||
i = delta >> 14; if (i > 0) st->writeByte((i & 127) | 128);
|
||||
i = delta >> 7; if (i > 0) st->writeByte((i & 127) | 128);
|
||||
st->writeByte(delta & 127);
|
||||
|
@ -196,7 +196,7 @@ static uint32 convertSND2MIDI(byte *snddata, byte **data) {
|
|||
int note;
|
||||
/* I don't know, what frequency equals midi note 0 ... */
|
||||
/* This moves the song 4 octaves down: */
|
||||
fr = (log10(111860.0 / (double)freq) / ll) - 48;
|
||||
fr = (log10(111860.0 / (double)freq) / ll) - 48;
|
||||
note = (int)floor(fr + 0.5);
|
||||
if (note < 0) note = 0;
|
||||
if (note > 127) note = 127;
|
||||
|
@ -222,7 +222,7 @@ static uint32 convertSND2MIDI(byte *snddata, byte **data) {
|
|||
st.writeByte(0);
|
||||
st.writeByte(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
writeDelta(&st, 0);
|
||||
st.writeByte(0xff);
|
||||
st.writeByte(0x2f);
|
||||
|
|
|
@ -45,9 +45,9 @@ struct SndGenChan {
|
|||
uint16 dissolveCount;
|
||||
byte attenuation;
|
||||
byte attenuationCopy;
|
||||
|
||||
|
||||
GenType genType;
|
||||
|
||||
|
||||
// for the sample mixer
|
||||
int freqCount;
|
||||
};
|
||||
|
|
|
@ -105,7 +105,7 @@ SoundGenSarien::~SoundGenSarien() {
|
|||
|
||||
int SoundGenSarien::readBuffer(int16 *buffer, const int numSamples) {
|
||||
fillAudio(buffer, numSamples / 2);
|
||||
|
||||
|
||||
return numSamples;
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ void SoundGenSarien::play(int resnum) {
|
|||
for (int i = 0; i < NUM_CHANNELS; i++) {
|
||||
_chn[i].type = type;
|
||||
_chn[i].flags = AGI_SOUND_LOOP;
|
||||
|
||||
|
||||
if (_env) {
|
||||
_chn[i].flags |= AGI_SOUND_ENVELOPE;
|
||||
_chn[i].adsr = AGI_SOUND_ENV_ATTACK;
|
||||
|
|
|
@ -621,7 +621,7 @@ void AGOSEngine_PuzzlePack::printInfoText(const char *itemText) {
|
|||
itemName = " Gem: ";
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 82:
|
||||
if (_variableArray[flag]) {
|
||||
if (_variableArray[flag] == 201 || _variableArray[flag] == 211)
|
||||
|
|
|
@ -55,7 +55,7 @@ int16 canUseOnObject = 0;
|
|||
|
||||
void waitPlayerInput() {
|
||||
uint16 button;
|
||||
|
||||
|
||||
do {
|
||||
manageEvents();
|
||||
getMouseData(mouseUpdateStatus, &button, &dummyU16, &dummyU16);
|
||||
|
|
|
@ -212,7 +212,7 @@ int loadBackground(const char *name, int idx) {
|
|||
// NOTE: the following is really meant to compare pointers and not the actual
|
||||
// strings. See r48092 and r48094.
|
||||
if (name != backgroundTable[idx].name) {
|
||||
if (strlen(name) >= sizeof(backgroundTable[idx].name))
|
||||
if (strlen(name) >= sizeof(backgroundTable[idx].name))
|
||||
warning("background name length exceeded allowable maximum");
|
||||
|
||||
Common::strlcpy(backgroundTable[idx].name, name, sizeof(backgroundTable[idx].name));
|
||||
|
|
|
@ -1882,7 +1882,7 @@ void CruiseEngine::mainLoop() {
|
|||
|
||||
while (numIterations-- > 0) {
|
||||
bgChanged = backgroundChanged[masterScreen];
|
||||
|
||||
|
||||
manageScripts(&relHead);
|
||||
manageScripts(&procHead);
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ void MainMenuDialog::reflowLayout() {
|
|||
_loadButton->setEnabled(_engine->canLoadGameStateCurrently());
|
||||
if (_engine->hasFeature(Engine::kSupportsSavingDuringRuntime))
|
||||
_saveButton->setEnabled(_engine->canSaveGameStateCurrently());
|
||||
|
||||
|
||||
// Overlay size might have changed since the construction of the dialog.
|
||||
// Update labels when it might be needed
|
||||
// FIXME: it might be better to declare GUI::StaticTextWidget::setLabel() virtual
|
||||
|
|
|
@ -243,7 +243,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
|
|||
GUIO_NONE
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
// Drascula French version (ScummVM repacked files)
|
||||
{
|
||||
|
|
|
@ -204,7 +204,7 @@ void DrasculaEngine::copyRect(int xorg, int yorg, int xdes, int ydes, int width,
|
|||
}
|
||||
ptr += 320 - width;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void DrasculaEngine::updateScreen(int xorg, int yorg, int xdes, int ydes, int width, int height, byte *buffer) {
|
||||
|
@ -354,7 +354,7 @@ void DrasculaEngine::centerText(const char *message, int textX, int textY) {
|
|||
print_abc(msg, x, y);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Message doesn't fit on screen, split it
|
||||
|
||||
// Get a word from the message
|
||||
|
|
|
@ -45,7 +45,7 @@ TextResourceParser::TextResourceParser(Common::SeekableReadStream *stream, Dispo
|
|||
_stream(stream), _dispose(dispose) {
|
||||
|
||||
// NOTE: strangely enough, the code before this refactoring used the size of
|
||||
// the stream as a fixed maximum length for the parser. Using an updated
|
||||
// the stream as a fixed maximum length for the parser. Using an updated
|
||||
// (size-pos) would make more sense to me, but let's see what the experts say.
|
||||
_maxLen = _stream->size();
|
||||
}
|
||||
|
|
|
@ -1675,7 +1675,7 @@ void DrasculaEngine::enterRoom(int roomIndex) {
|
|||
if (!stream) {
|
||||
error("missing data file %s", fileName);
|
||||
}
|
||||
|
||||
|
||||
TextResourceParser p(stream, DisposeAfterUse::YES);
|
||||
|
||||
p.parseInt(roomNumber);
|
||||
|
|
|
@ -50,7 +50,7 @@ static const PlainGameDescriptor dreamWebGames[] = {
|
|||
class DreamWebMetaEngine : public AdvancedMetaEngine {
|
||||
public:
|
||||
DreamWebMetaEngine():
|
||||
AdvancedMetaEngine(DreamWeb::gameDescriptions,
|
||||
AdvancedMetaEngine(DreamWeb::gameDescriptions,
|
||||
sizeof(DreamWeb::DreamWebGameDescription), dreamWebGames) {
|
||||
_singleid = "dreamweb";
|
||||
_guioptions = Common::GUIO_NOMIDI;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -44,7 +44,7 @@
|
|||
|
||||
namespace DreamWeb {
|
||||
|
||||
DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gameDesc) :
|
||||
DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gameDesc) :
|
||||
Engine(syst), _gameDescription(gameDesc), _rnd("dreamweb") {
|
||||
|
||||
_context.engine = this;
|
||||
|
@ -223,7 +223,7 @@ Common::Error DreamWebEngine::run() {
|
|||
|
||||
_context.__start();
|
||||
_context.data.byte(DreamGen::DreamGenContext::kQuitrequested) = 0;
|
||||
|
||||
|
||||
getTimerManager()->removeTimerProc(vSyncInterrupt);
|
||||
|
||||
return Common::kNoError;
|
||||
|
@ -428,7 +428,7 @@ void DreamWebEngine::playSound(uint8 channel, uint8 id, uint8 loops) {
|
|||
type = Audio::Mixer::kSFXSoundType;
|
||||
} else if (speech)
|
||||
type = Audio::Mixer::kSpeechSoundType;
|
||||
else
|
||||
else
|
||||
type = Audio::Mixer::kMusicSoundType;
|
||||
|
||||
Audio::SeekableAudioStream *raw;
|
||||
|
@ -445,7 +445,7 @@ void DreamWebEngine::playSound(uint8 channel, uint8 id, uint8 loops) {
|
|||
memcpy(buffer, data.data.begin() + sample.offset, sample.size);
|
||||
|
||||
raw = Audio::makeRawStream(
|
||||
buffer,
|
||||
buffer,
|
||||
sample.size, 22050, Audio::FLAG_UNSIGNED);
|
||||
} else {
|
||||
uint8 *buffer = (uint8 *)malloc(_speechData.size());
|
||||
|
@ -453,9 +453,9 @@ void DreamWebEngine::playSound(uint8 channel, uint8 id, uint8 loops) {
|
|||
if (!buffer)
|
||||
error("out of memory: cannot allocate memory for sound(%u bytes)", _speechData.size());
|
||||
raw = Audio::makeRawStream(
|
||||
buffer,
|
||||
buffer,
|
||||
_speechData.size(), 22050, Audio::FLAG_UNSIGNED);
|
||||
|
||||
|
||||
}
|
||||
|
||||
Audio::AudioStream *stream;
|
||||
|
|
|
@ -104,7 +104,7 @@ public:
|
|||
|
||||
void loadSounds(uint bank, const Common::String &file);
|
||||
bool loadSpeech(const Common::String &filename);
|
||||
|
||||
|
||||
void enableSavingOrLoading(bool enable = true) { _enableSavingOrLoading = enable; }
|
||||
|
||||
private:
|
||||
|
|
|
@ -97,16 +97,16 @@ public:
|
|||
|
||||
struct Segment {
|
||||
Common::Array<uint8> data;
|
||||
|
||||
|
||||
inline void assign(const uint8 *b, const uint8 *e) {
|
||||
data.assign(b, e);
|
||||
}
|
||||
|
||||
|
||||
inline uint8 &byte(unsigned index) {
|
||||
assert(index < data.size());
|
||||
return data[index];
|
||||
}
|
||||
|
||||
|
||||
inline WordRef word(unsigned index) {
|
||||
return WordRef(data, index);
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ public:
|
|||
assert(_segment != 0);
|
||||
_segment->assign(b, e);
|
||||
}
|
||||
|
||||
|
||||
inline uint8* ptr(unsigned index, unsigned size) {
|
||||
assert(_segment != 0);
|
||||
return _segment->ptr(index, size);
|
||||
|
@ -180,7 +180,7 @@ struct Flags {
|
|||
|
||||
inline bool l() const { return _o != _s; }
|
||||
inline bool le() const { return _o != _s|| _z; }
|
||||
|
||||
|
||||
inline void update_zs(uint8 v) {
|
||||
_s = v & 0x80;
|
||||
_z = v == 0;
|
||||
|
@ -228,7 +228,7 @@ public:
|
|||
//data == fake segment register always pointing to data segment
|
||||
Flags flags;
|
||||
|
||||
inline Context(): engine(0), al(ax), ah(ax), bl(bx), bh(bx), cl(cx), ch(cx), dl(dx), dh(dx),
|
||||
inline Context(): engine(0), al(ax), ah(ax), bl(bx), bh(bx), cl(cx), ch(cx), dl(dx), dh(dx),
|
||||
cs(this), ds(this), es(this), data(this) {
|
||||
_segments[kDefaultDataSegment] = SegmentPtr(new Segment());
|
||||
cs.reset(kDefaultDataSegment);
|
||||
|
|
|
@ -367,7 +367,7 @@ void DreamGenContext::dosreturn() {
|
|||
|
||||
ax = data.word(kMousebutton);
|
||||
_and(ax, 1);
|
||||
if (flags.z())
|
||||
if (flags.z())
|
||||
return;
|
||||
|
||||
data.word(kMousebutton) = 0;
|
||||
|
|
|
@ -174,7 +174,7 @@ void Inter_Fascination::oFascin_assign(OpFuncParams ¶ms) {
|
|||
|
||||
case TYPE_VAR_INT32_AS_INT16:
|
||||
case TYPE_ARRAY_INT16:
|
||||
WRITE_VARO_UINT16(dest + i * 2, _vm->_game->_script->getResultInt());
|
||||
WRITE_VARO_UINT16(dest + i * 2, _vm->_game->_script->getResultInt());
|
||||
break;
|
||||
|
||||
case TYPE_VAR_INT32:
|
||||
|
|
|
@ -124,7 +124,7 @@ void Video_v6::drawYUV(Surface &destDesc, int16 x, int16 y,
|
|||
Pixel dstRow = dst;
|
||||
|
||||
int nextChromaLine = (i < ((height - 1) & ~3) ) ? dataWidth : 0;
|
||||
|
||||
|
||||
for (int j = 0; j < width; j++, dstRow++) {
|
||||
|
||||
int nextChromaColumn = (j < ((width - 1) & ~3)) ? 1 : 0;
|
||||
|
|
|
@ -801,17 +801,17 @@ bool MusicPlayerIOS::load(uint32 fileref, bool loop) {
|
|||
19468 ambient (but not 69, amb b. odd)
|
||||
19470 puzzle
|
||||
19471
|
||||
19473
|
||||
19473
|
||||
19475 coffins or blood pump
|
||||
19476 blood pump or coffins
|
||||
19493
|
||||
19499 chapel
|
||||
19509 downstair ambient
|
||||
19510 bedroom 'skip 3 and 5' puzzle (should loop from partway?)
|
||||
19514
|
||||
19514
|
||||
19515 bathroom drain teeth
|
||||
*/
|
||||
if ((fileref >= 19462 && fileref <= 19468) ||
|
||||
if ((fileref >= 19462 && fileref <= 19468) ||
|
||||
fileref == 19470 || fileref == 19471 ||
|
||||
fileref == 19473 || fileref == 19475 ||
|
||||
fileref == 19476 || fileref == 19493 ||
|
||||
|
@ -849,7 +849,7 @@ bool MusicPlayerIOS::load(uint32 fileref, bool loop) {
|
|||
updateVolume();
|
||||
|
||||
// Play!
|
||||
_vm->_system->getMixer()->playStream(Audio::Mixer::kMusicSoundType, &_handle, audStream);
|
||||
_vm->_system->getMixer()->playStream(Audio::Mixer::kMusicSoundType, &_handle, audStream);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,8 +53,8 @@ protected:
|
|||
Common::SeekableReadStream *_file;
|
||||
uint16 _flags;
|
||||
Audio::QueuingAudioStream *_audioStream;
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
// Synchronization stuff
|
||||
bool _begunPlaying;
|
||||
|
|
|
@ -64,8 +64,8 @@ bool HugoConsole::Cmd_gotoScreen(int argc, const char **argv) {
|
|||
if ((argc != 2) || (strToInt(argv[1]) > _vm->_numScreens)){
|
||||
DebugPrintf("Usage: %s <screen number>\n", argv[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_vm->_scheduler->newScreen(strToInt(argv[1]));
|
||||
return false;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ bool HugoConsole::Cmd_listScreens(int argc, const char **argv) {
|
|||
DebugPrintf("Usage: %s\n", argv[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
DebugPrintf("Available screens for this game are:\n");
|
||||
for (int i = 0; i < _vm->_numScreens; i++)
|
||||
DebugPrintf("%2d - %s\n", i, _vm->_text->getScreenNames(i));
|
||||
|
@ -93,7 +93,7 @@ bool HugoConsole::Cmd_listObjects(int argc, const char **argv) {
|
|||
DebugPrintf("Usage: %s\n", argv[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
DebugPrintf("Available objects for this game are:\n");
|
||||
for (int i = 0; i < _vm->_object->_numObj; i++) {
|
||||
if (_vm->_object->_objects[i].genericCmd & TAKE)
|
||||
|
@ -110,7 +110,7 @@ bool HugoConsole::Cmd_getObject(int argc, const char **argv) {
|
|||
DebugPrintf("Usage: %s <object number>\n", argv[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (_vm->_object->_objects[strToInt(argv[1])].genericCmd & TAKE)
|
||||
_vm->_parser->takeObject(&_vm->_object->_objects[strToInt(argv[1])]);
|
||||
else
|
||||
|
@ -127,7 +127,7 @@ bool HugoConsole::Cmd_getAllObjects(int argc, const char **argv) {
|
|||
DebugPrintf("Usage: %s\n", argv[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < _vm->_object->_numObj; i++) {
|
||||
if (_vm->_object->_objects[i].genericCmd & TAKE)
|
||||
_vm->_parser->takeObject(&_vm->_object->_objects[i]);
|
||||
|
|
|
@ -95,15 +95,15 @@ void TopMenu::reflowLayout() {
|
|||
|
||||
_recallButton->resize(x * scale, y * scale, kButtonWidth * scale, kButtonHeight * scale);
|
||||
x += kButtonWidth + kButtonPad;
|
||||
|
||||
|
||||
_turboButton->resize(x * scale, y * scale, kButtonWidth * scale, kButtonHeight * scale);
|
||||
x += kButtonWidth + kButtonPad;
|
||||
|
||||
x += kButtonSpace;
|
||||
|
||||
|
||||
_lookButton->resize(x * scale, y * scale, kButtonWidth * scale, kButtonHeight * scale);
|
||||
x += kButtonWidth + kButtonPad;
|
||||
|
||||
|
||||
_inventButton->resize(x * scale, y * scale, kButtonWidth * scale, kButtonHeight * scale);
|
||||
x += kButtonWidth + kButtonPad;
|
||||
|
||||
|
@ -133,7 +133,7 @@ void TopMenu::loadBmpArr(Common::SeekableReadStream &in) {
|
|||
arrayBmp[i * 2 + 1]->create(arrayBmp[i * 2]->w * 2, arrayBmp[i * 2]->h * 2, g_system->getOverlayFormat());
|
||||
byte *src = (byte *)arrayBmp[i * 2]->pixels;
|
||||
byte *dst = (byte *)arrayBmp[i * 2 + 1]->pixels;
|
||||
|
||||
|
||||
for (int j = 0; j < arrayBmp[i * 2]->h; j++) {
|
||||
src = (byte *)arrayBmp[i * 2]->getBasePtr(0, j);
|
||||
dst = (byte *)arrayBmp[i * 2 + 1]->getBasePtr(0, j * 2);
|
||||
|
@ -153,7 +153,7 @@ void TopMenu::loadBmpArr(Common::SeekableReadStream &in) {
|
|||
*dst++ = *src++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
in.skip(bmpSize);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -736,7 +736,7 @@ overlayState_t Screen_v1d::findOvl(seq_t *seq_p, image_pt dst_p, uint16 y) {
|
|||
uint16 index = (uint16)(dst_p - _frontBuffer) >> 3;
|
||||
|
||||
for (int i = 0; i < seq_p->lines-y; i++) { // Each line in object
|
||||
if (_vm->_object->getBaseBoundary(index)) // If any overlay base byte is non-zero then the object is foreground, else back.
|
||||
if (_vm->_object->getBaseBoundary(index)) // If any overlay base byte is non-zero then the object is foreground, else back.
|
||||
return kOvlForeground;
|
||||
index += kCompLineSize;
|
||||
}
|
||||
|
|
|
@ -299,7 +299,7 @@ Common::Error HugoEngine::run() {
|
|||
_status.helpFl = false;
|
||||
_file->instructions();
|
||||
}
|
||||
|
||||
|
||||
_mouse->mouseHandler(); // Mouse activity - adds to display list
|
||||
_screen->displayList(kDisplayDisplay); // Blit the display list to screen
|
||||
_status.doQuitFl |= shouldQuit(); // update game quit flag
|
||||
|
@ -315,7 +315,7 @@ void HugoEngine::initMachine() {
|
|||
_object->readObjectImages(); // Read all object images
|
||||
if (_platform == Common::kPlatformWindows)
|
||||
_file->readUIFImages(); // Read all uif images (only in Win versions)
|
||||
|
||||
|
||||
_sound->initPcspkrPlayer();
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue