Skip to content

Commit

Permalink
WIP: ExMultires support for D2Glide
Browse files Browse the repository at this point in the history
Replace direct memory patches with WriteDword
Add D2EX_MULTIRES definition to make posssible to build without ExMultiRes
Add PointersReadyEvent to avoid race condition GFX <-> Thread
  • Loading branch information
jankowskib committed Feb 3, 2014
1 parent 75c8a8a commit 3adea9b
Show file tree
Hide file tree
Showing 22 changed files with 453 additions and 210 deletions.
2 changes: 1 addition & 1 deletion Build.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define __BUILDNO__ 4853
#define __BUILDNO__ 4889
14 changes: 7 additions & 7 deletions CommonStructs.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ struct D2Config // sizeof 0x5C
{
char szSection[27]; // 0x00
char szKeyName[27]; // 0x1B
char szParamter[27]; // 0x36
char szParameter[27]; // 0x36
BYTE bType; // 0x51 - specify if config entry is byte (0) int(1) or char(2)
BYTE _1; // 0x52
BYTE _2; // 0x53
BYTE _1; // 0x52 - filler
BYTE _2; // 0x53 - filler
DWORD dwStructOffset; // 0x54 Offset on BnetData * struct
DWORD dwDefaultValue; // 0x58
};
Expand Down Expand Up @@ -139,7 +139,7 @@ struct GFXSettings // size 0x18

struct GFXHelpers
{
void(__fastcall *FillYBufferTable)(void *ppvBits, int nWidth, int nHeight, int aZero);
void(__fastcall *D2GFX_FillYBufferTable)(void *ppvBits, int nWidth, int nHeight, int aZero);
void(__fastcall *f2)(int a1, int a2, int a3);
void(__fastcall *f3)(int a1, int a2, int a3, int a4);
void(__fastcall *f4)(int a1, int a2, int a3, int a4);
Expand All @@ -149,10 +149,10 @@ struct GFXHelpers
};


struct fnDriverCallbacks
struct fnRendererCallbacks
{
BOOL(__fastcall *InitWindow)(HINSTANCE); // 0
BOOL(__fastcall *InitPerspective)(GFXSettings * pgfxSettings, int * pfnHelpers); // 1
BOOL(__fastcall *D2GFX_InitWindow)(HINSTANCE); // 0
BOOL(__fastcall *InitPerspective)(GFXSettings* pgfxSettings, GFXHelpers* pfnHelpers); // 1
BOOL(__fastcall *Release)(); // 2
BOOL(__fastcall *Init)(HANDLE hWnd, int nResolution); // 3
BOOL(__fastcall *Shutdown)(); // 4
Expand Down
2 changes: 1 addition & 1 deletion Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#ifndef CONSTS_H__
#define CONSTS_H__

enum D2VideoModes
enum D2RenderModes
{
VIDEO_MODE_GDI = 1,
VIDEO_MODE_RAVE = 2, // UNUSED
Expand Down
124 changes: 69 additions & 55 deletions D2Ex2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ ItemArray.push_back(hConfig);

unsigned __stdcall Thread(void * Args)
{

//Load config...
HANDLE hEvent = *((HANDLE*)Args);
Misc::Log("Defining offsets...");
Expand Down Expand Up @@ -144,7 +143,10 @@ StillSwitch = GetPrivateProfileInt("D2Ex","StillWSG",1,ConfigIni.c_str());
#endif

LoadItemConfig();

#ifdef D2EX_MULTIRES
ExMultiRes::EnumDisplayModes();
#endif

//BEFORE START...
#define CALL 0xE8
Expand Down Expand Up @@ -230,9 +232,9 @@ Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x337B0),(DWORD)D2Stubs::D2CLIENT_S
//Misc::Patch(JUMP,GetDllOffset("Fog.dll",0x1DBF0),(DWORD)ExMemory::Realloc,5,"Mem Realloc Override");
//}
//#endif
Misc::Patch(JUMP, GetDllOffset("D2Client.dll", 0x36FE0), (DWORD)ExMultiRes::SetResolution, 5, "Set Resolution Mode");
Misc::Patch(JUMP, GetDllOffset("D2Client.dll", 0x1C4B0), (DWORD)D2Stubs::D2CLIENT_ResizeView_STUB, 6, "Resize View");
Misc::Patch(JUMP, GetDllOffset("D2Gfx.dll", -10029), (DWORD)D2Stubs::D2GFX_SetResolutionMode_STUB, 5, "D2GFX_SetResolutionMode");
Misc::Patch(JUMP, GetDllOffset("D2Client.dll", 0x36FE0), (DWORD)ExMultiRes::D2CLIENT_SetResolution, 5, "Set Resolution Mode");
Misc::Patch(JUMP, GetDllOffset("D2Client.dll", 0x1C4B0), (DWORD)D2Stubs::D2CLIENT_D2CLIENT_ResizeView_STUB, 6, "Resize View");
Misc::Patch(JUMP, GetDllOffset("D2Gfx.dll", -10029), (DWORD)D2Stubs::D2GFX_D2GFX_SetResolutionMode_STUB, 5, "D2GFX_D2GFX_SetResolutionMode");
#elif defined VER_113D
Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x1D78C),(DWORD)D2Stubs::D2CLIENT_ScreenHook,5,"Screen Hook"); // k
Misc::Patch(CALL,GetDllOffset("D2Client.dll",0x1D4A1),(DWORD)ExEntryText::Draw,5,"Entry Text Fix"); //k
Expand Down Expand Up @@ -297,6 +299,7 @@ Misc::Patch(CUSTOM, GetDllOffset("D2Gfx.dll", 0xB6B0),0x45EB, 2, "Allow mutli wi
Misc::Patch(CALL, GetDllOffset("BNClient.dll",0xF494),(DWORD)ExLoading::CreateCacheFile, 6, "Cache file creation fix");
Misc::Patch(CALL, GetDllOffset("BNClient.dll",0xF7E4),(DWORD)ExLoading::CreateCacheFile, 6, "Cache file creation fix");

#ifdef D2EX_MULTIRES
//Res stuff
Misc::Patch(JUMP, GetDllOffset("D2Client.dll", 0x2C220), (DWORD)D2Stubs::D2CLIENT_SetResolution_STUB, 5, "Set Resolution Mode");
Misc::Patch(JUMP, GetDllOffset("D2Client.dll", 0x5C4F0), (DWORD)D2Stubs::D2CLIENT_ResizeView_STUB, 6, "Resize View");
Expand All @@ -312,57 +315,85 @@ Misc::Patch(CALL, GetDllOffset("D2Gfx.dll", 0xA4F7), (DWORD)D2Stubs::D2GFX_LookU
//Res UI fixups
Misc::Patch(JUMP, GetDllOffset("D2Common.dll", -10689), (DWORD)ExMultiRes::GetBeltPos, 7, "D2COMMON_GetBeltPos");
Misc::Patch(JUMP, GetDllOffset("D2Common.dll", -10370), (DWORD)ExMultiRes::GetBeltsTxtRecord, 10, "D2COMMON_GetBeltsTxtRecord");
Misc::WriteDword((DWORD*)&((GFXHelpers*)GetDllOffset("D2Gfx.dll", 0x10BFC))->D2GFX_FillYBufferTable, (DWORD)&ExMultiRes::D2GFX_FillYBufferTable);
#endif

#else
ShowWindow(D2Funcs::D2GFX_GetHwnd(),SW_HIDE);
MessageBoxA(0,"Version is not supported!","D2Ex",0);
exit(-1);
#endif

ExMpq::LoadMPQ();

#ifdef D2EX_MULTIRES
Misc::Log("Loading MultiRes resources...");
if (!ExMultiRes::InitImages())
{
D2EXERROR("One or more D2Ex resources weren't loaded. Check if your D2Ex2.MPQ is valid!");
}

#endif

//END PATCHES-----------------------------------------------------------------------------------
//KEYBOARD CALL TREE
D2Vars::D2CLIENT_UIModesCallTree[UICall::PARTYSCREEN]=(int)&ExParty::ShowHide;
D2Vars::D2CLIENT_UIModesCallTree[UICall::ESCMENU]=(int)&ExOptions::ShowHide;
D2Vars::D2CLIENT_UIModesCallTree[UICall::CLEARSCREEN]=(int)&ExParty::ClearScreenHandle;
//D2Vars::D2CLIENT_UIModesCallTree[UICall::PARTYSCREEN]=(int)&ExParty::ShowHide;
//D2Vars::D2CLIENT_UIModesCallTree[UICall::ESCMENU]=(int)&ExOptions::ShowHide;
//D2Vars::D2CLIENT_UIModesCallTree[UICall::CLEARSCREEN]=(int)&ExParty::ClearScreenHandle;

Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_UIModesCallTree[UICall::PARTYSCREEN], (DWORD)&ExParty::ShowHide);
Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_UIModesCallTree[UICall::ESCMENU], (DWORD)&ExOptions::ShowHide);
Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_UIModesCallTree[UICall::CLEARSCREEN], (DWORD)&ExParty::ClearScreenHandle);


//PACKET HANDLERS
D2Vars::D2CLIENT_PacketHandler[0x26].CallBack=&ExChat::OnMessage;
D2Vars::D2CLIENT_PacketHandler[0x5A].CallBack=&ExEvents::OnEvent;
//D2Vars::D2CLIENT_PacketHandler[0x26].CallBack=&ExChat::OnMessage;
//D2Vars::D2CLIENT_PacketHandler[0x5A].CallBack=&ExEvents::OnEvent;
Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0x26].CallBack, (DWORD)&ExChat::OnMessage);
Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0x5A].CallBack, (DWORD)&ExEvents::OnEvent);

#ifdef D2EX_EXAIM_ENABLED
D2Vars::D2CLIENT_PacketHandler[0x4D].CallBack2=&ExAim::OnUnitSpellCast;
D2Vars::D2CLIENT_PacketHandler[0x0A].CallBack=&ExAim::OnRemoveObject;

Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0x4D].CallBack2, (DWORD)&ExAim::OnUnitSpellCast);
Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0x0A].CallBack, (DWORD)&ExAim::OnRemoveObject);
#endif

//D2Vars::D2CLIENT_PacketHandler[0x65].CallBack=&ExParty::GetKillCount;
D2Vars::D2CLIENT_PacketHandler[0x66].CallBack=&ExParty::GetRoster;

D2Vars::D2CLIENT_PacketHandler[0xA8].CallBack=&ExBuffs::OnSetState;
D2Vars::D2CLIENT_PacketHandler[0xA9].CallBack=&ExBuffs::OnRemoveState;

D2Vars::D2CLIENT_PacketHandler[0x8B].CallBack=&ExParty::OnPartyUpdate2;
D2Vars::D2CLIENT_PacketHandler[0x8C].CallBack=&ExParty::OnPartyUpdate;
D2Vars::D2CLIENT_PacketHandler[0x8D].CallBack=&ExParty::OnPartyUpdate3;

//D2Vars::D2CLIENT_PacketHandler[0x66].CallBack=&ExParty::GetRoster;
Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0x66].CallBack, (DWORD)&ExParty::GetRoster);

//D2Vars::D2CLIENT_PacketHandler[0xA8].CallBack=&ExBuffs::OnSetState;
//D2Vars::D2CLIENT_PacketHandler[0xA9].CallBack=&ExBuffs::OnRemoveState;
Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0xA8].CallBack, (DWORD)&ExBuffs::OnSetState);
Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0xA9].CallBack, (DWORD)&ExBuffs::OnRemoveState);

//D2Vars::D2CLIENT_PacketHandler[0x8B].CallBack=&ExParty::OnPartyUpdate2;
//D2Vars::D2CLIENT_PacketHandler[0x8C].CallBack=&ExParty::OnPartyUpdate;
//D2Vars::D2CLIENT_PacketHandler[0x8D].CallBack=&ExParty::OnPartyUpdate3;
Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0x8B].CallBack, (DWORD)&ExParty::OnPartyUpdate2);
Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0x8C].CallBack, (DWORD)&ExParty::OnPartyUpdate);
Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0x8D].CallBack, (DWORD)&ExParty::OnPartyUpdate3);

// for location on party screeen -unused-
//D2Vars::D2CLIENT_PacketHandler[0x7F].CallBack=&ExParty::OnLocationUpdate;

D2Vars::D2CLIENT_PacketHandler[0x77].CallBack=&ExScreen::OnTradeButton;
D2Vars::D2CLIENT_PacketHandler[0x78].CallBack=&ExScreen::OnTradeData;
//D2Vars::D2CLIENT_PacketHandler[0x77].CallBack=&ExScreen::OnTradeButton;
//D2Vars::D2CLIENT_PacketHandler[0x78].CallBack=&ExScreen::OnTradeData;
Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0x77].CallBack, (DWORD)&ExScreen::OnTradeButton);
Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0x78].CallBack, (DWORD)&ExScreen::OnTradeData);

//ExEvents
D2Vars::D2CLIENT_PacketHandler[0xA6].CallBack = &ExEvents::OnTextEvent;
//D2Vars::D2CLIENT_PacketHandler[0xA6].CallBack = &ExEvents::OnTextEvent;
Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0xA6].CallBack, (DWORD)&ExEvents::OnTextEvent);
//ExSpectator
D2Vars::D2CLIENT_PacketHandler[0x7E].CallBack = &ExSpec::OnMousePacket;
D2Vars::D2CLIENT_PacketHandler[0x8F].CallBack=&ExLagometer::OnPong;
//D2Vars::D2CLIENT_PacketHandler[0x7E].CallBack = &ExSpec::OnMousePacket;
//D2Vars::D2CLIENT_PacketHandler[0x8F].CallBack = &ExLagometer::OnPong;
Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0x7E].CallBack, (DWORD)&ExSpec::OnMousePacket);
Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_PacketHandler[0x8F].CallBack, (DWORD)&ExLagometer::OnPong);

D2Vars::D2NET_SrvPacketLenTable[0x2C]=18;
//D2Vars::D2NET_SrvPacketLenTable[0x2C]=18;
Misc::WriteDword((DWORD*)&D2Vars::D2NET_SrvPacketLenTable[0x2C], 18);

for(int i = 1; i<38; ++i) {
if(i == UI_PARTY) continue;
Expand All @@ -383,8 +414,10 @@ D2Vars::D2NET_SrvPacketLenTable[0x2C]=18;
Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_MenuMsgs[0].fnCallBack,(DWORD)ExOptions::m_LBUTTONDOWN);
Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_MenuMsgs[1].fnCallBack,(DWORD)ExOptions::m_LBUTTONUP);
Misc::WriteDword((DWORD*)&D2Vars::D2CLIENT_MenuMsgs[6].fnCallBack,(DWORD)ExOptions::m_OnEnter);


#ifdef D2EX_MULTIRES
DEBUGMSG("Game has been patched, sending event!");
SetEvent(hPointersReadyEvent);
#endif
//-----------------------
//HERE WE GO
#ifdef D2EX_EXAIM_ENABLED
Expand All @@ -403,11 +436,13 @@ D2Vars::D2NET_SrvPacketLenTable[0x2C]=18;
}
if(ExParty::GetPlayerArea())
{
#ifdef D2EX_MULTIRES
int mDesiredMode = ExMultiRes::FindDisplayMode(cResModeX, cResModeX);
if (!mDesiredMode)
ExMultiRes::SetResolution(mDesiredMode);
ExMultiRes::D2CLIENT_SetResolution(mDesiredMode);
else
D2EXERROR("Cannot set resolution %dx%d. Please correct your setting in D2Ex.ini", cResModeX, cResModeY);
#endif

#ifdef D2EX_EXAIM_ENABLED
ResetEvent(hAimEvent);
Expand Down Expand Up @@ -466,6 +501,7 @@ DWORD WINAPI DllMain(HMODULE hModule, int dwReason, void* lpReserved)
{
if(!Handle) {
hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
ASSERT(hEvent);
SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
gModule = hModule;
InitializeCriticalSectionAndSpinCount(&EX_CRITSECT,1000);
Expand All @@ -475,33 +511,11 @@ DWORD WINAPI DllMain(HMODULE hModule, int dwReason, void* lpReserved)
#ifdef D2EX_EXAIM_ENABLED
InitializeCriticalSectionAndSpinCount(&TELE_CRITSECT,1000);
#endif
Misc::Patch(JUMP, GetDllOffset("D2Gfx.dll", -10073), (DWORD)ExMultiRes::InitWindow, 7, "D2GFX_InitWindow");
;
Misc::WriteDword((DWORD*)&((GFXHelpers*)GetDllOffset("D2Gfx.dll", 0x10BFC))->FillYBufferTable, (DWORD)&ExMultiRes::FillYBufferTable);
switch (ExMultiRes::GetRenderMode())
{
case VIDEO_MODE_GDI:
{
DEBUGMSG("Using GDI video mode")
typedef fnDriverCallbacks* (__stdcall * GetCallbacks_t)();
GetCallbacks_t GetCallbacks = (GetCallbacks_t)GetDllOffset("D2Gdi.dll", -10000);
fnDriverCallbacks * fns = GetCallbacks();

Misc::WriteDword((DWORD*)&(fns->Init), (DWORD)&ExMultiRes::GDI_Init);
Misc::WriteDword((DWORD*)&(fns->ResizeWin), (DWORD)&ExMultiRes::GDI_ResizeWindow);
}
break;
case VIDEO_MODE_GLIDE:
{
DEBUGMSG("Using GLIDE video mode!")
}
default:
{
DEBUGMSG("Video mode : %d", ExMultiRes::GetRenderMode())
}
break;
}

#ifdef D2EX_MULTIRES
hPointersReadyEvent = CreateEvent(NULL, TRUE, FALSE, "D2EX_READY");
ASSERT(hPointersReadyEvent);
Misc::Patch(JUMP, GetDllOffset("D2Gfx.dll", -10073), (DWORD)ExMultiRes::D2GFX_InitWindow, 7, "D2GFX_InitWindow");
#endif
Handle = (HANDLE)_beginthreadex(0,0,&Thread,&hEvent,0,&Id);
ASSERT(Handle)
}
Expand Down
Binary file added D2Ex2.v12.suo
Binary file not shown.
13 changes: 8 additions & 5 deletions D2Ex2.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,16 @@
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
<IncludePath>C:\boost_1_55_0;C:\glfw-3.0.4.bin.WIN32\include;$(IncludePath)</IncludePath>
<IncludePath>C:\boost_1_55_0;$(ProjectDir)\glide3x;$(IncludePath)</IncludePath>
<ReferencePath>$(ReferencePath)</ReferencePath>
<LibraryPath>C:\glfw-3.0.4.bin.WIN32\lib-msvc120;$(LibraryPath)</LibraryPath>
<LibraryPath>$(LibraryPath);$(ProjectDir)\glide3x</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)files\</OutDir>
<IntDir>$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
<IncludePath>C:\boost_1_55_0;$(IncludePath)</IncludePath>
<IncludePath>C:\boost_1_55_0;$(ProjectDir)\glide3x;$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath);$(ProjectDir)\glide3x</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
Expand All @@ -76,6 +77,7 @@
<Profile />
<SectionAlignment>
</SectionAlignment>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;;oleaut32.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy /y "$(TargetPath)" "D:\Gry\Diablo II\"</Command>
Expand All @@ -93,7 +95,7 @@
<IntrinsicFunctions>false</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>false</OmitFramePointers>
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;D2EX2_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
Expand All @@ -105,11 +107,12 @@
</ClCompile>
<Link>
<ModuleDefinitionFile />
<GenerateDebugInformation>false</GenerateDebugInformation>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
<GenerateMapFile>false</GenerateMapFile>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion D2Ptrs_111B.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ D2FUNCPTR(D2GFX, DrawCellContext, void __stdcall, (CellContext *context, int Xpo
D2FUNCPTR(D2GFX, DrawCellContextEx, void __stdcall, (CellContext *context, int Xpos, int Ypos, int dwl, int nTransLvl, BYTE Color), -10068)

D2FUNCPTR(D2GFX, GetResolutionMode, int __stdcall, (), -10063)
D2FUNCPTR(D2GFX, SetResolutionMode, BOOL __stdcall, (int nMode, int bUpdate), -10029)
D2FUNCPTR(D2GFX, D2GFX_SetResolutionMode, BOOL __stdcall, (int nMode, int bUpdate), -10029)
D2FUNCPTR(D2GFX, SetScreenShift, void __fastcall, (int nShift), -10073)


Expand Down
21 changes: 19 additions & 2 deletions D2Ptrs_113D.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma optimize ( "", off )
#include "Misc.h"
#include <glide.h>

#ifdef _DEFINE_PTRS
enum {DLLNO_D2CLIENT, DLLNO_D2COMMON, DLLNO_D2GFX, DLLNO_D2LANG, DLLNO_D2WIN, DLLNO_D2NET, DLLNO_D2GAME, DLLNO_D2LAUNCH, DLLNO_FOG, DLLNO_BNCLIENT, DLLNO_STORM, DLLNO_D2CMP, DLLNO_D2MULTI, DLLNO_D2SOUND, DLLNO_D2GDI, DLLNO_D2DDRAW, DLLNO_D2DIRECT3D, DLLNO_D2GLIDE};
Expand Down Expand Up @@ -118,7 +119,11 @@ D2FUNCPTR(D2GFX, SetResolutionMode, BOOL __stdcall, (int nMode, BOOL bUpdate), -
D2FUNCPTR(D2GFX, SetScreenShift, void __fastcall, (int nShift), -10047)

//D2GDI
D2FUNCPTR(D2GDI, GetCallbacks, fnDriverCallbacks* __fastcall, (), -10000) // Same oridinal for every patch and GFX driver (GDI, D2D, D3D, GLIDE). Unused but left just in case.
D2FUNCPTR(D2GDI, GetCallbacks, fnRendererCallbacks* __fastcall, (), -10000) // Same oridinal for every patch and GFX driver (GDI, D2D, D3D, GLIDE). Used directly but left just in case.

//D2GLIDE

D2FUNCPTR(D2GLIDE, AllocCache, BOOL __stdcall, (), 0xD180)

//D2WIN
D2FUNCPTR(D2WIN, ResizeWindow, BOOL __stdcall, (int nMode), -10037)
Expand Down Expand Up @@ -266,7 +271,8 @@ D2VARPTR(D2CLIENT, UiUnk1, int, 0x11D224)
D2VARPTR(D2CLIENT, UiUnk2, int, 0x11D228)
D2VARPTR(D2CLIENT, UiUnk3, int, 0x11D240)
D2VARPTR(D2CLIENT, UiUnk4, int, 0x11D244)
D2VARPTR(D2GFX, pfnDriverCallback, fnDriverCallbacks*, 0x14A48)

D2VARPTR(D2GFX, pfnDriverCallback, fnRendererCallbacks*, 0x14A48)
D2VARPTR(D2GFX, GfxMode, int, 0x14A40)
D2VARPTR(D2GFX, WindowMode, BOOL, 0x14A3C)
D2VARPTR(D2GFX, DriverType, int, 0x14A38)
Expand All @@ -279,6 +285,7 @@ D2VARPTR(D2GFX, Settings, GFXSettings, 0x10BE4)
D2VARPTR(D2GFX, hInstance, HINSTANCE, 0x14A30)
D2VARPTR(D2GFX, hDriverModHandle, HMODULE, 0x14A4C)
D2VARPTR(D2GFX, bPerspective, BOOL, 0x10BE8)
D2VARPTR(D2GFX, GammaValue, int, 0x10BF0)

D2VARPTR(D2GDI, WindowWidth, int, 0xCA98)
D2VARPTR(D2GDI, BitmapHeight, int, 0xC980)
Expand All @@ -290,6 +297,16 @@ D2VARPTR(D2GDI, PaletteEntries, PALETTEENTRY*, 0xC570)
D2VARPTR(D2GDI, Palette, HPALETTE, 0xC974)
D2VARPTR(D2GDI, hFont, HFONT, 0xC988)
D2VARPTR(D2GDI, Unk, int, 0xCA94)
D2VARPTR(D2GDI, csPause, CRITICAL_SECTION*, 0xCAA4)

D2VARPTR(D2GLIDE, bIsWindowOpen, BOOL, 0x17B2C)
D2VARPTR(D2GLIDE, Width, int, 0x15A78)
D2VARPTR(D2GLIDE, Height, int, 0x15B14)
D2VARPTR(D2GLIDE, Context, GrContext_t, 0x15AA0)
D2VARPTR(D2GLIDE, TMUCount, FxI32, 0x17B18)
D2VARPTR(D2GLIDE, TextureAlign, FxI32, 0x17B20)
D2VARPTR(D2GLIDE, bUMAAvailable, BOOL, 0x17B1C)
D2VARPTR(D2GLIDE, hWnd, HANDLE, 0x15A74)

//Key Config
D2VARPTR(D2CLIENT, KeyBindings, KeyBinding, 0x108D90) // ArraySize = 114
Expand Down
Loading

0 comments on commit 3adea9b

Please sign in to comment.