2020-05-02 09:38:13 +00:00
|
|
|
#include "../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp"
|
|
|
|
#include "../Core.hpp"
|
|
|
|
|
2022-04-02 11:03:11 +00:00
|
|
|
export_func AngelScriptResolver* PkmnLib_AngelScriptResolver_Construct() { return new AngelScriptResolver(); }
|
|
|
|
export_func uint8_t PkmnLib_AngelScriptResolver_Destruct(AngelScriptResolver* p) { Try(delete p;) }
|
2020-05-02 09:38:13 +00:00
|
|
|
|
2022-04-02 11:03:11 +00:00
|
|
|
export_func uint8_t PkmnLib_AngelScriptResolver_Initialize(AngelScriptResolver* p,
|
2020-05-02 09:38:13 +00:00
|
|
|
CreatureLib::Battling::BattleLibrary* lib) {
|
|
|
|
Try(p->Initialize(lib);)
|
|
|
|
}
|
|
|
|
|
2022-04-02 11:03:11 +00:00
|
|
|
export_func uint8_t PkmnLib_AngelScriptResolver_CreateScript(AngelScriptResolver* p, const char* name, const char* script) {
|
2020-05-02 09:38:13 +00:00
|
|
|
Try(p->CreateScript(name, script);)
|
|
|
|
}
|
2022-04-02 11:03:11 +00:00
|
|
|
export_func uint8_t PkmnLib_AngelScriptResolver_FinalizeModule(AngelScriptResolver* p) { Try(p->FinalizeModule();) }
|
|
|
|
export_func uint8_t PkmnLib_AngelScriptResolver_LoadScript(CreatureLib::Battling::BattleScript*& out, AngelScriptResolver* p,
|
2021-10-29 21:54:44 +00:00
|
|
|
void* owner, ScriptCategory category, const char* scriptName) {
|
|
|
|
Try(out = p->LoadScript(owner, category, ArbUt::StringView(scriptName));)
|
2020-05-02 09:38:13 +00:00
|
|
|
}
|
2022-04-02 11:03:11 +00:00
|
|
|
export_func uint8_t PkmnLib_AngelScriptResolver_LoadEvolutionScript(PkmnLib::Battling::EvolutionScript const*& out,
|
2021-07-09 11:54:42 +00:00
|
|
|
AngelScriptResolver* p, const char* scriptName) {
|
|
|
|
Try(
|
|
|
|
auto s = p->LoadEvolutionScript(ArbUt::StringView(scriptName));
|
|
|
|
if (!s.HasValue()) { out = nullptr; } else { out = s.GetValue(); })
|
|
|
|
}
|
|
|
|
|
2022-04-02 11:03:11 +00:00
|
|
|
export_func uint8_t PkmnLib_AngelScriptResolver_WriteByteCodeToFile(AngelScriptResolver* p, const char* file,
|
2020-05-02 09:38:13 +00:00
|
|
|
bool stripDebugInfo) {
|
|
|
|
Try(p->WriteByteCodeToFile(file, stripDebugInfo);)
|
|
|
|
}
|
2022-04-02 11:03:11 +00:00
|
|
|
export_func uint8_t PkmnLib_AngelScriptResolver_LoadByteCodeFromFile(AngelScriptResolver* p, const char* file) {
|
2020-05-02 09:38:13 +00:00
|
|
|
Try(p->LoadByteCodeFromFile(file);)
|
|
|
|
}
|
2022-04-02 11:03:11 +00:00
|
|
|
export_func uint8_t PkmnLib_AngelScriptResolver_WriteByteCodeToMemory(AngelScriptResolver* p, bool stripDebugInfo,
|
2020-05-02 09:38:13 +00:00
|
|
|
size_t& size, uint8_t*& out) {
|
|
|
|
Try(out = p->WriteByteCodeToMemory(size, stripDebugInfo);)
|
|
|
|
}
|
2022-04-02 11:03:11 +00:00
|
|
|
export_func uint8_t PkmnLib_AngelScriptResolver_LoadByteCodeFromMemory(AngelScriptResolver* p, uint8_t* memory,
|
2020-05-02 09:38:13 +00:00
|
|
|
size_t size) {
|
|
|
|
Try(p->LoadByteCodeFromMemory(memory, size);)
|
|
|
|
}
|
2022-04-02 11:03:11 +00:00
|
|
|
export_func uint8_t PkmnLib_AngelScriptResolver_RegisterType(AngelScriptResolver* p, const char* typeName) {
|
2020-05-02 09:53:12 +00:00
|
|
|
Try(p->RegisterType(typeName);)
|
|
|
|
}
|
2022-04-02 11:03:11 +00:00
|
|
|
export_func uint8_t PkmnLib_AngelScriptResolver_RegisterTypeMethod(AngelScriptResolver* p, const char* typeName,
|
2020-05-02 09:53:12 +00:00
|
|
|
const char* decl, void*(func)(void*)) {
|
|
|
|
Try(p->RegisterTypeMethod(typeName, decl, func);)
|
|
|
|
}
|
2022-04-02 11:03:11 +00:00
|
|
|
export_func uint8_t PkmnLib_AngelScriptResolver_RegisterGlobalMethod(AngelScriptResolver* p, const char* decl,
|
2020-05-02 09:53:12 +00:00
|
|
|
void*(func)(void*)) {
|
|
|
|
Try(p->RegisterGlobalMethod(decl, func);)
|
|
|
|
}
|
2022-04-02 11:03:11 +00:00
|
|
|
export_func void PkmnLib_AngelScriptResolver_DefineWord(AngelScriptResolver* p, const char* word) { p->DefineWord(word); }
|
2021-10-22 13:11:52 +00:00
|
|
|
|
2022-02-05 16:48:47 +00:00
|
|
|
#ifdef ANGELSCRIPT_DEBUGGER
|
2021-10-22 13:11:52 +00:00
|
|
|
export void PkmnLib_AngelScriptResolver_AddDebugger(AngelScriptResolver* p, u16 port) {
|
|
|
|
auto* d = new AngelscriptDebugger();
|
|
|
|
d->Run(port);
|
|
|
|
p->SetDebugger(d);
|
2022-02-05 16:48:47 +00:00
|
|
|
}
|
|
|
|
#endif
|