Skip to content

Commit

Permalink
initial release commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pixel-stuck committed Mar 6, 2022
1 parent a17123a commit 9422337
Show file tree
Hide file tree
Showing 10 changed files with 3,600 additions and 25 deletions.
49 changes: 46 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,52 @@
# exlaunch
# dread depackager
A modification for Metroid: Dread allowing redirection of files from within pkg files to loose files in RomFS.

# usage
dread deapackager expects a json file called "replacements.json" to be placed into the root of the RomFS directory for your mod, and the subsdk9 and main.npdm files in the exefs directory.

replacements.json can have two structures, and it will be automatically detected.

format 1 example:
```json
{
"replacements" :
[
"file1/path/within/pkg",
"file2/path/within/pkg"
]
}
```

with format 1, `file1/path/within/pkg` will be directed to `rom:/file1/path/within/pkg` when the game tries to open it from within a pkg, and instead will open it from the same path within RomFS.

format 2 example:
```json
{
"replacements" :
[
{ "file1/path/within/pkg" : "rom:/mymod/file1" },
{ "file2/path/within/pkg" : "rom:/mymod/file2" }
]
}
```

with format 2, the RomFS path is arbitrarily defined for any pkg file path, allowing for more flexible organization of the reaplced files in the finished mod

# How it works
Dread depackager uses the filepaths listed in replacements.json to selectively replace paths in the game's path to crc conversion code.
All file paths first pass through this function, and by hooking it and replacing the string, it can selectively redirect file paths into romfs

dread depackager uses a few libraries:
- exlaunch, a code injection framework for switch executables. Its original readme can be found below
- cJSON, a json parsing library written in C. Dread depackager uses a slightly modified version of this library.

# Original exlaunch readme
## exlaunch
A framework for injecting C/C++ code into Nintendo Switch applications/applet/sysmodules.

# Note
## Note
This project is a work in progress. If you have issues, reach out to Shadów#1337 on Discord.

# Credit
## Credit
- Atmosphère: A great reference and guide.
- oss-rtld: Included for (pending) interop with rtld in applications (License [here](https://github.com/shadowninja108/exlaunch/blob/main/source/lib/reloc/rtld/LICENSE.txt)).
4 changes: 2 additions & 2 deletions exlaunch.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Application",
"title_id": "0x0100801011c3e000",
"name": "GameApp",
"title_id": "0x010093801237c000",
"title_id_range_min": "0x0100000000010000",
"title_id_range_max": "0x01ffffffffffffff",
"main_thread_stack_size": "0x00100000",
Expand Down
2 changes: 1 addition & 1 deletion exlaunch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# How you're loading your module. Used to determine how to find the target module. (AsRtld/Module/Kip)
export LOAD_KIND="Module"
# Program you're targetting. Used to determine where to deploy your files.
export PROGRAM_ID="0100801011c3e000"
export PROGRAM_ID="010093801237c000"
# Optional path to copy the final ELF to, for convenience.
export ELF_EXTRACT=""
# Python command to use. Must be Python 3.4+.
Expand Down
2 changes: 1 addition & 1 deletion misc/mk/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ CFLAGS += $(EXL_CFLAGS) -I"$(DEVKITPRO)/libnx/include" -I$(ROOT_SOURCE) $(addpre
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -fno-asynchronous-unwind-tables -fno-unwind-tables -std=gnu++20

ASFLAGS := -g $(ARCH)
LDFLAGS := -specs=$(SPECS_PATH)/$(SPECS_NAME) -g $(ARCH) -Wl,-Map,$(notdir $*.map) -nostartfiles -nostdlib
LDFLAGS := -specs=$(SPECS_PATH)/$(SPECS_NAME) -g $(ARCH) -Wl,-Map,$(notdir $*.map) -nostartfiles -flto

LIBS :=

Expand Down
2 changes: 1 addition & 1 deletion source/nn/fs/fs_files.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,5 @@ namespace nn::fs {
Flush file.
handle: Handle representing file to flush.
*/
Result FlushFile(FileHandle handle);
Result FlushFile(FileHandle handle);
}
1 change: 1 addition & 0 deletions source/nn/fs/fs_mount.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ namespace nn::fs {
mount: drive to mount to.
*/
Result MountSdCardForDebug(char const* mount);
Result MountRom(char const*, void*, unsigned long);
};
Loading

0 comments on commit 9422337

Please sign in to comment.