Cleanup fancy printing, add and use configuration

Former-commit-id: 638a7a3d363b0e8566c54dd5ca462b8a5aa0c56f
This commit is contained in:
Phillip Stephens 2023-12-18 20:29:47 -08:00
parent 30bd0f60a0
commit 5f259dd384
2 changed files with 28 additions and 13 deletions

View File

@ -137,8 +137,15 @@ config.ldflags = [
"-fp hardware",
"-nodefaults",
]
config.progress_all = False
config.progress_modules = False
config.progress_use_fancy = True
config.progress_code_fancy_frac = 1499
config.progress_code_fancy_item = "Energy"
config.progress_data_fancy_frac = 250
config.progress_data_fancy_item = "Missiles"
config.build_rels = False
# Base flags, common to most GC/Wii games.

View File

@ -65,6 +65,13 @@ class ProjectConfig:
True # Include individual modules, disable for large numbers of modules
)
# Progress fancy printing
self.progress_use_fancy = False
self.progress_code_fancy_frac = 0
self.progress_code_fancy_item = ""
self.progress_data_fancy_frac = 0
self.progress_data_fancy_item = ""
def validate(self):
required_attrs = [
"build_dir",
@ -897,12 +904,12 @@ def calculate_progress(config):
def __init__(self, name):
self.name = name
self.code_total = 0
self.code_fancy_frac = 1499
self.code_fancy_item = "energy"
self.code_fancy_frac = config.progress_code_fancy_frac
self.code_fancy_item = config.progress_code_fancy_item
self.code_progress = 0
self.data_total = 0
self.data_fancy_frac = 250
self.data_fancy_item = "missiles"
self.data_fancy_frac = config.progress_data_fancy_frac
self.data_fancy_item = config.progress_data_fancy_item
self.data_progress = 0
self.objects_progress = 0
self.objects_total = 0
@ -976,6 +983,7 @@ def calculate_progress(config):
)
print(f" Code: {unit.code_progress} / {unit.code_total} bytes")
print(f" Data: {unit.data_progress} / {unit.data_total} bytes")
if config.progress_use_fancy:
print(
"\nYou have {} out of {} {} and collected {} out of {} {}.".format(
math.floor(code_frac * unit.code_fancy_frac),