Skip to content

Commit

Permalink
Start
Browse files Browse the repository at this point in the history
  • Loading branch information
Batfoxkid committed Feb 12, 2023
0 parents commit cc44ca5
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.dat
*.exe
*.smx
*.inc
*.code-workspace
.vscode/
[Dd]esktop.ini
[Tt]humbs.db
!filenetwork.inc
33 changes: 33 additions & 0 deletions gamedata/filenetwork.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"Games"
{
"tf"
{
"Signatures"
{
"CVEngineServer::GetPlayerNetInfo"
{
"library" "engine"
"linux" "@_ZN14CVEngineServer16GetPlayerNetInfoEi"
"windows" "\x55\x8B\xEC\x8B\x4D\x08\x83\xF9\x01\x7C\x2A\x3B\x0D\x2A\x2A\x2A\x2A\x7F\x2A\xA1\x2A\x2A\x2A\x2A\x8B\x44\x88\xFC"
// CVEngineServer::EmitAmbientSound -> Function Listing for CVEngineServer
// (To Confirm No Changes) 8 Up Function List -> CVEngineServer::IndexOfEdict -> EDICT_NUM
// Below CVEngineServer::IndexOfEdict is said function list
}
"CNetChan::SendFile"
{
"library" "engine"
"linux" "@_ZN8CNetChan8SendFileEPKcj"
"windows" "\x55\x8B\xEC\x57\x8B\xF9\x8D\x8F\x94\x00\x00\x00\xE8\x2A\x2A\x2A\x2A\x85\xC0\x75\x2A\xB0\x01\x5F\x5D\xC2\x08\x00\x56\x8B\x75\x08\x85\xF6"
// "SendFile: %s (ID %i)\n"
}
"CNetChan::IsFileInWaitingList"
{
"library" "engine"
"linux" "@_ZN8CNetChan19IsFileInWaitingListEPKc"
"windows" "\x55\x8B\xEC\x8B\x45\x08\x83\xEC\x08\x85\xC0\x0F\x84\x2A\x2A\x2A\x2A\x80\x38\x00"
// "CreateFragmentsFromFile: '%s' doesn't e" -> CNetChan::CreateFragmentsFromFile
// Top Call -> CNetChan::IsFileInWaitingList
}
}
}
}
97 changes: 97 additions & 0 deletions scripting/filenetwork.sp
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#include <sourcemod>
#include <sdktools>
//#include <dhooks>

#pragma semicolon 1
#pragma newdecls required

#define PLUGIN_VERSION "1.0"
#define PLUGIN_VERSION_REVISION "manual"
#define PLUGIN_VERSION_FULL PLUGIN_VERSION ... "." ... PLUGIN_VERSION_REVISION

Handle SDKGetPlayerNetInfo;
Handle SDKSendFile;
Handle SDKIsFileInWaitingList;

methodmap CNetChan
{
public CNetChan(int client)
{
return SDKCall(SDKGetPlayerNetInfo, client);
}

public bool SendFile(const char[] filename, int transferID)
{
return SDKCall(SDKSendFile, this, filename, transferID);
}
public bool IsFileInWaitingList(const char[] filename)
{
return SDKCall(SDKIsFileInWaitingList, this, filename);
}
}

public Plugin myinfo =
{
name = "File Network",
author = "Batfoxkid",
description = "But what if, no loading screen",
version = PLUGIN_VERSION_FULL,
url = "https://github.com/Batfoxkid/File-Network"
}

public void OnPluginStart()
{
bool failed;

GameData gamedata = new GameData("filenetwork");

StartPrepSDKCall(SDKCall_Static);
PrepSDKCall_SetFromConf(gamedata, SDKConf_Signature, "CVEngineServer::GetPlayerNetInfo");
PrepSDKCall_AddParameter(SDKType_CBasePlayer, SDKPass_Pointer, VDECODE_FLAG_ALLOWNOTINGAME);
PrepSDKCall_SetReturnInfo(SDKType_PlainOldData, SDKPass_Pointer);
SDKGetPlayerNetInfo = EndPrepSDKCall();
if(!SDKGetPlayerNetInfo)
{
LogError("[Gamedata] Could not find CVEngineServer::GetPlayerNetInfo");
failed = true;
}

StartPrepSDKCall(SDKCall_Raw);
PrepSDKCall_SetFromConf(gamedata, SDKConf_Signature, "CNetChan::SendFile");
PrepSDKCall_AddParameter(SDKType_String, SDKPass_Pointer);
PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Plain);
PrepSDKCall_SetReturnInfo(SDKType_Bool, SDKPass_ByValue);
SDKSendFile = EndPrepSDKCall();
if(!SDKSendFile)
{
LogError("[Gamedata] Could not find CNetChan::SendFile");
failed = true;
}

StartPrepSDKCall(SDKCall_Raw);
PrepSDKCall_SetFromConf(gamedata, SDKConf_Signature, "CNetChan::IsFileInWaitingList");
PrepSDKCall_AddParameter(SDKType_String, SDKPass_Pointer);
PrepSDKCall_SetReturnInfo(SDKType_Bool, SDKPass_ByValue);
SDKIsFileInWaitingList = EndPrepSDKCall();
if(!SDKIsFileInWaitingList)
{
LogError("[Gamedata] Could not find CNetChan::IsFileInWaitingList");
failed = true;
}

if(failed)
ThrowError("Gamedata failed, see error logs");
}

void CheckClient(int client)
{
QueryClientConVar(client, "sv_allowupload", QueryCallback);
}

public void QueryCallback(QueryCookie cookie, int client, ConVarQueryResult result, const char[] cvarName, const char[] cvarValue, any value)
{
if(result == ConVarQuery_Okay)
{

}
}

0 comments on commit cc44ca5

Please sign in to comment.