From 86706eb7d7c4a208925beebe5da59c02b8a6f34d Mon Sep 17 00:00:00 2001 From: John Willis Date: Sun, 29 Jun 2008 10:16:20 +0000 Subject: Small GP2X tidy (mostly svn:executable on scripts) and fixes needed to reflect "Patch ##1956946 (Audio::Mixer internal API revision)" svn-id: r32835 --- backends/platform/gp2x/build/README-GP2X | 2 +- backends/platform/gp2x/build/README-GP2X.html | 147 ++++++++++++++++++-------- backends/platform/gp2x/build/build.sh | 0 backends/platform/gp2x/build/bundle.sh | 0 backends/platform/gp2x/build/clean.sh | 0 backends/platform/gp2x/build/config.sh | 4 +- backends/platform/gp2x/build/scummvm.gpe | 0 backends/platform/gp2x/gp2x-common.h | 5 +- backends/platform/gp2x/gp2x.cpp | 54 +++++++--- 9 files changed, 147 insertions(+), 65 deletions(-) mode change 100644 => 100755 backends/platform/gp2x/build/build.sh mode change 100644 => 100755 backends/platform/gp2x/build/bundle.sh mode change 100644 => 100755 backends/platform/gp2x/build/clean.sh mode change 100644 => 100755 backends/platform/gp2x/build/config.sh mode change 100644 => 100755 backends/platform/gp2x/build/scummvm.gpe (limited to 'backends') diff --git a/backends/platform/gp2x/build/README-GP2X b/backends/platform/gp2x/build/README-GP2X index cb1d043500..7e10fc484e 100644 --- a/backends/platform/gp2x/build/README-GP2X +++ b/backends/platform/gp2x/build/README-GP2X @@ -1,4 +1,4 @@ -ScummVM - GP2X SPECIFIC README - 0.10.0 SVN +ScummVM - GP2X SPECIFIC README - HEAD SVN ------------------------------------------------------------------------ Contents: diff --git a/backends/platform/gp2x/build/README-GP2X.html b/backends/platform/gp2x/build/README-GP2X.html index 5289d3d36c..1b5f1a4173 100644 --- a/backends/platform/gp2x/build/README-GP2X.html +++ b/backends/platform/gp2x/build/README-GP2X.html @@ -2,12 +2,15 @@ ScummVM - GP2X SPECIFIC README + + -ScummVM - GP2X SPECIFIC README - 0.10.0 SVN
+ScummVM - +GP2X SPECIFIC README - HEAD SVN


@@ -16,52 +19,65 @@ +
+
About the backend/port

-This is the readme for the offficial GP2X ScummVM backend (also known as the GP2X port).
+This is the readme for the offficial GP2X ScummVM backend (also known +as the GP2X port).

-This is an SVN test release of ScummVM for the GP2X, it would be appreciated +This is an SVN test release of ScummVM for the GP2X, it would be +appreciated if this SVN test distribution was not mirrored and that people be -directed to http://www.distant-earth.com/scummvm instead for updated SVN builds.
+directed to http://www.distant-earth.com/scummvm +instead for updated SVN builds.

Full supported official releases of the GP2X ScummVM backend are made -in line with main official releases and are avalalble from the ScummVM downloads page.
+in line with main official releases and are avalalble from the ScummVM +downloads page.

-This build is in an active state of development and as such no ‘expected’ behavior can be guaranteed ;).
+This build is in an active state of development and as such no +‘expected’ behavior can be guaranteed ;).

@@ -69,47 +85,59 @@ SVN builds are quickly tested with firmware 2.0.0 for reference.

-Please refer to the GP2X ScummVM forum and WiKi for the latest information on the port.
+Please refer to the GP2X +ScummVM forum and WiKi +for the latest information on the port.
+

Game compatibility

-For information on the compatability of a specific game please refer to the GP2X compatability section of the ScummVM WiKi.
+For information on the compatability of a specific game please refer to +the GP2X +compatability section of the ScummVM WiKi.

-Please note the version and date of the ScummVM build you are running when reviewing the above list.
+Please note the version and date of the ScummVM build you are running +when reviewing the above list.


Included engines

+ Just because an engine is included does not mean any/all of its games are supported. Please check game compatability for more infomation.
+ +
  • Gob - (Goblins one)
  • + +
  • Queen - (Flight of the Amazon Queen)
  • + +
  • Kyra - (The Legend of Kyrandia)
  • + + All other game engines are disabled in this release.
    @@ -155,13 +183,18 @@ DXA video support will be added as soon as it is stable.
    Enabled hardware scalar code.
    -Now built using SDL 1.2.9 for the parts of the port that use SDL (some parts now hit the hardware directly).
    +Now built using SDL 1.2.9 for the parts of the port that use SDL (some +parts now hit the hardware directly).
    -Enabled new launcher - (Ensure defaulttheme.zip is in the same folder as the executable).
    +Enabled new launcher - (Ensure defaulttheme.zip is in the same folder +as the executable).
    -Aspect Ratio Correction can now be disabled ‘per game’. When adding a game you can find this option on the GFX tab.
    +Aspect Ratio Correction can now be disabled ‘per +game’. When adding a game you can find this option on the GFX +tab.
    -Note: This will cause the game to run with a black border at the bottom as it will be rendered to a 320*200 frame.
    +Note: This will cause the game to run with a black border at the bottom +as it will be rendered to a 320*200 frame.

    @@ -169,7 +202,9 @@ Note: This will cause the game to run with a black border at the bottom as it wi
    -NOTE: Everything is saved to the SD card, saves are stored in the saves folder under your main ScummVM executable unless you set another save location.
    +NOTE: +Everything is saved to the SD card, saves are stored in the saves folder under +your main ScummVM executable unless you set another save location.

    @@ -178,7 +213,8 @@ same place as the ScummVM executable.

    -The save process below is for Scumm engine games but the principle is the same for all.
    +The save process below is for Scumm engine games but the +principle is the same for all.

    @@ -198,11 +234,13 @@ In Game.

    -Basically the emulated keys you can use are equivelent to the values buttons are mapped to,
    +Basically the emulated keys you can use are equivelent to the values +buttons are mapped to,

    -I have a virtual keyboard like the GP32 one (left/right on the stick to pick chars) to add in at some point ;-)
    +I have a virtual keyboard like the GP32 one (left/right on the stick to +pick chars) to add in at some point ;-)

    @@ -262,9 +300,11 @@ Select: Exit ScummVM completely (and gracefully)

    -Possible random crash (well SegFault). I have had this happen twice and have not tracked down the cause.
    +Possible random crash (well SegFault). I have had this happen twice and +have not tracked down the cause.
    -It happens very infrequently, both times it was in the DOTT CD intro. Saving often is never a bad idea anyhow.
    +It happens very infrequently, both times it was in the DOTT CD intro. +Saving often is never a bad idea anyhow.

    @@ -272,11 +312,14 @@ It happens very infrequently, both times it was in the DOTT CD intro. Saving oft
    -Fix save support when using the Sky engine (Beneath a Steel Sky) - You CAN'T save at the moment but auto save works.
    +Fix save support when using the Sky engine (Beneath a Steel Sky) - You +CAN'T save at the moment but auto save works.
    -Look into inconsistencies with AGOS engine and map Y key to a button combination to allow clean quitting (Simon 1/2).
    +Look into inconsistencies with AGOS engine and map Y key to a button +combination to allow clean quitting (Simon 1/2).
    -Add splash-screen and pre-ScummVM config menu (CPU speed, LCD timings etc.) - Partly done.
    +Add splash-screen and pre-ScummVM config menu (CPU speed, LCD timings +etc.) - Partly done.
    Fix TV out, maybe make it an option in the pre-ScummVM config menu.
    @@ -284,17 +327,29 @@ Any help appreciated :).

    -
    Additional resources/links
    +
    Additional resources/links
    + +
    + +
    Note: +When providing feedback, +requests, forum posts, bug reports or anything like that always include +a mention of the version of ScummVM you are using (the build version, +date and time can be seen in the main game launcher window).
    diff --git a/backends/platform/gp2x/build/build.sh b/backends/platform/gp2x/build/build.sh old mode 100644 new mode 100755 diff --git a/backends/platform/gp2x/build/bundle.sh b/backends/platform/gp2x/build/bundle.sh old mode 100644 new mode 100755 diff --git a/backends/platform/gp2x/build/clean.sh b/backends/platform/gp2x/build/clean.sh old mode 100644 new mode 100755 diff --git a/backends/platform/gp2x/build/config.sh b/backends/platform/gp2x/build/config.sh old mode 100644 new mode 100755 index 4a30ed4a31..17083d1ea4 --- a/backends/platform/gp2x/build/config.sh +++ b/backends/platform/gp2x/build/config.sh @@ -17,7 +17,7 @@ export DEFINES=-DNDEBUG # Edit the configure line to suit. cd ../../../.. -./configure --backend=gp2x --disable-mt32emu --host=gp2x --disable-flac --disable-nasm --disable-hq-scalers --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 -#--enable-plugins +./configure --backend=gp2x --disable-mt32emu --host=gp2x --disable-flac --disable-nasm --disable-hq-scalers --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --enable-made --enable-m4 +#--enable-plugins --default-dynamic echo Generating config for GP2X complete. Check for errors. diff --git a/backends/platform/gp2x/build/scummvm.gpe b/backends/platform/gp2x/build/scummvm.gpe old mode 100644 new mode 100755 diff --git a/backends/platform/gp2x/gp2x-common.h b/backends/platform/gp2x/gp2x-common.h index 7e0ea88e0b..92f625bdc4 100644 --- a/backends/platform/gp2x/gp2x-common.h +++ b/backends/platform/gp2x/gp2x-common.h @@ -128,8 +128,8 @@ public: virtual bool pollEvent(Common::Event &event); // overloaded by CE backend // Set function that generates samples - typedef void (*SoundProc)(void *param, byte *buf, int len); - virtual bool setSoundCallback(SoundProc proc, void *param); // overloaded by CE backend + void setupMixer(); + static void mixCallback(void *s, byte *samples, int len); virtual Audio::Mixer *getMixer(); // Poll CD status @@ -179,7 +179,6 @@ public: int getGraphicsMode() const; bool openCD(int drive); - int getOutputSampleRate() const; bool hasFeature(Feature f); void setFeatureState(Feature f, bool enable); diff --git a/backends/platform/gp2x/gp2x.cpp b/backends/platform/gp2x/gp2x.cpp index 1f330cf2d4..c138f6c54d 100644 --- a/backends/platform/gp2x/gp2x.cpp +++ b/backends/platform/gp2x/gp2x.cpp @@ -444,41 +444,69 @@ void OSystem_GP2X::deleteMutex(MutexRef mutex) { #pragma mark --- Audio --- #pragma mark - +void OSystem_GP2X::mixCallback(void *sys, byte *samples, int len) { + OSystem_GP2X *this_ = (OSystem_GP2X *)sys; + assert(this_); + + if (this_->_mixer) + this_->_mixer->mixCallback(samples, len); +} + void OSystem_GP2X::setupMixer() { SDL_AudioSpec desired; SDL_AudioSpec obtained; - memset(&desired, 0, sizeof(desired)); + //memset(&desired, 0, sizeof(desired)); + // Determine the desired output sampling frequency. _samplesPerSec = 0; - if (ConfMan.hasKey("output_rate")) _samplesPerSec = ConfMan.getInt("output_rate"); - if (_samplesPerSec <= 0) _samplesPerSec = SAMPLES_PER_SEC; + //Quick EVIL Hack - DJWillis _samplesPerSec = 11025; + // Determine the sample buffer size. We want it to store enough data for + // about 1/16th of a second. Note that it must be a power of two. + // So e.g. at 22050 Hz, we request a sample buffer size of 2048. + int samples = 8192; + while (16 * samples >= _samplesPerSec) { + samples >>= 1; + } + + memset(&desired, 0, sizeof(desired)); desired.freq = _samplesPerSec; desired.format = AUDIO_S16SYS; desired.channels = 2; //desired.samples = (uint16)samples; desired.samples = 128; // Samples hack - desired.callback = proc; - desired.userdata = param; + desired.callback = mixCallback; + desired.userdata = this; + + // Create the mixer instance + assert(!_mixer); + _mixer = new Audio::MixerImpl(this); + assert(_mixer); + if (SDL_OpenAudio(&desired, &obtained) != 0) { warning("Could not open audio device: %s", SDL_GetError()); - return false; + _samplesPerSec = 0; + _mixer->setReady(false); + } else { + // Note: This should be the obtained output rate, but it seems that at + // least on some platforms SDL will lie and claim it did get the rate + // even if it didn't. Probably only happens for "weird" rates, though. + _samplesPerSec = obtained.freq; + debug(1, "Output sample rate: %d Hz", _samplesPerSec); + + // Tell the mixer that we are ready and start the sound processing + _mixer->setOutputRate(_samplesPerSec); + _mixer->setReady(true); + SDL_PauseAudio(0); } - _samplesPerSec = obtained.freq; - SDL_PauseAudio(0); - return true; -} - -int OSystem_GP2X::getOutputSampleRate() const { - return _samplesPerSec; } Audio::Mixer *OSystem_GP2X::getMixer() { -- cgit v1.2.3