text stringlengths 0 93.6k |
|---|
amiibo = None |
# initialize implicit sum manager |
implicit_sum_manager = ImplicitSumManager(implicit_sums, sections) |
while True: |
event, values = window.read() |
# need to change it from FileBrowse to normal button, call browse here |
match event: |
case "LOAD_AMIIBO" | "Open (CTRL+O)": |
if config.read_keys() is None: |
show_missing_key_warning() |
continue |
# file explorer |
path = filedialog.askopenfilename(filetypes=(('amiibo files', '*.json;*.bin'), )) |
# if cancelled don't try to open bin |
if path == '': |
continue |
try: |
try: |
if path.endswith(".json"): |
amiibo = JSONVirtualAmiiboFile(path, config.read_keys()) |
ryujinx_loaded = True |
else: |
amiibo = VirtualAmiiboFile(path, config.read_keys()) |
# Checks if the amiibo is initialized |
if amiibo.is_initialized() == False: |
# Asks the user if they want to apply a mii and name |
amiibo = initialize.open_initialize_amiibo_window(amiibo) |
ryujinx_loaded = False |
if amiibo == None: |
continue |
except (InvalidAmiiboDump, AmiiboHMACTagError, AmiiboHMACDataError): |
sg.popup("Invalid amiibo dump.", title='Incorrect Dump!') |
continue |
# update sections |
for section in sections: |
section.update(event, window, amiibo, None) |
# update implicit_sums |
implicit_sum_manager.update(event, window, amiibo) |
# update personality |
window["PERSONALITY"].update(f"The amiibo's personality is: {amiibo.get_personality()}") |
# update menu to include save options |
if ryujinx_loaded is not True: |
window[0].update(get_menu_def(updatePopUp, True)) |
else: |
window[0].update(get_menu_def(updatePopUp, True, True)) |
# update save button to be clickable |
window["SAVE_AMIIBO"].update(disabled=False) |
# hot key for saving enabled |
window.bind('<Control-s>', "Save As (CTRL+S)") |
# enable all sections |
for i in range(1, int(sections[-1].get_keys()[-1])+1): |
try: |
window[str(i)].update(disabled=False) |
# deals with bit numbers not having disabled property |
except TypeError: |
pass |
window.refresh() |
except FileNotFoundError: |
sg.popup( |
f"Amiibo encryption key(s) are missing.\nThese keys are for encrypting/decrypting amiibo.\nYou can get them by searching for them on the internet.\nPlease select keys using Settings > Select Key", |
title="Missing Key!") |
case "Save": |
if amiibo is not None: |
if values['SHUFFLE_SN']: |
# if shuffle checkbox selected, shuffle the serial number |
amiibo.randomize_sn() |
# this event is not reachable until bin is loaded (which sets path) |
# noinspection PyUnboundLocalVariable |
amiibo.save_bin(path) |
else: |
sg.popup("An amiibo has to be loaded before it can be saved.", title="Error") |
case "SAVE_AMIIBO" | "Save As (CTRL+S)": |
# file explorer |
if ryujinx_loaded is True: |
path = filedialog.asksaveasfilename(defaultextension='.json', filetypes=(('JSON files', '*.json'),)) |
else: |
path = filedialog.asksaveasfilename(defaultextension='.bin', filetypes=(('BIN files', '*.bin'),)) |
# if cancelled don't try to save bin |
if path == '': |
continue |
elif amiibo is not None: |
if values['SHUFFLE_SN']: |
# if shuffle checkbox selected, shuffle the serial number |
amiibo.randomize_sn() |
amiibo.save_bin(path) |
else: |
sg.popup("An amiibo has to be loaded before it can be saved.", title="Error") |
case "Copy Values": |
# Output variable |
output = "" |
# Iterate through the sections |
for section in sections: |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.