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

MemoryCallbackSystem ActiveChanged only invoked on first Add #1159

gifvex opened this issue Mar 26, 2018 · 0 comments


None yet
2 participants
Copy link

commented Mar 26, 2018

See: MemoryCallbackSystem.cs

This is an issue for cores that rely on the event handler to pass callbacks in:

_memorycallbacks.ActiveChanged += RefreshMemoryCallbacks;
private void RefreshMemoryCallbacks()
var mcs = MemoryCallbacks;
LibGambatte.gambatte_setreadcallback(GambatteState, mcs.HasReads ? _readcb : null);
LibGambatte.gambatte_setwritecallback(GambatteState, mcs.HasWrites ? _writecb : null);
LibGambatte.gambatte_setexeccallback(GambatteState, mcs.HasExecutes ? _execcb : null);

For example, if onmemoryexecute is called from lua, it will run RefreshMemoryCallbacks with only HasExecutes as true. Any calls to onmemorywrite or onmemoryread will still register the functions on the lua end, but the function pointer for those collections will never be passed to the core.

@gifvex gifvex changed the title lua: MemoryCallbackSystem ActiveChanged only invoked on first Add MemoryCallbackSystem ActiveChanged only invoked on first Add Mar 26, 2018

alyosha-tas added a commit that referenced this issue May 12, 2018

@YoshiRulz YoshiRulz added the Topic-Lua label Feb 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.