Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
huoji120 committed Oct 19, 2023
2 parents e5bb3ec + 254d0e1 commit f5413c4
Show file tree
Hide file tree
Showing 107 changed files with 34,153 additions and 261 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/msbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ env:
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
BUILD_CONFIGURATION: Release

permissions:
contents: read

jobs:
build:
runs-on: windows-latest
Expand All @@ -42,6 +39,7 @@ jobs:
# Add additional options to the MSBuild command line here (like platform or verbosity level).
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}}

- name: Upload build artifacts
uses: actions/upload-artifact@v2
with:
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"random": "cpp",
"hash_map": "cpp",
"hash_set": "cpp",
"filesystem": "cpp"
"filesystem": "cpp",
"regex": "cpp"
}
}
661 changes: 661 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

77 changes: 77 additions & 0 deletions csgo2/Server.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#include "server.h"
namespace Server {
size_t receive_data(void* contents, size_t size, size_t nmemb, void* stream) {
std::string* str = (std::string*)stream;
(*str).append((char*)contents, size * nmemb);
return size * nmemb;
}
CURLcode HttpGet(const std::string& strUrl, std::string& strResponse,
std::string header, int nTimeout) {
CURLcode res;
CURL* pCURL = curl_easy_init();
if (pCURL == NULL) {
return CURLE_FAILED_INIT;
}
struct curl_slist* headers = NULL;

if (header.empty() == false) {
headers = curl_slist_append(headers, (char*)header.c_str());
}
headers = curl_slist_append(headers, "Accept: application/json");
headers = curl_slist_append(headers,
"Content-Type: application/json"); // text/html
headers = curl_slist_append(headers, "charsets: utf-8");
curl_easy_setopt(pCURL, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(pCURL, CURLOPT_URL, strUrl.c_str());
// curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(pCURL, CURLOPT_NOSIGNAL, 1L);
curl_easy_setopt(pCURL, CURLOPT_TIMEOUT, nTimeout);
curl_easy_setopt(pCURL, CURLOPT_SSL_VERIFYPEER, false);
curl_easy_setopt(pCURL, CURLOPT_NOPROGRESS, 1L);
curl_easy_setopt(pCURL, CURLOPT_WRITEFUNCTION, receive_data);
curl_easy_setopt(pCURL, CURLOPT_WRITEDATA, (void*)&strResponse);
res = curl_easy_perform(pCURL);
curl_slist_free_all(headers);
curl_easy_cleanup(pCURL);

return res;
}

CURLcode HttpPost(const std::string& strUrl, std::string header,
std::string szJson, std::string& strResponse, int nTimeout) {
CURLcode res;
CURL* pCURL = curl_easy_init();
struct curl_slist* headers = NULL;
if (pCURL == NULL) {
return CURLE_FAILED_INIT;
}
if (header.empty() == false) {
headers = curl_slist_append(headers, (char*)header.c_str());
}
CURLcode ret;
ret = curl_easy_setopt(pCURL, CURLOPT_URL, strUrl.c_str());
// std::string data = curl_easy_escape(pCURL, szJson.c_str(),
// szJson.size());
std::string data = szJson;
ret = curl_easy_setopt(pCURL, CURLOPT_POST, 1L);
// headers = curl_slist_append(headers, "expect: ");
headers = curl_slist_append(headers, "Accept: application/json");
headers = curl_slist_append(headers,
"Content-Type: application/json"); // text/html
headers = curl_slist_append(headers, "charsets: utf-8");
ret = curl_easy_setopt(pCURL, CURLOPT_HTTPHEADER, headers);
ret = curl_easy_setopt(pCURL, CURLOPT_POSTFIELDS, data.c_str());
ret = curl_easy_setopt(pCURL, CURLOPT_TIMEOUT, 60);
ret = curl_easy_setopt(pCURL, CURLOPT_NOSIGNAL, 1);
ret = curl_easy_setopt(pCURL, CURLOPT_TIMEOUT_MS, 60000);
ret = curl_easy_setopt(pCURL, CURLOPT_SSL_VERIFYPEER, false);
ret = curl_easy_setopt(pCURL, CURLOPT_NOPROGRESS, 1L);
ret = curl_easy_setopt(pCURL, CURLOPT_WRITEFUNCTION, receive_data);
ret = curl_easy_setopt(pCURL, CURLOPT_WRITEDATA, (void*)&strResponse);
res = curl_easy_perform(pCURL);
curl_slist_free_all(headers);
curl_easy_cleanup(pCURL);
return res;
}

} // namespace Server
9 changes: 9 additions & 0 deletions csgo2/Server.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once
#include "head.h"
#include "libcurl/libcurl.h"
namespace Server {
CURLcode HttpPost(const std::string& strUrl, std::string header,
std::string szJson, std::string& strResponse, int nTimeout);
CURLcode HttpGet(const std::string& strUrl, std::string& strResponse,
std::string header, int nTimeout);
} // namespace Server
12 changes: 12 additions & 0 deletions csgo2/csgo2.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,14 @@
<IncludePath>$(MSBuildProjectDirectory)\sdk\protobuf-2.6.1\src;$(MSBuildProjectDirectory)\LuaBridge;$(IncludePath)</IncludePath>
<TargetName>$(ProjectName)</TargetName>
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<LibraryPath>$(ProjectDir)libcurl\lib\;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(MSBuildProjectDirectory)\sdk\protobuf-2.6.1\src;$(MSBuildProjectDirectory)\LuaBridge;$(IncludePath)</IncludePath>
<TargetName>$(ProjectName)</TargetName>
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<LibraryPath>$(ProjectDir)libcurl\lib\;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
Expand Down Expand Up @@ -137,6 +139,7 @@
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand All @@ -150,13 +153,16 @@
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpplatest</LanguageStandard>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<Optimization>MaxSpeed</Optimization>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
Expand All @@ -166,6 +172,7 @@
<ClInclude Include="head.h" />
<ClInclude Include="hooks.h" />
<ClInclude Include="interface.h" />
<ClInclude Include="luaCjson\strbuf.h" />
<ClInclude Include="lua\lapi.h" />
<ClInclude Include="lua\lauxlib.h" />
<ClInclude Include="lua\lcode.h" />
Expand Down Expand Up @@ -241,6 +248,7 @@
<ClInclude Include="sdk\tier1\UtlString.hpp" />
<ClInclude Include="sdk\tier1\UtlVector.hpp" />
<ClInclude Include="sdk_tools.h" />
<ClInclude Include="Server.h" />
<ClInclude Include="stb.hh" />
<ClInclude Include="timer.h" />
<ClInclude Include="tools.h" />
Expand All @@ -256,6 +264,9 @@
<ClCompile Include="global.cpp" />
<ClCompile Include="hooks.cpp" />
<ClCompile Include="interface.cpp" />
<ClCompile Include="luaCjson\fpconv.c" />
<ClCompile Include="luaCjson\lua_cjson.c" />
<ClCompile Include="luaCjson\strbuf.c" />
<ClCompile Include="lua\lapi.c" />
<ClCompile Include="lua\lauxlib.c" />
<ClCompile Include="lua\lbaselib.c" />
Expand Down Expand Up @@ -311,6 +322,7 @@
<ClCompile Include="sdk\convar\convar.cpp" />
<ClCompile Include="sdk\tier1\UtlString.cpp" />
<ClCompile Include="sdk_tools.cpp" />
<ClCompile Include="Server.cpp" />
<ClCompile Include="timer.cpp" />
<ClCompile Include="tools.cpp" />
<ClCompile Include="version_hijack.cpp" />
Expand Down
27 changes: 27 additions & 0 deletions csgo2/csgo2.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@
<Filter Include="源文件\hijack">
<UniqueIdentifier>{23cedcbc-aa1d-444b-baf2-0f55c87c525e}</UniqueIdentifier>
</Filter>
<Filter Include="源文件\script_engine\lua_cjson">
<UniqueIdentifier>{40443ff4-f9c7-4ed8-824e-244fc667bcf3}</UniqueIdentifier>
</Filter>
<Filter Include="源文件\http">
<UniqueIdentifier>{766101f1-81fc-457d-b23e-f896d2582e12}</UniqueIdentifier>
</Filter>
<Filter Include="头文件\http">
<UniqueIdentifier>{6733acfb-5291-4538-9448-3e945dc649ce}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
Expand Down Expand Up @@ -354,6 +363,12 @@
<ClInclude Include="sdk\public\Vector_Sdk.h">
<Filter>头文件\sdk\public</Filter>
</ClInclude>
<ClInclude Include="Server.h">
<Filter>头文件\http</Filter>
</ClInclude>
<ClInclude Include="luaCjson\strbuf.h">
<Filter>源文件\script_engine\lua_cjson</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
Expand Down Expand Up @@ -536,6 +551,18 @@
<ClCompile Include="version_hijack.cpp">
<Filter>源文件\hijack</Filter>
</ClCompile>
<ClCompile Include="Server.cpp">
<Filter>源文件\http</Filter>
</ClCompile>
<ClCompile Include="luaCjson\lua_cjson.c">
<Filter>源文件\script_engine\lua_cjson</Filter>
</ClCompile>
<ClCompile Include="luaCjson\strbuf.c">
<Filter>源文件\script_engine\lua_cjson</Filter>
</ClCompile>
<ClCompile Include="luaCjson\fpconv.c">
<Filter>源文件\script_engine\lua_cjson</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />
Expand Down
1 change: 1 addition & 0 deletions csgo2/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ auto init(void* ctx) -> bool {

Sleep(200);
}
global::isMetaModInit = (GetModuleHandleA("metamod.2.cs2.dll") != nullptr);
if (Offset::Init() == false) {
LOG("Offset::Init() == false !\n");
return false;
Expand Down
Loading

0 comments on commit f5413c4

Please sign in to comment.