Fixed compilation times by refactoring: WResourceManager.h gets included either directly or indirectly into every header & cpp file; so does its includes & implementation details. Broke out WResourceManager into a pure virtual class that contains only the required calls, and added a WResourceManagerImpl header that contains all the dirty details that the rest of the app doesn't care about / need to know.
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
class WResource
|
||||
{
|
||||
public:
|
||||
friend class WResourceManager;
|
||||
friend class ResourceManagerImpl;
|
||||
friend struct WCacheSort;
|
||||
template<class cacheItem, class cacheActual> friend class WCache;
|
||||
|
||||
@@ -39,7 +39,7 @@ protected:
|
||||
class WCachedResource: public WResource
|
||||
{
|
||||
public:
|
||||
friend class WResourceManager;
|
||||
friend class ResourceManagerImpl;
|
||||
template<class cacheItem,class cacheActual> friend class WCache;
|
||||
|
||||
virtual ~WCachedResource();
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
class WCachedTexture: public WCachedResource
|
||||
{
|
||||
public:
|
||||
friend class WResourceManager;
|
||||
friend class ResourceManagerImpl;
|
||||
template<class cacheItem,class cacheActual> friend class WCache;
|
||||
|
||||
WCachedTexture();
|
||||
@@ -82,7 +82,7 @@ protected:
|
||||
class WCachedParticles: public WCachedResource
|
||||
{
|
||||
public:
|
||||
friend class WResourceManager;
|
||||
friend class ResourceManagerImpl;
|
||||
template<class cacheItem,class cacheActual> friend class WCache;
|
||||
WCachedParticles();
|
||||
~WCachedParticles();
|
||||
@@ -104,7 +104,7 @@ protected:
|
||||
class WCachedSample: public WCachedResource
|
||||
{
|
||||
public:
|
||||
friend class WResourceManager;
|
||||
friend class ResourceManagerImpl;
|
||||
template<class cacheItem,class cacheActual> friend class WCache;
|
||||
|
||||
WCachedSample();
|
||||
|
||||
@@ -1,41 +1,9 @@
|
||||
#ifndef _WRESOURCEMANAGER_H_
|
||||
#define _WRESOURCEMANAGER_H_
|
||||
#ifndef _WResourceManager_H_
|
||||
#define _WResourceManager_H_
|
||||
|
||||
#include "WResource_Fwd.h"
|
||||
#include <JResourceManager.h>
|
||||
#include <JSoundSystem.h>
|
||||
#include <JTypes.h>
|
||||
#include "MTGDeck.h"
|
||||
#include "MTGCard.h"
|
||||
#include "utils.h"
|
||||
#include "WCachedResource.h"
|
||||
#include "WFont.h"
|
||||
#include "JLogger.h"
|
||||
#include <sstream>
|
||||
|
||||
#include "Threading.h"
|
||||
|
||||
#define HUGE_CACHE_LIMIT 20000000 // Size of the cache for Windows and Linux
|
||||
#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 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 OPERATIONAL_SIZE 5000000 // Size required by Wagic for operational stuff. 3MB is not enough. The cache will usually try to take (Total Ram - Operational size)
|
||||
#define MIN_LINEAR_RAM 1500000
|
||||
#ifdef DEBUG_CACHE
|
||||
#define MAX_CACHE_TIME 2000 //The threshold above which we try to prevent nowTime() from looping.
|
||||
#else
|
||||
#define MAX_CACHE_TIME 2000000000
|
||||
#endif
|
||||
|
||||
|
||||
#define THUMBNAILS_OFFSET 100000000
|
||||
#define OTHERS_OFFSET 2000000000
|
||||
|
||||
//Hard Limits.
|
||||
#define MAX_CACHE_OBJECTS 300
|
||||
#define MAX_CACHE_ATTEMPTS 10
|
||||
#define MAX_CACHE_MISSES 200
|
||||
#define MAX_CACHED_SAMPLES 50
|
||||
#define MAX_CACHE_GARBAGE 10
|
||||
|
||||
|
||||
enum ENUM_WRES_INFO
|
||||
{
|
||||
@@ -83,226 +51,75 @@ enum ENUM_CACHE_ERROR
|
||||
CACHE_ERROR_NOT_MANAGED,
|
||||
};
|
||||
|
||||
struct WCacheSort
|
||||
{
|
||||
bool operator()(const WResource * l, const WResource * r); //Predicate for use in sorting. See flatten().
|
||||
};
|
||||
|
||||
template <class cacheItem, class cacheActual>
|
||||
class WCache
|
||||
{
|
||||
public:
|
||||
friend class WResourceManager;
|
||||
friend class ThreadedCardRetriever;
|
||||
friend class UnthreadedCardRetriever;
|
||||
|
||||
WCache();
|
||||
~WCache();
|
||||
|
||||
cacheItem* Retrieve(int id, const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL); //Primary interface function.
|
||||
bool Release(cacheActual* actual); //Releases an item, and deletes it if unlocked.
|
||||
bool RemoveMiss(int id=0); //Removes a cache miss.
|
||||
bool RemoveOldest(); //Remove oldest unlocked item.
|
||||
bool Cleanup(); //Repeats RemoveOldest() until cache fits in size limits
|
||||
void ClearUnlocked(); //Remove all unlocked items.
|
||||
void Refresh(); //Refreshes all cache items.
|
||||
unsigned int Flatten(); //Ensures that the times don't loop. Returns new lastTime.
|
||||
void Resize(unsigned long size, int items); //Sets new limits, then enforces them. Lock safe, so not a "hard limit".
|
||||
|
||||
protected:
|
||||
|
||||
cacheItem* LoadIntoCache(int id, const string& filename, int submode, int style = RETRIEVE_NORMAL);
|
||||
|
||||
/*
|
||||
** Attempts a new cache item, progressively clearing cache if it fails.
|
||||
*/
|
||||
cacheItem* AttemptNew(const string& filename, int submode);
|
||||
|
||||
bool RemoveItem(cacheItem* item, bool force = true); //Removes an item, deleting it. if(force), ignores locks / permanent
|
||||
bool UnlinkCache(cacheItem* item); //Removes an item from our cache, does not delete it. Use with care.
|
||||
bool Delete(cacheItem* item); //SAFE_DELETE and garbage collect. If maxCached == 0, nullify first. (This means you have to free that cacheActual later!)
|
||||
cacheItem* Get(int id, const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL); //Subordinate to Retrieve.
|
||||
|
||||
int makeID(int id, const string& filename, int submode); //Makes an ID appropriate to the submode.
|
||||
|
||||
inline bool RequiresMissCleanup()
|
||||
{
|
||||
return (cacheItems < cache.size() /*&& cache.size() - cacheItems > MAX_CACHE_MISSES*/);
|
||||
}
|
||||
|
||||
inline bool RequiresOldItemCleanup()
|
||||
{
|
||||
if (cacheItems > MAX_CACHE_OBJECTS || cacheItems > maxCached || cacheSize > maxCacheSize)
|
||||
{
|
||||
std::ostringstream stream;
|
||||
if (cacheItems > MAX_CACHE_OBJECTS)
|
||||
{
|
||||
stream << "CacheItems exceeded 300, cacheItems = " << cacheItems;
|
||||
}
|
||||
else if (cacheItems > maxCached)
|
||||
{
|
||||
stream << "CacheItems (" << cacheItems << ") exceeded arbitrary limit of " << maxCached;
|
||||
}
|
||||
else
|
||||
{
|
||||
stream << "Cache size (" << cacheSize << ") exceeded max value of " << maxCacheSize;
|
||||
}
|
||||
|
||||
LOG(stream.str().c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
#if PSPENV
|
||||
if (ramAvailableLineareMax() < MIN_LINEAR_RAM)
|
||||
{
|
||||
DebugTrace("Memory below minimum threshold!!");
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
map<string,int> ids;
|
||||
map<int,cacheItem*> cache;
|
||||
map<int,cacheItem*> managed; //Cache can be arbitrarily large, so managed items are separate.
|
||||
unsigned long totalSize;
|
||||
unsigned long cacheSize;
|
||||
|
||||
//Applies to cacheSize only.
|
||||
unsigned long maxCacheSize;
|
||||
unsigned int maxCached;
|
||||
|
||||
unsigned int cacheItems;
|
||||
int mError;
|
||||
|
||||
// mutex meant for the cache map
|
||||
boost::mutex mCacheMutex;
|
||||
// mutex meant to protect against unthread-safe calls into JFileSystem, etc.
|
||||
boost::mutex mLoadFunctionMutex;
|
||||
};
|
||||
|
||||
struct WManagedQuad
|
||||
{
|
||||
WCachedTexture* texture;
|
||||
string resname;
|
||||
};
|
||||
struct WManagedQuad;
|
||||
class WFont;
|
||||
class MTGCard;
|
||||
struct hgeParticleSystemInfo;
|
||||
|
||||
class WResourceManager
|
||||
{
|
||||
public:
|
||||
static WResourceManager* Instance()
|
||||
{
|
||||
if (sInstance == NULL)
|
||||
{
|
||||
sInstance = NEW WResourceManager;
|
||||
}
|
||||
static WResourceManager* Instance();
|
||||
static void Terminate();
|
||||
|
||||
return sInstance;
|
||||
}
|
||||
virtual ~WResourceManager()
|
||||
{
|
||||
}
|
||||
|
||||
static void Terminate()
|
||||
{
|
||||
if (sInstance)
|
||||
SAFE_DELETE(sInstance);
|
||||
}
|
||||
virtual bool IsThreaded() = 0;
|
||||
|
||||
virtual ~WResourceManager();
|
||||
virtual JQuadPtr RetrieveCard(MTGCard * card, int style = RETRIEVE_NORMAL,int submode = CACHE_NORMAL) = 0;
|
||||
virtual JSample * RetrieveSample(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL) = 0;
|
||||
virtual JTexture * RetrieveTexture(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL) = 0;
|
||||
virtual JQuadPtr RetrieveQuad(const string& filename, float offX=0.0f, float offY=0.0f, float width=0.0f, float height=0.0f, string resname="", int style = RETRIEVE_LOCK, int submode = CACHE_NORMAL, int id = 0) = 0;
|
||||
virtual JQuadPtr RetrieveTempQuad(const string& filename, int submode = CACHE_NORMAL) = 0;
|
||||
virtual hgeParticleSystemInfo * RetrievePSI(const string& filename, JQuad * texture, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL) = 0;
|
||||
virtual int RetrieveError() = 0;
|
||||
|
||||
bool IsThreaded();
|
||||
virtual void Release(JTexture * tex) = 0;
|
||||
virtual void Release(JSample * sample) = 0;
|
||||
|
||||
void Unmiss(string filename);
|
||||
JQuadPtr RetrieveCard(MTGCard * card, int style = RETRIEVE_NORMAL,int submode = CACHE_NORMAL);
|
||||
JSample * RetrieveSample(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL);
|
||||
JTexture * RetrieveTexture(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL);
|
||||
JQuadPtr RetrieveQuad(const string& filename, float offX=0.0f, float offY=0.0f, float width=0.0f, float height=0.0f, string resname="", int style = RETRIEVE_LOCK, int submode = CACHE_NORMAL, int id = 0);
|
||||
JQuadPtr RetrieveTempQuad(const string& filename, int submode = CACHE_NORMAL);
|
||||
hgeParticleSystemInfo * RetrievePSI(const string& filename, JQuad * texture, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL);
|
||||
int RetrieveError();
|
||||
//Refreshes all files in cache, for when mode/profile changes.
|
||||
virtual void Refresh() = 0;
|
||||
|
||||
void Release(JTexture * tex);
|
||||
void Release(JSample * sample);
|
||||
bool RemoveOldest();
|
||||
virtual unsigned int nowTime() = 0;
|
||||
|
||||
void ClearUnlocked(); //Remove unlocked items.
|
||||
void Refresh(); //Refreshes all files in cache, for when mode/profile changes.
|
||||
|
||||
unsigned int nowTime();
|
||||
|
||||
unsigned long Size();
|
||||
unsigned long SizeCached();
|
||||
unsigned long SizeManaged();
|
||||
|
||||
unsigned int Count();
|
||||
unsigned int CountCached();
|
||||
unsigned int CountManaged();
|
||||
|
||||
int CreateQuad(const string &quadName, const string &textureName, float x, float y, float width, float height);
|
||||
JQuadPtr GetQuad(const string &quadName);
|
||||
JQuadPtr GetQuad(int id);
|
||||
|
||||
int AddQuadToManaged(const WManagedQuad& inManagedQuad);
|
||||
virtual JQuadPtr GetQuad(const string &quadName) = 0;
|
||||
|
||||
//Our file redirect system.
|
||||
string graphicsFile(const string& filename);
|
||||
string avatarFile(const string& filename);
|
||||
string cardFile(const string& filename);
|
||||
string musicFile(const string& filename);
|
||||
string sfxFile(const string& filename);
|
||||
int fileOK(const string&, bool relative = false);
|
||||
int dirOK(const string& dirname);
|
||||
virtual string graphicsFile(const string& filename) = 0;
|
||||
virtual string avatarFile(const string& filename) = 0;
|
||||
virtual string cardFile(const string& filename) = 0;
|
||||
virtual string musicFile(const string& filename) = 0;
|
||||
virtual string sfxFile(const string& filename) = 0;
|
||||
virtual int fileOK(const string&, bool relative = false) = 0;
|
||||
virtual int dirOK(const string& dirname) = 0;
|
||||
|
||||
//For backwards compatibility with JResourceManager. Avoid using these, they're not optimal.
|
||||
int CreateTexture(const string &textureName);
|
||||
JTexture* GetTexture(const string &textureName);
|
||||
JTexture* GetTexture(int id);
|
||||
//For backwards compatibility with JWResourceManager. Avoid using these, they're not optimal.
|
||||
virtual int CreateTexture(const string &textureName) = 0;
|
||||
virtual JTexture* GetTexture(const string &textureName) = 0;
|
||||
|
||||
// Font management functions
|
||||
void InitFonts(const std::string& inLang);
|
||||
int ReloadWFonts();
|
||||
WFont* LoadWFont(const string& inFontname, int inFontHeight, int inFontID);
|
||||
WFont* GetWFont(int id);
|
||||
void RemoveWFonts();
|
||||
virtual void InitFonts(const std::string& inLang) = 0;
|
||||
virtual int ReloadWFonts() = 0;
|
||||
virtual WFont* LoadWFont(const string& inFontname, int inFontHeight, int inFontID) = 0;
|
||||
virtual WFont* GetWFont(int id) = 0;
|
||||
|
||||
//Wrapped from JSoundSystem. TODO: Privatize.
|
||||
JMusic * ssLoadMusic(const char *fileName);
|
||||
virtual JMusic * ssLoadMusic(const char *fileName) = 0;
|
||||
|
||||
//Resets the cache limits on when it starts to purge data.
|
||||
void ResetCacheLimits();
|
||||
virtual void ResetCacheLimits() = 0;
|
||||
|
||||
void DebugRender();
|
||||
virtual void DebugRender() = 0;
|
||||
|
||||
#ifdef DEBUG_CACHE
|
||||
unsigned long menuCached;
|
||||
string debugMessage;
|
||||
#endif
|
||||
|
||||
private:
|
||||
protected:
|
||||
/*
|
||||
** Singleton object only accessibly via Instance(), constructor is private
|
||||
*/
|
||||
WResourceManager();
|
||||
|
||||
bool bThemedCards; //Does the theme have a "sets" directory for overwriting cards?
|
||||
void FlattenTimes(); //To prevent bad cache timing on int overflow
|
||||
|
||||
//For cached stuff
|
||||
WCache<WCachedTexture,JTexture> textureWCache;
|
||||
WCache<WCachedSample,JSample> sampleWCache;
|
||||
WCache<WCachedParticles,hgeParticleSystemInfo> psiWCache;
|
||||
|
||||
typedef std::map<std::string, WManagedQuad> ManagedQuadMap;
|
||||
ManagedQuadMap mManagedQuads;
|
||||
|
||||
typedef std::map<int, std::string> IDLookupMap;
|
||||
IDLookupMap mIDLookupMap;
|
||||
|
||||
//Statistics of record.
|
||||
unsigned int lastTime;
|
||||
int lastError;
|
||||
|
||||
typedef std::map<int, WFont*> FontMap;
|
||||
FontMap mWFontMap;
|
||||
std::string mFontFileExtension;
|
||||
WResourceManager()
|
||||
{
|
||||
}
|
||||
|
||||
static WResourceManager* sInstance;
|
||||
};
|
||||
|
||||
241
projects/mtg/include/WResourceManagerImpl.h
Normal file
241
projects/mtg/include/WResourceManagerImpl.h
Normal file
@@ -0,0 +1,241 @@
|
||||
#ifndef RESOURCEMANAGERIMPLIMPL_H
|
||||
#define RESOURCEMANAGERIMPLIMPL_H
|
||||
#include <JTypes.h>
|
||||
#include "MTGDeck.h"
|
||||
#include "MTGCard.h"
|
||||
#include "utils.h"
|
||||
#include "Threading.h"
|
||||
#include "WResourceManager.h"
|
||||
#include "WCachedResource.h"
|
||||
#include "WFont.h"
|
||||
#include "JLogger.h"
|
||||
#include <sstream>
|
||||
|
||||
#define HUGE_CACHE_LIMIT 20000000 // Size of the cache for Windows and Linux
|
||||
#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 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 OPERATIONAL_SIZE 5000000 // Size required by Wagic for operational stuff. 3MB is not enough. The cache will usually try to take (Total Ram - Operational size)
|
||||
#define MIN_LINEAR_RAM 1500000
|
||||
#ifdef DEBUG_CACHE
|
||||
#define MAX_CACHE_TIME 2000 //The threshold above which we try to prevent nowTime() from looping.
|
||||
#else
|
||||
#define MAX_CACHE_TIME 2000000000
|
||||
#endif
|
||||
|
||||
|
||||
#define THUMBNAILS_OFFSET 100000000
|
||||
#define OTHERS_OFFSET 2000000000
|
||||
|
||||
//Hard Limits.
|
||||
#define MAX_CACHE_OBJECTS 300
|
||||
#define MAX_CACHE_ATTEMPTS 10
|
||||
#define MAX_CACHE_MISSES 200
|
||||
#define MAX_CACHED_SAMPLES 50
|
||||
#define MAX_CACHE_GARBAGE 10
|
||||
|
||||
struct WCacheSort
|
||||
{
|
||||
bool operator()(const WResource * l, const WResource * r); //Predicate for use in sorting. See flatten().
|
||||
};
|
||||
|
||||
template <class cacheItem, class cacheActual>
|
||||
class WCache
|
||||
{
|
||||
public:
|
||||
friend class ResourceManagerImpl;
|
||||
friend class ThreadedCardRetriever;
|
||||
friend class UnthreadedCardRetriever;
|
||||
|
||||
WCache();
|
||||
~WCache();
|
||||
|
||||
cacheItem* Retrieve(int id, const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL); //Primary interface function.
|
||||
bool Release(cacheActual* actual); //Releases an item, and deletes it if unlocked.
|
||||
bool RemoveMiss(int id=0); //Removes a cache miss.
|
||||
bool RemoveOldest(); //Remove oldest unlocked item.
|
||||
bool Cleanup(); //Repeats RemoveOldest() until cache fits in size limits
|
||||
void ClearUnlocked(); //Remove all unlocked items.
|
||||
void Refresh(); //Refreshes all cache items.
|
||||
unsigned int Flatten(); //Ensures that the times don't loop. Returns new lastTime.
|
||||
void Resize(unsigned long size, int items); //Sets new limits, then enforces them. Lock safe, so not a "hard limit".
|
||||
|
||||
protected:
|
||||
|
||||
cacheItem* LoadIntoCache(int id, const string& filename, int submode, int style = RETRIEVE_NORMAL);
|
||||
|
||||
/*
|
||||
** Attempts a new cache item, progressively clearing cache if it fails.
|
||||
*/
|
||||
cacheItem* AttemptNew(const string& filename, int submode);
|
||||
|
||||
bool RemoveItem(cacheItem* item, bool force = true); //Removes an item, deleting it. if(force), ignores locks / permanent
|
||||
bool UnlinkCache(cacheItem* item); //Removes an item from our cache, does not delete it. Use with care.
|
||||
bool Delete(cacheItem* item); //SAFE_DELETE and garbage collect. If maxCached == 0, nullify first. (This means you have to free that cacheActual later!)
|
||||
cacheItem* Get(int id, const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL); //Subordinate to Retrieve.
|
||||
|
||||
int makeID(int id, const string& filename, int submode); //Makes an ID appropriate to the submode.
|
||||
|
||||
inline bool RequiresMissCleanup()
|
||||
{
|
||||
return (cacheItems < cache.size() /*&& cache.size() - cacheItems > MAX_CACHE_MISSES*/);
|
||||
}
|
||||
|
||||
inline bool RequiresOldItemCleanup()
|
||||
{
|
||||
if (cacheItems > MAX_CACHE_OBJECTS || cacheItems > maxCached || cacheSize > maxCacheSize)
|
||||
{
|
||||
std::ostringstream stream;
|
||||
if (cacheItems > MAX_CACHE_OBJECTS)
|
||||
{
|
||||
stream << "CacheItems exceeded 300, cacheItems = " << cacheItems;
|
||||
}
|
||||
else if (cacheItems > maxCached)
|
||||
{
|
||||
stream << "CacheItems (" << cacheItems << ") exceeded arbitrary limit of " << maxCached;
|
||||
}
|
||||
else
|
||||
{
|
||||
stream << "Cache size (" << cacheSize << ") exceeded max value of " << maxCacheSize;
|
||||
}
|
||||
|
||||
LOG(stream.str().c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
#if PSPENV
|
||||
if (ramAvailableLineareMax() < MIN_LINEAR_RAM)
|
||||
{
|
||||
DebugTrace("Memory below minimum threshold!!");
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
map<string,int> ids;
|
||||
map<int,cacheItem*> cache;
|
||||
map<int,cacheItem*> managed; //Cache can be arbitrarily large, so managed items are separate.
|
||||
unsigned long totalSize;
|
||||
unsigned long cacheSize;
|
||||
|
||||
//Applies to cacheSize only.
|
||||
unsigned long maxCacheSize;
|
||||
unsigned int maxCached;
|
||||
|
||||
unsigned int cacheItems;
|
||||
int mError;
|
||||
|
||||
// mutex meant for the cache map
|
||||
boost::mutex mCacheMutex;
|
||||
// mutex meant to protect against unthread-safe calls into JFileSystem, etc.
|
||||
boost::mutex mLoadFunctionMutex;
|
||||
};
|
||||
|
||||
struct WManagedQuad
|
||||
{
|
||||
WCachedTexture* texture;
|
||||
string resname;
|
||||
};
|
||||
|
||||
class ResourceManagerImpl : public WResourceManager
|
||||
{
|
||||
public:
|
||||
|
||||
ResourceManagerImpl();
|
||||
virtual ~ResourceManagerImpl();
|
||||
|
||||
bool IsThreaded();
|
||||
|
||||
void Unmiss(string filename);
|
||||
JQuadPtr RetrieveCard(MTGCard * card, int style = RETRIEVE_NORMAL,int submode = CACHE_NORMAL);
|
||||
JSample * RetrieveSample(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL);
|
||||
JTexture * RetrieveTexture(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL);
|
||||
JQuadPtr RetrieveQuad(const string& filename, float offX=0.0f, float offY=0.0f, float width=0.0f, float height=0.0f, string resname="", int style = RETRIEVE_LOCK, int submode = CACHE_NORMAL, int id = 0);
|
||||
JQuadPtr RetrieveTempQuad(const string& filename, int submode = CACHE_NORMAL);
|
||||
hgeParticleSystemInfo * RetrievePSI(const string& filename, JQuad * texture, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL);
|
||||
int RetrieveError();
|
||||
|
||||
void Release(JTexture * tex);
|
||||
void Release(JSample * sample);
|
||||
bool RemoveOldest();
|
||||
|
||||
void ClearUnlocked(); //Remove unlocked items.
|
||||
void Refresh(); //Refreshes all files in cache, for when mode/profile changes.
|
||||
|
||||
unsigned int nowTime();
|
||||
|
||||
unsigned long Size();
|
||||
unsigned long SizeCached();
|
||||
unsigned long SizeManaged();
|
||||
|
||||
unsigned int Count();
|
||||
unsigned int CountCached();
|
||||
unsigned int CountManaged();
|
||||
|
||||
int CreateQuad(const string &quadName, const string &textureName, float x, float y, float width, float height);
|
||||
JQuadPtr GetQuad(const string &quadName);
|
||||
JQuadPtr GetQuad(int id);
|
||||
|
||||
int AddQuadToManaged(const WManagedQuad& inManagedQuad);
|
||||
|
||||
//Our file redirect system.
|
||||
string graphicsFile(const string& filename);
|
||||
string avatarFile(const string& filename);
|
||||
string cardFile(const string& filename);
|
||||
string musicFile(const string& filename);
|
||||
string sfxFile(const string& filename);
|
||||
int fileOK(const string&, bool relative = false);
|
||||
int dirOK(const string& dirname);
|
||||
|
||||
//For backwards compatibility with JResourceManager. Avoid using these, they're not optimal.
|
||||
int CreateTexture(const string &textureName);
|
||||
JTexture* GetTexture(const string &textureName);
|
||||
JTexture* GetTexture(int id);
|
||||
|
||||
// Font management functions
|
||||
void InitFonts(const std::string& inLang);
|
||||
int ReloadWFonts();
|
||||
WFont* LoadWFont(const string& inFontname, int inFontHeight, int inFontID);
|
||||
WFont* GetWFont(int id);
|
||||
void RemoveWFonts();
|
||||
|
||||
//Wrapped from JSoundSystem. TODO: Privatize.
|
||||
JMusic * ssLoadMusic(const char *fileName);
|
||||
|
||||
//Resets the cache limits on when it starts to purge data.
|
||||
void ResetCacheLimits();
|
||||
|
||||
void DebugRender();
|
||||
|
||||
#ifdef DEBUG_CACHE
|
||||
unsigned long menuCached;
|
||||
string debugMessage;
|
||||
#endif
|
||||
|
||||
private:
|
||||
bool bThemedCards; //Does the theme have a "sets" directory for overwriting cards?
|
||||
void FlattenTimes(); //To prevent bad cache timing on int overflow
|
||||
|
||||
//For cached stuff
|
||||
WCache<WCachedTexture,JTexture> textureWCache;
|
||||
WCache<WCachedSample,JSample> sampleWCache;
|
||||
WCache<WCachedParticles,hgeParticleSystemInfo> psiWCache;
|
||||
|
||||
typedef std::map<std::string, WManagedQuad> ManagedQuadMap;
|
||||
ManagedQuadMap mManagedQuads;
|
||||
|
||||
typedef std::map<int, std::string> IDLookupMap;
|
||||
IDLookupMap mIDLookupMap;
|
||||
|
||||
//Statistics of record.
|
||||
unsigned int lastTime;
|
||||
int lastError;
|
||||
|
||||
typedef std::map<int, WFont*> FontMap;
|
||||
FontMap mWFontMap;
|
||||
std::string mFontFileExtension;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <JFileSystem.h>
|
||||
#include "GameOptions.h"
|
||||
#include "WResourceManager.h"
|
||||
#include "WCachedResource.h"
|
||||
#include <hge/hgeparticle.h>
|
||||
|
||||
#ifdef WITH_FMOD
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "WFont.h"
|
||||
#include "WResourceManager.h"
|
||||
#include "JFileSystem.h"
|
||||
#include "GameApp.h"
|
||||
|
||||
#define ISGBK(c) ((c) > 0x80 || (c) < 0x30 || (c) == '-' || (c) == '/')
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#include "PrecompiledHeader.h"
|
||||
|
||||
#include "GameOptions.h"
|
||||
#include "CacheEngine.h"
|
||||
#include "WResourceManager.h"
|
||||
#include "WResourceManagerImpl.h"
|
||||
#include "StyleManager.h"
|
||||
|
||||
#include "CacheEngine.h"
|
||||
|
||||
#if defined (WIN32)
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -29,12 +30,29 @@ namespace
|
||||
|
||||
WResourceManager* WResourceManager::sInstance = NULL;
|
||||
|
||||
int WResourceManager::RetrieveError()
|
||||
WResourceManager* WResourceManager::Instance()
|
||||
{
|
||||
if (sInstance == NULL)
|
||||
{
|
||||
sInstance = NEW ResourceManagerImpl;
|
||||
}
|
||||
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
void WResourceManager::Terminate()
|
||||
{
|
||||
if (sInstance)
|
||||
SAFE_DELETE(sInstance);
|
||||
}
|
||||
|
||||
|
||||
int ResourceManagerImpl::RetrieveError()
|
||||
{
|
||||
return lastError;
|
||||
}
|
||||
|
||||
bool WResourceManager::RemoveOldest()
|
||||
bool ResourceManagerImpl::RemoveOldest()
|
||||
{
|
||||
if (sampleWCache.RemoveOldest()) return true;
|
||||
if (textureWCache.RemoveOldest()) return true;
|
||||
@@ -43,11 +61,11 @@ bool WResourceManager::RemoveOldest()
|
||||
return false;
|
||||
}
|
||||
|
||||
//WResourceManager
|
||||
void WResourceManager::DebugRender()
|
||||
//ResourceManagerImpl
|
||||
void ResourceManagerImpl::DebugRender()
|
||||
{
|
||||
JRenderer* renderer = JRenderer::GetInstance();
|
||||
WFont * font = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
|
||||
WFont * font = ResourceManagerImpl::Instance()->GetWFont(Fonts::MAIN_FONT);
|
||||
if (!font || !renderer) return;
|
||||
|
||||
font->SetColor(ARGB(255,255,255,255));
|
||||
@@ -87,7 +105,7 @@ void WResourceManager::DebugRender()
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned long WResourceManager::Size()
|
||||
unsigned long ResourceManagerImpl::Size()
|
||||
{
|
||||
unsigned long res = 0;
|
||||
res += textureWCache.totalSize;
|
||||
@@ -96,7 +114,7 @@ unsigned long WResourceManager::Size()
|
||||
return res;
|
||||
}
|
||||
|
||||
unsigned long WResourceManager::SizeCached()
|
||||
unsigned long ResourceManagerImpl::SizeCached()
|
||||
{
|
||||
unsigned long res = 0;
|
||||
res += textureWCache.cacheSize;
|
||||
@@ -105,7 +123,7 @@ unsigned long WResourceManager::SizeCached()
|
||||
return res;
|
||||
}
|
||||
|
||||
unsigned long WResourceManager::SizeManaged()
|
||||
unsigned long ResourceManagerImpl::SizeManaged()
|
||||
{
|
||||
unsigned long res = 0;
|
||||
if (textureWCache.totalSize > textureWCache.cacheSize) res += textureWCache.totalSize - textureWCache.cacheSize;
|
||||
@@ -117,7 +135,7 @@ unsigned long WResourceManager::SizeManaged()
|
||||
return res;
|
||||
}
|
||||
|
||||
unsigned int WResourceManager::Count()
|
||||
unsigned int ResourceManagerImpl::Count()
|
||||
{
|
||||
unsigned int count = 0;
|
||||
count += textureWCache.cacheItems;
|
||||
@@ -129,7 +147,7 @@ unsigned int WResourceManager::Count()
|
||||
return count;
|
||||
}
|
||||
|
||||
unsigned int WResourceManager::CountCached()
|
||||
unsigned int ResourceManagerImpl::CountCached()
|
||||
{
|
||||
unsigned int count = 0;
|
||||
count += textureWCache.cacheItems;
|
||||
@@ -137,7 +155,7 @@ unsigned int WResourceManager::CountCached()
|
||||
count += psiWCache.cacheItems;
|
||||
return count;
|
||||
}
|
||||
unsigned int WResourceManager::CountManaged()
|
||||
unsigned int ResourceManagerImpl::CountManaged()
|
||||
{
|
||||
unsigned int count = 0;
|
||||
count += textureWCache.managed.size();
|
||||
@@ -146,14 +164,14 @@ unsigned int WResourceManager::CountManaged()
|
||||
return count;
|
||||
}
|
||||
|
||||
unsigned int WResourceManager::nowTime()
|
||||
unsigned int ResourceManagerImpl::nowTime()
|
||||
{
|
||||
if (lastTime > MAX_CACHE_TIME) FlattenTimes();
|
||||
|
||||
return ++lastTime;
|
||||
}
|
||||
|
||||
void WResourceManager::FlattenTimes()
|
||||
void ResourceManagerImpl::FlattenTimes()
|
||||
{
|
||||
unsigned int t;
|
||||
lastTime = sampleWCache.Flatten();
|
||||
@@ -165,9 +183,9 @@ void WResourceManager::FlattenTimes()
|
||||
if (t > lastTime) lastTime = t;
|
||||
}
|
||||
|
||||
WResourceManager::WResourceManager()
|
||||
ResourceManagerImpl::ResourceManagerImpl()
|
||||
{
|
||||
DebugTrace("Init WResourceManager : " << this);
|
||||
DebugTrace("Init ResourceManagerImpl : " << this);
|
||||
#ifdef DEBUG_CACHE
|
||||
menuCached = 0;
|
||||
#endif
|
||||
@@ -189,21 +207,21 @@ WResourceManager::WResourceManager()
|
||||
#endif
|
||||
}
|
||||
|
||||
WResourceManager::~WResourceManager()
|
||||
ResourceManagerImpl::~ResourceManagerImpl()
|
||||
{
|
||||
LOG("==Destroying WResourceManager==");
|
||||
LOG("==Destroying ResourceManagerImpl==");
|
||||
RemoveWFonts();
|
||||
|
||||
CacheEngine::Terminate();
|
||||
LOG("==Successfully Destroyed WResourceManager==");
|
||||
LOG("==Successfully Destroyed ResourceManagerImpl==");
|
||||
}
|
||||
|
||||
bool WResourceManager::IsThreaded()
|
||||
bool ResourceManagerImpl::IsThreaded()
|
||||
{
|
||||
return CacheEngine::IsThreaded();
|
||||
}
|
||||
|
||||
JQuadPtr WResourceManager::RetrieveCard(MTGCard * card, int style, int submode)
|
||||
JQuadPtr ResourceManagerImpl::RetrieveCard(MTGCard * card, int style, int submode)
|
||||
{
|
||||
//Cards are never, ever resource managed, so just check cache.
|
||||
if (!card || options[Options::DISABLECARDS].number) return JQuadPtr();
|
||||
@@ -232,7 +250,7 @@ JQuadPtr WResourceManager::RetrieveCard(MTGCard * card, int style, int submode)
|
||||
return JQuadPtr();
|
||||
}
|
||||
|
||||
int WResourceManager::AddQuadToManaged(const WManagedQuad& inQuad)
|
||||
int ResourceManagerImpl::AddQuadToManaged(const WManagedQuad& inQuad)
|
||||
{
|
||||
int id = mIDLookupMap.size();
|
||||
mIDLookupMap.insert(make_pair(id, inQuad.resname));
|
||||
@@ -241,7 +259,7 @@ int WResourceManager::AddQuadToManaged(const WManagedQuad& inQuad)
|
||||
return id;
|
||||
}
|
||||
|
||||
int WResourceManager::CreateQuad(const string &quadName, const string &textureName, float x, float y, float width, float height)
|
||||
int ResourceManagerImpl::CreateQuad(const string &quadName, const string &textureName, float x, float y, float width, float height)
|
||||
{
|
||||
if (!quadName.size() || !textureName.size()) return INVALID_ID;
|
||||
|
||||
@@ -276,7 +294,7 @@ int WResourceManager::CreateQuad(const string &quadName, const string &textureNa
|
||||
return id;
|
||||
}
|
||||
|
||||
JQuadPtr WResourceManager::GetQuad(const string &quadName)
|
||||
JQuadPtr ResourceManagerImpl::GetQuad(const string &quadName)
|
||||
{
|
||||
JQuadPtr result;
|
||||
ManagedQuadMap::const_iterator found = mManagedQuads.find(quadName);
|
||||
@@ -288,7 +306,7 @@ JQuadPtr WResourceManager::GetQuad(const string &quadName)
|
||||
return result;
|
||||
}
|
||||
|
||||
JQuadPtr WResourceManager::GetQuad(int id)
|
||||
JQuadPtr ResourceManagerImpl::GetQuad(int id)
|
||||
{
|
||||
JQuadPtr result;
|
||||
if (id < 0 || id >= (int) mManagedQuads.size()) return result;
|
||||
@@ -306,12 +324,12 @@ JQuadPtr WResourceManager::GetQuad(int id)
|
||||
return result;
|
||||
}
|
||||
|
||||
JQuadPtr WResourceManager::RetrieveTempQuad(const string& filename, int submode)
|
||||
JQuadPtr ResourceManagerImpl::RetrieveTempQuad(const string& filename, int submode)
|
||||
{
|
||||
return RetrieveQuad(filename, 0, 0, 0, 0, "temporary", RETRIEVE_NORMAL, submode);
|
||||
}
|
||||
|
||||
JQuadPtr WResourceManager::RetrieveQuad(const string& filename, float offX, float offY, float width, float height, string resname,
|
||||
JQuadPtr ResourceManagerImpl::RetrieveQuad(const string& filename, float offX, float offY, float width, float height, string resname,
|
||||
int style, int submode, int id)
|
||||
{
|
||||
//Lookup managed resources, but only with a real resname.
|
||||
@@ -368,7 +386,7 @@ JQuadPtr WResourceManager::RetrieveQuad(const string& filename, float offX, floa
|
||||
return JQuadPtr();
|
||||
}
|
||||
|
||||
void WResourceManager::Release(JTexture * tex)
|
||||
void ResourceManagerImpl::Release(JTexture * tex)
|
||||
{
|
||||
if (!tex) return;
|
||||
|
||||
@@ -393,28 +411,28 @@ void WResourceManager::Release(JTexture * tex)
|
||||
return; //Released!
|
||||
}
|
||||
|
||||
void WResourceManager::Unmiss(string filename)
|
||||
void ResourceManagerImpl::Unmiss(string filename)
|
||||
{
|
||||
map<int, WCachedTexture*>::iterator it;
|
||||
int id = textureWCache.makeID(0, filename, CACHE_NORMAL);
|
||||
textureWCache.RemoveMiss(id);
|
||||
}
|
||||
|
||||
void WResourceManager::ClearUnlocked()
|
||||
void ResourceManagerImpl::ClearUnlocked()
|
||||
{
|
||||
textureWCache.ClearUnlocked();
|
||||
sampleWCache.ClearUnlocked();
|
||||
psiWCache.ClearUnlocked();
|
||||
}
|
||||
|
||||
void WResourceManager::Release(JSample * sample)
|
||||
void ResourceManagerImpl::Release(JSample * sample)
|
||||
{
|
||||
if (!sample) return;
|
||||
|
||||
sampleWCache.Release(sample);
|
||||
}
|
||||
|
||||
JTexture * WResourceManager::RetrieveTexture(const string& filename, int style, int submode)
|
||||
JTexture * ResourceManagerImpl::RetrieveTexture(const string& filename, int style, int submode)
|
||||
{
|
||||
//Aliases.
|
||||
if (style == RETRIEVE_THUMB)
|
||||
@@ -464,7 +482,7 @@ JTexture * WResourceManager::RetrieveTexture(const string& filename, int style,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int WResourceManager::CreateTexture(const string &textureName)
|
||||
int ResourceManagerImpl::CreateTexture(const string &textureName)
|
||||
{
|
||||
JTexture * jtex = RetrieveTexture(textureName, RETRIEVE_MANAGE);
|
||||
|
||||
@@ -473,13 +491,13 @@ int WResourceManager::CreateTexture(const string &textureName)
|
||||
return INVALID_ID;
|
||||
}
|
||||
|
||||
JTexture* WResourceManager::GetTexture(const string &textureName)
|
||||
JTexture* ResourceManagerImpl::GetTexture(const string &textureName)
|
||||
{
|
||||
JTexture * jtex = RetrieveTexture(textureName, RETRIEVE_RESOURCE);
|
||||
return jtex;
|
||||
}
|
||||
|
||||
JTexture* WResourceManager::GetTexture(int id)
|
||||
JTexture* ResourceManagerImpl::GetTexture(int id)
|
||||
{
|
||||
map<int, WCachedTexture*>::iterator it;
|
||||
JTexture *jtex = NULL;
|
||||
@@ -498,7 +516,7 @@ JTexture* WResourceManager::GetTexture(int id)
|
||||
return jtex;
|
||||
}
|
||||
|
||||
hgeParticleSystemInfo * WResourceManager::RetrievePSI(const string& filename, JQuad * texture, int style, int submode)
|
||||
hgeParticleSystemInfo * ResourceManagerImpl::RetrievePSI(const string& filename, JQuad * texture, int style, int submode)
|
||||
{
|
||||
if (!texture) return NULL;
|
||||
|
||||
@@ -515,7 +533,7 @@ hgeParticleSystemInfo * WResourceManager::RetrievePSI(const string& filename, JQ
|
||||
return NULL;
|
||||
}
|
||||
|
||||
JSample * WResourceManager::RetrieveSample(const string& filename, int style, int submode)
|
||||
JSample * ResourceManagerImpl::RetrieveSample(const string& filename, int style, int submode)
|
||||
{
|
||||
WCachedSample * tc = NULL;
|
||||
tc = sampleWCache.Retrieve(0, filename, style, submode);
|
||||
@@ -531,7 +549,7 @@ JSample * WResourceManager::RetrieveSample(const string& filename, int style, in
|
||||
return NULL;
|
||||
}
|
||||
|
||||
string WResourceManager::graphicsFile(const string& filename)
|
||||
string ResourceManagerImpl::graphicsFile(const string& filename)
|
||||
{
|
||||
char buf[512];
|
||||
|
||||
@@ -582,7 +600,7 @@ string WResourceManager::graphicsFile(const string& filename)
|
||||
return graphdir;
|
||||
}
|
||||
|
||||
string WResourceManager::avatarFile(const string& filename)
|
||||
string ResourceManagerImpl::avatarFile(const string& filename)
|
||||
{
|
||||
char buf[512];
|
||||
|
||||
@@ -636,7 +654,7 @@ string WResourceManager::avatarFile(const string& filename)
|
||||
return "";
|
||||
}
|
||||
|
||||
string WResourceManager::cardFile(const string& filename)
|
||||
string ResourceManagerImpl::cardFile(const string& filename)
|
||||
{
|
||||
char buf[512];
|
||||
string::size_type i = 0;
|
||||
@@ -709,7 +727,7 @@ string WResourceManager::cardFile(const string& filename)
|
||||
return "";
|
||||
}
|
||||
|
||||
string WResourceManager::musicFile(const string& filename)
|
||||
string ResourceManagerImpl::musicFile(const string& filename)
|
||||
{
|
||||
char buf[512];
|
||||
|
||||
@@ -746,7 +764,7 @@ string WResourceManager::musicFile(const string& filename)
|
||||
return "";
|
||||
}
|
||||
|
||||
string WResourceManager::sfxFile(const string& filename)
|
||||
string ResourceManagerImpl::sfxFile(const string& filename)
|
||||
{
|
||||
char buf[512];
|
||||
|
||||
@@ -778,7 +796,7 @@ string WResourceManager::sfxFile(const string& filename)
|
||||
return "";
|
||||
}
|
||||
|
||||
int WResourceManager::dirOK(const string& dirname)
|
||||
int ResourceManagerImpl::dirOK(const string& dirname)
|
||||
{
|
||||
char fname[512];
|
||||
|
||||
@@ -796,7 +814,7 @@ int WResourceManager::dirOK(const string& dirname)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int WResourceManager::fileOK(const string& filename, bool relative)
|
||||
int ResourceManagerImpl::fileOK(const string& filename, bool relative)
|
||||
{
|
||||
wagic::ifstream * fp = NULL;
|
||||
if (relative)
|
||||
@@ -817,7 +835,7 @@ int WResourceManager::fileOK(const string& filename, bool relative)
|
||||
return result;
|
||||
}
|
||||
|
||||
void WResourceManager::InitFonts(const std::string& inLang)
|
||||
void ResourceManagerImpl::InitFonts(const std::string& inLang)
|
||||
{
|
||||
unsigned int idOffset = 0;
|
||||
|
||||
@@ -851,7 +869,7 @@ void WResourceManager::InitFonts(const std::string& inLang)
|
||||
LoadWFont("smallface", 7, Fonts::SMALLFACE_FONT + idOffset);
|
||||
}
|
||||
|
||||
int WResourceManager::ReloadWFonts()
|
||||
int ResourceManagerImpl::ReloadWFonts()
|
||||
{
|
||||
RemoveWFonts();
|
||||
|
||||
@@ -863,7 +881,7 @@ int WResourceManager::ReloadWFonts()
|
||||
return 1;
|
||||
}
|
||||
|
||||
WFont* WResourceManager::LoadWFont(const string& inFontname, int inFontHeight, int inFontID)
|
||||
WFont* ResourceManagerImpl::LoadWFont(const string& inFontname, int inFontHeight, int inFontID)
|
||||
{
|
||||
WFont* font = GetWFont(inFontID);
|
||||
if (font)
|
||||
@@ -885,7 +903,7 @@ WFont* WResourceManager::LoadWFont(const string& inFontname, int inFontHeight, i
|
||||
return font;
|
||||
}
|
||||
|
||||
WFont* WResourceManager::GetWFont(int id)
|
||||
WFont* ResourceManagerImpl::GetWFont(int id)
|
||||
{
|
||||
WFont* font = NULL;
|
||||
FontMap::iterator iter = mWFontMap.find(id);
|
||||
@@ -896,7 +914,7 @@ WFont* WResourceManager::GetWFont(int id)
|
||||
return font;
|
||||
}
|
||||
|
||||
void WResourceManager::RemoveWFonts()
|
||||
void ResourceManagerImpl::RemoveWFonts()
|
||||
{
|
||||
for (FontMap::iterator font = mWFontMap.begin(); font != mWFontMap.end(); ++font)
|
||||
{
|
||||
@@ -905,7 +923,7 @@ void WResourceManager::RemoveWFonts()
|
||||
mWFontMap.clear();
|
||||
}
|
||||
|
||||
void WResourceManager::ResetCacheLimits()
|
||||
void ResourceManagerImpl::ResetCacheLimits()
|
||||
{
|
||||
#if defined WIN32 || defined LINUX || defined (IOS)
|
||||
#ifdef FORCE_LOW_CACHE_MEMORY
|
||||
@@ -927,14 +945,14 @@ void WResourceManager::ResetCacheLimits()
|
||||
return;
|
||||
}
|
||||
|
||||
JMusic * WResourceManager::ssLoadMusic(const char *fileName)
|
||||
JMusic * ResourceManagerImpl::ssLoadMusic(const char *fileName)
|
||||
{
|
||||
string file = musicFile(fileName);
|
||||
if (!file.size()) return NULL;
|
||||
return JSoundSystem::GetInstance()->LoadMusic(file.c_str());
|
||||
}
|
||||
|
||||
void WResourceManager::Refresh()
|
||||
void ResourceManagerImpl::Refresh()
|
||||
{
|
||||
//Really easy cache relinking.
|
||||
ReloadWFonts();
|
||||
|
||||
@@ -982,6 +982,10 @@
|
||||
RelativePath=".\include\AllAbilities.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CacheEngine.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\CardDescriptor.h"
|
||||
>
|
||||
@@ -1374,6 +1378,10 @@
|
||||
RelativePath=".\include\WResourceManager.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\WResourceManagerImpl.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
|
||||
Reference in New Issue
Block a user