summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-07-17 12:53:11 +0200
committerSergeanur <s.anureev@yandex.ua>2020-07-17 12:53:11 +0200
commitde8759eabde158d345dea3aed80a1a50ab319fcb (patch)
treee448200e4ac1045c8951296c8f90ce9974c72cd5 /src
parentMerge branch 'master' into miami (diff)
parentAdd audio cache for faster initialization (diff)
downloadre3-de8759eabde158d345dea3aed80a1a50ab319fcb.tar
re3-de8759eabde158d345dea3aed80a1a50ab319fcb.tar.gz
re3-de8759eabde158d345dea3aed80a1a50ab319fcb.tar.bz2
re3-de8759eabde158d345dea3aed80a1a50ab319fcb.tar.lz
re3-de8759eabde158d345dea3aed80a1a50ab319fcb.tar.xz
re3-de8759eabde158d345dea3aed80a1a50ab319fcb.tar.zst
re3-de8759eabde158d345dea3aed80a1a50ab319fcb.zip
Diffstat (limited to 'src')
-rw-r--r--src/audio/sampman_miles.cpp17
-rw-r--r--src/audio/sampman_oal.cpp13
-rw-r--r--src/core/FileLoader.cpp2
-rw-r--r--src/core/config.h3
4 files changed, 33 insertions, 2 deletions
diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp
index 5893ea64..d6bb1975 100644
--- a/src/audio/sampman_miles.cpp
+++ b/src/audio/sampman_miles.cpp
@@ -1012,6 +1012,15 @@ cSampleManager::Initialise(void)
}
+#ifdef AUDIO_CACHE
+ TRACE("cache");
+ FILE *cacheFile = fopen("audio\\sound.cache", "rb");
+ if (cacheFile) {
+ fread(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
+ fclose(cacheFile);
+ m_bInitialised = true;
+ }else {
+#endif
TRACE("cdrom");
S32 tatalms;
@@ -1168,7 +1177,13 @@ cSampleManager::Initialise(void)
_bUseHDDAudio = false;
}
#endif
-
+#ifdef AUDIO_CACHE
+ cacheFile = fopen("audio\\sound.cache", "wb");
+ fwrite(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
+ fclose(cacheFile);
+ }
+#endif
+
TRACE("stream");
{
for ( int32 i = 0; i < MAX_STREAMS; i++ )
diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp
index de55c2ed..bf2eca7d 100644
--- a/src/audio/sampman_oal.cpp
+++ b/src/audio/sampman_oal.cpp
@@ -604,7 +604,13 @@ cSampleManager::Initialise(void)
return false;
}
}
-
+#ifdef AUDIO_CACHE
+ FILE *cacheFile = fopen("audio\\sound.cache", "rb");
+ if (cacheFile) {
+ fread(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
+ fclose(cacheFile);
+ } else
+#endif
{
for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ )
@@ -622,6 +628,11 @@ cSampleManager::Initialise(void)
else
USERERROR("Can't open '%s'\n", StreamedNameTable[i]);
}
+#ifdef AUDIO_CACHE
+ cacheFile = fopen("audio\\sound.cache", "wb");
+ fwrite(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
+ fclose(cacheFile);
+#endif
}
LoadSampleBank(SAMPLEBANK_MAIN);
diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp
index a7ab365c..a29d26fa 100644
--- a/src/core/FileLoader.cpp
+++ b/src/core/FileLoader.cpp
@@ -106,7 +106,9 @@ CFileLoader::LoadLevel(const char *filename)
LoadingScreenLoadingFile(line + 4);
LoadScene(line + 4);
}else if(strncmp(line, "SPLASH", 6) == 0){
+#ifndef DISABLE_LOADING_SCREEN
LoadSplash(GetRandomSplashScreen());
+#endif
}else if(strncmp(line, "CDIMAGE", 7) == 0){
CdStreamAddImage(line + 8);
}
diff --git a/src/core/config.h b/src/core/config.h
index 95550dd6..c63ce4c8 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -289,3 +289,6 @@ enum Config {
// Camera
#define IMPROVED_CAMERA // Better Debug cam, and maybe more in the future
#define FREE_CAM // Rotating cam
+
+// Audio
+#define AUDIO_CACHE // cache sound lengths to speed up the cold boot