accelerator/scripting/include/accelerator.inc
caxanga334 87704dc53b
Some checks failed
Release / main-ci (push) Has been cancelled
Release / release (push) Has been cancelled
[Feature]: Add on crash uploaded SourceMod forward (#42)
* 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.
2025-12-02 16:32:12 -05:00

67 lines
1.7 KiB
SourcePawn

/**
* Accelerator's SourcePawn include file
*/
#if defined _accelerator_included
#endinput
#endif
#define _accelerator_included
/**
* Called when Accelerator is done uploading crash dumps.
*/
forward void Accelerator_OnDoneUploadingCrashes();
/**
* Returns the number of crashes uploaded.
*
* @return Number of crashes uploaded.
*/
native int Accelerator_GetUploadedCrashCount();
/**
* Returns if Accelerator is done uploading crashes.
*
* @return True if no more crashes will be uploaded, false if there are still crashes pending upload.
*/
native bool Accelerator_IsDoneUploadingCrashes();
/**
* Gets a crash's HTTP response from Accelerator's backend server.
*
* @note The response from the server can be anything and there is no guarantee a crash ID will be present.
* @param index The crash index, starts at 0 and goes up to Accelerator_GetUploadedCrashCount() - 1;
* @param buffer Buffer to store the crash HTTP response.
* @param size Size of the buffer parameter.
* @error Native called before Accelerator_IsDoneUploadingCrashes() returns true or invalid crash index passed.
*/
native void Accelerator_GetCrashHTTPResponse(int index, char[] buffer, int size);
/**
* Do not edit below this line!
*/
public Extension __ext_accelerator =
{
name = "accelerator",
file = "accelerator.ext",
#if defined AUTOLOAD_EXTENSIONS
autoload = 1,
#else
autoload = 0,
#endif
#if defined REQUIRE_EXTENSIONS
required = 1,
#else
required = 0,
#endif
};
#if !defined REQUIRE_EXTENSIONS
public __ext_accelerator_SetNTVOptional()
{
MarkNativeAsOptional("Accelerator_GetUploadedCrashCount");
MarkNativeAsOptional("Accelerator_IsDoneUploadingCrashes");
MarkNativeAsOptional("Accelerator_GetCrashHTTPResponse");
}
#endif