mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-23 23:41:24 +00:00
slightly improve standard output
This commit is contained in:
parent
8ef1c164a4
commit
3a428239c9
4 changed files with 46 additions and 49 deletions
|
@ -16,7 +16,7 @@ if TYPE_CHECKING:
|
|||
|
||||
# 0: nothing, 1: in progress & waiting, 2: all
|
||||
VERBOSE_FILE_TRY_PARSE_DATA = 0
|
||||
VERBOSE_REPORT_RESBUF = True
|
||||
VERBOSE_REPORT_RESBUF = False
|
||||
|
||||
#
|
||||
# file
|
||||
|
@ -263,7 +263,7 @@ class File:
|
|||
else:
|
||||
print("??? no last_parse_waiting_e ???")
|
||||
print("then why has", resource.name, "not been parsed?")
|
||||
BEST_EFFORT = True # TODO move
|
||||
BEST_EFFORT = False # TODO move
|
||||
if BEST_EFFORT:
|
||||
print("BEST_EFFORT: removing non-parsed resources")
|
||||
for resource in resources_data_not_parsed:
|
||||
|
|
|
@ -3,6 +3,11 @@ from dataclasses import dataclass
|
|||
|
||||
from typing import Callable, TypeVar, Generic
|
||||
|
||||
try:
|
||||
from rich.pretty import pprint as rich_pprint
|
||||
except ModuleNotFoundError:
|
||||
rich_pprint = print
|
||||
|
||||
from . import Resource, File, GetResourceAtResult
|
||||
|
||||
|
||||
|
@ -321,18 +326,15 @@ class MemoryContext:
|
|||
fake_resource.reporters.add(reporter)
|
||||
fake_file.add_resource(fake_resource)
|
||||
if VERBOSE_BEST_EFFORT:
|
||||
print(
|
||||
"BEST_EFFORT: ignored error e=",
|
||||
repr(e),
|
||||
"on resource report by reporter=",
|
||||
reporter,
|
||||
"at address=",
|
||||
hex(address),
|
||||
"and created fake_file=",
|
||||
fake_file,
|
||||
"and fake_resource=",
|
||||
fake_resource,
|
||||
)
|
||||
print("BEST_EFFORT: ignored error e=")
|
||||
rich_pprint(e)
|
||||
print(" on resource report by reporter=")
|
||||
rich_pprint(reporter)
|
||||
print(f" at {address=:#08X}")
|
||||
print(" and created fake_file=")
|
||||
rich_pprint(fake_file),
|
||||
print(" and fake_resource=")
|
||||
rich_pprint(fake_resource)
|
||||
fake_file.FAKE_FOR_BEST_EFFORT = True
|
||||
fake_resource.FAKE_FOR_BEST_EFFORT = True
|
||||
return fake_resource
|
||||
|
@ -370,18 +372,11 @@ class MemoryContext:
|
|||
except UnmappedAddressError as e:
|
||||
if BEST_EFFORT:
|
||||
if VERBOSE_BEST_EFFORT:
|
||||
print(
|
||||
"BEST_EFFORT: ignored error e=",
|
||||
repr(e),
|
||||
"and skipping marking resource buffer for reporter=",
|
||||
reporter,
|
||||
"resource_type=",
|
||||
resource_type,
|
||||
"address_start=",
|
||||
hex(address_start),
|
||||
"address_end=",
|
||||
hex(address_end),
|
||||
)
|
||||
print("BEST_EFFORT: ignored error e=")
|
||||
rich_pprint(e)
|
||||
print(" and skipping marking resource buffer for reporter=")
|
||||
rich_pprint(reporter)
|
||||
print(f" {resource_type=} {address_start=:#08X} {address_end=:#08X}")
|
||||
return
|
||||
raise
|
||||
file_start = resolve_result.file_offset
|
||||
|
@ -401,12 +396,9 @@ class MemoryContext:
|
|||
except UnmappedAddressError as e:
|
||||
if BEST_EFFORT:
|
||||
if VERBOSE_BEST_EFFORT:
|
||||
print(
|
||||
"BEST_EFFORT: ignored error e=",
|
||||
repr(e),
|
||||
"and returning raw address =",
|
||||
f"0x{address:08X}",
|
||||
)
|
||||
print("BEST_EFFORT: ignored error e="),
|
||||
rich_pprint(e)
|
||||
print(f" and returning raw address=0x{address:08X}")
|
||||
return f"0x{address:08X}"
|
||||
raise
|
||||
|
||||
|
|
|
@ -1,12 +1,18 @@
|
|||
from __future__ import annotations
|
||||
from pathlib import Path
|
||||
import enum
|
||||
import io
|
||||
from pathlib import Path
|
||||
import reprlib
|
||||
|
||||
import io
|
||||
|
||||
from typing import TYPE_CHECKING, Union, Optional, Callable
|
||||
|
||||
try:
|
||||
from rich.pretty import pprint as rich_pprint
|
||||
except ModuleNotFoundError:
|
||||
rich_pprint = print
|
||||
|
||||
# pip install pygfxd@git+https://github.com/Dragorn421/pygfxd.git@065541d92ad0d84d214fad4f30e4592f7102c013
|
||||
import pygfxd
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..extase.memorymap import MemoryContext
|
||||
|
||||
|
@ -31,13 +37,6 @@ VERBOSE_ColorIndexedTexturesManager = False
|
|||
VERBOSE_BEST_EFFORT_TLUT_NO_REAL_USER = True
|
||||
|
||||
|
||||
import pygfxd
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ......pygfxd import pygfxd
|
||||
|
||||
|
||||
class MtxResource(CDataResource):
|
||||
def write_mtx(resource, memory_context, v, f: io.TextIOBase, line_prefix):
|
||||
assert isinstance(v, dict)
|
||||
|
@ -301,9 +300,13 @@ class TextureResource(Resource):
|
|||
cur_count = self.width * self.height
|
||||
|
||||
assert cur_count >= new_min_count, (
|
||||
cur_count,
|
||||
new_min_count,
|
||||
"TLUT resource",
|
||||
self,
|
||||
"is defined as having",
|
||||
cur_count,
|
||||
"colors, but there is an image using it as having at least",
|
||||
new_min_count,
|
||||
"colors:",
|
||||
resource_ci,
|
||||
)
|
||||
|
||||
|
@ -392,9 +395,11 @@ class TextureResource(Resource):
|
|||
if VERBOSE_BEST_EFFORT_TLUT_NO_REAL_USER:
|
||||
print(
|
||||
"BEST_EFFORT",
|
||||
"no real (non-fake for best effort) ci resource uses this tlut\n ",
|
||||
self,
|
||||
"\n extracting the tlut as its own png",
|
||||
"no real (non-fake for best effort) ci resource uses this tlut",
|
||||
)
|
||||
rich_pprint(self)
|
||||
print(
|
||||
" extracting the tlut as its own png",
|
||||
self.extract_to_path.resolve().as_uri(),
|
||||
"instead of relying on it being generated",
|
||||
"\n (note while the result may build and match the tlut probably is",
|
||||
|
|
|
@ -22,7 +22,7 @@ from . import z64_resource_handlers
|
|||
#
|
||||
|
||||
VERBOSE1 = False
|
||||
VERBOSE2 = True
|
||||
VERBOSE2 = False
|
||||
|
||||
# "options"
|
||||
RM_SOURCE = True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue