wasmboy icon indicating copy to clipboard operation
wasmboy copied to clipboard

More debugging / hacking functionality

Open eliasreid opened this issue 3 years ago • 4 comments

I experimenting with some in-RAM / register game hacking (ex. In Pokemon, change the move a trainer will use before they use it, etc). Emulators like BGB (https://bgb.bircd.org/) and Bizhawk (https://github.com/TASVideos/BizHawk) are helpful because they allow for things like breaking on address execution, or adding Lua scripts that are executed on certain conditions.

I think it would be really cool (at least for a project I have in mind) to add API to the wasmboy lib, to allow for executing callbacks on certain conditions, and modifying the internal state (registers, memory, etc). Right now from what I can tell (I'm a JavaScript / Web noob), the lib only allows for a single read and write breakpoint. I think it would be possible to extend the current "plugins" functionality to achieve some of these things?

I'm curious if this is way out of scope for the goals of this project, and if you have a sense of how hard this would be. I would be interested in attempting to contribute some of these features.

eliasreid avatar Apr 11 '21 16:04 eliasreid

Sorry, I just realized after looking at the code a bit more that there is already functionality for a program counter breakpoint, awesome!

I guess to re-phrase my issue as simpler question. Is there currently a way for a library consumer to write to the gameboy's memory and registers?

eliasreid avatar Apr 11 '21 18:04 eliasreid

Hello! Sorry for the super late reply! I was out last week for vacation, and then been catching up on open source things :smile:

I experimenting with some in-RAM / register game hacking (ex. In Pokemon, change the move a trainer will use before they use it, etc). Emulators like BGB (https://bgb.bircd.org/) and Bizhawk (https://github.com/TASVideos/BizHawk) are helpful because they allow for things like breaking on address execution, or adding Lua scripts that are executed on certain conditions.

Ah yes! I haven't worked on WasmBoy for a while due to lack of time. But I noticed a lot of emulators were implementing that feature! I think it's super rad! :smile:

I think it would be really cool (at least for a project I have in mind) to add API to the wasmboy lib, to allow for executing callbacks on certain conditions, and modifying the internal state (registers, memory, etc). Right now from what I can tell (I'm a JavaScript / Web noob), the lib only allows for a single read and write breakpoint. I think it would be possible to extend the current "plugins" functionality to achieve some of these things?

Oh yeah! Totally, the API is a bit wacky, but I think there is a way to set breakpoints, because I know I am doing it for the debugger, using the WasmBoy API.

I'm curious if this is way out of scope for the goals of this project, and if you have a sense of how hard this would be. I would be interested in attempting to contribute some of these features.

Totally not out of scope! Would be happy to review and merge some PRs! :smile:

Sorry, I just realized after looking at the code a bit more that there is already functionality for a program counter breakpoint, awesome! I guess to re-phrase my issue as simpler question. Is there currently a way for a library consumer to write to the gameboy's memory and registers?

No worries! :smile: I think there should be! All the memory for the ROM and things, should be in Wasm Memory. So as long as your 3P script, or modifying script writes to the Wasm memory should be good to go! :smile:

torch2424 avatar Apr 21 '21 19:04 torch2424

Thank you for the reply! I started trying to figure out some of this stuff, but as a non-web developer it was a bit overwhelming to follow everything (between WASM, web workers, JS in general..), and I found that BizHawk has a plugin system that pretty much exactly matches what I need.

eliasreid avatar May 01 '21 17:05 eliasreid

@eliasreid Ah yeah! This project definitely isn't a completed, end-user ready library. Definitely, I'd reccomend using something like BizHawk if you aren't too familiar with a Modern JS web Development stack (and possibly even some of the rough edges with Wasm :smile: )

Cool! Glad you found something that works for you! :smile: :+1: Again, thank you for reaching out! :smile:

torch2424 avatar May 04 '21 00:05 torch2424