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: |
23 files changed:
diff --git a/.gitignore b/.gitignore
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+*/*Debug/
+*/*Release/
+*.ncb
+*.suo
+*.user
diff --git a/drawgrp/drawgrp.cpp b/drawgrp/drawgrp.cpp
--- a/drawgrp/drawgrp.cpp
+++ b/drawgrp/drawgrp.cpp
// drawgrp.cpp : Defines the entry point for the console application.
//
+/* License information for this code is in license.txt */
#define _CRT_RAND_S
#include <stdlib.h>
diff --git a/drawgrp/drawgrp.vcproj b/drawgrp/drawgrp.vcproj
--- a/drawgrp/drawgrp.vcproj
+++ b/drawgrp/drawgrp.vcproj
Name="drawgrp"
ProjectGUID="{10729DB2-5CEA-41BA-9C6F-B47BE5A3C242}"
RootNamespace="drawgrp"
- SccProjectName=""$/grpapi_VS2005.root/grpapi", IGAAAAAA"
- SccLocalPath=".."
- SccProvider="MSSCCI:Microsoft Visual SourceSafe"
>
<Platforms>
<Platform
diff --git a/drawgrp/drawgrp.vcproj.vspscc b/drawgrp/drawgrp.vcproj.vspscc
+++ /dev/null
@@ -1,10 +0,0 @@
-""
-{
-"FILE_VERSION" = "9237"
-"ENLISTMENT_CHOICE" = "NEVER"
-"PROJECT_FILE_RELATIVE_PATH" = "relative:drawgrp"
-"NUMBER_OF_EXCLUDED_FILES" = "0"
-"ORIGINAL_PROJECT_FILE_PATH" = ""
-"NUMBER_OF_NESTED_PROJECTS" = "0"
-"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
-}
diff --git a/grpapi/GrpApi.bas b/grpapi/GrpApi.bas
--- a/grpapi/GrpApi.bas
+++ b/grpapi/GrpApi.bas
Attribute VB_Name = "GrpApi"
Option Explicit
-' ShadowFlare GRP Library. (c) ShadowFlare Software 2002-2006
+' ShadowFlare GRP Library. (c) ShadowFlare Software 2002-2008
+' License information for this code is in license.txt
' Any comments or suggestions are accepted at blakflare@hotmail.com (ShadowFlare)
'
' The functions must be in this form:
'
-' Function GetPixelProc (ByRef value As any_type, X As Long, Y As Long) As Long
-' Sub SetPixelProc (ByRef value As any_type, X As Long, Y As Long, clrColor As Long)
+' Function GetPixelProc (ByRef value As any_type, ByVal X As Long, ByVal Y As Long) As Long
+' Sub SetPixelProc (ByRef value As any_type, ByVal X As Long, ByVal Y As Long, ByVal clrColor As Long)
'
' or
'
-' Function GetPixelProc (ByVal value As any_type, X As Long, Y As Long) As Long
-' Sub SetPixelProc (ByVal value As any_type, X As Long, Y As Long, clrColor As Long)
+' Function GetPixelProc (ByVal value As any_type, ByVal X As Long, ByVal Y As Long) As Long
+' Sub SetPixelProc (ByVal value As any_type, ByVal X As Long, ByVal Y As Long, ByVal clrColor As Long)
'
-' Replace "any_type" with whatever type you want. This parameter gets the data from
-' DrawGrp's hdcDest parameter. You can either pass a number to DrawGrp and use the
-' "ByVal" versions of the above functions, or you can use AddressOf to get a reference
-' to a variable and use it for the "ByRef" versions.
+' Replace "any_type" with whatever type you want (but must be 4 bytes long if ByVal).
+' This parameter gets the data from DrawGrp's hdcDest parameter. You can either pass
+' a number to DrawGrp and use the "ByVal" versions of the above functions, or you can
+' use AddressOf to get a reference to a variable and use it for the "ByRef" versions.
' GetPixelProc should return an RGB color value.
Declare Sub SetFunctionGetPixel Lib "Grpapi.dll" (lpGetPixelProc As Long)
Declare Sub SetFunctionSetPixel Lib "Grpapi.dll" (lpSetPixelProc As Long)
diff --git a/grpapi/grp_static.h b/grpapi/grp_static.h
--- a/grpapi/grp_static.h
+++ b/grpapi/grp_static.h
ShadowFlare GRP Static Library. (c) ShadowFlare Software 2002
*/
+/* License information for this code is in license.txt */
#ifndef GRPLIB_INCLUDED
#define GRPLIB_INCLUDED
diff --git a/grpapi/grpapi.cpp b/grpapi/grpapi.cpp
--- a/grpapi/grpapi.cpp
+++ b/grpapi/grpapi.cpp
+/* License information for this code is in license.txt */
+
#include "grpapi.h"
#include "../LoadStorm/storm.h"
#include <malloc.h>
diff --git a/grpapi/grpapi.def b/grpapi/grpapi.def
--- a/grpapi/grpapi.def
+++ b/grpapi/grpapi.def
+; License information for this code is in license.txt
+
EXPORTS
LoadPalette @1
LoadGrp @2
diff --git a/grpapi/grpapi.h b/grpapi/grpapi.h
--- a/grpapi/grpapi.h
+++ b/grpapi/grpapi.h
/*
- ShadowFlare GRP Library. (c) ShadowFlare Software 2002-2006
+ ShadowFlare GRP Library. (c) ShadowFlare Software 2002-2008
+ License information for this code is in license.txt
Any comments or suggestions are accepted at blakflare@hotmail.com (ShadowFlare)
*/
diff --git a/grpapi/grpapi.rc b/grpapi/grpapi.rc
--- a/grpapi/grpapi.rc
+++ b/grpapi/grpapi.rc
+// License information for this code is in license.txt
+
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
diff --git a/grpapi/grpapi.sln b/grpapi/grpapi.sln
--- a/grpapi/grpapi.sln
+++ b/grpapi/grpapi.sln
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "drawgrp", "..\drawgrp\drawgrp.vcproj", "{10729DB2-5CEA-41BA-9C6F-B47BE5A3C242}"
+ ProjectSection(WebsiteProperties) = preProject
+ Debug.AspNetCompiler.Debug = "True"
+ Release.AspNetCompiler.Debug = "False"
+ EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpapi", "grpapi.vcproj", "{08812E9C-7F03-4DCB-8828-F3BDB0728EC7}"
+ ProjectSection(WebsiteProperties) = preProject
+ Debug.AspNetCompiler.Debug = "True"
+ Release.AspNetCompiler.Debug = "False"
+ EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grplib", "grplib.vcproj", "{66127C6F-39DA-4B7A-9856-789ED0139DCB}"
+ ProjectSection(WebsiteProperties) = preProject
+ Debug.AspNetCompiler.Debug = "True"
+ Release.AspNetCompiler.Debug = "False"
+ EndProjectSection
EndProject
Global
- GlobalSection(SourceCodeControl) = preSolution
- SccNumberOfProjects = 4
- SccProjectName0 = \u0022$/grpapi_VS2005.root/grpapi\u0022,\u0020IGAAAAAA
- SccLocalPath0 = ..
- SccProvider0 = MSSCCI:Microsoft\u0020Visual\u0020SourceSafe
- CanCheckoutShared = false
- SccProjectFilePathRelativizedFromConnection0 = grpapi\\
- SccProjectUniqueName1 = ..\\drawgrp\\drawgrp.vcproj
- SccLocalPath1 = ..
- CanCheckoutShared = false
- SccProjectFilePathRelativizedFromConnection1 = drawgrp\\
- SccProjectUniqueName2 = grpapi.vcproj
- SccLocalPath2 = ..
- CanCheckoutShared = false
- SccProjectFilePathRelativizedFromConnection2 = grpapi\\
- SccProjectUniqueName3 = grplib.vcproj
- SccLocalPath3 = ..
- CanCheckoutShared = false
- SccProjectFilePathRelativizedFromConnection3 = grpapi\\
- EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
diff --git a/grpapi/grpapi.vcproj b/grpapi/grpapi.vcproj
--- a/grpapi/grpapi.vcproj
+++ b/grpapi/grpapi.vcproj
Name="grpapi"
ProjectGUID="{08812E9C-7F03-4DCB-8828-F3BDB0728EC7}"
RootNamespace="grpapi"
- SccProjectName=""$/grpapi_VS2005.root/grpapi", IGAAAAAA"
- SccLocalPath=".."
- SccProvider="MSSCCI:Microsoft Visual SourceSafe"
>
<Platforms>
<Platform
diff --git a/grpapi/grpapi.vcproj.vspscc b/grpapi/grpapi.vcproj.vspscc
+++ /dev/null
@@ -1,10 +0,0 @@
-""
-{
-"FILE_VERSION" = "9237"
-"ENLISTMENT_CHOICE" = "NEVER"
-"PROJECT_FILE_RELATIVE_PATH" = "relative:grpapi"
-"NUMBER_OF_EXCLUDED_FILES" = "0"
-"ORIGINAL_PROJECT_FILE_PATH" = ""
-"NUMBER_OF_NESTED_PROJECTS" = "0"
-"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
-}
diff --git a/grpapi/grpapi.vsscc b/grpapi/grpapi.vsscc
deleted file mode 100644 (file)
index 85ef98b..0000000 Binary files a/grpapi/grpapi.vsscc and /dev/null differ diff --git a/grpapi/grpapi.vssscc b/grpapi/grpapi.vssscc
--- a/grpapi/grpapi.vssscc
+++ /dev/null
@@ -1,10 +0,0 @@
-""
-{
-"FILE_VERSION" = "9237"
-"ENLISTMENT_CHOICE" = "NEVER"
-"PROJECT_FILE_RELATIVE_PATH" = "relative:grpapi"
-"NUMBER_OF_EXCLUDED_FILES" = "0"
-"ORIGINAL_PROJECT_FILE_PATH" = ""
-"NUMBER_OF_NESTED_PROJECTS" = "0"
-"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
-}
--- a/grpapi/grpapi_no-lib.cpp
+++ b/grpapi/grpapi_no-lib.cpp
+/* License information for this code is in license.txt */
+
#include "grpapi_no-lib.h"
struct GRPAPIMODULE {
HINSTANCE hGrpApi = 0;
-funcLoadPalette LoadPalette = 0;
-funcLoadGrp LoadGrp = 0;
-funcDestroyGrp DestroyGrp = 0;
-funcDrawGrp DrawGrp = 0;
-funcGetGrpInfo GetGrpInfo = 0;
-funcGetGrpFrameInfo GetGrpFrameInfo = 0;
-funcCreateGrp CreateGrp = 0;
-funcSetFunctionGetPixel SetFunctionGetPixel = 0;
-funcSetFunctionSetPixel SetFunctionSetPixel = 0;
-funcSetMpqDll SetMpqDll = 0;
-funcLoadGrpApi LoadGrpApi = 0;
-funcFreeGrpApi FreeGrpApi = 0;
+BOOL (WINAPI* LoadPalette)(LPCSTR lpFileName, DWORD *dwPaletteBuffer) = 0;
+HANDLE (WINAPI* LoadGrp)(LPCSTR lpFileName) = 0;
+BOOL (WINAPI* DestroyGrp)(HANDLE hGrp) = 0;
+BOOL (WINAPI* DrawGrp)(HANDLE hGrp, HDC hdcDest, int nXDest, int nYDest, WORD nFrame, DWORD *dwPalette, DWORD dwFlags, DWORD dwAlpha) = 0;
+BOOL (WINAPI* GetGrpInfo)(HANDLE hGrp, GRPHEADER *GrpInfo) = 0;
+BOOL (WINAPI* GetGrpFrameInfo)(HANDLE hGrp, WORD nFrame, DWORD *nLeft, DWORD *nTop, DWORD *nWidth, DWORD *nHeight) = 0;
+HANDLE (WINAPI* CreateGrp)(signed short *lpImageData, WORD nFrames, WORD wMaxWidth, WORD wMaxHeight, BOOL bNoCompress, DWORD *nGrpSize) = 0;
+void (WINAPI* SetFunctionGetPixel)(GETPIXELPROC lpGetPixelProc) = 0;
+void (WINAPI* SetFunctionSetPixel)(SETPIXELPROC lpSetPixelProc) = 0;
+BOOL (WINAPI* SetMpqDll)(LPCSTR lpDllFileName) = 0;
+BOOL (WINAPI* LoadGrpApi)() = 0;
+void (WINAPI* FreeGrpApi)() = 0;
GRPAPIMODULE::GRPAPIMODULE()
{
hGrpApi = LoadLibrary("grpapi.dll");
if (hGrpApi!=0) {
- LoadPalette = (funcLoadPalette)GetProcAddress(hGrpApi,"LoadPalette");
- LoadGrp = (funcLoadGrp)GetProcAddress(hGrpApi,"LoadGrp");
- DestroyGrp = (funcDestroyGrp)GetProcAddress(hGrpApi,"DestroyGrp");
- DrawGrp = (funcDrawGrp)GetProcAddress(hGrpApi,"DrawGrp");
- GetGrpInfo = (funcGetGrpInfo)GetProcAddress(hGrpApi,"GetGrpInfo");
- GetGrpFrameInfo = (funcGetGrpFrameInfo)GetProcAddress(hGrpApi,"GetGrpFrameInfo");
- CreateGrp = (funcCreateGrp)GetProcAddress(hGrpApi,"CreateGrp");
- SetFunctionGetPixel = (funcSetFunctionGetPixel)GetProcAddress(hGrpApi,"SetFunctionGetPixel");
- SetFunctionSetPixel = (funcSetFunctionSetPixel)GetProcAddress(hGrpApi,"SetFunctionSetPixel");
- SetMpqDll = (funcSetMpqDll)GetProcAddress(hGrpApi,"SetMpqDll");
- LoadGrpApi = (funcLoadGrpApi)GetProcAddress(hGrpApi,"LoadGrpApi");
- FreeGrpApi = (funcFreeGrpApi)GetProcAddress(hGrpApi,"FreeGrpApi");
+ *(FARPROC *)&LoadPalette = GetProcAddress(hGrpApi,"LoadPalette");
+ *(FARPROC *)&LoadGrp = GetProcAddress(hGrpApi,"LoadGrp");
+ *(FARPROC *)&DestroyGrp = GetProcAddress(hGrpApi,"DestroyGrp");
+ *(FARPROC *)&DrawGrp = GetProcAddress(hGrpApi,"DrawGrp");
+ *(FARPROC *)&GetGrpInfo = GetProcAddress(hGrpApi,"GetGrpInfo");
+ *(FARPROC *)&GetGrpFrameInfo = GetProcAddress(hGrpApi,"GetGrpFrameInfo");
+ *(FARPROC *)&CreateGrp = GetProcAddress(hGrpApi,"CreateGrp");
+ *(FARPROC *)&SetFunctionGetPixel = GetProcAddress(hGrpApi,"SetFunctionGetPixel");
+ *(FARPROC *)&SetFunctionSetPixel = GetProcAddress(hGrpApi,"SetFunctionSetPixel");
+ *(FARPROC *)&SetMpqDll = GetProcAddress(hGrpApi,"SetMpqDll");
+ *(FARPROC *)&LoadGrpApi = GetProcAddress(hGrpApi,"LoadGrpApi");
+ *(FARPROC *)&FreeGrpApi = GetProcAddress(hGrpApi,"FreeGrpApi");
}
}
diff --git a/grpapi/grpapi_no-lib.h b/grpapi/grpapi_no-lib.h
--- a/grpapi/grpapi_no-lib.h
+++ b/grpapi/grpapi_no-lib.h
/*
- ShadowFlare GRP Library. (c) ShadowFlare Software 2002
+ ShadowFlare GRP Library. (c) ShadowFlare Software 2002-2008
+ License information for this code is in license.txt
Any comments or suggestions are accepted at blakflare@hotmail.com (ShadowFlare)
*/
// Palette is an array of 256 DWORD's
// For LoadPalette and LoadGrp, lpFileName may be a file in an open mpq archive
// or a file not in an archive
-typedef BOOL (WINAPI* funcLoadPalette)(LPCSTR lpFileName, DWORD *dwPaletteBuffer);
-typedef HANDLE (WINAPI* funcLoadGrp)(LPCSTR lpFileName);
-typedef BOOL (WINAPI* funcDestroyGrp)(HANDLE hGrp);
-typedef BOOL (WINAPI* funcDrawGrp)(HANDLE hGrp, HDC hdcDest, int nXDest, int nYDest, WORD nFrame, DWORD *dwPalette, DWORD dwFlags, DWORD dwAlpha);
-typedef BOOL (WINAPI* funcGetGrpInfo)(HANDLE hGrp, GRPHEADER *GrpInfo);
-typedef BOOL (WINAPI* funcGetGrpFrameInfo)(HANDLE hGrp, WORD nFrame, DWORD *nLeft, DWORD *nTop, DWORD *nWidth, DWORD *nHeight);
-extern funcLoadPalette LoadPalette;
-extern funcLoadGrp LoadGrp;
-extern funcDestroyGrp DestroyGrp;
-extern funcDrawGrp DrawGrp;
-extern funcGetGrpInfo GetGrpInfo;
-extern funcGetGrpFrameInfo GetGrpFrameInfo;
+extern BOOL (WINAPI* LoadPalette)(LPCSTR lpFileName, DWORD *dwPaletteBuffer);
+extern HANDLE (WINAPI* LoadGrp)(LPCSTR lpFileName);
+extern BOOL (WINAPI* DestroyGrp)(HANDLE hGrp);
+extern BOOL (WINAPI* DrawGrp)(HANDLE hGrp, HDC hdcDest, int nXDest, int nYDest, WORD nFrame, DWORD *dwPalette, DWORD dwFlags, DWORD dwAlpha);
+extern BOOL (WINAPI* GetGrpInfo)(HANDLE hGrp, GRPHEADER *GrpInfo);
+extern BOOL (WINAPI* GetGrpFrameInfo)(HANDLE hGrp, WORD nFrame, DWORD *nLeft, DWORD *nTop, DWORD *nWidth, DWORD *nHeight);
// A pointer to the raw image data to encode should be passed to lpImageData. The size of
// the buffer containing the data should be nFrames * wMaxWidth * wMaxHeight * sizeof(short)
// When your program is done with the returned buffer, it should call DestroyGrp on the
// buffer that was returned by this function to free up the memory from it.
// The pointer returned by this function can also be directly used by DrawGrp or GetGrpInfo.
-typedef HANDLE (WINAPI* funcCreateGrp)(signed short *lpImageData, WORD nFrames, WORD wMaxWidth, WORD wMaxHeight, BOOL bNoCompress, DWORD *nGrpSize);
-extern funcCreateGrp CreateGrp;
+extern HANDLE (WINAPI* CreateGrp)(signed short *lpImageData, WORD nFrames, WORD wMaxWidth, WORD wMaxHeight, BOOL bNoCompress, DWORD *nGrpSize);
typedef COLORREF (WINAPI* GETPIXELPROC)(
HDC hDC, // same value as hdcDest from DrawGrp,
// Call these to have DrawGrp use custom functions for reading and drawing pixels
// so that you can have it read from and write to a buffer, for example.
-typedef void (WINAPI* funcSetFunctionGetPixel)(GETPIXELPROC lpGetPixelProc);
-typedef void (WINAPI* funcSetFunctionSetPixel)(SETPIXELPROC lpSetPixelProc);
-extern funcSetFunctionGetPixel SetFunctionGetPixel; // Only used with ALPHA_BLEND
-extern funcSetFunctionSetPixel SetFunctionSetPixel;
+extern void (WINAPI* SetFunctionGetPixel)(GETPIXELPROC lpGetPixelProc); // Only used with ALPHA_BLEND
+extern void (WINAPI* SetFunctionSetPixel)(SETPIXELPROC lpSetPixelProc);
// Call this to make a different Storm.dll-compatible MPQ library be used (like SFMPQ).
-typedef BOOL (WINAPI* funcSetMpqDll)(LPCSTR lpDllFileName);
-extern funcSetMpqDll SetMpqDll;
+extern BOOL (WINAPI* SetMpqDll)(LPCSTR lpDllFileName);
// These no longer need to be called
-typedef BOOL (WINAPI* funcLoadGrpApi)();
-typedef void (WINAPI* funcFreeGrpApi)();
-extern funcLoadGrpApi LoadGrpApi;
-extern funcFreeGrpApi FreeGrpApi;
+extern BOOL (WINAPI* LoadGrpApi)();
+extern void (WINAPI* FreeGrpApi)();
#ifdef __cplusplus
}; // extern "C"
diff --git a/grpapi/grplib.vcproj b/grpapi/grplib.vcproj
--- a/grpapi/grplib.vcproj
+++ b/grpapi/grplib.vcproj
Version="8.00"
Name="grplib"
ProjectGUID="{66127C6F-39DA-4B7A-9856-789ED0139DCB}"
- SccProjectName=""$/grpapi_VS2005.root/grpapi", IGAAAAAA"
- SccLocalPath=".."
- SccProvider="MSSCCI:Microsoft Visual SourceSafe"
>
<Platforms>
<Platform
diff --git a/grpapi/grplib.vcproj.vspscc b/grpapi/grplib.vcproj.vspscc
+++ /dev/null
@@ -1,10 +0,0 @@
-""
-{
-"FILE_VERSION" = "9237"
-"ENLISTMENT_CHOICE" = "NEVER"
-"PROJECT_FILE_RELATIVE_PATH" = "relative:grpapi"
-"NUMBER_OF_EXCLUDED_FILES" = "0"
-"ORIGINAL_PROJECT_FILE_PATH" = ""
-"NUMBER_OF_NESTED_PROJECTS" = "0"
-"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
-}
diff --git a/grpapi/resource.h b/grpapi/resource.h
--- a/grpapi/resource.h
+++ b/grpapi/resource.h
+/* License information for this code is in license.txt */
+
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by grpapi.rc
diff --git a/license.txt b/license.txt
--- /dev/null
+++ b/license.txt
@@ -0,0 +1,24 @@
+Copyright (c) 2002-2008, ShadowFlare <blakflare@hotmail.com>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
\ No newline at end of file
diff --git a/loadstorm/Storm.cpp b/loadstorm/Storm.cpp
--- a/loadstorm/Storm.cpp
+++ b/loadstorm/Storm.cpp
/*
Storm.cpp
*/
+/* License information for this code is in license.txt */
#include "storm.h"
~STORMMODULE();
} Storm;
+void LoadStormFunctions();
void FreeStorm();
HINSTANCE hStorm = 0;
BOOL AlreadyLoaded = FALSE;
// Storm Function Names
-funcSFileCloseArchive SFileCloseArchive = 0;
-funcSFileCloseFile SFileCloseFile = 0;
-funcSFileDestroy SFileDestroy = 0;
-funcSFileGetFileArchive SFileGetFileArchive = 0;
-funcSFileGetFileSize SFileGetFileSize = 0;
-funcSFileOpenArchive SFileOpenArchive = 0;
-funcSFileOpenFile SFileOpenFile = 0;
-funcSFileOpenFileEx SFileOpenFileEx = 0;
-funcSFileReadFile SFileReadFile = 0;
-funcSFileSetBasePath SFileSetBasePath = 0;
-funcSFileSetFilePointer SFileSetFilePointer = 0;
-funcSFileSetLocale SFileSetLocale = 0;
-funcSFileGetBasePath SFileGetBasePath = 0;
-funcSFileGetArchiveName SFileGetArchiveName = 0;
-funcSFileGetFileName SFileGetFileName = 0;
+BOOL (WINAPI* SFileOpenArchive)(LPCSTR lpFilename, DWORD dwPriority, DWORD dwFlags, MPQHANDLE *hMPQ) = 0;
+BOOL (WINAPI* SFileCloseArchive)(MPQHANDLE hMPQ) = 0;
+BOOL (WINAPI* SFileOpenFile)(LPCSTR lpFileName, MPQHANDLE *hFile) = 0;
+BOOL (WINAPI* SFileOpenFileEx)(MPQHANDLE hMPQ, LPCSTR lpFileName, DWORD dwSearchScope, MPQHANDLE *hFile) = 0;
+BOOL (WINAPI* SFileCloseFile)(MPQHANDLE hFile) = 0;
+DWORD (WINAPI* SFileGetFileSize)(MPQHANDLE hFile, LPDWORD lpFileSizeHigh) = 0;
+DWORD (WINAPI* SFileSetFilePointer)(MPQHANDLE hFile, long lDistanceToMove, PLONG lplDistanceToMoveHigh, DWORD dwMoveMethod) = 0;
+BOOL (WINAPI* SFileReadFile)(MPQHANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped) = 0;
+LCID (WINAPI* SFileSetLocale)(LCID nNewLocale) = 0;
+BOOL (WINAPI* SFileDestroy)() = 0;
+BOOL (WINAPI* SFileGetArchiveName)(MPQHANDLE hMPQ, LPCSTR lpBuffer, DWORD dwBufferLength) = 0;
+BOOL (WINAPI* SFileGetFileName)(MPQHANDLE hFile, LPCSTR lpBuffer, DWORD dwBufferLength) = 0;
+BOOL (WINAPI* SFileGetFileArchive)(MPQHANDLE hFile, MPQHANDLE *hMPQ) = 0;
+BOOL (WINAPI* SFileGetBasePath)(LPCSTR lpBuffer, DWORD dwBufferLength) = 0;
+BOOL (WINAPI* SFileSetBasePath)(LPCSTR lpNewBasePath) = 0;
STORMMODULE::STORMMODULE()
{
if (hStorm == NULL) hStorm = LoadLibrary(STORM_DLL);
else AlreadyLoaded=TRUE;
- if (hStorm != NULL)
- {
- SFileCloseArchive = (funcSFileCloseArchive)GetProcAddress(hStorm, (LPCSTR)0xFC);
- SFileCloseFile = (funcSFileCloseFile)GetProcAddress(hStorm, (LPCSTR)0xFD);
- SFileDestroy = (funcSFileDestroy)GetProcAddress(hStorm, (LPCSTR)0x106);
- SFileGetFileArchive = (funcSFileGetFileArchive)GetProcAddress(hStorm, (LPCSTR)0x108);
- SFileGetFileSize = (funcSFileGetFileSize)GetProcAddress(hStorm, (LPCSTR)0x109);
- SFileOpenArchive = (funcSFileOpenArchive)GetProcAddress(hStorm, (LPCSTR)0x10A);
- SFileOpenFile = (funcSFileOpenFile)GetProcAddress(hStorm, (LPCSTR)0x10B);
- SFileOpenFileEx = (funcSFileOpenFileEx)GetProcAddress(hStorm, (LPCSTR)0x10C);
- SFileReadFile = (funcSFileReadFile)GetProcAddress(hStorm, (LPCSTR)0x10D);
- SFileSetBasePath = (funcSFileSetBasePath)GetProcAddress(hStorm, (LPCSTR)0x10E);
- SFileSetFilePointer = (funcSFileSetFilePointer)GetProcAddress(hStorm, (LPCSTR)0x10F);
- SFileSetLocale = (funcSFileSetLocale)GetProcAddress(hStorm, (LPCSTR)0x110);
- SFileGetBasePath = (funcSFileGetBasePath)GetProcAddress(hStorm, (LPCSTR)0x111);
- SFileGetArchiveName = (funcSFileGetArchiveName)GetProcAddress(hStorm, (LPCSTR)0x113);
- SFileGetFileName = (funcSFileGetFileName)GetProcAddress(hStorm, (LPCSTR)0x114);
- }
+ LoadStormFunctions();
if (SFileDestroy && !AlreadyLoaded) SFileDestroy();
}
if (hStorm == NULL) hStorm = LoadLibrary(DllFileName);
else AlreadyLoaded=TRUE;
- if (hStorm != NULL)
- {
- SFileCloseArchive = (funcSFileCloseArchive)GetProcAddress(hStorm, (LPCSTR)0xFC);
- SFileCloseFile = (funcSFileCloseFile)GetProcAddress(hStorm, (LPCSTR)0xFD);
- SFileDestroy = (funcSFileDestroy)GetProcAddress(hStorm, (LPCSTR)0x106);
- SFileGetFileArchive = (funcSFileGetFileArchive)GetProcAddress(hStorm, (LPCSTR)0x108);
- SFileGetFileSize = (funcSFileGetFileSize)GetProcAddress(hStorm, (LPCSTR)0x109);
- SFileOpenArchive = (funcSFileOpenArchive)GetProcAddress(hStorm, (LPCSTR)0x10A);
- SFileOpenFile = (funcSFileOpenFile)GetProcAddress(hStorm, (LPCSTR)0x10B);
- SFileOpenFileEx = (funcSFileOpenFileEx)GetProcAddress(hStorm, (LPCSTR)0x10C);
- SFileReadFile = (funcSFileReadFile)GetProcAddress(hStorm, (LPCSTR)0x10D);
- SFileSetBasePath = (funcSFileSetBasePath)GetProcAddress(hStorm, (LPCSTR)0x10E);
- SFileSetFilePointer = (funcSFileSetFilePointer)GetProcAddress(hStorm, (LPCSTR)0x10F);
- SFileSetLocale = (funcSFileSetLocale)GetProcAddress(hStorm, (LPCSTR)0x110);
- SFileGetBasePath = (funcSFileGetBasePath)GetProcAddress(hStorm, (LPCSTR)0x111);
- SFileGetArchiveName = (funcSFileGetArchiveName)GetProcAddress(hStorm, (LPCSTR)0x113);
- SFileGetFileName = (funcSFileGetFileName)GetProcAddress(hStorm, (LPCSTR)0x114);
- }
+ LoadStormFunctions();
if (SFileDestroy && !AlreadyLoaded) SFileDestroy();
if (AlreadyLoaded==TRUE) return 0;
return hStorm;
}
+void LoadStormFunctions()
+{
+ if (hStorm != NULL)
+ {
+ *(FARPROC *)&SFileCloseArchive = GetProcAddress(hStorm, (LPCSTR)0xFC);
+ *(FARPROC *)&SFileCloseFile = GetProcAddress(hStorm, (LPCSTR)0xFD);
+ *(FARPROC *)&SFileDestroy = GetProcAddress(hStorm, (LPCSTR)0x106);
+ *(FARPROC *)&SFileGetFileArchive = GetProcAddress(hStorm, (LPCSTR)0x108);
+ *(FARPROC *)&SFileGetFileSize = GetProcAddress(hStorm, (LPCSTR)0x109);
+ *(FARPROC *)&SFileOpenArchive = GetProcAddress(hStorm, (LPCSTR)0x10A);
+ *(FARPROC *)&SFileOpenFile = GetProcAddress(hStorm, (LPCSTR)0x10B);
+ *(FARPROC *)&SFileOpenFileEx = GetProcAddress(hStorm, (LPCSTR)0x10C);
+ *(FARPROC *)&SFileReadFile = GetProcAddress(hStorm, (LPCSTR)0x10D);
+ *(FARPROC *)&SFileSetBasePath = GetProcAddress(hStorm, (LPCSTR)0x10E);
+ *(FARPROC *)&SFileSetFilePointer = GetProcAddress(hStorm, (LPCSTR)0x10F);
+ *(FARPROC *)&SFileSetLocale = GetProcAddress(hStorm, (LPCSTR)0x110);
+ *(FARPROC *)&SFileGetBasePath = GetProcAddress(hStorm, (LPCSTR)0x111);
+ *(FARPROC *)&SFileGetArchiveName = GetProcAddress(hStorm, (LPCSTR)0x113);
+ *(FARPROC *)&SFileGetFileName = GetProcAddress(hStorm, (LPCSTR)0x114);
+ }
+}
+
void FreeStorm()
{
SFileCloseArchive = 0;
diff --git a/loadstorm/Storm.h b/loadstorm/Storm.h
--- a/loadstorm/Storm.h
+++ b/loadstorm/Storm.h
+/* License information for this code is in license.txt */
+
#ifndef STORM_H_INCLUDED
#define STORM_H_INCLUDED
#define MPQHANDLE HANDLE
// Storm Function Prototypes
-typedef BOOL (WINAPI* funcSFileOpenArchive)(LPCSTR lpFilename, DWORD dwPriority, DWORD dwFlags, MPQHANDLE *hMPQ);
-typedef BOOL (WINAPI* funcSFileCloseArchive)(MPQHANDLE hMPQ);
-typedef BOOL (WINAPI* funcSFileOpenFile)(LPCSTR lpFileName, MPQHANDLE *hFile);
-typedef BOOL (WINAPI* funcSFileOpenFileEx)(MPQHANDLE hMPQ, LPCSTR lpFileName, DWORD dwSearchScope, MPQHANDLE *hFile);
-typedef BOOL (WINAPI* funcSFileCloseFile)(MPQHANDLE hFile);
-typedef DWORD (WINAPI* funcSFileGetFileSize)(MPQHANDLE hFile, LPDWORD lpFileSizeHigh);
-typedef DWORD (WINAPI* funcSFileSetFilePointer)(MPQHANDLE hFile, long lDistanceToMove, PLONG lplDistanceToMoveHigh, DWORD dwMoveMethod);
-typedef BOOL (WINAPI* funcSFileReadFile)(MPQHANDLE hFile,LPVOID lpBuffer,DWORD nNumberOfBytesToRead,LPDWORD lpNumberOfBytesRead,LPOVERLAPPED lpOverlapped);
-typedef LCID (WINAPI* funcSFileSetLocale)(LCID nNewLocale);
-typedef BOOL (WINAPI* funcSFileDestroy)();
-typedef BOOL (WINAPI* funcSFileGetArchiveName)(MPQHANDLE hMPQ, LPCSTR lpBuffer, DWORD dwBufferLength);
-typedef BOOL (WINAPI* funcSFileGetFileName)(MPQHANDLE hFile, LPCSTR lpBuffer, DWORD dwBufferLength);
-typedef BOOL (WINAPI* funcSFileGetFileArchive)(MPQHANDLE hFile, MPQHANDLE *hMPQ);
-typedef BOOL (WINAPI* funcSFileGetBasePath)(LPCSTR lpBuffer, DWORD dwBufferLength);
-typedef BOOL (WINAPI* funcSFileSetBasePath)(LPCSTR lpNewBasePath);
-
-// Storm Function Names
-extern funcSFileCloseArchive SFileCloseArchive;
-extern funcSFileCloseFile SFileCloseFile;
-extern funcSFileDestroy SFileDestroy;
-extern funcSFileGetFileArchive SFileGetFileArchive;
-extern funcSFileGetFileSize SFileGetFileSize;
-extern funcSFileOpenArchive SFileOpenArchive;
-extern funcSFileOpenFile SFileOpenFile;
-extern funcSFileOpenFileEx SFileOpenFileEx;
-extern funcSFileReadFile SFileReadFile;
-extern funcSFileSetBasePath SFileSetBasePath;
-extern funcSFileSetFilePointer SFileSetFilePointer;
-extern funcSFileSetLocale SFileSetLocale;
-extern funcSFileGetBasePath SFileGetBasePath;
-extern funcSFileGetArchiveName SFileGetArchiveName;
-extern funcSFileGetFileName SFileGetFileName;
+extern BOOL (WINAPI* SFileOpenArchive)(LPCSTR lpFilename, DWORD dwPriority, DWORD dwFlags, MPQHANDLE *hMPQ);
+extern BOOL (WINAPI* SFileCloseArchive)(MPQHANDLE hMPQ);
+extern BOOL (WINAPI* SFileOpenFile)(LPCSTR lpFileName, MPQHANDLE *hFile);
+extern BOOL (WINAPI* SFileOpenFileEx)(MPQHANDLE hMPQ, LPCSTR lpFileName, DWORD dwSearchScope, MPQHANDLE *hFile);
+extern BOOL (WINAPI* SFileCloseFile)(MPQHANDLE hFile);
+extern DWORD (WINAPI* SFileGetFileSize)(MPQHANDLE hFile, LPDWORD lpFileSizeHigh);
+extern DWORD (WINAPI* SFileSetFilePointer)(MPQHANDLE hFile, long lDistanceToMove, PLONG lplDistanceToMoveHigh, DWORD dwMoveMethod);
+extern BOOL (WINAPI* SFileReadFile)(MPQHANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped);
+extern LCID (WINAPI* SFileSetLocale)(LCID nNewLocale);
+extern BOOL (WINAPI* SFileDestroy)();
+extern BOOL (WINAPI* SFileGetArchiveName)(MPQHANDLE hMPQ, LPCSTR lpBuffer, DWORD dwBufferLength);
+extern BOOL (WINAPI* SFileGetFileName)(MPQHANDLE hFile, LPCSTR lpBuffer, DWORD dwBufferLength);
+extern BOOL (WINAPI* SFileGetFileArchive)(MPQHANDLE hFile, MPQHANDLE *hMPQ);
+extern BOOL (WINAPI* SFileGetBasePath)(LPCSTR lpBuffer, DWORD dwBufferLength);
+extern BOOL (WINAPI* SFileSetBasePath)(LPCSTR lpNewBasePath);
#ifdef __cplusplus
}; // extern "C"
|