mirror of https://github.com/zeldaret/botw.git
tools: Reformat progress
This commit is contained in:
parent
382cb57fc1
commit
9aacce607d
|
@ -16,12 +16,14 @@ parser.add_argument("--print-ok", "-m", action="store_true",
|
||||||
help="Print matching functions")
|
help="Print matching functions")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
class AIClassType(enum.Enum):
|
class AIClassType(enum.Enum):
|
||||||
Action = 0
|
Action = 0
|
||||||
AI = 1
|
AI = 1
|
||||||
Behavior = 2
|
Behavior = 2
|
||||||
Query = 3
|
Query = 3
|
||||||
|
|
||||||
|
|
||||||
code_size_total = 0
|
code_size_total = 0
|
||||||
num_total = 0
|
num_total = 0
|
||||||
code_size: tp.DefaultDict[FunctionStatus, int] = defaultdict(int)
|
code_size: tp.DefaultDict[FunctionStatus, int] = defaultdict(int)
|
||||||
|
@ -64,7 +66,8 @@ for info in utils.get_functions():
|
||||||
if args.print_ok:
|
if args.print_ok:
|
||||||
print(f"{Fore.GREEN}OK{Fore.RESET} {utils.format_symbol_name(info.decomp_name)}")
|
print(f"{Fore.GREEN}OK{Fore.RESET} {utils.format_symbol_name(info.decomp_name)}")
|
||||||
elif info.status == FunctionStatus.Wip:
|
elif info.status == FunctionStatus.Wip:
|
||||||
print(f"{Back.RED}{Style.BRIGHT}{Fore.WHITE} WIP {Style.RESET_ALL} {utils.format_symbol_name(info.decomp_name)}{Style.RESET_ALL}")
|
print(
|
||||||
|
f"{Back.RED}{Style.BRIGHT}{Fore.WHITE} WIP {Style.RESET_ALL} {utils.format_symbol_name(info.decomp_name)}{Style.RESET_ALL}")
|
||||||
|
|
||||||
|
|
||||||
def format_progress(label: str, num: int, size: int):
|
def format_progress(label: str, num: int, size: int):
|
||||||
|
@ -72,19 +75,24 @@ def format_progress(label: str, num: int, size: int):
|
||||||
size_percentage = round(100 * size / code_size_total, 3)
|
size_percentage = round(100 * size / code_size_total, 3)
|
||||||
return f"{num:>7d} {label}{Fore.RESET} ({percentage}% | size: {size_percentage}%)"
|
return f"{num:>7d} {label}{Fore.RESET} ({percentage}% | size: {size_percentage}%)"
|
||||||
|
|
||||||
|
|
||||||
def format_progress_for_status(label: str, status: FunctionStatus):
|
def format_progress_for_status(label: str, status: FunctionStatus):
|
||||||
return format_progress(label, counts[status], code_size[status])
|
return format_progress(label, counts[status], code_size[status])
|
||||||
|
|
||||||
|
|
||||||
def format_ai_progress(label: str, class_type: AIClassType):
|
def format_ai_progress(label: str, class_type: AIClassType):
|
||||||
percentage = round(100 * ai_counts_done[class_type] / ai_counts[class_type], 3)
|
percentage = round(100 * ai_counts_done[class_type] / ai_counts[class_type], 3)
|
||||||
return f"{ai_counts_done[class_type]:>7d} {label}{Fore.RESET} ({percentage}%)"
|
return f"{ai_counts_done[class_type]:>7d} {label}{Fore.RESET} ({percentage}%)"
|
||||||
|
|
||||||
|
|
||||||
print()
|
print()
|
||||||
|
|
||||||
print(f"{num_total:>7d} functions (size: ~{code_size_total} bytes)")
|
print(f"{num_total:>7d} functions (size: ~{code_size_total} bytes)")
|
||||||
|
|
||||||
count_decompiled = counts[FunctionStatus.Matching] + counts[FunctionStatus.Equivalent] + counts[FunctionStatus.NonMatching]
|
count_decompiled = counts[FunctionStatus.Matching] + counts[FunctionStatus.Equivalent] + counts[
|
||||||
code_size_decompiled = code_size[FunctionStatus.Matching] + code_size[FunctionStatus.Equivalent] + code_size[FunctionStatus.NonMatching]
|
FunctionStatus.NonMatching]
|
||||||
|
code_size_decompiled = code_size[FunctionStatus.Matching] + code_size[FunctionStatus.Equivalent] + code_size[
|
||||||
|
FunctionStatus.NonMatching]
|
||||||
|
|
||||||
print(format_progress(f"{Fore.CYAN}decompiled", count_decompiled, code_size_decompiled))
|
print(format_progress(f"{Fore.CYAN}decompiled", count_decompiled, code_size_decompiled))
|
||||||
print(format_progress_for_status(f"{Fore.GREEN}matching", FunctionStatus.Matching))
|
print(format_progress_for_status(f"{Fore.GREEN}matching", FunctionStatus.Matching))
|
||||||
|
|
Loading…
Reference in New Issue