Merge remote branch 'upstream/master' into pegasus

Conflicts:
	video/qt_decoder.cpp
This commit is contained in:
Matthew Hoops 2011-12-12 15:25:28 -05:00
commit 00279659b2
920 changed files with 67209 additions and 66917 deletions

4
.gitignore vendored
View file

@ -29,6 +29,7 @@ lib*.a
/build
/staging
/portdist
/backends/platform/dc/gui
/backends/platform/dc/graphics
@ -164,3 +165,6 @@ ScummVM.config
ScummVM.creator
ScummVM.files
ScummVM.includes
#Ignore Komodo IDE/Edit project files
*.komodoproject

106
AUTHORS
View file

@ -71,6 +71,9 @@ ScummVM Team
Kari Salminen
Eugene Sandulenko
Composer:
Alyssa Milburn
CruisE:
Paul Gilbert
Vincent Hamm - (retired)
@ -84,9 +87,9 @@ ScummVM Team
Pawel Kolodziejski
DreamWeb:
Vladimir Menshakov
Torbjorn Andersson
Bertrand Augereau
Vladimir Menshakov - (retired)
Gob:
Torbjorn Andersson
@ -119,12 +122,6 @@ ScummVM Team
Lure:
Paul Gilbert
M4:
Torbjorn Andersson
Paul Gilbert
Benjamin Haisch
Filippos Karapetis
MADE:
Benjamin Haisch
Filippos Karapetis
@ -178,15 +175,15 @@ ScummVM Team
Jonathan Gray - (retired)
Sword25:
Eugene Sandulenko
Filippos Karapetis
Max Horn - (retired)
Paul Gilbert
Torbjorn Andersson
Paul Gilbert
Max Horn - (retired)
Filippos Karapetis
Eugene Sandulenko
TeenAgent:
Robert Megone - Help with callback rewriting
Vladimir Menshakov
Vladimir Menshakov - (retired)
Tinsel:
Torbjorn Andersson
@ -204,8 +201,8 @@ ScummVM Team
Gregory Montoir
TsAGE:
Paul Gilbert
Arnaud Boutonne
Paul Gilbert
Tucker:
Gregory Montoir
@ -239,8 +236,8 @@ ScummVM Team
Fabio Battaglia
Nintendo DS:
Neil Millstone
Bertrand Augereau - HQ software scaler
Neil Millstone
OpenPandora:
John Willis
@ -255,8 +252,8 @@ ScummVM Team
Max Lingua
PSP (PlayStation Portable):
Joost Peters
Yotam Barnoy
Joost Peters
SDL (Win/Linux/OS X/etc.):
Max Horn - (retired)
@ -432,6 +429,7 @@ Other contributions
Spanish:
Tomas Maidagan
Jordi Vilalta Prat
Swedish:
Hampus Flink
@ -442,11 +440,11 @@ Other contributions
Websites (design)
-----------------
Dobo Balazs - Website design
Yaroslav Fedevych - HTML/CSS for the website
David Jensen - SVG logo conversion
Jean Marc Gimenez - ScummVM logo
Raina - ScummVM forum buttons
William Claydon - Skins for doxygen, buildbot and wiki
Yaroslav Fedevych - HTML/CSS for the website
Jean Marc Gimenez - ScummVM logo
David Jensen - SVG logo conversion
Raina - ScummVM forum buttons
Code contributions
------------------
@ -482,50 +480,50 @@ Other contributions
FreeSCI Contributors
--------------------
Anders Baden Nielsen - PPC testing
Bas Zoetekouw - Man pages, debian package management, CVS
maintenance
Carl Muckenhoupt - Sources to the SCI resource viewer tools that
started it all
Francois-R Boyer - MT-32 information and mapping code
Rainer Canavan - IRIX MIDI driver and bug fixes
Xiaojun Chen
Paul David Doherty - Game version information
Vyacheslav Dikonov - Config script improvements
Ruediger Hanke - Port to the MorphOS platform
Matt Hargett - Clean-ups, bugfixes, Hardcore QA, Win32
Max Horn - SetJump implementation
Ravi I. - SCI0 sound resource specification
Emmanuel Jeandel - Bugfixes and bug reports
Dmitry Jemerov - Port to the Win32 platform, numerous bugfixes
Chris Kehler - Makefile enhancements
Christoph Reichenbach - UN*X code, VM/Graphics/Sound/other
infrastructure
Christopher T. Lansdo - Original CVS maintainer, Alpha compatibility
fixes
Sergey Lapin - Port of Carl's type 2 decompression code
Rickard Lind - MT-32->GM MIDI mapping magic, sound research
Hubert Maier - AmigaOS 4 port
Johannes Manhave - Document format translation
Claudio Matsuoka - CVS snapshots, daily builds, BeOS and cygwin
ports
Dark Minister - SCI research (bytecode and parser)
Dmitry Jemerov - Port to the Win32 platform, numerous bugfixes
Emmanuel Jeandel - Bugfixes and bug reports
Francois-R Boyer - MT-32 information and mapping code
George Reid - FreeBSD package management
Hubert Maier - AmigaOS 4 port
Hugues Valois - Game selection menu
Johannes Manhave - Document format translation
Jordi Vilalta - Numerous code and website clean-up patches
Lars Skovlund - Project maintenance, most documentation,
bugfixes, SCI1 support
Carl Muckenhoupt - Sources to the SCI resource viewer tools that
started it all
Anders Baden Nielsen - PPC testing
Walter van Niftrik - Ports to the Dreamcast and GP32 platforms
Rune Orsval - Configuration file editor
Solomon Peachy - SDL ports and much of the sound subsystem
Robey Pointer - Bug tracking system hosting
Magnus Reftel - Heap implementation, Python class viewer,
bugfixes
Matt Hargett - Clean-ups, bugfixes, Hardcore QA, Win32
Max Horn - SetJump implementation
Paul David Doherty - Game version information
Christoph Reichenbach - UN*X code, VM/Graphics/Sound/other
infrastructure
George Reid - FreeBSD package management
Lars Skovlund - Project maintenance, most documentation,
bugfixes, SCI1 support
Rink Springer - Port to the DOS platform, several bug fixes
Rainer De Temple - SCI research
Sean Terrell
Hugues Valois - Game selection menu
Jordi Vilalta - Numerous code and website clean-up patches
Petr Vyhnak - The DCL-INFLATE algorithm, many Win32
improvements
Rainer Canavan - IRIX MIDI driver and bug fixes
Rainer De Temple - SCI research
Ravi I. - SCI0 sound resource specification
Ruediger Hanke - Port to the MorphOS platform
Rune Orsval - Configuration file editor
Rickard Lind - MT-32->GM MIDI mapping magic, sound research
Rink Springer - Port to the DOS platform, several bug fixes
Robey Pointer - Bug tracking system hosting
Sergey Lapin - Port of Carl's type 2 decompression code
Solomon Peachy - SDL ports and much of the sound subsystem
Vyacheslav Dikonov - Config script improvements
Walter van Niftrik - Ports to the Dreamcast and GP32 platforms
Xiaojun Chen
Sean Terrell
Bas Zoetekouw - Man pages, debian package management, CVS
maintenance
Special thanks to Prof. Dr. Gary Nutt for allowing the FreeSCI VM
extension as a course project in his Advanced OS course.
@ -557,6 +555,8 @@ Special thanks to
Tristan - For additional work on the original MT-32 emulator
James Woodcock - Soundtrack enhancements
Some icons by Yusuke Kamiyamane
Tony Warriner and everyone at Revolution Software Ltd. for sharing with us
the source of some of their brilliant games, allowing us to release
Beneath a Steel Sky as freeware... and generally being supportive above

View file

@ -252,9 +252,6 @@ endif
ifdef ENABLE_LURE
DIST_FILES_ENGINEDATA+=lure.dat
endif
ifdef ENABLE_M4
DIST_FILES_ENGINEDATA+=m4.dat
endif
ifdef ENABLE_QUEEN
DIST_FILES_ENGINEDATA+=queen.tbl
endif

48
NEWS
View file

@ -1,7 +1,36 @@
For a more comprehensive changelog of the latest experimental code, see:
https://github.com/scummvm/scummvm/commits/
1.4.0 (????-??-??)
1.5.0 (????-??-??)
New Games:
- Added support for Soltys.
SDL ports:
- Added support for OpenGL (GSoC Task).
Broken Sword 1:
- Fixed incorrect sound effects in the DOS/Windows demo.
Cine:
- Implemented Roland MT-32 output driver.
SCUMM:
- Added support for the Macintosh version of SPY Fox in Hold the Mustard.
1.4.1 (????-??-??)
AGOS:
- Fixed loading videos directly from InstallShield cabinets in the Windows
version of the The Feeble Files.
KYRA:
- Fixed bug in the original Lands of Lore GUI which made ScummVM error out
in the case the user did not have a contiguous save slot usage.
SCI:
- Fixed race condition in SCI1.1 palette changes. This fixes an error in
QFG1VGA, when sleeping at Erana's place.
1.4.0 (2011-11-11)
New Games:
- Added support for Lands of Lore: The Throne of Chaos.
- Added support for Blue's Birthday Adventure.
@ -11,6 +40,10 @@ For a more comprehensive changelog of the latest experimental code, see:
New Ports:
- Added PlayStation 3 port.
General:
- Fixed the ARM assembly routine for reverse stereo audio.
- Added support for building with MacPorts out of the box.
AGI:
- Implemented sound support for the DOS version of Winnie the Pooh in the
Hundred Acre Wood.
@ -42,12 +75,19 @@ For a more comprehensive changelog of the latest experimental code, see:
- Improved palette handling for the Amiga version of Indiana Jones and the
Fate of Atlantis.
SDL ports:
- Added support for OpenGL (GSoC Task).
Broken Sword 1:
- Fix freeze in Windows demo.
- Fix crash when using cutscene subtitles pack with the Macintosh version.
TINSEL:
Tinsel:
- Fixed deleting saved games from the list of saved games (from the launcher
and the in-game ScummVM menu).
- The US version of Discworld II now shows the correct title screen and
language flag.
Android port:
- Fixed plugins on Android 3.x.
- Moved the default saved game location to the SD card.
1.3.1 (2011-07-12)
General:

1
README
View file

@ -956,6 +956,7 @@ arguments -- see the next section.
--themepath=PATH Path to where GUI themes are stored
--list-themes Display list of all usable GUI themes
-e, --music-driver=MODE Select music driver (see also section 7.0)
--list-audio-devices List all available audio devices
-q, --language=LANG Select game's language (see also section 5.2)
-m, --music-volume=NUM Set the music volume, 0-255 (default: 192)
-s, --sfx-volume=NUM Set the sfx volume, 0-255 (default: 192)

View file

@ -20,8 +20,8 @@
*
*/
#ifndef SOUND_AUDIOSTREAM_H
#define SOUND_AUDIOSTREAM_H
#ifndef AUDIO_AUDIOSTREAM_H
#define AUDIO_AUDIOSTREAM_H
#include "common/ptr.h"
#include "common/scummsys.h"

View file

@ -26,8 +26,8 @@
* - groovie
*/
#ifndef SOUND_AAC_H
#define SOUND_AAC_H
#ifndef AUDIO_AAC_H
#define AUDIO_AAC_H
#include "common/scummsys.h"
#include "common/types.h"
@ -59,4 +59,4 @@ Codec *makeAACDecoder(
} // End of namespace Audio
#endif // #ifdef USE_FAAD
#endif // #ifndef SOUND_AAC_H
#endif // #ifndef AUDIO_AAC_H

View file

@ -31,8 +31,8 @@
* - tinsel
*/
#ifndef SOUND_ADPCM_H
#define SOUND_ADPCM_H
#ifndef AUDIO_ADPCM_H
#define AUDIO_ADPCM_H
#include "common/scummsys.h"
#include "common/types.h"

View file

@ -28,8 +28,8 @@
* ADPCM decoder implementations.
*/
#ifndef SOUND_ADPCM_INTERN_H
#define SOUND_ADPCM_INTERN_H
#ifndef AUDIO_ADPCM_INTERN_H
#define AUDIO_ADPCM_INTERN_H
#include "audio/audiostream.h"
#include "common/endian.h"
@ -43,7 +43,7 @@ namespace Audio {
class ADPCMStream : public RewindableAudioStream {
protected:
Common::DisposablePtr<Common::SeekableReadStream> _stream;
const int32 _startpos;
int32 _startpos;
const int32 _endpos;
const int _channels;
const uint32 _blockAlign;
@ -97,9 +97,7 @@ protected:
public:
Ima_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign)
: ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) {
memset(&_status, 0, sizeof(_status));
}
: ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) {}
/**
* This table is used by decodeIMA.

View file

@ -28,8 +28,8 @@
* - sword1
*/
#ifndef SOUND_AIFF_H
#define SOUND_AIFF_H
#ifndef AUDIO_AIFF_H
#define AUDIO_AIFF_H
#include "common/scummsys.h"
#include "common/types.h"

View file

@ -26,7 +26,6 @@
* - agos
* - draci
* - kyra
* - m4
* - queen
* - saga
* - sci
@ -37,8 +36,8 @@
* - tucker
*/
#ifndef SOUND_FLAC_H
#define SOUND_FLAC_H
#ifndef AUDIO_FLAC_H
#define AUDIO_FLAC_H
#include "common/scummsys.h"
#include "common/types.h"
@ -68,4 +67,4 @@ SeekableAudioStream *makeFLACStream(
} // End of namespace Audio
#endif // #ifdef USE_FLAC
#endif // #ifndef SOUND_FLAC_H
#endif // #ifndef AUDIO_FLAC_H

View file

@ -26,8 +26,8 @@
* - parallaction
*/
#ifndef SOUND_IFF_H
#define SOUND_IFF_H
#ifndef AUDIO_IFF_H
#define AUDIO_IFF_H
namespace Common {
class ReadStream;

View file

@ -26,8 +26,8 @@
* - sci
*/
#ifndef SOUND_MAC_SND_H
#define SOUND_MAC_SND_H
#ifndef AUDIO_MAC_SND_H
#define AUDIO_MAC_SND_H
#include "common/scummsys.h"
#include "common/types.h"

View file

@ -26,7 +26,6 @@
* - agos
* - draci
* - kyra
* - m4
* - mohawk
* - queen
* - saga
@ -38,8 +37,8 @@
* - tucker
*/
#ifndef SOUND_MP3_H
#define SOUND_MP3_H
#ifndef AUDIO_MP3_H
#define AUDIO_MP3_H
#include "common/scummsys.h"
#include "common/types.h"
@ -69,4 +68,4 @@ SeekableAudioStream *makeMP3Stream(
} // End of namespace Audio
#endif // #ifdef USE_MAD
#endif // #ifndef SOUND_MP3_H
#endif // #ifndef AUDIO_MP3_H

View file

@ -1832,7 +1832,7 @@ QDM2Stream::QDM2Stream(Common::SeekableReadStream *extraData, DisposeAfterUse::F
_subSampling = _fftOrder - 7;
_frequencyRange = 255 / (1 << (2 - _subSampling));
switch ((_subSampling * 2 + _channels - 1)) {
switch (_subSampling * 2 + _channels - 1) {
case 0:
tmp = 40;
break;

View file

@ -87,6 +87,9 @@ void QuickTimeAudioDecoder::init() {
// Initialize the codec (if necessary)
entry->initCodec();
if (_tracks[_audioTrackIndex]->editCount != 1)
warning("Multiple edit list entries in an audio track. Things may go awry");
}
}
}
@ -414,7 +417,9 @@ public:
}
Timestamp getLength() const {
return Timestamp(0, _tracks[_audioTrackIndex]->duration, _tracks[_audioTrackIndex]->timeScale);
// TODO: Switch to the other one when audio edits are supported
//return Timestamp(0, _tracks[_audioTrackIndex]->duration, _timeScale);
return Timestamp(0, _tracks[_audioTrackIndex]->mediaDuration, _tracks[_audioTrackIndex]->timeScale);
}
};

View file

@ -50,35 +50,14 @@ namespace Audio {
template<bool is16Bit, bool isUnsigned, bool isLE>
class RawStream : public SeekableAudioStream {
public:
RawStream(int rate, bool stereo, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream, const RawStreamBlockList &blocks)
: _rate(rate), _isStereo(stereo), _playtime(0, rate), _stream(stream, disposeStream), _blocks(blocks), _curBlock(_blocks.begin()), _blockLeft(0), _buffer(0) {
assert(_blocks.size() > 0);
RawStream(int rate, bool stereo, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream)
: _rate(rate), _isStereo(stereo), _playtime(0, rate), _stream(stream, disposeStream), _endOfData(false), _buffer(0) {
// Setup our buffer for readBuffer
_buffer = new byte[kSampleBufferLength * (is16Bit ? 2 : 1)];
assert(_buffer);
// Set current buffer state, playing first block
_stream->seek(_curBlock->pos, SEEK_SET);
// In case of an error we will stop (or rather
// not start) stream playback.
if (_stream->err()) {
_blockLeft = 0;
_curBlock = _blocks.end();
} else {
_blockLeft = _curBlock->len;
}
// Add up length of all blocks in order to caluclate total play time
int32 len = 0;
for (RawStreamBlockList::const_iterator i = _blocks.begin(); i != _blocks.end(); ++i) {
assert(i->len % (_isStereo ? 2 : 1) == 0);
len += i->len;
}
_playtime = Timestamp(0, len / (_isStereo ? 2 : 1), rate);
// Calculate the total playtime of the stream
_playtime = Timestamp(0, _stream->size() / (_isStereo ? 2 : 1) / (is16Bit ? 2 : 1), rate);
}
~RawStream() {
@ -88,7 +67,7 @@ public:
int readBuffer(int16 *buffer, const int numSamples);
bool isStereo() const { return _isStereo; }
bool endOfData() const { return (_curBlock == _blocks.end()) && (_blockLeft == 0); }
bool endOfData() const { return _endOfData; }
int getRate() const { return _rate; }
Timestamp getLength() const { return _playtime; }
@ -99,16 +78,7 @@ private:
const bool _isStereo; ///< Whether this is an stereo stream
Timestamp _playtime; ///< Calculated total play time
Common::DisposablePtr<Common::SeekableReadStream> _stream; ///< Stream to read data from
const RawStreamBlockList _blocks; ///< Audio block list
RawStreamBlockList::const_iterator _curBlock; ///< Current audio block number
int32 _blockLeft; ///< How many bytes are still left in the current block
/**
* Advance one block in the stream in case
* the current one is empty.
*/
void updateBlockIfNeeded();
bool _endOfData; ///< Whether the stream end has been reached
byte *_buffer; ///< Buffer used in readBuffer
enum {
@ -169,13 +139,9 @@ int RawStream<is16Bit, isUnsigned, isLE>::fillBuffer(int maxSamples) {
// We will only read up to maxSamples
while (maxSamples > 0 && !endOfData()) {
// Calculate how many samples we can safely read
// from the current block.
const int len = MIN<int>(maxSamples, _blockLeft);
// Try to read all the sample data and update the
// destination pointer.
const int bytesRead = _stream->read(dst, len * (is16Bit ? 2 : 1));
const int bytesRead = _stream->read(dst, maxSamples * (is16Bit ? 2 : 1));
dst += bytesRead;
// Calculate how many samples we actually read.
@ -184,88 +150,32 @@ int RawStream<is16Bit, isUnsigned, isLE>::fillBuffer(int maxSamples) {
// Update all status variables
bufferedSamples += samplesRead;
maxSamples -= samplesRead;
_blockLeft -= samplesRead;
// In case of an error we will stop
// stream playback.
if (_stream->err()) {
_blockLeft = 0;
_curBlock = _blocks.end();
}
// Advance to the next block in case the current
// one is already finished.
updateBlockIfNeeded();
// We stop stream playback, when we reached the end of the data stream.
// We also stop playback when an error occures.
if (_stream->pos() == _stream->size() || _stream->err() || _stream->eos())
_endOfData = true;
}
return bufferedSamples;
}
template<bool is16Bit, bool isUnsigned, bool isLE>
void RawStream<is16Bit, isUnsigned, isLE>::updateBlockIfNeeded() {
// Have we now finished this block? If so, read the next block
if (_blockLeft == 0 && _curBlock != _blocks.end()) {
// Next block
++_curBlock;
// Check whether we reached the end of the stream
// yet. In case we did not do this, we will just
// setup the next block as new block.
if (_curBlock != _blocks.end()) {
_stream->seek(_curBlock->pos, SEEK_SET);
// In case of an error we will stop
// stream playback.
if (_stream->err()) {
_blockLeft = 0;
_curBlock = _blocks.end();
} else {
_blockLeft = _curBlock->len;
}
}
}
}
template<bool is16Bit, bool isUnsigned, bool isLE>
bool RawStream<is16Bit, isUnsigned, isLE>::seek(const Timestamp &where) {
_blockLeft = 0;
_curBlock = _blocks.end();
_endOfData = true;
if (where > _playtime)
return false;
const uint32 seekSample = convertTimeToStreamPos(where, getRate(), isStereo()).totalNumberOfFrames();
uint32 curSample = 0;
_stream->seek(seekSample * (is16Bit ? 2 : 1), SEEK_SET);
// Search for the disk block in which the specific sample is placed
for (_curBlock = _blocks.begin(); _curBlock != _blocks.end(); ++_curBlock) {
uint32 nextBlockSample = curSample + _curBlock->len;
if (nextBlockSample > seekSample)
break;
curSample = nextBlockSample;
}
if (_curBlock == _blocks.end()) {
return ((seekSample - curSample) == 0);
} else {
const uint32 offset = seekSample - curSample;
_stream->seek(_curBlock->pos + offset * (is16Bit ? 2 : 1), SEEK_SET);
// In case of an error we will stop
// stream playback.
if (_stream->err()) {
_blockLeft = 0;
_curBlock = _blocks.end();
} else {
_blockLeft = _curBlock->len - offset;
}
// In case of an error we will not continue stream playback.
if (!_stream->err() && !_stream->eos() && _stream->pos() != _stream->size())
_endOfData = false;
return true;
}
}
#pragma mark -
#pragma mark --- Raw stream factories ---
@ -283,28 +193,21 @@ bool RawStream<is16Bit, isUnsigned, isLE>::seek(const Timestamp &where) {
#define MAKE_RAW_STREAM(UNSIGNED) \
if (is16Bit) { \
if (isLE) \
return new RawStream<true, UNSIGNED, true>(rate, isStereo, disposeAfterUse, stream, blockList); \
return new RawStream<true, UNSIGNED, true>(rate, isStereo, disposeAfterUse, stream); \
else \
return new RawStream<true, UNSIGNED, false>(rate, isStereo, disposeAfterUse, stream, blockList); \
return new RawStream<true, UNSIGNED, false>(rate, isStereo, disposeAfterUse, stream); \
} else \
return new RawStream<false, UNSIGNED, false>(rate, isStereo, disposeAfterUse, stream, blockList)
return new RawStream<false, UNSIGNED, false>(rate, isStereo, disposeAfterUse, stream)
SeekableAudioStream *makeRawStream(Common::SeekableReadStream *stream,
const RawStreamBlockList &blockList,
int rate,
byte flags,
int rate, byte flags,
DisposeAfterUse::Flag disposeAfterUse) {
const bool isStereo = (flags & Audio::FLAG_STEREO) != 0;
const bool is16Bit = (flags & Audio::FLAG_16BITS) != 0;
const bool isUnsigned = (flags & Audio::FLAG_UNSIGNED) != 0;
const bool isLE = (flags & Audio::FLAG_LITTLE_ENDIAN) != 0;
if (blockList.empty()) {
warning("Empty block list passed to makeRawStream");
if (disposeAfterUse == DisposeAfterUse::YES)
delete stream;
return 0;
}
assert(stream->size() % ((is16Bit ? 2 : 1) * (isStereo ? 2 : 1)) == 0);
if (isUnsigned) {
MAKE_RAW_STREAM(true);
@ -313,38 +216,10 @@ SeekableAudioStream *makeRawStream(Common::SeekableReadStream *stream,
}
}
SeekableAudioStream *makeRawStream(Common::SeekableReadStream *stream,
int rate, byte flags,
DisposeAfterUse::Flag disposeAfterUse) {
RawStreamBlockList blocks;
RawStreamBlock block;
block.pos = 0;
const bool isStereo = (flags & Audio::FLAG_STEREO) != 0;
const bool is16Bit = (flags & Audio::FLAG_16BITS) != 0;
assert(stream->size() % ((is16Bit ? 2 : 1) * (isStereo ? 2 : 1)) == 0);
block.len = stream->size() / (is16Bit ? 2 : 1);
blocks.push_back(block);
return makeRawStream(stream, blocks, rate, flags, disposeAfterUse);
}
SeekableAudioStream *makeRawStream(const byte *buffer, uint32 size,
int rate, byte flags,
DisposeAfterUse::Flag disposeAfterUse) {
return makeRawStream(new Common::MemoryReadStream(buffer, size, disposeAfterUse), rate, flags, DisposeAfterUse::YES);
}
SeekableAudioStream *makeRawDiskStream_OLD(Common::SeekableReadStream *stream, RawStreamBlock *block, int numBlocks,
int rate, byte flags, DisposeAfterUse::Flag disposeStream) {
assert(numBlocks > 0);
RawStreamBlockList blocks;
for (int i = 0; i < numBlocks; ++i)
blocks.push_back(block[i]);
return makeRawStream(stream, blocks, rate, flags, disposeStream);
}
} // End of namespace Audio

View file

@ -20,8 +20,8 @@
*
*/
#ifndef SOUND_RAW_H
#define SOUND_RAW_H
#ifndef AUDIO_RAW_H
#define AUDIO_RAW_H
#include "common/scummsys.h"
#include "common/types.h"
@ -60,21 +60,6 @@ enum RawFlags {
FLAG_STEREO = 1 << 3
};
/**
* Struct used to define the audio data to be played by a RawStream.
*/
struct RawStreamBlock {
int32 pos; ///< Position in stream of the block (in bytes of course!)
int32 len; ///< Length of the block (in raw samples, not sample pairs!)
};
/**
* List containing all blocks of a raw stream.
* @see RawStreamBlock
*/
typedef Common::List<RawStreamBlock> RawStreamBlockList;
/**
* Creates an audio stream, which plays from the given buffer.
*
@ -104,47 +89,6 @@ SeekableAudioStream *makeRawStream(Common::SeekableReadStream *stream,
int rate, byte flags,
DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
/**
* Creates an audio stream, which plays from the given stream.
*
* @param stream Stream object to play from.
* @param blockList List of blocks to play.
* @see RawDiskStreamAudioBlock
* @see RawStreamBlockList
* @param rate Rate of the sound data.
* @param flags Audio flags combination.
* @see RawFlags
* @param disposeAfterUse Whether to delete the stream after use.
* @return The new SeekableAudioStream (or 0 on failure).
*/
SeekableAudioStream *makeRawStream(Common::SeekableReadStream *stream,
const RawStreamBlockList &blockList,
int rate,
byte flags,
DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
/**
* NOTE:
* This API is considered deprecated.
*
* Creates a audio stream, which plays from given stream.
*
* @param stream Stream to play from
* @param block Pointer to an RawStreamBlock array
* @see RawStreamBlock
* @param numBlocks Number of blocks.
* @param rate The rate
* @param flags Flags combination.
* @see RawFlags
* @param disposeStream Whether the "stream" object should be destroyed after playback.
* @return The new SeekableAudioStream (or 0 on failure).
*/
SeekableAudioStream *makeRawDiskStream_OLD(Common::SeekableReadStream *stream,
RawStreamBlock *block, int numBlocks,
int rate, byte flags,
DisposeAfterUse::Flag disposeStream);
} // End of namespace Audio
#endif

View file

@ -25,14 +25,478 @@
#include "common/util.h"
#include "common/stream.h"
#include "common/textconsole.h"
#include "common/list.h"
#include "audio/audiostream.h"
#include "audio/decoders/raw.h"
#include "audio/decoders/voc.h"
namespace Audio {
namespace {
bool checkVOCHeader(Common::ReadStream &stream) {
VocFileHeader fileHeader;
if (stream.read(&fileHeader, 8) != 8)
return false;
if (!memcmp(&fileHeader, "VTLK", 4)) {
if (stream.read(&fileHeader, sizeof(VocFileHeader)) != sizeof(VocFileHeader))
return false;
} else if (!memcmp(&fileHeader, "Creative", 8)) {
if (stream.read(((byte *)&fileHeader) + 8, sizeof(VocFileHeader) - 8) != sizeof(VocFileHeader) - 8)
return false;
} else {
return false;
}
if (memcmp(fileHeader.desc, "Creative Voice File", 19) != 0)
return false;
//if (fileHeader.desc[19] != 0x1A)
// debug(3, "loadVOCFromStream: Partially invalid header");
int32 offset = FROM_LE_16(fileHeader.datablock_offset);
int16 version = FROM_LE_16(fileHeader.version);
int16 code = FROM_LE_16(fileHeader.id);
if (offset != sizeof(VocFileHeader))
return false;
// 0x100 is an invalid VOC version used by German version of DOTT (Disk) and
// French version of Simon the Sorcerer 2 (CD)
if (version != 0x010A && version != 0x0114 && version != 0x0100)
return false;
if (code != ~version + 0x1234)
return false;
return true;
}
class VocStream : public SeekableAudioStream {
public:
VocStream(Common::SeekableReadStream *stream, bool isUnsigned, DisposeAfterUse::Flag disposeAfterUse);
~VocStream();
virtual int readBuffer(int16 *buffer, const int numSamples);
virtual bool isStereo() const { return false; }
virtual int getRate() const { return _rate; }
virtual bool endOfData() const { return (_curBlock == _blocks.end()) && (_blockLeft == 0); }
virtual bool seek(const Timestamp &where);
virtual Timestamp getLength() const { return _length; }
private:
void preProcess();
Common::SeekableReadStream *const _stream;
const DisposeAfterUse::Flag _disposeAfterUse;
const bool _isUnsigned;
int _rate;
Timestamp _length;
struct Block {
uint8 code;
uint32 length;
union {
struct {
uint32 offset;
int rate;
int samples;
} sampleBlock;
struct {
int count;
} loopBlock;
};
};
typedef Common::List<Block> BlockList;
BlockList _blocks;
BlockList::const_iterator _curBlock;
uint32 _blockLeft;
/**
* Advance one block in the stream in case
* the current one is empty.
*/
void updateBlockIfNeeded();
// Do some internal buffering for systems with really slow slow disk i/o
enum {
/**
* How many samples we can buffer at once.
*
* TODO: Check whether this size suffices
* for systems with slow disk I/O.
*/
kSampleBufferLength = 2048
};
byte _buffer[kSampleBufferLength];
/**
* Fill the temporary sample buffer used in readBuffer.
*
* @param maxSamples Maximum samples to read.
* @return actual count of samples read.
*/
int fillBuffer(int maxSamples);
};
VocStream::VocStream(Common::SeekableReadStream *stream, bool isUnsigned, DisposeAfterUse::Flag disposeAfterUse)
: _stream(stream), _disposeAfterUse(disposeAfterUse), _isUnsigned(isUnsigned), _rate(0),
_length(), _blocks(), _curBlock(_blocks.end()), _blockLeft(0), _buffer() {
preProcess();
}
VocStream::~VocStream() {
if (_disposeAfterUse == DisposeAfterUse::YES)
delete _stream;
}
int VocStream::readBuffer(int16 *buffer, const int numSamples) {
int samplesLeft = numSamples;
while (samplesLeft > 0) {
// Try to read up to "samplesLeft" samples.
int len = fillBuffer(samplesLeft);
// In case we were not able to read any samples
// we will stop reading here.
if (!len)
break;
// Adjust the samples left to read.
samplesLeft -= len;
// Copy the data to the caller's buffer.
const byte *src = _buffer;
while (len-- > 0)
*buffer++ = (*src++ << 8) ^ (_isUnsigned ? 0x8000 : 0);
}
return numSamples - samplesLeft;
}
void VocStream::updateBlockIfNeeded() {
// Have we now finished this block? If so, read the next block
if (_blockLeft == 0 && _curBlock != _blocks.end()) {
// Find the next sample block
while (true) {
// Next block
++_curBlock;
// Check whether we reached the end of the stream
// yet.
if (_curBlock == _blocks.end())
return;
// Skip all none sample blocks for now
if (_curBlock->code != 1 && _curBlock->code != 9)
continue;
_stream->seek(_curBlock->sampleBlock.offset, SEEK_SET);
// In case of an error we will stop
// stream playback.
if (_stream->err()) {
_blockLeft = 0;
_curBlock = _blocks.end();
} else {
_blockLeft = _curBlock->sampleBlock.samples;
}
return;
}
}
}
int VocStream::fillBuffer(int maxSamples) {
int bufferedSamples = 0;
byte *dst = _buffer;
// We can only read up to "kSampleBufferLength" samples
// so we take this into consideration, when trying to
// read up to maxSamples.
maxSamples = MIN<int>(kSampleBufferLength, maxSamples);
// We will only read up to maxSamples
while (maxSamples > 0 && !endOfData()) {
// Calculate how many samples we can safely read
// from the current block.
const int len = MIN<int>(maxSamples, _blockLeft);
// Try to read all the sample data and update the
// destination pointer.
const int bytesRead = _stream->read(dst, len);
dst += bytesRead;
// Calculate how many samples we actually read.
const int samplesRead = bytesRead;
// Update all status variables
bufferedSamples += samplesRead;
maxSamples -= samplesRead;
_blockLeft -= samplesRead;
// In case of an error we will stop
// stream playback.
if (_stream->err()) {
_blockLeft = 0;
_curBlock = _blocks.end();
break;
}
// Advance to the next block in case the current
// one is already finished.
updateBlockIfNeeded();
}
return bufferedSamples;
}
bool VocStream::seek(const Timestamp &where) {
// Invalidate stream
_blockLeft = 0;
_curBlock = _blocks.end();
if (where > _length)
return false;
// Search for the block containing the requested sample
const uint32 seekSample = convertTimeToStreamPos(where, getRate(), isStereo()).totalNumberOfFrames();
uint32 curSample = 0;
for (_curBlock = _blocks.begin(); _curBlock != _blocks.end(); ++_curBlock) {
// Skip all none sample blocks for now
if (_curBlock->code != 1 && _curBlock->code != 9)
continue;
uint32 nextBlockSample = curSample + _curBlock->sampleBlock.samples;
if (nextBlockSample > seekSample)
break;
curSample = nextBlockSample;
}
if (_curBlock == _blocks.end()) {
return ((seekSample - curSample) == 0);
} else {
const uint32 offset = seekSample - curSample;
_stream->seek(_curBlock->sampleBlock.offset + offset, SEEK_SET);
// In case of an error we will stop
// stream playback.
if (_stream->err()) {
_blockLeft = 0;
_curBlock = _blocks.end();
} else {
_blockLeft = _curBlock->sampleBlock.samples - offset;
}
return true;
}
}
void VocStream::preProcess() {
Block block;
// Scan through the file and collect all blocks
while (true) {
block.code = _stream->readByte();
block.length = 0;
// If we hit EOS here we found the end of the VOC file.
// According to http://wiki.multimedia.cx/index.php?title=Creative_Voice
// there is no need for an "Terminator" block to be present.
// In case we hit a "Terminator" block we also break here.
if (_stream->eos() || block.code == 0)
break;
block.length = _stream->readByte();
block.length |= _stream->readByte() << 8;
block.length |= _stream->readByte() << 16;
// Premature end of stream => error!
if (_stream->eos() || _stream->err())
return;
uint32 skip = 0;
switch (block.code) {
// Sound data
case 1:
// Sound data (New format)
case 9:
if (block.code == 1) {
// Read header data
int freqDiv = _stream->readByte();
// Prevent division through 0
if (freqDiv == 256)
return;
block.sampleBlock.rate = getSampleRateFromVOCRate(freqDiv);
int codec = _stream->readByte();
// We only support 8bit PCM
if (codec != 0)
return;
block.sampleBlock.samples = skip = block.length - 2;
block.sampleBlock.offset = _stream->pos();
// Check the last block if there is any
if (_blocks.size() > 0) {
BlockList::iterator lastBlock = _blocks.end();
--lastBlock;
// When we have found a block 8 as predecessor
// we need to use its settings
if (lastBlock->code == 8) {
block.sampleBlock.rate = lastBlock->sampleBlock.rate;
// Remove the block since we don't need it anymore
_blocks.erase(lastBlock);
}
}
} else {
block.sampleBlock.rate = _stream->readUint32LE();
int bitsPerSample = _stream->readByte();
// We only support 8bit PCM
if (bitsPerSample != 8)
return;
int channels = _stream->readByte();
// We only support mono
if (channels != 1) {
warning("Unhandled channel count %d in VOC file", channels);
return;
}
int codec = _stream->readUint16LE();
// We only support 8bit PCM
if (codec != 0) {
warning("Unhandled codec %d in VOC file", codec);
return;
}
/*uint32 reserved = */_stream->readUint32LE();
block.sampleBlock.offset = _stream->pos();
block.sampleBlock.samples = skip = block.length - 12;
}
// Check whether we found a new highest rate
if (_rate < block.sampleBlock.rate)
_rate = block.sampleBlock.rate;
break;
// Silence
case 3: {
if (block.length != 3)
return;
block.sampleBlock.offset = 0;
block.sampleBlock.samples = _stream->readUint16LE() + 1;
int freqDiv = _stream->readByte();
// Prevent division through 0
if (freqDiv == 256)
return;
block.sampleBlock.rate = getSampleRateFromVOCRate(freqDiv);
} break;
// Repeat start
case 6:
if (block.length != 2)
return;
block.loopBlock.count = _stream->readUint16LE() + 1;
break;
// Repeat end
case 7:
break;
// Extra info
case 8: {
if (block.length != 4)
return;
int freqDiv = _stream->readUint16LE();
// Prevent division through 0
if (freqDiv == 65536)
return;
int codec = _stream->readByte();
// We only support RAW 8bit PCM.
if (codec != 0) {
warning("Unhandled codec %d in VOC file", codec);
return;
}
int channels = _stream->readByte() + 1;
// We only support mono sound right now
if (channels != 1) {
warning("Unhandled channel count %d in VOC file", channels);
return;
}
block.sampleBlock.offset = 0;
block.sampleBlock.samples = 0;
block.sampleBlock.rate = 256000000L / (65536L - freqDiv);
} break;
default:
warning("Unhandled code %d in VOC file (len %d)", block.code, block.length);
return;
}
// Premature end of stream => error!
if (_stream->eos() || _stream->err())
return;
// Skip the rest of the block
if (skip)
_stream->skip(skip);
_blocks.push_back(block);
}
// Since we determined the sample rate we need for playback now, we will
// initialize the play length.
_length = Timestamp(0, _rate);
// Calculate the total play time and do some more sanity checks
for (BlockList::const_iterator i = _blocks.begin(), end = _blocks.end(); i != end; ++i) {
// Check whether we found a block 8 which survived, this is not
// allowed to happen!
if (i->code == 8) {
warning("VOC file contains unused block 8");
return;
}
// For now only use blocks with actual samples
if (i->code != 1 && i->code != 9)
continue;
// Check the sample rate
if (i->sampleBlock.rate != _rate) {
warning("VOC file contains chunks with different sample rates (%d != %d)", _rate, i->sampleBlock.rate);
return;
}
_length = _length.addFrames(i->sampleBlock.samples);
}
// Set the current block to the first block in the stream
rewind();
}
} // End of anonymous namespace
int getSampleRateFromVOCRate(int vocSR) {
if (vocSR == 0xa5 || vocSR == 0xa6) {
return 11025;
@ -47,7 +511,7 @@ int getSampleRateFromVOCRate(int vocSR) {
}
}
static byte *loadVOCFromStream(Common::ReadStream &stream, int &size, int &rate, int &loops, int &begin_loop, int &end_loop) {
byte *loadVOCFromStream(Common::ReadStream &stream, int &size, int &rate) {
VocFileHeader fileHeader;
debug(2, "loadVOCFromStream");
@ -84,8 +548,6 @@ static byte *loadVOCFromStream(Common::ReadStream &stream, int &size, int &rate,
int len;
byte *ret_sound = 0;
size = 0;
begin_loop = 0;
end_loop = 0;
while ((code = stream.readByte())) {
len = stream.readByte();
@ -128,8 +590,6 @@ static byte *loadVOCFromStream(Common::ReadStream &stream, int &size, int &rate,
}
stream.read(ret_sound + size, len);
size += len;
begin_loop = size;
end_loop = size;
} else {
warning("VOC file packing %d unsupported", packing);
}
@ -144,7 +604,7 @@ static byte *loadVOCFromStream(Common::ReadStream &stream, int &size, int &rate,
break;
case 6: // begin of loop
assert(len == 2);
loops = stream.readUint16LE();
stream.readUint16LE();
break;
case 7: // end of loop
assert(len == 0);
@ -173,232 +633,21 @@ static byte *loadVOCFromStream(Common::ReadStream &stream, int &size, int &rate,
return ret_sound;
}
byte *loadVOCFromStream(Common::ReadStream &stream, int &size, int &rate) {
int loops, begin_loop, end_loop;
return loadVOCFromStream(stream, size, rate, loops, begin_loop, end_loop);
}
#ifdef STREAM_AUDIO_FROM_DISK
int parseVOCFormat(Common::SeekableReadStream& stream, RawStreamBlock* block, int &rate, int &loops, int &begin_loop, int &end_loop) {
VocFileHeader fileHeader;
int currentBlock = 0;
int size = 0;
debug(2, "parseVOCFormat");
if (stream.read(&fileHeader, 8) != 8)
goto invalid;
if (!memcmp(&fileHeader, "VTLK", 4)) {
if (stream.read(&fileHeader, sizeof(VocFileHeader)) != sizeof(VocFileHeader))
goto invalid;
} else if (!memcmp(&fileHeader, "Creative", 8)) {
if (stream.read(((byte *)&fileHeader) + 8, sizeof(VocFileHeader) - 8) != sizeof(VocFileHeader) - 8)
goto invalid;
} else {
invalid:;
warning("loadVOCFromStream: Invalid header");
return 0;
}
if (memcmp(fileHeader.desc, "Creative Voice File", 19) != 0)
error("loadVOCFromStream: Invalid header");
if (fileHeader.desc[19] != 0x1A)
debug(3, "loadVOCFromStream: Partially invalid header");
int32 offset = FROM_LE_16(fileHeader.datablock_offset);
int16 version = FROM_LE_16(fileHeader.version);
int16 code = FROM_LE_16(fileHeader.id);
assert(offset == sizeof(VocFileHeader));
// 0x100 is an invalid VOC version used by German version of DOTT (Disk) and
// French version of Simon the Sorcerer 2 (CD)
assert(version == 0x010A || version == 0x0114 || version == 0x0100);
assert(code == ~version + 0x1234);
int len;
size = 0;
begin_loop = 0;
end_loop = 0;
while ((code = stream.readByte())) {
len = stream.readByte();
len |= stream.readByte() << 8;
len |= stream.readByte() << 16;
debug(2, "Block code %d, len %d", code, len);
switch (code) {
case 1:
case 9: {
int packing;
if (code == 1) {
int time_constant = stream.readByte();
packing = stream.readByte();
len -= 2;
rate = getSampleRateFromVOCRate(time_constant);
} else {
rate = stream.readUint32LE();
int bits = stream.readByte();
int channels = stream.readByte();
if (bits != 8 || channels != 1) {
warning("Unsupported VOC file format (%d bits per sample, %d channels)", bits, channels);
break;
}
packing = stream.readUint16LE();
stream.readUint32LE();
len -= 12;
}
debug(9, "VOC Data Block: %d, %d, %d", rate, packing, len);
if (packing == 0) {
// Found a data block - so add it to the block list
block[currentBlock].pos = stream.pos();
block[currentBlock].len = len;
currentBlock++;
stream.seek(len, SEEK_CUR);
size += len;
begin_loop = size;
end_loop = size;
} else {
warning("VOC file packing %d unsupported", packing);
}
} break;
case 3: // silence
// occur with a few Igor sounds, voc file starts with a silence block with a
// frequency different from the data block. Just ignore fow now (implementing
// it wouldn't make a big difference anyway...)
assert(len == 3);
stream.readUint16LE();
stream.readByte();
break;
case 6: // begin of loop
assert(len == 2);
loops = stream.readUint16LE();
break;
case 7: // end of loop
assert(len == 0);
break;
case 8: // "Extended"
// This occures in the LoL Intro demo. This block can usually be used to create stereo
// sound, but the LoL intro has only an empty block, thus this dummy implementation will
// work.
assert(len == 4);
stream.readUint16LE();
stream.readByte();
stream.readByte();
break;
default:
warning("Unhandled code %d in VOC file (len %d)", code, len);
return 0;
}
}
debug(4, "VOC Data Size : %d", size);
return currentBlock;
}
AudioStream *makeVOCDiskStream(Common::SeekableReadStream *stream, byte flags, DisposeAfterUse::Flag disposeAfterUse) {
const int MAX_AUDIO_BLOCKS = 256;
RawStreamBlock *block = new RawStreamBlock[MAX_AUDIO_BLOCKS];
int rate, loops, begin_loop, end_loop;
int numBlocks = parseVOCFormat(*stream, block, rate, loops, begin_loop, end_loop);
AudioStream *audioStream = 0;
// Create an audiostream from the data. Note the numBlocks may be 0,
// e.g. when invalid data is encountered. See bug #2890038.
if (numBlocks)
audioStream = makeRawDiskStream_OLD(stream, block, numBlocks, rate, flags, disposeAfterUse/*, begin_loop, end_loop*/);
delete[] block;
return audioStream;
}
SeekableAudioStream *makeVOCDiskStreamNoLoop(Common::SeekableReadStream *stream, byte flags, DisposeAfterUse::Flag disposeAfterUse) {
const int MAX_AUDIO_BLOCKS = 256;
RawStreamBlock *block = new RawStreamBlock[MAX_AUDIO_BLOCKS];
int rate, loops, begin_loop, end_loop;
int numBlocks = parseVOCFormat(*stream, block, rate, loops, begin_loop, end_loop);
SeekableAudioStream *audioStream = 0;
// Create an audiostream from the data. Note the numBlocks may be 0,
// e.g. when invalid data is encountered. See bug #2890038.
if (numBlocks)
audioStream = makeRawDiskStream_OLD(stream, block, numBlocks, rate, flags, disposeAfterUse);
delete[] block;
return audioStream;
}
#endif
AudioStream *makeVOCStream(Common::SeekableReadStream *stream, byte flags, uint loopStart, uint loopEnd, DisposeAfterUse::Flag disposeAfterUse) {
#ifdef STREAM_AUDIO_FROM_DISK
return makeVOCDiskStream(stream, flags, disposeAfterUse);
#else
int size, rate;
byte *data = loadVOCFromStream(*stream, size, rate);
if (!data) {
if (disposeAfterUse == DisposeAfterUse::YES)
delete stream;
return 0;
}
SeekableAudioStream *s = Audio::makeRawStream(data, size, rate, flags);
if (loopStart != loopEnd) {
const bool isStereo = (flags & Audio::FLAG_STEREO) != 0;
const bool is16Bit = (flags & Audio::FLAG_16BITS) != 0;
if (loopEnd == 0)
loopEnd = size;
assert(loopStart <= loopEnd);
assert(loopEnd <= (uint)size);
// Verify the buffer sizes are sane
if (is16Bit && isStereo)
assert((loopStart & 3) == 0 && (loopEnd & 3) == 0);
else if (is16Bit || isStereo)
assert((loopStart & 1) == 0 && (loopEnd & 1) == 0);
const uint32 extRate = s->getRate() * (is16Bit ? 2 : 1) * (isStereo ? 2 : 1);
return new SubLoopingAudioStream(s, 0, Timestamp(0, loopStart, extRate), Timestamp(0, loopEnd, extRate));
} else {
return s;
}
#endif
}
SeekableAudioStream *makeVOCStream(Common::SeekableReadStream *stream, byte flags, DisposeAfterUse::Flag disposeAfterUse) {
#ifdef STREAM_AUDIO_FROM_DISK
return makeVOCDiskStreamNoLoop(stream, flags, disposeAfterUse);
#else
int size, rate;
byte *data = loadVOCFromStream(*stream, size, rate);
if (!data) {
if (!checkVOCHeader(*stream)) {
if (disposeAfterUse == DisposeAfterUse::YES)
delete stream;
return 0;
}
return makeRawStream(data, size, rate, flags);
#endif
SeekableAudioStream *audioStream = new VocStream(stream, (flags & Audio::FLAG_UNSIGNED) != 0, disposeAfterUse);
if (audioStream && audioStream->endOfData()) {
delete audioStream;
return 0;
} else {
return audioStream;
}
}
} // End of namespace Audio

View file

@ -24,16 +24,14 @@
* @file
* Sound decoder used in engines:
* - agos
* - drascula
* - kyra
* - made
* - saga
* - scumm
* - touche
*/
#ifndef SOUND_VOC_H
#define SOUND_VOC_H
#ifndef AUDIO_VOC_H
#define AUDIO_VOC_H
#include "common/scummsys.h"
#include "common/types.h"
@ -90,16 +88,11 @@ extern byte *loadVOCFromStream(Common::ReadStream &stream, int &size, int &rate)
/**
* Try to load a VOC from the given seekable stream and create an AudioStream
* from that data. Currently this function only supports uncompressed raw PCM
* data. Optionally supports (infinite) looping of a portion of the data.
* data.
*
* This function uses loadVOCFromStream() internally.
*/
AudioStream *makeVOCStream(Common::SeekableReadStream *stream, byte flags = 0, uint loopStart = 0, uint loopEnd = 0, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::NO);
/**
* This does not use any of the looping features of VOC files!
*/
SeekableAudioStream *makeVOCStream(Common::SeekableReadStream *stream, byte flags, DisposeAfterUse::Flag disposeAfterUse);
SeekableAudioStream *makeVOCStream(Common::SeekableReadStream *stream, byte flags, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::NO);
} // End of namespace Audio

View file

@ -26,7 +26,6 @@
* - agos
* - draci
* - kyra
* - m4
* - queen
* - saga
* - sci
@ -38,8 +37,8 @@
* - tucker
*/
#ifndef SOUND_VORBIS_H
#define SOUND_VORBIS_H
#ifndef AUDIO_VORBIS_H
#define AUDIO_VORBIS_H
#include "common/scummsys.h"
#include "common/types.h"
@ -69,4 +68,4 @@ SeekableAudioStream *makeVorbisStream(
} // End of namespace Audio
#endif // #ifdef USE_VORBIS
#endif // #ifndef SOUND_VORBIS_H
#endif // #ifndef AUDIO_VORBIS_H

View file

@ -34,8 +34,8 @@
* - tucker
*/
#ifndef SOUND_WAVE_H
#define SOUND_WAVE_H
#ifndef AUDIO_WAVE_H
#define AUDIO_WAVE_H
#include "common/scummsys.h"
#include "common/types.h"

View file

@ -19,8 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef SOUND_FMOPL_H
#define SOUND_FMOPL_H
#ifndef AUDIO_FMOPL_H
#define AUDIO_FMOPL_H
#include "common/scummsys.h"

View file

@ -55,27 +55,30 @@ const byte MidiDriver::_gmToMt32[128] = {
101, 103, 100, 120, 117, 113, 99, 128, 128, 128, 128, 124, 123, 128, 128, 128, // 7x
};
static const uint32 GUIOMapping[] = {
MT_PCSPK, Common::GUIO_MIDIPCSPK,
MT_CMS, Common::GUIO_MIDICMS,
MT_PCJR, Common::GUIO_MIDIPCJR,
MT_ADLIB, Common::GUIO_MIDIADLIB,
MT_C64, Common::GUIO_MIDIC64,
MT_AMIGA, Common::GUIO_MIDIAMIGA,
MT_APPLEIIGS, Common::GUIO_MIDIAPPLEIIGS,
MT_TOWNS, Common::GUIO_MIDITOWNS,
MT_PC98, Common::GUIO_MIDIPC98,
MT_GM, Common::GUIO_MIDIGM,
MT_MT32, Common::GUIO_MIDIMT32,
0, 0
static const struct {
uint32 type;
const char *guio;
} GUIOMapping[] = {
{ MT_PCSPK, GUIO_MIDIPCSPK, },
{ MT_CMS, GUIO_MIDICMS, },
{ MT_PCJR, GUIO_MIDIPCJR, },
{ MT_ADLIB, GUIO_MIDIADLIB, },
{ MT_C64, GUIO_MIDIC64, },
{ MT_AMIGA, GUIO_MIDIAMIGA, },
{ MT_APPLEIIGS, GUIO_MIDIAPPLEIIGS, },
{ MT_TOWNS, GUIO_MIDITOWNS, },
{ MT_PC98, GUIO_MIDIPC98, },
{ MT_GM, GUIO_MIDIGM, },
{ MT_MT32, GUIO_MIDIMT32, },
{ 0, 0 },
};
uint32 MidiDriver::musicType2GUIO(uint32 musicType) {
uint32 res = 0;
Common::String MidiDriver::musicType2GUIO(uint32 musicType) {
Common::String res;
for (int i = 0; GUIOMapping[i] || GUIOMapping[i + 1]; i += 2) {
if (musicType == GUIOMapping[i] || musicType == (uint32)-1)
res |= GUIOMapping[i + 1];
for (int i = 0; GUIOMapping[i].guio; i++) {
if (musicType == GUIOMapping[i].type || musicType == (uint32)-1)
res += GUIOMapping[i].guio;
}
return res;

View file

@ -20,8 +20,8 @@
*
*/
#ifndef SOUND_MIDIDRV_H
#define SOUND_MIDIDRV_H
#ifndef AUDIO_MIDIDRV_H
#define AUDIO_MIDIDRV_H
#include "common/scummsys.h"
#include "common/str.h"
@ -146,7 +146,7 @@ public:
kDeviceId
};
static uint32 musicType2GUIO(uint32 musicType);
static Common::String musicType2GUIO(uint32 musicType);
/** Create music driver matching the given device handle, or NULL if there is no match. */
static MidiDriver *createMidi(DeviceHandle handle);

View file

@ -22,8 +22,8 @@
/// \brief Declarations related to the MidiParser class
#ifndef SOUND_MIDIPARSER_H
#define SOUND_MIDIPARSER_H
#ifndef AUDIO_MIDIPARSER_H
#define AUDIO_MIDIPARSER_H
#include "common/scummsys.h"
#include "common/endian.h"

View file

@ -20,8 +20,8 @@
*
*/
#ifndef SOUND_MIDIPLAYER_H
#define SOUND_MIDIPLAYER_H
#ifndef AUDIO_MIDIPLAYER_H
#define AUDIO_MIDIPLAYER_H
#include "common/scummsys.h"
#include "common/mutex.h"

View file

@ -20,8 +20,8 @@
*
*/
#ifndef SOUND_MIXER_H
#define SOUND_MIXER_H
#ifndef AUDIO_MIXER_H
#define AUDIO_MIXER_H
#include "common/types.h"
#include "common/noncopyable.h"

View file

@ -20,8 +20,8 @@
*
*/
#ifndef SOUND_MIXER_INTERN_H
#define SOUND_MIXER_INTERN_H
#ifndef AUDIO_MIXER_INTERN_H
#define AUDIO_MIXER_INTERN_H
#include "common/scummsys.h"
#include "common/mutex.h"

View file

@ -26,8 +26,8 @@
* - gob
*/
#ifndef SOUND_MODS_INFOGRAMES_H
#define SOUND_MODS_INFOGRAMES_H
#ifndef AUDIO_MODS_INFOGRAMES_H
#define AUDIO_MODS_INFOGRAMES_H
#include "audio/mods/paula.h"

View file

@ -29,7 +29,7 @@
#include "audio/mods/maxtrax.h"
// test for engines using this class.
#if defined(SOUND_MODS_MAXTRAX_H)
#if defined(AUDIO_MODS_MAXTRAX_H)
namespace {
@ -1034,4 +1034,4 @@ void MaxTrax::outPutScore(const Score &sc, int num) {}
} // End of namespace Audio
#endif // #if defined(SOUND_MODS_MAXTRAX_H)
#endif // #if defined(AUDIO_MODS_MAXTRAX_H)

View file

@ -24,8 +24,8 @@
#if !defined(ENABLE_KYRA)
// normal Header Guard
#elif !defined SOUND_MODS_MAXTRAX_H
#define SOUND_MODS_MAXTRAX_H
#elif !defined AUDIO_MODS_MAXTRAX_H
#define AUDIO_MODS_MAXTRAX_H
// #define MAXTRAX_HAS_MODULATION
// #define MAXTRAX_HAS_MICROTONAL
@ -219,4 +219,4 @@ private:
};
} // End of namespace Audio
#endif // !defined SOUND_MODS_MAXTRAX_H
#endif // !defined AUDIO_MODS_MAXTRAX_H

View file

@ -20,8 +20,8 @@
*
*/
#ifndef SOUND_MODS_MODULE_H
#define SOUND_MODS_MODULE_H
#ifndef AUDIO_MODS_MODULE_H
#define AUDIO_MODS_MODULE_H
#include "common/scummsys.h"

View file

@ -20,8 +20,8 @@
*
*/
#ifndef SOUND_MODS_PAULA_H
#define SOUND_MODS_PAULA_H
#ifndef AUDIO_MODS_PAULA_H
#define AUDIO_MODS_PAULA_H
#include "audio/audiostream.h"
#include "common/frac.h"

View file

@ -27,8 +27,8 @@
* - parallaction
*/
#ifndef SOUND_MODS_PROTRACKER_H
#define SOUND_MODS_PROTRACKER_H
#ifndef AUDIO_MODS_PROTRACKER_H
#define AUDIO_MODS_PROTRACKER_H
namespace Common {
class SeekableReadStream;

View file

@ -26,8 +26,8 @@
* - queen
*/
#ifndef SOUND_MODS_RJP1_H
#define SOUND_MODS_RJP1_H
#ifndef AUDIO_MODS_RJP1_H
#define AUDIO_MODS_RJP1_H
namespace Common {
class SeekableReadStream;

View file

@ -26,8 +26,8 @@
* - cine
*/
#ifndef SOUND_MODS_SOUNDFX_H
#define SOUND_MODS_SOUNDFX_H
#ifndef AUDIO_MODS_SOUNDFX_H
#define AUDIO_MODS_SOUNDFX_H
namespace Common {
class SeekableReadStream;

View file

@ -29,7 +29,7 @@
#include "audio/mods/tfmx.h"
// test for engines using this class.
#if defined(SOUND_MODS_TFMX_H)
#if defined(AUDIO_MODS_TFMX_H)
// couple debug-functions
namespace {
@ -1187,4 +1187,4 @@ void displayPatternstep(const void * const vptr) {
} // End of anonymous namespace
#endif
#endif // #if defined(SOUND_MODS_TFMX_H)
#endif // #if defined(AUDIO_MODS_TFMX_H)

View file

@ -24,8 +24,8 @@
#if !defined(ENABLE_SCUMM)
// normal Header Guard
#elif !defined(SOUND_MODS_TFMX_H)
#define SOUND_MODS_TFMX_H
#elif !defined(AUDIO_MODS_TFMX_H)
#define AUDIO_MODS_TFMX_H
#include "audio/mods/paula.h"
@ -278,4 +278,4 @@ private:
} // End of namespace Audio
#endif // !defined(SOUND_MODS_TFMX_H)
#endif // !defined(AUDIO_MODS_TFMX_H)

View file

@ -20,8 +20,8 @@
*
*/
#ifndef SOUND_MPU401_H
#define SOUND_MPU401_H
#ifndef AUDIO_MPU401_H
#define AUDIO_MPU401_H
#include "audio/mididrv.h"

View file

@ -19,8 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef SOUND_MUSICPLUGIN_H
#define SOUND_MUSICPLUGIN_H
#ifndef AUDIO_MUSICPLUGIN_H
#define AUDIO_MUSICPLUGIN_H
#include "base/plugins.h"
#include "audio/mididrv.h"

View file

@ -19,8 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef SOUND_NULL_H
#define SOUND_NULL_H
#ifndef AUDIO_NULL_H
#define AUDIO_NULL_H
#include "audio/musicplugin.h"
#include "audio/mpu401.h"

View file

@ -20,8 +20,8 @@
*
*/
#ifndef SOUND_RATE_H
#define SOUND_RATE_H
#ifndef AUDIO_RATE_H
#define AUDIO_RATE_H
#include "common/scummsys.h"

View file

@ -90,8 +90,8 @@ CopyRate_S_loop:
LDRSH r5, [r12],#2 @ r5 = tmp1 = *ptr++
LDRSH r6, [r1] @ r6 = obuf[0]
LDRSH r7, [r1,#2] @ r7 = obuf[1]
MUL r4, r2, r4 @ r5 = tmp0*vol_l
MUL r5, r3, r5 @ r6 = tmp1*vol_r
MUL r4, r2, r4 @ r4 = tmp0*vol_l
MUL r5, r3, r5 @ r5 = tmp1*vol_r
ADDS r6, r4, r6, LSL #16 @ r6 = obuf[0]<<16 + tmp0*vol_l
RSCVS r6, r14,#0x80000000 @ Clamp r6
@ -124,16 +124,16 @@ _ARM_CopyRate_R:
ORR r2, r2, r2, LSL #8 @ r2 = vol_l as 16 bits
ORR r3, r3, r3, LSL #8 @ r3 = vol_r as 16 bits
CopyRate_R_loop:
LDRSH r5, [r12],#2 @ r5 = tmp1 = *ptr++
LDRSH r4, [r12],#2 @ r4 = tmp0 = *ptr++
LDRSH r5, [r12],#2 @ r5 = tmp1 = *ptr++
LDRSH r6, [r1] @ r6 = obuf[0]
LDRSH r7, [r1,#2] @ r7 = obuf[1]
MUL r4, r2, r4 @ r4 = tmp0*vol_l
MUL r5, r3, r5 @ r5 = tmp1*vol_r
ADDS r6, r4, r6, LSL #16 @ r6 = obuf[0]<<16 + tmp0*vol_l
ADDS r6, r5, r6, LSL #16 @ r6 = obuf[0]<<16 + tmp1*vol_r
RSCVS r6, r14,#0x80000000 @ Clamp r6
ADDS r7, r5, r7, LSL #16 @ r7 = obuf[1]<<16 + tmp1*vol_r
ADDS r7, r4, r7, LSL #16 @ r7 = obuf[1]<<16 + tmp0*vol_l
RSCVS r7, r14,#0x80000000 @ Clamp r7
MOV r6, r6, LSR #16 @ Shift back to halfword
@ -263,8 +263,8 @@ SimpleRate_S_read_return:
LDRSH r6, [r3] @ r6 = obuf[0]
LDRSH r7, [r3,#2] @ r7 = obuf[1]
ADD r2, r2, r8 @ r2 = opos += opos_inc
MUL r4, r12,r4 @ r5 = tmp0*vol_l
MUL r5, r14,r5 @ r6 = tmp1*vol_r
MUL r4, r12,r4 @ r4 = tmp0*vol_l
MUL r5, r14,r5 @ r5 = tmp1*vol_r
ADDS r6, r4, r6, LSL #16 @ r6 = obuf[0]<<16 + tmp0*vol_l
RSCVS r6, r10,#0x80000000 @ Clamp r6
@ -337,17 +337,17 @@ SimpleRate_R_loop:
ADDGE r0, r0, #4 @ if (r2 >= 0) { sr.inPtr += 2
BGE SimpleRate_R_loop @ and loop }
SimpleRate_R_read_return:
LDRSH r5, [r0],#2 @ r5 = tmp0 = *inPtr++
LDRSH r4, [r0],#2 @ r4 = tmp1 = *inPtr++
LDRSH r4, [r0],#2 @ r4 = tmp0 = *inPtr++
LDRSH r5, [r0],#2 @ r5 = tmp1 = *inPtr++
LDRSH r6, [r3] @ r6 = obuf[0]
LDRSH r7, [r3,#2] @ r7 = obuf[1]
ADD r2, r2, r8 @ r2 = opos += opos_inc
MUL r4, r12,r4 @ r5 = tmp0*vol_l
MUL r5, r14,r5 @ r6 = tmp1*vol_r
MUL r4, r12,r4 @ r4 = tmp0*vol_l
MUL r5, r14,r5 @ r5 = tmp1*vol_r
ADDS r6, r4, r6, LSL #16 @ r6 = obuf[0]<<16 + tmp0*vol_l
ADDS r6, r5, r6, LSL #16 @ r6 = obuf[0]<<16 + tmp1*vol_r
RSCVS r6, r10,#0x80000000 @ Clamp r6
ADDS r7, r5, r7, LSL #16 @ r7 = obuf[1]<<16 + tmp1*vol_r
ADDS r7, r4, r7, LSL #16 @ r7 = obuf[1]<<16 + tmp0*vol_l
RSCVS r7, r10,#0x80000000 @ Clamp r7
MOV r6, r6, LSR #16 @ Shift back to halfword
@ -360,15 +360,14 @@ SimpleRate_R_read_return:
BGT SimpleRate_R_loop @ and loop
SimpleRate_R_end:
LDR r14,[r13,#8] @ r14 = sr
ADD r13,r13,#12 @ Skip over r0-r2 on stack
STMIA r14,{r0,r1,r2} @ Store back updated values
ADD r13,r13,#12 @ skip over r0-r2 on stack
STMIA r14,{r0,r1,r2} @ store back updated values
MOV r0, r3 @ return obuf
LDMFD r13!,{r4-r8,r10-r11,PC}
SimpleRate_R_read:
LDR r0, [r13,#8] @ r0 = sr (8 = 4*2)
ADD r0, r0, #16 @ r0 = inPtr = inBuf
STMFD r13!,{r0,r2-r3,r12,r14}
MOV r1, r0 @ r1 = inBuf
LDR r0, [r13,#20] @ r0 = AudioStream & input (20 = 4*5)
MOV r2, #512 @ r2 = ARRAYSIZE(inBuf)
@ -509,7 +508,7 @@ LinearRate_S_loop:
LinearRate_S_read_return:
LDR r10,[r2, #16] @ r10= icur[0,1]
LDRSH r5, [r0],#2 @ r5 = tmp0 = *inPtr++
LDRSH r6, [r0],#2 @ r5 = tmp1 = *inPtr++
LDRSH r6, [r0],#2 @ r6 = tmp1 = *inPtr++
SUBS r8, r8, #65536 @ r8 = opos--
STRH r10,[r2,#22] @ ilast[0] = icur[0]
MOV r10,r10,LSR #16
@ -611,11 +610,11 @@ LinearRate_R_loop:
LinearRate_R_read_return:
LDR r10,[r2, #16] @ r10= icur[0,1]
LDRSH r5, [r0],#2 @ r5 = tmp0 = *inPtr++
LDRSH r6, [r0],#2 @ r5 = tmp1 = *inPtr++
LDRSH r6, [r0],#2 @ r6 = tmp1 = *inPtr++
SUBS r8, r8, #65536 @ r8 = opos--
STRH r10,[r2,#22] @ ilast[0] = icur[0]
MOV r10,r10,LSR #16
STRH r10,[r2,#22] @ ilast[1] = icur[1]
STRH r10,[r2,#26] @ ilast[1] = icur[1]
STRH r5, [r2,#16] @ icur[0] = tmp0
STRH r6, [r2,#18] @ icur[1] = tmp1
BGE LinearRate_R_loop
@ -623,29 +622,29 @@ LinearRate_R_read_return:
@ part2 - form output samples
LinearRate_R_part2:
@ We are guaranteed that opos < 0 here
LDR r6, [r2,#20] @ r6 = ilast[0]
LDR r6, [r2,#20] @ r6 = ilast[0]<<16 + 32768
LDRSH r5, [r2,#16] @ r5 = icur[0]
MOV r4, r8, LSL #16
MOV r4, r4, LSR #16
SUB r5, r5, r6, ASR #16 @ r5 = icur[0] - ilast[0]
MLA r6, r4, r5, r6 @ r6 = (icur[0]-ilast[0])*opos_frac+ilast[0]
LDR r7, [r2,#24] @ r7 = ilast[1]
LDR r7, [r2,#24] @ r7 = ilast[1]<<16 + 32768
LDRSH r5, [r2,#18] @ r5 = icur[1]
LDR r10,[r3] @ r10= obuf[0]
LDRSH r10,[r3,#2] @ r10= obuf[1]
MOV r6, r6, ASR #16 @ r6 = tmp1 >>= 16
SUB r5, r5, r7, ASR #16 @ r5 = icur[1] - ilast[1]
MLA r7, r4, r5, r7 @ r7 = (icur[1]-ilast[1])*opos_frac+ilast[1]
LDRSH r5, [r3,#2] @ r5 = obuf[1]
LDRSH r5, [r3] @ r5 = obuf[0]
MOV r7, r7, ASR #16 @ r7 = tmp0 >>= 16
MUL r7, r12,r7 @ r7 = tmp0*vol_l
MUL r6, r14,r6 @ r6 = tmp1*vol_r
ADDS r7, r7, r10, LSL #16 @ r7 = obuf[0]<<16 + tmp0*vol_l
ADDS r7, r7, r10, LSL #16 @ r7 = obuf[1]<<16 + tmp0*vol_l
MOV r4, #0
RSCVS r7, r4, #0x80000000 @ Clamp r7
ADDS r6, r6, r5, LSL #16 @ r6 = obuf[1]<<16 + tmp1*vol_r
ADDS r6, r6, r5, LSL #16 @ r6 = obuf[0]<<16 + tmp1*vol_r
RSCVS r6, r4, #0x80000000 @ Clamp r6
MOV r7, r7, LSR #16 @ Shift back to halfword

View file

@ -1471,8 +1471,7 @@ void MidiDriver_ADLIB::adlib_setup_channel(int chan, AdLibInstrument *instr, byt
adlib_write((byte)chan + 0xC0, instr->feedback);
}
void MidiDriver_ADLIB::adlib_note_on_ex(int chan, byte note, int mod)
{
void MidiDriver_ADLIB::adlib_note_on_ex(int chan, byte note, int mod) {
int code;
assert(chan >= 0 && chan < 9);
code = (note << 7) + mod;

View file

@ -19,8 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef SOUND_SOFTSYNTH_CMS_H
#define SOUND_SOFTSYNTH_CMS_H
#ifndef AUDIO_SOFTSYNTH_CMS_H
#define AUDIO_SOFTSYNTH_CMS_H
#include "common/scummsys.h"

View file

@ -19,8 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef SOUND_SOFTSYNTH_EMUMIDI_H
#define SOUND_SOFTSYNTH_EMUMIDI_H
#ifndef AUDIO_SOFTSYNTH_EMUMIDI_H
#define AUDIO_SOFTSYNTH_EMUMIDI_H
#include "audio/audiostream.h"
#include "audio/mididrv.h"

View file

@ -133,8 +133,9 @@ private:
};
class TownsAudioInterfaceInternal : public TownsPC98_FmSynth {
public:
private:
TownsAudioInterfaceInternal(Audio::Mixer *mixer, TownsAudioInterface *owner, TownsAudioInterfacePluginDriver *driver, bool externalMutexHandling = false);
public:
~TownsAudioInterfaceInternal();
static TownsAudioInterfaceInternal *addNewRef(Audio::Mixer *mixer, TownsAudioInterface *owner, TownsAudioInterfacePluginDriver *driver, bool externalMutexHandling = false);

View file

@ -387,8 +387,6 @@ void TownsPC98_MusicChannel::reset() {
_totalLevel = 0;
_algorithm = 0;
_flags = CHS_EOT;
_algorithm = 0;
_block = 0;
_frequency = 0;

View file

@ -801,7 +801,7 @@ void Synth::writeSysex(unsigned char device, const Bit8u *sysex, Bit32u len) {
}
}
if (regionNum == NUM_REGIONS) {
printDebug("Sysex write to unrecognised address %06x, len %d", MT32EMU_SYSEXMEMADDR(addr), len);
printDebug("Sysex write to unrecognized address %06x, len %d", MT32EMU_SYSEXMEMADDR(addr), len);
break;
}
Bit32u next = region->next(addr, len);

View file

@ -18,8 +18,8 @@
// Last synch with DOSBox SVN trunk r3752
#ifndef SOUND_SOFTSYNTH_OPL_DBOPL_H
#define SOUND_SOFTSYNTH_OPL_DBOPL_H
#ifndef AUDIO_SOFTSYNTH_OPL_DBOPL_H
#define AUDIO_SOFTSYNTH_OPL_DBOPL_H
#include "common/scummsys.h"

View file

@ -26,8 +26,8 @@
* http://www.dosbox.com
*/
#ifndef SOUND_SOFTSYNTH_OPL_DOSBOX_H
#define SOUND_SOFTSYNTH_OPL_DOSBOX_H
#ifndef AUDIO_SOFTSYNTH_OPL_DOSBOX_H
#define AUDIO_SOFTSYNTH_OPL_DOSBOX_H
#ifndef DISABLE_DOSBOX_OPL

View file

@ -23,8 +23,8 @@
*/
#ifndef SOUND_SOFTSYNTH_OPL_MAME_H
#define SOUND_SOFTSYNTH_OPL_MAME_H
#ifndef AUDIO_SOFTSYNTH_OPL_MAME_H
#define AUDIO_SOFTSYNTH_OPL_MAME_H
#include "common/scummsys.h"
#include "common/random.h"

View file

@ -19,8 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef SOUND_SOFTSYNTH_PCSPK_H
#define SOUND_SOFTSYNTH_PCSPK_H
#ifndef AUDIO_SOFTSYNTH_PCSPK_H
#define AUDIO_SOFTSYNTH_PCSPK_H
#include "audio/audiostream.h"
#include "common/mutex.h"
@ -81,4 +81,4 @@ protected:
} // End of namespace Audio
#endif // SOUND_SOFTSYNTH_PCSPEAKER_H
#endif // AUDIO_SOFTSYNTH_PCSPEAKER_H

View file

@ -27,7 +27,7 @@
#ifndef DISABLE_SID
#include "sid.h"
#include "audio/softsynth/sid.h"
#include "audio/null.h"
namespace Resid {

View file

@ -25,8 +25,8 @@
* Copyright (C) 2004 Dag Lem <resid@nimrod.no>
*/
#ifndef __SID_H__
#define __SID_H__
#ifndef AUDIO_SOFTSYNTH_SID_H
#define AUDIO_SOFTSYNTH_SID_H
// Inlining on/off.
#define RESID_INLINE inline
@ -342,4 +342,4 @@ protected:
}
#endif // not __SID_H__
#endif // not AUDIO_SOFTSYNTH_SID_H

View file

@ -27,7 +27,7 @@
#ifndef DISABLE_SID
#include "sid.h"
#include "audio/softsynth/sid.h"
namespace Resid {

View file

@ -20,8 +20,8 @@
*
*/
#ifndef SOUND_TIMESTAMP_H
#define SOUND_TIMESTAMP_H
#ifndef AUDIO_TIMESTAMP_H
#define AUDIO_TIMESTAMP_H
#include "common/scummsys.h"

View file

@ -27,12 +27,17 @@
#include "backends/events/maemosdl/maemosdl-events.h"
#include "common/translation.h"
namespace Maemo {
MaemoSdlEventSource::MaemoSdlEventSource() : SdlEventSource(), _clickEnabled(true) {
}
bool MaemoSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
Model model = Model(((OSystem_SDL_Maemo *)g_system)->getModel());
debug(10, "Model: %s %u %s %s", model.hwId, model.modelType, model.hwAlias, model.hwKeyboard ? "true" : "false");
// List of special N810 keys:
// SDLK_F4 -> menu
// SDLK_F5 -> home
@ -42,14 +47,29 @@ bool MaemoSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
switch (ev.type) {
case SDL_KEYDOWN:{
if (ev.key.keysym.sym == SDLK_F4) {
if (ev.key.keysym.sym == SDLK_F4
|| (model.modelType == kModelTypeN900
&& ev.key.keysym.sym == SDLK_m
&& (ev.key.keysym.mod & KMOD_CTRL)
&& (ev.key.keysym.mod & KMOD_SHIFT))) {
event.type = Common::EVENT_MAINMENU;
debug(9, "remapping to main menu");
return true;
} else if (ev.key.keysym.sym == SDLK_F6) {
if (!model.hwKeyboard) {
event.type = Common::EVENT_KEYDOWN;
event.kbd.keycode = Common::KEYCODE_F7;
event.kbd.ascii = Common::ASCII_F7;
event.kbd.flags = 0;
debug(9, "remapping to F7 down (virtual keyboard)");
return true;
} else {
// handled in keyup
}
} else if (ev.key.keysym.sym == SDLK_F7) {
event.type = Common::EVENT_RBUTTONDOWN;
processMouseEvent(event, _km.x, _km.y);
debug(9, "remapping to right click down");
return true;
} else if (ev.key.keysym.sym == SDLK_F8) {
if (ev.key.keysym.mod & KMOD_CTRL) {
@ -57,6 +77,7 @@ bool MaemoSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
event.kbd.keycode = Common::KEYCODE_F7;
event.kbd.ascii = Common::ASCII_F7;
event.kbd.flags = 0;
debug(9, "remapping to F7 down (virtual keyboard)");
return true;
} else {
// handled in keyup
@ -66,18 +87,33 @@ bool MaemoSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
break;
}
case SDL_KEYUP: {
if (ev.key.keysym.sym == SDLK_F4) {
if (ev.key.keysym.sym == SDLK_F4
|| (model.modelType == kModelTypeN900
&& ev.key.keysym.sym == SDLK_m
&& (ev.key.keysym.mod & KMOD_CTRL)
&& (ev.key.keysym.mod & KMOD_SHIFT))) {
event.type = Common::EVENT_MAINMENU;
return true;
} else if (ev.key.keysym.sym == SDLK_F6) {
if (!model.hwKeyboard) {
event.type = Common::EVENT_KEYUP;
event.kbd.keycode = Common::KEYCODE_F7;
event.kbd.ascii = Common::ASCII_F7;
event.kbd.flags = 0;
debug(9, "remapping to F7 down (virtual keyboard)");
return true;
} else {
bool currentState = ((OSystem_SDL *)g_system)->getGraphicsManager()->getFeatureState(OSystem::kFeatureFullscreenMode);
g_system->beginGFXTransaction();
((OSystem_SDL *)g_system)->getGraphicsManager()->setFeatureState(OSystem::kFeatureFullscreenMode, !currentState);
g_system->endGFXTransaction();
debug(9, "remapping to full screen toggle");
return true;
}
} else if (ev.key.keysym.sym == SDLK_F7) {
event.type = Common::EVENT_RBUTTONUP;
processMouseEvent(event, _km.x, _km.y);
debug(9, "remapping to right click up");
return true;
} else if (ev.key.keysym.sym == SDLK_F8) {
if (ev.key.keysym.mod & KMOD_CTRL) {
@ -85,11 +121,13 @@ bool MaemoSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
event.kbd.keycode = Common::KEYCODE_F7;
event.kbd.ascii = Common::ASCII_F7;
event.kbd.flags = 0;
debug(9, "remapping to F7 up (virtual keyboard)");
return true;
} else {
_clickEnabled = !_clickEnabled;
((SurfaceSdlGraphicsManager*) _graphicsManager)->displayMessageOnOSD(
_clickEnabled ? _("Clicking Enabled") : _("Clicking Disabled"));
debug(9, "remapping to click toggle");
return true;
}
}
@ -120,4 +158,6 @@ bool MaemoSdlEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &even
return SdlEventSource::handleMouseButtonUp(ev, event);
}
#endif
} // namespace Maemo
#endif // if defined(MAEMO)

View file

@ -26,9 +26,11 @@
#define BACKEND_EVENTS_SDL_MAEMO_H
#include "backends/events/sdl/sdl-events.h"
#include "backends/platform/sdl/sdl.h"
#include "backends/platform/maemo/maemo.h"
#include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
namespace Maemo {
/**
* SDL events manager for Maemo
*/
@ -43,6 +45,8 @@ protected:
bool _clickEnabled;
};
#endif
} // namespace Maemo
#endif
#endif // include guard
#endif // if defined(MAEMO)

View file

@ -65,8 +65,7 @@ bool OPEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) {
event.type = Common::EVENT_MOUSEMOVE;
else
event.type = Common::EVENT_LBUTTONDOWN; /* For normal mice etc. */
}
else if (ev.button.button == SDL_BUTTON_RIGHT)
} else if (ev.button.button == SDL_BUTTON_RIGHT)
event.type = Common::EVENT_RBUTTONDOWN;
#if defined(SDL_BUTTON_WHEELUP) && defined(SDL_BUTTON_WHEELDOWN)
else if (ev.button.button == SDL_BUTTON_WHEELUP)
@ -98,8 +97,7 @@ bool OPEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
event.type = Common::EVENT_MOUSEMOVE;
else
event.type = Common::EVENT_LBUTTONUP; /* For normal mice etc. */
}
else if (ev.button.button == SDL_BUTTON_RIGHT)
} else if (ev.button.button == SDL_BUTTON_RIGHT)
event.type = Common::EVENT_RBUTTONUP;
#if defined(SDL_BUTTON_MIDDLE)
else if (ev.button.button == SDL_BUTTON_MIDDLE)

View file

@ -22,55 +22,17 @@
#ifdef WEBOS
// Allow use of stuff in <time.h>
#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
#include "common/scummsys.h"
#include "common/system.h"
#include "sys/time.h"
#include "time.h"
#include "common/str.h"
#include "common/translation.h"
#include "backends/events/webossdl/webossdl-events.h"
#include "gui/message.h"
#include "engines/engine.h"
// Inidicates if gesture area is pressed down or not.
static bool gestureDown = false;
// The timestamp when screen was pressed down.
static int screenDownTime = 0;
// The timestamp when a possible drag operation was triggered.
static int dragStartTime = 0;
// The index of the motion pointer.
static int motionPtrIndex = -1;
// The maximum horizontal motion during dragging (For tap recognition).
static int dragDiffX = 0;
// The maximum vertical motion during dragging (For tap recognition).
static int dragDiffY = 0;
// Indicates if we are in drag mode.
static bool dragging = false;
// The current mouse position on the screen.
static int curX = 0, curY = 0;
// The time (seconds after 1/1/1970) when program started.
static time_t programStartTime = time(0);
/**
* Returns the number of passed milliseconds since program start.
*
* @return The number of passed milliseconds.
*/
static time_t getMillis()
{
struct timeval tv;
gettimeofday(&tv, NULL);
return (time(0) - programStartTime) * 1000 + tv.tv_usec / 1000;
}
// PDL.h provided by the official Palm WebOS PDK.
#include <PDL.h>
/**
* WebOS devices only have a Shift key and a CTRL key. There is also an Alt
@ -91,7 +53,7 @@ void WebOSSdlEventSource::SDLModToOSystemKeyFlags(SDLMod mod,
event.kbd.flags |= Common::KBD_CTRL;
// Holding down the gesture area emulates the ALT key
if (gestureDown)
if (_gestureDown)
event.kbd.flags |= Common::KBD_ALT;
}
@ -106,7 +68,7 @@ void WebOSSdlEventSource::SDLModToOSystemKeyFlags(SDLMod mod,
bool WebOSSdlEventSource::handleKeyDown(SDL_Event &ev, Common::Event &event) {
// Handle gesture area tap.
if (ev.key.keysym.sym == SDLK_WORLD_71) {
gestureDown = true;
_gestureDown = true;
return true;
}
@ -115,7 +77,18 @@ bool WebOSSdlEventSource::handleKeyDown(SDL_Event &ev, Common::Event &event) {
// gesture tap AFTER the backward gesture event and not BEFORE (Like
// WebOS 2).
if (ev.key.keysym.sym == 27 || ev.key.keysym.sym == 229) {
gestureDown = false;
_gestureDown = false;
}
// handle virtual keyboard dismiss key
if (ev.key.keysym.sym == 24) {
int gblPDKVersion = PDL_GetPDKVersion();
// check for correct PDK Version, as this determines whether an
// OS-supplied virtual keyboard is available on this device.
if (gblPDKVersion >= 300) {
PDL_SetKeyboardState(PDL_FALSE);
return true;
}
}
// Call original SDL key handler.
@ -133,10 +106,21 @@ bool WebOSSdlEventSource::handleKeyDown(SDL_Event &ev, Common::Event &event) {
bool WebOSSdlEventSource::handleKeyUp(SDL_Event &ev, Common::Event &event) {
// Handle gesture area tap.
if (ev.key.keysym.sym == SDLK_WORLD_71) {
gestureDown = false;
_gestureDown = false;
return true;
}
// handle virtual keyboard dismiss key
if (ev.key.keysym.sym == 24) {
int gblPDKVersion = PDL_GetPDKVersion();
// check for correct PDK Version, as this determines whether an
// OS-supplied virtual keyboard is available on this device.
if (gblPDKVersion >= 300) {
PDL_SetKeyboardState(PDL_FALSE);
return true;
}
}
// Call original SDL key handler.
return SdlEventSource::handleKeyUp(ev, event);
}
@ -148,19 +132,45 @@ bool WebOSSdlEventSource::handleKeyUp(SDL_Event &ev, Common::Event &event) {
* @param event The ScummVM event.
* @return True if event was processed, false if not.
*/
bool WebOSSdlEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) {
if (motionPtrIndex == -1) {
motionPtrIndex = ev.button.which;
dragDiffX = 0;
dragDiffY = 0;
screenDownTime = getMillis();
bool WebOSSdlEventSource::handleMouseButtonDown(SDL_Event &ev,
Common::Event &event) {
_dragDiffX[ev.button.which] = 0;
_dragDiffY[ev.button.which] = 0;
_fingerDown[ev.button.which] = true;
_screenDownTime[ev.button.which] = g_system->getMillis();
// Start dragging when pressing the screen shortly after a tap.
if (getMillis() - dragStartTime < 250) {
dragging = true;
if (ev.button.which == 0) {
// Do a click when the finger lifts unless we leave the range
_doClick = true;
// Queue up dragging if auto-drag mode is on
if (_autoDragMode)
_queuedDragTime = g_system->getMillis() + QUEUED_DRAG_DELAY;
// Turn drag mode on instantly for a double-tap
else if (g_system->getMillis() - _dragStartTime < DOUBLETAP_LIMIT) {
_dragging = true;
event.type = Common::EVENT_LBUTTONDOWN;
processMouseEvent(event, curX, curY);
processMouseEvent(event, _curX, _curY);
}
// If we're not in touchpad mode, move the cursor to the tap
if (!_touchpadMode) {
_curX = MIN(_screenX, MAX(0, 0 + ev.motion.x));
_curY = MIN(_screenY, MAX(0, 0 + ev.motion.y));
// If we're already clicking, hold it until after the move.
if (event.type == Common::EVENT_LBUTTONDOWN) {
processMouseEvent(event, _curX, _curY);
g_system->getEventManager()->pushEvent(event);
}
// Move the mouse
event.type = Common::EVENT_MOUSEMOVE;
processMouseEvent(event, _curX, _curY);
}
// Watch for a double-tap-triggered drag
_dragStartTime = g_system->getMillis();
} else if (ev.button.which == 1) {
// Kill any queued drag event if a second finger goes down
if (_queuedDragTime > 0)
_queuedDragTime = 0;
_doClick = false;
}
return true;
}
@ -172,54 +182,48 @@ bool WebOSSdlEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &ev
* @param event The ScummVM event.
* @return True if event was processed, false if not.
*/
bool WebOSSdlEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
if (motionPtrIndex == ev.button.which) {
motionPtrIndex = -1;
// When drag mode was active then simply send a mouse up event
if (dragging)
{
bool WebOSSdlEventSource::handleMouseButtonUp(SDL_Event &ev,
Common::Event &event) {
// Only react if the finger hasn't been virtually lifted already
if (_fingerDown[ev.button.which]) {
// No matter what, if it's the first finger that's lifted when
// we're dragging, just lift the mouse button.
if (ev.button.which == 0 && _dragging) {
event.type = Common::EVENT_LBUTTONUP;
processMouseEvent(event, curX, curY);
dragging = false;
return true;
}
// When mouse was moved 5 pixels or less then emulate a mouse button
// click.
if (ABS(dragDiffX) < 6 && ABS(dragDiffY) < 6)
{
int duration = getMillis() - screenDownTime;
// When screen was pressed for less than 500ms then emulate a
// left mouse click.
if (duration < 500) {
processMouseEvent(event, _curX, _curY);
_dragging = false;
} else {
// If it was the first finger and the click hasn't been
// canceled, it's a click.
if (ev.button.which == 0 && _doClick &&
!_fingerDown[1] && !_fingerDown[2]) {
event.type = Common::EVENT_LBUTTONUP;
processMouseEvent(event, curX, curY);
processMouseEvent(event, _curX, _curY);
g_system->getEventManager()->pushEvent(event);
event.type = Common::EVENT_LBUTTONDOWN;
dragStartTime = getMillis();
}
// When screen was pressed for less than 1000ms then emulate a
if (_queuedDragTime > 0)
_queuedDragTime = 0;
} else if (ev.button.which == 1 &&
_fingerDown[0] && _fingerDown[1] && !_fingerDown[2]) {
// If the first finger's down and the second taps, it's a
// right mouse click.
else if (duration < 1000) {
event.type = Common::EVENT_RBUTTONUP;
processMouseEvent(event, curX, curY);
g_system->getEventManager()->pushEvent(event);
event.type = Common::EVENT_RBUTTONDOWN;
}
// When screen was pressed for more than 1000ms then emulate a
// middle mouse click.
else {
processMouseEvent(event, _curX, _curY);
_queuedRUpTime = g_system->getMillis() + QUEUED_RUP_DELAY;
} else if (ev.button.which == 2 &&
_fingerDown[0] && _fingerDown[1]) {
// If two fingers are down and a third taps, it's a middle
// click -- but lift the second finger so it doesn't register
// as a right click.
event.type = Common::EVENT_MBUTTONUP;
processMouseEvent(event, curX, curY);
processMouseEvent(event, _curX, _curY);
g_system->getEventManager()->pushEvent(event);
event.type = Common::EVENT_MBUTTONDOWN;
_fingerDown[1] = false;
}
}
// Officially lift the finger that was raised.
_fingerDown[ev.button.which] = false;
}
return true;
}
@ -231,18 +235,200 @@ bool WebOSSdlEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &even
* @param event The ScummVM event.
* @return True if event was processed, false if not.
*/
bool WebOSSdlEventSource::handleMouseMotion(SDL_Event &ev, Common::Event &event) {
if (ev.motion.which == motionPtrIndex) {
int screenX = g_system->getWidth();
int screenY = g_system->getHeight();
curX = MIN(screenX, MAX(0, curX + ev.motion.xrel));
curY = MIN(screenY, MAX(0, curY + ev.motion.yrel));
dragDiffX += ev.motion.xrel;
dragDiffY += ev.motion.yrel;
bool WebOSSdlEventSource::handleMouseMotion(SDL_Event &ev,
Common::Event &event) {
if (_fingerDown[ev.motion.which]) {
_dragDiffX[ev.motion.which] += ev.motion.xrel;
_dragDiffY[ev.motion.which] += ev.motion.yrel;
switch (ev.motion.which) {
case 0:
// If our dragDiff goes too many pixels in either direction,
// kill the future click and any queued drag event.
if (_doClick && (ABS(_dragDiffX[0]) > MOUSE_DEADZONE_PIXELS ||
ABS(_dragDiffY[0]) > MOUSE_DEADZONE_PIXELS)) {
_doClick = false;
if (_queuedDragTime > 0)
_queuedDragTime = 0;
}
// If only one finger is on the screen and moving, that's
// the mouse pointer.
if (!_fingerDown[1] && !_fingerDown[2]) {
if (_touchpadMode) {
_curX = MIN(_screenX, MAX(0, _curX + ev.motion.xrel));
_curY = MIN(_screenY, MAX(0, _curY + ev.motion.yrel));
} else {
_curX = MIN(_screenX, MAX(0, 0 + ev.motion.x));
_curY = MIN(_screenY, MAX(0, 0 + ev.motion.y));
}
event.type = Common::EVENT_MOUSEMOVE;
processMouseEvent(event, curX, curY);
processMouseEvent(event, _curX, _curY);
}
break;
case 1:
// Check for a two-finger swipe
if (_fingerDown[0] && !_fingerDown[2]) {
// Check for a vertical swipe
if (ABS(_dragDiffY[0]) > _swipeDistY &&
ABS(_dragDiffY[1]) > _swipeDistY) {
// Virtually lift fingers to prevent repeat triggers
_fingerDown[0] = _fingerDown[1] = false;
if (_dragDiffY[0] < 0 && _dragDiffY[1] < 0) {
// A swipe up triggers the keyboard, if it exists. We
// test for existance of a virtual OS keyboard by
// checking for the version of the linked PDK libs.
int gblPDKVersion = PDL_GetPDKVersion();
if (gblPDKVersion >= 300)
PDL_SetKeyboardState(PDL_TRUE);
} else if (_dragDiffY[0] > 0 && _dragDiffY[1] > 0) {
// A swipe down triggers the menu
if (g_engine && !g_engine->isPaused())
g_engine->openMainMenuDialog();
}
return true;
}
// Check for a horizontal swipe
if (ABS(_dragDiffX[0]) > _swipeDistX &&
ABS(_dragDiffX[1]) > _swipeDistX) {
// Virtually lift fingers to prevent repeat triggers
_fingerDown[0] = _fingerDown[1] = false;
if (_dragDiffX[0] < 0 && _dragDiffX[1] < 0) {
// A swipe left presses escape
event.type = Common::EVENT_KEYDOWN;
event.kbd.flags = 0;
event.kbd.keycode = Common::KEYCODE_ESCAPE;
event.kbd.ascii = Common::ASCII_ESCAPE;
_queuedEscapeUpTime = g_system->getMillis() +
QUEUED_KEY_DELAY;
} else if (_dragDiffX[0] > 0 && _dragDiffX[1] > 0) {
// A swipe right toggles touchpad mode
_touchpadMode = !_touchpadMode;
g_system->showMouse(_touchpadMode);
// I18N: Touchpad mode toggle status.
Common::String dialogMsg(_("Touchpad mode is now"));
dialogMsg += " ";
// I18N: Touchpad mode on or off.
dialogMsg += (_touchpadMode ? _("ON") : _("OFF"));
dialogMsg += ".\n";
// I18N: Instructions to toggle Touchpad mode.
dialogMsg +=
_("Swipe two fingers to the right to toggle.");
GUI::TimedMessageDialog dialog(dialogMsg, 1500);
dialog.runModal();
}
return true;
}
}
break;
case 2:
// Check for a three-finger swipe
if (_fingerDown[0] && _fingerDown[1]) {
// Swipe to the right toggles Auto-drag
if (_dragDiffX[0] > _swipeDistX &&
_dragDiffX[1] > _swipeDistX &&
_dragDiffX[2] > _swipeDistX) {
// Virtually lift fingers to prevent repeat triggers
_fingerDown[0] = _fingerDown[1] = _fingerDown[2] = false;
// Toggle Auto-drag mode
_autoDragMode = !_autoDragMode;
// I18N: Auto-drag toggle status.
Common::String dialogMsg(_("Auto-drag mode is now"));
dialogMsg += " ";
// I18N: Auto-drag on or off.
dialogMsg += (_autoDragMode ? _("ON") : _("OFF"));
dialogMsg += ".\n";
// I18N: Instructions to toggle auto-drag.
dialogMsg += _(
"Swipe three fingers to the right to toggle.");
GUI::TimedMessageDialog dialog(dialogMsg, 1500);
dialog.runModal();
return true;
} else if (_dragDiffY[0] > _swipeDistY &&
_dragDiffY[1] > _swipeDistY &&
_dragDiffY[2] > _swipeDistY ) {
// Swipe down to emulate spacebar (pause)
// Virtually lift fingers to prevent repeat triggers
_fingerDown[0] = _fingerDown[1] = _fingerDown[2] = false;
// Press space
event.type = Common::EVENT_KEYDOWN;
event.kbd.flags = 0;
event.kbd.keycode = Common::KEYCODE_SPACE;
event.kbd.ascii = Common::ASCII_SPACE;
_queuedSpaceUpTime = g_system->getMillis() +
QUEUED_KEY_DELAY;
}
}
}
}
return true;
}
/**
* Before calling the original SDL implementation, this method loads in
* queued events.
*
* @param event The ScummVM event
*/
bool WebOSSdlEventSource::pollEvent(Common::Event &event) {
uint32 curTime = g_system->getMillis();
// Event-dependent nitializations for when SDL runs its first poll.
if (_firstPoll) {
// Set the initial dimensions
calculateDimensions();
// Having a mouse pointer on screen when not in Touchpad mode is poor
// interface design, because the user won't know whether to tap buttons
// or drag the pointer to them. On the first poll, set the appropriate
// pointer visibility.
g_system->showMouse(_touchpadMode);
_firstPoll = false;
}
// Run down the priority list for queued events. The built-in
// event queue runs events on the next poll, which causes many
// WebOS devices (and a few game engines) to ignore certain inputs.
// Allowing keys and clicks to stay "down" longer is enough to register
// the press.
if (_queuedEscapeUpTime != 0 && curTime >= _queuedEscapeUpTime) {
event.type = Common::EVENT_KEYUP;
event.kbd.flags = 0;
event.kbd.keycode = Common::KEYCODE_ESCAPE;
event.kbd.ascii = Common::ASCII_ESCAPE;
_queuedEscapeUpTime = 0;
return true;
} else if (_queuedSpaceUpTime != 0 && curTime >= _queuedSpaceUpTime) {
event.type = Common::EVENT_KEYUP;
event.kbd.flags = 0;
event.kbd.keycode = Common::KEYCODE_SPACE;
event.kbd.ascii = Common::ASCII_SPACE;
_queuedSpaceUpTime = 0;
return true;
} else if (_queuedRUpTime != 0 && curTime >= _queuedRUpTime) {
event.type = Common::EVENT_RBUTTONUP;
processMouseEvent(event, _curX, _curY);
_queuedRUpTime = 0;
return true;
} else if (_queuedDragTime != 0 && curTime >= _queuedDragTime) {
event.type = Common::EVENT_LBUTTONDOWN;
_dragging = true;
processMouseEvent(event, _curX, _curY);
_queuedDragTime = 0;
return true;
}
return SdlEventSource::pollEvent(event);
}
/**
* Sets the _screenX and _screenY variables to the effective screen dimensions,
* and alters _swipeDistX and _swipeDistY to the correct relative values.
*/
void WebOSSdlEventSource::calculateDimensions() {
_screenX = g_system->getOverlayWidth();
_screenY = g_system->getOverlayHeight();
_swipeDistX = _screenX * SWIPE_PERCENT_HORIZ / 100;
_swipeDistY = _screenY * SWIPE_PERCENT_VERT / 100;
}
#endif

View file

@ -29,13 +29,87 @@
* SDL events manager for WebOS
*/
class WebOSSdlEventSource : public SdlEventSource {
public:
enum {
DOUBLETAP_LIMIT = 400,
MAX_FINGERS = 3,
MOUSE_DEADZONE_PIXELS = 5,
QUEUED_DRAG_DELAY = 500,
QUEUED_KEY_DELAY = 250,
QUEUED_RUP_DELAY = 50,
SWIPE_PERCENT_HORIZ = 15,
SWIPE_PERCENT_VERT = 20
};
WebOSSdlEventSource() :
_gestureDown(false),
_dragStartTime(0), _dragging(false),
_curX(0), _curY(0),
_screenX(0), _screenY(0),
_touchpadMode(false), _autoDragMode(true),
_doClick(true),
_queuedDragTime(0), _queuedEscapeUpTime(0), _queuedSpaceUpTime(0),
_queuedRUpTime(0),
_firstPoll(true) {
for (int i = 0; i < MAX_FINGERS; i++) {
_fingerDown[i] = false;
_screenDownTime[i] = _dragDiffX[i] = _dragDiffY[i] = 0;
}
};
protected:
// Inidicates if gesture area is pressed down or not.
bool _gestureDown;
// The timestamp when screen was pressed down for each finger.
uint32 _screenDownTime[MAX_FINGERS];
// The timestamp when a possible drag operation was triggered.
uint32 _dragStartTime;
// The distance each finger traveled from touch to release.
int _dragDiffX[MAX_FINGERS], _dragDiffY[MAX_FINGERS];
// Indicates if we are in drag mode.
bool _dragging;
// The current mouse position on the screen.
int _curX, _curY;
// The current screen dimensions
int _screenX, _screenY;
// The drag distance for linear gestures
int _swipeDistX, _swipeDistY;
// Indicates if we're in touchpad mode or tap-to-move mode.
bool _touchpadMode;
// Indicates if we're in automatic drag mode.
bool _autoDragMode;
// Tracks which fingers are currently touching the screen.
bool _fingerDown[MAX_FINGERS];
// Indicates if a click should be executed when the first finger is lifted
bool _doClick;
// Indicates whether the event poll has been run before
bool _firstPoll;
// Event queues
uint32 _queuedDragTime, _queuedEscapeUpTime, _queuedSpaceUpTime,
_queuedRUpTime;
// SDL overrides
virtual void SDLModToOSystemKeyFlags(SDLMod mod, Common::Event &event);
virtual bool handleKeyDown(SDL_Event &ev, Common::Event &event);
virtual bool handleKeyUp(SDL_Event &ev, Common::Event &event);
virtual bool handleMouseButtonDown(SDL_Event &ev, Common::Event &event);
virtual bool handleMouseButtonUp(SDL_Event &ev, Common::Event &event);
virtual bool handleMouseMotion(SDL_Event &ev, Common::Event &event);
virtual bool pollEvent(Common::Event &event);
// Utility functions
void calculateDimensions();
};
#endif

View file

@ -91,10 +91,10 @@ public:
virtual ~AmigaOSFilesystemNode();
virtual bool exists() const;
virtual Common::String getDisplayName() const { return _sDisplayName; };
virtual Common::String getName() const { return _sDisplayName; };
virtual Common::String getPath() const { return _sPath; };
virtual bool isDirectory() const { return _bIsDirectory; };
virtual Common::String getDisplayName() const { return _sDisplayName; }
virtual Common::String getName() const { return _sDisplayName; }
virtual Common::String getPath() const { return _sPath; }
virtual bool isDirectory() const { return _bIsDirectory; }
virtual bool isReadable() const;
virtual bool isWritable() const;

View file

@ -96,7 +96,7 @@ public:
virtual Common::SeekableReadStream *createReadStream();
virtual Common::WriteStream *createWriteStream();
int getDev() { return 0; };
int getDev() { return 0; }
};
#endif

View file

@ -37,7 +37,7 @@ public:
virtual AbstractFSNode *makeFileNodePath(const Common::String &path) const;
protected:
PSPFilesystemFactory() {};
PSPFilesystemFactory() {}
private:
friend class Common::Singleton<SingletonBaseType>;

View file

@ -0,0 +1,60 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#if defined(MAEMO)
#include "SDL_syswm.h"
#include "common/scummsys.h"
#include "backends/platform/maemo/maemo.h"
#include "backends/events/maemosdl/maemosdl-events.h"
#include "backends/graphics/maemosdl/maemosdl-graphics.h"
MaemoSdlGraphicsManager::MaemoSdlGraphicsManager(SdlEventSource *sdlEventSource)
: SurfaceSdlGraphicsManager(sdlEventSource) {
}
bool MaemoSdlGraphicsManager::loadGFXMode() {
bool success = SurfaceSdlGraphicsManager::loadGFXMode();
// fix the problematic zoom key capture in Maemo5/N900
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
if (SDL_GetWMInfo(&info)) {
Display *dpy = info.info.x11.display;
Window win;
unsigned long val = 1;
Atom atom_zoom = XInternAtom(dpy, "_HILDON_ZOOM_KEY_ATOM", 0);
info.info.x11.lock_func();
win = info.info.x11.fswindow;
if (win)
XChangeProperty(dpy, win, atom_zoom, XA_INTEGER, 32, PropModeReplace, (unsigned char *) &val, 1); // grab zoom keys
win = info.info.x11.wmwindow;
if (win)
XChangeProperty(dpy, win, atom_zoom, XA_INTEGER, 32, PropModeReplace, (unsigned char *) &val, 1); // grab zoom keys
info.info.x11.unlock_func();
}
return success;
}
#endif

View file

@ -20,9 +20,21 @@
*
*/
#ifndef CREATE_MADS_PARSER
#define CREATE_MADS_PARSER
#if defined(MAEMO)
bool Compile(const char *srcFilename, const char *destFilename);
#ifndef BACKENDS_GRAPHICS_MAEMOSDL_GRAPHICS_H
#define BACKENDS_GRAPHICS_MAEMOSDL_GRAPHICS_H
#include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
class MaemoSdlGraphicsManager : public SurfaceSdlGraphicsManager {
public:
MaemoSdlGraphicsManager(SdlEventSource *sdlEventSource);
protected:
virtual bool loadGFXMode();
};
#endif
#endif

View file

@ -102,6 +102,11 @@ public:
*/
GLuint getHeight() const { return _realHeight; }
/**
* Get the bytes per pixel.
*/
uint getBytesPerPixel() const { return _bytesPerPixel; }
/**
* Set the texture filter.
* @filter the filter type, GL_NEAREST or GL_LINEAR

View file

@ -1115,8 +1115,6 @@ void OpenGLGraphicsManager::loadTextures() {
}
#endif
uint gameScreenBPP = 0;
if (!_gameTexture) {
byte bpp;
GLenum intformat;
@ -1127,7 +1125,6 @@ void OpenGLGraphicsManager::loadTextures() {
#else
getGLPixelFormat(Graphics::PixelFormat::createFormatCLUT8(), bpp, intformat, format, type);
#endif
gameScreenBPP = bpp;
_gameTexture = new GLTexture(bpp, intformat, format, type);
} else
_gameTexture->refresh();
@ -1186,10 +1183,11 @@ void OpenGLGraphicsManager::loadTextures() {
// We need to setup a proper unpack alignment value here, else we will
// get problems with the texture updates, in case the surface data is
// not properly aligned.
// For now we use the gcd of the game screen format and 2, since 2 is
// the BPP value for the overlay and the OSD.
if (gameScreenBPP)
glPixelStorei(GL_UNPACK_ALIGNMENT, Common::gcd<uint>(gameScreenBPP, 2));
// It is noteworthy this assumes the OSD uses the same BPP as the overlay
// and that the cursor works with any alignment setting.
int newAlignment = Common::gcd(_gameTexture->getBytesPerPixel(), _overlayTexture->getBytesPerPixel());
assert(newAlignment == 1 || newAlignment == 2 || newAlignment == 4);
glPixelStorei(GL_UNPACK_ALIGNMENT, newAlignment);
// We use a "pack" alignment (when reading from textures) to 4 here,
// since the only place where we really use it is the BMP screenshot

View file

@ -199,6 +199,7 @@ bool Keymap::isComplete(const HardwareKeySet *hwKeys) {
// - if an action finds a key with required type but a parent action with
// higher priority is using it, that key is never used
void Keymap::automaticMapping(HardwareKeySet *hwKeys) {
#if 0 //disabling the broken automapper for now
// Create copies of action and key lists.
List<Action*> actions(_actions);
List<const HardwareKey*> keys(hwKeys->getHardwareKeys());
@ -318,6 +319,7 @@ void Keymap::automaticMapping(HardwareKeySet *hwKeys) {
break;
}
}
#endif
}
Action *Keymap::getParentMappedAction(KeyState key) {

View file

@ -192,10 +192,10 @@ bool Keymapper::mapKey(const KeyState& key, bool keyDown) {
// Search for key in active keymap stack
for (int i = _activeMaps.size() - 1; i >= 0; --i) {
MapRecord mr = _activeMaps[i];
debug(5, "Keymapper::mapKey keymap: %s", mr.keymap->getName().c_str());
action = mr.keymap->getMappedAction(key);
if (action || mr.inherit == false)
if (action || !mr.inherit)
break;
}

View file

@ -36,6 +36,8 @@
namespace Common {
const char *const kGuiKeymapName = "gui";
class Keymapper : public Common::EventMapper, private Common::ArtificialEventSource {
public:

View file

@ -28,13 +28,13 @@
#include "gui/widgets/popup.h"
#include "gui/widgets/scrollbar.h"
#include "gui/ThemeEval.h"
#include "common/translation.h"
namespace Common {
enum {
kRemapCmd = 'REMP',
kClearCmd = 'CLER',
kCloseCmd = 'CLOS'
};
@ -60,7 +60,7 @@ void RemapDialog::open() {
bool divider = false;
const Stack<Keymapper::MapRecord> &activeKeymaps = _keymapper->getActiveStack();
if (!(activeKeymaps.size() > 0)) {
if (activeKeymaps.size() > 0) {
_kmPopUp->appendEntry(activeKeymaps.top().keymap->getName() + _(" (Active)"));
divider = true;
}
@ -84,7 +84,7 @@ void RemapDialog::open() {
keymapCount += _gameKeymaps->size();
}
debug(3, "keymaps: %d", keymapCount);
debug(3, "RemapDialog::open keymaps: %d", keymapCount);
_keymapTable = (Keymap **)malloc(sizeof(Keymap*) * keymapCount);
@ -140,8 +140,10 @@ void RemapDialog::reflowLayout() {
uint16 areaW, areaH;
int spacing = g_gui.xmlEval()->getVar("Globals.KeyMapper.Spacing");
int labelWidth = g_gui.xmlEval()->getVar("Globals.KeyMapper.LabelWidth");
int buttonWidth = g_gui.xmlEval()->getVar("Globals.KeyMapper.ButtonWidth");
int colWidth = labelWidth + buttonWidth + spacing;
int keyButtonWidth = g_gui.xmlEval()->getVar("Globals.KeyMapper.ButtonWidth");
int clearButtonWidth = g_gui.xmlEval()->getVar("Globals.Line.Height");
int clearButtonHeight = g_gui.xmlEval()->getVar("Globals.Line.Height");
int colWidth = labelWidth + keyButtonWidth + clearButtonWidth + spacing;
g_gui.xmlEval()->getWidgetData((const String&)String("KeyMapper.KeymapArea"), areaX, areaY, areaW, areaH);
@ -156,6 +158,7 @@ void RemapDialog::reflowLayout() {
_scrollBar->recalc();
uint textYOff = (buttonHeight - kLineHeight) / 2;
uint clearButtonYOff = (buttonHeight - clearButtonHeight) / 2;
uint oldSize = _keymapWidgets.size();
uint newSize = _rowCount * _colCount;
@ -169,6 +172,16 @@ void RemapDialog::reflowLayout() {
new GUI::StaticTextWidget(this, 0, 0, 0, 0, "", Graphics::kTextAlignRight);
widg.keyButton =
new GUI::ButtonWidget(this, 0, 0, 0, 0, "", 0, kRemapCmd + i);
#ifndef DISABLE_FANCY_THEMES
if (g_gui.xmlEval()->getVar("Globals.ShowSearchPic") == 1 && g_gui.theme()->supportsImages()) {
widg.clearButton = new GUI::PicButtonWidget(this, 0, 0, clearButtonWidth, clearButtonHeight, _("Clear value"), kClearCmd + i);
((GUI::PicButtonWidget *)widg.clearButton)->useThemeTransparency(true);
((GUI::PicButtonWidget *)widg.clearButton)->setGfx(g_gui.theme()->getImageSurface(GUI::ThemeEngine::kImageEraser));
}
else
#endif
widg.clearButton = new GUI::ButtonWidget(this, 0, 0, 0, 0, "C", _("Clear value"), kClearCmd + i);
_keymapWidgets.push_back(widg);
} else {
widg = _keymapWidgets[i];
@ -178,7 +191,8 @@ void RemapDialog::reflowLayout() {
uint y = areaY + (i / _colCount) * (buttonHeight + spacing);
widg.actionText->resize(x, y + textYOff, labelWidth, kLineHeight);
widg.keyButton->resize(x + labelWidth, y, buttonWidth, buttonHeight);
widg.keyButton->resize(x + labelWidth, y, keyButtonWidth, buttonHeight);
widg.clearButton->resize(x + labelWidth + keyButtonWidth + spacing, y + clearButtonYOff, clearButtonWidth, clearButtonHeight);
}
while (oldSize > newSize) {
ActionWidgets widg = _keymapWidgets.remove_at(--oldSize);
@ -188,14 +202,19 @@ void RemapDialog::reflowLayout() {
removeWidget(widg.keyButton);
delete widg.keyButton;
removeWidget(widg.clearButton);
delete widg.clearButton;
}
}
void RemapDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) {
debug(0, "Command!");
debug(3, "RemapDialog::handleCommand %u %u", cmd, data);
if (cmd >= kRemapCmd && cmd < kRemapCmd + _keymapWidgets.size()) {
startRemapping(cmd - kRemapCmd);
} else if (cmd >= kClearCmd && cmd < kClearCmd + _keymapWidgets.size()) {
clearMapping(cmd - kClearCmd);
} else if (cmd == GUI::kPopUpItemSelectedCmd) {
loadKeymap();
} else if (cmd == GUI::kSetPositionCmd) {
@ -207,6 +226,23 @@ void RemapDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 d
}
}
void RemapDialog::clearMapping(uint i) {
if (_topAction + i >= _currentActions.size())
return;
debug(3, "clear the mapping %u", i);
_activeRemapAction = _currentActions[_topAction + i].action;
_activeRemapAction->mapKey(0);
_activeRemapAction->getParent()->saveMappings();
_changes = true;
// force refresh
_topAction = -1;
refreshKeymap();
_activeRemapAction = 0;
}
void RemapDialog::startRemapping(uint i) {
if (_topAction + i >= _currentActions.size())
return;
@ -240,7 +276,7 @@ void RemapDialog::handleKeyUp(Common::KeyState state) {
if (_activeRemapAction) {
const HardwareKey *hwkey = _keymapper->findHardwareKey(state);
debug(0, "Key: %d, %d (%c), %x", state.keycode, state.ascii, (state.ascii ? state.ascii : ' '), state.flags);
debug(4, "RemapDialog::handleKeyUp Key: %d, %d (%c), %x", state.keycode, state.ascii, (state.ascii ? state.ascii : ' '), state.flags);
if (hwkey) {
_activeRemapAction->mapKey(hwkey);
@ -270,15 +306,23 @@ void RemapDialog::loadKeymap() {
_currentActions.clear();
const Stack<Keymapper::MapRecord> &activeKeymaps = _keymapper->getActiveStack();
debug(3, "RemapDialog::loadKeymap active keymaps: %u", activeKeymaps.size());
if (!activeKeymaps.empty() && _kmPopUp->getSelected() == 0) {
// load active keymaps
List<const HardwareKey*> freeKeys(_keymapper->getHardwareKeys());
// add most active keymap's keys
Keymapper::MapRecord top = activeKeymaps.top();
List<Action*>::iterator actIt;
int topIndex = activeKeymaps.size() - 1;
// skip the top gui keymap since it is for the keymapper itself
// TODO: Don't use the keymap name as a way to discriminate GUI maps
if (topIndex > 0 && activeKeymaps[topIndex].keymap->getName().equals(kGuiKeymapName))
--topIndex;
// add most active keymap's keys
Keymapper::MapRecord top = activeKeymaps[topIndex];
List<Action*>::iterator actIt;
debug(3, "RemapDialog::loadKeymap top keymap: %s", top.keymap->getName().c_str());
for (actIt = top.keymap->getActions().begin(); actIt != top.keymap->getActions().end(); ++actIt) {
Action *act = *actIt;
ActionInfo info = {act, false, act->description};
@ -290,9 +334,10 @@ void RemapDialog::loadKeymap() {
}
// loop through remaining finding mappings for unmapped keys
if (top.inherit) {
for (int i = activeKeymaps.size() - 2; i >= 0; --i) {
if (top.inherit && topIndex >= 0) {
for (int i = topIndex - 1; i >= 0; --i) {
Keymapper::MapRecord mr = activeKeymaps[i];
debug(3, "RemapDialog::loadKeymap keymap: %s", mr.keymap->getName().c_str());
List<const HardwareKey*>::iterator keyIt = freeKeys.begin();
while (keyIt != freeKeys.end()) {
@ -351,6 +396,7 @@ void RemapDialog::refreshKeymap() {
ActionWidgets& widg = _keymapWidgets[widgetI];
if (actionI < _currentActions.size()) {
debug(8, "RemapDialog::refreshKeymap actionI=%u", actionI);
ActionInfo& info = _currentActions[actionI];
widg.actionText->setLabel(info.description + ": ");
@ -365,11 +411,13 @@ void RemapDialog::refreshKeymap() {
widg.actionText->setVisible(true);
widg.keyButton->setVisible(true);
widg.clearButton->setVisible(true);
actionI++;
} else {
widg.actionText->setVisible(false);
widg.keyButton->setVisible(false);
widg.clearButton->setVisible(false);
}
//widg.actionText->draw();
//widg.keyButton->draw();

View file

@ -55,6 +55,7 @@ protected:
struct ActionWidgets {
GUI::StaticTextWidget *actionText;
GUI::ButtonWidget *keyButton;
GUI::ButtonWidget *clearButton;
};
struct ActionInfo {
Action *action;
@ -64,6 +65,7 @@ protected:
void loadKeymap();
void refreshKeymap();
void clearMapping(uint i);
void startRemapping(uint i);
void stopRemapping();

View file

@ -149,7 +149,8 @@ endif
ifeq ($(BACKEND),maemo)
MODULE_OBJS += \
events/maemosdl/maemosdl-events.o
events/maemosdl/maemosdl-events.o \
graphics/maemosdl/maemosdl-graphics.o
endif
ifeq ($(BACKEND),n64)

View file

@ -174,6 +174,8 @@ OSystem_Android::~OSystem_Android() {
_mixer = 0;
delete _fsFactory;
_fsFactory = 0;
delete _timerManager;
_timerManager = 0;
deleteMutex(_event_queue_lock);
}

View file

@ -63,7 +63,7 @@ PATH_BUILD_CLASSES_PLUGIN_TOP = $(PATH_BUILD)/classes.plugin
PATH_STAGE_PREFIX = build.stage
PATH_STAGE_MAIN = $(PATH_STAGE_PREFIX).main
PATH_REL = org/inodes/gus/scummvm
PATH_REL = org/scummvm/scummvm
PATH_SRC_TOP = $(srcdir)/backends/platform/android
PATH_SRC = $(PATH_SRC_TOP)/$(PATH_REL)
@ -172,13 +172,13 @@ androidrelease: $(addprefix release/, $(APK_MAIN) $(APK_PLUGINS))
androidtestmain: $(APK_MAIN)
$(ADB) install -r $(APK_MAIN)
$(ADB) shell am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n org.inodes.gus.scummvm/.Unpacker
$(ADB) shell am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n org.scummvm.scummvm/.Unpacker
androidtest: $(APK_MAIN) $(APK_PLUGINS)
@set -e; for apk in $^; do \
$(ADB) install -r $$apk; \
done
$(ADB) shell am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n org.inodes.gus.scummvm/.Unpacker
$(ADB) shell am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n org.scummvm.scummvm/.Unpacker
# used by buildbot!
androiddistdebug: all

View file

@ -125,7 +125,7 @@ jint JNI::onLoad(JavaVM *vm) {
if (_vm->GetEnv((void **)&env, JNI_VERSION_1_2))
return JNI_ERR;
jclass cls = env->FindClass("org/inodes/gus/scummvm/ScummVM");
jclass cls = env->FindClass("org/scummvm/scummvm/ScummVM");
if (cls == 0)
return JNI_ERR;

View file

@ -1,4 +1,4 @@
package org.inodes.gus.scummvm;
package org.scummvm.scummvm;
import android.content.Context;
import android.text.InputType;

View file

@ -1,10 +1,11 @@
package org.inodes.gus.scummvm;
package org.scummvm.scummvm;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
@ -16,7 +17,7 @@ public class PluginProvider extends BroadcastReceiver {
private final static String LOG_TAG = "ScummVM";
public final static String META_UNPACK_LIB =
"org.inodes.gus.scummvm.meta.UNPACK_LIB";
"org.scummvm.scummvm.meta.UNPACK_LIB";
public void onReceive(Context context, Intent intent) {
if (!intent.getAction().equals(ScummVMApplication.ACTION_PLUGIN_QUERY))
@ -25,15 +26,24 @@ public class PluginProvider extends BroadcastReceiver {
Bundle extras = getResultExtras(true);
final ActivityInfo info;
final PackageInfo pinfo;
try {
info = context.getPackageManager()
.getReceiverInfo(new ComponentName(context, this.getClass()),
PackageManager.GET_META_DATA);
pinfo = context.getPackageManager()
.getPackageInfo(context.getPackageName(), 0);
} catch (PackageManager.NameNotFoundException e) {
Log.e(LOG_TAG, "Error finding my own info?", e);
return;
}
String host_version = extras.getString(ScummVMApplication.EXTRA_VERSION);
if (!pinfo.versionName.equals(host_version)) {
Log.e(LOG_TAG, "Plugin version " + pinfo.versionName + " is not equal to ScummVM version " + host_version);
return;
}
String mylib = info.metaData.getString(META_UNPACK_LIB);
if (mylib != null) {
ArrayList<String> all_libs =

View file

@ -1,4 +1,4 @@
package org.inodes.gus.scummvm;
package org.scummvm.scummvm;
import android.util.Log;
import android.content.res.AssetManager;

View file

@ -1,4 +1,4 @@
package org.inodes.gus.scummvm;
package org.scummvm.scummvm;
import android.app.Activity;
import android.app.AlertDialog;
@ -14,6 +14,8 @@ import android.view.MotionEvent;
import android.view.inputmethod.InputMethodManager;
import android.widget.Toast;
import java.io.File;
public class ScummVMActivity extends Activity {
private class MyScummVM extends ScummVM {
@ -128,6 +130,16 @@ public class ScummVMActivity extends Activity {
getFilesDir().mkdirs();
// Store savegames on external storage if we can, which means they're
// world-readable and don't get deleted on uninstall.
String savePath = Environment.getExternalStorageDirectory() + "/ScummVM/Saves/";
File saveDir = new File(savePath);
saveDir.mkdirs();
if (!saveDir.isDirectory()) {
// If it doesn't work, resort to the internal app path.
savePath = getDir("saves", MODE_WORLD_READABLE).getPath();
}
// Start ScummVM
_scummvm = new MyScummVM(main_surface.getHolder());
@ -136,7 +148,7 @@ public class ScummVMActivity extends Activity {
"--config=" + getFileStreamPath("scummvmrc").getPath(),
"--path=" + Environment.getExternalStorageDirectory().getPath(),
"--gui-theme=scummmodern",
"--savepath=" + getDir("saves", 0).getPath()
"--savepath=" + savePath
});
_events = new ScummVMEvents(this, _scummvm);

View file

@ -1,12 +1,13 @@
package org.inodes.gus.scummvm;
package org.scummvm.scummvm;
import android.app.Application;
import java.io.File;
public class ScummVMApplication extends Application {
public final static String ACTION_PLUGIN_QUERY = "org.inodes.gus.scummvm.action.PLUGIN_QUERY";
public final static String EXTRA_UNPACK_LIBS = "org.inodes.gus.scummvm.extra.UNPACK_LIBS";
public final static String ACTION_PLUGIN_QUERY = "org.scummvm.scummvm.action.PLUGIN_QUERY";
public final static String EXTRA_UNPACK_LIBS = "org.scummvm.scummvm.extra.UNPACK_LIBS";
public final static String EXTRA_VERSION = "org.scummvm.scummvm.extra.VERSION";
private static File _cache_dir;

View file

@ -1,4 +1,4 @@
package org.inodes.gus.scummvm;
package org.scummvm.scummvm;
import android.os.Handler;
import android.os.Message;

View file

@ -1,4 +1,4 @@
package org.inodes.gus.scummvm;
package org.scummvm.scummvm;
import android.app.Activity;
import android.app.AlertDialog;
@ -10,6 +10,7 @@ import android.content.ContextWrapper;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
@ -38,12 +39,15 @@ public class Unpacker extends Activity {
// TODO don't hardcode this
private final static boolean PLUGINS_ENABLED = false;
private final static String META_NEXT_ACTIVITY =
"org.inodes.gus.unpacker.nextActivity";
"org.scummvm.unpacker.nextActivity";
private ProgressBar mProgress;
private File mUnpackDest; // location to unpack into
private AsyncTask<String, Integer, Void> mUnpacker;
private final static int REQUEST_MARKET = 1;
// Android 3.1+ only
public static final int FLAG_INCLUDE_STOPPED_PACKAGES = 32;
private static class UnpackJob {
public ZipFile zipfile;
public Set<String> paths;
@ -272,7 +276,19 @@ public class Unpacker extends Activity {
extras.putStringArrayList(ScummVMApplication.EXTRA_UNPACK_LIBS,
unpack_libs);
final PackageInfo info;
try {
info = getPackageManager().getPackageInfo(getPackageName(), 0);
} catch (PackageManager.NameNotFoundException e) {
Log.e(LOG_TAG, "Error finding my own info?", e);
return;
}
extras.putString(ScummVMApplication.EXTRA_VERSION, info.versionName);
Intent intent = new Intent(ScummVMApplication.ACTION_PLUGIN_QUERY);
// Android 3.1 defaults to FLAG_EXCLUDE_STOPPED_PACKAGES, and since
// none of our plugins will ever be running, that is not helpful
intent.setFlags(FLAG_INCLUDE_STOPPED_PACKAGES);
sendOrderedBroadcast(intent, Manifest.permission.SCUMMVM_PLUGIN,
new PluginBroadcastReciever(),
null, RESULT_OK, null, extras);

View file

@ -287,7 +287,7 @@ void GLESTexture::fillBuffer(uint32 color) {
((color & 0xff) == ((color >> 8) & 0xff)))
memset(_pixels, color & 0xff, _surface.pitch * _surface.h);
else
Common::set_to(_pixels, _pixels + _surface.pitch * _surface.h,
Common::fill(_pixels, _pixels + _surface.pitch * _surface.h,
(uint16)color);
setDirty();

View file

@ -83,3 +83,10 @@ Links:
A short turorial on implementing OpenGL ES 1.1 in BADA:
http://forums.badadev.com/viewtopic.php?f=7&t=208
HelvB14 font files:
http://www.cl.cam.ac.uk/~mgk25/ucs-fonts.html
http://www.cl.cam.ac.uk/~mgk25/download/ucs-fonts-75dpi100dpi.tar.gz
Then run the following command:
$ ./ucs2any.pl 100dpi/helvB14.bdf MAPPINGS/8859-1.TXT iso8859-1 \
MAPPINGS/8859-2.TXT iso8859-2 MAPPINGS/8859-3.TXT iso8859-3

View file

@ -99,7 +99,8 @@ void BadaScummVM::OnLowMemory(void) {
}
void BadaScummVM::pauseGame(bool pause) {
if (pause && _appForm && g_engine && !g_engine->isPaused()) {
if (_appForm) {
if (pause && g_engine && !g_engine->isPaused()) {
_appForm->pushKey(Common::KEYCODE_SPACE);
}
@ -107,3 +108,4 @@ void BadaScummVM::pauseGame(bool pause) {
((BadaSystem *)g_system)->setMute(pause);
}
}
}

View file

@ -74,7 +74,7 @@ bool AudioThread::isSilentMode() {
}
void AudioThread::setMute(bool on) {
if (_audioOut && !isSilentMode()) {
if (_audioOut && _timer) {
_muted = on;
if (on) {
_timer->Cancel();
@ -88,7 +88,7 @@ int AudioThread::setVolume(bool up, bool minMax) {
int level = -1;
int numLevels = sizeof(levels) / sizeof(levels[0]);
if (_audioOut && !isSilentMode()) {
if (_audioOut) {
int volume = _audioOut->GetVolume();
if (minMax) {
level = up ? numLevels - 1 : 0;

View file

@ -49,9 +49,9 @@ using namespace Osp::Ui::Controls;
//
BadaAppForm::BadaAppForm() :
_gameThread(0),
_state(InitState),
_buttonState(LeftButton),
_shortcut(SetVolume) {
_state(kInitState),
_buttonState(kLeftButton),
_shortcut(kSetVolume) {
_eventQueueLock = new Mutex();
_eventQueueLock->Create();
}
@ -99,11 +99,11 @@ result BadaAppForm::Construct() {
BadaAppForm::~BadaAppForm() {
logEntered();
if (_gameThread && _state != ErrorState) {
if (_gameThread && _state != kErrorState) {
terminate();
_gameThread->Stop();
if (_state != ErrorState) {
if (_state != kErrorState) {
_gameThread->Join();
}
@ -123,7 +123,7 @@ BadaAppForm::~BadaAppForm() {
// abort the game thread
//
void BadaAppForm::terminate() {
if (_state == ActiveState) {
if (_state == kActiveState) {
((BadaSystem *)g_system)->setMute(true);
_eventQueueLock->Acquire();
@ -131,25 +131,25 @@ void BadaAppForm::terminate() {
Common::Event e;
e.type = Common::EVENT_QUIT;
_eventQueue.push(e);
_state = ClosingState;
_state = kClosingState;
_eventQueueLock->Release();
// block while thread ends
AppLog("waiting for shutdown");
for (int i = 0; i < EXIT_SLEEP_STEP && _state == ClosingState; i++) {
for (int i = 0; i < EXIT_SLEEP_STEP && _state == kClosingState; i++) {
Thread::Sleep(EXIT_SLEEP);
}
if (_state == ClosingState) {
if (_state == kClosingState) {
// failed to terminate - Join() will freeze
_state = ErrorState;
_state = kErrorState;
}
}
}
void BadaAppForm::exitSystem() {
_state = ErrorState;
_state = kErrorState;
if (_gameThread) {
_gameThread->Stop();
@ -200,8 +200,7 @@ bool BadaAppForm::pollEvent(Common::Event &event) {
return result;
}
void BadaAppForm::pushEvent(Common::EventType type,
const Point &currentPosition) {
void BadaAppForm::pushEvent(Common::EventType type, const Point &currentPosition) {
BadaSystem *system = (BadaSystem *)g_system;
BadaGraphicsManager *graphics = system->getGraphics();
if (graphics) {
@ -248,8 +247,8 @@ void BadaAppForm::pushKey(Common::KeyCode keycode) {
void BadaAppForm::OnOrientationChanged(const Control &source,
OrientationStatus orientationStatus) {
logEntered();
if (_state == InitState) {
_state = ActiveState;
if (_state == kInitState) {
_state = kActiveState;
_gameThread->Start();
}
}
@ -257,30 +256,30 @@ void BadaAppForm::OnOrientationChanged(const Control &source,
Object *BadaAppForm::Run(void) {
scummvm_main(0, 0);
if (_state == ActiveState) {
if (_state == kActiveState) {
Application::GetInstance()->SendUserEvent(USER_MESSAGE_EXIT, NULL);
}
_state = DoneState;
_state = kDoneState;
return NULL;
}
void BadaAppForm::setButtonShortcut() {
switch (_buttonState) {
case LeftButton:
case kLeftButton:
g_system->displayMessageOnOSD(_("Right Click Once"));
_buttonState = RightButtonOnce;
_buttonState = kRightButtonOnce;
break;
case RightButtonOnce:
case kRightButtonOnce:
g_system->displayMessageOnOSD(_("Right Click"));
_buttonState = RightButton;
_buttonState = kRightButton;
break;
case RightButton:
case kRightButton:
g_system->displayMessageOnOSD(_("Move Only"));
_buttonState = MoveOnly;
_buttonState = kMoveOnly;
break;
case MoveOnly:
case kMoveOnly:
g_system->displayMessageOnOSD(_("Left Click"));
_buttonState = LeftButton;
_buttonState = kLeftButton;
break;
}
}
@ -288,27 +287,27 @@ void BadaAppForm::setButtonShortcut() {
void BadaAppForm::setShortcut() {
// cycle to the next shortcut
switch (_shortcut) {
case ControlMouse:
case kControlMouse:
g_system->displayMessageOnOSD(_("Escape Key"));
_shortcut = EscapeKey;
_shortcut = kEscapeKey;
break;
case EscapeKey:
case kEscapeKey:
g_system->displayMessageOnOSD(_("Game Menu"));
_shortcut = GameMenu;
_shortcut = kGameMenu;
break;
case GameMenu:
case kGameMenu:
g_system->displayMessageOnOSD(_("Show Keypad"));
_shortcut = ShowKeypad;
_shortcut = kShowKeypad;
break;
case SetVolume:
case kSetVolume:
// fallthru
case ShowKeypad:
case kShowKeypad:
g_system->displayMessageOnOSD(_("Control Mouse"));
_shortcut = ControlMouse;
_shortcut = kControlMouse;
break;
}
}
@ -330,17 +329,17 @@ void BadaAppForm::setVolume(bool up, bool minMax) {
void BadaAppForm::showKeypad() {
// display the soft keyboard
_buttonState = LeftButton;
_buttonState = kLeftButton;
pushKey(Common::KEYCODE_F7);
}
void BadaAppForm::OnTouchDoublePressed(const Control &source,
const Point &currentPosition,
const TouchEventInfo &touchInfo) {
if (_buttonState != MoveOnly) {
pushEvent(_buttonState == LeftButton ? Common::EVENT_LBUTTONDOWN : Common::EVENT_RBUTTONDOWN,
if (_buttonState != kMoveOnly) {
pushEvent(_buttonState == kLeftButton ? Common::EVENT_LBUTTONDOWN : Common::EVENT_RBUTTONDOWN,
currentPosition);
pushEvent(_buttonState == LeftButton ? Common::EVENT_LBUTTONDOWN : Common::EVENT_RBUTTONDOWN,
pushEvent(_buttonState == kLeftButton ? Common::EVENT_LBUTTONDOWN : Common::EVENT_RBUTTONDOWN,
currentPosition);
}
}
@ -358,7 +357,7 @@ void BadaAppForm::OnTouchFocusOut(const Control &source,
void BadaAppForm::OnTouchLongPressed(const Control &source,
const Point &currentPosition,
const TouchEventInfo &touchInfo) {
if (_buttonState != LeftButton) {
if (_buttonState != kLeftButton) {
pushKey(Common::KEYCODE_RETURN);
}
}
@ -372,8 +371,8 @@ void BadaAppForm::OnTouchMoved(const Control &source,
void BadaAppForm::OnTouchPressed(const Control &source,
const Point &currentPosition,
const TouchEventInfo &touchInfo) {
if (_buttonState != MoveOnly) {
pushEvent(_buttonState == LeftButton ? Common::EVENT_LBUTTONDOWN : Common::EVENT_RBUTTONDOWN,
if (_buttonState != kMoveOnly) {
pushEvent(_buttonState == kLeftButton ? Common::EVENT_LBUTTONDOWN : Common::EVENT_RBUTTONDOWN,
currentPosition);
}
}
@ -381,11 +380,11 @@ void BadaAppForm::OnTouchPressed(const Control &source,
void BadaAppForm::OnTouchReleased(const Control &source,
const Point &currentPosition,
const TouchEventInfo &touchInfo) {
if (_buttonState != MoveOnly) {
pushEvent(_buttonState == LeftButton ? Common::EVENT_LBUTTONUP : Common::EVENT_RBUTTONUP,
if (_buttonState != kMoveOnly) {
pushEvent(_buttonState == kLeftButton ? Common::EVENT_LBUTTONUP : Common::EVENT_RBUTTONUP,
currentPosition);
if (_buttonState == RightButtonOnce) {
_buttonState = LeftButton;
if (_buttonState == kRightButtonOnce) {
_buttonState = kLeftButton;
}
// flick to skip dialog
if (touchInfo.IsFlicked()) {
@ -398,17 +397,17 @@ void BadaAppForm::OnKeyLongPressed(const Control &source, KeyCode keyCode) {
logEntered();
switch (keyCode) {
case KEY_SIDE_UP:
_shortcut = SetVolume;
_shortcut = kSetVolume;
setVolume(true, true);
return;
case KEY_SIDE_DOWN:
_shortcut = SetVolume;
_shortcut = kSetVolume;
setVolume(false, true);
return;
case KEY_CAMERA:
_shortcut = ShowKeypad;
_shortcut = kShowKeypad;
showKeypad();
return;
@ -420,8 +419,8 @@ void BadaAppForm::OnKeyLongPressed(const Control &source, KeyCode keyCode) {
void BadaAppForm::OnKeyPressed(const Control &source, KeyCode keyCode) {
switch (keyCode) {
case KEY_SIDE_UP:
if (_shortcut != SetVolume) {
_shortcut = SetVolume;
if (_shortcut != kSetVolume) {
_shortcut = kSetVolume;
} else {
setVolume(true, false);
}
@ -429,19 +428,20 @@ void BadaAppForm::OnKeyPressed(const Control &source, KeyCode keyCode) {
case KEY_SIDE_DOWN:
switch (_shortcut) {
case ControlMouse:
case kControlMouse:
setButtonShortcut();
break;
case EscapeKey:
case kEscapeKey:
pushKey(Common::KEYCODE_ESCAPE);
break;
case GameMenu:
case kGameMenu:
_buttonState = kLeftButton;
pushKey(Common::KEYCODE_F5);
break;
case ShowKeypad:
case kShowKeypad:
showKeypad();
break;

View file

@ -50,7 +50,7 @@ public:
result Construct();
bool pollEvent(Common::Event &event);
bool isClosing() { return _state == ClosingState; }
bool isClosing() { return _state == kClosingState; }
void pushKey(Common::KeyCode keycode);
void exitSystem();
@ -100,9 +100,9 @@ private:
Osp::Base::Runtime::Thread *_gameThread;
Osp::Base::Runtime::Mutex *_eventQueueLock;
Common::Queue<Common::Event> _eventQueue;
enum {InitState, ActiveState, ClosingState, DoneState, ErrorState} _state;
enum {LeftButton, RightButtonOnce, RightButton, MoveOnly} _buttonState;
enum {ControlMouse, EscapeKey, GameMenu, ShowKeypad, SetVolume} _shortcut;
enum { kInitState, kActiveState, kClosingState, kDoneState, kErrorState } _state;
enum { kLeftButton, kRightButtonOnce, kRightButton, kMoveOnly } _buttonState;
enum { kControlMouse, kEscapeKey, kGameMenu, kShowKeypad, kSetVolume } _shortcut;
};
#endif

View file

@ -345,7 +345,7 @@ bool BadaFilesystemNode::getChildren(AbstractFSList &myList,
// open directory
if (IsFailed(pDir->Construct(_unicodePath))) {
AppLog("Failed to open directory");
AppLog("Failed to open directory: %S", _unicodePath.GetPointer());
} else {
// read all directory entries
pDirEnum = pDir->ReadN();
@ -365,8 +365,7 @@ bool BadaFilesystemNode::getChildren(AbstractFSList &myList,
}
// skip '.' and '..' to avoid cycles
if ((fileName[0] == '.' && fileName[1] == 0) ||
(fileName[0] == '.' && fileName[1] == '.')) {
if (fileName == L"." || fileName == L"..") {
continue;
}

View file

@ -38,7 +38,6 @@ BadaGraphicsManager::BadaGraphicsManager(BadaAppForm *appForm) :
_initState(true) {
assert(appForm != NULL);
_videoMode.fullscreen = true;
_videoMode.antialiasing = true;
}
const Graphics::Font *BadaGraphicsManager::getFontOSD() {
@ -195,7 +194,6 @@ void BadaGraphicsManager::loadTextures() {
// prevent image skew in some games, see:
// http://www.opengl.org/resources/features/KilgardTechniques/oglpitfall
// note: this did not solve the pixel border problem in refreshGameScreen()
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
}
@ -234,58 +232,6 @@ void BadaGraphicsManager::unloadGFXMode() {
logLeaving();
}
void BadaGraphicsManager::refreshGameScreen() {
if (_screenNeedsRedraw)
_screenDirtyRect = Common::Rect(0, 0, _screenData.w, _screenData.h);
int x = _screenDirtyRect.left;
int y = _screenDirtyRect.top;
int w = _screenDirtyRect.width();
int h = _screenDirtyRect.height();
if (_screenData.format.bytesPerPixel == 1) {
// Create a temporary RGB888 surface
int sw = w;
int sh = h;
if (_videoMode.screenWidth == w && _videoMode.screenHeight == h) {
// The extra border prevents random pixels from appearing in the right and bottom
// screen column/row. Not sure whether this should be applied to opengl-graphics.cpp
sw = w + 1;
sh = h + 1;
}
byte *surface = new byte[sw * sh * 3];
// Convert the paletted buffer to RGB888
const byte *src = (byte *)_screenData.pixels + y * _screenData.pitch;
src += x * _screenData.format.bytesPerPixel;
byte *dst = surface;
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
dst[0] = _gamePalette[src[j] * 3];
dst[1] = _gamePalette[src[j] * 3 + 1];
dst[2] = _gamePalette[src[j] * 3 + 2];
dst += 3;
}
src += _screenData.pitch;
}
// Update the texture
_gameTexture->updateBuffer(surface, w * 3, x, y, sw, sh);
// Free the temp surface
delete[] surface;
} else {
// Update the texture
_gameTexture->updateBuffer((byte *)_screenData.pixels + y * _screenData.pitch +
x * _screenData.format.bytesPerPixel, _screenData.pitch, x, y, w, h);
}
_screenNeedsRedraw = false;
_screenDirtyRect = Common::Rect();
}
// display a simple splash screen until launcher is ready
void BadaGraphicsManager::showSplash() {
Canvas canvas;

View file

@ -57,7 +57,6 @@ private:
bool loadGFXMode();
void loadTextures();
void unloadGFXMode();
void refreshGameScreen();
void setInternalMousePosition(int x, int y) {}
void showSplash();

View file

@ -30,6 +30,7 @@
#include <stdio.h>
#include <unistd.h>
#include <math.h>
#include <new>
#define M_PI 3.14159265358979323846

View file

@ -31,13 +31,28 @@
//
bool scanInt(const char **in, va_list *ap, int max) {
while (**in && (**in == ' ' || **in == '0')) {
// skip leading space characters
while (**in && **in == ' ') {
(*in)++;
}
// number optionally preceeded with a + or - sign.
bool negate = false;
if (**in == '-') {
(*in)++;
negate = true;
}
if (**in == '+') {
(*in)++;
}
int *arg = va_arg(*ap, int*);
char *end;
long n = strtol(*in, &end, 0);
long n = strtol(*in, &end, 10);
if (negate) {
n = -n;
}
bool err = false;
if (end == *in || (max > 0 && (end - *in) > max)) {
@ -162,21 +177,37 @@ extern "C" int simple_sscanf(const char *input, const char *format, ...) {
#if defined(TEST)
int main(int argc, char *pArgv[]) {
int x,y,h;
int x,y,xx,yy,h;
char buffer[100];
unsigned u;
char c;
strcpy(buffer, "hello");
char *b = buffer;
// strcpy(buffer, "in the buffer something");
if (simple_sscanf("CAT 123x-10 0x100 FONT large 1 enough\n 123456.AUD $",
"CAT %dx%d %x FONT %[^\n] %06u.AUD %c",
&x, &y, &h, b, &u, &c) != 6) {
if (simple_sscanf("BBX 00009 -1 +10 000",
"BBX %d %d %d %d",
&x, &y, &xx, &yy) != 4) {
printf("Failed\n");
} else {
printf("Success %d %d %d %s %d '%c'\n", x, y, h, buffer, u, c);
printf("Success %d %d %d %d\n", x, y, xx, yy);
}
if (simple_sscanf("CAT 123x-10 0x100h 123456.AUD $ ",
"CAT %dx%d %xh %06u.AUD %c",
&x, &y, &h, &u, &c) != 5) {
printf("Failed\n");
} else {
printf("Success %d %d %d %d '%c' \n", x, y, h, u, c);
}
if (simple_sscanf("COPYRIGHT \"Copyright (c) 1984, 1987 Foo Systems Incorporated",
"COPYRIGHT \"%[^\"]",
b) != 1) {
printf("Failed\n");
} else {
printf("Success %s\n", buffer);
}
return 0;
}
#endif

View file

@ -45,6 +45,7 @@ using namespace Osp::Base::Runtime;
using namespace Osp::Ui::Controls;
#define DEFAULT_CONFIG_FILE "/Home/scummvm.ini"
#define RESOURCE_PATH "/Res"
#define MUTEX_BUFFER_SIZE 5
//
@ -283,9 +284,6 @@ result BadaSystem::initModules() {
void BadaSystem::initBackend() {
logEntered();
// allow translations and game .DAT files to be found
ConfMan.set("extrapath", "/Res");
// use the mobile device theme
ConfMan.set("gui_theme", "/Res/scummmobile");
@ -304,7 +302,7 @@ void BadaSystem::initBackend() {
}
ConfMan.registerDefault("fullscreen", true);
ConfMan.registerDefault("aspect_ratio", true);
ConfMan.registerDefault("aspect_ratio", false);
ConfMan.setBool("confirm_exit", false);
Osp::System::SystemTime::GetTicks(_epoch);
@ -317,7 +315,7 @@ void BadaSystem::initBackend() {
// replace kBigGUIFont using the large font from the scummmobile theme
Common::File fontFile;
Common::String fileName = "/Res/scummmobile/helvB14-ASCII.fcc";
Common::String fileName = "/Res/scummmobile/helvB14-iso-8859-1.fcc";
BadaFilesystemNode file(fileName);
if (file.exists()) {
Common::SeekableReadStream *stream = file.createReadStream();
@ -335,6 +333,11 @@ void BadaSystem::initBackend() {
logLeaving();
}
void BadaSystem::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
// allow translations.dat and game .DAT files to be found
s.addDirectory(RESOURCE_PATH, RESOURCE_PATH, priority);
}
void BadaSystem::destroyBackend() {
closeAudio();
@ -446,10 +449,14 @@ void BadaSystem::closeGraphics() {
}
void BadaSystem::setMute(bool on) {
// only change mute after eventManager init() has completed
if (_audioThread) {
BadaGraphicsManager *graphics = getGraphics();
if (graphics && graphics->isReady()) {
_audioThread->setMute(on);
}
}
}
int BadaSystem::setVolume(bool up, bool minMax) {
int level = -1;

View file

@ -88,6 +88,7 @@ private:
void getTimeAndDate(TimeDate &t) const;
void fatalError();
void logMessage(LogMessageType::Type type, const char *message);
void addSysArchivesToSearchSet(Common::SearchSet &s, int priority);
Common::EventSource *getDefaultEventSource() { return this; }
Common::SeekableReadStream *createConfigReadStream();

View file

@ -39,7 +39,7 @@ protected:
Common::String _path;
public:
RoninCDFileNode(const Common::String &path) : _path(path) {};
RoninCDFileNode(const Common::String &path) : _path(path) {}
virtual bool exists() const { return true; }
virtual Common::String getName() const { return lastPathComponent(_path, '/'); }
@ -61,7 +61,7 @@ public:
/* A directory */
class RoninCDDirectoryNode : public RoninCDFileNode {
public:
RoninCDDirectoryNode(const Common::String &path) : RoninCDFileNode(path) {};
RoninCDDirectoryNode(const Common::String &path) : RoninCDFileNode(path) {}
virtual bool isDirectory() const { return true; }
virtual AbstractFSNode *getChild(const Common::String &n) const;
@ -72,7 +72,7 @@ public:
/* A file/directory which does not exist */
class RoninCDNonexistingNode : public RoninCDFileNode {
public:
RoninCDNonexistingNode(const Common::String &path) : RoninCDFileNode(path) {};
RoninCDNonexistingNode(const Common::String &path) : RoninCDFileNode(path) {}
virtual bool exists() const { return false; }
virtual bool isReadable() const { return false; }

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