Communicate with the Bizhawk emulator via a Lua socket
Project description
Bizhawk Hook
Interact with Bizhawk via a socket server hosted in the Lua Console.
How to use
Bizhawk Lua
Exporting
Export all the necessary Lua components using the provided function.
from bizhook import export_lua_components
export_lua_components('/home/williamson/.bizhook')
You can either provide a path or leave it empty to have it open up a file dialogue asking for directory.
The dialogue window may not work on all systems. If an error occurs, you'll simply have to provide the path as an argument.
Opening socket
In Bizhawk, go to Tools
> Lua Console
. Select Open script
and open hook.lua
from the exported components.
Is it working?
If it starts successfully, you should see a text in the top-left of the emulator saying the socket is being opened. Should that not appear, try restarting the emulator until it does. This seems to be an issue with Bizhawk.
Note: Do not try to communicate with the socket before the text has disappeared, as it isn't actually opened yet. The message is there to make it clear that the script is running successfully.
Python
You can read from and write to memory by using a Memory
object.
from bizhook import Memory
combined_wram = Memory('Combined WRAM')
To see the available methods, do help(Memory)
.
Memory domain
You can use the default memory domain by providing an empty string. However, I would advice against it and that you always do specify with which domain you want to interact. It may be that it works for you solely because, per chance, the default one happens to be the correct one.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file bizhook-1.2.1.tar.gz
.
File metadata
- Download URL: bizhook-1.2.1.tar.gz
- Upload date:
- Size: 174.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.10.5 Linux/5.10.126-1-MANJARO
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65ed78f1a8dbcbfeafa7a6a89a51e164f7ef5719653a80589041c379828b7aae |
|
MD5 | ab7a299518e81079691ac4fd6e0c8db9 |
|
BLAKE2b-256 | c8418252680a095844ddae3c141f74854f0a30893cffa7930e6d0f12550fba37 |
File details
Details for the file bizhook-1.2.1-py3-none-any.whl
.
File metadata
- Download URL: bizhook-1.2.1-py3-none-any.whl
- Upload date:
- Size: 172.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.10.5 Linux/5.10.126-1-MANJARO
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fe3fed24d3e5b3fa51b12393f6559b9d8fd10df0370979c88b8b5106cb543fc |
|
MD5 | 826491cc67617027a3f855ba87e55c6a |
|
BLAKE2b-256 | c7538e65154a5c6b8172287251fee64bdad9ff4ae76094253aa677f0166ca2e2 |