mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Add RPak completion callbacks
Add completion for 'pak_requestload' and 'pak_requestunload'.
This commit is contained in:
parent
a8c5ed45fd
commit
e4df03c4f2
@ -375,8 +375,8 @@ void ConCommand::Init(void)
|
||||
// RTECH API |
|
||||
ConCommand::Create("rtech_strtoguid", "Calculates the GUID from input data.", FCVAR_DEVELOPMENTONLY, RTech_StringToGUID_f, nullptr);
|
||||
ConCommand::Create("rtech_decompress", "Decompresses the specified RPAK file.", FCVAR_DEVELOPMENTONLY, RTech_Decompress_f, nullptr);
|
||||
ConCommand::Create("pak_requestload", "Requests asynchronous load for specified RPAK file.", FCVAR_DEVELOPMENTONLY, Pak_RequestLoad_f, nullptr);
|
||||
ConCommand::Create("pak_requestunload", "Requests unload for specified RPAK file or ID.", FCVAR_DEVELOPMENTONLY, Pak_RequestUnload_f, nullptr);
|
||||
ConCommand::Create("pak_requestload", "Requests asynchronous load for specified RPAK file.", FCVAR_DEVELOPMENTONLY, Pak_RequestLoad_f, RTech_PakLoad_f_CompletionFunc);
|
||||
ConCommand::Create("pak_requestunload", "Requests unload for specified RPAK file or ID.", FCVAR_DEVELOPMENTONLY, Pak_RequestUnload_f, RTech_PakUnload_f_CompletionFunc);
|
||||
ConCommand::Create("pak_swap", "Requests swap for specified RPAK file or ID", FCVAR_DEVELOPMENTONLY, Pak_Swap_f, nullptr);
|
||||
ConCommand::Create("pak_listpaks", "Display a list of the loaded Pak files.", FCVAR_RELEASE, Pak_ListPaks_f, nullptr);
|
||||
ConCommand::Create("pak_listtypes", "Display a list of the registered asset types.", FCVAR_RELEASE, Pak_ListTypes_f, nullptr);
|
||||
|
@ -50,13 +50,42 @@ int _Host_Map_f_CompletionFunc(char const* cmdname, char const* partial, char co
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Input : *partial -
|
||||
// Input : *autocomplete -
|
||||
// *partial -
|
||||
// context -
|
||||
// longest -
|
||||
// maxcommands -
|
||||
// **commands -
|
||||
// Output : int
|
||||
//-----------------------------------------------------------------------------
|
||||
int _Host_Pak_f_CompletionFunc(CAutoCompleteFileList* autocomplete, char const* partial, char commands[COMMAND_COMPLETION_MAXITEMS][COMMAND_COMPLETION_ITEM_LENGTH])
|
||||
{
|
||||
int count = autocomplete->AutoCompletionFunc(partial, commands);
|
||||
if (count > 0)
|
||||
{
|
||||
for (size_t i = 0; i < count; i++)
|
||||
{
|
||||
size_t cmdsize = strlen(commands[i]);
|
||||
if (cmdsize < COMMAND_COMPLETION_ITEM_LENGTH - 4)
|
||||
{
|
||||
snprintf(&commands[i][cmdsize], 5, "%s", "rpak");
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(commands[i], COMMAND_COMPLETION_ITEM_LENGTH, "%s", "BUFFER_TOO_SMALL");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Input : *partial -
|
||||
// **commands -
|
||||
// Output : int
|
||||
//-----------------------------------------------------------------------------
|
||||
int Host_SSMap_f_CompletionFunc(char const* partial, char commands[COMMAND_COMPLETION_MAXITEMS][COMMAND_COMPLETION_ITEM_LENGTH])
|
||||
{
|
||||
char const* cmdname = "ss_map ";
|
||||
@ -66,9 +95,6 @@ int Host_SSMap_f_CompletionFunc(char const* partial, char commands[COMMAND_COMPL
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Input : *partial -
|
||||
// context -
|
||||
// longest -
|
||||
// maxcommands -
|
||||
// **commands -
|
||||
// Output : int
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -81,9 +107,6 @@ int Host_Map_f_CompletionFunc(char const* partial, char commands[COMMAND_COMPLET
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Input : *partial -
|
||||
// context -
|
||||
// longest -
|
||||
// maxcommands -
|
||||
// **commands -
|
||||
// Output : int
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -96,9 +119,6 @@ int Host_Background_f_CompletionFunc(char const* partial, char commands[COMMAND_
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Input : *partial -
|
||||
// context -
|
||||
// longest -
|
||||
// maxcommands -
|
||||
// **commands -
|
||||
// Output : int
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -109,8 +129,37 @@ int Host_Changelevel_f_CompletionFunc(char const* partial, char commands[COMMAND
|
||||
}
|
||||
|
||||
static CAutoCompleteFileList s_GiveAutoFileList("give", "scripts/weapons", "txt");
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Input : *partial -
|
||||
// **commands -
|
||||
// Output : int
|
||||
//-----------------------------------------------------------------------------
|
||||
int Game_Give_f_CompletionFunc(char const* partial, char commands[COMMAND_COMPLETION_MAXITEMS][COMMAND_COMPLETION_ITEM_LENGTH])
|
||||
{
|
||||
return s_GiveAutoFileList.AutoCompletionFunc(partial, commands);
|
||||
}
|
||||
|
||||
static CAutoCompleteFileList s_PakLoadAutoFileList("pak_requestload", "paks/Win64", "rpak");
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Input : *partial -
|
||||
// **commands -
|
||||
// Output : int
|
||||
//-----------------------------------------------------------------------------
|
||||
int RTech_PakLoad_f_CompletionFunc(char const* partial, char commands[COMMAND_COMPLETION_MAXITEMS][COMMAND_COMPLETION_ITEM_LENGTH])
|
||||
{
|
||||
return _Host_Pak_f_CompletionFunc(&s_PakLoadAutoFileList, partial, commands);
|
||||
}
|
||||
|
||||
static CAutoCompleteFileList s_PakUnloadAutoFileList("pak_requestunload", "paks/Win64", "rpak");
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Input : *partial -
|
||||
// **commands -
|
||||
// Output : int
|
||||
//-----------------------------------------------------------------------------
|
||||
int RTech_PakUnload_f_CompletionFunc(char const* partial, char commands[COMMAND_COMPLETION_MAXITEMS][COMMAND_COMPLETION_ITEM_LENGTH])
|
||||
{
|
||||
return _Host_Pak_f_CompletionFunc(&s_PakUnloadAutoFileList, partial, commands);
|
||||
}
|
||||
|
@ -9,6 +9,9 @@ int Host_Changelevel_f_CompletionFunc(char const* partial, char commands[COMMAND
|
||||
|
||||
int Game_Give_f_CompletionFunc(char const* partial, char commands[COMMAND_COMPLETION_MAXITEMS][COMMAND_COMPLETION_ITEM_LENGTH]);
|
||||
|
||||
int RTech_PakLoad_f_CompletionFunc(char const* partial, char commands[COMMAND_COMPLETION_MAXITEMS][COMMAND_COMPLETION_ITEM_LENGTH]);
|
||||
int RTech_PakUnload_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<int(*)(
|
||||
CAutoCompleteFileList* thisp, const char* partial, char commands[COMMAND_COMPLETION_MAXITEMS][COMMAND_COMPLETION_ITEM_LENGTH])>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user