diff options
Diffstat (limited to 'common/winexe.cpp')
| -rw-r--r-- | common/winexe.cpp | 23 | 
1 files changed, 23 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 | 
