Skip to content
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

Some general code cleaning: #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ASM/scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@
# Diff ROMs

call(['python', 'scripts/rom_diff.py',
'roms/base.z64', 'roms/patched.z64', '../data/rom_patch.txt'])
'roms/base.z64', 'roms/patched.z64', '../data/rom_patch.txt'])
3 changes: 2 additions & 1 deletion ASM/scripts/rom_diff.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import json
import sys

if len(sys.argv) < 4:
Expand All @@ -8,6 +7,7 @@
compare_path = sys.argv[2]
output_path = sys.argv[3]


def unequal_chunks(file1, file2):
chunk_size = 2048
i = 0
Expand All @@ -20,6 +20,7 @@ def unequal_chunks(file1, file2):
yield (i * chunk_size, chunk1, chunk2)
i += 1


diffs = []
with open(base_path, 'rb') as base_f, open(compare_path, 'rb') as comp_f:
for (i, base_c, comp_c) in unequal_chunks(base_f, comp_f):
Expand Down
212 changes: 127 additions & 85 deletions BaseClasses.py

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions BetterOoT.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
#!/usr/bin/env python3
import argparse
import os
import logging
import random
import textwrap
import os
import sys
import textwrap

from Gui import guiMain
from Main import main
from Utils import is_bundled, close_console
from Patches import get_tunic_color_options, get_navi_color_options
from Settings import get_settings_from_command_line_args
from Utils import is_bundled, close_console


class ArgumentDefaultsHelpFormatter(argparse.RawTextHelpFormatter):
Expand All @@ -20,7 +18,6 @@ def _get_help_string(self, action):


def start():

settings, gui, args_loglevel = get_settings_from_command_line_args()

if is_bundled() and len(sys.argv) == 1:
Expand All @@ -34,11 +31,13 @@ def start():

# ToDo: Validate files further than mere existance
if not os.path.isfile(settings.rom):
input('Could not find valid base rom for patching at expected path %s. Please run with -h to see help for further information. \nPress Enter to exit.' % settings.rom)
input(
'Could not find valid base rom for patching at expected path %s. Please run with -h to see help for further information. \nPress Enter to exit.' % settings.rom)
sys.exit(1)

# set up logger
loglevel = {'error': logging.ERROR, 'info': logging.INFO, 'warning': logging.WARNING, 'debug': logging.DEBUG}[args_loglevel]
loglevel = {'error': logging.ERROR, 'info': logging.INFO, 'warning': logging.WARNING, 'debug': logging.DEBUG}[
args_loglevel]
logging.basicConfig(format='%(message)s', level=loglevel)

logger = logging.getLogger('')
Expand All @@ -53,5 +52,6 @@ def start():
else:
main(settings)


if __name__ == '__main__':
start()
start()
Loading