all repos — m12-patcher @ e3c37d39bb278f21f24f2661ccddd39d5175ca23

light code refactoring
Marco Andronaco andronacomarco@gmail.com
Wed, 06 Jul 2022 15:57:15 +0200
commit

e3c37d39bb278f21f24f2661ccddd39d5175ca23

parent

2aaac7b27ad8359b672aaf1a66f566952a2c118d

4 files changed, 85 insertions(+), 81 deletions(-)

jump to
M Constants.pyConstants.py

@@ -5,8 +5,8 @@

PATCH_VERSION = '1.1.1' FINAL_ROM_NAME = f'Mother 1+2 [T+Ita{PATCH_VERSION}].gba' +STATUS_PRESET = "Preset applicato" # Niente punto qui STATUS_START = "Patcher pronto all'uso." -STATUS_PRESET = "Preset applicato." STATUS_MD5 = "MD5 verificato." STATUS_COPIED = "File copiati." STATUS_ASSEMBLY = "Codice compilato."

@@ -29,81 +29,84 @@ PATH_ALT = os.path.join(PATH_TOOLS, 'alt')

PRESETS = { "Scelte consigliate": { - 'font': 1, - 'sprites': 3, - 'places': 6, - 'palette': 8, - 'skip_m1': 12 + 'font': 'fonts_og', + 'sprites': 'sprites_mix', + 'places': 'places_us', + 'palette': 'palette_nes', + 'skip_m1': 'skip_m1_yes' }, "EB Beginnings (US)": { - 'font': 1, - 'sprites': 4, - 'places': 6, - 'palette': 8, - 'skip_m1': 12 + 'font': 'fonts_og', + 'sprites': 'sprites_us', + 'places': 'places_us', + 'palette': 'palette_nes', + 'skip_m1': 'skip_m1_yes' }, "Mother 1 (JP)": { - 'font': 1, - 'sprites': 5, - 'places': 7, - 'palette': 8, - 'skip_m1': 12 + 'font': 'fonts_og', + 'sprites': 'sprites_jp', + 'places': 'places_jp', + 'palette': 'palette_nes', + 'skip_m1': 'skip_m1_yes' }, "Mother 1+2": { - 'font': 1, - 'sprites': 4, - 'places': 7, - 'palette': 9, - 'skip_m1': 13 + 'font': 'fonts_og', + 'sprites': 'sprites_us', + 'places': 'places_jp', + 'palette': 'palette_gba', + 'skip_m1': 'skip_m1_no' } } -DEF_FILENAMES = { - 'font': ['m1_gfx_font.bin'], - 'sprites': [ - 'm1_restoration_gfx_sprites.bin', - 'm1_restoration_gfx_ending.bin', - 'm1_restoration_gfx_enemies.bin', - 'm1_restoration_gfx_maptiles.bin' - ], - 'places': [ - 'm1_main_text.txt', - 'm1_gfx_map.bin' - ] -} - ALT_FILENAMES = { - 1: ['m1_gfx_font_og.bin'], - - 2: ['m1_gfx_font_new.bin'], - - 3: ['m1_restoration_gfx_sprites_mix.bin', + 'fonts_og': + ['m1_gfx_font_og.bin'], + 'fonts_new': + ['m1_gfx_font_new.bin'], + 'sprites_mix': + ['m1_restoration_gfx_sprites_mix.bin', 'm1_restoration_gfx_ending_us.bin', 'm1_restoration_gfx_enemies_jp.bin', 'm1_restoration_gfx_maptiles_jp.bin'], - - 4: ['m1_restoration_gfx_sprites_us.bin', + 'sprites_us': + ['m1_restoration_gfx_sprites_us.bin', 'm1_restoration_gfx_ending_us.bin', 'm1_restoration_gfx_enemies_us.bin', 'm1_restoration_gfx_maptiles_us.bin'], - - 5: ['m1_restoration_gfx_sprites_jp.bin', + 'sprites_jp': + ['m1_restoration_gfx_sprites_jp.bin', 'm1_restoration_gfx_ending_jp.bin', 'm1_restoration_gfx_enemies_jp.bin', 'm1_restoration_gfx_maptiles_jp.bin'], - - 6: ['m1_main_text_us.txt', + 'places_us': + ['m1_main_text_us.txt', 'm1_gfx_map_us.bin'], - - 7: ['m1_main_text_jp.txt', + 'places_jp': + ['m1_main_text_jp.txt', 'm1_gfx_map_jp.bin'], - - 8: 'nes.ips', - 9: None, - 10: 'ncm.ips', - 11: 'vc.ips', - 12: 'skipm1.ips', - 13: None + + 'palette_nes': 'nes.ips', + 'palette_gba': None, + 'palette_ncm': 'ncm.ips', + 'palette_vc': 'vc.ips', + 'skip_m1_yes': 'skipm1.ips', + 'skip_m1_no': None +} + +DEF_FILENAMES = { + 'font': [ + 'm1_gfx_font.bin' + ], + 'sprites': [ + 'm1_restoration_gfx_sprites.bin', + 'm1_restoration_gfx_ending.bin', + 'm1_restoration_gfx_enemies.bin', + 'm1_restoration_gfx_maptiles.bin' + ], + 'places': [ + 'm1_main_text.txt', + 'm1_gfx_map.bin' + ] } OS_SUFFIX = (
M README.mdREADME.md

@@ -1,6 +1,6 @@

# Mother 1+2 Patcher 🇮🇹 -An italian patcher for MOTHER 1+2, created by Team M🌍DRE and presented by Earthbound Café. +An italian patcher for MOTHER 1+2, created by Team M🌍DRE and presented by [Earthbound Café](https://linktr.ee/earthboundcafe). This project wouldn't be possible without the [MOTHER 1+2 Fan Translation](http://mother12.earthboundcentral.com/).
M patcher.pypatcher.py

@@ -70,8 +70,9 @@ if apply_preset(self, preset):

set_progress(self, 0, Constants.STATUS_PRESET) def on_change_preset(self, *arg): - if apply_preset(self, self.preset.get()): - set_progress(self, 0, Constants.STATUS_PRESET) + preset = self.preset.get() + if apply_preset(self, preset): + set_progress(self, 0, f'{Constants.STATUS_PRESET}: {preset}.') def on_apply_button(self): self.apply_button['state'] = 'disabled'
M patcher.uipatcher.ui

@@ -96,8 +96,8 @@ </layout>

<child> <object class="ttk.Radiobutton" id="font_serif"> <property name="text" translatable="yes">Serif (originale)</property> - <property name="value">1</property> - <property name="variable">int:font</property> + <property name="value">fonts_og</property> + <property name="variable">string:font</property> <layout manager="pack"> <property name="anchor">w</property> <property name="padx">5</property>

@@ -109,8 +109,8 @@ </child>

<child> <object class="ttk.Radiobutton" id="font_sans"> <property name="text" translatable="yes">Sans serif (alternativa di Tomato)</property> - <property name="value">2</property> - <property name="variable">int:font</property> + <property name="value">fonts_new</property> + <property name="variable">string:font</property> <layout manager="pack"> <property name="anchor">w</property> <property name="padx">5</property>

@@ -138,8 +138,8 @@ </layout>

<child> <object class="ttk.Radiobutton" id="places_us"> <property name="text" translatable="yes">Occidentali</property> - <property name="value">6</property> - <property name="variable">int:places</property> + <property name="value">places_us</property> + <property name="variable">string:places</property> <layout manager="pack"> <property name="anchor">w</property> <property name="padx">5</property>

@@ -151,8 +151,8 @@ </child>

<child> <object class="ttk.Radiobutton" id="places_jp"> <property name="text" translatable="yes">Giapponesi</property> - <property name="value">7</property> - <property name="variable">int:places</property> + <property name="value">places_jp</property> + <property name="variable">string:places</property> <layout manager="pack"> <property name="anchor">w</property> <property name="padx">5</property>

@@ -180,8 +180,8 @@ </layout>

<child> <object class="ttk.Radiobutton" id="sprites_mix"> <property name="text" translatable="yes">Misti (aggiornati non censurati)</property> - <property name="value">3</property> - <property name="variable">int:sprites</property> + <property name="value">sprites_mix</property> + <property name="variable">string:sprites</property> <layout manager="pack"> <property name="anchor">w</property> <property name="padx">5</property>

@@ -193,8 +193,8 @@ </child>

<child> <object class="ttk.Radiobutton" id="sprites_us"> <property name="text" translatable="yes">Aggiornati e censurati (EBB, M1+2)</property> - <property name="value">4</property> - <property name="variable">int:sprites</property> + <property name="value">sprites_us</property> + <property name="variable">string:sprites</property> <layout manager="pack"> <property name="anchor">w</property> <property name="padx">5</property>

@@ -206,8 +206,8 @@ </child>

<child> <object class="ttk.Radiobutton" id="sprites_jp"> <property name="text" translatable="yes">Originali (M1)</property> - <property name="value">5</property> - <property name="variable">int:sprites</property> + <property name="value">sprites_jp</property> + <property name="variable">string:sprites</property> <layout manager="pack"> <property name="anchor">w</property> <property name="padx">5</property>

@@ -235,8 +235,8 @@ </layout>

<child> <object class="ttk.Radiobutton" id="palette_nes"> <property name="text" translatable="yes">NES</property> - <property name="value">8</property> - <property name="variable">int:palette</property> + <property name="value">palette_nes</property> + <property name="variable">string:palette</property> <layout manager="pack"> <property name="anchor">w</property> <property name="padx">5</property>

@@ -248,8 +248,8 @@ </child>

<child> <object class="ttk.Radiobutton" id="palette_gba"> <property name="text" translatable="yes">GBA</property> - <property name="value">9</property> - <property name="variable">int:palette</property> + <property name="value">palette_gba</property> + <property name="variable">string:palette</property> <layout manager="pack"> <property name="anchor">w</property> <property name="padx">5</property>

@@ -261,8 +261,8 @@ </child>

<child> <object class="ttk.Radiobutton" id="palette_ncm"> <property name="text" translatable="yes">Nintendo Classic Mini - NES</property> - <property name="value">10</property> - <property name="variable">int:palette</property> + <property name="value">palette_ncm</property> + <property name="variable">string:palette</property> <layout manager="pack"> <property name="anchor">w</property> <property name="padx">5</property>

@@ -290,10 +290,10 @@ <property name="sticky">ew</property>

</layout> <child> <object class="ttk.Checkbutton" id="skip_m1_check"> - <property name="offvalue">13</property> - <property name="onvalue">12</property> + <property name="offvalue">skip_m1_no</property> + <property name="onvalue">skip_m1_yes</property> <property name="text" translatable="yes">Avvia automaticamente Mother 1</property> - <property name="variable">int:skip_m1</property> + <property name="variable">string:skip_m1</property> <layout manager="pack"> <property name="anchor">w</property> <property name="padx">5</property>