[Scummvm-cvs-logs] scummvm master -> c24f0775cd262c789f7d17ea0ed461c57e7c5f6e
Littleboy
littleboy22 at gmail.com
Fri May 13 21:56:54 CEST 2011
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
aa64280b55 LASTEXPRESS: Implement SoundManager::setupCache()
a08158a004 CREATE_PROJECT: Generate a default revision header when no revision can be determined
c24f0775cd CREATE_PROJECT: Handle paths with spaces in pre/post-build scripts
Commit: aa64280b55609d11ab869d0b7cea9775a8e0d291
https://github.com/scummvm/scummvm/commit/aa64280b55609d11ab869d0b7cea9775a8e0d291
Author: Littleboy (littleboy at users.sourceforge.net)
Date: 2011-05-13T12:49:55-07:00
Commit Message:
LASTEXPRESS: Implement SoundManager::setupCache()
Changed paths:
engines/lastexpress/game/sound.cpp
engines/lastexpress/game/sound.h
diff --git a/engines/lastexpress/game/sound.cpp b/engines/lastexpress/game/sound.cpp
index 7125b95..5cfe990 100644
--- a/engines/lastexpress/game/sound.cpp
+++ b/engines/lastexpress/game/sound.cpp
@@ -36,6 +36,9 @@
namespace LastExpress {
+#define SOUNDCACHE_ENTRY_SIZE 92160
+#define SOUNDCACHE_MAX_SIZE 6
+
// Letters & messages
const char *messages[24] = {
"",
@@ -109,6 +112,9 @@ SoundManager::SoundManager(LastExpressEngine *engine) : _engine(engine), _state(
memset(&_buffer, 0, sizeof(_buffer));
memset(&_lastWarning, 0, sizeof(_lastWarning));
+ // Sound cache
+ _soundCacheData = malloc(6 * SOUNDCACHE_ENTRY_SIZE);
+
_drawSubtitles = 0;
_currentSubtitle = NULL;
}
@@ -124,6 +130,8 @@ SoundManager::~SoundManager() {
_currentSubtitle = NULL;
+ free(_soundCacheData);
+
// Zero passed pointers
_engine = NULL;
}
@@ -154,7 +162,7 @@ void SoundManager::handleTimer() {
//////////////////////////////////////////////////////////////////////////
void SoundManager::updateQueue() {
// TODO add mutex lock!
- //warning("Sound::unknownFunction1: not implemented!");
+ warning("Sound::updateQueue: not implemented!");
}
void SoundManager::resetQueue(SoundType type1, SoundType type2) {
@@ -328,11 +336,64 @@ void SoundManager::setEntryStatus(SoundEntry *entry, FlagType flag) const {
entry->status.status = (status | kSoundStatusClear4);
}
+void SoundManager::setInCache(SoundEntry *entry) {
+ entry->status.status |= kSoundStatusClear2;
+}
+
bool SoundManager::setupCache(SoundEntry *entry) {
- warning("Sound::setupCache: not implemented!");
+ if (entry->soundData)
+ return true;
+
+ if (_cache.size() >= SOUNDCACHE_MAX_SIZE) {
+
+ SoundEntry *cacheEntry = NULL;
+ uint32 size = 1000;
+
+ for (Common::List<SoundEntry *>::iterator i = _cache.begin(); i != _cache.end(); ++i) {
+ if (!((*i)->status.status & kSoundStatus_180)) {
+ uint32 newSize = (*i)->field_4C + ((*i)->status.status & kSoundStatusClear1);
+
+ if (newSize < size) {
+ cacheEntry = (*i);
+ size = newSize;
+ }
+ }
+ }
+
+ if (entry->field_4C <= size)
+ return false;
+
+ if (cacheEntry)
+ setInCache(cacheEntry);
+
+ // TODO: Wait until the cache entry is ready to be removed
+ while (!(cacheEntry->status.status1 & 1));
+
+ if (cacheEntry->soundData)
+ removeFromCache(cacheEntry);
+
+ _cache.push_back(entry);
+ entry->soundData = (char *)_soundCacheData + SOUNDCACHE_ENTRY_SIZE * (_cache.size() - 1);
+ } else {
+ _cache.push_back(entry);
+ entry->soundData = (char *)_soundCacheData + SOUNDCACHE_ENTRY_SIZE * (_cache.size() - 1);
+ }
+
return true;
}
+void SoundManager::removeFromCache(SoundEntry *entry) {
+ for (Common::List<SoundEntry *>::iterator i = _cache.begin(); i != _cache.end(); ++i) {
+ if ((*i) == entry) {
+ // Remove sound buffer
+ entry->soundData = NULL;
+
+ // Remove entry from sound cache
+ i = _cache.reverse_erase(i);
+ }
+ }
+}
+
void SoundManager::clearStatus() {
Common::StackLock locker(_mutex);
diff --git a/engines/lastexpress/game/sound.h b/engines/lastexpress/game/sound.h
index 37aff5c..08ec767 100644
--- a/engines/lastexpress/game/sound.h
+++ b/engines/lastexpress/game/sound.h
@@ -206,6 +206,7 @@ private:
enum SoundStatus {
kSoundStatus_20 = 0x20,
kSoundStatus_40 = 0x40,
+ kSoundStatus_180 = 0x180,
kSoundStatusRemoved = 0x200,
kSoundStatus_400 = 0x400,
@@ -247,8 +248,8 @@ private:
SoundType type; // int
//int field_8;
//int field_C;
- //int field_10;
- //int fileData;
+ int processedFrameCount;
+ void *soundData;
//int field_18;
int field_1C;
uint32 time;
@@ -262,7 +263,7 @@ private:
int field_40;
EntityIndex entity;
int field_48;
- int field_4C;
+ uint32 field_4C;
Common::String name1; //char[16];
Common::String name2; //char[16];
//int next; // offset to the next structure in the list (not used)
@@ -275,6 +276,9 @@ private:
status.status = 0;
type = kSoundTypeNone;
+ processedFrameCount = 0;
+ soundData = NULL;
+
field_1C = 0;
time = 0;
@@ -345,6 +349,7 @@ private:
// Sound cache
Common::List<SoundEntry *> _cache;
+ void *_soundCacheData;
SoundEntry *getEntry(EntityIndex index);
SoundEntry *getEntry(Common::String name);
@@ -353,7 +358,9 @@ private:
void setupEntry(SoundEntry *entry, Common::String name, FlagType flag, int a4);
void setEntryType(SoundEntry *entry, FlagType flag);
void setEntryStatus(SoundEntry *entry, FlagType flag) const;
+ void setInCache(SoundEntry *entry);
bool setupCache(SoundEntry *entry);
+ void removeFromCache(SoundEntry *entry);
void loadSoundData(SoundEntry *entry, Common::String name);
void updateEntry(SoundEntry *entry, uint value) const;
Commit: a08158a004425afb89ca984379c6d27fa71e763b
https://github.com/scummvm/scummvm/commit/a08158a004425afb89ca984379c6d27fa71e763b
Author: Littleboy (littleboy at users.sourceforge.net)
Date: 2011-05-13T12:49:57-07:00
Commit Message:
CREATE_PROJECT: Generate a default revision header when no revision can be determined
Changed paths:
devtools/create_project/scripts/revision.vbs
diff --git a/devtools/create_project/scripts/revision.vbs b/devtools/create_project/scripts/revision.vbs
index 3e12125..e6fef57 100644
--- a/devtools/create_project/scripts/revision.vbs
+++ b/devtools/create_project/scripts/revision.vbs
@@ -80,6 +80,7 @@ Sub DetermineRevision()
If Not DetermineGitVersion() Then
If Not DetermineHgVersion() Then
Wscript.StdErr.WriteLine "Could not determine the current revision, skipping..."
+ OutputRevisionHeader ""
Exit Sub
End If
End If
@@ -91,6 +92,7 @@ Sub DetermineRevision()
If Not DetermineTortoiseSVNVersion() Then
If Not DetermineSVNVersion() Then
Wscript.StdErr.WriteLine "Could not determine the current revision, skipping..."
+ OutputRevisionHeader ""
Exit Sub
End If
End If
@@ -121,9 +123,13 @@ Sub DetermineRevision()
Wscript.StdErr.WriteLine outputInfo & vbCrLf
- ' Output revision header file
+ OutputRevisionHeader revisionString
+End Sub
+
+' Output revision header file
+Sub OutputRevisionHeader(str)
FSO.CopyFile rootFolder & "\\base\\internal_revision.h.in", targetFolder & "\\internal_revision.h"
- FindReplaceInFile targetFolder & "\\internal_revision.h", "@REVISION@", revisionString
+ FindReplaceInFile targetFolder & "\\internal_revision.h", "@REVISION@", str
End Sub
Function DetermineTortoiseSVNVersion()
Commit: c24f0775cd262c789f7d17ea0ed461c57e7c5f6e
https://github.com/scummvm/scummvm/commit/c24f0775cd262c789f7d17ea0ed461c57e7c5f6e
Author: Littleboy (littleboy at users.sourceforge.net)
Date: 2011-05-13T12:49:59-07:00
Commit Message:
CREATE_PROJECT: Handle paths with spaces in pre/post-build scripts
Changed paths:
devtools/create_project/scripts/postbuild.cmd
devtools/create_project/scripts/prebuild.cmd
diff --git a/devtools/create_project/scripts/postbuild.cmd b/devtools/create_project/scripts/postbuild.cmd
index 75a916d..a5051d8 100644
--- a/devtools/create_project/scripts/postbuild.cmd
+++ b/devtools/create_project/scripts/postbuild.cmd
@@ -37,16 +37,16 @@ REM xcopy /F /Y "%~1/dists/engine-data/*.cpt" %~2 1>NUL 2>&1
REM xcopy /F /Y "%~1/gui/themes/*.zip" %~2 1>NUL 2>&1
REM xcopy /F /Y "%~1/gui/themes/translations.dat" %~2 1>NUL 2>&1
-xcopy /F /Y "%~4/lib/%~3/SDL.dll" %~2 1>NUL 2>&1
-xcopy /F /Y "%~4/README-SDL" %~2 1>NUL 2>&1
+xcopy /F /Y "%~4/lib/%~3/SDL.dll" "%~2" 1>NUL 2>&1
+xcopy /F /Y "%~4/README-SDL" "%~2" 1>NUL 2>&1
-xcopy /F /Y "%~1/backends/vkeybd/packs/vkeybd_default.zip" %~2 1>NUL 2>&1
+xcopy /F /Y "%~1/backends/vkeybd/packs/vkeybd_default.zip" "%~2" 1>NUL 2>&1
if "%~5"=="0" goto done
echo Running installer script
echo.
- at call cscript "%~1/devtools/create_project/scripts/installer.vbs" %~1 %~2 %~3 1>NUL
+ at call cscript "%~1/devtools/create_project/scripts/installer.vbs" "%~1" "%~2" "%~3" 1>NUL
if not %errorlevel% == 0 goto error_script
goto done
diff --git a/devtools/create_project/scripts/prebuild.cmd b/devtools/create_project/scripts/prebuild.cmd
index dd4d12a..fbab426 100644
--- a/devtools/create_project/scripts/prebuild.cmd
+++ b/devtools/create_project/scripts/prebuild.cmd
@@ -14,7 +14,7 @@ if "%~1"=="" goto error_root
if "%~2"=="" goto error_target
REM Run the revision script
- at call cscript "%~1/devtools/create_project/scripts/revision.vbs" %~1 %~2 1>NUL
+ at call cscript "%~1/devtools/create_project/scripts/revision.vbs" "%~1" "%~2" 1>NUL
if not %errorlevel% == 0 goto error_script
goto done
More information about the Scummvm-git-logs
mailing list