- Fix Android compilation issues
- Added a "cachesize" option (not available from the menu, but can be manually edited in players/options.txt, for example cachesize=200 means 200MB of cache). The hardcoded cache on windows/linux is 20MB, which is not enough for Hi Res cards (60 is better, 200 is great)
This commit is contained in:
@@ -133,7 +133,6 @@ LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.cpp \
|
|||||||
$(MTG_PATH)/src/WFont.cpp \
|
$(MTG_PATH)/src/WFont.cpp \
|
||||||
$(MTG_PATH)/src/WGui.cpp \
|
$(MTG_PATH)/src/WGui.cpp \
|
||||||
$(MTG_PATH)/src/WResourceManager.cpp \
|
$(MTG_PATH)/src/WResourceManager.cpp \
|
||||||
$(MTG_PATH)/src/NetworkPlayer.cpp \
|
|
||||||
$(JGE_PATH)/src/SDLmain.cpp \
|
$(JGE_PATH)/src/SDLmain.cpp \
|
||||||
$(JGE_PATH)/src/Encoding.cpp \
|
$(JGE_PATH)/src/Encoding.cpp \
|
||||||
$(JGE_PATH)/src/JAnimator.cpp \
|
$(JGE_PATH)/src/JAnimator.cpp \
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public:
|
|||||||
bool tryToUnlock(GameObserver * game);
|
bool tryToUnlock(GameObserver * game);
|
||||||
static void load();
|
static void load();
|
||||||
static map <string, Unlockable *> unlockables;
|
static map <string, Unlockable *> unlockables;
|
||||||
static void Unlockable::Destroy();
|
static void Destroy();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "JLogger.h"
|
#include "JLogger.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#define HUGE_CACHE_LIMIT 20000000 // Size of the cache for Windows and Linux
|
#define HUGE_CACHE_LIMIT 20000000 // Size of the cache for Windows and Linux (in bytes)
|
||||||
#define SAMPLES_CACHE_SIZE 1500000 // Size in bytes of the cached samples
|
#define SAMPLES_CACHE_SIZE 1500000 // Size in bytes of the cached samples
|
||||||
#define PSI_CACHE_SIZE 500000 // Size in bytes of the cached particles
|
#define PSI_CACHE_SIZE 500000 // Size in bytes of the cached particles
|
||||||
#define TEXTURES_CACHE_MINSIZE 2000000 // Minimum size of the cache on the PSP. The program should complain if the cache ever gets smaller than this
|
#define TEXTURES_CACHE_MINSIZE 2000000 // Minimum size of the cache on the PSP. The program should complain if the cache ever gets smaller than this
|
||||||
|
|||||||
@@ -96,8 +96,6 @@ void GameApp::Create()
|
|||||||
//_CrtSetBreakAlloc(368);
|
//_CrtSetBreakAlloc(368);
|
||||||
LOG("starting Game");
|
LOG("starting Game");
|
||||||
|
|
||||||
WResourceManager::Instance()->ResetCacheLimits();
|
|
||||||
|
|
||||||
string systemFolder = "Res/";
|
string systemFolder = "Res/";
|
||||||
string foldersRoot = "";
|
string foldersRoot = "";
|
||||||
|
|
||||||
@@ -149,6 +147,11 @@ void GameApp::Create()
|
|||||||
LOG("options.reloadProfile()");
|
LOG("options.reloadProfile()");
|
||||||
options.reloadProfile();
|
options.reloadProfile();
|
||||||
|
|
||||||
|
|
||||||
|
//Setup Cache before calling any gfx/sfx functions
|
||||||
|
WResourceManager::Instance()->ResetCacheLimits();
|
||||||
|
|
||||||
|
|
||||||
LOG("Checking for music files");
|
LOG("Checking for music files");
|
||||||
//Test for Music files presence
|
//Test for Music files presence
|
||||||
JFileSystem * jfs = JFileSystem::GetInstance();
|
JFileSystem * jfs = JFileSystem::GetInstance();
|
||||||
|
|||||||
@@ -894,13 +894,7 @@ void ResourceManagerImpl::RemoveWFonts()
|
|||||||
|
|
||||||
void ResourceManagerImpl::ResetCacheLimits()
|
void ResourceManagerImpl::ResetCacheLimits()
|
||||||
{
|
{
|
||||||
#if defined WIN32 || defined LINUX || defined (IOS)
|
#if defined PSP
|
||||||
#ifdef FORCE_LOW_CACHE_MEMORY
|
|
||||||
textureWCache.Resize(kConstrainedCacheLimit, MAX_CACHE_OBJECTS);
|
|
||||||
#else
|
|
||||||
textureWCache.Resize(HUGE_CACHE_LIMIT,MAX_CACHE_OBJECTS);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
unsigned int ram = ramAvailable();
|
unsigned int ram = ramAvailable();
|
||||||
unsigned int myNewSize = ram - OPERATIONAL_SIZE + textureWCache.totalSize;
|
unsigned int myNewSize = ram - OPERATIONAL_SIZE + textureWCache.totalSize;
|
||||||
if (myNewSize < TEXTURES_CACHE_MINSIZE)
|
if (myNewSize < TEXTURES_CACHE_MINSIZE)
|
||||||
@@ -908,6 +902,14 @@ void ResourceManagerImpl::ResetCacheLimits()
|
|||||||
DebugTrace( "Error, Not enough RAM for Cache: " << myNewSize << " - total Ram: " << ram);
|
DebugTrace( "Error, Not enough RAM for Cache: " << myNewSize << " - total Ram: " << ram);
|
||||||
}
|
}
|
||||||
textureWCache.Resize(MIN(myNewSize, HUGE_CACHE_LIMIT), MAX_CACHE_OBJECTS);
|
textureWCache.Resize(MIN(myNewSize, HUGE_CACHE_LIMIT), MAX_CACHE_OBJECTS);
|
||||||
|
#else
|
||||||
|
#ifdef FORCE_LOW_CACHE_MEMORY
|
||||||
|
textureWCache.Resize(kConstrainedCacheLimit, MAX_CACHE_OBJECTS);
|
||||||
|
#else
|
||||||
|
unsigned long cacheSize = options["cachesize"].number ? (unsigned long)(options["cachesize"].number) * 1024 * 1024 : HUGE_CACHE_LIMIT;
|
||||||
|
textureWCache.Resize(cacheSize,MAX_CACHE_OBJECTS);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user