Compare commits

...

2 Commits

Author SHA1 Message Date
magical 4622f61057 update README 2024-02-03 20:22:28 -08:00
magical 3c7ae38f81 restore GUI event loop 2024-02-03 20:22:28 -08:00
2 changed files with 82 additions and 68 deletions

136
GUI.py
View File

@ -231,74 +231,78 @@ def main_window(debug):
fileName = str() fileName = str()
finishGenerating = False finishGenerating = False
oldNum = str() oldNum = str()
(event, values) = window.read() while True:
if event == ui.WINDOW_CLOSED: (event, values) = window.read()
pass if event == ui.WINDOW_CLOSED:
elif event == 'Num': break
if len(values['Num']) > 3:
window['Num'].update(oldNum) elif event == 'Num':
for x in range(4): if len(values['Num']) > 3:
if x < len(values['Num']) or values['Num'][x] not in '0123456789':
window['Num'].update(oldNum) window['Num'].update(oldNum)
for x in range(4):
oldNum = values['Num'] if x < len(values['Num']):
# continue if values['Num'][x] not in '0123456789':
if event == 'Generate': window['Num'].update(oldNum)
basegame = ui.popup_get_file('Choose base game', no_titlebar=True, file_types=[('GBA File', '*.gba')], history=True, history_setting_filename=os.path.join('.', 'settings.json')) break
if basegame == '': else:
ui.popup('Please select a Metroid Fusion (U) rom.', title='No source rom selected') oldNum = values['Num']
if basegame != None and basegame != '':
checksum = fileHash(basegame) elif event == 'Generate':
if checksum != 1819625372: basegame = ui.popup_get_file('Choose base game', no_titlebar=True, file_types=[('GBA File', '*.gba')], history=True, history_setting_filename=os.path.join('.', 'settings.json'))
ui.popup('Only Metroid Fusion (U) is supported.\nCheck the CRC32 value: it should be 6C75479C', title='Bad Checksum') if basegame == '':
else: ui.popup('Please select a Metroid Fusion (U) rom.', title='No source rom selected')
values.update({ if basegame != None and basegame != '':
'Debug': debug }) checksum = fileHash(basegame)
threading.Thread(target=rando_thread, args=[window, values], daemon=True).start() if checksum != 1819625372:
window['Difficulty'].update(disabled=True) ui.popup('Only Metroid Fusion (U) is supported.\nCheck the CRC32 value: it should be 6C75479C', title='Bad Checksum')
window['MajorMinor'].update(disabled=True) else:
window['MissilesWithoutMainData'].update(disabled=True) values.update({
window['PowerBombsWithoutBombs'].update(disabled=True) 'Debug': debug })
window['DamageRuns'].update(disabled=True) threading.Thread(target=rando_thread, args=[window, values], daemon=True).start()
window['SplitSecurity'].update(disabled=True) window['Difficulty'].update(disabled=True)
window['SectorShuffle'].update(disabled=True) window['MajorMinor'].update(disabled=True)
window['HideItems'].update(disabled=True) window['MissilesWithoutMainData'].update(disabled=True)
window['Seed'].update(disabled=True) window['PowerBombsWithoutBombs'].update(disabled=True)
window['RaceSeed'].update(disabled=True) window['DamageRuns'].update(disabled=True)
window['Num'].update(disabled=True) window['SplitSecurity'].update(disabled=True)
window['Patch'].update(disabled=True) window['SectorShuffle'].update(disabled=True)
window['Generate'].update(disabled=True) window['HideItems'].update(disabled=True)
if generating: window['Seed'].update(disabled=True)
ui.popup_animated(ui.DEFAULT_BASE64_LOADING_GIF, 'Generating game, please wait...', time_between_frames=20) window['RaceSeed'].update(disabled=True)
window.Refresh() window['Num'].update(disabled=True)
# continue window['Patch'].update(disabled=True)
if finishGenerating: window['Generate'].update(disabled=True)
ui.popup_animated(None)
if failedgen: if generating:
ui.popup('Could not generate a game with the current settings. Try changing your settings.', title='Metroid Fusion Open Randomizer') ui.popup_animated(ui.DEFAULT_BASE64_LOADING_GIF, 'Generating game, please wait...', time_between_frames=20)
elif randoerror: window.Refresh()
ui.popup('An error occurred, no game was generated.', title='Error')
elif ui.Input.get(window['Num']) != '': elif finishGenerating:
if int(ui.Input.get(window['Num'])) > 1: ui.popup_animated(None)
ui.popup('Multiple games have been added to the seeds folder.', title='Success!') if failedgen:
ui.popup('Could not generate a game with the current settings. Try changing your settings.', title='Metroid Fusion Open Randomizer')
elif randoerror:
ui.popup('An error occurred, no game was generated.', title='Error')
elif ui.Input.get(window['Num']) != '':
if int(ui.Input.get(window['Num'])) > 1:
ui.popup('Multiple games have been added to the seeds folder.', title='Success!')
else:
ui.popup('{}\nhas been added to the seeds folder.'.format(fileName), title='Success!')
else: else:
ui.popup('{}\nhas been added to the seeds folder.'.format(fileName), title='Success!') ui.popup('{}\nhas been added to the seeds folder.'.format(fileName), title='Success!')
else: window['Difficulty'].update(disabled=False)
ui.popup('{}\nhas been added to the seeds folder.'.format(fileName), title='Success!') window['MajorMinor'].update(disabled=False)
window['Difficulty'].update(disabled=False) window['MissilesWithoutMainData'].update(disabled=False)
window['MajorMinor'].update(disabled=False) window['PowerBombsWithoutBombs'].update(disabled=False)
window['MissilesWithoutMainData'].update(disabled=False) window['DamageRuns'].update(disabled=False)
window['PowerBombsWithoutBombs'].update(disabled=False) window['SplitSecurity'].update(disabled=False)
window['DamageRuns'].update(disabled=False) window['SectorShuffle'].update(disabled=False)
window['SplitSecurity'].update(disabled=False) window['HideItems'].update(disabled=False)
window['SectorShuffle'].update(disabled=False) window['Seed'].update(disabled=False)
window['HideItems'].update(disabled=False) window['RaceSeed'].update(disabled=False)
window['Seed'].update(disabled=False) window['Num'].update(disabled=False)
window['RaceSeed'].update(disabled=False) window['Patch'].update(disabled=False)
window['Num'].update(disabled=False) window['Generate'].update(disabled=False)
window['Patch'].update(disabled=False) finishGenerating = False
window['Generate'].update(disabled=False)
finishGenerating = False
# continue
window.close() window.close()

View File

@ -4,13 +4,23 @@ This is the official unofficial Git repository for the Metroid Fusion Open Rando
Considering the original repository states that the software is GPL-3.0 licensed, but no source was ever released, we're endeavouring on this (potentially failing) task of making MFOR Open Again Considering the original repository states that the software is GPL-3.0 licensed, but no source was ever released, we're endeavouring on this (potentially failing) task of making MFOR Open Again
## Links
* [OpenMFOR repository][] (This project, in case you are looking at a fork)
* The [original MFOR repository][] on Github
* The [original MFOR thread][] on Metroid Construction
[OpenMFOR repository]: https://git.inabaudonge.reisen/OpenMFOR/OpenMFOR
[original MFOR repository]: https://github.com/Kazuto88/MFOR
[original MFOR thread]: https://forum.metroidconstruction.com/index.php/topic,5376.0.html
## Project Status ## Project Status
- [x] Decent disassembly - [x] Decent disassembly
- [x] GUI - [x] GUI
- [x] CRC verification - [x] CRC verification
- [ ] Logic - [x] Logic
- [ ] Reconstructing missing parts of code - [x] Reconstructing missing parts of code
- [x] Patching - [x] Patching
- [ ] Generating BPS patches - [ ] Generating BPS patches