Dolphin, the GameCube and Wii emulator - Forums

Full Version: Possible to listen for game events?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

pondswimma

Hi all,

I'm wondering if it's possible to listen for game events using Dolphin.
For example, when a player loses a stock or gets hit in SSBM I'd like Dolphin to print out a relevant memory value to a file.
Finding the memory locations is pretty straightforward, but getting Dolphin to communicate them to the outside world is proving difficult.

One potential approach I've been looking at is the built-in logger.  In Log Configurations (debug mode) I'm able to specify "Write to File," but I haven't figured out a way to automatically log specific memory values.

Any help would be super appreciated!  Thanks.


________

Operating System: Windows x64
Processor/CPU: Intel i7 @ 2.4 GHz
Video Card/GPU: Nvidia 2x GeForce GT 755M
Memory/RAM: 8 GB
Dolphin: 4.0-5886
You can use MemoryWatcher. Read the descriptions of these PRs for more information:

https://github.com/dolphin-emu/dolphin/pull/3403
https://github.com/dolphin-emu/dolphin/pull/3413

pondswimma

Thanks for pointing me in the right direction.
Unfortunately I haven't been able to get it to work :/ The PRs have Unix specific instructions and I'm on Windows. I'm also not very familiar with C.

The section of the PR I'm most confused about is when he says,
"Now listen to MemoryWatcher/MemoryWatcher like so" [follows by a bunch of C code].
Where is that C code supposed to go? And what does it do? The fact that the C code is "listening" to MemoryWatcher/MemoryWatcher seems to imply that MemoryWatcher/MemoryWatcher is automatically being updated with memory info, and the C code is just reading it. If that's the case, then do I even need the C code (all I need is to have memory info written to a file - I don't need to send that info back into Dolphin)? If I'm misinterpreting this and I do in fact need this code to write data to MemoryWatcher/MemoryWatcher, then how would I do this with a Windows machine?

I parsed the instructions as best I could and did the following:
-Upgraded to newer Dolphin build (4.0-9.281).
-Added a "MemoryWatcher" folder (along with the appropriate "Locations.txt") to the Sys directory
-Added the same MemoryWatcher folder to the main directory (the one Dolphin.exe is in) because I wasn't sure which directory was the correct one.
-Manually created a file named "MemoryWatcher" (no extension) in each of the above folders I created.
-Ran SSBM and played a match.
-Expected MemoryWatcher/MemoryWatcher to be automatically updated with memory values as I played, but nothing happened.

Btw, in my Locations.txt I have the following:
"80453130 60
80453FC0 60"

Which should refer to P1 and P2 percent, according to this doc:
https://docs.google.com/spreadsheets/d/1...dit#gid=12

Sorry I'm so lost.. The ultimate goal with this isn't developer-related, but to create procedural music that responds to game events.
(05-06-2016, 08:37 AM)pondswimma Wrote: [ -> ]Where is that C code supposed to go?

That C code is supposed to be part of a new program that you create and run.

(05-06-2016, 08:37 AM)pondswimma Wrote: [ -> ]And what does it do?  The fact that the C code is "listening" to MemoryWatcher/MemoryWatcher seems to imply that MemoryWatcher/MemoryWatcher is automatically being updated with memory info, and the C code is just reading it.  If that's the case, then do I even need the C code (all I need is to have memory info written to a file - I don't need to send that info back into Dolphin)?

It's not a regular file, it's a Unix socket (at least as far as I know). You can't read it the way you normally read a file, so yes, you need something along the lines of that C code.

(05-06-2016, 08:37 AM)pondswimma Wrote: [ -> ]If I'm misinterpreting this and I do in fact need this code to write data to MemoryWatcher/MemoryWatcher, then how would I do this with a Windows machine?

Hmm, I'm not actually sure if it works on Windows right now... You might be out of luck.
According to the code, it's an Unix domain socket, so you *need* Unix. It won't work with Windows.