Skip to content

Commit

Permalink
Add some D2MCPClient stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
Lectem committed Oct 26, 2023
1 parent b7eb37f commit 06840dd
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ add_subdirectory(D2Game)
add_subdirectory(D2Gfx)
add_subdirectory(D2Win)
add_subdirectory(D2Sound)
add_subdirectory(D2MCPClient)
add_subdirectory(D2Debugger)

19 changes: 19 additions & 0 deletions source/D2MCPClient/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

add_library(D2MCPClient
SHARED
src/DllMain.cpp

include/D2MCPClient.h
)
target_include_directories(D2MCPClient PUBLIC include)

# The definition file that matches functions with their ordinals
target_sources(D2MCPClient PRIVATE definitions/D2MCPClient.${D2MOO_ORDINALS_VERSION}.def)

# If not defined, we use declspec(dllimport), so only define it to build the .dll
target_compile_definitions(D2MCPClient PRIVATE D2MCP_IMPL)

get_target_property(D2MCPClientSources D2MCPClient SOURCES)
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}
FILES ${D2MCPClientSources}
)
5 changes: 5 additions & 0 deletions source/D2MCPClient/definitions/D2MCPClient.1.10f.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
LIBRARY D2MCP
EXPORTS
D2MCPClientCloseMCP @10001 NONAME

; TODO REST OF THE FILE
12 changes: 12 additions & 0 deletions source/D2MCPClient/include/D2MCPClient.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#pragma once

#include <Windows.h>

#ifdef D2MCP_IMPL
#define D2MCP_DLL_DECL
#else
#define D2MCP_DLL_DECL __declspec( dllimport )
#endif


void __cdecl D2MCPClientCloseMCP();
25 changes: 25 additions & 0 deletions source/D2MCPClient/src/DllMain.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include <Windows.h>

#include <cstdint>

//stubs
void __cdecl D2MCPClientCloseMCP(){}

// NOLINTBEGIN(bugprone-branch-clone)
BOOL __stdcall DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
break;
case DLL_PROCESS_DETACH:
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}

return TRUE;
}
// NOLINTEND(bugprone-branch-clone)

0 comments on commit 06840dd

Please sign in to comment.