Current News Archived News Search News Discussion Forum Old Forum Install Programs More Downloads... Troubleshooting Source Code Format Specs. Misc. Information Non-SF Stuff Links Small banner for links to this site: |
diff --git a/SFTypes.h b/SFTypes.h
--- a/SFTypes.h
+++ b/SFTypes.h
#ifndef SFTYPES_INCLUDED
#define SFTYPES_INCLUDED
+#if defined(_WIN32) || defined(_WIN64)
+
typedef signed char Int8;
typedef signed short Int16;
typedef signed long Int32;
typedef signed __int64 Int64;
+#ifdef _WIN64
+typedef signed __int64 IntPtr;
+#else
+typedef signed int IntPtr;
+#endif
+
typedef unsigned char UInt8;
typedef unsigned short UInt16;
typedef unsigned long UInt32;
typedef unsigned __int64 UInt64;
+#ifdef _WIN64
+typedef unsigned __int64 UIntPtr;
+#else
+typedef unsigned int UIntPtr;
+#endif
+
+#else
+
+#include <stdint.h>
+
+typedef int8_t Int8;
+typedef int16_t Int16;
+typedef int32_t Int32;
+typedef int64_t Int64;
+typedef intptr_t IntPtr;
+
+typedef uint8_t UInt8;
+typedef uint16_t UInt16;
+typedef uint32_t UInt32;
+typedef uint64_t UInt64;
+typedef uintptr_t UIntPtr;
+
+#endif
+
union IntConv {
Int8 i8[8];
UInt8 ui8[8];
diff --git a/SFmpqapi.cpp b/SFmpqapi.cpp
--- a/SFmpqapi.cpp
+++ b/SFmpqapi.cpp
case SFILE_INFO_PRIORITY:
return mpqOpenArc->dwPriority;
case SFILE_INFO_HASH_INDEX:
- return ((INT_PTR)mpqOpenFile->lpHashEntry-(INT_PTR)mpqOpenArc->lpHashTable)/sizeof(HASHTABLEENTRY);
+ return ((UIntPtr)mpqOpenFile->lpHashEntry-(UIntPtr)mpqOpenArc->lpHashTable)/sizeof(HASHTABLEENTRY);
case SFILE_INFO_BLOCK_INDEX:
return mpqOpenFile->lpHashEntry->dwBlockTableIndex;
default:
diff --git a/SFmpqapi.h b/SFmpqapi.h
--- a/SFmpqapi.h
+++ b/SFmpqapi.h
typedef HANDLE MPQHANDLE;
+#include <pshpack1.h>
+
struct FILELISTENTRY {
DWORD dwFileExists; // Nonzero if this entry is used
LCID lcLocale; // Locale ID of file
DWORD dwBlockTableSize; // Number of entries in block table
};
+#include <poppack.h>
+
//Archive handles may be typecasted to this struct so you can access
//some of the archive's properties and the decrypted hash table and
//block table directly. This struct is based on Storm's internal
LPSTR lpFileName;
};
+#include <pshpack1.h>
+
struct BLOCKTABLEENTRY {
DWORD dwFileOffset; // Offset to file
DWORD dwCompressedSize; // Compressed size of file
DWORD dwBlockTableIndex; // Index to the block table entry for the file
};
+#include <poppack.h>
+
// Defines for backward compatibility with old lmpqapi function names
#define MpqAddFileToArcive MpqAddFileToArchive
#define MpqOpenArchive SFileOpenArchive
|