Skip to content

Commit

Permalink
updated to v11.02 by Yohann
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaosMarc committed Jun 19, 2017
1 parent 3f60030 commit 857834b
Show file tree
Hide file tree
Showing 39 changed files with 836 additions and 769 deletions.
15 changes: 7 additions & 8 deletions Commons/VersionInfo.cpp
Expand Up @@ -7,19 +7,22 @@

//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include "VersionInfo.h"
#include <windows.h>

#pragma comment(lib, "Version.Lib")

const char* VersionStrings[16] = { "1.00","1.07","1.08","1.09","1.09b","1.09d","1.10","1.11","1.11b","1.12","1.13c","1.13d","1.14a","1.14b","1.14c","1.14d" };

const char* GetVersionString(int version)
{
if (version < 0 || version >= sizeof(VersionStrings))
return "UNKNOW";
return VersionStrings[version];
}

eGameVersion GetD2Version(LPCVOID pVersionResource)
{
if (!pVersionResource) return UNKNOW;

UINT uLen;
VS_FIXEDFILEINFO* ptFixedFileInfo;
if (!VerQueryValue(pVersionResource, "\\", (LPVOID*)&ptFixedFileInfo, &uLen))
Expand Down Expand Up @@ -67,19 +70,15 @@ eGameVersion GetD2Version(char* gameExe)
return version;
}

eGameVersion GetD2Version()
eGameVersion GetD2Version(HMODULE hModule)
{
HMODULE hModule = GetModuleHandle(NULL);
HRSRC hResInfo = FindResource(hModule, MAKEINTRESOURCE(VS_VERSION_INFO), RT_VERSION);
if (!hResInfo) return UNKNOW;
HGLOBAL hResData = LoadResource(hModule, hResInfo);
if (!hResData) return UNKNOW;
LPVOID pVersionResource = LockResource(hResData);
//DWORD dwSize = SizeofResource(hInst, hResInfo);
//LPVOID pVersionResource = LocalAlloc(LMEM_FIXED, dwSize);
//CopyMemory(pVersionResource, pRes, dwSize);

eGameVersion version = GetD2Version(pVersionResource);
FreeResource(hResData);
//LocalFree(pVersionResource);
return version;
}

Expand Down
4 changes: 3 additions & 1 deletion Commons/VersionInfo.h
Expand Up @@ -6,6 +6,8 @@
=================================================================*/
#pragma once

#include <windows.h>

enum eGameVersion
{
UNKNOW = -1,
Expand All @@ -29,6 +31,6 @@ enum eGameVersion

const char* GetVersionString(int version);
eGameVersion GetD2Version(char* gamePath);
eGameVersion GetD2Version();
eGameVersion GetD2Version(HMODULE hModule);

///////////////////////// END OF FILE ///////////////////////
1 change: 1 addition & 0 deletions Commons/updatingConst.h
Expand Up @@ -48,6 +48,7 @@ enum UpdateServerConst
US_RENAME,
US_PAGENAME,
US_SET_INDEX,
US_SET_MAIN_INDEX,
US_RESET_INDEX,
US_INSERT_PAGE,
US_DELETE_PAGE,
Expand Down
26 changes: 23 additions & 3 deletions PlugY/Commands.cpp
Expand Up @@ -22,6 +22,8 @@ bool active_savegame=false;

#define MAX_CMD_SIZE 200

const char * CMD_PLAYERS="players set to";

const char * CMD_SAVE="/save";
const char * CMD_SELECTPAGE="/page";

Expand All @@ -34,6 +36,7 @@ const char * CMD_RENAME_CHAR="/renamechar";

const char * CMD_REPAGE_NAME = "/renamepage";
const char * CMD_SET_INDEX = "/setindex";
const char * CMD_SET_MAIN_INDEX = "/setmainindex";
const char * CMD_RESET_INDEX = "/resetindex";
const char * CMD_INSERT_PAGE = "/insertpage";
const char * CMD_DELETE_PAGE = "/deletepage";
Expand Down Expand Up @@ -334,6 +337,14 @@ int STDCALL commands (char* ptText)
strncpy(command,ptText,MAX_CMD_SIZE-1);
_strlwr(command);

if (!strncmp(command, CMD_PLAYERS, strlen(CMD_PLAYERS)))
{
int nb = atoi(&command[strlen(CMD_PLAYERS)]);
if (nb > 0 && nb <= 64)
nbPlayersCommand = nb;
return 1;
}

if (!strcmp(command, CMD_SAVE))
{
if (onRealm) return 1;
Expand Down Expand Up @@ -364,7 +375,7 @@ int STDCALL commands (char* ptText)

if (!strncmp(command, CMD_RENAME_CHAR, strlen(CMD_RENAME_CHAR)))
{
const char* param = &command[strlen(CMD_RENAME_CHAR)];
const char* param = &ptText[strlen(CMD_RENAME_CHAR)];
if (param[0] != ' ')
return 1;
param++;
Expand All @@ -374,7 +385,7 @@ int STDCALL commands (char* ptText)
if (!strncmp(command, CMD_REPAGE_NAME,strlen(CMD_REPAGE_NAME)))
{
if (!active_multiPageStash) return 1;
char* param = &command[strlen(CMD_REPAGE_NAME)];
char* param = &ptText[strlen(CMD_REPAGE_NAME)];
Stash* ptStash = PCPY->currentStash;
if (!ptStash)
return 0;
Expand Down Expand Up @@ -408,6 +419,13 @@ int STDCALL commands (char* ptText)
return 0;
}

if (!strcmp(command, CMD_SET_MAIN_INDEX))
{
if (!active_multiPageStash) return 1;
updateServer(US_SET_MAIN_INDEX);
return 0;
}

if (!strcmp(command, CMD_RESET_INDEX))
{
if (!active_multiPageStash) return 1;
Expand All @@ -426,7 +444,7 @@ int STDCALL commands (char* ptText)
if (!strcmp(command, CMD_DELETE_PAGE))
{
if (!active_multiPageStash) return 1;
if (deleteStash(ptChar))
if (deleteStash(ptChar, true))
updateServer(US_DELETE_PAGE);
return 0;
}
Expand All @@ -435,6 +453,8 @@ int STDCALL commands (char* ptText)
{
if (!active_multiPageStash) return 1;
int page = atoi(&command[strlen(CMD_SWAP)]) - 1;
if (page < 0 && PCPY->currentStash->nextStash)
page = PCPY->currentStash->nextStash->id;
if (page < 0)
return 1;
updateServer(US_SWAP3 + ((page & 0xFF000000) >> 16));
Expand Down
3 changes: 1 addition & 2 deletions PlugY/D2functions.cpp
Expand Up @@ -607,7 +607,7 @@ void setFctAddr(DWORD* addr, HMODULE module, LPCSTR index)
*addr = NULL;
}

bool initD2functions()
void initD2functions()
{
// #define D2S(F, I, R, N, P) N = (F##I)GetProcAddress((HMODULE)offset_##F, (LPCSTR)I);
// #define D2F(F, I, R, N, P) N = (F##I)GetProcAddress((HMODULE)offset_##F, (LPCSTR)I);
Expand Down Expand Up @@ -956,7 +956,6 @@ bool initD2functions()
shifting.ptSkills = V7(D2Common,CC,CC,A8,A8,A8,A8,A8,A8);
shifting.ptImage = V7(D2Common,04,04,04,08,08,3C,34,34);
shifting.ptFrame = V7(D2Common,08,08,08,44,44,40,00,00);
return true;
}

/*================================= END OF FILE =================================*/

0 comments on commit 857834b

Please sign in to comment.