diff --git a/r5dev/tier1/cmd.cpp b/r5dev/tier1/cmd.cpp
index 8b4ae664..aeef346b 100644
--- a/r5dev/tier1/cmd.cpp
+++ b/r5dev/tier1/cmd.cpp
@@ -394,10 +394,12 @@ void ConCommand::InitShipped(void)
///------------------------------------------------------ [ CALLBACK SWAP ]
//-------------------------------------------------------------------------
// ENGINE DLL |
+#ifndef CLIENT_DLL
ConCommand* changelevel = g_pCVar->FindCommand("changelevel");
ConCommand* map = g_pCVar->FindCommand("map");
ConCommand* map_background = g_pCVar->FindCommand("map_background");
ConCommand* ss_map = g_pCVar->FindCommand("ss_map");
+#endif // !CLIENT_DLL
ConCommand* migrateme = g_pCVar->FindCommand("migrateme");
ConCommand* help = g_pCVar->FindCommand("help");
ConCommand* convar_list = g_pCVar->FindCommand("convar_list");
@@ -407,19 +409,29 @@ void ConCommand::InitShipped(void)
//-------------------------------------------------------------------------
// MATERIAL SYSTEM
ConCommand* mat_crosshair = g_pCVar->FindCommand("mat_crosshair"); // Patch callback function to working callback.
- mat_crosshair->m_fnCommandCallback = Mat_CrossHair_f;
+ //-------------------------------------------------------------------------
+ // CLIENT DLL |
+ ConCommand* give = g_pCVar->FindCommand("give");
#endif // !DEDICATED
help->m_fnCommandCallback = CVHelp_f;
- changelevel->m_fnCommandCallback = Host_Changelevel_f;
convar_list->m_fnCommandCallback = CVList_f;
convar_differences->m_fnCommandCallback = CVDiff_f;
convar_findByFlags->m_fnCommandCallback = CVFlag_f;
+#ifndef CLIENT_DLL
+ changelevel->m_fnCommandCallback = Host_Changelevel_f;
+ changelevel->m_fnCompletionCallback = Host_Changelevel_f_CompletionFunc;
+
map->m_fnCompletionCallback = Host_Map_f_CompletionFunc;
map_background->m_fnCompletionCallback = Host_Background_f_CompletionFunc;
ss_map->m_fnCompletionCallback = Host_SSMap_f_CompletionFunc;
- changelevel->m_fnCompletionCallback = Host_Changelevel_f_CompletionFunc;
+#endif // !CLIENT_DLL
+
+#ifndef DEDICATED
+ mat_crosshair->m_fnCommandCallback = Mat_CrossHair_f;
+ give->m_fnCompletionCallback = Game_Give_f_CompletionFunc;
+#endif // !DEDICATED
/// ------------------------------------------------------ [ FLAG REMOVAL ]
//-------------------------------------------------------------------------
@@ -452,14 +464,17 @@ void ConCommand::InitShipped(void)
}
}
- changelevel->RemoveFlags(FCVAR_DEVELOPMENTONLY);
convar_list->RemoveFlags(FCVAR_DEVELOPMENTONLY);
convar_differences->RemoveFlags(FCVAR_DEVELOPMENTONLY);
convar_findByFlags->RemoveFlags(FCVAR_DEVELOPMENTONLY);
help->RemoveFlags(FCVAR_DEVELOPMENTONLY);
+ migrateme->RemoveFlags(FCVAR_SERVER_CAN_EXECUTE);
+#ifndef CLIENT_DLL
+ changelevel->RemoveFlags(FCVAR_DEVELOPMENTONLY);
map->RemoveFlags(FCVAR_SERVER_CAN_EXECUTE);
map_background->RemoveFlags(FCVAR_SERVER_CAN_EXECUTE);
- migrateme->RemoveFlags(FCVAR_SERVER_CAN_EXECUTE);
+ ss_map->RemoveFlags(FCVAR_SERVER_CAN_EXECUTE);
+#endif // !CLIENT_DLL
}
}
diff --git a/r5dev/vproj/clientsdk.vcxproj b/r5dev/vproj/clientsdk.vcxproj
index 01f361d3..e725881f 100644
--- a/r5dev/vproj/clientsdk.vcxproj
+++ b/r5dev/vproj/clientsdk.vcxproj
@@ -159,6 +159,7 @@
+
@@ -597,6 +598,7 @@
+
diff --git a/r5dev/vproj/clientsdk.vcxproj.filters b/r5dev/vproj/clientsdk.vcxproj.filters
index bea9a981..c0238ac2 100644
--- a/r5dev/vproj/clientsdk.vcxproj.filters
+++ b/r5dev/vproj/clientsdk.vcxproj.filters
@@ -681,6 +681,9 @@
sdk\tier0
+
+ sdk\vstdlib
+
@@ -1994,6 +1997,9 @@
sdk\tier0
+
+ sdk\vstdlib
+
diff --git a/r5dev/vproj/dedicated.vcxproj b/r5dev/vproj/dedicated.vcxproj
index a1198b30..d8e9abe7 100644
--- a/r5dev/vproj/dedicated.vcxproj
+++ b/r5dev/vproj/dedicated.vcxproj
@@ -512,6 +512,7 @@
+
@@ -654,6 +655,7 @@
+
diff --git a/r5dev/vproj/dedicated.vcxproj.filters b/r5dev/vproj/dedicated.vcxproj.filters
index ff7f7bcb..9ad9e52a 100644
--- a/r5dev/vproj/dedicated.vcxproj.filters
+++ b/r5dev/vproj/dedicated.vcxproj.filters
@@ -1380,6 +1380,9 @@
sdk\tier0
+
+ sdk\vstdlib
+
@@ -1763,6 +1766,9 @@
sdk\tier0
+
+ sdk\vstdlib
+
diff --git a/r5dev/vproj/gamesdk.vcxproj b/r5dev/vproj/gamesdk.vcxproj
index 83f6ad05..152b25f6 100644
--- a/r5dev/vproj/gamesdk.vcxproj
+++ b/r5dev/vproj/gamesdk.vcxproj
@@ -178,6 +178,7 @@
+
@@ -651,6 +652,7 @@
+
diff --git a/r5dev/vproj/gamesdk.vcxproj.filters b/r5dev/vproj/gamesdk.vcxproj.filters
index 8a938e1d..f02d3f67 100644
--- a/r5dev/vproj/gamesdk.vcxproj.filters
+++ b/r5dev/vproj/gamesdk.vcxproj.filters
@@ -747,6 +747,9 @@
sdk\tier0
+
+ sdk\vstdlib
+
@@ -2165,6 +2168,9 @@
sdk\tier0
+
+ sdk\vstdlib
+
diff --git a/r5dev/vstdlib/autocompletefilelist.cpp b/r5dev/vstdlib/autocompletefilelist.cpp
new file mode 100644
index 00000000..73b98906
--- /dev/null
+++ b/r5dev/vstdlib/autocompletefilelist.cpp
@@ -0,0 +1,20 @@
+//===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//===========================================================================//
+#include "core/stdafx.h"
+#include "completion.h"
+#include "autocompletefilelist.h"
+
+//-----------------------------------------------------------------------------
+// Purpose: Fills in a list of commands based on specified subdirectory and extension into the format:
+// commandname subdir/filename.ext
+// commandname subdir/filename2.ext
+// Returns number of files in list for autocompletion
+//-----------------------------------------------------------------------------
+int CAutoCompleteFileList::AutoCompletionFunc(const char* partial, char commands[COMMAND_COMPLETION_MAXITEMS][COMMAND_COMPLETION_ITEM_LENGTH])
+{
+ return v_CAutoCompleteFileList_AutoCompletionFunc(this, partial, commands);
+}
diff --git a/r5dev/vstdlib/autocompletefilelist.h b/r5dev/vstdlib/autocompletefilelist.h
new file mode 100644
index 00000000..9d29a8a6
--- /dev/null
+++ b/r5dev/vstdlib/autocompletefilelist.h
@@ -0,0 +1,36 @@
+//===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//===========================================================================//
+
+#ifndef AUTOCOMPLETEFILELIST_H
+#define AUTOCOMPLETEFILELIST_H
+#ifdef _WIN32
+#pragma once
+#endif
+#include "public/iconvar.h"
+
+//-----------------------------------------------------------------------------
+// Purpose: Simple helper class for doing autocompletion of all files in a specific directory by extension
+//-----------------------------------------------------------------------------
+class CAutoCompleteFileList
+{
+public:
+ CAutoCompleteFileList(const char* cmdname, const char* subdir, const char* extension)
+ {
+ m_pszCommandName = cmdname;
+ m_pszSubDir = subdir;
+ m_pszExtension = extension;
+ }
+
+ int AutoCompletionFunc(const char* partial, char commands[COMMAND_COMPLETION_MAXITEMS][COMMAND_COMPLETION_ITEM_LENGTH]);
+
+private:
+ const char* m_pszCommandName;
+ const char* m_pszSubDir;
+ const char* m_pszExtension;
+};
+
+#endif // AUTOCOMPLETEFILELIST_H
\ No newline at end of file
diff --git a/r5dev/vstdlib/completion.cpp b/r5dev/vstdlib/completion.cpp
index c1035e7f..ce343630 100644
--- a/r5dev/vstdlib/completion.cpp
+++ b/r5dev/vstdlib/completion.cpp
@@ -8,6 +8,7 @@
#include "engine/cmodel_bsp.h"
#include "tier1/strtools.h"
#include "completion.h"
+#include "autocompletefilelist.h"
//-----------------------------------------------------------------------------
// Purpose:
@@ -106,3 +107,10 @@ int Host_Changelevel_f_CompletionFunc(char const* partial, char commands[COMMAND
char const* cmdname = "changelevel ";
return _Host_Map_f_CompletionFunc(cmdname, partial, commands);
}
+
+static CAutoCompleteFileList s_GiveAutoFileList("give", "scripts/weapons", "txt");
+int Game_Give_f_CompletionFunc(char const* partial, char commands[COMMAND_COMPLETION_MAXITEMS][COMMAND_COMPLETION_ITEM_LENGTH])
+{
+ return s_GiveAutoFileList.AutoCompletionFunc(partial, commands);
+}
+
diff --git a/r5dev/vstdlib/completion.h b/r5dev/vstdlib/completion.h
index 9666c5a1..10aae755 100644
--- a/r5dev/vstdlib/completion.h
+++ b/r5dev/vstdlib/completion.h
@@ -1,16 +1,35 @@
#pragma once
#include "public/iconvar.h"
+#include "autocompletefilelist.h"
int Host_SSMap_f_CompletionFunc(char const* partial, char commands[COMMAND_COMPLETION_MAXITEMS][COMMAND_COMPLETION_ITEM_LENGTH]);
int Host_Map_f_CompletionFunc(char const* partial, char commands[COMMAND_COMPLETION_MAXITEMS][COMMAND_COMPLETION_ITEM_LENGTH]);
int Host_Background_f_CompletionFunc(char const* partial, char commands[COMMAND_COMPLETION_MAXITEMS][COMMAND_COMPLETION_ITEM_LENGTH]);
int Host_Changelevel_f_CompletionFunc(char const* partial, char commands[COMMAND_COMPLETION_MAXITEMS][COMMAND_COMPLETION_ITEM_LENGTH]);
+int Game_Give_f_CompletionFunc(char const* partial, char commands[COMMAND_COMPLETION_MAXITEMS][COMMAND_COMPLETION_ITEM_LENGTH]);
+
+inline CMemory p_CAutoCompleteFileList_AutoCompletionFunc;
+inline auto v_CAutoCompleteFileList_AutoCompletionFunc = p_CAutoCompleteFileList_AutoCompletionFunc.RCast();
+
///////////////////////////////////////////////////////////////////////////////
class VCompletion : public IDetour
{
- virtual void GetAdr(void) const { }
- virtual void GetFun(void) const { }
+ virtual void GetAdr(void) const
+ {
+ LogFunAdr("CAutoCompleteFileList::AutoCompletionFunc", p_CAutoCompleteFileList_AutoCompletionFunc.GetPtr());
+ }
+ virtual void GetFun(void) const
+ {
+#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
+ p_CBaseAutoCompleteFileList_AutoCompletionFunc = g_GameDll.FindPatternSIMD("40 55 53 57 41 54 41 55 41 56 41 57 48 8D 6C 24 ?? 48 81 EC ?? ?? ?? ?? 48 8B 39");
+#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
+ p_CAutoCompleteFileList_AutoCompletionFunc = g_GameDll.FindPatternSIMD("48 8B C4 4C 89 40 18 55 41 54");
+#endif
+ v_CAutoCompleteFileList_AutoCompletionFunc = p_CAutoCompleteFileList_AutoCompletionFunc.RCast();
+ }
virtual void GetVar(void) const { }
virtual void GetCon(void) const { }
virtual void Attach(void) const { }