-
Notifications
You must be signed in to change notification settings - Fork 773
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
Setup: automatically generate Setup Data for SNIClient games #1262
Conversation
# Conflicts: # worlds/alttp/Client.py
# did not find a good source to automatically pull these | ||
default_rom_file_names: typing.Dict[str, str] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we ever get "AutoWorldSettings", this could pull from there. Until then Utils.get_default_options()
, however we still need a dict "A Link to the Past" -> "lttp_options" here (which is cleaner than putting the rom name here imo)
} | ||
|
||
snes_md5s: typing.Dict[str, str] = { | ||
"A Link to the Past": "03a63945398191337e896e5771f77173", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't the hash available through AutoPatch? if not, this should be made available through that, instead of listing the hashes here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{game: patch_type.hash for game, patch_type in AutoPatchRegister.patch_types.items() if game in default_rom_file_names}
with open("generator_components.iss", "w") as f_gen: | ||
with open("sni_components.iss", "w") as f_sni: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code below looks like jinja may be the better choice?
} | ||
|
||
snes_md5s: typing.Dict[str, str] = { | ||
"A Link to the Past": "03a63945398191337e896e5771f77173", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{game: patch_type.hash for game, patch_type in AutoPatchRegister.patch_types.items() if game in default_rom_file_names}
patch_types: ClassVar[Dict[str, AutoPatchRegister]] = {} | ||
file_endings: ClassVar[Dict[str, AutoPatchRegister]] = {} | ||
patch_types: ClassVar[Dict[str, APDeltaPatch]] = {} | ||
file_endings: ClassVar[Dict[str, APDeltaPatch]] = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous annotations were correct. the patch types are instances of the type AutoPatchRegister
, not APDeltaPatch
.
An acceptable annotation in practice might be Type[APDeltaPatch]
.
(Although the IDE will still complain when inserting new_class
into these dicts, since it doesn't know that the only instances of AutoPatchRegister
that are created in practice are APDeltaPatch
and its subclasses.)
with open("sni_components.iss", "w") as f_sni: | ||
|
||
for game_name in AutoSNIClientRegister.game_handlers: | ||
patch_handler: APDeltaPatch = AutoPatchRegister.patch_types[game_name] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
patch_handler
is not of type APDeltaPatch
; see comment in "Files.py".
/generator_components.iss | ||
/files.iss | ||
/sni_components.iss | ||
/code.iss |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe these generated files could all be placed in a single subdirectory? (Maybe even the already used buildfolder?)
(Provided Inno Setup supports including from subfolders.)
with open("generator_components.iss", "w") as f_gen: | ||
with open("sni_components.iss", "w") as f_sni: | ||
|
||
for game_name in AutoSNIClientRegister.game_handlers: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looping over it like this means that a ROM setup option will be created for SMZ3 (which did not exist before, and does nothing useful now), but it does not create one for SoE (which would be required in order to pick a SoE ROM.).
from worlds.AutoSNIClient import AutoSNIClientRegister | ||
from worlds.Files import AutoPatchRegister, APDeltaPatch | ||
with open("generator_components.iss", "w") as f_gen: | ||
with open("sni_components.iss", "w") as f_sni: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really important, but there is no need for the extra nesting level; multiple contexts can be entered in a single with
statement.
Name: "client/sni/dkc3"; Description: "SNI Client - Donkey Kong Country 3 Patch Setup"; Types: full playing; Flags: disablenouninstallwarning | ||
Name: "client/sni/smw"; Description: "SNI Client - Super Mario World Patch Setup"; Types: full playing; Flags: disablenouninstallwarning | ||
Name: "client/sni/l2ac"; Description: "SNI Client - Lufia II Ancient Cave Patch Setup"; Types: full playing; Flags: disablenouninstallwarning | ||
#include "sni_components.iss" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would "sni_client_components" be a better name?
do we still need this? |
Some parts of this would be superseded by #2268, so this would be up for a major rework if that PR were merged. |
What is this fixing or adding?
automatically generates Registry bindings for SNIClient games
Moves Romfile name and checksum to a single place in setup.py, rather than multiple in iss
Prevents pressing Next on SNI games if the currently selected ROM does not exist or does not pass checksum tests, preventing users from ignoring warnings and installing AP in a broken state. Also brings up an explanation message.
Less duplicated code, however the singular code is now a twisted mess of Python string interpolation and pascal, rather than copy-pasted pascal.
Note: ExtraDiskSpaceRequired flag is removed, however I'm fairly sure most of it was false anyway and simply copy-pasted without anyone actually calculating it properly.
How was this tested?
A few times as part of dev. My Registry seems to still be intact, so that's a good sign.
If this makes graphical changes, please attach screenshots.