Skip to content

Commit d50e7cb

Browse files
committed
cleanup
1 parent 7569796 commit d50e7cb

16 files changed

+175
-310
lines changed

CMakeLists.txt

+3-18
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,14 @@ cmake_minimum_required(VERSION 3.15)
22

33
set(CMAKE_CXX_STANDARD 17)
44

5-
project(gc_proxy)
5+
project(cs2_patch)
66

7-
8-
# should be bin dir on windows, doesn't matter on linux or macos
9-
set(PROXY_DIR CACHE STRING "Directory to output executable to")
10-
11-
# only relevant on windows, on linux and macos we build libgc_proxy.so/dylib
12-
# and load it with LD_PRELOAD/DYLD_INSERT_LIBRARIES
13-
set(PROXY_NAME CACHE STRING "Exectable name (csgo, hl2...)")
7+
set(OUT_DIR CACHE STRING "Directory to output executable to")
148

159
set(SRC_DIR ${CMAKE_CURRENT_LIST_DIR})
1610

1711
if (MSVC)
18-
# urgh
1912
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:mainCRTStartup")
20-
21-
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
22-
23-
# don't crash on machines with a lot of ram
24-
add_link_options(/LARGEADDRESSAWARE)
25-
26-
# newer csgo builds use several gigabytes of stack
27-
add_link_options(/STACK:1572864)
2813
endif()
2914

30-
add_subdirectory(proxy)
15+
add_subdirectory(launcher)

external/protobuf/lib/libprotobuf.lib

-11.4 MB
Binary file not shown.
-59.6 MB
Binary file not shown.
-8.05 MB
Binary file not shown.

launcher/CMakeLists.txt

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
set(LAUNCHER_SRC steam_proxy.cpp)
2+
3+
if (WIN32)
4+
set(LAUNCHER_SRC ${LAUNCHER_SRC} launcher_win.cpp plat_win.cpp launcher.rc)
5+
else()
6+
set(LAUNCHER_SRC ${LAUNCHER_SRC} plat_unix.cpp)
7+
endif()
8+
9+
set(PROTO_SRC
10+
${SRC_DIR}/protos/gcsdk_gcmessages.pb.cc
11+
${SRC_DIR}/protos/steammessages.pb.cc)
12+
13+
source_group("Protobufs" FILES ${PROTO_SRC})
14+
set(LAUNCHER_SRC ${LAUNCHER_SRC} ${PROTO_SRC})
15+
16+
include_directories(${SRC_DIR}/protos)
17+
18+
# local protobuf for msvc
19+
if(MSVC)
20+
include_directories(${SRC_DIR}/external/protobuf/src)
21+
link_directories(${SRC_DIR}/external/protobuf/lib64)
22+
23+
link_libraries(
24+
$<$<CONFIG:Debug>:libprotobufd>
25+
$<$<CONFIG:RelWithDebInfo>:libprotobuf>
26+
$<$<CONFIG:Release>:libprotobuf>
27+
$<$<CONFIG:MinSizeRel>:libprotobuf>)
28+
else()
29+
link_libraries(protobuf)
30+
endif()
31+
32+
include_directories(${SRC_DIR}/shared ${SRC_DIR}/external/steam)
33+
add_compile_definitions(STEAM_API_NODLL)
34+
35+
add_executable(cs2 WIN32 ${LAUNCHER_SRC})
36+
37+
# for protobuf
38+
set_property(TARGET cs2 PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
39+
40+
if (OUT_DIR)
41+
add_custom_command(TARGET cs2 POST_BUILD
42+
COMMAND ${CMAKE_COMMAND} -E copy
43+
$<TARGET_FILE:cs2>
44+
${OUT_DIR}/$<TARGET_FILE_NAME:cs2>)
45+
endif()
File renamed without changes.
File renamed without changes.
File renamed without changes.

proxy/plat_win.cpp renamed to launcher/plat_win.cpp

+3-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#include "precompiled.h"
1+
#include "platform.h"
2+
3+
#include <cstdio>
24
#include <windows.h>
35

46
typedef void (*ConColorMsg_t)(const MsgColor &color, const char *fmt, ...);
@@ -42,16 +44,6 @@ void HardError(const char *fmt, ...)
4244
ExitProcess(1);
4345
}
4446

45-
void *FindSymbol(void *handle, const char *symbol)
46-
{
47-
return (void *)GetProcAddress((HMODULE)handle, symbol);
48-
}
49-
50-
void *GetModule(const char *name)
51-
{
52-
return (void *)GetModuleHandleA(name);
53-
}
54-
5547
bool IsAddrFromModule(void *addr, const char *name)
5648
{
5749
HMODULE hModule;

proxy/platform.h renamed to launcher/platform.h

+3-21
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,7 @@
22

33
struct MsgColor
44
{
5-
MsgColor(int _r, int _g, int _b, int _a) :
6-
r(_r),
7-
g(_g),
8-
b(_b),
9-
a(_a)
10-
{
11-
}
12-
13-
uint8 r, g, b, a;
5+
unsigned char r, g, b, a;
146
};
157

168
void InitLog();
@@ -20,28 +12,18 @@ void DebugLogColor(bool bError, MsgColor color, const char *fmt, ...);
2012
template <typename... Args>
2113
inline void DebugLog(const char *fmt, Args... args)
2214
{
23-
DebugLogColor(false, MsgColor(0, 200, 255, 255), fmt, args...);
15+
DebugLogColor(false, { 0, 200, 255, 255 }, fmt, args...);
2416
}
2517

2618
template <typename... Args>
2719
inline void DebugError(const char *fmt, Args... args)
2820
{
29-
DebugLogColor(true, MsgColor(255, 0, 0, 255), fmt, args...);
21+
DebugLogColor(true, { 255, 0, 0, 255 }, fmt, args...);
3022
}
3123

3224
// mainly for steam stuff
3325
void HardError(const char *fmt, ...);
3426

35-
void *FindSymbol(void *handle, const char *symbol);
36-
37-
template<typename T>
38-
void FindSymbol(T *dst, void *handle, const char *symbol)
39-
{
40-
*dst = (T)FindSymbol(handle, symbol);
41-
}
42-
43-
void *GetModule(const char *name);
44-
4527
bool IsAddrFromModule(void *addr, const char *name);
4628

4729
#if defined(_WIN32)
File renamed without changes.

proxy/steam_proxy.cpp renamed to launcher/steam_proxy.cpp

+121-62
Large diffs are not rendered by default.

proxy/CMakeLists.txt

-58
This file was deleted.

proxy/gc_dump.cpp

-105
This file was deleted.

proxy/gc_dump.h

-24
This file was deleted.

proxy/precompiled.h

-11
This file was deleted.

0 commit comments

Comments
 (0)