summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/wmresourcemng.cpp12
-rw-r--r--src/wmresourcemng.h5
2 files changed, 13 insertions, 4 deletions
diff --git a/src/wmresourcemng.cpp b/src/wmresourcemng.cpp
index 741abb2..9854fc2 100644
--- a/src/wmresourcemng.cpp
+++ b/src/wmresourcemng.cpp
@@ -112,7 +112,8 @@ void *dWMResourceMng_c::operator[](u32 key) {
void dWMResourceMng_c::prepareResources() {
// first off, initialise every brres file used
for (int i = 0; i < resCount(); i++) {
- if ((keyForIndex(i) >> 16) == '3D') {
+ //if ((keyForIndex(i) >> 16) == '3D') {
+ if (isResFile_byIndex(i)) {
nw4r::g3d::ResFile resFile(dataForIndex(i));
resFile.CheckRevision();
resFile.Init();
@@ -123,13 +124,16 @@ void dWMResourceMng_c::prepareResources() {
// them to every other file ... because I don't think it's a good idea to
// bind them before they've been initialised
for (int i = 0; i < resCount(); i++) {
- if ((keyForIndex(i) >> 16) == '3D') {
+ //if ((keyForIndex(i) >> 16) == '3D') {
+ if (isResFile_byIndex(i)) {
nw4r::g3d::ResFile firstFile(dataForIndex(i));
for (int j = 0; j < resCount(); j++) {
- nw4r::g3d::ResFile secondFile(dataForIndex(j));
+ if (isResFile_byIndex(j)) {
+ nw4r::g3d::ResFile secondFile(dataForIndex(j));
- firstFile.Bind(secondFile);
+ firstFile.Bind(secondFile);
+ }
}
}
}
diff --git a/src/wmresourcemng.h b/src/wmresourcemng.h
index 910acf1..4789856 100644
--- a/src/wmresourcemng.h
+++ b/src/wmresourcemng.h
@@ -51,6 +51,11 @@ public:
void *dataForIndex(u32 index) {
return resLoaders[index].buffer;
}
+
+ // TODO: refactor this, it's a bit strange atm
+ bool isResFile_byIndex(u32 index) {
+ return (memcmp(dataForIndex(index), "bres", 4) == 0);
+ }
};
#endif