This commit is contained in:
momo5502 2015-12-27 14:05:08 +01:00
parent 412dbe3d33
commit b8a94cbf22
9 changed files with 41 additions and 35 deletions

View File

@ -8,6 +8,7 @@ namespace Components
public:
Params(DWORD id) : CommandId(id) {};
Params(const Params &obj) { this->CommandId = obj.CommandId; };
Params() : Params(*Game::cmd_id) {};
char* operator[](size_t index);
size_t Length();

View File

@ -2,6 +2,12 @@
namespace Components
{
char** Console::GetAutoCompleteFileList(const char *path, const char *extension, Game::FsListBehavior_e behavior, int *numfiles, int allocTrackType)
{
if (path == (char*)0xBAADF00D) return nullptr;
return Game::FS_ListFiles(path, extension, behavior, numfiles, allocTrackType);
}
void Console::ToggleConsole()
{
// possibly cls.keyCatchers?
@ -25,5 +31,8 @@ namespace Components
// Internal console
Utils::Hook(0x4F690C, Console::ToggleConsole, HOOK_CALL).Install()->Quick();
Utils::Hook(0x4F65A5, Console::ToggleConsole, HOOK_JUMP).Install()->Quick();
// Check for bad food ;)
Utils::Hook(0x4CB9F4, Console::GetAutoCompleteFileList, HOOK_CALL).Install()->Quick();
}
}

View File

@ -8,5 +8,6 @@ namespace Components
private:
static void ToggleConsole();
static char** GetAutoCompleteFileList(const char *path, const char *extension, Game::FsListBehavior_e behavior, int *numfiles, int allocTrackType);
};
}

View File

@ -9,10 +9,10 @@ namespace Components
{
SteamID id;
id.m_comp.m_unAccountID = Game::Com_Milliseconds();
id.m_comp.m_EUniverse = 1;
id.m_comp.m_EAccountType = 8;
id.m_comp.m_unAccountInstance = 0x40000;
id.AccountID = Game::Com_Milliseconds();
id.Universe = 1;
id.AccountType = 8;
id.AccountInstance = 0x40000;
return id;
}
@ -31,9 +31,9 @@ namespace Components
const char* Party::GetLobbyInfo(SteamID lobby, std::string key)
{
if (Party::LobbyMap.find(lobby.m_Bits) != Party::LobbyMap.end())
if (Party::LobbyMap.find(lobby.Bits) != Party::LobbyMap.end())
{
Network::Address address = Party::LobbyMap[lobby.m_Bits];
Network::Address address = Party::LobbyMap[lobby.Bits];
if (key == "addr")
{
@ -50,21 +50,12 @@ namespace Components
void Party::RemoveLobby(SteamID lobby)
{
if (Party::LobbyMap.find(lobby.m_Bits) != Party::LobbyMap.end())
if (Party::LobbyMap.find(lobby.Bits) != Party::LobbyMap.end())
{
Party::LobbyMap.erase(Party::LobbyMap.find(lobby.m_Bits));
Party::LobbyMap.erase(Party::LobbyMap.find(lobby.Bits));
}
}
Game::netadr_t* PartyHost_GetMemberAddressBySlotInState(int unk, void *party, const int slot)
{
Game::netadr_t* addr = Game::PartyHost_GetMemberAddressBySlot(unk, party, slot);
OutputDebugStringA(Network::Address(addr).GetString());
return addr;
}
Party::Party()
{
// various changes to SV_DirectConnect-y stuff to allow non-party joinees
@ -106,8 +97,6 @@ namespace Components
Utils::Hook::Nop(0x5AF851, 5);
Utils::Hook::Set<BYTE>(0x5AF85B, 0xEB);
Utils::Hook(0x5B5544, PartyHost_GetMemberAddressBySlotInState, HOOK_CALL).Install()->Quick();
Command::Add("connect", [] (Command::Params params)
{
if (params.Length() < 2)
@ -129,9 +118,9 @@ namespace Components
SteamID id = Party::GenerateLobbyId();
Party::LobbyMap[id.m_Bits] = address;
Party::LobbyMap[id.Bits] = address;
OutputDebugStringA(Utils::VA("Mapping %llX -> %s", id.m_Bits, address.GetString()));
OutputDebugStringA(Utils::VA("Mapping %llX -> %s", id.Bits, address.GetString()));
Game::Steam_JoinLobby(id, 0);
@ -174,7 +163,7 @@ namespace Components
info.Set("mapname", Dvar::Var("mapname").Get<const char*>());
info.Set("gametype", Dvar::Var("g_gametype").Get<const char*>());
info.Set("fs_game", Dvar::Var("fs_game").Get<const char*>());
info.Set("xuid", Utils::VA("%llX", Steam::SteamUser()->GetSteamID().m_Bits));
info.Set("xuid", Utils::VA("%llX", Steam::SteamUser()->GetSteamID().Bits));
info.Set("clients", Utils::VA("%i", clientCount));
info.Set("sv_maxclients", Utils::VA("%i", *Game::svs_numclients));

View File

@ -81,7 +81,7 @@ namespace Game
typedef int(__cdecl * FS_ReadFile_t)(const char* path, char** buffer);
extern FS_ReadFile_t FS_ReadFile;
typedef char** (__cdecl * FS_ListFiles_t)(char* path, char* extension, int noclue, int* amount);
typedef char** (__cdecl * FS_ListFiles_t)(const char *path, const char *extension, FsListBehavior_e behavior, int *numfiles, int allocTrackType);
extern FS_ListFiles_t FS_ListFiles;
typedef void(__cdecl * FS_FreeFileList_t)(char** list);

View File

@ -602,6 +602,12 @@ namespace Game
menuDef_t **menus;
};
enum FsListBehavior_e
{
FS_LIST_PURE_ONLY = 0x0,
FS_LIST_ALL = 0x1,
};
typedef enum
{
NA_BOT,

View File

@ -54,10 +54,10 @@ namespace Steam
LobbyCreated* retvals = new LobbyCreated;
SteamID id;
id.m_comp.m_unAccountID = 1337132;
id.m_comp.m_EUniverse = 1;
id.m_comp.m_EAccountType = 8;
id.m_comp.m_unAccountInstance = 0x40000;
id.AccountID = 1337132;
id.Universe = 1;
id.AccountType = 8;
id.AccountInstance = 0x40000;
retvals->m_eResult = 1;
retvals->m_ulSteamIDLobby = id;

View File

@ -29,7 +29,7 @@ namespace Steam
subId = /*::Utils::OneAtATime((char*)Data[1].pbData, 52); */(Game::Com_Milliseconds() + timeGetTime());
}
id.m_Bits = 0x110000100000000 | subId;
id.Bits = 0x110000100000000 | subId;
return id;
}

View File

@ -4,15 +4,15 @@
typedef union
{
struct SteamIDComponent_t
struct
{
unsigned int m_unAccountID : 32;
unsigned int m_unAccountInstance : 20;
unsigned int m_EAccountType : 4;
int m_EUniverse : 8;
} m_comp;
unsigned int AccountID : 32;
unsigned int AccountInstance : 20;
unsigned int AccountType : 4;
int Universe : 8;
};
unsigned long long m_Bits;
unsigned long long Bits;
} SteamID;
#include "Interfaces\SteamUser.hpp"