Psuedocoding client stuff that includes the ram address & hex for the rom's name.

This commit is contained in:
MarioSpore
2025-08-04 23:03:31 -04:00
parent 3541e13f21
commit 397693c8a8
3 changed files with 77 additions and 22 deletions

View File

@@ -0,0 +1,51 @@
from typing import TYPE_CHECKING
from NetUtils import ClientStatus
import worlds._bizhawk as bizhawk
from worlds._bizhawk.client import BizHawkClient
from worlds.Files import APDeltaPatch
if TYPE_CHECKING:
from worlds._bizhawk.context import BizHawkClientContext
class GrinchClient(BizHawkClient):
game = "The Grinch"
system = "PSX"
patch_suffix = ".apgrinch"
async def validate_rom(self, ctx: "BizHawkClientContext") -> bool:
grinch_identifier_ram_address: int = 0x00928C
bytes_expected: bytes = bytes.fromhex("53554C533131305F3B37392E")
try:
bytes_actual: bytes = (await bizhawk.read(ctx.bizhawk_ctx, [(
grinch_identifier_ram_address, len(bytes_expected), "MainRAM"
)]))[0]
except Exception():
return True
async def game_watcher(self, ctx: "BizHawkClientContext") -> None:
try:
# Read save data
save_data = await bizhawk.read(
ctx.bizhawk_ctx,
[(0x3000100, 20, "System Bus")]
)[0]
# Check locations
if save_data[2] & 0x04:
await ctx.send_msgs([{
"cmd": "LocationChecks",
"locations": [23]
}])
# Send game clear
if not ctx.finished_game and (save_data[5] & 0x01):
await ctx.send_msgs([{
"cmd": "StatusUpdate",
"status": ClientStatus.CLIENT_GOAL
}])
except bizhawk.RequestFailedError:
# The connector didn't respond. Exit handler and return to main loop to reconnect
pass

View File

@@ -28,31 +28,31 @@ class Missionsanity(Choice):
option_both = 3 option_both = 3
default = 1 default = 1
# class StartingArea(Choice): class StartingArea(Choice):
# """ """
# Here, you can select which area you'll start the game with. Here, you can select which area you'll start the game with.
# Whichever one you pick is the region you'll have access to at the start of the Multiworld. Whichever one you pick is the region you'll have access to at the start of the Multiworld.
# """ """
# option_whoville = 0 option_whoville = 0
# option_who_forest = 1 option_who_forest = 1
# option_who_dump = 2 option_who_dump = 2
# option_who_lake = 3 option_who_lake = 3
# default = 0 default = 0
# display_name = "Starting Area" display_name = "Starting Area"
# class Supadow(Toggle): class Supadow(Toggle):
# """Enables completing minigames through the Supadows in Mount Crumpit as checks. (9 locations) [NOT IMPLEMENTED]""" """Enables completing minigames through the Supadows in Mount Crumpit as checks. (9 locations) [NOT IMPLEMENTED]"""
# display_name = "Supadow Minigame Locations"# display_name = "Supadow Minigame Locations"#
# class Gifts(Toggle): class Gifts(Toggle):
# """Missions that require you to squash every present in a level. (4 locations) [NOT IMPLEMENTED]""" """Missions that require you to squash every present in a level. (4 locations) [NOT IMPLEMENTED]"""
# display_name = "Gift Collection Locations" display_name = "Gift Collection Locations"
# class Movesanity(Toggle): class Movesanity(Toggle):
# """Randomizes Grinch's moveset along with randomizing max into the pool. [NOT IMPLEMENTED]""" """Randomizes Grinch's moveset along with randomizing max into the pool. [NOT IMPLEMENTED]"""
# display_name = "Movesanity" display_name = "Movesanity"
class UnlimitedRottenEggs(Toggle): class UnlimitedRottenEggs(Toggle):
@@ -72,3 +72,7 @@ class GrinchOptions(PerGameCommonOptions):#DeathLinkMixin
unlimited_rotten_eggs: UnlimitedRottenEggs unlimited_rotten_eggs: UnlimitedRottenEggs
ring_link: RingLinkOption ring_link: RingLinkOption
trap_link: TrapLinkOption trap_link: TrapLinkOption
minigamesanity: Supadow
giftsanity: Gifts
movesanity: Movesanity
starting_area: StartingArea

View File

@@ -63,10 +63,10 @@ rules_dict: dict[str,list[list[str]]] = {
"Enter the Mayor's Villa": [ "Enter the Mayor's Villa": [
[] []
], ],
"Smashing Snowmen": [ "Shuffling The Mail": [
[] []
], ],
"Shuffling The Mail": [ "Smashing Snowmen": [
[] []
], ],
"Painting The Mayor's Posters": [ "Painting The Mayor's Posters": [