Skip to content

Commit

Permalink
8.0 Hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuphat committed Nov 16, 2023
2 parents 0afb82d + 63749c7 commit 8d3b2ef
Show file tree
Hide file tree
Showing 12 changed files with 3,188 additions and 3,186 deletions.
902 changes: 451 additions & 451 deletions ASM/build/asm_symbols.txt

Large diffs are not rendered by default.

Binary file modified ASM/build/bundle.o
Binary file not shown.
2 changes: 1 addition & 1 deletion ASM/c/ocarina_buttons.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ uint8_t c_block_ocarina() {
}
return res;
}
extern int16_t EPONAS_SONG_NOTES;
extern uint8_t EPONAS_SONG_NOTES;
int8_t can_spawn_epona() {
if (!SHUFFLE_OCARINA_BUTTONS) {
return 1;
Expand Down
2 changes: 1 addition & 1 deletion ASM/src/config.asm
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ CUSTOM_KEY_MODELS:
SHUFFLE_OCARINA_BUTTONS:
.byte 0x00
EPONAS_SONG_NOTES:
.halfword 0x0000
.byte 0x00
.align 4

; These configuration values are given fixed addresses to aid auto-trackers.
Expand Down
2 changes: 1 addition & 1 deletion Cosmetics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,7 @@ def __init__(self, settings: Settings) -> None:
for setting in self.settings.setting_infos.values():
if setting.name not in self.src_dict['settings'] or not setting.cosmetic:
continue
self.settings.settings_dict[setting.name] = self.src_dict['settings'][setting.name]
setattr(self.settings, setting.name, self.src_dict['settings'][setting.name])
valid_settings.append(setting.name)
for setting in list(self.src_dict['settings'].keys()):
if setting not in valid_settings:
Expand Down
8 changes: 4 additions & 4 deletions GUI/src/app/providers/GUIGlobal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ export class GUIGlobal implements OnDestroy {
userSettings[setting.name].forEach(entry => {

let optionEntry = setting.options.find(option => {
if (option.name == entry)
if (option.name === entry)
return true;

return false;
Expand All @@ -548,7 +548,7 @@ export class GUIGlobal implements OnDestroy {
}
else {
let optionEntry = setting.options.find(option => {
if (option.name == userSettings[setting.name])
if (option.name === userSettings[setting.name])
return true;

return false;
Expand Down Expand Up @@ -886,7 +886,7 @@ export class GUIGlobal implements OnDestroy {
settingsObj[setting.name].forEach(entry => {

let optionEntry = setting.options.find(option => {
if (option.name == entry)
if (option.name === entry)
return true;

return false;
Expand All @@ -901,7 +901,7 @@ export class GUIGlobal implements OnDestroy {
else if (setting.type == "Combobox") { //Ensure combobox option exists before applying it (in case of outdated settings being loaded)

let optionEntry = setting.options.find(option => {
if (option.name == settingsObj[setting.name])
if (option.name === settingsObj[setting.name])
return true;

return false;
Expand Down
2 changes: 1 addition & 1 deletion Patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -2508,7 +2508,7 @@ def update_scrub_text(message: bytearray, text_replacement: list[str], default_p
song_layout_in_byte_form |= 1 << 3
if '>' in epona_notes:
song_layout_in_byte_form |= 1 << 4
rom.write_int16(rom.sym('EPONAS_SONG_NOTES'), song_layout_in_byte_form)
rom.write_byte(rom.sym('EPONAS_SONG_NOTES'), song_layout_in_byte_form)

# Sets the torch count to open the entrance to Shadow Temple
if world.settings.easier_fire_arrow_entry:
Expand Down
2 changes: 1 addition & 1 deletion Plandomizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ def __init__(self, settings: Settings, src_dict: Optional[dict[str, Any]] = None
or update_dict['_settings'].get('starting_songs', None)):
update_dict['_settings']['starting_items'] = {}

self.settings.settings_dict.update(update_dict['_settings'])
self.settings.update(update_dict['_settings'])
if 'settings' in self.src_dict:
validate_settings(self.src_dict['settings'])
self.src_dict['_settings'] = self.src_dict['settings']
Expand Down
52 changes: 27 additions & 25 deletions Settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,7 @@ def __init__(self, settings_dict: dict[str, Any], strict: bool = False) -> None:
del settings_dict['compress_rom']
if strict:
validate_settings(settings_dict)
self.settings_dict.update(settings_dict)
for info in self.setting_infos.values():
if info.name not in self.settings_dict:
self.settings_dict[info.name] = info.default
self.update(settings_dict, initialize=True)

if self.world_count < 1:
self.world_count = 1
Expand All @@ -105,6 +102,14 @@ def copy(self) -> Settings:
settings.settings_dict = copy.deepcopy(settings.settings_dict)
return settings

def update(self, settings_dict: dict[str, Any], *, initialize: bool = False) -> None:
for info in self.setting_infos.values():
if info.type is type(None):
continue
if not initialize and info.name not in settings_dict:
continue
setattr(self, info.name, settings_dict[info.name] if info.name in settings_dict else info.default)

def get_settings_display(self) -> str:
padding = 0
for setting in filter(lambda s: s.shared, self.setting_infos.values()):
Expand All @@ -114,16 +119,16 @@ def get_settings_display(self) -> str:
for setting in filter(lambda s: s.shared, self.setting_infos.values()):
name = setting.name + ': ' + ' ' * (padding - len(setting.name))
if setting.type == list:
val = ('\n' + (' ' * (padding + 2))).join(self.settings_dict[setting.name])
val = ('\n' + (' ' * (padding + 2))).join(getattr(self, setting.name))
else:
val = str(self.settings_dict[setting.name])
val = str(getattr(self, setting.name))
output += name + val + '\n'
return output

def get_settings_string(self) -> str:
bits = []
for setting in filter(lambda s: s.shared and s.bitwidth > 0, self.setting_infos.values()):
value = self.settings_dict[setting.name]
value = getattr(self, setting.name)
i_bits = []
if setting.name in LEGACY_STARTING_ITEM_SETTINGS:
items = LEGACY_STARTING_ITEM_SETTINGS[setting.name]
Expand Down Expand Up @@ -223,9 +228,9 @@ def update_with_settings_string(self, text: str) -> None:
else:
raise TypeError(f'Cannot decode type {setting.type} from settings string')

self.settings_dict[setting.name] = value
setattr(self, setting.name, value)

self.settings_dict['starting_items'] = {} # Settings string contains the GUI format, so clear the current value of the dict format.
setattr(self, 'starting_items', {}) # Settings string contains the GUI format, so clear the current value of the dict format.
self.distribution.reset() # convert starting_items
self.settings_string = self.get_settings_string()
self.numeric_seed = self.get_numeric_seed()
Expand All @@ -249,10 +254,6 @@ def update_seed(self, seed: str) -> None:
self.sanitize_seed()
self.numeric_seed = self.get_numeric_seed()

def update(self) -> None:
self.settings_string = self.get_settings_string()
self.numeric_seed = self.get_numeric_seed()

def load_distribution(self) -> None:
if self.enable_distribution_file:
if self.distribution_file:
Expand Down Expand Up @@ -286,7 +287,7 @@ def check_dependency(self, setting_name: str, check_random: bool = True) -> bool
def get_dependency(self, setting_name: str, check_random: bool = True) -> Any:
info = SettingInfos.setting_infos[setting_name]
not_in_dist = '_settings' not in self.distribution.src_dict or info.name not in self.distribution.src_dict['_settings'].keys()
if check_random and 'randomize_key' in info.gui_params and self.settings_dict[info.gui_params['randomize_key']] and not_in_dist:
if check_random and 'randomize_key' in info.gui_params and getattr(self, info.gui_params['randomize_key']) and not_in_dist:
return info.disabled_default
elif info.dependency is not None:
return info.disabled_default if info.dependency(self) and not_in_dist else None
Expand All @@ -298,7 +299,7 @@ def remove_disabled(self) -> None:
if info.dependency is not None:
new_value = self.get_dependency(info.name)
if new_value is not None:
self.settings_dict[info.name] = new_value
setattr(self, info.name, new_value)
self._disabled.add(info.name)

self.settings_string = self.get_settings_string()
Expand Down Expand Up @@ -327,46 +328,47 @@ def resolve_random_settings(self, cosmetic: bool, randomize_key: Optional[str] =
# Make sure the setting is meant to be randomized and not specified in distribution
# We that check it's not specified in the distribution so that plando can override randomized settings
not_in_dist = '_settings' not in self.distribution.src_dict or info.name not in self.distribution.src_dict['_settings'].keys()
if self.settings_dict[info.gui_params['randomize_key']] and not_in_dist:
if getattr(self, info.gui_params['randomize_key']) and not_in_dist:
randomize_keys_enabled.add(info.gui_params['randomize_key'])
choices, weights = zip(*info.gui_params['distribution'])
self.settings_dict[info.name] = random.choices(choices, weights=weights)[0]
setattr(self, info.name, random.choices(choices, weights=weights)[0])

# Second pass to make sure disabled settings are set properly.
# Stupid hack: disable randomize keys, then re-enable.
for randomize_keys in randomize_keys_enabled:
self.settings_dict[randomize_keys] = False
setattr(self, randomize_keys, False)
for info in sorted_infos:
if cosmetic == info.shared:
continue
dependency = self.get_dependency(info.name, check_random=False)
if dependency is None:
continue
self.settings_dict[info.name] = dependency
setattr(self, info.name, dependency)
for randomize_keys in randomize_keys_enabled:
self.settings_dict[randomize_keys] = True
setattr(self, randomize_keys, True)

def to_json(self, *, legacy_starting_items: bool = False) -> dict[str, Any]:
if legacy_starting_items:
settings = self.copy()
for setting_name, items in LEGACY_STARTING_ITEM_SETTINGS.items():
settings.settings_dict[setting_name] = []
starting_items = []
setattr(settings, setting_name, starting_items)
for entry in items.values():
if entry.item_name in self.starting_items:
count = self.starting_items[entry.item_name]
if not isinstance(count, int):
count = count.count
if count > entry.i:
settings.settings_dict[setting_name].append(entry.setting_name)
starting_items.append(entry.setting_name)
else:
settings = self
return { # TODO: This should be done in a way that is less insane than a double-digit line dictionary comprehension.
setting.name: (
{name: (
{name: record.to_json() for name, record in record.items()} if isinstance(record, dict) else record.to_json()
) for name, record in settings.settings_dict[setting.name].items()}
) for name, record in getattr(settings, setting.name).items()}
if setting.name == 'starting_items' and not legacy_starting_items else
settings.settings_dict[setting.name]
getattr(settings, setting.name)
)
for setting in self.setting_infos.values()
if setting.shared and (
Expand All @@ -380,7 +382,7 @@ def to_json(self, *, legacy_starting_items: bool = False) -> dict[str, Any]:
}

def to_json_cosmetics(self) -> dict[str, Any]:
return {setting.name: self.settings_dict[setting.name] for setting in self.setting_infos.values() if setting.cosmetic}
return {setting.name: getattr(self, setting.name) for setting in self.setting_infos.values() if setting.cosmetic}


# gets the randomizer settings, whether to open the gui, and the logger level from command line arguments
Expand Down
Loading

0 comments on commit 8d3b2ef

Please sign in to comment.