Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Basis/Packages/com.basis.shim/Shims/CilboxPropBasis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public class CilboxPropBasis : Cilbox

// Unity types
"UnityEngine.Animator",
"UnityEngine.AnimatorStateInfo",
"UnityEngine.AudioClip",
"UnityEngine.AudioSource",
"UnityEngine.Color",
Expand Down
31 changes: 24 additions & 7 deletions Basis/Packages/com.cnlohr.cilbox/Cilbox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,20 @@ public object Interpret( CilboxProxy ths, object [] parametersIn )
try
{
ret = InterpretInner( stackBuffer, parameters ).AsObject();
} catch( Exception e )
}
catch( Exception e )
{
parentClass.box.InterpreterExit();

if (e is CilboxUnhandledInterpretedException uhe)
{
// strip the throwee just in case, and re-throw a normal runtime exception
string exceptionTypeName = uhe.Throwee?.GetType().FullName ?? "null";
string reason = $"Exception of type {exceptionTypeName} was unhandled in interpreted code";
parentClass.box.DisableWithReason(reason); // CilboxUnhandledInterpretedException bypasses the box disable
throw new CilboxInterpreterRuntimeException(reason, uhe.ClassName, uhe.MethodName, uhe.PC);
}

Debug.Log( e.ToString() );
throw;
}
Expand Down Expand Up @@ -1541,10 +1552,7 @@ private StackElement InterpretInner( ArraySegment<StackElement> stackBufferIn, A
catch( Exception e )
{
string fullError = $"Breakwarn: {e.ToString()} Class: {parentClass.className}, Function: {methodName}, Bytecode: {pc}";
Debug.LogError( fullError );
box.disabledReason = fullError;
box.disabled = true;
//box.InterpreterExit();
box.DisableWithReason(fullError);

if (e is CilboxInterpreterRuntimeException)
{
Expand Down Expand Up @@ -2328,6 +2336,14 @@ void Update()
{
usSpentLastFrame = Interlocked.Exchange( ref interpreterAccountingCumulitiveTicks, 0 ) / interpreterTicksInUs;
}

internal void DisableWithReason(string reason)
{
Debug.LogError( reason );
this.disabledReason = reason;
this.disabled = true;
//this.InterpreterExit();
}
}


Expand Down Expand Up @@ -3025,10 +3041,11 @@ public enum ImportFunctionID
Update,
Start,
Awake,
OnTriggerEnter,
OnTriggerExit,
OnEnable,
OnDisable,
OnDestroy,
OnTriggerEnter,
OnTriggerExit,
OnCollisionEnter,
OnCollisionExit
}
Expand Down
5 changes: 3 additions & 2 deletions Basis/Packages/com.cnlohr.cilbox/CilboxProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -472,10 +472,11 @@ void Start() {
box.InterpretIID( cls, this, ImportFunctionID.Awake, null );
box.InterpretIID( cls, this, ImportFunctionID.Start, null );
}
void FixedUpdate() { if( proxyWasSetup ) box.InterpretIID( cls, this, ImportFunctionID.FixedUpdate, null ); }
void Update() { if( proxyWasSetup ) box.InterpretIID( cls, this, ImportFunctionID.Update, null ); }
void OnEnable() { if( proxyWasSetup ) box.InterpretIID( cls, this, ImportFunctionID.OnEnable, null ); }
void OnDisable() { if( proxyWasSetup ) box.InterpretIID( cls, this, ImportFunctionID.OnDisable, null ); }
void Update() { if( proxyWasSetup ) box.InterpretIID( cls, this, ImportFunctionID.Update, null ); }
void FixedUpdate() { if( proxyWasSetup ) box.InterpretIID( cls, this, ImportFunctionID.FixedUpdate, null ); }
void OnDestroy() { if( proxyWasSetup ) box.InterpretIID( cls, this, ImportFunctionID.OnDestroy, null ); }
void OnTriggerEnter(Collider c) { if (proxyWasSetup) box.InterpretIID(cls, this, ImportFunctionID.OnTriggerEnter, new object[] { c }); }
void OnTriggerExit(Collider c) { if (proxyWasSetup) box.InterpretIID(cls, this, ImportFunctionID.OnTriggerExit, new object[] { c }); }
void OnCollisionEnter(Collision c) { if (proxyWasSetup) box.InterpretIID(cls, this, ImportFunctionID.OnCollisionEnter, new object[] { c }); }
Expand Down
Loading