aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/winexe.cpp23
-rw-r--r--common/winexe.h2
2 files changed, 25 insertions, 0 deletions
diff --git a/common/winexe.cpp b/common/winexe.cpp
index fd1d565036..ad6ff96505 100644
--- a/common/winexe.cpp
+++ b/common/winexe.cpp
@@ -24,6 +24,8 @@
#include "common/memstream.h"
#include "common/str.h"
#include "common/winexe.h"
+#include "common/winexe_ne.h"
+#include "common/winexe_pe.h"
namespace Common {
@@ -160,4 +162,25 @@ bool WinResources::loadFromCompressedEXE(const String &fileName) {
return loadFromEXE(stream);
}
+
+WinResources *WinResources::createFromEXE(const String &fileName) {
+ WinResources *exe;
+
+ // First try loading via the NE code
+ exe = new Common::NEResources();
+ if (exe->loadFromEXE(fileName)) {
+ return exe;
+ }
+ delete exe;
+
+ // Then try loading via the PE code
+ exe = new Common::PEResources();
+ if (exe->loadFromEXE(fileName)) {
+ return exe;
+ }
+ delete exe;
+
+ return nullptr;
+}
+
} // End of namespace Common
diff --git a/common/winexe.h b/common/winexe.h
index cdbc0f6d13..2b81a33261 100644
--- a/common/winexe.h
+++ b/common/winexe.h
@@ -128,6 +128,8 @@ public:
virtual SeekableReadStream *getResource(const WinResourceID &type, const WinResourceID &id, const WinResourceID &lang) {
return getResource(type, id);
}
+
+ static WinResources *createFromEXE(const String &fileName);
};
} // End of namespace Common