From 70ca6ace3d276be1082b9c2a21af017ff6c4394d Mon Sep 17 00:00:00 2001 From: BoomShotKapow <75021396+BoomShotKapow@users.noreply.github.com> Date: Wed, 3 Nov 2021 08:20:52 +0000 Subject: [PATCH] Add a native for getting Shavit's replay folder path for personal replays --- .../scripting/include/shavit/replay-playback.inc | 9 +++++++++ addons/sourcemod/scripting/shavit-replay-playback.sp | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/addons/sourcemod/scripting/include/shavit/replay-playback.inc b/addons/sourcemod/scripting/include/shavit/replay-playback.inc index 2e617f4b..60b09a2d 100644 --- a/addons/sourcemod/scripting/include/shavit/replay-playback.inc +++ b/addons/sourcemod/scripting/include/shavit/replay-playback.inc @@ -265,6 +265,15 @@ native void Shavit_GetReplayName(int style, int track, char[] buffer, int length */ native void Shavit_GetReplayCacheName(int bot, char[] buffer, int length); +/** + * Retrieves the folder path where the replay files are saved. + * + * @param buffer Buffer string. + * @param length String length. + * @noreturn + */ +native void Shavit_GetReplayFolderPath(char[] buffer, int length); + /** * Checks if there's loaded replay data for a bhop style or not. * diff --git a/addons/sourcemod/scripting/shavit-replay-playback.sp b/addons/sourcemod/scripting/shavit-replay-playback.sp index 478ada4c..ecb1260d 100644 --- a/addons/sourcemod/scripting/shavit-replay-playback.sp +++ b/addons/sourcemod/scripting/shavit-replay-playback.sp @@ -284,6 +284,7 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max CreateNative("Shavit_StartReplayFromFile", Native_StartReplayFromFile); CreateNative("Shavit_GetLoopingBotByName", Native_GetLoopingBotByName); CreateNative("Shavit_SetReplayCacheName", Native_SetReplayCacheName); + CreateNative("Shavit_GetReplayFolderPath", Native_GetReplayFolderPath); if (!FileExists("cfg/sourcemod/plugin.shavit-replay-playback.cfg") && FileExists("cfg/sourcemod/plugin.shavit-replay.cfg")) { @@ -1390,6 +1391,11 @@ public int Native_SetReplayCacheName(Handle plugin, int numParams) return 0; } +public int Native_GetReplayFolderPath(Handle handler, int numParams) +{ + return SetNativeString(1, gS_ReplayFolder, GetNativeCell(2)); +} + public Action Timer_Cron(Handle Timer) { for (int i = 1; i <= MaxClients; i++)