-
Notifications
You must be signed in to change notification settings - Fork 47
Fix Wii and GameCube builds #173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Yanis002
wants to merge
11
commits into
HackerN64:main
Choose a base branch
from
Yanis002:fix_wii_gc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
39cad90
wii vc fix
Yanis002 59a2934
build issues
Yanis002 bca4739
fix audio lag!!!
Yanis002 4dda326
remove useless stuff
Yanis002 7b5fd2a
Merge remote-tracking branch 'upstream/main' into fix_wii_gc
Yanis002 6aa4ed8
oopsies
Yanis002 a8bf025
oopsies 2
Yanis002 00cc532
Merge remote-tracking branch 'upstream/main' into fix_wii_gc
Yanis002 e37a8f1
Merge remote-tracking branch 'upstream/main' into fix_wii_gc
Yanis002 5e5814c
fix build issues
Yanis002 eb23824
fixed boot issues and improvements
Yanis002 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,7 +28,6 @@ docs/doxygen/ | |
| *.png~ | ||
| *.dol | ||
| *.Identifier | ||
| *.dol | ||
| F3DEX3/*/*.code | ||
| F3DEX3/*/*.data | ||
| wadextract/ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| # Example usage: | ||
| # - make wad VERSION=ntsc-1.2 | ||
| # - make iso VERSION=ntsc-1.2 | ||
| # | ||
| # if building a mod for the GameCube, you will need to build this: https://github.com/Yanis002/oot-gc/tree/oot_gcc_compat | ||
| # and place the build in the baseroms folder (see `DOL` below) | ||
|
|
||
| ## Tools | ||
|
|
||
| # You can get gzinject here https://github.com/PracticeROM/gzinject | ||
| GZINJECT ?= tools/gzinject/gzinject | ||
|
|
||
| COPY ?= cp -v | ||
|
|
||
| # GameCube: | ||
| # This tool generates a file that the (modified) emulator can read | ||
| # to figure out which parts of the rom to cache. | ||
| # It outputs file indices from the rom and the location and the size of `gDmaDataTable`. | ||
| GEN_DMA_CONFIG := tools/generate_dma_config.py | ||
|
|
||
| # GameCube: | ||
| # This tool generates a file that the (modified) emulator can read | ||
| # to figure out where some of the N64 functions are to apply the proper hacks | ||
| # to make the game run properly. | ||
| # By default, the emulator will compute a checksum and it tries to find functions based on | ||
| # the calculated checksum and the size of the function, though this can fail completely | ||
| # since other compilers like GCC can change these values, this system is a workaround for that. | ||
| # Note: this is only useful when building with GCC. | ||
| GEN_LIB_CONFIG := tools/generate_lib_config.py | ||
|
|
||
| # Wii | ||
| WAD_NAME ?= "HackerOoT" | ||
| WAD_ID ?= NHOE | ||
| WAD_REGION ?= $(REGION) | ||
|
|
||
| ## Files | ||
|
|
||
| BASEWAD := baseroms/baserom-$(WAD_REGION).wad | ||
| COMMON_KEY := baseroms/common-key.bin | ||
| WAD := $(ROM:.z64=.wad) | ||
|
|
||
| # for ISOs we pick the MQ-JP one for all versions and instead patch the emulator | ||
| BASEISO := baseroms/baserom.iso | ||
| ISO := $(ROM:.z64=.iso) | ||
| DMA_CONFIG_FILE := dma_config.bin | ||
| LIB_CONFIG_FILE := lib_config.bin | ||
|
|
||
| # set to 1 to inject in MQ | ||
| MQ_INJECT ?= 0 | ||
|
|
||
| ifeq ($(MQ_INJECT),1) | ||
| ROM_NAME := urazlj_f | ||
| else | ||
| ROM_NAME := zlj_f | ||
| endif | ||
|
|
||
| # the emulator replacement dol, can be empty skip this step | ||
| DOL := baseroms/oot-gc.dol | ||
|
|
||
| ## Flags | ||
|
|
||
| # wad or iso to make a compatible gcc build | ||
| TARGET ?= | ||
|
|
||
| ifeq ($(COMPILER),gcc) | ||
| ifneq ($(TARGET),) | ||
| # TARGET_GC disables `.set gp=64` in exceptasm.s and the 3ms audio delay in `audio_thread_manager.c` | ||
| CFLAGS += -fno-reorder-blocks -fno-optimize-sibling-calls -fno-toplevel-reorder -DTARGET_GC -DWAD_REGION=REGION_$(WAD_REGION) | ||
| CPPFLAGS += -fno-reorder-blocks -fno-optimize-sibling-calls -fno-toplevel-reorder -DTARGET_GC -DWAD_REGION=REGION_$(WAD_REGION) | ||
| CCASFLAGS += -DTARGET_GC -DWAD_REGION=$(WAD_REGION) | ||
|
|
||
| $(BUILD_DIR)/src/audio/internal/seqplayer.o: OPTFLAGS := -O1 | ||
| endif | ||
| endif | ||
|
|
||
| ifeq ($(TARGET),) | ||
| TARGET := n64 | ||
| endif | ||
|
|
||
| ## Targets | ||
|
|
||
| wad: | ||
| $(V)$(MAKE) compress TARGET=wad | ||
| $(V)$(GZINJECT) -a inject -t $(WAD_NAME) -i $(WAD_ID) -k $(COMMON_KEY) -m $(ROMC) -w $(BASEWAD) -o $(WAD) -p gzi/$(WAD_REGION).gzi -p gzi/controller.gzi | ||
| $(V)$(RM) -r wadextract/ | ||
|
|
||
| # for ISOs we need to do things manually since we want to remove | ||
| # the useless files that increase the size of the file by a lot | ||
| iso: | ||
| $(V)$(MAKE) compress TARGET=iso | ||
| $(V)$(GZINJECT) -a extract -s $(BASEISO) | ||
| $(V)$(PYTHON) $(GEN_DMA_CONFIG) -v $(VERSION) | ||
| $(V)$(COPY) $(BUILD_DIR)/$(DMA_CONFIG_FILE) isoextract/zlj_f.tgc/$(DMA_CONFIG_FILE) | ||
| ifneq ($(COMPILER),ido) | ||
| $(V)$(PYTHON) $(GEN_LIB_CONFIG) -v $(VERSION) | ||
| $(V)$(COPY) $(BUILD_DIR)/$(LIB_CONFIG_FILE) isoextract/zlj_f.tgc/$(LIB_CONFIG_FILE) | ||
| endif | ||
| $(V)$(COPY) $(ROMC) isoextract/zlj_f.tgc/$(ROM_NAME).n64 | ||
| ifneq ($(DOL),) | ||
| $(V)$(COPY) $(DOL) isoextract/zlj_f.tgc/main.dol | ||
| endif | ||
| $(V)$(RM) -r isoextract/S_*.tgc/ isoextract/zlj_f.tgc/*.thp | ||
| $(V)$(GZINJECT) -a pack -s $(ISO) | ||
| $(V)$(RM) -r isoextract/ | ||
|
|
||
| .PHONY: wad iso | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -324,10 +324,6 @@ SEQ_CPPFLAGS := -D_LANGUAGE_ASEQ -DMML_VERSION=MML_VERSION_OOT $(CPP_DEFINES) - | |
| SBCFLAGS := --matching | ||
| SFCFLAGS := --matching | ||
|
|
||
| CFLAGS += $(CPP_DEFINES) | ||
| CPPFLAGS += $(CPP_DEFINES) | ||
| CFLAGS_IDO += $(CPP_DEFINES) | ||
|
|
||
| # Extra debugging steps | ||
| ifeq ($(DEBUG_OBJECTS),1) | ||
| OBJDUMP_CMD = @$(OBJDUMP) $(OBJDUMP_FLAGS) $@ > $(@:.o=.s) | ||
|
|
@@ -382,12 +378,11 @@ SPEC := spec/spec | |
| SPEC_INCLUDES := $(wildcard spec/*.inc) | ||
|
|
||
| # HackerOoT files | ||
| WAD := $(ROM:.z64=.wad) | ||
| ISO := $(ROM:.z64=.iso) | ||
| BPS := $(ROM:.z64=.bps) | ||
| UCODE_PATCHES := $(wildcard $(F3DEX3_DIR)/*.bps) | ||
| UCODE_FILES := $(foreach f,$(UCODE_PATCHES:.bps=),$f) | ||
| UCODE_O_FILES := $(foreach f,$(UCODE_FILES),$(BUILD_DIR)/$f.o) | ||
| -include .make_wii-vc.mk | ||
|
|
||
| SRC_DIRS := $(shell find src -type d) | ||
| UNDECOMPILED_DATA_DIRS := $(shell find data -type d) | ||
|
|
@@ -524,44 +519,6 @@ ifeq ($(COMPILER),gcc) | |
| $(BUILD_DIR)/src/%.o: CFLAGS += -fexec-charset=utf-8 | ||
| $(BUILD_DIR)/src/libultra/libc/ll.o: OPTFLAGS := -Ofast | ||
| $(BUILD_DIR)/src/overlays/%.o: CFLAGS += -fno-merge-constants -mno-explicit-relocs -mno-split-addresses | ||
|
|
||
| ## HackerOoT overrides ## | ||
|
|
||
| $(BUILD_DIR)/src/overlays/actors/ovl_Item_Shield/%.o: OPTFLAGS := -O2 | ||
| $(BUILD_DIR)/src/overlays/actors/ovl_En_Part/%.o: OPTFLAGS := -O2 | ||
| $(BUILD_DIR)/src/overlays/actors/ovl_Item_B_Heart/%.o: OPTFLAGS := -O0 | ||
| $(BUILD_DIR)/src/overlays/actors/ovl_Bg_Mori_Hineri/%.o: OPTFLAGS := -O0 | ||
|
Comment on lines
-530
to
-533
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO: test again if this is necessary |
||
|
|
||
| # library overrides | ||
| ifeq ($(TARGET),iso) | ||
| MIPS_VERSION_IDO := -mips2 | ||
| CFLAGS_IDO += -G 0 -non_shared -fullwarn -verbose -Xcpluscomm $(INC) -Wab,-r4300_mul -woff 516,609,649,838,712 | ||
| $(BUILD_DIR)/src/libultra/io/viswapbuf.o: OPTFLAGS := -O2 | ||
| $(BUILD_DIR)/src/libultra/io/viswapbuf.o: MIPS_VERSION := $(MIPS_VERSION_IDO) | ||
| $(BUILD_DIR)/src/libultra/io/viswapbuf.o: CFLAGS := $(CFLAGS_IDO) | ||
| $(BUILD_DIR)/src/libultra/io/viswapbuf.o: CC := $(CC_IDO) | ||
| $(BUILD_DIR)/src/libultra/gu/sinf.o: OPTFLAGS := -O2 | ||
| $(BUILD_DIR)/src/libultra/gu/sinf.o: MIPS_VERSION := $(MIPS_VERSION_IDO) | ||
| $(BUILD_DIR)/src/libultra/gu/sinf.o: CFLAGS := $(CFLAGS_IDO) | ||
| $(BUILD_DIR)/src/libultra/gu/sinf.o: CC := $(CC_IDO) | ||
| $(BUILD_DIR)/src/libultra/gu/cosf.o: OPTFLAGS := -O2 | ||
| $(BUILD_DIR)/src/libultra/gu/cosf.o: MIPS_VERSION := $(MIPS_VERSION_IDO) | ||
| $(BUILD_DIR)/src/libultra/gu/cosf.o: CFLAGS := $(CFLAGS_IDO) | ||
| $(BUILD_DIR)/src/libultra/gu/cosf.o: CC := $(CC_IDO) | ||
| $(BUILD_DIR)/src/libultra/gu/perspective.o: OPTFLAGS := -O2 | ||
| $(BUILD_DIR)/src/libultra/gu/perspective.o: MIPS_VERSION := $(MIPS_VERSION_IDO) | ||
| $(BUILD_DIR)/src/libultra/gu/perspective.o: CFLAGS := $(CFLAGS_IDO) | ||
| $(BUILD_DIR)/src/libultra/gu/perspective.o: CC := $(CC_IDO) | ||
| $(BUILD_DIR)/src/libultra/os/getmemsize.o: OPTFLAGS := -O1 | ||
| $(BUILD_DIR)/src/libultra/os/getmemsize.o: MIPS_VERSION := $(MIPS_VERSION_IDO) | ||
| $(BUILD_DIR)/src/libultra/os/getmemsize.o: CFLAGS := $(CFLAGS_IDO) | ||
| $(BUILD_DIR)/src/libultra/os/getmemsize.o: CC := $(CC_IDO) | ||
| $(BUILD_DIR)/src/libultra/os/aisetnextbuf.o: OPTFLAGS := -O1 | ||
| $(BUILD_DIR)/src/libultra/os/aisetnextbuf.o: MIPS_VERSION := $(MIPS_VERSION_IDO) | ||
| $(BUILD_DIR)/src/libultra/os/aisetnextbuf.o: CFLAGS := $(CFLAGS_IDO) | ||
| $(BUILD_DIR)/src/libultra/os/aisetnextbuf.o: CC := $(CC_IDO) | ||
| endif | ||
|
|
||
| endif | ||
|
|
||
| #### Main Targets ### | ||
|
|
@@ -654,6 +611,7 @@ $(ROM): $(ELF) | |
| @$(PRINT) "${GREEN}Rom Path: $(BLUE)$(ROM)$(NO_COL)\n" | ||
| @$(PRINT) "${GREEN}Build Author: $(BLUE)$(PACKAGE_AUTHOR)$(NO_COL)\n" | ||
| @$(PRINT) "${GREEN}Commit Author: $(BLUE)$(PACKAGE_COMMIT_AUTHOR)$(NO_COL)\n" | ||
| @$(PRINT) "${GREEN}Target: $(BLUE)$(TARGET)$(NO_COL)\n" | ||
| ifeq ($(TESTSUITE_MODE),1) | ||
| @$(PRINT) "${GREEN}Made with HackerTestSuite$(NO_COL)\n" | ||
| endif | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # default gz patches for NACJ | ||
| 0000 00000000 00000001 | ||
| # use 8MB memory | ||
| 0304 00002EB0 60000000 | ||
| # allocate 32MB for rom | ||
| 0304 0005BF44 3C807200 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # default gz patches for NACE | ||
| 0000 00000000 00000001 | ||
| # use 8MB memory | ||
| 0304 00002EB0 60000000 | ||
| # allocate 32MB for rom | ||
| 0304 0005BFD4 3C807200 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # gz standard remapping for NACE and NACJ | ||
| 0000 00000000 00000001 | ||
| # apply d-pad remappings | ||
| 0302 0016BAF0 00000800 | ||
| 0302 0016BAF4 00000400 | ||
| 0302 0016BAF8 00000200 | ||
| 0302 0016BAFC 00000100 | ||
| # apply c-stick remapping | ||
| 0302 0016BB04 00000020 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: test again gamecube builds