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




ShadowFlare [Thu, 10 Jul 2008 09:40:44 +0000 (03:40 -0600)]
23 files changed:
drawgrp/ReadMe.txt
drawgrp/StdAfx.cpp
drawgrp/StdAfx.h
drawgrp/drawgrp.cpp
drawgrp/drawgrp.vcproj
drawgrp/drawgrp.vcproj.vspscc
grpapi/GrpApi.bas
grpapi/grp_static.h
grpapi/grpapi.cpp
grpapi/grpapi.def
grpapi/grpapi.h
grpapi/grpapi.rc
grpapi/grpapi.sln
grpapi/grpapi.vcproj
grpapi/grpapi.vcproj.vspscc
grpapi/grpapi.vssscc
grpapi/grpapi_no-lib.cpp
grpapi/grpapi_no-lib.h
grpapi/grplib.vcproj
grpapi/grplib.vcproj.vspscc
grpapi/resource.h
loadstorm/Storm.cpp
loadstorm/Storm.h

index d071da0..7c6cba8 100644 (file)
@@ -1,34 +1,34 @@
-========================================================================\r
-       CONSOLE APPLICATION : drawgrp\r
-========================================================================\r
-\r
-\r
-AppWizard has created this drawgrp application for you.  \r
-\r
-This file contains a summary of what you will find in each of the files that\r
-make up your drawgrp application.\r
-\r
-drawgrp.dsp\r
-    This file (the project file) contains information at the project level and\r
-    is used to build a single project or subproject. Other users can share the\r
-    project (.dsp) file, but they should export the makefiles locally.\r
-\r
-drawgrp.cpp\r
-    This is the main application source file.\r
-\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-Other standard files:\r
-\r
-StdAfx.h, StdAfx.cpp\r
-    These files are used to build a precompiled header (PCH) file\r
-    named drawgrp.pch and a precompiled types file named StdAfx.obj.\r
-\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-Other notes:\r
-\r
-AppWizard uses "TODO:" to indicate parts of the source code you\r
-should add to or customize.\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
+========================================================================
+       CONSOLE APPLICATION : drawgrp
+========================================================================
+
+
+AppWizard has created this drawgrp application for you.  
+
+This file contains a summary of what you will find in each of the files that
+make up your drawgrp application.
+
+drawgrp.dsp
+    This file (the project file) contains information at the project level and
+    is used to build a single project or subproject. Other users can share the
+    project (.dsp) file, but they should export the makefiles locally.
+
+drawgrp.cpp
+    This is the main application source file.
+
+
+/////////////////////////////////////////////////////////////////////////////
+Other standard files:
+
+StdAfx.h, StdAfx.cpp
+    These files are used to build a precompiled header (PCH) file
+    named drawgrp.pch and a precompiled types file named StdAfx.obj.
+
+
+/////////////////////////////////////////////////////////////////////////////
+Other notes:
+
+AppWizard uses "TODO:" to indicate parts of the source code you
+should add to or customize.
+
+/////////////////////////////////////////////////////////////////////////////
index a6251b8..b9fe822 100644 (file)
@@ -1,8 +1,8 @@
-// stdafx.cpp : source file that includes just the standard includes\r
-//     drawgrp.pch will be the pre-compiled header\r
-//     stdafx.obj will contain the pre-compiled type information\r
-\r
-#include "stdafx.h"\r
-\r
-// TODO: reference any additional headers you need in STDAFX.H\r
-// and not in this file\r
+// stdafx.cpp : source file that includes just the standard includes
+//     drawgrp.pch will be the pre-compiled header
+//     stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
index 98db2d5..8f72b5f 100644 (file)
@@ -1,22 +1,22 @@
-// stdafx.h : include file for standard system include files,\r
-//  or project specific include files that are used frequently, but\r
-//      are changed infrequently\r
-//\r
-\r
-#if !defined(AFX_STDAFX_H__6C8ACA66_6D98_11D6_9E06_00A0C9199875__INCLUDED_)\r
-#define AFX_STDAFX_H__6C8ACA66_6D98_11D6_9E06_00A0C9199875__INCLUDED_\r
-\r
-#if _MSC_VER > 1000\r
-#pragma once\r
-#endif // _MSC_VER > 1000\r
-\r
-\r
-// TODO: reference additional headers your program requires here\r
-#include "../grpapi/grpapi_no-lib.h"\r
-#include "../LoadStorm/storm.h"\r
-#include <malloc.h>\r
-\r
-//{{AFX_INSERT_LOCATION}}\r
-// Microsoft Visual C++ will insert additional declarations immediately before the previous line.\r
-\r
-#endif // !defined(AFX_STDAFX_H__6C8ACA66_6D98_11D6_9E06_00A0C9199875__INCLUDED_)\r
+// stdafx.h : include file for standard system include files,
+//  or project specific include files that are used frequently, but
+//      are changed infrequently
+//
+
+#if !defined(AFX_STDAFX_H__6C8ACA66_6D98_11D6_9E06_00A0C9199875__INCLUDED_)
+#define AFX_STDAFX_H__6C8ACA66_6D98_11D6_9E06_00A0C9199875__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+
+// TODO: reference additional headers your program requires here
+#include "../grpapi/grpapi_no-lib.h"
+#include "../LoadStorm/storm.h"
+#include <malloc.h>
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_STDAFX_H__6C8ACA66_6D98_11D6_9E06_00A0C9199875__INCLUDED_)
index 8521822..269e45c 100644 (file)
-// drawgrp.cpp : Defines the entry point for the console application.\r
-//\r
-\r
-#define _CRT_RAND_S\r
-#include <stdlib.h>\r
-#include <stdio.h>\r
-#include "stdafx.h"\r
-\r
-\r
-/*int qmain(int argc, char* argv[]);\r
-\r
-int main(int argc, char* argv[])\r
-{\r
-       HINSTANCE hStorm = LoadStorm("Storm.dll");\r
-       if (SFileDestroy!=0) SFileDestroy();\r
-       LoadGrpApi();\r
-       int RetVal = qmain(argc,argv);\r
-       FreeGrpApi();\r
-       if (hStorm!=0) FreeLibrary(hStorm);\r
-       return RetVal;\r
-}*/\r
-\r
-struct BufferInfo {\r
-       WORD nWidth;\r
-       WORD nHeight;\r
-       signed short *pBuffer;\r
-       WORD nFrame;\r
-};\r
-\r
-COLORREF WINAPI ReadPixelFromBuffer(BufferInfo *pBI, int X, int Y)\r
-{\r
-       if (pBI->nFrame == 0xFFFF)\r
-               return pBI->pBuffer[(Y * pBI->nWidth) + X];\r
-       else\r
-               return pBI->pBuffer[(pBI->nFrame * pBI->nWidth * pBI->nHeight) + (Y * pBI->nWidth) + X];\r
-}\r
-\r
-void WINAPI WritePixelToBuffer(BufferInfo *pBI, int X, int Y, COLORREF clrColor)\r
-{\r
-       if (pBI->nFrame == 0xFFFF)\r
-               pBI->pBuffer[(Y * pBI->nWidth) + X] = (signed short)clrColor;\r
-       else\r
-               //if (clrColor < 1 || clrColor > 13)\r
-               //      pBI->pBuffer[(pBI->nFrame * pBI->nWidth * pBI->nHeight) + (Y * pBI->nWidth) + X] = (signed short)((BYTE)-clrColor);\r
-               //else\r
-                       pBI->pBuffer[(pBI->nFrame * pBI->nWidth * pBI->nHeight) + (Y * pBI->nWidth) + X] = (signed short)clrColor;\r
-}\r
-\r
-int main(int argc, char* argv[])\r
-{\r
-       HANDLE hMPQ=0,hMPQ2=0,hMPQ3=0;\r
-       DWORD *dwPalette = (DWORD *)_alloca(1024);\r
-       memset(dwPalette,0,1024);\r
-       LoadStorm("SFMpq.dll");\r
-       SetMpqDll("SFMpq.dll");\r
-       if (SFileOpenArchive!=0) {\r
-               char *buffer = (char *)_alloca(13);\r
-               memcpy(buffer,"StarDat.mpq",12);\r
-               if (SFileOpenArchive(buffer,1000,0,&hMPQ)==0) return 0;\r
-               memcpy(buffer,"BrooDat.mpq",12);\r
-               SFileOpenArchive(buffer,2000,0,&hMPQ2);\r
-               memcpy(buffer,"Patch_rt.mpq",13);\r
-               SFileOpenArchive(buffer,3000,0,&hMPQ3);\r
-       }\r
-       BufferInfo BI;\r
-       LoadPalette("tileset\\Platform.wpe",dwPalette);\r
-       HANDLE hGrp, hGrp2;\r
-       if (argc>1)\r
-               hGrp = LoadGrp(argv[1]);\r
-       else\r
-               hGrp = LoadGrp("unit\\zerg\\zergling.grp");\r
-       HDC hDC = GetDC(0);\r
-       GRPHEADER GrpInfo;\r
-       if (GetGrpInfo(hGrp,&GrpInfo)==0) {GrpInfo.nFrames=0;GrpInfo.wMaxWidth=0;GrpInfo.wMaxHeight=0;}\r
-       BI.nWidth = GrpInfo.wMaxWidth;\r
-       BI.nHeight = GrpInfo.wMaxHeight;\r
-       //BI.nWidth = 255;\r
-       //BI.nHeight = 255;\r
-       BI.pBuffer = (signed short *)malloc(GrpInfo.nFrames * BI.nWidth * BI.nHeight * sizeof(short));\r
-       WORD i,x,y;\r
-       DWORD j, nGrpSize;\r
-       unsigned int u,v;\r
-       memset(BI.pBuffer, 0xFF, GrpInfo.nFrames * BI.nWidth * BI.nHeight * sizeof(short));\r
-       //for (DWORD j=0;j<16;j++){\r
-       /*for (WORD i=0;i<GrpInfo.nFrames;i++) {\r
-               DrawGrp(hGrp,hDC,0,0,i,dwPalette,ALPHA_BLEND,0x401020);\r
-       }*/\r
-       signed short clrPixel;\r
-       RECT rect;\r
-       /*for (i=0;i<GrpInfo.nFrames;i++) {\r
-               for (j=0;j<16;j++)\r
-               {\r
-                       rand_s(&u);\r
-                       rand_s(&v);\r
-                       u = u % 800;\r
-                       v = v % 600;\r
-                       DrawGrp(hGrp,hDC,u,v,i,dwPalette,ALPHA_BLEND,0x404040);\r
-               }\r
-       }*/\r
-       SetFunctionGetPixel((GETPIXELPROC)ReadPixelFromBuffer);\r
-       SetFunctionSetPixel((SETPIXELPROC)WritePixelToBuffer);\r
-       for (i=0;i<GrpInfo.nFrames;i++) {\r
-               BI.nFrame = i;\r
-               u = (BI.nWidth - GrpInfo.wMaxWidth) / 2;\r
-               v = (BI.nHeight - GrpInfo.wMaxHeight) / 2;\r
-               for (y = 0; y < BI.nHeight; y++) {\r
-                       for (x = 0; x < BI.nWidth; x++) {\r
-                               WritePixelToBuffer(&BI, x, y, -1);\r
-                       }\r
-               }\r
-               DrawGrp(hGrp,(HDC)&BI,u,v,i,0,USE_INDEX,0);\r
-       }\r
-       hGrp2 = hGrp;\r
-       hGrp = CreateGrp(BI.pBuffer, GrpInfo.nFrames, BI.nWidth, BI.nHeight, FALSE, &nGrpSize);\r
-       /*HANDLE hFile;\r
-       hFile = CreateFile("generated zergling.grp", GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0);\r
-       if (hFile != INVALID_HANDLE_VALUE) {\r
-               WriteFile(hFile, hGrp, nGrpSize, &j, 0);\r
-               CloseHandle(hFile);\r
-       }*/\r
-       BI.nFrame = 0xFFFF;\r
-       j=0;\r
-       \r
-       for (i=0;i<GrpInfo.nFrames;i+=1) {\r
-               rect.left = rect.top = 0;\r
-               rect.right = rect.left + BI.nWidth;\r
-               rect.bottom = rect.top + BI.nHeight;\r
-               for (x = 0; x < BI.nWidth * BI.nHeight; x++)\r
-                       BI.pBuffer[x] = -1;\r
-               //for (j=0;j<(1 * 1);j++) {\r
-//                     DrawGrp(hGrp,(HDC)&BI,i,0,i % (17*8),dwPalette,ALPHA_BLEND,0x401020);\r
-                       //DrawGrp(hGrp2,(HDC)&BI,0,0,i,0,USE_INDEX,0x401020);\r
-                       //u = memcmp(BI.pBuffer, &BI.pBuffer[i * BI.nWidth * BI.nHeight], BI.nWidth * BI.nHeight * sizeof(short));\r
-                       DrawGrp(hGrp,(HDC)&BI,0,0,i,0,USE_INDEX,0x401020);\r
-                       u = memcmp(BI.pBuffer, &BI.pBuffer[i * BI.nWidth * BI.nHeight], BI.nWidth * BI.nHeight * sizeof(short));\r
-                       for (x = 0; x < BI.nWidth; x++)\r
-                               for (y = 0; y < BI.nHeight; y++) {\r
-                                       clrPixel = BI.pBuffer[(y * BI.nWidth) + x];\r
-                                       if (clrPixel != -1) SetPixelV(hDC, x, y, dwPalette[clrPixel]);\r
-                               }\r
-               //}\r
-               if (u) {\r
-                       printf("Output of re-encoded graphic for frame %d does not match original!  Total %d\n", i, ++j);\r
-                       //break;\r
-               }\r
-               FillRect(hDC, &rect, (HBRUSH) (COLOR_WINDOW+1));\r
-       }\r
-       for (i=4;i<400;i+=17) {\r
-               rect.left = rect.top = 400-i;\r
-               rect.right = rect.left + BI.nWidth;\r
-               rect.bottom = rect.top + BI.nHeight;\r
-               for (x = 0; x < BI.nWidth * BI.nHeight; x++)\r
-                       BI.pBuffer[x] = -1;\r
-               for (j=0;j<32;j++) {\r
-//                     DrawGrp(hGrp,(HDC)&BI,400-i,0,i % (17*8),dwPalette,HORIZONTAL_FLIP|ALPHA_BLEND,0x401020);\r
-                       DrawGrp(hGrp,(HDC)&BI,0,0,i % (17*8),0,HORIZONTAL_FLIP|USE_INDEX,0x401020);\r
-                       for (x = 0; x < BI.nWidth; x++)\r
-                               for (y = 0; y < BI.nHeight; y++) {\r
-                                       clrPixel = BI.pBuffer[(y * BI.nWidth) + x];\r
-                                       if (clrPixel != -1) SetPixelV(hDC, 400-i + x, 400-i + y, dwPalette[clrPixel]);\r
-                               }\r
-               }\r
-               FillRect(hDC, &rect, (HBRUSH) (COLOR_WINDOW+1));\r
-       }\r
-       for (i = 0; i < BI.nWidth; i++)\r
-               for (j = 0; j < BI.nHeight; j++) {\r
-                       clrPixel = BI.pBuffer[(j * BI.nWidth) + i];\r
-                       if (clrPixel != -1) SetPixelV(hDC, 400 + i, 300 + j, dwPalette[clrPixel]);\r
-               }\r
-       //}\r
-       \r
-       ReleaseDC(0,hDC);\r
-       free(BI.pBuffer);\r
-    DestroyGrp(hGrp);\r
-    DestroyGrp(hGrp2);\r
-       if (SFileCloseArchive!=0) {\r
-               if (hMPQ3!=0) SFileCloseArchive(hMPQ3);\r
-               if (hMPQ2!=0) SFileCloseArchive(hMPQ2);\r
-               if (hMPQ!=0) SFileCloseArchive(hMPQ);\r
-       }\r
-       return 0;\r
-}\r
-\r
+// drawgrp.cpp : Defines the entry point for the console application.
+//
+
+#define _CRT_RAND_S
+#include <stdlib.h>
+#include <stdio.h>
+#include "stdafx.h"
+
+
+/*int qmain(int argc, char* argv[]);
+
+int main(int argc, char* argv[])
+{
+       HINSTANCE hStorm = LoadStorm("Storm.dll");
+       if (SFileDestroy!=0) SFileDestroy();
+       LoadGrpApi();
+       int RetVal = qmain(argc,argv);
+       FreeGrpApi();
+       if (hStorm!=0) FreeLibrary(hStorm);
+       return RetVal;
+}*/
+
+struct BufferInfo {
+       WORD nWidth;
+       WORD nHeight;
+       signed short *pBuffer;
+       WORD nFrame;
+};
+
+COLORREF WINAPI ReadPixelFromBuffer(BufferInfo *pBI, int X, int Y)
+{
+       if (pBI->nFrame == 0xFFFF)
+               return pBI->pBuffer[(Y * pBI->nWidth) + X];
+       else
+               return pBI->pBuffer[(pBI->nFrame * pBI->nWidth * pBI->nHeight) + (Y * pBI->nWidth) + X];
+}
+
+void WINAPI WritePixelToBuffer(BufferInfo *pBI, int X, int Y, COLORREF clrColor)
+{
+       if (pBI->nFrame == 0xFFFF)
+               pBI->pBuffer[(Y * pBI->nWidth) + X] = (signed short)clrColor;
+       else
+               //if (clrColor < 1 || clrColor > 13)
+               //      pBI->pBuffer[(pBI->nFrame * pBI->nWidth * pBI->nHeight) + (Y * pBI->nWidth) + X] = (signed short)((BYTE)-clrColor);
+               //else
+                       pBI->pBuffer[(pBI->nFrame * pBI->nWidth * pBI->nHeight) + (Y * pBI->nWidth) + X] = (signed short)clrColor;
+}
+
+int main(int argc, char* argv[])
+{
+       HANDLE hMPQ=0,hMPQ2=0,hMPQ3=0;
+       DWORD *dwPalette = (DWORD *)_alloca(1024);
+       memset(dwPalette,0,1024);
+       LoadStorm("SFMpq.dll");
+       SetMpqDll("SFMpq.dll");
+       if (SFileOpenArchive!=0) {
+               char *buffer = (char *)_alloca(13);
+               memcpy(buffer,"StarDat.mpq",12);
+               if (SFileOpenArchive(buffer,1000,0,&hMPQ)==0) return 0;
+               memcpy(buffer,"BrooDat.mpq",12);
+               SFileOpenArchive(buffer,2000,0,&hMPQ2);
+               memcpy(buffer,"Patch_rt.mpq",13);
+               SFileOpenArchive(buffer,3000,0,&hMPQ3);
+       }
+       BufferInfo BI;
+       LoadPalette("tileset\\Platform.wpe",dwPalette);
+       HANDLE hGrp, hGrp2;
+       if (argc>1)
+               hGrp = LoadGrp(argv[1]);
+       else
+               hGrp = LoadGrp("unit\\zerg\\zergling.grp");
+       HDC hDC = GetDC(0);
+       GRPHEADER GrpInfo;
+       if (GetGrpInfo(hGrp,&GrpInfo)==0) {GrpInfo.nFrames=0;GrpInfo.wMaxWidth=0;GrpInfo.wMaxHeight=0;}
+       BI.nWidth = GrpInfo.wMaxWidth;
+       BI.nHeight = GrpInfo.wMaxHeight;
+       //BI.nWidth = 255;
+       //BI.nHeight = 255;
+       BI.pBuffer = (signed short *)malloc(GrpInfo.nFrames * BI.nWidth * BI.nHeight * sizeof(short));
+       WORD i,x,y;
+       DWORD j, nGrpSize;
+       unsigned int u,v;
+       memset(BI.pBuffer, 0xFF, GrpInfo.nFrames * BI.nWidth * BI.nHeight * sizeof(short));
+       //for (DWORD j=0;j<16;j++){
+       /*for (WORD i=0;i<GrpInfo.nFrames;i++) {
+               DrawGrp(hGrp,hDC,0,0,i,dwPalette,ALPHA_BLEND,0x401020);
+       }*/
+       signed short clrPixel;
+       RECT rect;
+       /*for (i=0;i<GrpInfo.nFrames;i++) {
+               for (j=0;j<16;j++)
+               {
+                       rand_s(&u);
+                       rand_s(&v);
+                       u = u % 800;
+                       v = v % 600;
+                       DrawGrp(hGrp,hDC,u,v,i,dwPalette,ALPHA_BLEND,0x404040);
+               }
+       }*/
+       SetFunctionGetPixel((GETPIXELPROC)ReadPixelFromBuffer);
+       SetFunctionSetPixel((SETPIXELPROC)WritePixelToBuffer);
+       for (i=0;i<GrpInfo.nFrames;i++) {
+               BI.nFrame = i;
+               u = (BI.nWidth - GrpInfo.wMaxWidth) / 2;
+               v = (BI.nHeight - GrpInfo.wMaxHeight) / 2;
+               for (y = 0; y < BI.nHeight; y++) {
+                       for (x = 0; x < BI.nWidth; x++) {
+                               WritePixelToBuffer(&BI, x, y, -1);
+                       }
+               }
+               DrawGrp(hGrp,(HDC)&BI,u,v,i,0,USE_INDEX,0);
+       }
+       hGrp2 = hGrp;
+       hGrp = CreateGrp(BI.pBuffer, GrpInfo.nFrames, BI.nWidth, BI.nHeight, FALSE, &nGrpSize);
+       /*HANDLE hFile;
+       hFile = CreateFile("generated zergling.grp", GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0);
+       if (hFile != INVALID_HANDLE_VALUE) {
+               WriteFile(hFile, hGrp, nGrpSize, &j, 0);
+               CloseHandle(hFile);
+       }*/
+       BI.nFrame = 0xFFFF;
+       j=0;
+       
+       for (i=0;i<GrpInfo.nFrames;i+=1) {
+               rect.left = rect.top = 0;
+               rect.right = rect.left + BI.nWidth;
+               rect.bottom = rect.top + BI.nHeight;
+               for (x = 0; x < BI.nWidth * BI.nHeight; x++)
+                       BI.pBuffer[x] = -1;
+               //for (j=0;j<(1 * 1);j++) {
+//                     DrawGrp(hGrp,(HDC)&BI,i,0,i % (17*8),dwPalette,ALPHA_BLEND,0x401020);
+                       //DrawGrp(hGrp2,(HDC)&BI,0,0,i,0,USE_INDEX,0x401020);
+                       //u = memcmp(BI.pBuffer, &BI.pBuffer[i * BI.nWidth * BI.nHeight], BI.nWidth * BI.nHeight * sizeof(short));
+                       DrawGrp(hGrp,(HDC)&BI,0,0,i,0,USE_INDEX,0x401020);
+                       u = memcmp(BI.pBuffer, &BI.pBuffer[i * BI.nWidth * BI.nHeight], BI.nWidth * BI.nHeight * sizeof(short));
+                       for (x = 0; x < BI.nWidth; x++)
+                               for (y = 0; y < BI.nHeight; y++) {
+                                       clrPixel = BI.pBuffer[(y * BI.nWidth) + x];
+                                       if (clrPixel != -1) SetPixelV(hDC, x, y, dwPalette[clrPixel]);
+                               }
+               //}
+               if (u) {
+                       printf("Output of re-encoded graphic for frame %d does not match original!  Total %d\n", i, ++j);
+                       //break;
+               }
+               FillRect(hDC, &rect, (HBRUSH) (COLOR_WINDOW+1));
+       }
+       for (i=4;i<400;i+=17) {
+               rect.left = rect.top = 400-i;
+               rect.right = rect.left + BI.nWidth;
+               rect.bottom = rect.top + BI.nHeight;
+               for (x = 0; x < BI.nWidth * BI.nHeight; x++)
+                       BI.pBuffer[x] = -1;
+               for (j=0;j<32;j++) {
+//                     DrawGrp(hGrp,(HDC)&BI,400-i,0,i % (17*8),dwPalette,HORIZONTAL_FLIP|ALPHA_BLEND,0x401020);
+                       DrawGrp(hGrp,(HDC)&BI,0,0,i % (17*8),0,HORIZONTAL_FLIP|USE_INDEX,0x401020);
+                       for (x = 0; x < BI.nWidth; x++)
+                               for (y = 0; y < BI.nHeight; y++) {
+                                       clrPixel = BI.pBuffer[(y * BI.nWidth) + x];
+                                       if (clrPixel != -1) SetPixelV(hDC, 400-i + x, 400-i + y, dwPalette[clrPixel]);
+                               }
+               }
+               FillRect(hDC, &rect, (HBRUSH) (COLOR_WINDOW+1));
+       }
+       for (i = 0; i < BI.nWidth; i++)
+               for (j = 0; j < BI.nHeight; j++) {
+                       clrPixel = BI.pBuffer[(j * BI.nWidth) + i];
+                       if (clrPixel != -1) SetPixelV(hDC, 400 + i, 300 + j, dwPalette[clrPixel]);
+               }
+       //}
+       
+       ReleaseDC(0,hDC);
+       free(BI.pBuffer);
+    DestroyGrp(hGrp);
+    DestroyGrp(hGrp2);
+       if (SFileCloseArchive!=0) {
+               if (hMPQ3!=0) SFileCloseArchive(hMPQ3);
+               if (hMPQ2!=0) SFileCloseArchive(hMPQ2);
+               if (hMPQ!=0) SFileCloseArchive(hMPQ);
+       }
+       return 0;
+}
+
index 9f93088..a8188a5 100644 (file)
-<?xml version="1.0" encoding="Windows-1252"?>\r
-<VisualStudioProject\r
-       ProjectType="Visual C++"\r
-       Version="8.00"\r
-       Name="drawgrp"\r
-       ProjectGUID="{10729DB2-5CEA-41BA-9C6F-B47BE5A3C242}"\r
-       RootNamespace="drawgrp"\r
-       SccProjectName="&quot;$/grpapi_VS2005.root/grpapi&quot;, IGAAAAAA"\r
-       SccLocalPath=".."\r
-       SccProvider="MSSCCI:Microsoft Visual SourceSafe"\r
-       >\r
-       <Platforms>\r
-               <Platform\r
-                       Name="Win32"\r
-               />\r
-       </Platforms>\r
-       <ToolFiles>\r
-       </ToolFiles>\r
-       <Configurations>\r
-               <Configuration\r
-                       Name="Release|Win32"\r
-                       OutputDirectory=".\Release"\r
-                       IntermediateDirectory=".\Release"\r
-                       ConfigurationType="1"\r
-                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
-                       UseOfMFC="0"\r
-                       ATLMinimizesCRunTimeLibraryUsage="false"\r
-                       CharacterSet="2"\r
-                       >\r
-                       <Tool\r
-                               Name="VCPreBuildEventTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCCustomBuildTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCXMLDataGeneratorTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCWebServiceProxyGeneratorTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCMIDLTool"\r
-                               TypeLibraryName=".\Release/drawgrp.tlb"\r
-                               HeaderFileName=""\r
-                       />\r
-                       <Tool\r
-                               Name="VCCLCompilerTool"\r
-                               Optimization="2"\r
-                               InlineFunctionExpansion="1"\r
-                               PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"\r
-                               StringPooling="true"\r
-                               RuntimeLibrary="0"\r
-                               EnableFunctionLevelLinking="true"\r
-                               PrecompiledHeaderFile=".\Release/drawgrp.pch"\r
-                               AssemblerListingLocation=".\Release/"\r
-                               ObjectFile=".\Release/"\r
-                               ProgramDataBaseFileName=".\Release/"\r
-                               WarningLevel="3"\r
-                               SuppressStartupBanner="true"\r
-                       />\r
-                       <Tool\r
-                               Name="VCManagedResourceCompilerTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCResourceCompilerTool"\r
-                               PreprocessorDefinitions="NDEBUG"\r
-                               Culture="1033"\r
-                       />\r
-                       <Tool\r
-                               Name="VCPreLinkEventTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCLinkerTool"\r
-                               OutputFile=".\Release/drawgrp.exe"\r
-                               LinkIncremental="1"\r
-                               SuppressStartupBanner="true"\r
-                               ProgramDatabaseFile=".\Release/drawgrp.pdb"\r
-                               SubSystem="1"\r
-                               TargetMachine="1"\r
-                       />\r
-                       <Tool\r
-                               Name="VCALinkTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCManifestTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCXDCMakeTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCBscMakeTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCFxCopTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCAppVerifierTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCWebDeploymentTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCPostBuildEventTool"\r
-                       />\r
-               </Configuration>\r
-               <Configuration\r
-                       Name="Debug|Win32"\r
-                       OutputDirectory=".\Debug"\r
-                       IntermediateDirectory=".\Debug"\r
-                       ConfigurationType="1"\r
-                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
-                       UseOfMFC="0"\r
-                       ATLMinimizesCRunTimeLibraryUsage="false"\r
-                       CharacterSet="2"\r
-                       >\r
-                       <Tool\r
-                               Name="VCPreBuildEventTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCCustomBuildTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCXMLDataGeneratorTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCWebServiceProxyGeneratorTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCMIDLTool"\r
-                               TypeLibraryName=".\Debug/drawgrp.tlb"\r
-                               HeaderFileName=""\r
-                       />\r
-                       <Tool\r
-                               Name="VCCLCompilerTool"\r
-                               Optimization="0"\r
-                               PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"\r
-                               BasicRuntimeChecks="3"\r
-                               RuntimeLibrary="1"\r
-                               PrecompiledHeaderFile=".\Debug/drawgrp.pch"\r
-                               AssemblerListingLocation=".\Debug/"\r
-                               ObjectFile=".\Debug/"\r
-                               ProgramDataBaseFileName=".\Debug/"\r
-                               WarningLevel="3"\r
-                               SuppressStartupBanner="true"\r
-                               DebugInformationFormat="4"\r
-                       />\r
-                       <Tool\r
-                               Name="VCManagedResourceCompilerTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCResourceCompilerTool"\r
-                               PreprocessorDefinitions="_DEBUG"\r
-                               Culture="1033"\r
-                       />\r
-                       <Tool\r
-                               Name="VCPreLinkEventTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCLinkerTool"\r
-                               OutputFile=".\Debug/drawgrp.exe"\r
-                               LinkIncremental="1"\r
-                               SuppressStartupBanner="true"\r
-                               GenerateDebugInformation="true"\r
-                               ProgramDatabaseFile=".\Debug/drawgrp.pdb"\r
-                               SubSystem="1"\r
-                               TargetMachine="1"\r
-                       />\r
-                       <Tool\r
-                               Name="VCALinkTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCManifestTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCXDCMakeTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCBscMakeTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCFxCopTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCAppVerifierTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCWebDeploymentTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCPostBuildEventTool"\r
-                       />\r
-               </Configuration>\r
-       </Configurations>\r
-       <References>\r
-       </References>\r
-       <Files>\r
-               <Filter\r
-                       Name="Source Files"\r
-                       Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
-                       >\r
-                       <File\r
-                               RelativePath="drawgrp.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               Optimization="2"\r
-                                               PreprocessorDefinitions=""\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               Optimization="0"\r
-                                               PreprocessorDefinitions=""\r
-                                               BasicRuntimeChecks="3"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\grpapi\grpapi_no-lib.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               Optimization="2"\r
-                                               PreprocessorDefinitions=""\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               Optimization="0"\r
-                                               PreprocessorDefinitions=""\r
-                                               BasicRuntimeChecks="3"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="StdAfx.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               Optimization="2"\r
-                                               PreprocessorDefinitions=""\r
-                                               UsePrecompiledHeader="1"\r
-                                               PrecompiledHeaderThrough="stdafx.h"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               Optimization="0"\r
-                                               PreprocessorDefinitions=""\r
-                                               BasicRuntimeChecks="3"\r
-                                               UsePrecompiledHeader="1"\r
-                                               PrecompiledHeaderThrough="stdafx.h"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\LoadStorm\Storm.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               Optimization="2"\r
-                                               PreprocessorDefinitions=""\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               Optimization="0"\r
-                                               PreprocessorDefinitions=""\r
-                                               BasicRuntimeChecks="3"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-               </Filter>\r
-               <Filter\r
-                       Name="Header Files"\r
-                       Filter="h;hpp;hxx;hm;inl"\r
-                       >\r
-                       <File\r
-                               RelativePath="..\grpapi\grpapi_no-lib.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="StdAfx.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\LoadStorm\Storm.h"\r
-                               >\r
-                       </File>\r
-               </Filter>\r
-               <Filter\r
-                       Name="Resource Files"\r
-                       Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"\r
-                       >\r
-               </Filter>\r
-               <File\r
-                       RelativePath="..\grpapi\GrpApi.bas"\r
-                       >\r
-               </File>\r
-               <File\r
-                       RelativePath="ReadMe.txt"\r
-                       >\r
-               </File>\r
-       </Files>\r
-       <Globals>\r
-       </Globals>\r
-</VisualStudioProject>\r
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+       ProjectType="Visual C++"
+       Version="8.00"
+       Name="drawgrp"
+       ProjectGUID="{10729DB2-5CEA-41BA-9C6F-B47BE5A3C242}"
+       RootNamespace="drawgrp"
+       SccProjectName="&quot;$/grpapi_VS2005.root/grpapi&quot;, IGAAAAAA"
+       SccLocalPath=".."
+       SccProvider="MSSCCI:Microsoft Visual SourceSafe"
+       >
+       <Platforms>
+               <Platform
+                       Name="Win32"
+               />
+       </Platforms>
+       <ToolFiles>
+       </ToolFiles>
+       <Configurations>
+               <Configuration
+                       Name="Release|Win32"
+                       OutputDirectory=".\Release"
+                       IntermediateDirectory=".\Release"
+                       ConfigurationType="1"
+                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+                       UseOfMFC="0"
+                       ATLMinimizesCRunTimeLibraryUsage="false"
+                       CharacterSet="2"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                               TypeLibraryName=".\Release/drawgrp.tlb"
+                               HeaderFileName=""
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="2"
+                               InlineFunctionExpansion="1"
+                               PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+                               StringPooling="true"
+                               RuntimeLibrary="0"
+                               EnableFunctionLevelLinking="true"
+                               PrecompiledHeaderFile=".\Release/drawgrp.pch"
+                               AssemblerListingLocation=".\Release/"
+                               ObjectFile=".\Release/"
+                               ProgramDataBaseFileName=".\Release/"
+                               WarningLevel="3"
+                               SuppressStartupBanner="true"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               PreprocessorDefinitions="NDEBUG"
+                               Culture="1033"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLinkerTool"
+                               OutputFile=".\Release/drawgrp.exe"
+                               LinkIncremental="1"
+                               SuppressStartupBanner="true"
+                               ProgramDatabaseFile=".\Release/drawgrp.pdb"
+                               SubSystem="1"
+                               TargetMachine="1"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCManifestTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCAppVerifierTool"
+                       />
+                       <Tool
+                               Name="VCWebDeploymentTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+               <Configuration
+                       Name="Debug|Win32"
+                       OutputDirectory=".\Debug"
+                       IntermediateDirectory=".\Debug"
+                       ConfigurationType="1"
+                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+                       UseOfMFC="0"
+                       ATLMinimizesCRunTimeLibraryUsage="false"
+                       CharacterSet="2"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                               TypeLibraryName=".\Debug/drawgrp.tlb"
+                               HeaderFileName=""
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="0"
+                               PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+                               BasicRuntimeChecks="3"
+                               RuntimeLibrary="1"
+                               PrecompiledHeaderFile=".\Debug/drawgrp.pch"
+                               AssemblerListingLocation=".\Debug/"
+                               ObjectFile=".\Debug/"
+                               ProgramDataBaseFileName=".\Debug/"
+                               WarningLevel="3"
+                               SuppressStartupBanner="true"
+                               DebugInformationFormat="4"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               PreprocessorDefinitions="_DEBUG"
+                               Culture="1033"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLinkerTool"
+                               OutputFile=".\Debug/drawgrp.exe"
+                               LinkIncremental="1"
+                               SuppressStartupBanner="true"
+                               GenerateDebugInformation="true"
+                               ProgramDatabaseFile=".\Debug/drawgrp.pdb"
+                               SubSystem="1"
+                               TargetMachine="1"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCManifestTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCAppVerifierTool"
+                       />
+                       <Tool
+                               Name="VCWebDeploymentTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+       </Configurations>
+       <References>
+       </References>
+       <Files>
+               <Filter
+                       Name="Source Files"
+                       Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+                       >
+                       <File
+                               RelativePath="drawgrp.cpp"
+                               >
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               Optimization="2"
+                                               PreprocessorDefinitions=""
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               Optimization="0"
+                                               PreprocessorDefinitions=""
+                                               BasicRuntimeChecks="3"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="..\grpapi\grpapi_no-lib.cpp"
+                               >
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               Optimization="2"
+                                               PreprocessorDefinitions=""
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               Optimization="0"
+                                               PreprocessorDefinitions=""
+                                               BasicRuntimeChecks="3"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="StdAfx.cpp"
+                               >
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               Optimization="2"
+                                               PreprocessorDefinitions=""
+                                               UsePrecompiledHeader="1"
+                                               PrecompiledHeaderThrough="stdafx.h"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               Optimization="0"
+                                               PreprocessorDefinitions=""
+                                               BasicRuntimeChecks="3"
+                                               UsePrecompiledHeader="1"
+                                               PrecompiledHeaderThrough="stdafx.h"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="..\LoadStorm\Storm.cpp"
+                               >
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               Optimization="2"
+                                               PreprocessorDefinitions=""
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               Optimization="0"
+                                               PreprocessorDefinitions=""
+                                               BasicRuntimeChecks="3"
+                                       />
+                               </FileConfiguration>
+                       </File>
+               </Filter>
+               <Filter
+                       Name="Header Files"
+                       Filter="h;hpp;hxx;hm;inl"
+                       >
+                       <File
+                               RelativePath="..\grpapi\grpapi_no-lib.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="StdAfx.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\LoadStorm\Storm.h"
+                               >
+                       </File>
+               </Filter>
+               <Filter
+                       Name="Resource Files"
+                       Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+                       >
+               </Filter>
+               <File
+                       RelativePath="..\grpapi\GrpApi.bas"
+                       >
+               </File>
+               <File
+                       RelativePath="ReadMe.txt"
+                       >
+               </File>
+       </Files>
+       <Globals>
+       </Globals>
+</VisualStudioProject>
index 5d67725..680bbb6 100644 (file)
@@ -1,10 +1,10 @@
-""\r
-{\r
-"FILE_VERSION" = "9237"\r
-"ENLISTMENT_CHOICE" = "NEVER"\r
-"PROJECT_FILE_RELATIVE_PATH" = "relative:drawgrp"\r
-"NUMBER_OF_EXCLUDED_FILES" = "0"\r
-"ORIGINAL_PROJECT_FILE_PATH" = ""\r
-"NUMBER_OF_NESTED_PROJECTS" = "0"\r
-"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"\r
-}\r
+""
+{
+"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"
+}
index 5fa2585..5dfca12 100644 (file)
-Attribute VB_Name = "GrpApi"\r
-Option Explicit\r
-\r
-'  ShadowFlare GRP Library. (c) ShadowFlare Software 2002-2006\r
-\r
-'  Any comments or suggestions are accepted at blakflare@hotmail.com (ShadowFlare)\r
-\r
-Type GRPHEADER\r
-    nFrames As Integer\r
-    wMaxWidth As Integer\r
-    wMaxHeight As Integer\r
-End Type\r
-\r
-Public Const HORIZONTAL_FLIP As Long = &H1& ' Flips the graphic horizontally\r
-Public Const VERTICAL_FLIP   As Long = &H2& ' Flips the graphic vertically\r
-Public Const SHADOW_COLOR    As Long = &H4& ' Causes the graphic to be drawn in one color\r
-                                            ' Second byte of flags is the red component of\r
-                                            ' the shadow's color, third byte is green,\r
-                                            ' fourth byte is blue; like this:\r
-                                            ' 'SHADOW_COLOR Or &HBBGGRR00'\r
-Public Const ALPHA_BLEND     As Long = &H8& ' Blends the graphic with what it is being drawn over.\r
-                                            ' The dwAlpha parameter will only be used when this\r
-                                            ' flag is specified.  dwAlpha is an RGB value\r
-                                            ' (&HBBGGRR).\r
-                                            ' Note: Because of the extra calculations required,\r
-                                            ' alpha blended graphics take longer to draw\r
-Public Const USE_INDEX      As Long = &H10& ' Only valid when used with a custom SetPixel function.\r
-                                            ' This flag cannot be used in combination with\r
-                                            ' ALPHA_BLEND or SHADOW_COLOR\r
-                                            ' When this flag is used, the index to a color in the\r
-                                            ' palette will be passed to your custom SetPixel\r
-                                            ' function instead of the actual color.\r
-\r
-' Palette is an array of 256 Longs.  Pass the first element of the array to these functions,\r
-' rather than the actual array\r
-' For LoadPalette and LoadGrp, lpFileName may be a file in an open mpq archive\r
-' or a file not in an archive\r
-Declare Function LoadPalette Lib "Grpapi.dll" (ByVal lpFileName As String, dwPalette As Long) As Boolean\r
-Declare Function LoadGrp Lib "Grpapi.dll" (ByVal lpFileName As String) As Long\r
-Declare Function DestroyGrp Lib "Grpapi.dll" (ByVal hGrp As Long) As Boolean\r
-Declare Function DrawGrp Lib "Grpapi.dll" (ByVal hGrp As Long, ByVal hdcDest As Long, ByVal nXDest As Long, ByVal nYDest As Long, ByVal nFrame As Integer, dwPalette As Long, ByVal dwFlags As Long, ByVal dwAlpha As Long) As Boolean\r
-Declare Function GetGrpInfo Lib "Grpapi.dll" (ByVal hGrp As Long, GrpInfo As GRPHEADER) As Boolean\r
-Declare Function GetGrpFrameInfo Lib "Grpapi.dll" (ByVal hGrp As Long, ByVal nFrame As Integer, ByRef nLeft As Long, ByRef nTop As Long, ByRef nWidth As Long, ByRef nHeight As Long) As Boolean\r
-\r
-Declare Function GetDC Lib "User32.dll" (ByVal hWnd As Long) As Long\r
-Declare Function ReleaseDC Lib "User32.dll" (ByVal hWnd As Long, ByVal hDC As Long) As Long\r
-\r
-' An array of the raw image data to encode should be passed to lpImageData.  To do this,\r
-' pass the first byte of the array to the function.  The size of the buffer containing\r
-' the data should be nFrames * wMaxWidth * wMaxHeight * 2\r
-' and the values should be arranged row by row of the frame, with the top row first.\r
-' After all the rows of a frame have been put into the buffer, the rows of the next frame\r
-' go after it.  For transparent pixels, they should be set to -1.  All other pixels should\r
-' have the high order byte set to zero, meaning that they should not be negative and the\r
-' values should not exceed 255 (&HFF).  The values used for the colors are indexes into the\r
-' color palette.\r
-' Pass True to bNoCompress if you need an uncompressed GRP.\r
-' Pass a variable to nGrpSize to receive the size in bytes of the resulting encoded GRP.\r
-' The return value of this function is actually a pointer to the GRP data.  This is what your\r
-' program should save to a file.  The size of this buffer is the value received by nGrpSize.\r
-' When your program is done with the returned buffer, it should call DestroyGrp on the\r
-' buffer that was returned by this function to free up the memory from it.\r
-' The pointer returned by this function can also be directly used by DrawGrp or GetGrpInfo.\r
-Declare Function CreateGrp Lib "Grpapi.dll" (ByRef lpImageData As Integer, ByVal nFrames As Integer, ByVal wMaxWidth As Integer, ByVal wMaxHeight As Integer, ByVal bNoCompress As Boolean, ByRef nGrpSize As Long) As Long\r
-\r
-' Use this function to make a copy the memory at the location returned by CreateGrp.\r
-' Pass the address ByVal to Source.  Pass either a byte array or a string to Destination.\r
-' The size of the array or string must be at least the size of the GRP data before\r
-' attempting to copy it to the array or string.\r
-' To pass a byte array, pass the first byte of the array ByRef.  To pass a string,\r
-' pass the string ByVal.\r
-Declare Sub CopyMemory Lib "Kernel32.dll" _\r
-    Alias "RtlMoveMemory" ( _\r
-    ByRef Destination As Any, _\r
-    ByRef Source As Any, _\r
-    ByVal Length As Long)\r
-\r
-' Call these to have DrawGrp use custom functions for reading and drawing pixels\r
-' so that you can have it read from and write to a buffer, for example.\r
-' Requires Visual Basic 5 or higher\r
-'\r
-' The functions must be in this form:\r
-'\r
-' Function GetPixelProc (ByRef value As any_type, X As Long, Y As Long) As Long\r
-' Sub SetPixelProc (ByRef value As any_type, X As Long, Y As Long, clrColor As Long)\r
-'\r
-' or\r
-'\r
-' Function GetPixelProc (ByVal value As any_type, X As Long, Y As Long) As Long\r
-' Sub SetPixelProc (ByVal value As any_type, X As Long, Y As Long, clrColor As Long)\r
-'\r
-' Replace "any_type" with whatever type you want.  This parameter gets the data from\r
-' DrawGrp's hdcDest parameter.  You can either pass a number to DrawGrp and use the\r
-' "ByVal" versions of the above functions, or you can use AddressOf to get a reference\r
-' to a variable and use it for the "ByRef" versions.\r
-' GetPixelProc should return an RGB color value.\r
-Declare Sub SetFunctionGetPixel Lib "Grpapi.dll" (lpGetPixelProc As Long)\r
-Declare Sub SetFunctionSetPixel Lib "Grpapi.dll" (lpSetPixelProc As Long)\r
-\r
-' Call this to make a different Storm.dll-compatible MPQ library be used (like SFMPQ).\r
-Declare Function SetMpqDll Lib "Grpapi.dll" (ByVal lpDllFileName As String) As Boolean\r
-\r
-' These no longer need to be called\r
-Declare Function LoadGrpApi Lib "Grpapi.dll" () As Boolean\r
-Declare Sub FreeGrpApi Lib "Grpapi.dll" ()\r
+Attribute VB_Name = "GrpApi"
+Option Explicit
+
+'  ShadowFlare GRP Library. (c) ShadowFlare Software 2002-2006
+
+'  Any comments or suggestions are accepted at blakflare@hotmail.com (ShadowFlare)
+
+Type GRPHEADER
+    nFrames As Integer
+    wMaxWidth As Integer
+    wMaxHeight As Integer
+End Type
+
+Public Const HORIZONTAL_FLIP As Long = &H1& ' Flips the graphic horizontally
+Public Const VERTICAL_FLIP   As Long = &H2& ' Flips the graphic vertically
+Public Const SHADOW_COLOR    As Long = &H4& ' Causes the graphic to be drawn in one color
+                                            ' Second byte of flags is the red component of
+                                            ' the shadow's color, third byte is green,
+                                            ' fourth byte is blue; like this:
+                                            ' 'SHADOW_COLOR Or &HBBGGRR00'
+Public Const ALPHA_BLEND     As Long = &H8& ' Blends the graphic with what it is being drawn over.
+                                            ' The dwAlpha parameter will only be used when this
+                                            ' flag is specified.  dwAlpha is an RGB value
+                                            ' (&HBBGGRR).
+                                            ' Note: Because of the extra calculations required,
+                                            ' alpha blended graphics take longer to draw
+Public Const USE_INDEX      As Long = &H10& ' Only valid when used with a custom SetPixel function.
+                                            ' This flag cannot be used in combination with
+                                            ' ALPHA_BLEND or SHADOW_COLOR
+                                            ' When this flag is used, the index to a color in the
+                                            ' palette will be passed to your custom SetPixel
+                                            ' function instead of the actual color.
+
+' Palette is an array of 256 Longs.  Pass the first element of the array to these functions,
+' rather than the actual array
+' For LoadPalette and LoadGrp, lpFileName may be a file in an open mpq archive
+' or a file not in an archive
+Declare Function LoadPalette Lib "Grpapi.dll" (ByVal lpFileName As String, dwPalette As Long) As Boolean
+Declare Function LoadGrp Lib "Grpapi.dll" (ByVal lpFileName As String) As Long
+Declare Function DestroyGrp Lib "Grpapi.dll" (ByVal hGrp As Long) As Boolean
+Declare Function DrawGrp Lib "Grpapi.dll" (ByVal hGrp As Long, ByVal hdcDest As Long, ByVal nXDest As Long, ByVal nYDest As Long, ByVal nFrame As Integer, dwPalette As Long, ByVal dwFlags As Long, ByVal dwAlpha As Long) As Boolean
+Declare Function GetGrpInfo Lib "Grpapi.dll" (ByVal hGrp As Long, GrpInfo As GRPHEADER) As Boolean
+Declare Function GetGrpFrameInfo Lib "Grpapi.dll" (ByVal hGrp As Long, ByVal nFrame As Integer, ByRef nLeft As Long, ByRef nTop As Long, ByRef nWidth As Long, ByRef nHeight As Long) As Boolean
+
+Declare Function GetDC Lib "User32.dll" (ByVal hWnd As Long) As Long
+Declare Function ReleaseDC Lib "User32.dll" (ByVal hWnd As Long, ByVal hDC As Long) As Long
+
+' An array of the raw image data to encode should be passed to lpImageData.  To do this,
+' pass the first byte of the array to the function.  The size of the buffer containing
+' the data should be nFrames * wMaxWidth * wMaxHeight * 2
+' and the values should be arranged row by row of the frame, with the top row first.
+' After all the rows of a frame have been put into the buffer, the rows of the next frame
+' go after it.  For transparent pixels, they should be set to -1.  All other pixels should
+' have the high order byte set to zero, meaning that they should not be negative and the
+' values should not exceed 255 (&HFF).  The values used for the colors are indexes into the
+' color palette.
+' Pass True to bNoCompress if you need an uncompressed GRP.
+' Pass a variable to nGrpSize to receive the size in bytes of the resulting encoded GRP.
+' The return value of this function is actually a pointer to the GRP data.  This is what your
+' program should save to a file.  The size of this buffer is the value received by nGrpSize.
+' 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.
+Declare Function CreateGrp Lib "Grpapi.dll" (ByRef lpImageData As Integer, ByVal nFrames As Integer, ByVal wMaxWidth As Integer, ByVal wMaxHeight As Integer, ByVal bNoCompress As Boolean, ByRef nGrpSize As Long) As Long
+
+' Use this function to make a copy the memory at the location returned by CreateGrp.
+' Pass the address ByVal to Source.  Pass either a byte array or a string to Destination.
+' The size of the array or string must be at least the size of the GRP data before
+' attempting to copy it to the array or string.
+' To pass a byte array, pass the first byte of the array ByRef.  To pass a string,
+' pass the string ByVal.
+Declare Sub CopyMemory Lib "Kernel32.dll" _
+    Alias "RtlMoveMemory" ( _
+    ByRef Destination As Any, _
+    ByRef Source As Any, _
+    ByVal Length As Long)
+
+' 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.
+' Requires Visual Basic 5 or higher
+'
+' 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)
+'
+' 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)
+'
+' 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.
+' 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)
+
+' Call this to make a different Storm.dll-compatible MPQ library be used (like SFMPQ).
+Declare Function SetMpqDll Lib "Grpapi.dll" (ByVal lpDllFileName As String) As Boolean
+
+' These no longer need to be called
+Declare Function LoadGrpApi Lib "Grpapi.dll" () As Boolean
+Declare Sub FreeGrpApi Lib "Grpapi.dll" ()
index 5e7cc77..79cbf64 100644 (file)
@@ -1,17 +1,17 @@
-/*\r
-\r
-  ShadowFlare GRP Static Library. (c) ShadowFlare Software 2002\r
-\r
-*/\r
-\r
-#ifndef GRPLIB_INCLUDED\r
-#define GRPLIB_INCLUDED\r
-\r
-#ifndef GRPAPI_STATIC\r
-#define GRPAPI_STATIC\r
-#endif\r
-\r
-#include "grpapi.h"\r
-\r
-#endif\r
-\r
+/*
+
+  ShadowFlare GRP Static Library. (c) ShadowFlare Software 2002
+
+*/
+
+#ifndef GRPLIB_INCLUDED
+#define GRPLIB_INCLUDED
+
+#ifndef GRPAPI_STATIC
+#define GRPAPI_STATIC
+#endif
+
+#include "grpapi.h"
+
+#endif
+
index b002e12..ad088c3 100644 (file)
-#include "grpapi.h"\r
-#include "../LoadStorm/storm.h"\r
-#include <malloc.h>\r
-\r
-#ifdef GRPAPI_STATIC\r
-#define DllMain GrpMain\r
-\r
-#include "grp_static.h"\r
-\r
-struct GRPLIBMODULE {\r
-       GRPLIBMODULE();\r
-       ~GRPLIBMODULE();\r
-} GrpLib;\r
-\r
-BOOL APIENTRY DllMain(HINSTANCE hInstDLL, DWORD  ul_reason_for_call, LPVOID lpReserved);\r
-\r
-GRPLIBMODULE::GRPLIBMODULE()\r
-{\r
-       GrpMain(0,DLL_PROCESS_ATTACH,0);\r
-}\r
-\r
-GRPLIBMODULE::~GRPLIBMODULE()\r
-{\r
-       GrpMain(0,DLL_PROCESS_DETACH,0);\r
-}\r
-\r
-#endif\r
-\r
-typedef struct {\r
-       BYTE Left;\r
-       BYTE Top;\r
-       BYTE Width;\r
-       BYTE Height;\r
-       DWORD Offset;\r
-} FRAMEHEADER;\r
-\r
-typedef struct {\r
-       WORD *lpRowOffsets;\r
-       WORD *lpRowSizes;\r
-       LPBYTE *lpRowData;\r
-       DWORD Size;\r
-} FRAMEDATA;\r
-\r
-GETPIXELPROC MyGetPixel = GetPixel;\r
-SETPIXELPROC MySetPixel = (SETPIXELPROC)SetPixelV;\r
-\r
-void __inline SetPix(HDC hDC, int X, int Y, COLORREF clrColor, DWORD *dwPalette, DWORD dwFlags, DWORD dwAlpha);\r
-void EncodeFrameData(signed short *lpImageData, WORD nFrame, GRPHEADER *lpGrpHeader, FRAMEHEADER *lpFrameHeader, FRAMEDATA *lpFrameData, BOOL bNoCompress);\r
-BOOL VerifyRow(signed short *lpRawRow, int nWidth, LPBYTE lpEncRow, int nSize, BOOL bNoCompress);\r
-\r
-extern HINSTANCE hStorm;\r
-\r
-BOOL APIENTRY DllMain( HINSTANCE hInstDLL, \r
-                       DWORD  ul_reason_for_call, \r
-                       LPVOID lpReserved\r
-                                        )\r
-{\r
-    switch (ul_reason_for_call)\r
-       {\r
-               case DLL_PROCESS_ATTACH:\r
-                       break;\r
-               case DLL_THREAD_ATTACH:\r
-                       break;\r
-               case DLL_THREAD_DETACH:\r
-                       break;\r
-               case DLL_PROCESS_DETACH:\r
-                       break;\r
-    }\r
-\r
-    return TRUE;\r
-}\r
-\r
-BOOL GRPAPI WINAPI LoadGrpApi()\r
-{\r
-       if (!hStorm) return FALSE;\r
-       else return TRUE;\r
-}\r
-\r
-void GRPAPI WINAPI FreeGrpApi()\r
-{\r
-}\r
-\r
-/*\r
-HANDLE hProcessHeap = NULL;\r
-\r
-void * SFAlloc(size_t nSize)\r
-{\r
-       if (!hProcessHeap) hProcessHeap = GetProcessHeap();\r
-       if (hProcessHeap) return HeapAlloc(hProcessHeap, 0, nSize);\r
-       else return NULL;\r
-}\r
-\r
-void SFFree(void *lpMem)\r
-{\r
-       if (!hProcessHeap) hProcessHeap = GetProcessHeap();\r
-       if (hProcessHeap) HeapFree(hProcessHeap, 0, lpMem);\r
-}\r
-*/\r
-\r
-BOOL GRPAPI WINAPI SetMpqDll(LPCSTR lpDllFileName)\r
-{\r
-       if (LoadStorm((char *)lpDllFileName)) return TRUE;\r
-       else return FALSE;\r
-}\r
-\r
-BOOL GRPAPI WINAPI LoadPalette(LPCSTR lpFileName, DWORD *dwPaletteBuffer)\r
-{\r
-       if (!lpFileName || !dwPaletteBuffer) return FALSE;\r
-       HANDLE hFile;\r
-       if (SFileOpenFileEx && SFileGetFileSize\r
-        && SFileSetFilePointer && SFileReadFile\r
-        && SFileCloseFile) {\r
-               if (!SFileOpenFileEx(0,lpFileName,1,&hFile)) return FALSE;\r
-               DWORD fsz = SFileGetFileSize(hFile,0);\r
-               SFileSetFilePointer(hFile,0,0,FILE_BEGIN);\r
-               if (fsz>=1024) {\r
-                       memset(dwPaletteBuffer,0,1024);\r
-                       SFileReadFile(hFile,dwPaletteBuffer,1024,0,0);\r
-               }\r
-               else if (fsz==768) {\r
-                       char *buffer = (char *)_alloca(768);\r
-                       memset(buffer,0,768);\r
-                       SFileReadFile(hFile,buffer,768,0,0);\r
-                       for (DWORD i=0;i<256;i++) {\r
-                               memcpy(&dwPaletteBuffer[i],buffer+i*3,3);\r
-                               *(((char *)&dwPaletteBuffer[i])+3) = 0;\r
-                       }\r
-               }\r
-               else {\r
-                       memset(dwPaletteBuffer,0,1024);\r
-                       SFileReadFile(hFile,dwPaletteBuffer,fsz,0,0);\r
-               }\r
-               SFileCloseFile(hFile);\r
-       }\r
-       else {\r
-               hFile = CreateFile(lpFileName,GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,0,0);\r
-               if (hFile==INVALID_HANDLE_VALUE) return FALSE;\r
-               DWORD fsz = GetFileSize(hFile,0),tsz;\r
-               SetFilePointer(hFile,0,0,FILE_BEGIN);\r
-               if (fsz>=1024) {\r
-                       memset(dwPaletteBuffer,0,1024);\r
-                       ReadFile(hFile,dwPaletteBuffer,1024,&tsz,0);\r
-               }\r
-               else if (fsz==768) {\r
-                       char *buffer = (char *)_alloca(768);\r
-                       memset(buffer,0,768);\r
-                       ReadFile(hFile,buffer,768,&tsz,0);\r
-                       for (DWORD i=0;i<256;i++) {\r
-                               memcpy(&dwPaletteBuffer[i],buffer+i*3,3);\r
-                               *(((char *)&dwPaletteBuffer[i])+3) = 0;\r
-                       }\r
-               }\r
-               else {\r
-                       memset(dwPaletteBuffer,0,1024);\r
-                       ReadFile(hFile,dwPaletteBuffer,fsz,&tsz,0);\r
-               }\r
-               CloseHandle(hFile);\r
-       }\r
-       return TRUE;\r
-}\r
-\r
-HANDLE GRPAPI WINAPI LoadGrp(LPCSTR lpFileName)\r
-{\r
-       if (!lpFileName) return (HANDLE)-1;\r
-       HANDLE hFile;\r
-       char *GrpFile;\r
-       if (SFileOpenFileEx && SFileGetFileSize\r
-        && SFileSetFilePointer && SFileReadFile\r
-        && SFileCloseFile) {\r
-               if (!SFileOpenFileEx(0,lpFileName,1,&hFile)) return (HANDLE)-1;\r
-               DWORD fsz = SFileGetFileSize(hFile,0);\r
-               if (fsz<6) {\r
-                       SFileCloseFile(hFile);\r
-                       return (HANDLE)-1;\r
-               }\r
-               GrpFile = (char *)malloc(fsz);\r
-               if (GrpFile) {\r
-                       SFileSetFilePointer(hFile,0,0,FILE_BEGIN);\r
-                       SFileReadFile(hFile,GrpFile,fsz,0,0);\r
-               }\r
-               else GrpFile=(char *)-1;\r
-               SFileCloseFile(hFile);\r
-       }\r
-       else {\r
-               hFile = CreateFile(lpFileName,GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,0,0);\r
-               if (hFile==INVALID_HANDLE_VALUE) return (HANDLE)-1;\r
-               DWORD fsz = GetFileSize(hFile,0),tsz;\r
-               if (fsz<6) {\r
-                       CloseHandle(hFile);\r
-                       return (HANDLE)-1;\r
-               }\r
-               GrpFile = (char *)malloc(fsz);\r
-               if (GrpFile) {\r
-                       SetFilePointer(hFile,0,0,FILE_BEGIN);\r
-                       ReadFile(hFile,GrpFile,fsz,&tsz,0);\r
-               }\r
-               else GrpFile=(char *)-1;\r
-               CloseHandle(hFile);\r
-       }\r
-       return (HANDLE)GrpFile;\r
-}\r
-\r
-BOOL GRPAPI WINAPI DestroyGrp(HANDLE hGrp)\r
-{\r
-       if (!hGrp || hGrp==INVALID_HANDLE_VALUE) return FALSE;\r
-       free(hGrp);\r
-       return TRUE;\r
-}\r
-\r
-BOOL GRPAPI WINAPI DrawGrp(HANDLE hGrp, HDC hdcDest, int nXDest, int nYDest, WORD nFrame, DWORD *dwPalette, DWORD dwFlags, DWORD dwAlpha)\r
-{\r
-       if (!hGrp || hGrp==INVALID_HANDLE_VALUE || hdcDest==0 || (!dwPalette && !(dwFlags&USE_INDEX))) return FALSE;\r
-       GRPHEADER *GrpFile = (GRPHEADER *)hGrp;\r
-       nFrame %= GrpFile->nFrames;\r
-       FRAMEHEADER *GrpFrame = &((FRAMEHEADER *)(((char *)GrpFile)+6))[nFrame];\r
-       FRAMEHEADER *GrpFrames = &((FRAMEHEADER *)(((char *)GrpFile)+6))[0];\r
-       int FrameSize = 0xFFFFFF;\r
-       DWORD Right,Bottom;\r
-       if (dwFlags&HORIZONTAL_FLIP) Right = nXDest+GrpFile->wMaxWidth-1-GrpFrame->Left;\r
-       if (dwFlags&VERTICAL_FLIP) Bottom = nYDest+GrpFile->wMaxHeight-1-GrpFrame->Top;\r
-       nXDest += GrpFrame->Left;\r
-       nYDest += GrpFrame->Top;\r
-       WORD *GrpOffsets = ((WORD *)(((char *)GrpFile)+GrpFrame->Offset));\r
-       BYTE *GrpRaw = (BYTE *)GrpOffsets;\r
-       BYTE *RowData;\r
-       WORD x,ofs;\r
-       DWORD y, nMaxOffset = 0;\r
-       WORD i;\r
-       int j, nFirstNonBlankFrame = 0;\r
-       for (i = 0; i < GrpFile->nFrames; i++) {\r
-               j = GrpFrames[i].Offset - GrpFrame->Offset;\r
-               if (j > 0 && j < FrameSize)\r
-                       FrameSize = j;\r
-               if (GrpFrames[i].Offset > nMaxOffset)\r
-                       nMaxOffset = GrpFrames[i].Offset;\r
-       }\r
-       if (FrameSize == 0xFFFFFF || FrameSize == GrpFrame->Width * GrpFrame->Height) {\r
-               FrameSize = 0xFFFFFF;\r
-               for (i = 0; i < GrpFile->nFrames; i++) {\r
-                       if (GrpFrames[i].Width != 0 && GrpFrames[i].Height != 0 && GrpFrames[i].Offset != GrpFrame->Offset && GrpFrames[i].Offset != nMaxOffset) {\r
-                               nFirstNonBlankFrame = i;\r
-                               break;\r
-                       }\r
-               }\r
-               if (i == GrpFile->nFrames)\r
-                       nFirstNonBlankFrame = nFrame;\r
-\r
-               for (i = 0; i < GrpFile->nFrames; i++) {\r
-                       j = GrpFrames[i].Offset - GrpFrames[nFirstNonBlankFrame].Offset;\r
-                       if (j > 0 && j < FrameSize)\r
-                               FrameSize = j;\r
-               }\r
-               if (FrameSize == GrpFrames[nFirstNonBlankFrame].Width * GrpFrames[nFirstNonBlankFrame].Height)\r
-                       FrameSize = GrpFrame->Width * GrpFrame->Height;\r
-       }\r
-       if (!(dwFlags&HORIZONTAL_FLIP) && !(dwFlags&VERTICAL_FLIP)) {\r
-               if (FrameSize != GrpFrame->Width * GrpFrame->Height) {\r
-                       for (y=0;y<GrpFrame->Height;y++) {\r
-                               RowData = ((BYTE *)(((char *)GrpOffsets)+GrpOffsets[y]));\r
-                               x=0; ofs=0;\r
-                               while (x<GrpFrame->Width) {\r
-                                       if (!(RowData[ofs] & 0x80)) {\r
-                                               if (!(RowData[ofs] & 0x40)) {\r
-                                                       for (i=1;i<=RowData[ofs] && x<GrpFrame->Width;i++) {\r
-                                                               SetPix(hdcDest,nXDest+x,nYDest+y,RowData[ofs+i],dwPalette,dwFlags,dwAlpha);\r
-                                                               x++;\r
-                                                       }\r
-                                                       ofs+=RowData[ofs]+1;\r
-                                               }\r
-                                               else {\r
-                                                       for (i=0;i<RowData[ofs]-64 && x<GrpFrame->Width;i++) {\r
-                                                               SetPix(hdcDest,nXDest+x,nYDest+y,RowData[ofs+1],dwPalette,dwFlags,dwAlpha);\r
-                                                               x++;\r
-                                                       }\r
-                                                       ofs+=2;\r
-                                               }\r
-                                       }\r
-                                       else {\r
-                                               x+=RowData[ofs]-128;\r
-                                               ofs++;\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-               else {\r
-                       for (y=0;y<GrpFrame->Height;y++) {\r
-                               for (x=0;x<GrpFrame->Width;x++) {\r
-                                       SetPix(hdcDest,nXDest+x,nYDest+y,GrpRaw[y * GrpFrame->Width + x],dwPalette,dwFlags,dwAlpha);\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-       else if (dwFlags&HORIZONTAL_FLIP && !(dwFlags&VERTICAL_FLIP)) {\r
-               if (FrameSize != GrpFrame->Width * GrpFrame->Height) {\r
-                       for (y=0;y<GrpFrame->Height;y++) {\r
-                               RowData = ((BYTE *)(((char *)GrpOffsets)+GrpOffsets[y]));\r
-                               x=0; ofs=0;\r
-                               while (x<GrpFrame->Width) {\r
-                                       if (!(RowData[ofs] & 0x80)) {\r
-                                               if (!(RowData[ofs] & 0x40)) {\r
-                                                       for (i=1;i<=RowData[ofs] && x<GrpFrame->Width;i++) {\r
-                                                               SetPix(hdcDest,Right-x,nYDest+y,RowData[ofs+i],dwPalette,dwFlags,dwAlpha);\r
-                                                               x++;\r
-                                                       }\r
-                                                       ofs+=RowData[ofs]+1;\r
-                                               }\r
-                                               else {\r
-                                                       for (i=0;i<RowData[ofs]-64 && x<GrpFrame->Width;i++) {\r
-                                                               SetPix(hdcDest,Right-x,nYDest+y,RowData[ofs+1],dwPalette,dwFlags,dwAlpha);\r
-                                                               x++;\r
-                                                       }\r
-                                                       ofs+=2;\r
-                                               }\r
-                                       }\r
-                                       else {\r
-                                               x+=RowData[ofs]-128;\r
-                                               ofs++;\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-               else {\r
-                       for (y=0;y<GrpFrame->Height;y++) {\r
-                               for (x=0;x<GrpFrame->Width;x++) {\r
-                                       SetPix(hdcDest,Right-x,nYDest+y,GrpRaw[y * GrpFrame->Width + x],dwPalette,dwFlags,dwAlpha);\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-       else if (!(dwFlags&HORIZONTAL_FLIP) && dwFlags&VERTICAL_FLIP) {\r
-               if (FrameSize != GrpFrame->Width * GrpFrame->Height) {\r
-                       for (y=0;y<GrpFrame->Height;y++) {\r
-                               RowData = ((BYTE *)(((char *)GrpOffsets)+GrpOffsets[y]));\r
-                               x=0; ofs=0;\r
-                               while (x<GrpFrame->Width) {\r
-                                       if (!(RowData[ofs] & 0x80)) {\r
-                                               if (!(RowData[ofs] & 0x40)) {\r
-                                                       for (i=1;i<=RowData[ofs] && x<GrpFrame->Width;i++) {\r
-                                                               SetPix(hdcDest,nXDest+x,Bottom-y,RowData[ofs+i],dwPalette,dwFlags,dwAlpha);\r
-                                                               x++;\r
-                                                       }\r
-                                                       ofs+=RowData[ofs]+1;\r
-                                               }\r
-                                               else {\r
-                                                       for (i=0;i<RowData[ofs]-64 && x<GrpFrame->Width;i++) {\r
-                                                               SetPix(hdcDest,nXDest+x,Bottom-y,RowData[ofs+1],dwPalette,dwFlags,dwAlpha);\r
-                                                               x++;\r
-                                                       }\r
-                                                       ofs+=2;\r
-                                               }\r
-                                       }\r
-                                       else {\r
-                                               x+=RowData[ofs]-128;\r
-                                               ofs++;\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-               else {\r
-                       for (y=0;y<GrpFrame->Height;y++) {\r
-                               for (x=0;x<GrpFrame->Width;x++) {\r
-                                       SetPix(hdcDest,nXDest+x,Bottom-y,GrpRaw[y * GrpFrame->Width + x],dwPalette,dwFlags,dwAlpha);\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-       else {\r
-               if (FrameSize != GrpFrame->Width * GrpFrame->Height) {\r
-                       for (y=0;y<GrpFrame->Height;y++) {\r
-                               RowData = ((BYTE *)(((char *)GrpOffsets)+GrpOffsets[y]));\r
-                               x=0; ofs=0;\r
-                               while (x<GrpFrame->Width) {\r
-                                       if (!(RowData[ofs] & 0x80)) {\r
-                                               if (!(RowData[ofs] & 0x40)) {\r
-                                                       for (i=1;i<=RowData[ofs] && x<GrpFrame->Width;i++) {\r
-                                                               SetPix(hdcDest,Right-x,Bottom-y,RowData[ofs+i],dwPalette,dwFlags,dwAlpha);\r
-                                                               x++;\r
-                                                       }\r
-                                                       ofs+=RowData[ofs]+1;\r
-                                               }\r
-                                               else {\r
-                                                       for (i=0;i<RowData[ofs]-64 && x<GrpFrame->Width;i++) {\r
-                                                               SetPix(hdcDest,Right-x,Bottom-y,RowData[ofs+1],dwPalette,dwFlags,dwAlpha);\r
-                                                               x++;\r
-                                                       }\r
-                                                       ofs+=2;\r
-                                               }\r
-                                       }\r
-                                       else {\r
-                                               x+=RowData[ofs]-128;\r
-                                               ofs++;\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-               else {\r
-                       for (y=0;y<GrpFrame->Height;y++) {\r
-                               for (x=0;x<GrpFrame->Width;x++) {\r
-                                       SetPix(hdcDest,Right-x,Bottom-y,GrpRaw[y * GrpFrame->Width + x],dwPalette,dwFlags,dwAlpha);\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-       return TRUE;\r
-}\r
-\r
-BOOL GRPAPI WINAPI GetGrpInfo(HANDLE hGrp, GRPHEADER *GrpInfo)\r
-{\r
-       if (!hGrp || hGrp==INVALID_HANDLE_VALUE || !GrpInfo) return FALSE;\r
-       memcpy(GrpInfo,hGrp,6);\r
-       return TRUE;\r
-}\r
-\r
-BOOL GRPAPI WINAPI GetGrpFrameInfo(HANDLE hGrp, WORD nFrame, DWORD *nLeft, DWORD *nTop, DWORD *nWidth, DWORD *nHeight)\r
-{\r
-       if (!hGrp || hGrp==INVALID_HANDLE_VALUE) return FALSE;\r
-       FRAMEHEADER *GrpFrame = &((FRAMEHEADER *)(((char *)hGrp)+6))[nFrame];\r
-\r
-       if (nLeft) *nLeft = GrpFrame->Left;\r
-       if (nTop) *nTop = GrpFrame->Top;\r
-       if (nWidth) *nWidth = GrpFrame->Width;\r
-       if (nHeight) *nHeight = GrpFrame->Height;\r
-\r
-       return TRUE;\r
-}\r
-\r
-void GRPAPI WINAPI SetFunctionGetPixel(GETPIXELPROC lpGetPixelProc)\r
-{\r
-       if (!lpGetPixelProc)\r
-               MyGetPixel = GetPixel;\r
-       else\r
-               MyGetPixel = lpGetPixelProc;\r
-}\r
-\r
-void GRPAPI WINAPI SetFunctionSetPixel(SETPIXELPROC lpSetPixelProc)\r
-{\r
-       if (!lpSetPixelProc)\r
-               MySetPixel = (SETPIXELPROC)SetPixelV;\r
-       else\r
-               MySetPixel = lpSetPixelProc;\r
-}\r
-\r
-void __inline SetPix(HDC hDC, int X, int Y, COLORREF clrColor, DWORD *dwPalette, DWORD dwFlags, DWORD dwAlpha)\r
-{\r
-       if (!(dwFlags&USE_INDEX)) {\r
-               if (dwFlags&SHADOW_COLOR) {\r
-                       clrColor = (dwFlags >> 8) & 0x00FFFFFF;\r
-               }\r
-               else {\r
-                       clrColor = dwPalette[clrColor];\r
-               }\r
-               if (dwFlags&ALPHA_BLEND) {\r
-                       DWORD dwColor = MyGetPixel(hDC,X,Y);\r
-\r
-                       // Old alpha\r
-                       /*((BYTE *)&dwColor)[0]*=1-((float)((BYTE *)&dwAlpha)[0]/256);\r
-                       ((BYTE *)&dwColor)[1]*=1-((float)((BYTE *)&dwAlpha)[1]/256);\r
-                       ((BYTE *)&dwColor)[2]*=1-((float)((BYTE *)&dwAlpha)[2]/256);\r
-                       ((BYTE *)&clrColor)[0]*=(float)((BYTE *)&dwAlpha)[0]/256;\r
-                       ((BYTE *)&clrColor)[1]*=(float)((BYTE *)&dwAlpha)[1]/256;\r
-                       ((BYTE *)&clrColor)[2]*=(float)((BYTE *)&dwAlpha)[2]/256;\r
-                       ((BYTE *)&clrColor)[0]+=((BYTE *)&dwColor)[0];\r
-                       ((BYTE *)&clrColor)[1]+=((BYTE *)&dwColor)[1];\r
-                       ((BYTE *)&clrColor)[2]+=((BYTE *)&dwColor)[2];*/\r
-\r
-                       /* blendedcolor =\r
-                                ( ( forecolor * ( 1 - alpha ) ) >> 8 )\r
-                          + ( ( backcolor * ( 256 - alpha ) ) >> 8 ) */\r
-                       ((BYTE *)&clrColor)[0] =\r
-                               ( ( ((BYTE *)&clrColor)[0] * ( ((BYTE *)&dwAlpha)[0] + 1 ) ) >> 8 )\r
-                               + ( ( ((BYTE *)&dwColor)[0] * ( 256 - ((BYTE *)&dwAlpha)[0] ) ) >> 8 );\r
-                       ((BYTE *)&clrColor)[1] =\r
-                               ( ( ((BYTE *)&clrColor)[1] * ( ((BYTE *)&dwAlpha)[1] + 1 ) ) >> 8 )\r
-                               + ( ( ((BYTE *)&dwColor)[1] * ( 256 - ((BYTE *)&dwAlpha)[1] ) ) >> 8 );\r
-                       ((BYTE *)&clrColor)[2] =\r
-                               ( ( ((BYTE *)&clrColor)[2] * ( ((BYTE *)&dwAlpha)[2] + 1 ) ) >> 8 )\r
-                               + ( ( ((BYTE *)&dwColor)[2] * ( 256 - ((BYTE *)&dwAlpha)[2] ) ) >> 8 );\r
-               }\r
-       }\r
-       MySetPixel(hDC,X,Y,clrColor);\r
-}\r
-\r
-HANDLE GRPAPI WINAPI CreateGrp(signed short *lpImageData, WORD nFrames, WORD wMaxWidth, WORD wMaxHeight, BOOL bNoCompress, DWORD *nGrpSize)\r
-{\r
-       GRPHEADER GrpHeader;\r
-       FRAMEHEADER *lpFrameHeaders;\r
-       FRAMEDATA *lpFrameData;\r
-       LPBYTE lpGrpData;\r
-       int i, j, x, y, x1, x2, y1, y2;\r
-       DWORD nLastOffset;\r
-\r
-       if (!lpImageData || !nGrpSize) return (HANDLE)-1;\r
-\r
-       GrpHeader.nFrames = nFrames;\r
-       GrpHeader.wMaxWidth = wMaxWidth;\r
-       GrpHeader.wMaxHeight = wMaxHeight;\r
-       lpFrameHeaders = (FRAMEHEADER *)malloc(nFrames * sizeof(FRAMEHEADER));\r
-       lpFrameData = (FRAMEDATA *)malloc(nFrames * sizeof(FRAMEDATA));\r
-       nLastOffset = sizeof(GRPHEADER) + nFrames * sizeof(FRAMEHEADER);\r
-\r
-       for (i = 0; i < nFrames; i++) {\r
-               lpFrameHeaders[i].Offset = nLastOffset;\r
-\r
-               // Scan frame to find dimensions of used part\r
-               x1 = y1 = 0x10000;\r
-               x2 = y2 = -1;\r
-               for (y = 0; y < wMaxHeight; y++) {\r
-                       for (x = 0; x < wMaxWidth; x++) {\r
-                               if (lpImageData[i * wMaxWidth * wMaxHeight + y * wMaxWidth + x] >= 0) {\r
-                                       if (x < x1) x1 = x;\r
-                                       if (x > x2) x2 = x;\r
-                                       if (y < y1) y1 = y;\r
-                                       if (y > y2) y2 = y;\r
-                               }\r
-                       }\r
-               }\r
-               x2 = x2 - x1 + 1;\r
-               y2 = y2 - y1 + 1;\r
-               if ((WORD)x1 > 255) x1 = 255;\r
-               if ((WORD)y1 > 255) y1 = 255;\r
-               if ((WORD)x2 > 255) x2 = 255;\r
-               if ((WORD)y2 > 255) y2 = 255;\r
-               lpFrameHeaders[i].Left = x1;\r
-               lpFrameHeaders[i].Top = y1;\r
-               lpFrameHeaders[i].Width = x2;\r
-               lpFrameHeaders[i].Height = y2;\r
-\r
-               // Search for duplicate frames\r
-               for (j = 0; j < i; j++) {\r
-                       if (lpFrameData[j].lpRowOffsets && lpFrameHeaders[i].Width == lpFrameHeaders[j].Width && lpFrameHeaders[i].Height == lpFrameHeaders[j].Height) {\r
-                               y1 = i * wMaxWidth * wMaxHeight + lpFrameHeaders[i].Top * wMaxWidth + lpFrameHeaders[i].Left;\r
-                               y2 = j * wMaxWidth * wMaxHeight + lpFrameHeaders[j].Top * wMaxWidth + lpFrameHeaders[j].Left;\r
-\r
-                               for (y = 0; y < lpFrameHeaders[i].Height; y++) {\r
-                                       if (memcmp(&lpImageData[y1], &lpImageData[y2], lpFrameHeaders[i].Width * sizeof(short)) != 0)\r
-                                               break;\r
-\r
-                                       y1 += wMaxWidth;\r
-                                       y2 += wMaxWidth;\r
-                               }\r
-\r
-                               if (y == lpFrameHeaders[i].Height) {\r
-                                       break;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               if (j < i) {\r
-                       // Duplicate frame found, set offset and flag as duplicate\r
-                       lpFrameHeaders[i].Offset = lpFrameHeaders[j].Offset;\r
-                       lpFrameData[i].lpRowOffsets = 0;\r
-                       lpFrameData[i].lpRowSizes = 0;\r
-                       lpFrameData[i].lpRowData = 0;\r
-                       lpFrameData[i].Size = 0;\r
-                       continue;\r
-               }\r
-\r
-               EncodeFrameData(lpImageData, i, &GrpHeader, &lpFrameHeaders[i], &lpFrameData[i], bNoCompress);\r
-               nLastOffset = lpFrameHeaders[i].Offset + lpFrameData[i].Size;\r
-       }\r
-\r
-       lpGrpData = (LPBYTE)malloc(nLastOffset);\r
-\r
-       // Write completed GRP to buffer\r
-       memcpy(lpGrpData, &GrpHeader, sizeof(GRPHEADER));\r
-       memcpy(lpGrpData + sizeof(GRPHEADER), lpFrameHeaders, nFrames * sizeof(FRAMEHEADER));\r
-\r
-       for (i = 0; i < nFrames; i++) {\r
-               if (lpFrameData[i].lpRowOffsets) {\r
-                       if (!bNoCompress)\r
-                               memcpy(lpGrpData + lpFrameHeaders[i].Offset, lpFrameData[i].lpRowOffsets, lpFrameHeaders[i].Height * sizeof(WORD));\r
-\r
-                       for (y = 0; y < lpFrameHeaders[i].Height; y++) {\r
-                               if (lpFrameData[i].lpRowData[y]) {\r
-                                       memcpy(lpGrpData + lpFrameHeaders[i].Offset + lpFrameData[i].lpRowOffsets[y], lpFrameData[i].lpRowData[y], lpFrameData[i].lpRowSizes[y]);\r
-                                       free(lpFrameData[i].lpRowData[y]);\r
-                               }\r
-                       }\r
-\r
-                       free(lpFrameData[i].lpRowOffsets);\r
-                       free(lpFrameData[i].lpRowSizes);\r
-                       free(lpFrameData[i].lpRowData);\r
-               }\r
-       }\r
-\r
-       free(lpFrameHeaders);\r
-       free(lpFrameData);\r
-\r
-       *nGrpSize = nLastOffset;\r
-       return (HANDLE)lpGrpData;\r
-}\r
-\r
-void EncodeFrameData(signed short *lpImageData, WORD nFrame, GRPHEADER *lpGrpHeader, FRAMEHEADER *lpFrameHeader, FRAMEDATA *lpFrameData, BOOL bNoCompress)\r
-{\r
-       int x, y, i, j, nBufPos, nRepeat;\r
-       LPBYTE lpRowBuf;\r
-       WORD nLastOffset = 0;\r
-\r
-       lpFrameData->lpRowOffsets = (WORD *)malloc(lpFrameHeader->Height * sizeof(WORD));\r
-       lpFrameData->lpRowSizes = (WORD *)malloc(lpFrameHeader->Height * sizeof(WORD));\r
-       lpFrameData->lpRowData = (LPBYTE *)malloc(lpFrameHeader->Height * sizeof(LPBYTE));\r
-       lpRowBuf = (LPBYTE)malloc(lpFrameHeader->Width * 2);\r
-\r
-       if (!bNoCompress)\r
-               nLastOffset = lpFrameHeader->Height * sizeof(WORD);\r
-\r
-       for (y = 0; y < lpFrameHeader->Height; y++) {\r
-               i = nFrame * lpGrpHeader->wMaxWidth * lpGrpHeader->wMaxHeight + (lpFrameHeader->Top + y) * lpGrpHeader->wMaxWidth;\r
-\r
-               if (!bNoCompress) {\r
-                       // Search for duplicate rows\r
-                       for (x = 0; x < y; x++) {\r
-                               j = nFrame * lpGrpHeader->wMaxWidth * lpGrpHeader->wMaxHeight + (lpFrameHeader->Top + x) * lpGrpHeader->wMaxWidth;\r
-                               if (memcmp(&lpImageData[i+lpFrameHeader->Left],\r
-                                                  &lpImageData[j+lpFrameHeader->Left],\r
-                                                  lpGrpHeader->wMaxWidth * sizeof(short)) == 0)\r
-                                       break;\r
-                       }\r
-\r
-                       if (x < y) {\r
-                               lpFrameData->lpRowOffsets[y] = lpFrameData->lpRowOffsets[x];\r
-                               lpFrameData->lpRowSizes[y] = 0;\r
-                               lpFrameData->lpRowData[y] = 0;\r
-\r
-#ifdef _DEBUG\r
-                               if (!VerifyRow(&lpImageData[i+lpFrameHeader->Left], lpFrameHeader->Width, lpFrameData->lpRowData[x], lpFrameData->lpRowSizes[x], bNoCompress)) {\r
-                                       nBufPos = nBufPos;\r
-                               }\r
-#endif\r
-\r
-                               continue;\r
-                       }\r
-               }\r
-\r
-               nBufPos = 0;\r
-               if (lpFrameHeader->Width > 0) {\r
-                       for (x = lpFrameHeader->Left; x < lpFrameHeader->Left + lpFrameHeader->Width; x++) {\r
-                               if (!bNoCompress) {\r
-                                       if (x < lpFrameHeader->Left + lpFrameHeader->Width - 1) {\r
-                                               if (lpImageData[i+x] < 0) {\r
-                                                       lpRowBuf[nBufPos] = 0x80;\r
-                                                       for (; lpImageData[i+x] < 0 && x < lpFrameHeader->Left + lpFrameHeader->Width && lpRowBuf[nBufPos] < 0xFF; x++) {\r
-                                                               lpRowBuf[nBufPos]++;\r
-                                                       }\r
-                                                       x--;\r
-                                                       if (nLastOffset + nBufPos + 1 <= 0xFFFF)\r
-                                                               nBufPos++;\r
-                                                       continue;\r
-                                               }\r
-\r
-                                               // Count repeating pixels, nRepeat = number of pixels - 1, ignore if there are less than 4 duplicates\r
-                                               for (nRepeat = 0; lpImageData[i+x+nRepeat] == lpImageData[i+x+nRepeat+1] && x+nRepeat < lpFrameHeader->Left + lpFrameHeader->Width - 1 && nRepeat < 0x3E; nRepeat++) {}\r
-\r
-                                               if (nRepeat > 2) {\r
-                                                       lpRowBuf[nBufPos] = 0x41 + nRepeat;\r
-                                                       lpRowBuf[nBufPos+1] = (BYTE)(lpImageData[i+x]);\r
-                                                       x += nRepeat;\r
-                                                       if (nLastOffset + nBufPos + 2 <= 0xFFFF)\r
-                                                               nBufPos += 2;\r
-                                               }\r
-                                               else {\r
-                                                       lpRowBuf[nBufPos] = 0;\r
-                                                       for (; lpImageData[i+x] >= 0 && x < lpFrameHeader->Left + lpFrameHeader->Width && lpRowBuf[nBufPos] < 0x3F; x++) {\r
-                                                               // Count repeating pixels, ignore if there are less than 4 duplicates\r
-                                                               for (nRepeat = 0; lpImageData[i+x+nRepeat] == lpImageData[i+x+nRepeat+1] && x+nRepeat < lpFrameHeader->Left + lpFrameHeader->Width - 1 && nRepeat < 3; nRepeat++) {}\r
-                                                               if (nRepeat > 2) break;\r
-\r
-                                                               lpRowBuf[nBufPos]++;\r
-                                                               lpRowBuf[nBufPos+lpRowBuf[nBufPos]] = (BYTE)(lpImageData[i+x]);\r
-                                                       }\r
-                                                       if (lpImageData[i+x] >= 0 && x == lpFrameHeader->Left + lpFrameHeader->Width - 1 && lpRowBuf[nBufPos] < 0x3F) {\r
-                                                               lpRowBuf[nBufPos]++;\r
-                                                               lpRowBuf[nBufPos+lpRowBuf[nBufPos]] = (BYTE)(lpImageData[i+x]);\r
-                                                       }\r
-                                                       x--;\r
-                                                       if (nLastOffset + nBufPos + 1 + lpRowBuf[nBufPos] <= 0xFFFF)\r
-                                                               nBufPos += 1 + lpRowBuf[nBufPos];\r
-                                               }\r
-                                       }\r
-                                       else {\r
-                                               if (lpImageData[i+x] < 0) {\r
-                                                       lpRowBuf[nBufPos] = 0x81;\r
-                                                       if (nLastOffset + nBufPos + 1 <= 0xFFFF)\r
-                                                               nBufPos++;\r
-                                               }\r
-                                               else {\r
-                                                       lpRowBuf[nBufPos] = 1;\r
-                                                       lpRowBuf[nBufPos+1] = (BYTE)(lpImageData[i+x]);\r
-                                                       if (nLastOffset + nBufPos + 2 <= 0xFFFF)\r
-                                                               nBufPos += 2;\r
-                                               }\r
-                                       }\r
-                               }\r
-                               else {\r
-                                       lpRowBuf[nBufPos] = (BYTE)(lpImageData[i+x]);\r
-                                       if (nLastOffset + nBufPos + 1 <= 0xFFFF)\r
-                                               nBufPos++;\r
-                               }\r
-                       }\r
-               }\r
-\r
-#ifdef _DEBUG\r
-               if (!VerifyRow(&lpImageData[i+lpFrameHeader->Left], lpFrameHeader->Width, lpRowBuf, nBufPos, bNoCompress)) {\r
-                       nBufPos = nBufPos;\r
-               }\r
-#endif\r
-\r
-               lpFrameData->lpRowOffsets[y] = nLastOffset;\r
-               nLastOffset = lpFrameData->lpRowOffsets[y] + nBufPos;\r
-\r
-               lpFrameData->lpRowSizes[y] = nBufPos;\r
-               lpFrameData->lpRowData[y] = (LPBYTE)malloc(nBufPos);\r
-               memcpy(lpFrameData->lpRowData[y], lpRowBuf, nBufPos);\r
-       }\r
-\r
-       lpFrameData->Size = nLastOffset;\r
-\r
-       free(lpRowBuf);\r
-}\r
-\r
-#ifdef _DEBUG\r
-BOOL VerifyRow(signed short *lpRawRow, int nWidth, LPBYTE lpEncRow, int nSize, BOOL bNoCompress)\r
-{\r
-       int i,x=0,ofs=0;\r
-       while (x < nWidth && ofs < nSize) {\r
-               if (!bNoCompress) {\r
-                       if (!(lpEncRow[ofs] & 0x80)) {\r
-                               if (!(lpEncRow[ofs] & 0x40)) {\r
-                                       for (i=1;i<=lpEncRow[ofs] && x<nWidth;i++) {\r
-                                               if (lpEncRow[ofs+i] != (BYTE)lpRawRow[x]) return FALSE;\r
-                                               x++;\r
-                                       }\r
-                                       ofs+=lpEncRow[ofs]+1;\r
-                               }\r
-                               else {\r
-                                       for (i=0;i<lpEncRow[ofs]-64 && x<nWidth;i++) {\r
-                                               if (lpEncRow[ofs+1] != (BYTE)lpRawRow[x]) return FALSE;\r
-                                               x++;\r
-                                       }\r
-                                       ofs+=2;\r
-                               }\r
-                       }\r
-                       else {\r
-                               for (i=0;i<lpEncRow[ofs]-128 && x<nWidth;i++) {\r
-                                       if (lpRawRow[x] >= 0) return FALSE;\r
-                               }\r
-                               x+=lpEncRow[ofs]-128;\r
-                               ofs++;\r
-                       }\r
-               }\r
-               else {\r
-                       if (lpEncRow[ofs] != (BYTE)lpRawRow[x]) return FALSE;\r
-                       x++;\r
-                       ofs++;\r
-               }\r
-       }\r
-\r
-       if (x != nWidth || ofs != nSize) return FALSE;\r
-\r
-       return TRUE;\r
-}\r
-#endif\r
+#include "grpapi.h"
+#include "../LoadStorm/storm.h"
+#include <malloc.h>
+
+#ifdef GRPAPI_STATIC
+#define DllMain GrpMain
+
+#include "grp_static.h"
+
+struct GRPLIBMODULE {
+       GRPLIBMODULE();
+       ~GRPLIBMODULE();
+} GrpLib;
+
+BOOL APIENTRY DllMain(HINSTANCE hInstDLL, DWORD  ul_reason_for_call, LPVOID lpReserved);
+
+GRPLIBMODULE::GRPLIBMODULE()
+{
+       GrpMain(0,DLL_PROCESS_ATTACH,0);
+}
+
+GRPLIBMODULE::~GRPLIBMODULE()
+{
+       GrpMain(0,DLL_PROCESS_DETACH,0);
+}
+
+#endif
+
+typedef struct {
+       BYTE Left;
+       BYTE Top;
+       BYTE Width;
+       BYTE Height;
+       DWORD Offset;
+} FRAMEHEADER;
+
+typedef struct {
+       WORD *lpRowOffsets;
+       WORD *lpRowSizes;
+       LPBYTE *lpRowData;
+       DWORD Size;
+} FRAMEDATA;
+
+GETPIXELPROC MyGetPixel = GetPixel;
+SETPIXELPROC MySetPixel = (SETPIXELPROC)SetPixelV;
+
+void __inline SetPix(HDC hDC, int X, int Y, COLORREF clrColor, DWORD *dwPalette, DWORD dwFlags, DWORD dwAlpha);
+void EncodeFrameData(signed short *lpImageData, WORD nFrame, GRPHEADER *lpGrpHeader, FRAMEHEADER *lpFrameHeader, FRAMEDATA *lpFrameData, BOOL bNoCompress);
+BOOL VerifyRow(signed short *lpRawRow, int nWidth, LPBYTE lpEncRow, int nSize, BOOL bNoCompress);
+
+extern HINSTANCE hStorm;
+
+BOOL APIENTRY DllMain( HINSTANCE hInstDLL, 
+                       DWORD  ul_reason_for_call, 
+                       LPVOID lpReserved
+                                        )
+{
+    switch (ul_reason_for_call)
+       {
+               case DLL_PROCESS_ATTACH:
+                       break;
+               case DLL_THREAD_ATTACH:
+                       break;
+               case DLL_THREAD_DETACH:
+                       break;
+               case DLL_PROCESS_DETACH:
+                       break;
+    }
+
+    return TRUE;
+}
+
+BOOL GRPAPI WINAPI LoadGrpApi()
+{
+       if (!hStorm) return FALSE;
+       else return TRUE;
+}
+
+void GRPAPI WINAPI FreeGrpApi()
+{
+}
+
+/*
+HANDLE hProcessHeap = NULL;
+
+void * SFAlloc(size_t nSize)
+{
+       if (!hProcessHeap) hProcessHeap = GetProcessHeap();
+       if (hProcessHeap) return HeapAlloc(hProcessHeap, 0, nSize);
+       else return NULL;
+}
+
+void SFFree(void *lpMem)
+{
+       if (!hProcessHeap) hProcessHeap = GetProcessHeap();
+       if (hProcessHeap) HeapFree(hProcessHeap, 0, lpMem);
+}
+*/
+
+BOOL GRPAPI WINAPI SetMpqDll(LPCSTR lpDllFileName)
+{
+       if (LoadStorm((char *)lpDllFileName)) return TRUE;
+       else return FALSE;
+}
+
+BOOL GRPAPI WINAPI LoadPalette(LPCSTR lpFileName, DWORD *dwPaletteBuffer)
+{
+       if (!lpFileName || !dwPaletteBuffer) return FALSE;
+       HANDLE hFile;
+       if (SFileOpenFileEx && SFileGetFileSize
+        && SFileSetFilePointer && SFileReadFile
+        && SFileCloseFile) {
+               if (!SFileOpenFileEx(0,lpFileName,1,&hFile)) return FALSE;
+               DWORD fsz = SFileGetFileSize(hFile,0);
+               SFileSetFilePointer(hFile,0,0,FILE_BEGIN);
+               if (fsz>=1024) {
+                       memset(dwPaletteBuffer,0,1024);
+                       SFileReadFile(hFile,dwPaletteBuffer,1024,0,0);
+               }
+               else if (fsz==768) {
+                       char *buffer = (char *)_alloca(768);
+                       memset(buffer,0,768);
+                       SFileReadFile(hFile,buffer,768,0,0);
+                       for (DWORD i=0;i<256;i++) {
+                               memcpy(&dwPaletteBuffer[i],buffer+i*3,3);
+                               *(((char *)&dwPaletteBuffer[i])+3) = 0;
+                       }
+               }
+               else {
+                       memset(dwPaletteBuffer,0,1024);
+                       SFileReadFile(hFile,dwPaletteBuffer,fsz,0,0);
+               }
+               SFileCloseFile(hFile);
+       }
+       else {
+               hFile = CreateFile(lpFileName,GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,0,0);
+               if (hFile==INVALID_HANDLE_VALUE) return FALSE;
+               DWORD fsz = GetFileSize(hFile,0),tsz;
+               SetFilePointer(hFile,0,0,FILE_BEGIN);
+               if (fsz>=1024) {
+                       memset(dwPaletteBuffer,0,1024);
+                       ReadFile(hFile,dwPaletteBuffer,1024,&tsz,0);
+               }
+               else if (fsz==768) {
+                       char *buffer = (char *)_alloca(768);
+                       memset(buffer,0,768);
+                       ReadFile(hFile,buffer,768,&tsz,0);
+                       for (DWORD i=0;i<256;i++) {
+                               memcpy(&dwPaletteBuffer[i],buffer+i*3,3);
+                               *(((char *)&dwPaletteBuffer[i])+3) = 0;
+                       }
+               }
+               else {
+                       memset(dwPaletteBuffer,0,1024);
+                       ReadFile(hFile,dwPaletteBuffer,fsz,&tsz,0);
+               }
+               CloseHandle(hFile);
+       }
+       return TRUE;
+}
+
+HANDLE GRPAPI WINAPI LoadGrp(LPCSTR lpFileName)
+{
+       if (!lpFileName) return (HANDLE)-1;
+       HANDLE hFile;
+       char *GrpFile;
+       if (SFileOpenFileEx && SFileGetFileSize
+        && SFileSetFilePointer && SFileReadFile
+        && SFileCloseFile) {
+               if (!SFileOpenFileEx(0,lpFileName,1,&hFile)) return (HANDLE)-1;
+               DWORD fsz = SFileGetFileSize(hFile,0);
+               if (fsz<6) {
+                       SFileCloseFile(hFile);
+                       return (HANDLE)-1;
+               }
+               GrpFile = (char *)malloc(fsz);
+               if (GrpFile) {
+                       SFileSetFilePointer(hFile,0,0,FILE_BEGIN);
+                       SFileReadFile(hFile,GrpFile,fsz,0,0);
+               }
+               else GrpFile=(char *)-1;
+               SFileCloseFile(hFile);
+       }
+       else {
+               hFile = CreateFile(lpFileName,GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,0,0);
+               if (hFile==INVALID_HANDLE_VALUE) return (HANDLE)-1;
+               DWORD fsz = GetFileSize(hFile,0),tsz;
+               if (fsz<6) {
+                       CloseHandle(hFile);
+                       return (HANDLE)-1;
+               }
+               GrpFile = (char *)malloc(fsz);
+               if (GrpFile) {
+                       SetFilePointer(hFile,0,0,FILE_BEGIN);
+                       ReadFile(hFile,GrpFile,fsz,&tsz,0);
+               }
+               else GrpFile=(char *)-1;
+               CloseHandle(hFile);
+       }
+       return (HANDLE)GrpFile;
+}
+
+BOOL GRPAPI WINAPI DestroyGrp(HANDLE hGrp)
+{
+       if (!hGrp || hGrp==INVALID_HANDLE_VALUE) return FALSE;
+       free(hGrp);
+       return TRUE;
+}
+
+BOOL GRPAPI WINAPI DrawGrp(HANDLE hGrp, HDC hdcDest, int nXDest, int nYDest, WORD nFrame, DWORD *dwPalette, DWORD dwFlags, DWORD dwAlpha)
+{
+       if (!hGrp || hGrp==INVALID_HANDLE_VALUE || hdcDest==0 || (!dwPalette && !(dwFlags&USE_INDEX))) return FALSE;
+       GRPHEADER *GrpFile = (GRPHEADER *)hGrp;
+       nFrame %= GrpFile->nFrames;
+       FRAMEHEADER *GrpFrame = &((FRAMEHEADER *)(((char *)GrpFile)+6))[nFrame];
+       FRAMEHEADER *GrpFrames = &((FRAMEHEADER *)(((char *)GrpFile)+6))[0];
+       int FrameSize = 0xFFFFFF;
+       DWORD Right,Bottom;
+       if (dwFlags&HORIZONTAL_FLIP) Right = nXDest+GrpFile->wMaxWidth-1-GrpFrame->Left;
+       if (dwFlags&VERTICAL_FLIP) Bottom = nYDest+GrpFile->wMaxHeight-1-GrpFrame->Top;
+       nXDest += GrpFrame->Left;
+       nYDest += GrpFrame->Top;
+       WORD *GrpOffsets = ((WORD *)(((char *)GrpFile)+GrpFrame->Offset));
+       BYTE *GrpRaw = (BYTE *)GrpOffsets;
+       BYTE *RowData;
+       WORD x,ofs;
+       DWORD y, nMaxOffset = 0;
+       WORD i;
+       int j, nFirstNonBlankFrame = 0;
+       for (i = 0; i < GrpFile->nFrames; i++) {
+               j = GrpFrames[i].Offset - GrpFrame->Offset;
+               if (j > 0 && j < FrameSize)
+                       FrameSize = j;
+               if (GrpFrames[i].Offset > nMaxOffset)
+                       nMaxOffset = GrpFrames[i].Offset;
+       }
+       if (FrameSize == 0xFFFFFF || FrameSize == GrpFrame->Width * GrpFrame->Height) {
+               FrameSize = 0xFFFFFF;
+               for (i = 0; i < GrpFile->nFrames; i++) {
+                       if (GrpFrames[i].Width != 0 && GrpFrames[i].Height != 0 && GrpFrames[i].Offset != GrpFrame->Offset && GrpFrames[i].Offset != nMaxOffset) {
+                               nFirstNonBlankFrame = i;
+                               break;
+                       }
+               }
+               if (i == GrpFile->nFrames)
+                       nFirstNonBlankFrame = nFrame;
+
+               for (i = 0; i < GrpFile->nFrames; i++) {
+                       j = GrpFrames[i].Offset - GrpFrames[nFirstNonBlankFrame].Offset;
+                       if (j > 0 && j < FrameSize)
+                               FrameSize = j;
+               }
+               if (FrameSize == GrpFrames[nFirstNonBlankFrame].Width * GrpFrames[nFirstNonBlankFrame].Height)
+                       FrameSize = GrpFrame->Width * GrpFrame->Height;
+       }
+       if (!(dwFlags&HORIZONTAL_FLIP) && !(dwFlags&VERTICAL_FLIP)) {
+               if (FrameSize != GrpFrame->Width * GrpFrame->Height) {
+                       for (y=0;y<GrpFrame->Height;y++) {
+                               RowData = ((BYTE *)(((char *)GrpOffsets)+GrpOffsets[y]));
+                               x=0; ofs=0;
+                               while (x<GrpFrame->Width) {
+                                       if (!(RowData[ofs] & 0x80)) {
+                                               if (!(RowData[ofs] & 0x40)) {
+                                                       for (i=1;i<=RowData[ofs] && x<GrpFrame->Width;i++) {
+                                                               SetPix(hdcDest,nXDest+x,nYDest+y,RowData[ofs+i],dwPalette,dwFlags,dwAlpha);
+                                                               x++;
+                                                       }
+                                                       ofs+=RowData[ofs]+1;
+                                               }
+                                               else {
+                                                       for (i=0;i<RowData[ofs]-64 && x<GrpFrame->Width;i++) {
+                                                               SetPix(hdcDest,nXDest+x,nYDest+y,RowData[ofs+1],dwPalette,dwFlags,dwAlpha);
+                                                               x++;
+                                                       }
+                                                       ofs+=2;
+                                               }
+                                       }
+                                       else {
+                                               x+=RowData[ofs]-128;
+                                               ofs++;
+                                       }
+                               }
+                       }
+               }
+               else {
+                       for (y=0;y<GrpFrame->Height;y++) {
+                               for (x=0;x<GrpFrame->Width;x++) {
+                                       SetPix(hdcDest,nXDest+x,nYDest+y,GrpRaw[y * GrpFrame->Width + x],dwPalette,dwFlags,dwAlpha);
+                               }
+                       }
+               }
+       }
+       else if (dwFlags&HORIZONTAL_FLIP && !(dwFlags&VERTICAL_FLIP)) {
+               if (FrameSize != GrpFrame->Width * GrpFrame->Height) {
+                       for (y=0;y<GrpFrame->Height;y++) {
+                               RowData = ((BYTE *)(((char *)GrpOffsets)+GrpOffsets[y]));
+                               x=0; ofs=0;
+                               while (x<GrpFrame->Width) {
+                                       if (!(RowData[ofs] & 0x80)) {
+                                               if (!(RowData[ofs] & 0x40)) {
+                                                       for (i=1;i<=RowData[ofs] && x<GrpFrame->Width;i++) {
+                                                               SetPix(hdcDest,Right-x,nYDest+y,RowData[ofs+i],dwPalette,dwFlags,dwAlpha);
+                                                               x++;
+                                                       }
+                                                       ofs+=RowData[ofs]+1;
+                                               }
+                                               else {
+                                                       for (i=0;i<RowData[ofs]-64 && x<GrpFrame->Width;i++) {
+                                                               SetPix(hdcDest,Right-x,nYDest+y,RowData[ofs+1],dwPalette,dwFlags,dwAlpha);
+                                                               x++;
+                                                       }
+                                                       ofs+=2;
+                                               }
+                                       }
+                                       else {
+                                               x+=RowData[ofs]-128;
+                                               ofs++;
+                                       }
+                               }
+                       }
+               }
+               else {
+                       for (y=0;y<GrpFrame->Height;y++) {
+                               for (x=0;x<GrpFrame->Width;x++) {
+                                       SetPix(hdcDest,Right-x,nYDest+y,GrpRaw[y * GrpFrame->Width + x],dwPalette,dwFlags,dwAlpha);
+                               }
+                       }
+               }
+       }
+       else if (!(dwFlags&HORIZONTAL_FLIP) && dwFlags&VERTICAL_FLIP) {
+               if (FrameSize != GrpFrame->Width * GrpFrame->Height) {
+                       for (y=0;y<GrpFrame->Height;y++) {
+                               RowData = ((BYTE *)(((char *)GrpOffsets)+GrpOffsets[y]));
+                               x=0; ofs=0;
+                               while (x<GrpFrame->Width) {
+                                       if (!(RowData[ofs] & 0x80)) {
+                                               if (!(RowData[ofs] & 0x40)) {
+                                                       for (i=1;i<=RowData[ofs] && x<GrpFrame->Width;i++) {
+                                                               SetPix(hdcDest,nXDest+x,Bottom-y,RowData[ofs+i],dwPalette,dwFlags,dwAlpha);
+                                                               x++;
+                                                       }
+                                                       ofs+=RowData[ofs]+1;
+                                               }
+                                               else {
+                                                       for (i=0;i<RowData[ofs]-64 && x<GrpFrame->Width;i++) {
+                                                               SetPix(hdcDest,nXDest+x,Bottom-y,RowData[ofs+1],dwPalette,dwFlags,dwAlpha);
+                                                               x++;
+                                                       }
+                                                       ofs+=2;
+                                               }
+                                       }
+                                       else {
+                                               x+=RowData[ofs]-128;
+                                               ofs++;
+                                       }
+                               }
+                       }
+               }
+               else {
+                       for (y=0;y<GrpFrame->Height;y++) {
+                               for (x=0;x<GrpFrame->Width;x++) {
+                                       SetPix(hdcDest,nXDest+x,Bottom-y,GrpRaw[y * GrpFrame->Width + x],dwPalette,dwFlags,dwAlpha);
+                               }
+                       }
+               }
+       }
+       else {
+               if (FrameSize != GrpFrame->Width * GrpFrame->Height) {
+                       for (y=0;y<GrpFrame->Height;y++) {
+                               RowData = ((BYTE *)(((char *)GrpOffsets)+GrpOffsets[y]));
+                               x=0; ofs=0;
+                               while (x<GrpFrame->Width) {
+                                       if (!(RowData[ofs] & 0x80)) {
+                                               if (!(RowData[ofs] & 0x40)) {
+                                                       for (i=1;i<=RowData[ofs] && x<GrpFrame->Width;i++) {
+                                                               SetPix(hdcDest,Right-x,Bottom-y,RowData[ofs+i],dwPalette,dwFlags,dwAlpha);
+                                                               x++;
+                                                       }
+                                                       ofs+=RowData[ofs]+1;
+                                               }
+                                               else {
+                                                       for (i=0;i<RowData[ofs]-64 && x<GrpFrame->Width;i++) {
+                                                               SetPix(hdcDest,Right-x,Bottom-y,RowData[ofs+1],dwPalette,dwFlags,dwAlpha);
+                                                               x++;
+                                                       }
+                                                       ofs+=2;
+                                               }
+                                       }
+                                       else {
+                                               x+=RowData[ofs]-128;
+                                               ofs++;
+                                       }
+                               }
+                       }
+               }
+               else {
+                       for (y=0;y<GrpFrame->Height;y++) {
+                               for (x=0;x<GrpFrame->Width;x++) {
+                                       SetPix(hdcDest,Right-x,Bottom-y,GrpRaw[y * GrpFrame->Width + x],dwPalette,dwFlags,dwAlpha);
+                               }
+                       }
+               }
+       }
+       return TRUE;
+}
+
+BOOL GRPAPI WINAPI GetGrpInfo(HANDLE hGrp, GRPHEADER *GrpInfo)
+{
+       if (!hGrp || hGrp==INVALID_HANDLE_VALUE || !GrpInfo) return FALSE;
+       memcpy(GrpInfo,hGrp,6);
+       return TRUE;
+}
+
+BOOL GRPAPI WINAPI GetGrpFrameInfo(HANDLE hGrp, WORD nFrame, DWORD *nLeft, DWORD *nTop, DWORD *nWidth, DWORD *nHeight)
+{
+       if (!hGrp || hGrp==INVALID_HANDLE_VALUE) return FALSE;
+       FRAMEHEADER *GrpFrame = &((FRAMEHEADER *)(((char *)hGrp)+6))[nFrame];
+
+       if (nLeft) *nLeft = GrpFrame->Left;
+       if (nTop) *nTop = GrpFrame->Top;
+       if (nWidth) *nWidth = GrpFrame->Width;
+       if (nHeight) *nHeight = GrpFrame->Height;
+
+       return TRUE;
+}
+
+void GRPAPI WINAPI SetFunctionGetPixel(GETPIXELPROC lpGetPixelProc)
+{
+       if (!lpGetPixelProc)
+               MyGetPixel = GetPixel;
+       else
+               MyGetPixel = lpGetPixelProc;
+}
+
+void GRPAPI WINAPI SetFunctionSetPixel(SETPIXELPROC lpSetPixelProc)
+{
+       if (!lpSetPixelProc)
+               MySetPixel = (SETPIXELPROC)SetPixelV;
+       else
+               MySetPixel = lpSetPixelProc;
+}
+
+void __inline SetPix(HDC hDC, int X, int Y, COLORREF clrColor, DWORD *dwPalette, DWORD dwFlags, DWORD dwAlpha)
+{
+       if (!(dwFlags&USE_INDEX)) {
+               if (dwFlags&SHADOW_COLOR) {
+                       clrColor = (dwFlags >> 8) & 0x00FFFFFF;
+               }
+               else {
+                       clrColor = dwPalette[clrColor];
+               }
+               if (dwFlags&ALPHA_BLEND) {
+                       DWORD dwColor = MyGetPixel(hDC,X,Y);
+
+                       // Old alpha
+                       /*((BYTE *)&dwColor)[0]*=1-((float)((BYTE *)&dwAlpha)[0]/256);
+                       ((BYTE *)&dwColor)[1]*=1-((float)((BYTE *)&dwAlpha)[1]/256);
+                       ((BYTE *)&dwColor)[2]*=1-((float)((BYTE *)&dwAlpha)[2]/256);
+                       ((BYTE *)&clrColor)[0]*=(float)((BYTE *)&dwAlpha)[0]/256;
+                       ((BYTE *)&clrColor)[1]*=(float)((BYTE *)&dwAlpha)[1]/256;
+                       ((BYTE *)&clrColor)[2]*=(float)((BYTE *)&dwAlpha)[2]/256;
+                       ((BYTE *)&clrColor)[0]+=((BYTE *)&dwColor)[0];
+                       ((BYTE *)&clrColor)[1]+=((BYTE *)&dwColor)[1];
+                       ((BYTE *)&clrColor)[2]+=((BYTE *)&dwColor)[2];*/
+
+                       /* blendedcolor =
+                                ( ( forecolor * ( 1 - alpha ) ) >> 8 )
+                          + ( ( backcolor * ( 256 - alpha ) ) >> 8 ) */
+                       ((BYTE *)&clrColor)[0] =
+                               ( ( ((BYTE *)&clrColor)[0] * ( ((BYTE *)&dwAlpha)[0] + 1 ) ) >> 8 )
+                               + ( ( ((BYTE *)&dwColor)[0] * ( 256 - ((BYTE *)&dwAlpha)[0] ) ) >> 8 );
+                       ((BYTE *)&clrColor)[1] =
+                               ( ( ((BYTE *)&clrColor)[1] * ( ((BYTE *)&dwAlpha)[1] + 1 ) ) >> 8 )
+                               + ( ( ((BYTE *)&dwColor)[1] * ( 256 - ((BYTE *)&dwAlpha)[1] ) ) >> 8 );
+                       ((BYTE *)&clrColor)[2] =
+                               ( ( ((BYTE *)&clrColor)[2] * ( ((BYTE *)&dwAlpha)[2] + 1 ) ) >> 8 )
+                               + ( ( ((BYTE *)&dwColor)[2] * ( 256 - ((BYTE *)&dwAlpha)[2] ) ) >> 8 );
+               }
+       }
+       MySetPixel(hDC,X,Y,clrColor);
+}
+
+HANDLE GRPAPI WINAPI CreateGrp(signed short *lpImageData, WORD nFrames, WORD wMaxWidth, WORD wMaxHeight, BOOL bNoCompress, DWORD *nGrpSize)
+{
+       GRPHEADER GrpHeader;
+       FRAMEHEADER *lpFrameHeaders;
+       FRAMEDATA *lpFrameData;
+       LPBYTE lpGrpData;
+       int i, j, x, y, x1, x2, y1, y2;
+       DWORD nLastOffset;
+
+       if (!lpImageData || !nGrpSize) return (HANDLE)-1;
+
+       GrpHeader.nFrames = nFrames;
+       GrpHeader.wMaxWidth = wMaxWidth;
+       GrpHeader.wMaxHeight = wMaxHeight;
+       lpFrameHeaders = (FRAMEHEADER *)malloc(nFrames * sizeof(FRAMEHEADER));
+       lpFrameData = (FRAMEDATA *)malloc(nFrames * sizeof(FRAMEDATA));
+       nLastOffset = sizeof(GRPHEADER) + nFrames * sizeof(FRAMEHEADER);
+
+       for (i = 0; i < nFrames; i++) {
+               lpFrameHeaders[i].Offset = nLastOffset;
+
+               // Scan frame to find dimensions of used part
+               x1 = y1 = 0x10000;
+               x2 = y2 = -1;
+               for (y = 0; y < wMaxHeight; y++) {
+                       for (x = 0; x < wMaxWidth; x++) {
+                               if (lpImageData[i * wMaxWidth * wMaxHeight + y * wMaxWidth + x] >= 0) {
+                                       if (x < x1) x1 = x;
+                                       if (x > x2) x2 = x;
+                                       if (y < y1) y1 = y;
+                                       if (y > y2) y2 = y;
+                               }
+                       }
+               }
+               x2 = x2 - x1 + 1;
+               y2 = y2 - y1 + 1;
+               if ((WORD)x1 > 255) x1 = 255;
+               if ((WORD)y1 > 255) y1 = 255;
+               if ((WORD)x2 > 255) x2 = 255;
+               if ((WORD)y2 > 255) y2 = 255;
+               lpFrameHeaders[i].Left = x1;
+               lpFrameHeaders[i].Top = y1;
+               lpFrameHeaders[i].Width = x2;
+               lpFrameHeaders[i].Height = y2;
+
+               // Search for duplicate frames
+               for (j = 0; j < i; j++) {
+                       if (lpFrameData[j].lpRowOffsets && lpFrameHeaders[i].Width == lpFrameHeaders[j].Width && lpFrameHeaders[i].Height == lpFrameHeaders[j].Height) {
+                               y1 = i * wMaxWidth * wMaxHeight + lpFrameHeaders[i].Top * wMaxWidth + lpFrameHeaders[i].Left;
+                               y2 = j * wMaxWidth * wMaxHeight + lpFrameHeaders[j].Top * wMaxWidth + lpFrameHeaders[j].Left;
+
+                               for (y = 0; y < lpFrameHeaders[i].Height; y++) {
+                                       if (memcmp(&lpImageData[y1], &lpImageData[y2], lpFrameHeaders[i].Width * sizeof(short)) != 0)
+                                               break;
+
+                                       y1 += wMaxWidth;
+                                       y2 += wMaxWidth;
+                               }
+
+                               if (y == lpFrameHeaders[i].Height) {
+                                       break;
+                               }
+                       }
+               }
+
+               if (j < i) {
+                       // Duplicate frame found, set offset and flag as duplicate
+                       lpFrameHeaders[i].Offset = lpFrameHeaders[j].Offset;
+                       lpFrameData[i].lpRowOffsets = 0;
+                       lpFrameData[i].lpRowSizes = 0;
+                       lpFrameData[i].lpRowData = 0;
+                       lpFrameData[i].Size = 0;
+                       continue;
+               }
+
+               EncodeFrameData(lpImageData, i, &GrpHeader, &lpFrameHeaders[i], &lpFrameData[i], bNoCompress);
+               nLastOffset = lpFrameHeaders[i].Offset + lpFrameData[i].Size;
+       }
+
+       lpGrpData = (LPBYTE)malloc(nLastOffset);
+
+       // Write completed GRP to buffer
+       memcpy(lpGrpData, &GrpHeader, sizeof(GRPHEADER));
+       memcpy(lpGrpData + sizeof(GRPHEADER), lpFrameHeaders, nFrames * sizeof(FRAMEHEADER));
+
+       for (i = 0; i < nFrames; i++) {
+               if (lpFrameData[i].lpRowOffsets) {
+                       if (!bNoCompress)
+                               memcpy(lpGrpData + lpFrameHeaders[i].Offset, lpFrameData[i].lpRowOffsets, lpFrameHeaders[i].Height * sizeof(WORD));
+
+                       for (y = 0; y < lpFrameHeaders[i].Height; y++) {
+                               if (lpFrameData[i].lpRowData[y]) {
+                                       memcpy(lpGrpData + lpFrameHeaders[i].Offset + lpFrameData[i].lpRowOffsets[y], lpFrameData[i].lpRowData[y], lpFrameData[i].lpRowSizes[y]);
+                                       free(lpFrameData[i].lpRowData[y]);
+                               }
+                       }
+
+                       free(lpFrameData[i].lpRowOffsets);
+                       free(lpFrameData[i].lpRowSizes);
+                       free(lpFrameData[i].lpRowData);
+               }
+       }
+
+       free(lpFrameHeaders);
+       free(lpFrameData);
+
+       *nGrpSize = nLastOffset;
+       return (HANDLE)lpGrpData;
+}
+
+void EncodeFrameData(signed short *lpImageData, WORD nFrame, GRPHEADER *lpGrpHeader, FRAMEHEADER *lpFrameHeader, FRAMEDATA *lpFrameData, BOOL bNoCompress)
+{
+       int x, y, i, j, nBufPos, nRepeat;
+       LPBYTE lpRowBuf;
+       WORD nLastOffset = 0;
+
+       lpFrameData->lpRowOffsets = (WORD *)malloc(lpFrameHeader->Height * sizeof(WORD));
+       lpFrameData->lpRowSizes = (WORD *)malloc(lpFrameHeader->Height * sizeof(WORD));
+       lpFrameData->lpRowData = (LPBYTE *)malloc(lpFrameHeader->Height * sizeof(LPBYTE));
+       lpRowBuf = (LPBYTE)malloc(lpFrameHeader->Width * 2);
+
+       if (!bNoCompress)
+               nLastOffset = lpFrameHeader->Height * sizeof(WORD);
+
+       for (y = 0; y < lpFrameHeader->Height; y++) {
+               i = nFrame * lpGrpHeader->wMaxWidth * lpGrpHeader->wMaxHeight + (lpFrameHeader->Top + y) * lpGrpHeader->wMaxWidth;
+
+               if (!bNoCompress) {
+                       // Search for duplicate rows
+                       for (x = 0; x < y; x++) {
+                               j = nFrame * lpGrpHeader->wMaxWidth * lpGrpHeader->wMaxHeight + (lpFrameHeader->Top + x) * lpGrpHeader->wMaxWidth;
+                               if (memcmp(&lpImageData[i+lpFrameHeader->Left],
+                                                  &lpImageData[j+lpFrameHeader->Left],
+                                                  lpGrpHeader->wMaxWidth * sizeof(short)) == 0)
+                                       break;
+                       }
+
+                       if (x < y) {
+                               lpFrameData->lpRowOffsets[y] = lpFrameData->lpRowOffsets[x];
+                               lpFrameData->lpRowSizes[y] = 0;
+                               lpFrameData->lpRowData[y] = 0;
+
+#ifdef _DEBUG
+                               if (!VerifyRow(&lpImageData[i+lpFrameHeader->Left], lpFrameHeader->Width, lpFrameData->lpRowData[x], lpFrameData->lpRowSizes[x], bNoCompress)) {
+                                       nBufPos = nBufPos;
+                               }
+#endif
+
+                               continue;
+                       }
+               }
+
+               nBufPos = 0;
+               if (lpFrameHeader->Width > 0) {
+                       for (x = lpFrameHeader->Left; x < lpFrameHeader->Left + lpFrameHeader->Width; x++) {
+                               if (!bNoCompress) {
+                                       if (x < lpFrameHeader->Left + lpFrameHeader->Width - 1) {
+                                               if (lpImageData[i+x] < 0) {
+                                                       lpRowBuf[nBufPos] = 0x80;
+                                                       for (; lpImageData[i+x] < 0 && x < lpFrameHeader->Left + lpFrameHeader->Width && lpRowBuf[nBufPos] < 0xFF; x++) {
+                                                               lpRowBuf[nBufPos]++;
+                                                       }
+                                                       x--;
+                                                       if (nLastOffset + nBufPos + 1 <= 0xFFFF)
+                                                               nBufPos++;
+                                                       continue;
+                                               }
+
+                                               // Count repeating pixels, nRepeat = number of pixels - 1, ignore if there are less than 4 duplicates
+                                               for (nRepeat = 0; lpImageData[i+x+nRepeat] == lpImageData[i+x+nRepeat+1] && x+nRepeat < lpFrameHeader->Left + lpFrameHeader->Width - 1 && nRepeat < 0x3E; nRepeat++) {}
+
+                                               if (nRepeat > 2) {
+                                                       lpRowBuf[nBufPos] = 0x41 + nRepeat;
+                                                       lpRowBuf[nBufPos+1] = (BYTE)(lpImageData[i+x]);
+                                                       x += nRepeat;
+                                                       if (nLastOffset + nBufPos + 2 <= 0xFFFF)
+                                                               nBufPos += 2;
+                                               }
+                                               else {
+                                                       lpRowBuf[nBufPos] = 0;
+                                                       for (; lpImageData[i+x] >= 0 && x < lpFrameHeader->Left + lpFrameHeader->Width && lpRowBuf[nBufPos] < 0x3F; x++) {
+                                                               // Count repeating pixels, ignore if there are less than 4 duplicates
+                                                               for (nRepeat = 0; lpImageData[i+x+nRepeat] == lpImageData[i+x+nRepeat+1] && x+nRepeat < lpFrameHeader->Left + lpFrameHeader->Width - 1 && nRepeat < 3; nRepeat++) {}
+                                                               if (nRepeat > 2) break;
+
+                                                               lpRowBuf[nBufPos]++;
+                                                               lpRowBuf[nBufPos+lpRowBuf[nBufPos]] = (BYTE)(lpImageData[i+x]);
+                                                       }
+                                                       if (lpImageData[i+x] >= 0 && x == lpFrameHeader->Left + lpFrameHeader->Width - 1 && lpRowBuf[nBufPos] < 0x3F) {
+                                                               lpRowBuf[nBufPos]++;
+                                                               lpRowBuf[nBufPos+lpRowBuf[nBufPos]] = (BYTE)(lpImageData[i+x]);
+                                                       }
+                                                       x--;
+                                                       if (nLastOffset + nBufPos + 1 + lpRowBuf[nBufPos] <= 0xFFFF)
+                                                               nBufPos += 1 + lpRowBuf[nBufPos];
+                                               }
+                                       }
+                                       else {
+                                               if (lpImageData[i+x] < 0) {
+                                                       lpRowBuf[nBufPos] = 0x81;
+                                                       if (nLastOffset + nBufPos + 1 <= 0xFFFF)
+                                                               nBufPos++;
+                                               }
+                                               else {
+                                                       lpRowBuf[nBufPos] = 1;
+                                                       lpRowBuf[nBufPos+1] = (BYTE)(lpImageData[i+x]);
+                                                       if (nLastOffset + nBufPos + 2 <= 0xFFFF)
+                                                               nBufPos += 2;
+                                               }
+                                       }
+                               }
+                               else {
+                                       lpRowBuf[nBufPos] = (BYTE)(lpImageData[i+x]);
+                                       if (nLastOffset + nBufPos + 1 <= 0xFFFF)
+                                               nBufPos++;
+                               }
+                       }
+               }
+
+#ifdef _DEBUG
+               if (!VerifyRow(&lpImageData[i+lpFrameHeader->Left], lpFrameHeader->Width, lpRowBuf, nBufPos, bNoCompress)) {
+                       nBufPos = nBufPos;
+               }
+#endif
+
+               lpFrameData->lpRowOffsets[y] = nLastOffset;
+               nLastOffset = lpFrameData->lpRowOffsets[y] + nBufPos;
+
+               lpFrameData->lpRowSizes[y] = nBufPos;
+               lpFrameData->lpRowData[y] = (LPBYTE)malloc(nBufPos);
+               memcpy(lpFrameData->lpRowData[y], lpRowBuf, nBufPos);
+       }
+
+       lpFrameData->Size = nLastOffset;
+
+       free(lpRowBuf);
+}
+
+#ifdef _DEBUG
+BOOL VerifyRow(signed short *lpRawRow, int nWidth, LPBYTE lpEncRow, int nSize, BOOL bNoCompress)
+{
+       int i,x=0,ofs=0;
+       while (x < nWidth && ofs < nSize) {
+               if (!bNoCompress) {
+                       if (!(lpEncRow[ofs] & 0x80)) {
+                               if (!(lpEncRow[ofs] & 0x40)) {
+                                       for (i=1;i<=lpEncRow[ofs] && x<nWidth;i++) {
+                                               if (lpEncRow[ofs+i] != (BYTE)lpRawRow[x]) return FALSE;
+                                               x++;
+                                       }
+                                       ofs+=lpEncRow[ofs]+1;
+                               }
+                               else {
+                                       for (i=0;i<lpEncRow[ofs]-64 && x<nWidth;i++) {
+                                               if (lpEncRow[ofs+1] != (BYTE)lpRawRow[x]) return FALSE;
+                                               x++;
+                                       }
+                                       ofs+=2;
+                               }
+                       }
+                       else {
+                               for (i=0;i<lpEncRow[ofs]-128 && x<nWidth;i++) {
+                                       if (lpRawRow[x] >= 0) return FALSE;
+                               }
+                               x+=lpEncRow[ofs]-128;
+                               ofs++;
+                       }
+               }
+               else {
+                       if (lpEncRow[ofs] != (BYTE)lpRawRow[x]) return FALSE;
+                       x++;
+                       ofs++;
+               }
+       }
+
+       if (x != nWidth || ofs != nSize) return FALSE;
+
+       return TRUE;
+}
+#endif
index 74872fc..2d95f21 100644 (file)
@@ -1,13 +1,13 @@
-EXPORTS\r
-       LoadPalette         @1\r
-       LoadGrp             @2\r
-       DestroyGrp          @3\r
-       DrawGrp             @4\r
-       GetGrpInfo          @5\r
-       LoadGrpApi          @6\r
-       FreeGrpApi          @7\r
-       SetFunctionGetPixel @8\r
-       SetFunctionSetPixel @9\r
-       SetMpqDll           @10\r
-       CreateGrp           @11\r
-       GetGrpFrameInfo     @12\r
+EXPORTS
+       LoadPalette         @1
+       LoadGrp             @2
+       DestroyGrp          @3
+       DrawGrp             @4
+       GetGrpInfo          @5
+       LoadGrpApi          @6
+       FreeGrpApi          @7
+       SetFunctionGetPixel @8
+       SetFunctionSetPixel @9
+       SetMpqDll           @10
+       CreateGrp           @11
+       GetGrpFrameInfo     @12
index 5bdbe94..bd5f6cb 100644 (file)
-/*\r
-\r
-  ShadowFlare GRP Library. (c) ShadowFlare Software 2002-2006\r
-\r
-  Any comments or suggestions are accepted at blakflare@hotmail.com (ShadowFlare)\r
-*/\r
-\r
-#ifndef GRPAPI_INCLUDED\r
-#define GRPAPI_INCLUDED\r
-\r
-#include <windows.h>\r
-\r
-#ifndef GRPAPI_STATIC\r
-\r
-#ifdef GRPAPI_EXPORTS\r
-#define GRPAPI __declspec(dllexport)\r
-#else\r
-#define GRPAPI __declspec(dllimport)\r
-#endif\r
-\r
-#else\r
-#define GRPAPI\r
-#endif\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-typedef struct {\r
-       WORD nFrames;\r
-       WORD wMaxWidth;\r
-       WORD wMaxHeight;\r
-} GRPHEADER;\r
-\r
-#define HORIZONTAL_FLIP 0x00000001 // Flips the graphic horizontally\r
-#define VERTICAL_FLIP   0x00000002 // Flips the graphic vertically\r
-#define SHADOW_COLOR    0x00000004 // Causes the graphic to be drawn in one color\r
-                                   // Second byte of flags is the red component of\r
-                                   // the shadow's color, third byte is green,\r
-                                   // fourth byte is blue; like this:\r
-                                   // SHADOW_COLOR|0xBBGGRR00\r
-                                   // This can be accomplished by using the left shift\r
-                                   // operator like this:  SHADOW_COLOR|(color << 8)\r
-#define ALPHA_BLEND     0x00000008 // Blends the graphic with what it is being drawn over.\r
-                                   // The dwAlpha parameter will only be used when this\r
-                                   // flag is specified.  dwAlpha is an RGB value\r
-                                   // (0xBBGGRR).\r
-                                   // Note: Because of the extra calculations required,\r
-                                   // alpha blended graphics take longer to draw\r
-#define USE_INDEX       0x00000010 // Only valid when used with a custom SetPixel function.\r
-                                   // This flag cannot be used in combination with\r
-                                   // ALPHA_BLEND or SHADOW_COLOR\r
-                                   // When this flag is used, the index to a color in the\r
-                                   // palette will be passed to your custom SetPixel\r
-                                   // function instead of the actual color.\r
-\r
-// Palette is an array of 256 DWORD's\r
-// For LoadPalette and LoadGrp, lpFileName may be a file in an open mpq archive\r
-// or a file not in an archive\r
-BOOL   GRPAPI WINAPI LoadPalette(LPCSTR lpFileName, DWORD *dwPaletteBuffer);\r
-HANDLE GRPAPI WINAPI LoadGrp(LPCSTR lpFileName);\r
-BOOL   GRPAPI WINAPI DestroyGrp(HANDLE hGrp);\r
-BOOL   GRPAPI WINAPI DrawGrp(HANDLE hGrp, HDC hdcDest, int nXDest, int nYDest, WORD nFrame, DWORD *dwPalette, DWORD dwFlags, DWORD dwAlpha);\r
-BOOL   GRPAPI WINAPI GetGrpInfo(HANDLE hGrp, GRPHEADER *GrpInfo);\r
-BOOL   GRPAPI WINAPI GetGrpFrameInfo(HANDLE hGrp, WORD nFrame, DWORD *nLeft, DWORD *nTop, DWORD *nWidth, DWORD *nHeight);\r
-\r
-// A pointer to the raw image data to encode should be passed to lpImageData.  The size of\r
-// the buffer containing the data should be nFrames * wMaxWidth * wMaxHeight * sizeof(short)\r
-// and the values should be arranged row by row of the frame, with the top row first.\r
-// After all the rows of a frame have been put into the buffer, the rows of the next frame\r
-// go after it.  For transparent pixels, they should be set to -1.  All other pixels should\r
-// have the high order byte set to zero, meaning that they should not be negative and the\r
-// values should not exceed 255 (0xFF).  The values used for the colors are indexes into the\r
-// color palette.\r
-// Pass TRUE to bNoCompress if you need an uncompressed GRP.\r
-// Pass a pointer to a DWORD value to nGrpSize to receive the size in bytes of the resulting encoded GRP.\r
-// The return value of this function is actually a pointer to the GRP data.  This is what your\r
-// program should save to a file.  The size of this buffer is the value received by nGrpSize.\r
-// When your program is done with the returned buffer, it should call DestroyGrp on the\r
-// buffer that was returned by this function to free up the memory from it.\r
-// The pointer returned by this function can also be directly used by DrawGrp or GetGrpInfo.\r
-HANDLE GRPAPI WINAPI CreateGrp(signed short *lpImageData, WORD nFrames, WORD wMaxWidth, WORD wMaxHeight, BOOL bNoCompress, DWORD *nGrpSize);\r
-\r
-typedef COLORREF (WINAPI* GETPIXELPROC)(\r
-  HDC hDC, // same value as hdcDest from DrawGrp,\r
-              // does not need to be used as an HDC,\r
-              // can be used for any other type of pointer\r
-  int X,   // x-coordinate of pixel\r
-  int Y    // y-coordinate of pixel\r
-);\r
-typedef void (WINAPI* SETPIXELPROC)(\r
-       HDC hDC,          // same value as hdcDest from DrawGrp,\r
-                         // does not need to be used as an HDC,\r
-                         // can be used for any other type of pointer\r
-       int X,            // x-coordinate of pixel\r
-       int Y,            // y-coordinate of pixel\r
-       COLORREF clrColor // new pixel color\r
-);\r
-\r
-// Call these to have DrawGrp use custom functions for reading and drawing pixels\r
-// so that you can have it read from and write to a buffer, for example.\r
-void GRPAPI WINAPI SetFunctionGetPixel(GETPIXELPROC lpGetPixelProc); // Only used with ALPHA_BLEND\r
-void GRPAPI WINAPI SetFunctionSetPixel(SETPIXELPROC lpSetPixelProc);\r
-\r
-// Call this to make a different Storm.dll-compatible MPQ library be used (like SFMPQ).\r
-BOOL GRPAPI WINAPI SetMpqDll(LPCSTR lpDllFileName);\r
-\r
-// These no longer need to be called\r
-BOOL   GRPAPI WINAPI LoadGrpApi();\r
-void   GRPAPI WINAPI FreeGrpApi();\r
-\r
-#ifdef __cplusplus\r
-};  // extern "C" \r
-#endif\r
-\r
-#endif\r
+/*
+
+  ShadowFlare GRP Library. (c) ShadowFlare Software 2002-2006
+
+  Any comments or suggestions are accepted at blakflare@hotmail.com (ShadowFlare)
+*/
+
+#ifndef GRPAPI_INCLUDED
+#define GRPAPI_INCLUDED
+
+#include <windows.h>
+
+#ifndef GRPAPI_STATIC
+
+#ifdef GRPAPI_EXPORTS
+#define GRPAPI __declspec(dllexport)
+#else
+#define GRPAPI __declspec(dllimport)
+#endif
+
+#else
+#define GRPAPI
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+       WORD nFrames;
+       WORD wMaxWidth;
+       WORD wMaxHeight;
+} GRPHEADER;
+
+#define HORIZONTAL_FLIP 0x00000001 // Flips the graphic horizontally
+#define VERTICAL_FLIP   0x00000002 // Flips the graphic vertically
+#define SHADOW_COLOR    0x00000004 // Causes the graphic to be drawn in one color
+                                   // Second byte of flags is the red component of
+                                   // the shadow's color, third byte is green,
+                                   // fourth byte is blue; like this:
+                                   // SHADOW_COLOR|0xBBGGRR00
+                                   // This can be accomplished by using the left shift
+                                   // operator like this:  SHADOW_COLOR|(color << 8)
+#define ALPHA_BLEND     0x00000008 // Blends the graphic with what it is being drawn over.
+                                   // The dwAlpha parameter will only be used when this
+                                   // flag is specified.  dwAlpha is an RGB value
+                                   // (0xBBGGRR).
+                                   // Note: Because of the extra calculations required,
+                                   // alpha blended graphics take longer to draw
+#define USE_INDEX       0x00000010 // Only valid when used with a custom SetPixel function.
+                                   // This flag cannot be used in combination with
+                                   // ALPHA_BLEND or SHADOW_COLOR
+                                   // When this flag is used, the index to a color in the
+                                   // palette will be passed to your custom SetPixel
+                                   // function instead of the actual color.
+
+// 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
+BOOL   GRPAPI WINAPI LoadPalette(LPCSTR lpFileName, DWORD *dwPaletteBuffer);
+HANDLE GRPAPI WINAPI LoadGrp(LPCSTR lpFileName);
+BOOL   GRPAPI WINAPI DestroyGrp(HANDLE hGrp);
+BOOL   GRPAPI WINAPI DrawGrp(HANDLE hGrp, HDC hdcDest, int nXDest, int nYDest, WORD nFrame, DWORD *dwPalette, DWORD dwFlags, DWORD dwAlpha);
+BOOL   GRPAPI WINAPI GetGrpInfo(HANDLE hGrp, GRPHEADER *GrpInfo);
+BOOL   GRPAPI 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)
+// and the values should be arranged row by row of the frame, with the top row first.
+// After all the rows of a frame have been put into the buffer, the rows of the next frame
+// go after it.  For transparent pixels, they should be set to -1.  All other pixels should
+// have the high order byte set to zero, meaning that they should not be negative and the
+// values should not exceed 255 (0xFF).  The values used for the colors are indexes into the
+// color palette.
+// Pass TRUE to bNoCompress if you need an uncompressed GRP.
+// Pass a pointer to a DWORD value to nGrpSize to receive the size in bytes of the resulting encoded GRP.
+// The return value of this function is actually a pointer to the GRP data.  This is what your
+// program should save to a file.  The size of this buffer is the value received by nGrpSize.
+// 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.
+HANDLE GRPAPI 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,
+              // does not need to be used as an HDC,
+              // can be used for any other type of pointer
+  int X,   // x-coordinate of pixel
+  int Y    // y-coordinate of pixel
+);
+typedef void (WINAPI* SETPIXELPROC)(
+       HDC hDC,          // same value as hdcDest from DrawGrp,
+                         // does not need to be used as an HDC,
+                         // can be used for any other type of pointer
+       int X,            // x-coordinate of pixel
+       int Y,            // y-coordinate of pixel
+       COLORREF clrColor // new pixel color
+);
+
+// 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.
+void GRPAPI WINAPI SetFunctionGetPixel(GETPIXELPROC lpGetPixelProc); // Only used with ALPHA_BLEND
+void GRPAPI WINAPI SetFunctionSetPixel(SETPIXELPROC lpSetPixelProc);
+
+// Call this to make a different Storm.dll-compatible MPQ library be used (like SFMPQ).
+BOOL GRPAPI WINAPI SetMpqDll(LPCSTR lpDllFileName);
+
+// These no longer need to be called
+BOOL   GRPAPI WINAPI LoadGrpApi();
+void   GRPAPI WINAPI FreeGrpApi();
+
+#ifdef __cplusplus
+};  // extern "C" 
+#endif
+
+#endif
index 11d6327..e330c45 100644 (file)
-// Microsoft Visual C++ generated resource script.\r
-//\r
-#include "resource.h"\r
-\r
-#define APSTUDIO_READONLY_SYMBOLS\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// Generated from the TEXTINCLUDE 2 resource.\r
-//\r
-#include "afxres.h"\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-#undef APSTUDIO_READONLY_SYMBOLS\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-// English (U.S.) resources\r
-\r
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r
-#ifdef _WIN32\r
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US\r
-#pragma code_page(1252)\r
-#endif //_WIN32\r
-\r
-#ifdef APSTUDIO_INVOKED\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// TEXTINCLUDE\r
-//\r
-\r
-1 TEXTINCLUDE \r
-BEGIN\r
-    "resource.h\0"\r
-END\r
-\r
-2 TEXTINCLUDE \r
-BEGIN\r
-    "#include ""afxres.h""\r\n"\r
-    "\0"\r
-END\r
-\r
-3 TEXTINCLUDE \r
-BEGIN\r
-    "\r\n"\r
-    "\0"\r
-END\r
-\r
-#endif    // APSTUDIO_INVOKED\r
-\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// Version\r
-//\r
-\r
-VS_VERSION_INFO VERSIONINFO\r
- FILEVERSION 1,1,1,6\r
- PRODUCTVERSION 1,1,1,6\r
- FILEFLAGSMASK 0x3fL\r
-#ifdef _DEBUG\r
- FILEFLAGS 0x1L\r
-#else\r
- FILEFLAGS 0x0L\r
-#endif\r
- FILEOS 0x40004L\r
- FILETYPE 0x2L\r
- FILESUBTYPE 0x0L\r
-BEGIN\r
-    BLOCK "StringFileInfo"\r
-    BEGIN\r
-        BLOCK "040904b0"\r
-        BEGIN\r
-            VALUE "CompanyName", "ShadowFlare Software"\r
-            VALUE "FileDescription", "ShadowFlare GRP Library"\r
-            VALUE "FileVersion", "1.11"\r
-            VALUE "InternalName", "grpapi"\r
-            VALUE "LegalCopyright", "Copyright © ShadowFlare Software 2002-2007"\r
-            VALUE "OriginalFilename", "grpapi.dll"\r
-            VALUE "ProductName", "GRP Library"\r
-            VALUE "ProductVersion", "1, 1, 1, 6"\r
-            VALUE "Web Address", "http://sfsrealm.hopto.org/"\r
-        END\r
-    END\r
-    BLOCK "VarFileInfo"\r
-    BEGIN\r
-        VALUE "Translation", 0x409, 1200\r
-    END\r
-END\r
-\r
-#endif    // English (U.S.) resources\r
-/////////////////////////////////////////////////////////////////////////////\r
-\r
-\r
-\r
-#ifndef APSTUDIO_INVOKED\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// Generated from the TEXTINCLUDE 3 resource.\r
-//\r
-\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-#endif    // not APSTUDIO_INVOKED\r
-\r
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE 
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE 
+BEGIN
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE 
+BEGIN
+    "\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,1,1,6
+ PRODUCTVERSION 1,1,1,6
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904b0"
+        BEGIN
+            VALUE "CompanyName", "ShadowFlare Software"
+            VALUE "FileDescription", "ShadowFlare GRP Library"
+            VALUE "FileVersion", "1.11"
+            VALUE "InternalName", "grpapi"
+            VALUE "LegalCopyright", "Copyright © ShadowFlare Software 2002-2007"
+            VALUE "OriginalFilename", "grpapi.dll"
+            VALUE "ProductName", "GRP Library"
+            VALUE "ProductVersion", "1, 1, 1, 6"
+            VALUE "Web Address", "http://sfsrealm.hopto.org/"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1200
+    END
+END
+
+#endif    // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+
index 63329d9..f2413bb 100644 (file)
@@ -1,51 +1,51 @@
-Microsoft Visual Studio Solution File, Format Version 9.00\r
-# Visual Studio 2005\r
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "drawgrp", "..\drawgrp\drawgrp.vcproj", "{10729DB2-5CEA-41BA-9C6F-B47BE5A3C242}"\r
-EndProject\r
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpapi", "grpapi.vcproj", "{08812E9C-7F03-4DCB-8828-F3BDB0728EC7}"\r
-EndProject\r
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grplib", "grplib.vcproj", "{66127C6F-39DA-4B7A-9856-789ED0139DCB}"\r
-EndProject\r
-Global\r
-       GlobalSection(SourceCodeControl) = preSolution\r
-               SccNumberOfProjects = 4\r
-               SccProjectName0 = \u0022$/grpapi_VS2005.root/grpapi\u0022,\u0020IGAAAAAA\r
-               SccLocalPath0 = ..\r
-               SccProvider0 = MSSCCI:Microsoft\u0020Visual\u0020SourceSafe\r
-               CanCheckoutShared = false\r
-               SccProjectFilePathRelativizedFromConnection0 = grpapi\\\r
-               SccProjectUniqueName1 = ..\\drawgrp\\drawgrp.vcproj\r
-               SccLocalPath1 = ..\r
-               CanCheckoutShared = false\r
-               SccProjectFilePathRelativizedFromConnection1 = drawgrp\\\r
-               SccProjectUniqueName2 = grpapi.vcproj\r
-               SccLocalPath2 = ..\r
-               CanCheckoutShared = false\r
-               SccProjectFilePathRelativizedFromConnection2 = grpapi\\\r
-               SccProjectUniqueName3 = grplib.vcproj\r
-               SccLocalPath3 = ..\r
-               CanCheckoutShared = false\r
-               SccProjectFilePathRelativizedFromConnection3 = grpapi\\\r
-       EndGlobalSection\r
-       GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
-               Debug|Win32 = Debug|Win32\r
-               Release|Win32 = Release|Win32\r
-       EndGlobalSection\r
-       GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
-               {10729DB2-5CEA-41BA-9C6F-B47BE5A3C242}.Debug|Win32.ActiveCfg = Debug|Win32\r
-               {10729DB2-5CEA-41BA-9C6F-B47BE5A3C242}.Debug|Win32.Build.0 = Debug|Win32\r
-               {10729DB2-5CEA-41BA-9C6F-B47BE5A3C242}.Release|Win32.ActiveCfg = Release|Win32\r
-               {10729DB2-5CEA-41BA-9C6F-B47BE5A3C242}.Release|Win32.Build.0 = Release|Win32\r
-               {08812E9C-7F03-4DCB-8828-F3BDB0728EC7}.Debug|Win32.ActiveCfg = Debug|Win32\r
-               {08812E9C-7F03-4DCB-8828-F3BDB0728EC7}.Debug|Win32.Build.0 = Debug|Win32\r
-               {08812E9C-7F03-4DCB-8828-F3BDB0728EC7}.Release|Win32.ActiveCfg = Release|Win32\r
-               {08812E9C-7F03-4DCB-8828-F3BDB0728EC7}.Release|Win32.Build.0 = Release|Win32\r
-               {66127C6F-39DA-4B7A-9856-789ED0139DCB}.Debug|Win32.ActiveCfg = Debug|Win32\r
-               {66127C6F-39DA-4B7A-9856-789ED0139DCB}.Debug|Win32.Build.0 = Debug|Win32\r
-               {66127C6F-39DA-4B7A-9856-789ED0139DCB}.Release|Win32.ActiveCfg = Release|Win32\r
-               {66127C6F-39DA-4B7A-9856-789ED0139DCB}.Release|Win32.Build.0 = Release|Win32\r
-       EndGlobalSection\r
-       GlobalSection(SolutionProperties) = preSolution\r
-               HideSolutionNode = FALSE\r
-       EndGlobalSection\r
-EndGlobal\r
+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}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpapi", "grpapi.vcproj", "{08812E9C-7F03-4DCB-8828-F3BDB0728EC7}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grplib", "grplib.vcproj", "{66127C6F-39DA-4B7A-9856-789ED0139DCB}"
+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
+       EndGlobalSection
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution
+               {10729DB2-5CEA-41BA-9C6F-B47BE5A3C242}.Debug|Win32.ActiveCfg = Debug|Win32
+               {10729DB2-5CEA-41BA-9C6F-B47BE5A3C242}.Debug|Win32.Build.0 = Debug|Win32
+               {10729DB2-5CEA-41BA-9C6F-B47BE5A3C242}.Release|Win32.ActiveCfg = Release|Win32
+               {10729DB2-5CEA-41BA-9C6F-B47BE5A3C242}.Release|Win32.Build.0 = Release|Win32
+               {08812E9C-7F03-4DCB-8828-F3BDB0728EC7}.Debug|Win32.ActiveCfg = Debug|Win32
+               {08812E9C-7F03-4DCB-8828-F3BDB0728EC7}.Debug|Win32.Build.0 = Debug|Win32
+               {08812E9C-7F03-4DCB-8828-F3BDB0728EC7}.Release|Win32.ActiveCfg = Release|Win32
+               {08812E9C-7F03-4DCB-8828-F3BDB0728EC7}.Release|Win32.Build.0 = Release|Win32
+               {66127C6F-39DA-4B7A-9856-789ED0139DCB}.Debug|Win32.ActiveCfg = Debug|Win32
+               {66127C6F-39DA-4B7A-9856-789ED0139DCB}.Debug|Win32.Build.0 = Debug|Win32
+               {66127C6F-39DA-4B7A-9856-789ED0139DCB}.Release|Win32.ActiveCfg = Release|Win32
+               {66127C6F-39DA-4B7A-9856-789ED0139DCB}.Release|Win32.Build.0 = Release|Win32
+       EndGlobalSection
+       GlobalSection(SolutionProperties) = preSolution
+               HideSolutionNode = FALSE
+       EndGlobalSection
+EndGlobal
index f5e4d67..5761f2b 100644 (file)
-<?xml version="1.0" encoding="Windows-1252"?>\r
-<VisualStudioProject\r
-       ProjectType="Visual C++"\r
-       Version="8.00"\r
-       Name="grpapi"\r
-       ProjectGUID="{08812E9C-7F03-4DCB-8828-F3BDB0728EC7}"\r
-       RootNamespace="grpapi"\r
-       SccProjectName="&quot;$/grpapi_VS2005.root/grpapi&quot;, IGAAAAAA"\r
-       SccLocalPath=".."\r
-       SccProvider="MSSCCI:Microsoft Visual SourceSafe"\r
-       >\r
-       <Platforms>\r
-               <Platform\r
-                       Name="Win32"\r
-               />\r
-       </Platforms>\r
-       <ToolFiles>\r
-       </ToolFiles>\r
-       <Configurations>\r
-               <Configuration\r
-                       Name="Debug|Win32"\r
-                       OutputDirectory=".\Debug"\r
-                       IntermediateDirectory=".\Debug"\r
-                       ConfigurationType="2"\r
-                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
-                       UseOfMFC="0"\r
-                       ATLMinimizesCRunTimeLibraryUsage="false"\r
-                       CharacterSet="2"\r
-                       >\r
-                       <Tool\r
-                               Name="VCPreBuildEventTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCCustomBuildTool"\r
-                               CommandLine="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)..\drawgrp\debug\&quot;&#x0D;&#x0A;"\r
-                               Outputs="$(TargetDir)null.txt"\r
-                       />\r
-                       <Tool\r
-                               Name="VCXMLDataGeneratorTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCWebServiceProxyGeneratorTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCMIDLTool"\r
-                               PreprocessorDefinitions="_DEBUG"\r
-                               MkTypLibCompatible="true"\r
-                               SuppressStartupBanner="true"\r
-                               TargetEnvironment="1"\r
-                               TypeLibraryName=".\Debug/grpapi.tlb"\r
-                               HeaderFileName=""\r
-                       />\r
-                       <Tool\r
-                               Name="VCCLCompilerTool"\r
-                               Optimization="0"\r
-                               PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;GRPAPI_EXPORTS"\r
-                               BasicRuntimeChecks="3"\r
-                               RuntimeLibrary="1"\r
-                               UsePrecompiledHeader="0"\r
-                               PrecompiledHeaderFile=".\Debug/grpapi.pch"\r
-                               AssemblerListingLocation=".\Debug/"\r
-                               ObjectFile=".\Debug/"\r
-                               ProgramDataBaseFileName=".\Debug/"\r
-                               WarningLevel="3"\r
-                               SuppressStartupBanner="true"\r
-                               DebugInformationFormat="4"\r
-                       />\r
-                       <Tool\r
-                               Name="VCManagedResourceCompilerTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCResourceCompilerTool"\r
-                               PreprocessorDefinitions="_DEBUG"\r
-                               Culture="1033"\r
-                       />\r
-                       <Tool\r
-                               Name="VCPreLinkEventTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCLinkerTool"\r
-                               OutputFile=".\Debug/grpapi.dll"\r
-                               LinkIncremental="1"\r
-                               SuppressStartupBanner="true"\r
-                               ModuleDefinitionFile=".\grpapi.def"\r
-                               GenerateDebugInformation="true"\r
-                               ProgramDatabaseFile=".\Debug/grpapi.pdb"\r
-                               ImportLibrary=".\Debug/grpapi.lib"\r
-                               TargetMachine="1"\r
-                       />\r
-                       <Tool\r
-                               Name="VCALinkTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCManifestTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCXDCMakeTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCBscMakeTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCFxCopTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCAppVerifierTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCWebDeploymentTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCPostBuildEventTool"\r
-                       />\r
-               </Configuration>\r
-               <Configuration\r
-                       Name="Release|Win32"\r
-                       OutputDirectory=".\Release"\r
-                       IntermediateDirectory=".\Release"\r
-                       ConfigurationType="2"\r
-                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
-                       UseOfMFC="0"\r
-                       ATLMinimizesCRunTimeLibraryUsage="false"\r
-                       CharacterSet="2"\r
-                       >\r
-                       <Tool\r
-                               Name="VCPreBuildEventTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCCustomBuildTool"\r
-                               CommandLine="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)..\drawgrp\release\&quot;&#x0D;&#x0A;"\r
-                               Outputs="$(TargetDir)null.txt"\r
-                       />\r
-                       <Tool\r
-                               Name="VCXMLDataGeneratorTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCWebServiceProxyGeneratorTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCMIDLTool"\r
-                               PreprocessorDefinitions="NDEBUG"\r
-                               MkTypLibCompatible="true"\r
-                               SuppressStartupBanner="true"\r
-                               TargetEnvironment="1"\r
-                               TypeLibraryName=".\Release/grpapi.tlb"\r
-                               HeaderFileName=""\r
-                       />\r
-                       <Tool\r
-                               Name="VCCLCompilerTool"\r
-                               Optimization="2"\r
-                               InlineFunctionExpansion="2"\r
-                               FavorSizeOrSpeed="1"\r
-                               PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GRPAPI_EXPORTS"\r
-                               StringPooling="true"\r
-                               RuntimeLibrary="0"\r
-                               EnableFunctionLevelLinking="true"\r
-                               UsePrecompiledHeader="0"\r
-                               PrecompiledHeaderFile=".\Release/grpapi.pch"\r
-                               AssemblerListingLocation=".\Release/"\r
-                               ObjectFile=".\Release/"\r
-                               ProgramDataBaseFileName=".\Release/"\r
-                               WarningLevel="3"\r
-                               SuppressStartupBanner="true"\r
-                       />\r
-                       <Tool\r
-                               Name="VCManagedResourceCompilerTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCResourceCompilerTool"\r
-                               PreprocessorDefinitions="NDEBUG"\r
-                               Culture="1033"\r
-                       />\r
-                       <Tool\r
-                               Name="VCPreLinkEventTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCLinkerTool"\r
-                               OutputFile=".\Release/grpapi.dll"\r
-                               LinkIncremental="1"\r
-                               SuppressStartupBanner="true"\r
-                               ModuleDefinitionFile=".\grpapi.def"\r
-                               ProgramDatabaseFile=".\Release/grpapi.pdb"\r
-                               ImportLibrary=".\Release/grpapi.lib"\r
-                               TargetMachine="1"\r
-                       />\r
-                       <Tool\r
-                               Name="VCALinkTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCManifestTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCXDCMakeTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCBscMakeTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCFxCopTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCAppVerifierTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCWebDeploymentTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCPostBuildEventTool"\r
-                       />\r
-               </Configuration>\r
-       </Configurations>\r
-       <References>\r
-       </References>\r
-       <Files>\r
-               <Filter\r
-                       Name="Source Files"\r
-                       Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
-                       >\r
-                       <File\r
-                               RelativePath="grpapi.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               Optimization="0"\r
-                                               PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;GRPAPI_EXPORTS;$(NoInherit)"\r
-                                               BasicRuntimeChecks="3"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               Optimization="2"\r
-                                               PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;GRPAPI_EXPORTS;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="grpapi.def"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="grpapi.rc"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\LoadStorm\Storm.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               Optimization="0"\r
-                                               PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;GRPAPI_EXPORTS;$(NoInherit)"\r
-                                               BasicRuntimeChecks="3"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               Optimization="2"\r
-                                               PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;GRPAPI_EXPORTS;$(NoInherit)"\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-               </Filter>\r
-               <Filter\r
-                       Name="Header Files"\r
-                       Filter="h;hpp;hxx;hm;inl"\r
-                       >\r
-                       <File\r
-                               RelativePath="grpapi.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath=".\resource.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\LoadStorm\Storm.h"\r
-                               >\r
-                       </File>\r
-               </Filter>\r
-               <Filter\r
-                       Name="Resource Files"\r
-                       Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"\r
-                       >\r
-               </Filter>\r
-       </Files>\r
-       <Globals>\r
-       </Globals>\r
-</VisualStudioProject>\r
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+       ProjectType="Visual C++"
+       Version="8.00"
+       Name="grpapi"
+       ProjectGUID="{08812E9C-7F03-4DCB-8828-F3BDB0728EC7}"
+       RootNamespace="grpapi"
+       SccProjectName="&quot;$/grpapi_VS2005.root/grpapi&quot;, IGAAAAAA"
+       SccLocalPath=".."
+       SccProvider="MSSCCI:Microsoft Visual SourceSafe"
+       >
+       <Platforms>
+               <Platform
+                       Name="Win32"
+               />
+       </Platforms>
+       <ToolFiles>
+       </ToolFiles>
+       <Configurations>
+               <Configuration
+                       Name="Debug|Win32"
+                       OutputDirectory=".\Debug"
+                       IntermediateDirectory=".\Debug"
+                       ConfigurationType="2"
+                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+                       UseOfMFC="0"
+                       ATLMinimizesCRunTimeLibraryUsage="false"
+                       CharacterSet="2"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                               CommandLine="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)..\drawgrp\debug\&quot;&#x0D;&#x0A;"
+                               Outputs="$(TargetDir)null.txt"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                               PreprocessorDefinitions="_DEBUG"
+                               MkTypLibCompatible="true"
+                               SuppressStartupBanner="true"
+                               TargetEnvironment="1"
+                               TypeLibraryName=".\Debug/grpapi.tlb"
+                               HeaderFileName=""
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="0"
+                               PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;GRPAPI_EXPORTS"
+                               BasicRuntimeChecks="3"
+                               RuntimeLibrary="1"
+                               UsePrecompiledHeader="0"
+                               PrecompiledHeaderFile=".\Debug/grpapi.pch"
+                               AssemblerListingLocation=".\Debug/"
+                               ObjectFile=".\Debug/"
+                               ProgramDataBaseFileName=".\Debug/"
+                               WarningLevel="3"
+                               SuppressStartupBanner="true"
+                               DebugInformationFormat="4"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               PreprocessorDefinitions="_DEBUG"
+                               Culture="1033"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLinkerTool"
+                               OutputFile=".\Debug/grpapi.dll"
+                               LinkIncremental="1"
+                               SuppressStartupBanner="true"
+                               ModuleDefinitionFile=".\grpapi.def"
+                               GenerateDebugInformation="true"
+                               ProgramDatabaseFile=".\Debug/grpapi.pdb"
+                               ImportLibrary=".\Debug/grpapi.lib"
+                               TargetMachine="1"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCManifestTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCAppVerifierTool"
+                       />
+                       <Tool
+                               Name="VCWebDeploymentTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+               <Configuration
+                       Name="Release|Win32"
+                       OutputDirectory=".\Release"
+                       IntermediateDirectory=".\Release"
+                       ConfigurationType="2"
+                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+                       UseOfMFC="0"
+                       ATLMinimizesCRunTimeLibraryUsage="false"
+                       CharacterSet="2"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                               CommandLine="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)..\drawgrp\release\&quot;&#x0D;&#x0A;"
+                               Outputs="$(TargetDir)null.txt"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                               PreprocessorDefinitions="NDEBUG"
+                               MkTypLibCompatible="true"
+                               SuppressStartupBanner="true"
+                               TargetEnvironment="1"
+                               TypeLibraryName=".\Release/grpapi.tlb"
+                               HeaderFileName=""
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="2"
+                               InlineFunctionExpansion="2"
+                               FavorSizeOrSpeed="1"
+                               PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GRPAPI_EXPORTS"
+                               StringPooling="true"
+                               RuntimeLibrary="0"
+                               EnableFunctionLevelLinking="true"
+                               UsePrecompiledHeader="0"
+                               PrecompiledHeaderFile=".\Release/grpapi.pch"
+                               AssemblerListingLocation=".\Release/"
+                               ObjectFile=".\Release/"
+                               ProgramDataBaseFileName=".\Release/"
+                               WarningLevel="3"
+                               SuppressStartupBanner="true"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               PreprocessorDefinitions="NDEBUG"
+                               Culture="1033"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLinkerTool"
+                               OutputFile=".\Release/grpapi.dll"
+                               LinkIncremental="1"
+                               SuppressStartupBanner="true"
+                               ModuleDefinitionFile=".\grpapi.def"
+                               ProgramDatabaseFile=".\Release/grpapi.pdb"
+                               ImportLibrary=".\Release/grpapi.lib"
+                               TargetMachine="1"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCManifestTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCAppVerifierTool"
+                       />
+                       <Tool
+                               Name="VCWebDeploymentTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+       </Configurations>
+       <References>
+       </References>
+       <Files>
+               <Filter
+                       Name="Source Files"
+                       Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+                       >
+                       <File
+                               RelativePath="grpapi.cpp"
+                               >
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               Optimization="0"
+                                               PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;GRPAPI_EXPORTS;$(NoInherit)"
+                                               BasicRuntimeChecks="3"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               Optimization="2"
+                                               PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;GRPAPI_EXPORTS;$(NoInherit)"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="grpapi.def"
+                               >
+                       </File>
+                       <File
+                               RelativePath="grpapi.rc"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\LoadStorm\Storm.cpp"
+                               >
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               Optimization="0"
+                                               PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;GRPAPI_EXPORTS;$(NoInherit)"
+                                               BasicRuntimeChecks="3"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               Optimization="2"
+                                               PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;GRPAPI_EXPORTS;$(NoInherit)"
+                                       />
+                               </FileConfiguration>
+                       </File>
+               </Filter>
+               <Filter
+                       Name="Header Files"
+                       Filter="h;hpp;hxx;hm;inl"
+                       >
+                       <File
+                               RelativePath="grpapi.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\resource.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\LoadStorm\Storm.h"
+                               >
+                       </File>
+               </Filter>
+               <Filter
+                       Name="Resource Files"
+                       Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+                       >
+               </Filter>
+       </Files>
+       <Globals>
+       </Globals>
+</VisualStudioProject>
index 055d30a..d780160 100644 (file)
@@ -1,10 +1,10 @@
-""\r
-{\r
-"FILE_VERSION" = "9237"\r
-"ENLISTMENT_CHOICE" = "NEVER"\r
-"PROJECT_FILE_RELATIVE_PATH" = "relative:grpapi"\r
-"NUMBER_OF_EXCLUDED_FILES" = "0"\r
-"ORIGINAL_PROJECT_FILE_PATH" = ""\r
-"NUMBER_OF_NESTED_PROJECTS" = "0"\r
-"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"\r
-}\r
+""
+{
+"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"
+}
index 055d30a..d780160 100644 (file)
@@ -1,10 +1,10 @@
-""\r
-{\r
-"FILE_VERSION" = "9237"\r
-"ENLISTMENT_CHOICE" = "NEVER"\r
-"PROJECT_FILE_RELATIVE_PATH" = "relative:grpapi"\r
-"NUMBER_OF_EXCLUDED_FILES" = "0"\r
-"ORIGINAL_PROJECT_FILE_PATH" = ""\r
-"NUMBER_OF_NESTED_PROJECTS" = "0"\r
-"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"\r
-}\r
+""
+{
+"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"
+}
index 9a63fa8..71018b7 100644 (file)
@@ -1,70 +1,70 @@
-#include "grpapi_no-lib.h"\r
-\r
-struct GRPAPIMODULE {\r
-       GRPAPIMODULE();\r
-       ~GRPAPIMODULE();\r
-} GrpApi;\r
-\r
-HINSTANCE hGrpApi = 0;\r
-\r
-funcLoadPalette LoadPalette = 0;\r
-funcLoadGrp LoadGrp = 0;\r
-funcDestroyGrp DestroyGrp = 0;\r
-funcDrawGrp DrawGrp = 0;\r
-funcGetGrpInfo GetGrpInfo = 0;\r
-funcGetGrpFrameInfo GetGrpFrameInfo = 0;\r
-funcCreateGrp CreateGrp = 0;\r
-funcSetFunctionGetPixel SetFunctionGetPixel = 0;\r
-funcSetFunctionSetPixel SetFunctionSetPixel = 0;\r
-funcSetMpqDll SetMpqDll = 0;\r
-funcLoadGrpApi LoadGrpApi = 0;\r
-funcFreeGrpApi FreeGrpApi = 0;\r
-\r
-GRPAPIMODULE::GRPAPIMODULE()\r
-{\r
-       if (hGrpApi!=0) return;\r
-       hGrpApi = LoadLibrary("grpapi.dll");\r
-\r
-       if (hGrpApi!=0) {\r
-               LoadPalette = (funcLoadPalette)GetProcAddress(hGrpApi,"LoadPalette");\r
-               LoadGrp = (funcLoadGrp)GetProcAddress(hGrpApi,"LoadGrp");\r
-               DestroyGrp = (funcDestroyGrp)GetProcAddress(hGrpApi,"DestroyGrp");\r
-               DrawGrp = (funcDrawGrp)GetProcAddress(hGrpApi,"DrawGrp");\r
-               GetGrpInfo = (funcGetGrpInfo)GetProcAddress(hGrpApi,"GetGrpInfo");\r
-               GetGrpFrameInfo = (funcGetGrpFrameInfo)GetProcAddress(hGrpApi,"GetGrpFrameInfo");\r
-               CreateGrp = (funcCreateGrp)GetProcAddress(hGrpApi,"CreateGrp");\r
-               SetFunctionGetPixel = (funcSetFunctionGetPixel)GetProcAddress(hGrpApi,"SetFunctionGetPixel");\r
-               SetFunctionSetPixel = (funcSetFunctionSetPixel)GetProcAddress(hGrpApi,"SetFunctionSetPixel");\r
-               SetMpqDll = (funcSetMpqDll)GetProcAddress(hGrpApi,"SetMpqDll");\r
-               LoadGrpApi = (funcLoadGrpApi)GetProcAddress(hGrpApi,"LoadGrpApi");\r
-               FreeGrpApi = (funcFreeGrpApi)GetProcAddress(hGrpApi,"FreeGrpApi");\r
-       }\r
-}\r
-\r
-GRPAPIMODULE::~GRPAPIMODULE()\r
-{\r
-       LoadPalette = 0;\r
-       LoadGrp = 0;\r
-       DestroyGrp = 0;\r
-       DrawGrp = 0;\r
-       GetGrpInfo = 0;\r
-       GetGrpFrameInfo = 0;\r
-       CreateGrp = 0;\r
-       SetFunctionGetPixel = 0;\r
-       SetFunctionSetPixel = 0;\r
-       SetMpqDll = 0;\r
-       LoadGrpApi = 0;\r
-       FreeGrpApi = 0;\r
-\r
-       if (hGrpApi==0) return;\r
-       FreeLibrary(hGrpApi);\r
-       hGrpApi = 0;\r
-}\r
-\r
-void LoadGrpApiLib()\r
-{\r
-}\r
-\r
-void FreeGrpApiLib()\r
-{\r
-}\r
+#include "grpapi_no-lib.h"
+
+struct GRPAPIMODULE {
+       GRPAPIMODULE();
+       ~GRPAPIMODULE();
+} GrpApi;
+
+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;
+
+GRPAPIMODULE::GRPAPIMODULE()
+{
+       if (hGrpApi!=0) return;
+       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");
+       }
+}
+
+GRPAPIMODULE::~GRPAPIMODULE()
+{
+       LoadPalette = 0;
+       LoadGrp = 0;
+       DestroyGrp = 0;
+       DrawGrp = 0;
+       GetGrpInfo = 0;
+       GetGrpFrameInfo = 0;
+       CreateGrp = 0;
+       SetFunctionGetPixel = 0;
+       SetFunctionSetPixel = 0;
+       SetMpqDll = 0;
+       LoadGrpApi = 0;
+       FreeGrpApi = 0;
+
+       if (hGrpApi==0) return;
+       FreeLibrary(hGrpApi);
+       hGrpApi = 0;
+}
+
+void LoadGrpApiLib()
+{
+}
+
+void FreeGrpApiLib()
+{
+}
index 9dc9baa..fef3f6c 100644 (file)
-/*\r
-\r
-  ShadowFlare GRP Library. (c) ShadowFlare Software 2002\r
-\r
-  Any comments or suggestions are accepted at blakflare@hotmail.com (ShadowFlare)\r
-*/\r
-\r
-#ifndef GRPAPI_INCLUDED\r
-#define GRPAPI_INCLUDED\r
-\r
-#include <windows.h>\r
-\r
-#ifdef GRPAPI_EXPORTS\r
-#define GRPAPI __declspec(dllexport)\r
-#else\r
-#define GRPAPI __declspec(dllimport)\r
-#endif\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-// These no longer need to be called\r
-extern void LoadGrpApiLib();\r
-extern void FreeGrpApiLib();\r
-\r
-typedef struct {\r
-       WORD nFrames;\r
-       WORD wMaxWidth;\r
-       WORD wMaxHeight;\r
-} GRPHEADER;\r
-\r
-#define HORIZONTAL_FLIP 0x00000001 // Flips the graphic horizontally\r
-#define VERTICAL_FLIP   0x00000002 // Flips the graphic vertically\r
-#define SHADOW_COLOR    0x00000004 // Causes the graphic to be drawn in one color\r
-                                   // Second byte of flags is the red component of\r
-                                   // the shadow's color, third byte is green,\r
-                                   // fourth byte is blue; like this:\r
-                                   // SHADOW_COLOR|0xBBGGRR00\r
-                                   // This can be accomplished by using the left shift\r
-                                   // operator like this:  SHADOW_COLOR|(color << 8)\r
-#define ALPHA_BLEND     0x00000008 // Blends the graphic with what it is being drawn over.\r
-                                   // The dwAlpha parameter will only be used when this\r
-                                   // flag is specified.  dwAlpha is an RGB value\r
-                                   // (0xBBGGRR).\r
-                                   // Note: Because of the extra calculations required,\r
-                                   // alpha blended graphics take longer to draw\r
-#define USE_INDEX       0x00000010 // Only valid when used with a custom SetPixel function.\r
-                                   // This flag cannot be used in combination with\r
-                                   // ALPHA_BLEND or SHADOW_COLOR\r
-                                   // When this flag is used, the index to a color in the\r
-                                   // palette will be passed to your custom SetPixel\r
-                                   // function instead of the actual color.\r
-\r
-// Palette is an array of 256 DWORD's\r
-// For LoadPalette and LoadGrp, lpFileName may be a file in an open mpq archive\r
-// or a file not in an archive\r
-typedef BOOL   (WINAPI* funcLoadPalette)(LPCSTR lpFileName, DWORD *dwPaletteBuffer);\r
-typedef HANDLE (WINAPI* funcLoadGrp)(LPCSTR lpFileName);\r
-typedef BOOL   (WINAPI* funcDestroyGrp)(HANDLE hGrp);\r
-typedef BOOL   (WINAPI* funcDrawGrp)(HANDLE hGrp, HDC hdcDest, int nXDest, int nYDest, WORD nFrame, DWORD *dwPalette, DWORD dwFlags, DWORD dwAlpha);\r
-typedef BOOL   (WINAPI* funcGetGrpInfo)(HANDLE hGrp, GRPHEADER *GrpInfo);\r
-typedef BOOL   (WINAPI* funcGetGrpFrameInfo)(HANDLE hGrp, WORD nFrame, DWORD *nLeft, DWORD *nTop, DWORD *nWidth, DWORD *nHeight);\r
-extern funcLoadPalette LoadPalette;\r
-extern funcLoadGrp LoadGrp;\r
-extern funcDestroyGrp DestroyGrp;\r
-extern funcDrawGrp DrawGrp;\r
-extern funcGetGrpInfo GetGrpInfo;\r
-extern funcGetGrpFrameInfo GetGrpFrameInfo;\r
-\r
-// A pointer to the raw image data to encode should be passed to lpImageData.  The size of\r
-// the buffer containing the data should be nFrames * wMaxWidth * wMaxHeight * sizeof(short)\r
-// and the values should be arranged row by row of the frame, with the top row first.\r
-// After all the rows of a frame have been put into the buffer, the rows of the next frame\r
-// go after it.  For transparent pixels, they should be set to -1.  All other pixels should\r
-// have the high order byte set to zero, meaning that they should not be negative and the\r
-// values should not exceed 255 (0xFF).  The values used for the colors are indexes into the\r
-// color palette.\r
-// Pass TRUE to bNoCompress if you need an uncompressed GRP.\r
-// Pass a pointer to a DWORD value to nGrpSize to receive the size in bytes of the resulting encoded GRP.\r
-// The return value of this function is actually a pointer to the GRP data.  This is what your\r
-// program should save to a file.  The size of this buffer is the value received by nGrpSize.\r
-// When your program is done with the returned buffer, it should call DestroyGrp on the\r
-// buffer that was returned by this function to free up the memory from it.\r
-// The pointer returned by this function can also be directly used by DrawGrp or GetGrpInfo.\r
-typedef HANDLE (WINAPI* funcCreateGrp)(signed short *lpImageData, WORD nFrames, WORD wMaxWidth, WORD wMaxHeight, BOOL bNoCompress, DWORD *nGrpSize);\r
-extern funcCreateGrp CreateGrp;\r
-\r
-typedef COLORREF (WINAPI* GETPIXELPROC)(\r
-  HDC hDC, // same value as hdcDest from DrawGrp,\r
-              // does not need to be used as an HDC,\r
-              // can be used for any other type of pointer\r
-  int X,   // x-coordinate of pixel\r
-  int Y    // y-coordinate of pixel\r
-);\r
-typedef void (WINAPI* SETPIXELPROC)(\r
-       HDC hDC,          // same value as hdcDest from DrawGrp,\r
-                         // does not need to be used as an HDC,\r
-                         // can be used for any other type of pointer\r
-       int X,            // x-coordinate of pixel\r
-       int Y,            // y-coordinate of pixel\r
-       COLORREF clrColor // new pixel color\r
-);\r
-\r
-// Call these to have DrawGrp use custom functions for reading and drawing pixels\r
-// so that you can have it read from and write to a buffer, for example.\r
-typedef void (WINAPI* funcSetFunctionGetPixel)(GETPIXELPROC lpGetPixelProc);\r
-typedef void (WINAPI* funcSetFunctionSetPixel)(SETPIXELPROC lpSetPixelProc);\r
-extern funcSetFunctionGetPixel SetFunctionGetPixel; // Only used with ALPHA_BLEND\r
-extern funcSetFunctionSetPixel SetFunctionSetPixel;\r
-\r
-// Call this to make a different Storm.dll-compatible MPQ library be used (like SFMPQ).\r
-typedef BOOL (WINAPI* funcSetMpqDll)(LPCSTR lpDllFileName);\r
-extern funcSetMpqDll SetMpqDll;\r
-\r
-// These no longer need to be called\r
-typedef BOOL   (WINAPI* funcLoadGrpApi)();\r
-typedef void   (WINAPI* funcFreeGrpApi)();\r
-extern funcLoadGrpApi LoadGrpApi;\r
-extern funcFreeGrpApi FreeGrpApi;\r
-\r
-#ifdef __cplusplus\r
-};  // extern "C" \r
-#endif\r
-\r
-#endif\r
+/*
+
+  ShadowFlare GRP Library. (c) ShadowFlare Software 2002
+
+  Any comments or suggestions are accepted at blakflare@hotmail.com (ShadowFlare)
+*/
+
+#ifndef GRPAPI_INCLUDED
+#define GRPAPI_INCLUDED
+
+#include <windows.h>
+
+#ifdef GRPAPI_EXPORTS
+#define GRPAPI __declspec(dllexport)
+#else
+#define GRPAPI __declspec(dllimport)
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// These no longer need to be called
+extern void LoadGrpApiLib();
+extern void FreeGrpApiLib();
+
+typedef struct {
+       WORD nFrames;
+       WORD wMaxWidth;
+       WORD wMaxHeight;
+} GRPHEADER;
+
+#define HORIZONTAL_FLIP 0x00000001 // Flips the graphic horizontally
+#define VERTICAL_FLIP   0x00000002 // Flips the graphic vertically
+#define SHADOW_COLOR    0x00000004 // Causes the graphic to be drawn in one color
+                                   // Second byte of flags is the red component of
+                                   // the shadow's color, third byte is green,
+                                   // fourth byte is blue; like this:
+                                   // SHADOW_COLOR|0xBBGGRR00
+                                   // This can be accomplished by using the left shift
+                                   // operator like this:  SHADOW_COLOR|(color << 8)
+#define ALPHA_BLEND     0x00000008 // Blends the graphic with what it is being drawn over.
+                                   // The dwAlpha parameter will only be used when this
+                                   // flag is specified.  dwAlpha is an RGB value
+                                   // (0xBBGGRR).
+                                   // Note: Because of the extra calculations required,
+                                   // alpha blended graphics take longer to draw
+#define USE_INDEX       0x00000010 // Only valid when used with a custom SetPixel function.
+                                   // This flag cannot be used in combination with
+                                   // ALPHA_BLEND or SHADOW_COLOR
+                                   // When this flag is used, the index to a color in the
+                                   // palette will be passed to your custom SetPixel
+                                   // function instead of the actual color.
+
+// 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;
+
+// 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)
+// and the values should be arranged row by row of the frame, with the top row first.
+// After all the rows of a frame have been put into the buffer, the rows of the next frame
+// go after it.  For transparent pixels, they should be set to -1.  All other pixels should
+// have the high order byte set to zero, meaning that they should not be negative and the
+// values should not exceed 255 (0xFF).  The values used for the colors are indexes into the
+// color palette.
+// Pass TRUE to bNoCompress if you need an uncompressed GRP.
+// Pass a pointer to a DWORD value to nGrpSize to receive the size in bytes of the resulting encoded GRP.
+// The return value of this function is actually a pointer to the GRP data.  This is what your
+// program should save to a file.  The size of this buffer is the value received by nGrpSize.
+// 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;
+
+typedef COLORREF (WINAPI* GETPIXELPROC)(
+  HDC hDC, // same value as hdcDest from DrawGrp,
+              // does not need to be used as an HDC,
+              // can be used for any other type of pointer
+  int X,   // x-coordinate of pixel
+  int Y    // y-coordinate of pixel
+);
+typedef void (WINAPI* SETPIXELPROC)(
+       HDC hDC,          // same value as hdcDest from DrawGrp,
+                         // does not need to be used as an HDC,
+                         // can be used for any other type of pointer
+       int X,            // x-coordinate of pixel
+       int Y,            // y-coordinate of pixel
+       COLORREF clrColor // new pixel color
+);
+
+// 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;
+
+// Call this to make a different Storm.dll-compatible MPQ library be used (like SFMPQ).
+typedef BOOL (WINAPI* funcSetMpqDll)(LPCSTR lpDllFileName);
+extern funcSetMpqDll SetMpqDll;
+
+// These no longer need to be called
+typedef BOOL   (WINAPI* funcLoadGrpApi)();
+typedef void   (WINAPI* funcFreeGrpApi)();
+extern funcLoadGrpApi LoadGrpApi;
+extern funcFreeGrpApi FreeGrpApi;
+
+#ifdef __cplusplus
+};  // extern "C" 
+#endif
+
+#endif
index 38a197b..0c2c8c3 100644 (file)
-<?xml version="1.0" encoding="Windows-1252"?>\r
-<VisualStudioProject\r
-       ProjectType="Visual C++"\r
-       Version="8.00"\r
-       Name="grplib"\r
-       ProjectGUID="{66127C6F-39DA-4B7A-9856-789ED0139DCB}"\r
-       SccProjectName="&quot;$/grpapi_VS2005.root/grpapi&quot;, IGAAAAAA"\r
-       SccLocalPath=".."\r
-       SccProvider="MSSCCI:Microsoft Visual SourceSafe"\r
-       >\r
-       <Platforms>\r
-               <Platform\r
-                       Name="Win32"\r
-               />\r
-       </Platforms>\r
-       <ToolFiles>\r
-       </ToolFiles>\r
-       <Configurations>\r
-               <Configuration\r
-                       Name="Debug|Win32"\r
-                       OutputDirectory=".\grplib___Win32_Debug"\r
-                       IntermediateDirectory=".\Debug"\r
-                       ConfigurationType="4"\r
-                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
-                       UseOfMFC="0"\r
-                       ATLMinimizesCRunTimeLibraryUsage="false"\r
-                       CharacterSet="2"\r
-                       >\r
-                       <Tool\r
-                               Name="VCPreBuildEventTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCCustomBuildTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCXMLDataGeneratorTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCWebServiceProxyGeneratorTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCMIDLTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCCLCompilerTool"\r
-                               Optimization="0"\r
-                               PreprocessorDefinitions="WIN32;_DEBUG;_LIB;GRPAPI_STATIC"\r
-                               BasicRuntimeChecks="3"\r
-                               RuntimeLibrary="1"\r
-                               UsePrecompiledHeader="0"\r
-                               PrecompiledHeaderFile=".\Debug/grplib.pch"\r
-                               AssemblerListingLocation=".\Debug/"\r
-                               ObjectFile=".\Debug/"\r
-                               ProgramDataBaseFileName=".\Debug/"\r
-                               WarningLevel="3"\r
-                               SuppressStartupBanner="true"\r
-                               DebugInformationFormat="4"\r
-                       />\r
-                       <Tool\r
-                               Name="VCManagedResourceCompilerTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCResourceCompilerTool"\r
-                               PreprocessorDefinitions="_DEBUG"\r
-                               Culture="1033"\r
-                       />\r
-                       <Tool\r
-                               Name="VCPreLinkEventTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCLibrarianTool"\r
-                               OutputFile="Debug\grp_static.lib"\r
-                               SuppressStartupBanner="true"\r
-                       />\r
-                       <Tool\r
-                               Name="VCALinkTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCXDCMakeTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCBscMakeTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCFxCopTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCPostBuildEventTool"\r
-                       />\r
-               </Configuration>\r
-               <Configuration\r
-                       Name="Release|Win32"\r
-                       OutputDirectory=".\Release"\r
-                       IntermediateDirectory=".\grplib___Win32_Release"\r
-                       ConfigurationType="4"\r
-                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
-                       UseOfMFC="0"\r
-                       ATLMinimizesCRunTimeLibraryUsage="false"\r
-                       CharacterSet="2"\r
-                       >\r
-                       <Tool\r
-                               Name="VCPreBuildEventTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCCustomBuildTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCXMLDataGeneratorTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCWebServiceProxyGeneratorTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCMIDLTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCCLCompilerTool"\r
-                               Optimization="2"\r
-                               InlineFunctionExpansion="1"\r
-                               PreprocessorDefinitions="WIN32;NDEBUG;_LIB;GRPAPI_STATIC"\r
-                               StringPooling="true"\r
-                               RuntimeLibrary="0"\r
-                               EnableFunctionLevelLinking="true"\r
-                               UsePrecompiledHeader="0"\r
-                               PrecompiledHeaderFile=".\grplib___Win32_Release/grplib.pch"\r
-                               AssemblerListingLocation=".\grplib___Win32_Release/"\r
-                               ObjectFile=".\grplib___Win32_Release/"\r
-                               ProgramDataBaseFileName=".\grplib___Win32_Release/"\r
-                               WarningLevel="3"\r
-                               SuppressStartupBanner="true"\r
-                       />\r
-                       <Tool\r
-                               Name="VCManagedResourceCompilerTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCResourceCompilerTool"\r
-                               PreprocessorDefinitions="NDEBUG"\r
-                               Culture="1033"\r
-                       />\r
-                       <Tool\r
-                               Name="VCPreLinkEventTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCLibrarianTool"\r
-                               OutputFile="Release\grp_static.lib"\r
-                               SuppressStartupBanner="true"\r
-                       />\r
-                       <Tool\r
-                               Name="VCALinkTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCXDCMakeTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCBscMakeTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCFxCopTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCPostBuildEventTool"\r
-                       />\r
-               </Configuration>\r
-       </Configurations>\r
-       <References>\r
-       </References>\r
-       <Files>\r
-               <Filter\r
-                       Name="Source Files"\r
-                       Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
-                       >\r
-                       <File\r
-                               RelativePath="grpapi.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               Optimization="0"\r
-                                               PreprocessorDefinitions=""\r
-                                               BasicRuntimeChecks="3"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               Optimization="2"\r
-                                               PreprocessorDefinitions=""\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\LoadStorm\Storm.cpp"\r
-                               >\r
-                               <FileConfiguration\r
-                                       Name="Debug|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               Optimization="0"\r
-                                               PreprocessorDefinitions=""\r
-                                               BasicRuntimeChecks="3"\r
-                                       />\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="Release|Win32"\r
-                                       >\r
-                                       <Tool\r
-                                               Name="VCCLCompilerTool"\r
-                                               Optimization="2"\r
-                                               PreprocessorDefinitions=""\r
-                                       />\r
-                               </FileConfiguration>\r
-                       </File>\r
-               </Filter>\r
-               <Filter\r
-                       Name="Header Files"\r
-                       Filter="h;hpp;hxx;hm;inl"\r
-                       >\r
-                       <File\r
-                               RelativePath="grp_static.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="grpapi.h"\r
-                               >\r
-                       </File>\r
-                       <File\r
-                               RelativePath="..\LoadStorm\Storm.h"\r
-                               >\r
-                       </File>\r
-               </Filter>\r
-       </Files>\r
-       <Globals>\r
-       </Globals>\r
-</VisualStudioProject>\r
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+       ProjectType="Visual C++"
+       Version="8.00"
+       Name="grplib"
+       ProjectGUID="{66127C6F-39DA-4B7A-9856-789ED0139DCB}"
+       SccProjectName="&quot;$/grpapi_VS2005.root/grpapi&quot;, IGAAAAAA"
+       SccLocalPath=".."
+       SccProvider="MSSCCI:Microsoft Visual SourceSafe"
+       >
+       <Platforms>
+               <Platform
+                       Name="Win32"
+               />
+       </Platforms>
+       <ToolFiles>
+       </ToolFiles>
+       <Configurations>
+               <Configuration
+                       Name="Debug|Win32"
+                       OutputDirectory=".\grplib___Win32_Debug"
+                       IntermediateDirectory=".\Debug"
+                       ConfigurationType="4"
+                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+                       UseOfMFC="0"
+                       ATLMinimizesCRunTimeLibraryUsage="false"
+                       CharacterSet="2"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="0"
+                               PreprocessorDefinitions="WIN32;_DEBUG;_LIB;GRPAPI_STATIC"
+                               BasicRuntimeChecks="3"
+                               RuntimeLibrary="1"
+                               UsePrecompiledHeader="0"
+                               PrecompiledHeaderFile=".\Debug/grplib.pch"
+                               AssemblerListingLocation=".\Debug/"
+                               ObjectFile=".\Debug/"
+                               ProgramDataBaseFileName=".\Debug/"
+                               WarningLevel="3"
+                               SuppressStartupBanner="true"
+                               DebugInformationFormat="4"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               PreprocessorDefinitions="_DEBUG"
+                               Culture="1033"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLibrarianTool"
+                               OutputFile="Debug\grp_static.lib"
+                               SuppressStartupBanner="true"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+               <Configuration
+                       Name="Release|Win32"
+                       OutputDirectory=".\Release"
+                       IntermediateDirectory=".\grplib___Win32_Release"
+                       ConfigurationType="4"
+                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+                       UseOfMFC="0"
+                       ATLMinimizesCRunTimeLibraryUsage="false"
+                       CharacterSet="2"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="2"
+                               InlineFunctionExpansion="1"
+                               PreprocessorDefinitions="WIN32;NDEBUG;_LIB;GRPAPI_STATIC"
+                               StringPooling="true"
+                               RuntimeLibrary="0"
+                               EnableFunctionLevelLinking="true"
+                               UsePrecompiledHeader="0"
+                               PrecompiledHeaderFile=".\grplib___Win32_Release/grplib.pch"
+                               AssemblerListingLocation=".\grplib___Win32_Release/"
+                               ObjectFile=".\grplib___Win32_Release/"
+                               ProgramDataBaseFileName=".\grplib___Win32_Release/"
+                               WarningLevel="3"
+                               SuppressStartupBanner="true"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               PreprocessorDefinitions="NDEBUG"
+                               Culture="1033"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLibrarianTool"
+                               OutputFile="Release\grp_static.lib"
+                               SuppressStartupBanner="true"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+       </Configurations>
+       <References>
+       </References>
+       <Files>
+               <Filter
+                       Name="Source Files"
+                       Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+                       >
+                       <File
+                               RelativePath="grpapi.cpp"
+                               >
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               Optimization="0"
+                                               PreprocessorDefinitions=""
+                                               BasicRuntimeChecks="3"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               Optimization="2"
+                                               PreprocessorDefinitions=""
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="..\LoadStorm\Storm.cpp"
+                               >
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               Optimization="0"
+                                               PreprocessorDefinitions=""
+                                               BasicRuntimeChecks="3"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                               Optimization="2"
+                                               PreprocessorDefinitions=""
+                                       />
+                               </FileConfiguration>
+                       </File>
+               </Filter>
+               <Filter
+                       Name="Header Files"
+                       Filter="h;hpp;hxx;hm;inl"
+                       >
+                       <File
+                               RelativePath="grp_static.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="grpapi.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\LoadStorm\Storm.h"
+                               >
+                       </File>
+               </Filter>
+       </Files>
+       <Globals>
+       </Globals>
+</VisualStudioProject>
index 055d30a..d780160 100644 (file)
@@ -1,10 +1,10 @@
-""\r
-{\r
-"FILE_VERSION" = "9237"\r
-"ENLISTMENT_CHOICE" = "NEVER"\r
-"PROJECT_FILE_RELATIVE_PATH" = "relative:grpapi"\r
-"NUMBER_OF_EXCLUDED_FILES" = "0"\r
-"ORIGINAL_PROJECT_FILE_PATH" = ""\r
-"NUMBER_OF_NESTED_PROJECTS" = "0"\r
-"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"\r
-}\r
+""
+{
+"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"
+}
index 82116dd..d934404 100644 (file)
@@ -1,15 +1,15 @@
-//{{NO_DEPENDENCIES}}\r
-// Microsoft Visual C++ generated include file.\r
-// Used by grpapi.rc\r
-//\r
-\r
-// Next default values for new objects\r
-// \r
-#ifdef APSTUDIO_INVOKED\r
-#ifndef APSTUDIO_READONLY_SYMBOLS\r
-#define _APS_NEXT_RESOURCE_VALUE        102\r
-#define _APS_NEXT_COMMAND_VALUE         40001\r
-#define _APS_NEXT_CONTROL_VALUE         1000\r
-#define _APS_NEXT_SYMED_VALUE           101\r
-#endif\r
-#endif\r
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by grpapi.rc
+//
+
+// Next default values for new objects
+// 
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE        102
+#define _APS_NEXT_COMMAND_VALUE         40001
+#define _APS_NEXT_CONTROL_VALUE         1000
+#define _APS_NEXT_SYMED_VALUE           101
+#endif
+#endif
index c8e6366..02b528f 100644 (file)
-/*\r
-       Storm.cpp\r
-*/\r
-\r
-#include "storm.h"\r
-\r
-struct STORMMODULE {\r
-       STORMMODULE();\r
-       ~STORMMODULE();\r
-} Storm;\r
-\r
-void FreeStorm();\r
-\r
-HINSTANCE hStorm = 0;\r
-BOOL AlreadyLoaded = FALSE;\r
-\r
-// Storm Function Names\r
-funcSFileCloseArchive SFileCloseArchive = 0;\r
-funcSFileCloseFile SFileCloseFile = 0;\r
-funcSFileDestroy SFileDestroy = 0;\r
-funcSFileGetFileArchive SFileGetFileArchive = 0;\r
-funcSFileGetFileSize SFileGetFileSize = 0;\r
-funcSFileOpenArchive SFileOpenArchive = 0;\r
-funcSFileOpenFile SFileOpenFile = 0;\r
-funcSFileOpenFileEx SFileOpenFileEx = 0;\r
-funcSFileReadFile SFileReadFile = 0;\r
-funcSFileSetBasePath SFileSetBasePath = 0;\r
-funcSFileSetFilePointer SFileSetFilePointer = 0;\r
-funcSFileSetLocale SFileSetLocale = 0;\r
-funcSFileGetBasePath SFileGetBasePath = 0;\r
-funcSFileGetArchiveName SFileGetArchiveName = 0;\r
-funcSFileGetFileName SFileGetFileName = 0;\r
-\r
-STORMMODULE::STORMMODULE()\r
-{\r
-       if (hStorm!=0) return;\r
-       const char STORM_DLL[] = "Storm.dll";\r
-       hStorm = GetModuleHandle(STORM_DLL);\r
-       if (hStorm == NULL) hStorm = LoadLibrary(STORM_DLL);\r
-       else AlreadyLoaded=TRUE;\r
-\r
-       if (hStorm != NULL)\r
-       {\r
-               SFileCloseArchive = (funcSFileCloseArchive)GetProcAddress(hStorm, (LPCSTR)0xFC);\r
-               SFileCloseFile = (funcSFileCloseFile)GetProcAddress(hStorm, (LPCSTR)0xFD);\r
-               SFileDestroy = (funcSFileDestroy)GetProcAddress(hStorm, (LPCSTR)0x106);\r
-               SFileGetFileArchive = (funcSFileGetFileArchive)GetProcAddress(hStorm, (LPCSTR)0x108);\r
-               SFileGetFileSize = (funcSFileGetFileSize)GetProcAddress(hStorm, (LPCSTR)0x109);\r
-               SFileOpenArchive = (funcSFileOpenArchive)GetProcAddress(hStorm, (LPCSTR)0x10A);\r
-               SFileOpenFile = (funcSFileOpenFile)GetProcAddress(hStorm, (LPCSTR)0x10B);\r
-               SFileOpenFileEx = (funcSFileOpenFileEx)GetProcAddress(hStorm, (LPCSTR)0x10C);\r
-               SFileReadFile = (funcSFileReadFile)GetProcAddress(hStorm, (LPCSTR)0x10D);\r
-               SFileSetBasePath = (funcSFileSetBasePath)GetProcAddress(hStorm, (LPCSTR)0x10E);\r
-               SFileSetFilePointer = (funcSFileSetFilePointer)GetProcAddress(hStorm, (LPCSTR)0x10F);\r
-               SFileSetLocale = (funcSFileSetLocale)GetProcAddress(hStorm, (LPCSTR)0x110);\r
-               SFileGetBasePath = (funcSFileGetBasePath)GetProcAddress(hStorm, (LPCSTR)0x111);\r
-               SFileGetArchiveName = (funcSFileGetArchiveName)GetProcAddress(hStorm, (LPCSTR)0x113);\r
-               SFileGetFileName = (funcSFileGetFileName)GetProcAddress(hStorm, (LPCSTR)0x114);\r
-       }\r
-       if (SFileDestroy && !AlreadyLoaded) SFileDestroy();\r
-}\r
-\r
-STORMMODULE::~STORMMODULE()\r
-{\r
-       FreeStorm();\r
-}\r
-\r
-HINSTANCE LoadStorm(char * DllFileName)\r
-{\r
-       FreeStorm();\r
-       if (hStorm!=0) return 0;\r
-       hStorm = GetModuleHandle(DllFileName);\r
-       if (hStorm == NULL) hStorm = LoadLibrary(DllFileName);\r
-       else AlreadyLoaded=TRUE;\r
-\r
-       if (hStorm != NULL)\r
-       {\r
-               SFileCloseArchive = (funcSFileCloseArchive)GetProcAddress(hStorm, (LPCSTR)0xFC);\r
-               SFileCloseFile = (funcSFileCloseFile)GetProcAddress(hStorm, (LPCSTR)0xFD);\r
-               SFileDestroy = (funcSFileDestroy)GetProcAddress(hStorm, (LPCSTR)0x106);\r
-               SFileGetFileArchive = (funcSFileGetFileArchive)GetProcAddress(hStorm, (LPCSTR)0x108);\r
-               SFileGetFileSize = (funcSFileGetFileSize)GetProcAddress(hStorm, (LPCSTR)0x109);\r
-               SFileOpenArchive = (funcSFileOpenArchive)GetProcAddress(hStorm, (LPCSTR)0x10A);\r
-               SFileOpenFile = (funcSFileOpenFile)GetProcAddress(hStorm, (LPCSTR)0x10B);\r
-               SFileOpenFileEx = (funcSFileOpenFileEx)GetProcAddress(hStorm, (LPCSTR)0x10C);\r
-               SFileReadFile = (funcSFileReadFile)GetProcAddress(hStorm, (LPCSTR)0x10D);\r
-               SFileSetBasePath = (funcSFileSetBasePath)GetProcAddress(hStorm, (LPCSTR)0x10E);\r
-               SFileSetFilePointer = (funcSFileSetFilePointer)GetProcAddress(hStorm, (LPCSTR)0x10F);\r
-               SFileSetLocale = (funcSFileSetLocale)GetProcAddress(hStorm, (LPCSTR)0x110);\r
-               SFileGetBasePath = (funcSFileGetBasePath)GetProcAddress(hStorm, (LPCSTR)0x111);\r
-               SFileGetArchiveName = (funcSFileGetArchiveName)GetProcAddress(hStorm, (LPCSTR)0x113);\r
-               SFileGetFileName = (funcSFileGetFileName)GetProcAddress(hStorm, (LPCSTR)0x114);\r
-       }\r
-       if (SFileDestroy && !AlreadyLoaded) SFileDestroy();\r
-       if (AlreadyLoaded==TRUE) return 0;\r
-       return hStorm;\r
-}\r
-\r
-void FreeStorm()\r
-{\r
-       SFileCloseArchive = 0;\r
-       SFileCloseFile = 0;\r
-       SFileDestroy = 0;\r
-       SFileGetFileArchive = 0;\r
-       SFileGetFileSize = 0;\r
-       SFileOpenArchive = 0;\r
-       SFileOpenFile = 0;\r
-       SFileOpenFileEx = 0;\r
-       SFileReadFile = 0;\r
-       SFileSetBasePath = 0;\r
-       SFileSetFilePointer = 0;\r
-       SFileSetLocale = 0;\r
-       SFileGetBasePath = 0;\r
-       SFileGetArchiveName = 0;\r
-       SFileGetFileName = 0;\r
-\r
-       if (hStorm==0) return;\r
-\r
-       if (AlreadyLoaded==FALSE) FreeLibrary(hStorm);\r
-       hStorm = 0;\r
-}\r
+/*
+       Storm.cpp
+*/
+
+#include "storm.h"
+
+struct STORMMODULE {
+       STORMMODULE();
+       ~STORMMODULE();
+} Storm;
+
+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;
+
+STORMMODULE::STORMMODULE()
+{
+       if (hStorm!=0) return;
+       const char STORM_DLL[] = "Storm.dll";
+       hStorm = GetModuleHandle(STORM_DLL);
+       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);
+       }
+       if (SFileDestroy && !AlreadyLoaded) SFileDestroy();
+}
+
+STORMMODULE::~STORMMODULE()
+{
+       FreeStorm();
+}
+
+HINSTANCE LoadStorm(char * DllFileName)
+{
+       FreeStorm();
+       if (hStorm!=0) return 0;
+       hStorm = GetModuleHandle(DllFileName);
+       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);
+       }
+       if (SFileDestroy && !AlreadyLoaded) SFileDestroy();
+       if (AlreadyLoaded==TRUE) return 0;
+       return hStorm;
+}
+
+void FreeStorm()
+{
+       SFileCloseArchive = 0;
+       SFileCloseFile = 0;
+       SFileDestroy = 0;
+       SFileGetFileArchive = 0;
+       SFileGetFileSize = 0;
+       SFileOpenArchive = 0;
+       SFileOpenFile = 0;
+       SFileOpenFileEx = 0;
+       SFileReadFile = 0;
+       SFileSetBasePath = 0;
+       SFileSetFilePointer = 0;
+       SFileSetLocale = 0;
+       SFileGetBasePath = 0;
+       SFileGetArchiveName = 0;
+       SFileGetFileName = 0;
+
+       if (hStorm==0) return;
+
+       if (AlreadyLoaded==FALSE) FreeLibrary(hStorm);
+       hStorm = 0;
+}
index 31a5eac..cfadd7f 100644 (file)
@@ -1,59 +1,59 @@
-#ifndef STORM_H_INCLUDED\r
-#define STORM_H_INCLUDED\r
-\r
-#include <windows.h>\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-// This no longer needs to be called\r
-extern HINSTANCE LoadStorm(char * DllFileName);\r
-\r
-#define SFILE_OPEN_HARD_DISK_FILE 0x0000 //Open archive without regard to the drive type it resides on\r
-#define SFILE_OPEN_CD_ROM_FILE    0x0001 //Open the archive only if it is on a CD-ROM\r
-\r
-#define SFILE_SEARCH_CURRENT_ONLY 0x00 //Used with SFileOpenFileEx; only the archive with the handle specified will be searched for the file\r
-#define SFILE_SEARCH_ALL_OPEN     0x01 //SFileOpenFileEx will look through all open archives for the file\r
-\r
-#define MPQHANDLE HANDLE\r
-\r
-// Storm Function Prototypes\r
-typedef BOOL  (WINAPI* funcSFileOpenArchive)(LPCSTR lpFilename, DWORD dwPriority, DWORD dwFlags, MPQHANDLE *hMPQ);\r
-typedef BOOL  (WINAPI* funcSFileCloseArchive)(MPQHANDLE hMPQ);\r
-typedef BOOL  (WINAPI* funcSFileOpenFile)(LPCSTR lpFileName, MPQHANDLE *hFile);\r
-typedef BOOL  (WINAPI* funcSFileOpenFileEx)(MPQHANDLE hMPQ, LPCSTR lpFileName, DWORD dwSearchScope, MPQHANDLE *hFile);\r
-typedef BOOL  (WINAPI* funcSFileCloseFile)(MPQHANDLE hFile);\r
-typedef DWORD (WINAPI* funcSFileGetFileSize)(MPQHANDLE hFile, LPDWORD lpFileSizeHigh);\r
-typedef DWORD (WINAPI* funcSFileSetFilePointer)(MPQHANDLE hFile, long lDistanceToMove, PLONG lplDistanceToMoveHigh, DWORD dwMoveMethod);\r
-typedef BOOL  (WINAPI* funcSFileReadFile)(MPQHANDLE hFile,LPVOID lpBuffer,DWORD nNumberOfBytesToRead,LPDWORD lpNumberOfBytesRead,LPOVERLAPPED lpOverlapped);\r
-typedef LCID  (WINAPI* funcSFileSetLocale)(LCID nNewLocale);\r
-typedef BOOL  (WINAPI* funcSFileDestroy)();\r
-typedef BOOL  (WINAPI* funcSFileGetArchiveName)(MPQHANDLE hMPQ, LPCSTR lpBuffer, DWORD dwBufferLength);\r
-typedef BOOL  (WINAPI* funcSFileGetFileName)(MPQHANDLE hFile, LPCSTR lpBuffer, DWORD dwBufferLength);\r
-typedef BOOL  (WINAPI* funcSFileGetFileArchive)(MPQHANDLE hFile, MPQHANDLE *hMPQ);\r
-typedef BOOL  (WINAPI* funcSFileGetBasePath)(LPCSTR lpBuffer, DWORD dwBufferLength);\r
-typedef BOOL  (WINAPI* funcSFileSetBasePath)(LPCSTR lpNewBasePath);\r
-\r
-// Storm Function Names\r
-extern funcSFileCloseArchive SFileCloseArchive;\r
-extern funcSFileCloseFile SFileCloseFile;\r
-extern funcSFileDestroy SFileDestroy;\r
-extern funcSFileGetFileArchive SFileGetFileArchive;\r
-extern funcSFileGetFileSize SFileGetFileSize;\r
-extern funcSFileOpenArchive SFileOpenArchive;\r
-extern funcSFileOpenFile SFileOpenFile;\r
-extern funcSFileOpenFileEx SFileOpenFileEx;\r
-extern funcSFileReadFile SFileReadFile;\r
-extern funcSFileSetBasePath SFileSetBasePath;\r
-extern funcSFileSetFilePointer SFileSetFilePointer;\r
-extern funcSFileSetLocale SFileSetLocale;\r
-extern funcSFileGetBasePath SFileGetBasePath;\r
-extern funcSFileGetArchiveName SFileGetArchiveName;\r
-extern funcSFileGetFileName SFileGetFileName;\r
-\r
-#ifdef __cplusplus\r
-};  // extern "C" \r
-#endif\r
-\r
-#endif\r
+#ifndef STORM_H_INCLUDED
+#define STORM_H_INCLUDED
+
+#include <windows.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// This no longer needs to be called
+extern HINSTANCE LoadStorm(char * DllFileName);
+
+#define SFILE_OPEN_HARD_DISK_FILE 0x0000 //Open archive without regard to the drive type it resides on
+#define SFILE_OPEN_CD_ROM_FILE    0x0001 //Open the archive only if it is on a CD-ROM
+
+#define SFILE_SEARCH_CURRENT_ONLY 0x00 //Used with SFileOpenFileEx; only the archive with the handle specified will be searched for the file
+#define SFILE_SEARCH_ALL_OPEN     0x01 //SFileOpenFileEx will look through all open archives for the file
+
+#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;
+
+#ifdef __cplusplus
+};  // extern "C" 
+#endif
+
+#endif