Update to latest.

This commit is contained in:
Deukhoofd 2021-11-05 13:58:01 +01:00
parent 8369328719
commit d542e75cd1
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
15 changed files with 96 additions and 19 deletions

View File

@ -9,7 +9,7 @@ namespace PkmnLibSharp.Battling
{
public class AngelScriptResolver : ScriptResolver
{
private readonly Dictionary<string, EvolutionScript?> _evolutionScriptCache =
private readonly Dictionary<string, EvolutionScript?> _evolutionScriptCache =
new Dictionary<string, EvolutionScript?>();
public AngelScriptResolver() : base(Pkmnlib.Generated.AngelScriptResolver.Construct())
@ -29,11 +29,12 @@ namespace PkmnLibSharp.Battling
{
Pkmnlib.Generated.AngelScriptResolver.CreateScript(Ptr, name.ToPtr(), script.ToPtr()).Assert();
}
public Script LoadScript(ScriptCategory category, string name)
public Script LoadScript(PointerWrapper owner, ScriptCategory category, string name)
{
var ptr = IntPtr.Zero;
Pkmnlib.Generated.AngelScriptResolver
.LoadScript(ref ptr, Ptr, (Pkmnlib.ScriptCategory) category, name.ToPtr()).Assert();
.LoadScript(ref ptr, Ptr, owner.Ptr, (Pkmnlib.ScriptCategory)category, name.ToPtr()).Assert();
return new AngelscriptScript(ptr);
}
@ -43,6 +44,7 @@ namespace PkmnLibSharp.Battling
{
return s;
}
var ptr = IntPtr.Zero;
Pkmnlib.Generated.AngelScriptResolver.LoadEvolutionScript(ref ptr, Ptr, name.ToPtr()).Assert();
if (ptr == IntPtr.Zero)
@ -50,6 +52,7 @@ namespace PkmnLibSharp.Battling
_evolutionScriptCache.Add(name, null);
return null;
}
s = new EvolutionScript(ptr);
_evolutionScriptCache.Add(name, s);
return s;
@ -59,7 +62,7 @@ namespace PkmnLibSharp.Battling
{
var pinnedArray = GCHandle.Alloc(data, GCHandleType.Pinned);
var pointer = pinnedArray.AddrOfPinnedObject();
Pkmnlib.Generated.AngelScriptResolver.LoadByteCodeFromMemory(Ptr, pointer, (ulong) data.Length).Assert();
Pkmnlib.Generated.AngelScriptResolver.LoadByteCodeFromMemory(Ptr, pointer, (ulong)data.Length).Assert();
pinnedArray.Free();
}

View File

@ -18,6 +18,11 @@ namespace Creaturelib.Generated
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_BattleSide_Destruct")]
internal static extern void Destruct(IntPtr p);
/// <param name="p">BattleSide *</param>
/// <returns>Battle *</returns>
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_BattleSide_GetBattle")]
internal static extern IntPtr GetBattle(IntPtr p);
/// <param name="p">BattleSide *</param>
/// <returns>bool</returns>
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_BattleSide_AllChoicesSet")]
@ -95,5 +100,41 @@ namespace Creaturelib.Generated
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_BattleSide_SwapPositions")]
internal static extern byte SwapPositions(ref byte @out, IntPtr p, byte a, byte b);
/// <param name="p">BattleSide *</param>
/// <param name="key">const char *</param>
/// <returns>BattleScript *</returns>
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_BattleSide_GetVolatileScript")]
internal static extern IntPtr GetVolatileScript(IntPtr p, IntPtr key);
/// <param name="p">BattleSide *</param>
/// <param name="key">const char *</param>
/// <returns>unsigned char</returns>
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_BattleSide_AddVolatileScriptByName")]
internal static extern byte AddVolatileScriptByName(IntPtr p, IntPtr key);
/// <param name="p">BattleSide *</param>
/// <param name="script">BattleScript *</param>
/// <returns>unsigned char</returns>
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_BattleSide_AddVolatileScript")]
internal static extern byte AddVolatileScript(IntPtr p, IntPtr script);
/// <param name="p">BattleSide *</param>
/// <param name="key">const char *</param>
/// <returns>unsigned char</returns>
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_BattleSide_RemoveVolatileScript")]
internal static extern byte RemoveVolatileScript(IntPtr p, IntPtr key);
/// <param name="p">BattleSide *</param>
/// <param name="script">BattleScript *</param>
/// <returns>unsigned char</returns>
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_BattleSide_RemoveVolatileScriptWithScript")]
internal static extern byte RemoveVolatileScriptWithScript(IntPtr p, IntPtr script);
/// <param name="p">BattleSide *</param>
/// <param name="key">const char *</param>
/// <returns>bool</returns>
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_BattleSide_HasVolatileScript")]
internal static extern byte HasVolatileScript(IntPtr p, IntPtr key);
}
}

View File

@ -7,5 +7,6 @@ namespace Creaturelib
internal enum HistoryElementKind : byte
{
AttackUse = 0,
Damage = 1,
}
}

View File

@ -16,5 +16,11 @@ namespace Creaturelib.Generated
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_HistoryHandler_GetLastUsedAttack")]
internal static extern IntPtr GetLastUsedAttack(IntPtr p);
/// <param name="p">const HistoryHolder *</param>
/// <param name="c">const Creature *</param>
/// <returns>const HistoryElement *</returns>
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_HistoryHandler_GetLastDamageOnTarget")]
internal static extern IntPtr GetLastDamageOnTarget(IntPtr p, IntPtr c);
}
}

View File

@ -23,11 +23,12 @@ namespace Creaturelib.Generated
/// <param name="out">BattleScript * &</param>
/// <param name="p">ScriptResolver *</param>
/// <param name="owner">void *</param>
/// <param name="category">ScriptCategory</param>
/// <param name="scriptName">const char *</param>
/// <returns>unsigned char</returns>
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_ScriptResolver_LoadScript")]
internal static extern byte LoadScript(ref IntPtr @out, IntPtr p, ScriptCategory category, IntPtr scriptName);
internal static extern byte LoadScript(ref IntPtr @out, IntPtr p, IntPtr owner, ScriptCategory category, IntPtr scriptName);
/// <param name="out">ItemUseScript * &</param>
/// <param name="p">ScriptResolver *</param>

View File

@ -35,11 +35,12 @@ namespace Pkmnlib.Generated
/// <param name="out">BattleScript * &</param>
/// <param name="p">AngelScriptResolver *</param>
/// <param name="owner">void *</param>
/// <param name="category">ScriptCategory</param>
/// <param name="scriptName">const char *</param>
/// <returns>unsigned char</returns>
[DllImport("libpkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_AngelScriptResolver_LoadScript")]
internal static extern byte LoadScript(ref IntPtr @out, IntPtr p, ScriptCategory category, IntPtr scriptName);
internal static extern byte LoadScript(ref IntPtr @out, IntPtr p, IntPtr owner, ScriptCategory category, IntPtr scriptName);
/// <param name="out">const EvolutionScript * &</param>
/// <param name="p">AngelScriptResolver *</param>
@ -97,5 +98,17 @@ namespace Pkmnlib.Generated
[DllImport("libpkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_AngelScriptResolver_RegisterGlobalMethod")]
internal static extern byte RegisterGlobalMethod(IntPtr p, IntPtr decl, IntPtr func);
/// <param name="p">AngelScriptResolver *</param>
/// <param name="word">const char *</param>
/// <returns>void</returns>
[DllImport("libpkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_AngelScriptResolver_DefineWord")]
internal static extern void DefineWord(IntPtr p, IntPtr word);
/// <param name="p">AngelScriptResolver *</param>
/// <param name="port">unsigned short</param>
/// <returns>void</returns>
[DllImport("libpkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_AngelScriptResolver_AddDebugger")]
internal static extern void AddDebugger(IntPtr p, ushort port);
}
}

View File

@ -122,8 +122,8 @@ namespace Pkmnlib.Generated
/// <param name="index">long unsigned int</param>
/// <param name="out">const EffectParameter * &</param>
/// <returns>unsigned char</returns>
[DllImport("libpkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_EvolutionData_GetData")]
internal static extern byte GetData(IntPtr data, ulong index, ref IntPtr @out);
[DllImport("libpkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_EvolutionData_GetDataAt")]
internal static extern byte GetDataAt(IntPtr data, ulong index, ref IntPtr @out);
}
}

View File

@ -0,0 +1,12 @@
// AUTOMATICALLY GENERATED, DO NOT EDIT
using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib
{
[SuppressMessage("ReSharper", "InconsistentNaming")]
internal enum HistoryElementKind : byte
{
AttackUse = 0,
Damage = 1,
}
}

View File

@ -122,7 +122,7 @@ namespace PkmnLibSharp.Library.Evolution
public EffectParameter GetData(ulong index)
{
var ptr = IntPtr.Zero;
Pkmnlib.Generated.EvolutionData.GetData(Ptr, index, ref ptr).Assert();
Pkmnlib.Generated.EvolutionData.GetDataAt(Ptr, index, ref ptr).Assert();
if (TryResolvePointer(ptr, out EffectParameter? parameter))
return parameter!;
return new EffectParameter(ptr);

BIN
PkmnLibSharp/Native/Linux/libArbutils.so (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

BIN
PkmnLibSharp/Native/Linux/libpkmnLib.so (Stored with Git LFS)

Binary file not shown.

BIN
PkmnLibSharp/Native/Linux/libpkmnlib_ai.so (Stored with Git LFS)

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long