mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 18:38:26 +00:00
add cheapCloneHandle parameter to Shavit_GetReplayFrames
This commit is contained in:
parent
4a686ee440
commit
418676d26c
@ -1611,9 +1611,10 @@ native int Shavit_GetReplayCachePostFrame(int bot);
|
||||
*
|
||||
* @param style Style.
|
||||
* @param track Track.
|
||||
* @param cheapCloneHandle False means we duplicate the frames (ArrayList.Clone). True means we clone the handle to the frames (CloneHandle).
|
||||
* @return ArrayList with proper replay data, or null if there is no recorded data.
|
||||
*/
|
||||
native ArrayList Shavit_GetReplayFrames(int style, int track);
|
||||
native ArrayList Shavit_GetReplayFrames(int style, int track, bool cheapCloneHandle=false);
|
||||
|
||||
/**
|
||||
* Retrieves a client's frame count.
|
||||
|
||||
@ -1107,14 +1107,20 @@ public int Native_GetReplayFrames(Handle plugin, int numParams)
|
||||
{
|
||||
int style = GetNativeCell(1);
|
||||
int track = GetNativeCell(2);
|
||||
bool cheapCloneHandle = (numParams > 2) && view_as<bool>(GetNativeCell(3));
|
||||
Handle cloned = null;
|
||||
|
||||
if(gA_FrameCache[style][track].aFrames != null)
|
||||
{
|
||||
ArrayList frames = gA_FrameCache[style][track].aFrames.Clone();
|
||||
ArrayList frames = cheapCloneHandle ? gA_FrameCache[style][track].aFrames : gA_FrameCache[style][track].aFrames.Clone();
|
||||
cloned = CloneHandle(frames, plugin); // set the calling plugin as the handle owner
|
||||
|
||||
if (!cheapCloneHandle)
|
||||
{
|
||||
// Only hit for .Clone()'d handles. .Clone() != CloneHandle()
|
||||
CloseHandle(frames);
|
||||
}
|
||||
}
|
||||
|
||||
return view_as<int>(cloned);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user