LibreSplit/include/plugins/plugin_utils.h

47 lines
1.1 KiB
C
Raw Normal View History

2026-03-13 22:10:10 +01:00
#pragma once
#include "include/lasr/auto-splitter.h"
#include "include/timer.h"
#include "lua.h"
2026-03-14 21:17:51 +01:00
extern ExternalLASRFunctionRegistry external_lasr_functions;
2026-03-13 22:10:10 +01:00
extern TimerHookRegistry start_hooks;
extern TimerHookRegistry stop_hooks;
extern TimerHookRegistry split_hooks;
extern TimerHookRegistry reset_hooks;
extern TimerHookRegistry cancel_hooks;
extern TimerHookRegistry skip_hooks;
extern TimerHookRegistry unsplit_hooks;
extern TimerHookRegistry pause_hooks;
extern TimerHookRegistry unpause_hooks;
2026-03-13 22:10:10 +01:00
/*! \enum event
*
* Describes the events you can register an event hook for.
*/
typedef enum HookableEvent {
START,
SPLIT,
STOP,
RESET,
CANCEL,
SKIP,
UNSPLIT,
PAUSE,
UNPAUSE,
} HookableEvent;
typedef int (*register_lua_func)(const char*, lua_CFunction);
typedef int (*register_event_func)(HookableEvent event, timer_hook_func fn);
typedef struct PlugAPI {
register_lua_func register_lua_function;
register_event_func register_event_hook;
} PlugAPI;
int register_lua_function(const char* name, lua_CFunction);
2026-03-13 22:10:10 +01:00
int register_event_hook(HookableEvent event, timer_hook_func fn);
void init_external_lasr_functions(void);