Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FF1: Bizhawk Client and APWorld Support #4448

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

Rosalie-A
Copy link
Contributor

Please format your title with what portion of the project this pull request is
targeting and what it's changing.

ex. "MyGame4: implement new game" or "Docs: add new guide for customizing MyGame3"

What is this fixing or adding?

Converts FF1 to using the Bizhawk Client instead of its bespoke client and connector, with updated documentation.

Also makes the few changes needed to allow it to be an APWorld instead of a folder in lib/worlds, mostly for my convenience.

How was this tested?

Ran through an entire game, checked every location to make sure it sent. Received items, both naturally and through admin console, and confirmed they arrived properly. Also put this up for testing in the Discord, and no issues have been reported as of the latest version (whether this means no testers or no issues is, as always, up in the air).

If this makes graphical changes, please attach screenshots.

@github-actions github-actions bot added affects: core Issues/PRs that touch core and may need additional validation. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels Jan 8, 2025
Copy link
Collaborator

@qwint qwint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pure code review, did not run the client at all nor play any games, also only briefly reviewed docs changes and full Client.py code

You will also need to update inno_setup.iss to remove the old frozen executable (and likely the old folder since you're moving to .apworld format too) but other than and my pkgutil comments looks good

FF1_PROGRESSION_LIST else ItemClassification.useful if name in FF1_USEFUL_LIST else
ItemClassification.filler) for name, code in items.items()]
self._item_table_lookup = {item.name: item for item in self._item_table}
file = pkgutil.get_data(__name__, os.path.join("data", "items.json")).decode("utf-8")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
file = pkgutil.get_data(__name__, os.path.join("data", "items.json")).decode("utf-8")
file = pkgutil.get_data(__name__, "data/items.json").decode("utf-8")

ref #4232
for this and the other similar suggestion (also there's no need for the os import after this change)

# Hardcode progression and categories for now
self._location_table = [LocationData(name, code) for name, code in locations.items()]
self._location_table_lookup = {item.name: item for item in self._location_table}
file = pkgutil.get_data(__name__, os.path.join("data", "locations.json"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
file = pkgutil.get_data(__name__, os.path.join("data", "locations.json"))
file = pkgutil.get_data(__name__, "data/locations.json")

…changed the logger in the client to actually do something.
Copy link
Collaborator

@qwint qwint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not certain there aren't more required inno_setup changes, but the updates fixed every issue that existed to my knowledge


async def read_ram_value(self, ctx, location):
value = ((await bizhawk.read(ctx.bizhawk_ctx, [(location, 1, self.wram)]))[0])
return int.from_bytes(value)

This comment was marked as resolved.

Comment on lines 109 to 112
if self.consumable_stack_amounts is None:
self.consumable_stack_amounts = {}
self.consumable_stack_amounts["Shard"] = 1
self.consumable_stack_amounts["Tent"] = (await self.read_rom(ctx, 0x47400, 1))[0] + 1

This comment was marked as resolved.

self.consumable_stack_amounts["Ext1"] = (await self.read_rom(ctx, 0x47406, 1))[0] + 1
self.consumable_stack_amounts["Ext2"] = (await self.read_rom(ctx, 0x47407, 1))[0] + 1
self.consumable_stack_amounts["Ext3"] = (await self.read_rom(ctx, 0x47408, 1))[0] + 1
self.consumable_stack_amounts["Ext4"] = (await self.read_rom(ctx, 0x47409, 1))[0] + 1

This comment was marked as resolved.

- Your legally obtained Final Fantasy (USA Edition) ROM file, probably named `Final Fantasy (USA).nes`. Neither
Archipelago.gg nor the Final Fantasy Randomizer Community can supply you with this.

## Installation Procedures

1. Download and install the latest version of Archipelago.
1. On Windows, download Setup.Archipelago.<HighestVersion\>.exe and run it
2. Assign EmuHawk version 2.3.1 or higher as your default program for launching `.nes` files.
2. Assign EmuHawk or higher as your default program for launching `.nes` files.

This comment was marked as resolved.

@ScipioWright ScipioWright added the is: enhancement Issues requesting new features or pull requests implementing new features. label Jan 10, 2025
@beauxq
Copy link
Collaborator

beauxq commented Jan 11, 2025

Rosalie-A#72

Fixed a bug with extended consumables being switched.
@Zunawe
Copy link
Collaborator

Zunawe commented Feb 8, 2025

You'll want to add the old client and script to the inno_setup script so they get get deleted by the installer.

@Rosalie-A
Copy link
Contributor Author

Rosalie-A commented Feb 8, 2025

You'll want to add the old client and script to the inno_setup script so they get get deleted by the installer.

Unless I'm crazy, I already caught the old client, but I did completely miss removing the old Lua script, thank you. Latest commit fixes that.

Copy link
Contributor

@wildham0 wildham0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while i can't speak for the specifics of ap, the legacy lua behiavours have been correctly transferred to the client and the appropriate memory addresses and values are queried

Copy link
Collaborator

@Zunawe Zunawe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly just a quick scroll through. I think the client looks fine from the standpoint of interacting with BizHawk. Comments are basically just suggestions.

status_b = await self.read_sram_value(ctx, status_b_location)
status_c = await self.read_sram_value(ctx, status_c_location)

# First character's name's first character will never have FF
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no problem here, I just have to comment on the silliness of this sentence.

Also implemented item received messages in Bizhawk.
Fixed a bug with the guard against writing on title screen.

Removed redundant read.
Copy link
Collaborator

@Zunawe Zunawe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks fine as far as correctly utilizing BizHawk Client. Didn't test, and couldn't say myself whether it correctly replaces all the necessary behaviors.

@qwint qwint added waiting-on: core-review Issue/PR has been peer-reviewed and is ready to be merged or needs input from a core maintainer. and removed waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels Feb 9, 2025
Comment on lines 209 to 211
current_gold = int.from_bytes(await self.read_sram_values_guarded(ctx, gp_location_low, 3), "little")
if current_gold is None:
return
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

current_gold is not something that needs to be checked for None - It will never be None

What needs to be checked it the result of await self.read_sram_values_guarded(ctx, gp_location_low, 3)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects: core Issues/PRs that touch core and may need additional validation. is: enhancement Issues requesting new features or pull requests implementing new features. waiting-on: core-review Issue/PR has been peer-reviewed and is ready to be merged or needs input from a core maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants