Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Game unable to find a class if the asl is opened before the game, finds after reload #10

Open
mitchell-merry opened this issue Nov 21, 2022 · 0 comments
Assignees
Labels
area: unity bug Issue reports behavior which is not expected.

Comments

@mitchell-merry
Copy link
Contributor

mitchell-merry commented Nov 21, 2022

What helper class does this issue occur on?

Unity

Description

Game is Bendy and the Dark Revival.

When the asl is loaded before the game, it repeatedly is unable to find the GameManager class, never - even if you leave it running for a while, if you go into levels, but if the asl is refreshed at any point then it will find it on it's next attempt.

Reproduction Steps

state("Bendy and the Dark Revival") { }

startup
{
  Assembly.Load(File.ReadAllBytes("Components/asl-help")).CreateInstance("Unity");
}

init
{
  vars.Helper.TryLoad = (Func<dynamic, bool>)(mono =>
  {
    var gm = mono["GameManager"];
    return true;
  });
}
// ...

Error Messages

Connected to game: Bendy and the Dark Revival (using default state descriptor)
Initializing
Init completed, running main methods
Searching for module with names: mono.dll, mono-2.0-bdwgc.dll, GameAssembly.dll...
  => No module found yet.
  => Retrying 2 more times in 1000ms...
  => Found mono-2.0-bdwgc.dll.
Retrieving Unity version...
  => Unity 2021.3.6f1.
  => Doesn't look right? You can set the helper's `UnityVersion` manually in 'startup {}':
     `vars.Helper.UnityVersion = new Version(2017, 2);`
Loading Unity mono.v3 structs...
  => Success.

Executing TryLoad...
Searching for image 'Assembly-CSharp'...
  => Found at 0x1FDB06B73E0.
    => class_cache.size is 11.
    => class_cache.table at 0x1FDB07D55F0.
Executing TryLoad...
Searching for image 'Assembly-CSharp'...
  => Found at 0x1FDB06B73E0.
    => class_cache.size is 11.
    => class_cache.table at 0x1FDB07D55F0.
Searching for class 'GameManager'...
  => Not found!
  => Class 'GameManager' could not be found.
TryLoad not successful.
  => Retrying in 3000ms... 
Exception thrown: 'System.ComponentModel.Win32Exception' in 'update' method:
The handle is invalid

   at ASL line 28 in 'update'

   at LiveSplit.ASL.ASLMethod.Call(LiveSplitState timer, ExpandoObject vars, String& version, Double& refreshRate, Object settings, ExpandoObject old, ExpandoObject current, Process game) 
   at LiveSplit.ASL.ASLScript.RunMethod(ASLMethod method, LiveSplitState state, String& version) 
   at LiveSplit.ASL.ASLScript.DoUpdate(LiveSplitState state) 
   at LiveSplit.UI.Components.ASLComponent.UpdateScript()
  => Found at 0x1FDB06B73E0.
    => class_cache.size is 11.
    => class_cache.table at 0x1FDB07D55F0.
Searching for class 'GameManager'...
  => Not found!
  => Class 'GameManager' could not be found.
TryLoad not successful.
  => Retrying in 3000ms...
  => Found at 0x1FDB06B73E0.
    => class_cache.size is 11.
    => class_cache.table at 0x1FDB07D55F0.
Searching for class 'GameManager'...
  => Not found!
  => Class 'GameManager' could not be found.
TryLoad not successful. 
...

Regression?

No response

Potential Causes and Fixes

A way to catch this error or somehow force a complete refresh of asl-help would be a nice option to have if TryLoad fails.

@mitchell-merry mitchell-merry added bug Issue reports behavior which is not expected. untriaged This issue has not been evaluated yet. labels Nov 21, 2022
@just-ero just-ero added area: unity and removed untriaged This issue has not been evaluated yet. labels Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: unity bug Issue reports behavior which is not expected.
Projects
None yet
Development

No branches or pull requests

2 participants