mirror of
https://github.com/asherkin/accelerator.git
synced 2025-12-06 18:08:30 +00:00
* Squashed commit of the following:
commit c7efce2d6722b08e2ea719ce1a39f80747502f77
Author: caxanga334 <10157643+caxanga334@users.noreply.github.com>
Date: Sat Nov 22 22:35:24 2025 -0300
Fix Error
commit e8acf9f505aa26b007c5837d4075f649099f43c3
Author: caxanga334 <10157643+caxanga334@users.noreply.github.com>
Date: Sat Nov 22 22:23:57 2025 -0300
Fix Possible Memory Leak
commit 51e718922726c074c0e7a45f9d13c6a51e4b97eb
Author: caxanga334 <10157643+caxanga334@users.noreply.github.com>
Date: Sat Nov 22 22:13:55 2025 -0300
Add Upload Forward
* Update accelerator.inc
* Fix: Missing forwards.cpp in AMBuilder
* Refactor API
Forward notifies plugins when the extension is done uploading.
Plugins can fetch data from uploaded crashes via natives.
Added example plugin.
* Implement Requested Changes
* Fix Error
* Update Example Plugin
Removed timer example.
Added example of how to handle plugin late loads.
37 lines
904 B
C++
37 lines
904 B
C++
#include <array>
|
|
#include <string>
|
|
#include "extension.h"
|
|
#include "forwards.h"
|
|
|
|
|
|
static SourceMod::IForward* s_ondoneuploadingforward = nullptr;
|
|
|
|
static void OnDoneUploadingCallback(void* data)
|
|
{
|
|
if (s_ondoneuploadingforward) {
|
|
s_ondoneuploadingforward->Execute();
|
|
}
|
|
}
|
|
|
|
|
|
void extforwards::Init()
|
|
{
|
|
s_ondoneuploadingforward = forwards->CreateForward("Accelerator_OnDoneUploadingCrashes", SourceMod::ExecType::ET_Ignore, 0, nullptr);
|
|
}
|
|
|
|
void extforwards::Shutdown()
|
|
{
|
|
if (s_ondoneuploadingforward) {
|
|
forwards->ReleaseForward(s_ondoneuploadingforward);
|
|
s_ondoneuploadingforward = nullptr;
|
|
}
|
|
}
|
|
|
|
void extforwards::CallOnDoneUploadingForward()
|
|
{
|
|
// It's obligatory to use AddFrameAction here because SourcePawn forwards can only be called from the server's main thread.
|
|
// AddFrameAction will do this for us and is also thread safe.
|
|
smutils->AddFrameAction(OnDoneUploadingCallback, nullptr);
|
|
}
|
|
|