Skip to content
Merged
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
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ repos:
hooks:
- id: ruff-check
args: [ --fix, --exit-non-zero-on-fix ]
- id: ruff-format

- repo: https://github.com/rhysd/actionlint
rev: v1.7.11
Expand Down
15 changes: 9 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@


def generate_exefs_patches():
subprocess.run([
sys.executable,
os.fspath(Path(__file__).parent.joinpath("tools", "create_exefs_patches.py")),
"dread",
], check=True)
subprocess.run(
[
sys.executable,
os.fspath(Path(__file__).parent.joinpath("tools", "create_exefs_patches.py")),
"dread",
],
check=True,
)


class BuildPyCommand(build_py):
Expand All @@ -27,6 +30,6 @@ def run(self):

setup(
cmdclass={
'build_py': BuildPyCommand,
"build_py": BuildPyCommand,
},
)
1 change: 1 addition & 0 deletions src/open_dread_rando/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

def patch(input_path: Path, output_path: Path, configuration: dict):
from .dread_patcher import patch_extracted

return patch_extracted(input_path, output_path, configuration)


Expand Down
1 change: 1 addition & 0 deletions src/open_dread_rando/__pyinstaller/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
# This function returns a list containing only the path to this
# directory, which is the location of these hooks.


def get_hook_dirs():
return [os.path.dirname(__file__)]
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

# https://pyinstaller.readthedocs.io/en/stable/hooks.html#provide-hooks-with-package

datas = collect_data_files('open_dread_rando', excludes=['__pyinstaller'])
datas = collect_data_files("open_dread_rando", excludes=["__pyinstaller"])
64 changes: 35 additions & 29 deletions src/open_dread_rando/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,44 +10,50 @@

def create_parser():
parser = argparse.ArgumentParser()
parser.add_argument("--input-path", required=True, type=Path,
help="Path to where the extracted Metroid Dread romfs to randomize can be found.")
parser.add_argument("--output-path", required=True, type=Path,
help="Path to where the modified files will be written to.")
parser.add_argument("--input-json", required=True, type=Path,
help="Path to the configuration json.")
parser.add_argument(
"--input-path",
required=True,
type=Path,
help="Path to where the extracted Metroid Dread romfs to randomize can be found.",
)
parser.add_argument(
"--output-path", required=True, type=Path, help="Path to where the modified files will be written to."
)
parser.add_argument("--input-json", required=True, type=Path, help="Path to the configuration json.")
parser.add_argument("-q", "--quiet", action="store_true", help="Disables all info and debug logs.")
return parser


def setup_logging():
handlers = {
'default': {
'level': 'DEBUG',
'formatter': 'default',
'class': 'logging.StreamHandler',
'stream': 'ext://sys.stdout', # Default is stderr
"default": {
"level": "DEBUG",
"formatter": "default",
"class": "logging.StreamHandler",
"stream": "ext://sys.stdout", # Default is stderr
},
}
logging.config.dictConfig({
'version': 1,
'formatters': {
'default': {
'format': '[%(asctime)s] [%(levelname)s] [%(name)s] %(funcName)s: %(message)s',
}
},
'handlers': handlers,
'disable_existing_loggers': False,
'loggers': {
'default': {
'level': 'DEBUG',
logging.config.dictConfig(
{
"version": 1,
"formatters": {
"default": {
"format": "[%(asctime)s] [%(levelname)s] [%(name)s] %(funcName)s: %(message)s",
}
},
},
'root': {
'level': 'DEBUG',
'handlers': list(handlers.keys()),
},
})
"handlers": handlers,
"disable_existing_loggers": False,
"loggers": {
"default": {
"level": "DEBUG",
},
},
"root": {
"level": "DEBUG",
"handlers": list(handlers.keys()),
},
}
)


def main():
Expand Down
6 changes: 4 additions & 2 deletions src/open_dread_rando/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@

# list of all scenarios
ALL_SCENARIOS = [
"s010_cave", "s020_magma",
"s010_cave",
"s020_magma",
"s030_baselab",
"s040_aqua",
"s050_forest",
"s060_quarantine",
"s070_basesanc",
"s080_shipyard",
"s090_skybase"
"s090_skybase",
]


# fade in/out values (in seconds) for room name GUI
class FadeTimes(Enum):
NO_FADE = -1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ def __init__(self, name: str, color: tuple[float, float, float, float]):
base_mat="actors/items/item_missiletank/models/imats/item_missiletank_mp_fxhologram_01.bsmat",
new_mat_name=f"{name}_mp_fxhologram_01",
new_path=f"actors/items/item_missiletank/models/imats/{name}_mp_fxhologram_01.bsmat",
uniform_params={
"vTex0EmissiveColor": color
}
uniform_params={"vTex0EmissiveColor": color},
)
}

self.base_model_path="actors/items/item_missiletank/models/item_missiletank.bcmdl"
self.new_model_path=f"actors/items/item_missiletank/models/{name}.bcmdl"
self.base_model_path = "actors/items/item_missiletank/models/item_missiletank.bcmdl"
self.new_model_path = f"actors/items/item_missiletank/models/{name}.bcmdl"


MISSILE_TANK_RECOLORS: dict[str, MissileTankRecolor] = {
Expand Down
Loading