mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-11 11:45:21 +00:00
SCUMM: Move class ResourceManager to its own header
This commit is contained in:
parent
7773a17b0a
commit
b37463fe59
@ -27,6 +27,7 @@
|
||||
#include "scumm/imuse/imuse.h"
|
||||
#include "scumm/imuse_digi/dimuse.h"
|
||||
#include "scumm/he/intern_he.h"
|
||||
#include "scumm/resource.h"
|
||||
#include "scumm/scumm_v7.h"
|
||||
#include "scumm/sound.h"
|
||||
#include "scumm/util.h"
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "scumm/scumm.h"
|
||||
#include "scumm/actor.h"
|
||||
#include "scumm/boxes.h"
|
||||
#include "scumm/resource.h"
|
||||
#include "scumm/scumm_v0.h"
|
||||
#include "scumm/scumm_v6.h"
|
||||
#include "scumm/util.h"
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "scumm/debugger.h"
|
||||
#include "scumm/imuse/imuse.h"
|
||||
#include "scumm/object.h"
|
||||
#include "scumm/resource.h"
|
||||
#include "scumm/scumm.h"
|
||||
#include "scumm/sound.h"
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "scumm/scumm_v8.h"
|
||||
#include "scumm/file.h"
|
||||
#include "scumm/file_nes.h"
|
||||
#include "scumm/resource.h"
|
||||
|
||||
#include "engines/metaengine.h"
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "scumm/actor.h"
|
||||
#include "scumm/file.h"
|
||||
#include "scumm/imuse/imuse.h"
|
||||
#include "scumm/resource.h"
|
||||
#include "scumm/scumm.h"
|
||||
#include "scumm/he/sound_he.h"
|
||||
#include "scumm/he/intern_he.h"
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "audio/decoders/vorbis.h"
|
||||
#include "audio/decoders/mp3.h"
|
||||
|
||||
#include "scumm/resource.h"
|
||||
#include "scumm/scumm.h"
|
||||
#include "scumm/util.h"
|
||||
#include "scumm/imuse_digi/dimuse.h"
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "scumm/he/intern_he.h"
|
||||
#include "scumm/he/logic_he.h"
|
||||
#endif
|
||||
#include "scumm/resource.h"
|
||||
#include "scumm/scumm_v0.h"
|
||||
#include "scumm/scumm_v6.h"
|
||||
#include "scumm/scumm_v8.h"
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include "scumm/actor.h"
|
||||
#include "scumm/file.h"
|
||||
#include "scumm/resource.h"
|
||||
#include "scumm/scumm_v7.h"
|
||||
#include "scumm/sound.h"
|
||||
|
||||
|
@ -22,6 +22,8 @@
|
||||
#ifndef SCUMM_RESOURCE_H
|
||||
#define SCUMM_RESOURCE_H
|
||||
|
||||
#include "scumm/scumm.h" // for rtNumTypes
|
||||
|
||||
namespace Scumm {
|
||||
|
||||
enum {
|
||||
@ -41,6 +43,74 @@ public:
|
||||
const byte *findNext(uint32 tag);
|
||||
};
|
||||
|
||||
enum {
|
||||
RES_INVALID_OFFSET = 0xFFFFFFFF
|
||||
};
|
||||
|
||||
class ScummEngine;
|
||||
|
||||
/**
|
||||
* The 'resource manager' class. Currently doesn't really deserve to be called
|
||||
* a 'class', at least until somebody gets around to OOfying this more.
|
||||
*/
|
||||
class ResourceManager {
|
||||
//friend class ScummDebugger;
|
||||
//friend class ScummEngine;
|
||||
protected:
|
||||
ScummEngine *_vm;
|
||||
|
||||
public:
|
||||
byte mode[rtNumTypes];
|
||||
uint16 num[rtNumTypes];
|
||||
uint32 tags[rtNumTypes];
|
||||
const char *name[rtNumTypes];
|
||||
byte **address[rtNumTypes];
|
||||
protected:
|
||||
byte *flags[rtNumTypes];
|
||||
byte *status[rtNumTypes];
|
||||
public:
|
||||
byte *roomno[rtNumTypes];
|
||||
uint32 *roomoffs[rtNumTypes];
|
||||
uint32 *globsize[rtNumTypes];
|
||||
|
||||
protected:
|
||||
uint32 _allocatedSize;
|
||||
uint32 _maxHeapThreshold, _minHeapThreshold;
|
||||
byte _expireCounter;
|
||||
|
||||
public:
|
||||
ResourceManager(ScummEngine *vm);
|
||||
~ResourceManager();
|
||||
|
||||
void setHeapThreshold(int min, int max);
|
||||
|
||||
void allocResTypeData(int id, uint32 tag, int num, const char *name, int mode);
|
||||
void freeResources();
|
||||
|
||||
byte *createResource(int type, int index, uint32 size);
|
||||
void nukeResource(int type, int i);
|
||||
|
||||
bool isResourceLoaded(int type, int index) const;
|
||||
|
||||
void lock(int type, int i);
|
||||
void unlock(int type, int i);
|
||||
bool isLocked(int type, int i) const;
|
||||
|
||||
void setModified(int type, int i);
|
||||
bool isModified(int type, int i) const;
|
||||
|
||||
void increaseExpireCounter();
|
||||
void setResourceCounter(int type, int index, byte flag);
|
||||
void increaseResourceCounter();
|
||||
|
||||
void resourceStats();
|
||||
|
||||
//protected:
|
||||
bool validateResource(const char *str, int type, int index) const;
|
||||
protected:
|
||||
void expireResources(uint32 size);
|
||||
};
|
||||
|
||||
} // End of namespace Scumm
|
||||
|
||||
#endif
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "scumm/scumm_v3.h"
|
||||
#include "scumm/file.h"
|
||||
#include "scumm/resource.h"
|
||||
#include "scumm/util.h"
|
||||
|
||||
namespace Scumm {
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "scumm/actor.h"
|
||||
#include "scumm/charset.h"
|
||||
#include "scumm/object.h"
|
||||
#include "scumm/resource.h"
|
||||
#include "scumm/scumm_v0.h"
|
||||
#include "scumm/verbs.h"
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "scumm/actor.h"
|
||||
#include "scumm/charset.h"
|
||||
#include "scumm/object.h"
|
||||
#include "scumm/resource.h"
|
||||
#include "scumm/scumm_v2.h"
|
||||
#include "scumm/sound.h"
|
||||
#include "scumm/util.h"
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "scumm/actor.h"
|
||||
#include "scumm/charset.h"
|
||||
#include "scumm/object.h"
|
||||
#include "scumm/resource.h"
|
||||
#include "scumm/scumm_v3.h"
|
||||
#include "scumm/scumm_v5.h"
|
||||
#include "scumm/sound.h"
|
||||
|
@ -62,6 +62,7 @@
|
||||
#include "scumm/player_v2a.h"
|
||||
#include "scumm/player_v3a.h"
|
||||
#include "scumm/player_v4a.h"
|
||||
#include "scumm/resource.h"
|
||||
#include "scumm/he/resource_he.h"
|
||||
#include "scumm/scumm_v0.h"
|
||||
#include "scumm/scumm_v8.h"
|
||||
|
@ -346,71 +346,7 @@ enum ResTypes {
|
||||
rtNumTypes = 22
|
||||
};
|
||||
|
||||
enum {
|
||||
RES_INVALID_OFFSET = 0xFFFFFFFF
|
||||
};
|
||||
|
||||
/**
|
||||
* The 'resource manager' class. Currently doesn't really deserve to be called
|
||||
* a 'class', at least until somebody gets around to OOfying this more.
|
||||
*/
|
||||
class ResourceManager {
|
||||
//friend class ScummDebugger;
|
||||
//friend class ScummEngine;
|
||||
protected:
|
||||
ScummEngine *_vm;
|
||||
|
||||
public:
|
||||
byte mode[rtNumTypes];
|
||||
uint16 num[rtNumTypes];
|
||||
uint32 tags[rtNumTypes];
|
||||
const char *name[rtNumTypes];
|
||||
byte **address[rtNumTypes];
|
||||
protected:
|
||||
byte *flags[rtNumTypes];
|
||||
byte *status[rtNumTypes];
|
||||
public:
|
||||
byte *roomno[rtNumTypes];
|
||||
uint32 *roomoffs[rtNumTypes];
|
||||
uint32 *globsize[rtNumTypes];
|
||||
|
||||
protected:
|
||||
uint32 _allocatedSize;
|
||||
uint32 _maxHeapThreshold, _minHeapThreshold;
|
||||
byte _expireCounter;
|
||||
|
||||
public:
|
||||
ResourceManager(ScummEngine *vm);
|
||||
~ResourceManager();
|
||||
|
||||
void setHeapThreshold(int min, int max);
|
||||
|
||||
void allocResTypeData(int id, uint32 tag, int num, const char *name, int mode);
|
||||
void freeResources();
|
||||
|
||||
byte *createResource(int type, int index, uint32 size);
|
||||
void nukeResource(int type, int i);
|
||||
|
||||
bool isResourceLoaded(int type, int index) const;
|
||||
|
||||
void lock(int type, int i);
|
||||
void unlock(int type, int i);
|
||||
bool isLocked(int type, int i) const;
|
||||
|
||||
void setModified(int type, int i);
|
||||
bool isModified(int type, int i) const;
|
||||
|
||||
void increaseExpireCounter();
|
||||
void setResourceCounter(int type, int index, byte flag);
|
||||
void increaseResourceCounter();
|
||||
|
||||
void resourceStats();
|
||||
|
||||
//protected:
|
||||
bool validateResource(const char *str, int type, int index) const;
|
||||
protected:
|
||||
void expireResources(uint32 size);
|
||||
};
|
||||
class ResourceManager;
|
||||
|
||||
/**
|
||||
* Base class for all SCUMM engines.
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "scumm/imuse/imuse.h"
|
||||
#include "scumm/imuse_digi/dimuse.h"
|
||||
#include "scumm/player_towns.h"
|
||||
#include "scumm/resource.h"
|
||||
#include "scumm/scumm.h"
|
||||
#include "scumm/sound.h"
|
||||
#include "scumm/util.h"
|
||||
|
@ -32,6 +32,7 @@
|
||||
#ifdef ENABLE_HE
|
||||
#include "scumm/he/intern_he.h"
|
||||
#endif
|
||||
#include "scumm/resource.h"
|
||||
#include "scumm/scumm.h"
|
||||
#include "scumm/scumm_v6.h"
|
||||
#include "scumm/scumm_v8.h"
|
||||
|
Loading…
Reference in New Issue
Block a user