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

Add in static reference to start of currently loaded core #1680

Closed
Coltaho opened this issue Sep 23, 2019 · 8 comments
Closed

Add in static reference to start of currently loaded core #1680

Coltaho opened this issue Sep 23, 2019 · 8 comments

Comments

@Coltaho
Copy link

Coltaho commented Sep 23, 2019

It would be highly beneficial for Autosplitter creators to have access to a static pointer which could get us to the start of the currently loaded core. Better yet, to the start of that core's emulated memory section. This would simplify things greatly as each core has a different signature/offset in memory to go through in order to find this information.

@YoshiRulz
Copy link
Member

YoshiRulz commented Sep 23, 2019

Is this an XY problem? You shouldn't have to resort to inspecting the host's memory when we expose virtual memory via ApiHawk. Exactly how much of the CLR is available in LiveSplit scripts?

@Coltaho
Copy link
Author

Coltaho commented Sep 23, 2019

I don't know anyone who's done anything aside from signature scanning or some sort of pointer magic when working with Bizhawk autosplitting. LiveSplit has access to almost anything in C# technically (less if you are using a script which is the easiest way for users). Are there any examples of how to use that API? It would be absolutely amazing if things were that simple.

@YoshiRulz
Copy link
Member

YoshiRulz commented Sep 23, 2019

The example tool is compressed here and there's a note "it MUST be called CustomMainForm and implements IExternalToolForm".

edit: Alternatively, run a Lua script which does all the work and updates the splitter script over a socket (under comm).

@Coltaho
Copy link
Author

Coltaho commented Sep 23, 2019

I'll take a look into it, thank you for the info.

It would still make things massively easier with a static reference we could easily hook into via a pointer to the start of the emulated memory. Having less required outside scripts makes it much easier for users to use Livesplit autosplitters.

@vadosnaprimer
Copy link
Contributor

Better examine this one https://github.com/upthorn/Ecco_BizHawkTool

@Coltaho
Copy link
Author

Coltaho commented Sep 23, 2019

So in theory would it be possible to write a simple external tool that provided a static reference to the memory regions that could then be used by the Livesplit scripting? Although requiring all users to download this tool would once again be an added step required and confuse/discourage users.

Example of how we can currently do this transparently to users for GBA games, although the latest WIn10 update broke the signature scanning: https://github.com/Coltaho/Autosplitters/blob/master/MegaManZero2/MMZ2autosplit.asl

Also note another user found these signatures, but they get us to the base pointer for the core. Having a simpler way for every core would greatly alleviate excess code and issues based on updates.

@nattthebear
Copy link
Contributor

The general idea of "give me a pointer", "static reference to", etc, seems completely hopeless in CLR, no? Garbage collection and all of that.

Ask the CLR's debugging features to give you whatever you need, and then you can work with it to make sure you know when references go dead or move through garbage collection.

If this "Autosplitter" scripting environment doesn't provide that sort of capability built in, then it's probably the wrong tool for the job.

@YoshiRulz
Copy link
Member

Closing because, as above, OP can use a Lua script or an ext. tool, either to make an autosplitter or to forward virtual memory to another process. Trying to get anything from BizHawk by reading the host's memory is a non-starter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants