38 #define MAKE_NWN_VERSION(MAJOR, MINOR, BUILD) ((((uint64)(MAJOR)) << 32) + \ 39 (((uint64)(MINOR)) << 16) + \ 43 '\0',
'F',
'\0',
'i',
'\0',
'l',
'\0',
'e',
'\0',
'V',
'\0',
'e',
'\0',
'r',
'\0',
's',
'\0',
'i',
'\0',
'o',
'\0',
'n',
'\0' 47 '\0',
'P',
'\0',
'r',
'\0',
'i',
'\0',
'v',
'\0',
'a',
'\0',
't',
'\0',
'e',
'\0',
'B',
'\0',
'u',
'\0',
'i',
'\0',
'l',
'\0',
'd',
'\0' 51 '\0',
'N',
'e',
'v',
'e',
'r',
'w',
'i',
'n',
't',
'e',
'r',
' ',
'N',
'i',
'g',
'h',
't',
's',
'\0' 59 _versionMajor(0), _versionMinor(0), _versionBuild(0), _version(0) {
133 bool success =
false;
157 if ((size - (version - binary.
get())) < (
sizeof(
kVersionWin) + 24))
162 if ((size - (build - binary.
get())) < (
sizeof(
kBuildWin) + 10))
165 bool success =
false;
197 isdigit(build [
sizeof(
kBuildWin ) + 2]) &&
198 isdigit(build [
sizeof(
kBuildWin ) + 4]) &&
199 isdigit(build [
sizeof(
kBuildWin ) + 6]) &&
200 isdigit(build [
sizeof(
kBuildWin ) + 8])) {
237 if ((version - binary.
get()) < 15)
240 bool success =
false;
243 if ((version[- 1] == 0) &&
244 (version[- 2] == 0) &&
245 (version[- 3] == 0) &&
246 (version[- 8] == 0) &&
247 (version[- 9] == 0) &&
248 (version[-10] == 0) &&
249 (version[-11] == 0) &&
250 (version[- 6] ==
'.')) {
253 if (isdigit(version[- 4]) &&
254 isdigit(version[- 5]) &&
255 isdigit(version[- 7]) &&
256 isdigit(version[-12]) &&
257 isdigit(version[-13]) &&
258 isdigit(version[-14]) &&
259 isdigit(version[-15])) {
294 bool success =
false;
345 if (!file.
open(path))
351 if (file.
read(buffer.
get(), size) != size)
bool detectWindows(const Common::UString &directory)
#define MAKE_NWN_VERSION(MAJOR, MINOR, BUILD)
static const uint16 kOptimumVersionMinor
uint16 getVersionBuild() const
Return the build number.
bool isTooNew() const
Is this version newer than the optimum?
uint64 getVersion() const
Return the combined version.
A class holding an UTF-8 string.
bool isTooOld() const
Is this version older than the optimum?
PointerType release()
Returns the plain pointer value and releases ScopedPtr.
A simple streaming file reading class.
Utility functions to handle files used in BioWare's Aurora engine.
uint16 getVersionMinor() const
Return the minor version.
Neverwinter Nights installation version detection.
bool detect(const Common::UString &directory)
Try to detect the version of the NWN installation in this directory.
uint16 _versionMajor
v1.69.8109 -> 1
static uint64 getOptimumVersion()
Return the optimum combined version.
A simple scoped smart pointer template.
UString findFirst(const UString &str, bool caseInsensitive) const
Find the first file ending with the given string.
static const uint16 kOptimumVersionMajor
uint16 _versionMinor
v1.69.8109 -> 69
static UString format(const char *s,...) GCC_PRINTF(1
Print formatted data into an UString object, similar to sprintf().
static const uint16 kOptimumVersionBuild
bool open(const UString &fileName)
Try to open the file with the given fileName.
byte * readFile(const Common::UString &directory, const Common::UString &file, size_t &size)
Common::UString getVersionString() const
Common::UString getPlatformName() const
static uint16 getOptimumVersionMajor()
Return the optimum major version.
static Common::UString getOptimumVersionString()
uint16 _versionBuild
v1.69.8109 -> 8109
Version(Aurora::Platform platform)
size_t read(void *dataPtr, size_t dataSize)
Read data from the stream.
bool empty() const
Is the string empty?
static uint16 getOptimumVersionMinor()
Return the optimum minor version.
static const byte kBuildWin[25]
static const byte kVersionWin[23]
Implementing the stream reading interfaces for files.
Aurora::Platform getPlatform() const
PointerType get() const
Returns the plain pointer value.
bool detectMacOSX(const Common::UString &directory)
uint64 _version
The combined version number.
size_t size() const
Obtains the total size of the stream, measured in bytes.
static const byte kVersionUnix[20]
static uint16 getOptimumVersionBuild()
Return the optimum build number.
bool addDirectory(const UString &directory, int recurseDepth=0)
Add a directory to the list.
Aurora::Platform _platform
Common::UString getPlatformDescription(Platform platform)
Return the human readable string of a Platform.
bool hasVersion() const
Did we detect a version?
uint16 getVersionMajor() const
Return the major version.
bool detectLinux(const Common::UString &directory)
Utility class for manipulating file paths.
static UString findSubDirectory(const UString &directory, const UString &subDirectory, bool caseInsensitive=false)
Find a directory's subdirectory.