Skip to content

BizhawkTCPConnector ​

Implements several IConsoleConnector types with the Crowd Control BizHawk external tool plugin (CrowdControl.Bizhawk.dll), replacing the legacy Lua connector script.

Kind: Class

Namespace: ConnectorLib

Inheritance: ConsoleBase → I16BitConnector → I32BitConnector → I64BitConnector → I8BitConnector → IAddressableConnector → IConsoleConnector → IDisposable → IDomainMappableConnector → IDomainMappableConnector\<BizhawkTCPConnector\> → IFreezableConnector → IGBAConnector → IGBConnector → IGameConnector → IGameGearConnector → IGenesisConnector → IN64Connector → INESConnector → INESProConnector → IPS1Connector → IROMProcessor → ISNESConnector

Public Constructors

BizhawkTCPConnector()

BizhawkTCPConnector(Action messageHandler)

Public Member Functions

virtual override

Task>

Connect()

virtual override

Task

Disconnect(string message)

virtual override

bool

Read(ulong address, Span buffer, int offset, int length)

virtual override

bool

Read(ulong address, string domain, Span buffer, int offset, int length)

virtual override

bool

Write(ulong address, ReadOnlySpan buffer, int offset, int length)

virtual override

bool

Write(ulong address, string domain, ReadOnlySpan buffer, int offset, int length)

bool

Read8(ulong address, byte out value)

bool

Read16(ulong address, ushort out value)

bool

Read32(ulong address, uint out value)

bool

Read64(ulong address, ulong out value)

bool

Write8(ulong address, byte value)

bool

Write16(ulong address, ushort value)

bool

Write32(ulong address, uint value)

bool

Write64(ulong address, ulong value)

bool

SetBits(ulong address, byte value, byte out oldValue)

virtual override

bool

SetBits(ulong address, string domain, byte value, byte out oldValue)

bool

UnsetBits(ulong address, byte value, byte out oldValue)

virtual override

bool

UnsetBits(ulong address, string domain, byte value, byte out oldValue)

bool

CompareSwap(ulong chkAddress, byte test, byte newVal, byte out orig)

virtual override

bool

Freeze(ulong address, string domain, ulong value, byte size, WriteType writeType, ulong cmpAddress, ulong cmpValue, byte cmpSize, CompareType condition)

virtual override

bool

Freeze(ulong address, string domain, ulong value, ulong mask, byte size, WriteType writeType, ulong cmpAddress, ulong cmpValue, byte cmpSize, CompareType condition)

virtual override

bool

Freeze(ulong address, ulong value, byte size, WriteType writeType, ulong cmpAddress, ulong cmpValue, byte cmpSize, CompareType cmpType)

virtual override

bool

Freeze(ulong address, ulong value, ulong mask, byte size, WriteType writeType, ulong cmpAddress, ulong cmpValue, byte cmpSize, CompareType condition)

bool

FreezeU8(ulong address, byte value)

bool

FreezeU16(ulong address, ushort value)

bool

FreezeU32(ulong address, uint value)

bool

FreezeU64(ulong address, ulong value)

virtual override

bool

Unfreeze(ulong address, string domain)

virtual override

bool

Unfreeze(ulong address)

bool

UnfreezeAll()

Removes all freezes registered in the plugin.

virtual override

bool

SendMessage(string message)

bool

SendMessage(string[] lines)

bool

StartTimedMessage(string[] lines, TimeSpan duration, int out id)

bool

PauseTimedMessage(int id)

bool

ResumeTimedMessage(int id)

bool

ResumeTimedMessage(int id, TimeSpan elapsed)

bool

ChangeMessagePadding(int id, int padding)

bool

ChangeAllPadding(int padding)

virtual override

void

KeepAlive()

Sends a keepalive while connected; otherwise attempts to reconnect (e.g. after the plugin window was closed and reopened in EmuHawk).

virtual override

string

GetROMPath()

string

GetROMHash()

virtual override

bool

OpenROM(string localPath)

virtual override

bool

CloseROM()

virtual override

bool

PatchROM(IROMPatch patch)

virtual override

bool

PatchROM(byte[] data)

virtual override

bool

ResetConsole()

bool

StateCycle(string out key, bool keep = true)

bool

StateSave(string out key)

bool

StateLoad(string key)

bool

StateDelete(string key)

bool

SetEmulatorSpeed(int percent)

bool

PushState()

Pushes the current state onto the plugin-side state stack.

bool

PopState()

Pops and loads the top of the plugin-side state stack.

bool

ForceShuffle()

Forces the BizHawk Shuffler to swap games. Requires the Crowd Control shuffler plugin (crowdcontrol.lua) to be enabled in the shuffler session; without it (or with no shuffler running) this is a harmless no-op.

bool

SetUserData(string key, double value)

Stores a number in BizHawk's userdata bag (readable by Lua scripts via userdata.get).

bool

SetUserData(string key, string text)

Stores a number in BizHawk's userdata bag (readable by Lua scripts via userdata.get).

string

GetUserData(string key)

Reads a value from BizHawk's userdata bag as a string. Returns null if the key is absent or the request failed/timed out.

bool

Pause()

Pauses emulation.

bool

Unpause()

Unpauses emulation.

int

AddMemoryCallback(CommandType type, ulong address, byte size = 1, string domain = null, ulong cmpValue = 0)

Registers a plugin-side memory watch. The plugin checks the address every frame and pushes a ConnectorLib.BizhawkTCPConnector.MemoryCallbackTriggered event when it triggers, removing the need to poll game state over the connection.

bool

RemoveMemoryCallback(int callbackId)

Removes a plugin-side memory watch created by ConnectorLib.BizhawkTCPConnector.AddMemoryCallback(ConnectorLib.CommandType,System.UInt64,System.Byte,System.String,System.UInt64).

bool

BatchWrite(ValueTuple[] writes)

Applies multiple writes atomically within a single emulated frame.

bool

StartComplex(ComplexEffect effect)

Starts a complex effect with a known duration so the plugin can display a countdown.

bool

StopComplex(ComplexEffect effect)

bool

StartComplex(ComplexEffect effect, double durationSeconds)

Starts a complex effect with a known duration so the plugin can display a countdown.

bool

StartComplex(string effectName, double durationSeconds = 0)

Starts a complex effect with a known duration so the plugin can display a countdown.

bool

StopComplex(string effectName)

DomainMappedConnector

WithDomain(string domain)

Public Attributes

string

DEFAULT_HOST

The default host on which the BizHawk plugin listens.

int

DEFAULT_PORT

The default port (0xCC02) of the BizHawk plugin TCP service.

int

MIN_PLUGIN_MAJOR_VERSION

The minimum plugin major version this connector supports.

Properties

static

string

Host

[get, set]

The host to connect to. Change before connecting if BizHawk is configured differently.

static

int

Port

[get, set]

The port to connect to. Change before connecting if BizHawk is configured differently.

static

int

CommandResponseTimeoutMS

[get, set]

Allows globally configuring the default timeout before responses from the plugin will be considered lost/never arriving. Defaults to 1000ms.

Endianness

Endianness

[get, ]

PointerFormat

PointerFormat

[get, ]

IFeatureAware

Features

[get, ]

PointerFormat

RelativePointerFormat

[get, ]

IMemoryMapper

Mapper

[, set]

bool

Connected

[get, ]

string

CurrentSystem

[get, ]

The system id of the currently-loaded game, or null if unknown.

string

CurrentGameName

[get, ]

The name of the currently-loaded game, or null if unknown.

string

CurrentGameHash

[get, ]

The hash of the currently-loaded game, or null if unknown.

Events

Action<string, string, string>

GameChanged

Fired whenever the game loaded in BizHawk changes (including via the BizHawk Shuffler or a manual ROM swap). Arguments are (system, romName, romHash). The hash is the stable identifier - use it to pause/restore per-game effect state when a game is swapped away and back.

Action<int, ulong, ulong>

MemoryCallbackTriggered

Fired when a plugin-side memory watch triggers. Arguments are (callbackId, newValue, oldValue). Values are byte-swapped for big-endian systems like normal reads.

Action<string>

ComplexEffectDone

Raised when the plugin reports that a one-shot complex effect (slide puzzle, Rubik's cube, melt, ...) finished on its own. The argument is the ConnectorLib.BizhawkTCPConnector.ComplexEffect name that was originally started.

Action

AllEffectsCleared

Raised when the user manually clears all effects in the plugin UI ("Clear stuck effects").