Merge pull request #15 from Nomura-RH/main

This commit is contained in:
Nomura-RH
2023-07-26 19:42:25 +02:00
committed by GitHub
2227 changed files with 9513 additions and 5138 deletions

19
.gitattributes vendored
View File

@@ -1,22 +1,27 @@
*.sh text eol=lf
*.s text eol=lf
Makefile text eol=lf
*.mk text eol=lf
*.c text eol=lf
*.h text eol=lf
*.inc text eol=lf
*.sha1 text eol=lf
*.json text eol=lf
*.cpp text eol=lf
*.hpp text eol=lf
*.s text eol=lf
*.inc text eol=lf
*.sh text eol=lf
*.py text eol=lf
*.sha1 text eol=lf
*.json text eol=lf
meson.build text eol=lf
.gitattributes text eol=lf
.gitignore text eol=lf
*.md text eol=lf
*.lsf text eol=lf
*.yml text eol=lf
*.ini text eol=lf
lib/msl/include/MSL_C/* text eol=lf
*.bin binary
*.h linguist-language=C
*.inc linguist-language=Assembly
*.py linguist-language=Python

38
.gitignore vendored
View File

@@ -1,26 +1,13 @@
# Object files
*.nds
# Compilers
tools/mwccarm/**
# SDK
tools/bin/**
# Build folder
build/**
sub/build/**
# Meson files
/build/
/tools/cw/build/
/tools/cw/mwrap
/tools/cw/mwrap.exe
# CLion folders
.idea/
cmake-build-debug/
# ROM
*.srl
# Tool executables
*.exe
# Generated files
*.4bpp
*.lz
@@ -33,17 +20,11 @@ cmake-build-debug/
# For decomp.me
ctx.c
*.lcf.template
*.lcf
*.response.template
*.response
# Working files
overlays/*/module_*.s
overlays/*/module_*.sbin
overlays/*/module_*.cfg
*.sbin
*.bnr
*.nbfp
*.nbfc
@@ -56,12 +37,8 @@ asmdiff.sh
symbols.csv
# NARCs
*.narc
*.arc
files/**/*.c
res/**/*.c
*.o
*.naix
*.a
# Utilities
ntruncompbw
@@ -85,9 +62,7 @@ diff.txt
temp_asm/
asm_old/
!platinum.us/rom_header_template.sbin
!platinum.us/banner.bnr
!sub/*.sbin
uncrustify.cfg
compare.sh
@@ -96,3 +71,4 @@ diff/
sdk/
!tools/asmdiff/asmdiff.sh

View File

@@ -1,3 +1,6 @@
This doc details the steps necessary to build a copy of Pokemon Platinum (EN-US) from the sources contained in this repository.
# 1. Setting up a dev environment
## Windows
@@ -11,99 +14,121 @@ To add an environment variable:
You will need to restart your computer for the changes to take effect, but if you plan to use Windows Subsystem for Linux (WSL), then you can restart later as part of the required restart when installing WSL, if you choose so.
You now have the choice between two different environments to use to build the project.
### Windows 10 (Windows Subsystem for Linux)
### MSYS2 (Recommended)
Currently WSL2 has an issue with mwldarm not being able to locate it's executable. Please use WSL1 or another build environment to mitigate this issue until a solution is found.
1. Download the MSYS2 installer from the official website: https://www.msys2.org/ and install it on your system.
2. Once the installation is complete, a terminal should automatically pop up. To update the package registry, type the following command:
```
pacman -Syu
```
Press 'Y' when prompted to confirm the update. The update process may take a few minutes. Once completed, the terminal will automatically close.
3. Reopen an MSYS terminal (pink icon) and enter the following command to install the necessary packages:
```
pacman -S git meson gcc
```
Press 'Y' when prompted to confirm the installation.
4. Continue with the [building instructions](#Downloading_the_repository). Make sure to always use the plain MSYS environment, other environments will not work.
### Windows Subsystem for Linux
1. Open [Windows Powershell **as Administrator**](https://i.imgur.com/QKmVbP9.png), and run the following command (Right Click or Shift+Insert is paste in the Powershell).
```powershell
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
wsl --install -d Ubuntu
```
2. Once the process finishes, restart your machine.
2. Once the process finishes, you will be prompted to restart your machine. Accept.
3. The next step is to choose and install a Linux distribution from the Microsoft Store. The following instructions will assume Ubuntu as the Linux distribution of choice.
3. After rebooting, reopen PowerShell and run the following commmand to downgrade to WSL1
4. Open the [Microsoft Store Linux Selection](https://aka.ms/wslstore), click Ubuntu, then click Get, which will install the Ubuntu distribution.
<details>
<summary><i>Notes...</i></summary>
```powershell
wsl --set-version Ubuntu 1
```
> Note 1: If a dialog pops up asking for you to sign into a Microsoft Account, then just close the dialog.
> Note 2: If the link does not work, then open the Microsoft Store manually, and search for the Ubuntu app (choose the one with no version number).
</details>
This is necessary because WSL2 has very slow access to the Windows file drive, which is where we need to store the repository.
### Setting up WSL1
Some tips before proceeding:
- In WSL, Copy and Paste is either done via
- **right-click** (selection + right click to Copy, right click with no selection to Paste)
- **Ctrl+Shift+C/Ctrl+Shift+V** (enabled by right-clicking the title bar, going to Properties, then checking the checkbox next to "Use Ctrl+Shift+C/V as Copy/Paste").
- Some of the commands that you'll run will ask for your WSL password and/or confirmation to perform the stated action. This is to be expected, just enter your WSL password and/or the yes action when necessary.
4. Open **Ubuntu** (e.g. using Search).
1. Open **Ubuntu** (e.g. using Search).
2. WSL/Ubuntu will set up its own installation when it runs for the first time. Once WSL/Ubuntu finishes installing, it will ask for a username and password (to be input in).
5. WSL/Ubuntu will set up its own installation when it runs for the first time. Once WSL/Ubuntu finishes installing, it will ask for a username and password (to be input in).
<details>
<summary><i>Note...</i></summary>
> When typing in the password, there will be no visible response, but the terminal will still read in input.
</details>
3. Update WSL/Ubuntu before continuing. Do this by running the following command. These commands will likely take a long time to finish:
6. Update WSL/Ubuntu before continuing. Do this by running the following command. These commands will likely take a long time to finish:
```bash
sudo apt update && sudo apt upgrade
```
4. Certain packages are required to build the repository. Install these packages by running the following command:
7. Certain packages are required to build the repository. Install these packages by running the following command:
```bash
sudo apt install git build-essential binutils-arm-none-eabi python3 libpng-devel pugixml
sudo apt install git build-essential
```
5. Change to a directory accessible from Windows where you'll store the files, for example:
We are not done yet, the 'meson' package is also necessary, but the version provided by apt is too outdated. To get the most recent meson version, run:
```
sudo apt-get install pip
pip install --user meson
```
8. Change to a directory accessible from Windows where you'll store the files, for example:
```bash
cd /mnt/c/Users/$USER/Desktop
```
Continue with the [building instructions](#Building)
Continue with the [building instructions](#Downloading_the_repository)
## Linux
Building the ROM requires the following packages. If you cannot find one or more of these using your package distribution, it may be under a different name.
* make
* git
* meson (>= 1.2.0)
* build-essentials (build-essential on Ubuntu)
* binutils-arm-none-eabi
* wine (to run the mwcc executables)
* python3 (for asm preprocessor)
* libpng-devel (libpng-dev on Ubuntu)
* pkg-config
* pugixml (libpugixml-dev on Ubuntu)
NOTE: If you are using Arch/Manjaro or Void you will only need base-devel instead of build-essentials or make or git. You will still need wine.
NOTE: On some distros, the meson package provided by the package manager will be out of date. To check your meson version, run:
## Installing
```
meson --version
```
Clone the repository:
If your mesion version is older than 1.2.0, follow the instructions at: https://mesonbuild.com/Getting-meson.html to get the most recent version of Meson
# 2. Downloading the repository
In your terminal of choice, navigate to the path you would like to store the repository in. If you are using WSL, make sure to clone the repo under the Windows file drive. Clone the repository with:
```
git clone https://github.com/pret/pokeplatinum
cd pokeplatinum
```
The build system requires the use of the Metrowerks C Compiler versions 2.0/sp2p2 to compile matching files. Download the zip [here](https://cdn.discordapp.com/attachments/698589325620936736/845499146982129684/mwccarm.zip) and extract it to tools/. At the end of this operation, you should have i.e. the file `tools/mwccarm/2.0/sp2p2/mwccarm.exe`.
In the future, a GCC option will be available so MWCC is not required to build, however it is required for a matching ROM.
Download the `NitroSDK-4_2-071210-jp.7z` [here](https://cdn.discordapp.com/attachments/855279572651868170/875195363261292604/NitroSDK-4_2-071210-jp.7z) and extract and copy the folder `tools/bin` from the Nitro SDK into the folder `tools` in your pokeplatinum clone. At the end of this operation, you should have the file `tools/bin/makelcf.exe` inside your pokeplatinum clone. Finally, copy `include/nitro/specfiles/ARM7-TS.lcf.template` into the subdirectory `sub`, and `include/nitro/specfiles/ARM9-TS.lcf.template` and `include/nitro/specfiles/mwldarm.response.template` into the project root.
To build everything:
# 3. Building
To set up the build system, run:
```
make -j$(nproc)
./config.sh
```
This is only required once. If the process is successful, you will see a new 'build' folder in the repository.
To build the rom, run:
```
./build.sh
```
If everything works, then the following ROM should be built:
- [build/platinum.us/pokeplatinum.us.nds](https://datomatic.no-intro.org/index.php?page=show_record&s=28&n=3541) `sha1: ce81046eda7d232513069519cb2085349896dec7`
**Note for Windows users**: Consider disabling real-time protection using [these instructions](https://support.microsoft.com/en-us/windows/turn-off-defender-antivirus-protection-in-windows-security-99e6004f-c54c-8509-773c-a4d776b77960) to speed up builds. [Adding an exception](https://support.microsoft.com/help/4028485) for the repository folder does not seem to help as much; one hypothesis is that the exceptions do not affect how various files are accessed via Windows (not WSL1) absolute paths.

View File

@@ -1,92 +0,0 @@
infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst __SPACE__, ,$(line))))
ifeq (,$(filter-out all,$(MAKECMDGOALS)))
$(call infoshell, $(MAKE) -f make_tools.mk)
endif
MWCCVER := 2.0/sp2p2
PROC := arm946e
PROC_S := arm5te
PROC_LD := v5te
LCF_TEMPLATE := ARM9-TS.lcf.template
LIBS := -Llib -lsyscall -nostdlib
OPTFLAGS := -O4,p
# Config
BUILD_DIR := build/platinum.us
NEFNAME := main
buildname := platinum.us
TITLE_NAME := POKEMON PL
GAME_CODE := CPUE
GAME_VERSION := PLATINUM
GAME_LANGUAGE := ENGLISH
SECURE_CRC := 0xF8B8
GF_DEFINES := -DGAME_VERSION=$(GAME_VERSION) -DGAME_LANGUAGE=$(GAME_LANGUAGE)
GF_DEFINES += -DPM_KEEP_ASSERTS
GLB_DEFINES := -DSDK_CW_FORCE_EXPORT_SUPPORT -DSDK_TS -DSDK_4M -DSDK_ARM9 -DSDK_CW -DSDK_FINALROM -DSDK_LINK_ISD -DNNS_FINALROM -D_NITRO -DSDK_CODE_ARM
DEFINES = $(GF_DEFINES) $(GLB_DEFINES)
ALL_BUILDDIRS := $(BUILD_DIR)/lib
include common.mk
include filesystem.mk
ROM := $(BUILD_DIR)/poke$(buildname).nds
#BANNER := $(ROM:%.nds=%.bnr)
#BANNER_SPEC := $(buildname)/banner.bsf
#ICON_PNG := $(buildname)/icon.png
BANNER := $(buildname)/banner.bnr
HEADER_TEMPLATE := $(buildname)/rom_header_template.sbin
.PHONY: main libsyscall sdk sdk9 sdk7
.PRECIOUS: $(ROM)
MAKEFLAGS += --no-print-directory
all: $(ROM)
tidy:
$(RM) -r $(BUILD_DIR)
$(RM) -r $(PROJECT_CLEAN_TARGETS)
$(RM) $(ROM)
clean: tidy clean-tools
@$(MAKE) -C lib/syscall clean
sdk9 sdk7: sdk
main filesystem: | sdk9
main: $(SBIN) $(ELF)
ROMSPEC := rom.rsf
MAKEROM_FLAGS := $(DEFINES)
$(NEF): libsyscall
libsyscall:
$(MAKE) -C lib/syscall all install INSTALL_PREFIX=$(abspath $(WORK_DIR)/$(BUILD_DIR)) GAME_CODE=$(GAME_CODE)
$(BUILD_DIR)/component.files: main ;
$(HEADER_TEMPLATE): ;
#$(ROM): $(ROMSPEC) filesystem $(BANNER)
$(ROM): $(ROMSPEC) main
$(WINE) $(MAKEROM) $(MAKEROM_FLAGS) -DBUILD_DIR=$(BUILD_DIR) -DNITROFS_FILES="$(NITROFS_FILES:files/%=%)" -DTITLE_NAME="$(TITLE_NAME)" -DBNR="$(BANNER)" -DHEADER_TEMPLATE="$(HEADER_TEMPLATE)" $< $@
$(FIXROM) $@ --secure-crc $(SECURE_CRC) --game-code $(GAME_CODE)
ifeq ($(COMPARE),1)
$(SHA1SUM) -c $(buildname)/rom.sha1
endif
#$(BANNER): $(BANNER_SPEC) $(ICON_PNG:%.png=%.nbfp) $(ICON_PNG:%.png=%.nbfc)
# $(WINE) $(MAKEBNR) $< $@
# TODO: move to NitroSDK makefile
FX_CONST_H := $(WORK_DIR)/lib/NitroSDK/include/nitro/fx/fx_const.h
PROJECT_CLEAN_TARGETS += $(FX_CONST_H)
$(FX_CONST_H): $(TOOLSDIR)/gen_fx_consts/fx_const.csv
$(MKFXCONST) $@
sdk: $(FX_CONST_H)
$(WORK_DIR)/include/global.h: $(FX_CONST_H) ;
.PHONY:

View File

@@ -1,68 +0,0 @@
.include "macros/function.inc"
.extern Unk_020E4558
.extern Unk_020E4560
.extern Unk_020E4568
.extern Unk_020E4570
.extern Unk_020E4578
.extern Unk_020E4580
.extern Unk_020E4588
.extern Unk_020E4590
.extern Unk_020E45A0
.extern Unk_020E45B4
.extern Unk_020E45CC
.extern Unk_020E45D4
.extern Unk_020E45E4
.extern Unk_020E45EC
.extern Unk_020E4600
.extern Unk_020E4608
.extern Unk_020E4610
.extern Unk_020E4628
.extern Unk_020E4644
.extern Unk_020E465C
.section .exception, 4
.global Exception_Table_Index
Exception_Table_Index: ; 0x020E4670
.incbin "incbin/main_etable.bin", 0x118, 0x164
.word Unk_020E4558
.incbin "incbin/main_etable.bin",0x280,0x68
.word Unk_020E4560
.incbin "incbin/main_etable.bin",0x2EC,0x2C
.word Unk_020E4568
.incbin "incbin/main_etable.bin",0x31C,0x8C
.word Unk_020E4570
.incbin "incbin/main_etable.bin",0x3AC,0x8
.word Unk_020E4578
.incbin "incbin/main_etable.bin",0x3B8,0x2C
.word Unk_020E4580
.incbin "incbin/main_etable.bin",0x3E8,0x80
.word Unk_020E4588
.incbin "incbin/main_etable.bin",0x46C,0x2C
.word Unk_020E4590
.incbin "incbin/main_etable.bin",0x49C,0x2C
.word Unk_020E45A0
.incbin "incbin/main_etable.bin",0x4CC,0x68
.word Unk_020E45B4
.incbin "incbin/main_etable.bin",0x538,0x2C
.word Unk_020E45CC
.incbin "incbin/main_etable.bin",0x568,0x8
.word Unk_020E45D4
.incbin "incbin/main_etable.bin",0x574,0x8
.word Unk_020E45E4
.incbin "incbin/main_etable.bin",0x580,0x14
.word Unk_020E45EC
.incbin "incbin/main_etable.bin",0x598,0x8
.word Unk_020E4600
.incbin "incbin/main_etable.bin",0x5A4,0x8
.word Unk_020E4608
.incbin "incbin/main_etable.bin",0x5B0,0x38
.word Unk_020E4610
.incbin "incbin/main_etable.bin",0x5EC,0x8
.word Unk_020E4628
.incbin "incbin/main_etable.bin",0x5F8,0x14
.word Unk_020E4644
.incbin "incbin/main_etable.bin",0x610,0x8
.word Unk_020E465C
.incbin "incbin/main_etable.bin",0x61C,0xCC

4
asm/meson.build Normal file
View File

@@ -0,0 +1,4 @@
pokeplatinum_asm = files(
'overlay014/ov14_022248A4.s',
'dtcm.s'
)

View File

@@ -1,71 +0,0 @@
.public OS_AllocFromHeap
.public OS_FreeToHeap
.public MI_CpuFill8
.public MI_CpuCopy8
.public MATH_CalcSHA1
.public _s32_div_f
.public _u32_div_f
.public ov97_022394DC
.public ov97_022395DC
.public ov97_02239780
.public ov97_02239844
.public ov97_02239918
.public ov97_02239A74
.public ov97_0223A278
.public ov97_0223A60C
.public ov97_0223A74C
.public ov97_0223A7C8
.public ov97_0223AA44
.public ov97_0223AAF0
.public ov97_0223AB34
.public ov97_0223AB68
.public ov97_0223AB90
.public ov97_0223ABD0
.public ov97_0223AC0C
.public ov97_0223AC40
.public ov97_0223ADFC
.public ov97_0223AFD4
.public ov97_0223B148
.public ov97_0223B1DC
.public ov97_0223B31C
.public ov97_0223B408
.public ov97_0223B564
.public ov97_0223B5C0
.public ov97_0223B5F4
.public ov97_0223BB94
.public ov97_0223BCB8
.public ov97_0223BDB8
.public ov97_0223BEFC
.public ov97_0223C060
.public ov97_0223C17C
.public ov97_0223C258
.public ov97_0223C3B8
.public ov97_0223C4E0
.public ov97_0223C5FC
.public ov97_0223C700
.public ov97_0223C814
.public ov97_0223C964
.public ov97_0223CAB8
.public ov97_0223CC58
.public ov97_0223CE38
.public ov97_0223CEA8
.public ov97_0223CF44
.public ov97_0223CF98
.public ov97_0223D014
.public ov97_0223D128
.public ov97_0223D198
.public ov97_0223D1D0
.public ov97_0223D268
.public ov97_0223D2E8
.public ov97_0223D330
.public ov97_0223D358
.public ov97_0223D38C
.public ov97_0223D3D8
.public ov97_0223D3EC
.public ov97_0223D438
.public ov97_0223D4B8
.public ov97_0223D510
.public ov97_0223D534
.public ov97_0223D568
.public ov97_0223D5E4
.public ov97_0223D62C

View File

@@ -1,14 +0,0 @@
# Supply a GNU ARM Embedded toolchain for objcopy, ar, etc.
ifdef DEVKITARM
TOOLCHAIN := $(DEVKITARM)
endif
ifdef TOOLCHAIN
export PATH := $(TOOLCHAIN)/bin:$(PATH)
endif
PREFIX := arm-none-eabi-
OBJCOPY := $(PREFIX)objcopy
AR := $(PREFIX)ar

12
build.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/sh
target="test"
if [ "$#" -ge 1 ]; then
target="$1"
shift
fi
# Set up env variable to show % of completion during ninja build
export NINJA_STATUS="[%p %f/%t] "
ninja -C build "$target" "$@"

3
clean.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
ninja -C build clean

263
common.mk
View File

@@ -1,263 +0,0 @@
## Common defines for ARM9 and ARM7 Makefiles ##
COMPARE ?= 1
default: all
PROJECT_ROOT := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
# Because mwldarm expects absolute paths to be WIN32 paths,
# all paths referring up from BUILD_DIR must be relative.
WORK_DIR := $(shell realpath --relative-to $(CURDIR) $(PROJECT_ROOT))
$(shell mkdir -p $(BUILD_DIR))
BACK_REL := $(shell realpath --relative-to $(BUILD_DIR) $(CURDIR))
TOOLSDIR := $(WORK_DIR)/tools
include $(WORK_DIR)/platform.mk
include $(WORK_DIR)/binutils.mk
# NitroSDK tools
MWCC = $(TOOLSDIR)/mwccarm/$(MWCCVER)/mwccarm.exe
MWAS = $(TOOLSDIR)/mwccarm/$(MWCCVER)/mwasmarm.exe
MWLD = $(BACK_REL)/$(TOOLSDIR)/mwccarm/$(MWCCVER)/mwldarm.exe
MAKEROM := $(TOOLSDIR)/bin/makerom.exe
MAKELCF := $(TOOLSDIR)/bin/makelcf.exe
MAKEBNR := $(TOOLSDIR)/bin/makebanner.exe
export LM_LICENSE_FILE := $(TOOLSDIR)/mwccarm/license.dat
# Native tools
FIXROM := $(TOOLSDIR)/fixrom/fixrom$(EXE)
ASPATCH := $(TOOLSDIR)/mwasmarm_patcher/mwasmarm_patcher$(EXE)
MKFXCONST := $(TOOLSDIR)/gen_fx_consts/gen_fx_consts$(EXE)
# Other tools
NTRMERGE := $(TOOLSDIR)/ntr_merge_elf/ntr_merge_elf.sh
ASM_PROCESSOR := $(TOOLSDIR)/asm_processor/compile.sh
NATIVE_TOOLS := \
$(FIXROM) \
$(ASPATCH) \
$(MKFXCONST)
TOOLDIRS := $(foreach tool,$(NATIVE_TOOLS),$(dir $(tool)))
PRECOMPILE_SRC := include/global/global.pch
PRECOMPILE_OBJ := $(BUILD_DIR)/precompile/global.mch
PRECOMPILE_OBJ_BASENAME := global.mch
PRECOMPILE_OBJ_DIR := $(dir $(PRECOMPILE_OBJ))
PRECOMPILE_DEPFILE := $(BUILD_DIR)/precompile/global.d
NITRO_PRECOMPILE_SRC := lib/NitroSDK/include/nitro.pch
NITRO_PRECOMPILE_OBJ := $(BUILD_DIR)/precompile/nitro.mch
NITRO_PRECOMPILE_OBJ_BASENAME := nitro.mch
NITRO_PRECOMPILE_OBJ_DIR := $(dir $(PRECOMPILE_OBJ))
NITRO_PRECOMPILE_DEPFILE := $(BUILD_DIR)/precompile/nitro.d
# Directories
LIB_SUBDIRS := NitroSDK NitroSystem NitroDWC NitroWiFi libVCT gamespy msl
SRC_SUBDIR := src
ASM_SUBDIR := asm
LIB_SRC_SUBDIR := lib/src $(LIB_SUBDIRS:%=lib/%/src)
LIB_ASM_SUBDIR := lib/asm $(LIB_SUBDIRS:%=lib/%/asm)
ALL_SUBDIRS := $(SRC_SUBDIR) $(ASM_SUBDIR) $(LIB_SRC_SUBDIR) $(LIB_ASM_SUBDIR)
SRC_BUILDDIR := $(addprefix $(BUILD_DIR)/,$(SRC_SUBDIR))
ASM_BUILDDIR := $(addprefix $(BUILD_DIR)/,$(ASM_SUBDIR))
LIB_SRC_BUILDDIR := $(addprefix $(BUILD_DIR)/,$(LIB_SRC_SUBDIR))
LIB_ASM_BUILDDIR := $(addprefix $(BUILD_DIR)/,$(LIB_ASM_SUBDIR))
C_SRCS := $(foreach dname,$(SRC_SUBDIR),$(wildcard $(dname)/*.c $(dname)/*/*.c))
ASM_SRCS := $(foreach dname,$(ASM_SUBDIR),$(wildcard $(dname)/*.s $(dname)/*/*.s))
# asm processor should only be necessary for libcrypto
GLOBAL_ASM_SRCS :=
LIB_C_SRCS := $(foreach dname,$(LIB_SRC_SUBDIR),$(wildcard $(dname)/*.c $(dname)/*/*.c $(dname)/*/*/*.c))
LIB_ASM_SRCS := $(foreach dname,$(LIB_ASM_SUBDIR),$(wildcard $(dname)/*.s $(dname)/*/*.s $(dname)/*/*/*.s))
ALL_SRCS := $(C_SRCS) $(ASM_SRCS) $(LIB_C_SRCS) $(LIB_ASM_SRCS)
C_OBJS = $(C_SRCS:%.c=$(BUILD_DIR)/%.o)
ASM_OBJS = $(ASM_SRCS:%.s=$(BUILD_DIR)/%.o)
GLOBAL_ASM_OBJS = $(GLOBAL_ASM_SRCS:%.c=$(BUILD_DIR)/%.o)
LIB_C_OBJS = $(LIB_C_SRCS:%.c=$(BUILD_DIR)/%.o)
LIB_ASM_OBJS = $(LIB_ASM_SRCS:%.s=$(BUILD_DIR)/%.o)
ALL_GAME_OBJS = $(C_OBJS) $(ASM_OBJS)
ALL_LIB_OBJS = $(LIB_C_OBJS) $(LIB_ASM_OBJS)
ALL_OBJS = $(ALL_GAME_OBJS) $(ALL_LIB_OBJS)
$(ALL_LIB_OBJS): DEFINES = $(GLB_DEFINES)
ALL_BUILDDIRS := $(sort $(ALL_BUILDDIRS) $(foreach obj,$(ALL_OBJS),$(dir $(obj))))
NEF := $(BUILD_DIR)/$(NEFNAME).nef
ELF := $(NEF:%.nef=%.elf)
LCF := $(NEF:%.nef=%.lcf)
RESPONSE := $(NEF:%.nef=%.response)
SBIN := $(NEF:%.nef=%.sbin)
XMAP := $(NEF).xMAP
EXCCFLAGS := -Cpp_exceptions off
include $(WORK_DIR)/force_active.mk
MWCFLAGS = $(DEFINES) $(OPTFLAGS) -enum int -lang c99 $(EXCCFLAGS) -gccext,on -proc $(PROC) -msgstyle gcc -gccinc -ipa file -interworking -inline on,noauto -char signed
MWASFLAGS = $(DEFINES) -proc $(PROC_S) -gccinc -i . -i ./include -i ./asm -i $(WORK_DIR)/files -I$(WORK_DIR)/lib/msl/include/MSL_C -DSDK_ASM
MWLDFLAGS := -w on -proc $(PROC) -nopic -nopid -interworking -map closure,unused -symtab sort -m _start -msgstyle gcc -force_active $(FORCE_ACTIVE_SYMBOLS)
ARFLAGS := rcS
# The foreach iterates through all library folders defined in LIB_SUBDIRS
# and generates the relevant includes
# e.g. -I$(WORK_DIR)/lib/NitroSDK/include -I$(WORK_DIR)/lib/NitroSystem/include
LIBRARY_INCLUDE_FLAGS := -I$(WORK_DIR)/lib/msl/include/MSL_C $(foreach dname,$(LIB_SUBDIRS),-I$(WORK_DIR)/lib/$(dname)/include)
SRC_INCLUDE_FLAGS := -i ./include -i ./include/library -i $(WORK_DIR)/files $(LIBRARY_INCLUDE_FLAGS)
SDK_INCLUDE_FLAGS := $(LIBRARY_INCLUDE_FLAGS)
#$(C_OBJS): MWCFLAGS += -include global/thumb.h -prefix $(PRECOMPILE_OBJ)
MW_COMPILE_SRC = $(WINE) $(MWCC) $(MWCFLAGS) $(SRC_INCLUDE_FLAGS) -i $(PRECOMPILE_OBJ_DIR) -include global/thumb.h -prefix $(PRECOMPILE_OBJ_BASENAME)
MW_COMPILE_SRC_PRECOMPILE = $(WINE) $(MWCC) $(MWCFLAGS) $(SRC_INCLUDE_FLAGS)
MW_COMPILE_LIB = $(WINE) $(MWCC) $(MWCFLAGS) $(SDK_INCLUDE_FLAGS) -i $(NITRO_PRECOMPILE_OBJ_DIR) -prefix $(NITRO_PRECOMPILE_OBJ_BASENAME)
MW_COMPILE_LIB_PRECOMPILE = $(WINE) $(MWCC) $(MWCFLAGS) $(SDK_INCLUDE_FLAGS)
MW_ASSEMBLE = $(WINE) $(MWAS) $(MWASFLAGS)
export MWCIncludes := lib/msl/include/MSL_C
LSF := $(addsuffix .lsf,$(NEFNAME))
ifneq ($(LSF),)
OVERLAYS := $(shell $(GREP) -o "^Overlay \w+" $(LSF) | cut -d' ' -f2)
else
OVERLAYS :=
endif
# Make sure build directories exist before compiling anything
DUMMY := $(shell mkdir -p $(ALL_BUILDDIRS) $(PRECOMPILE_OBJ_DIR))
.SECONDARY:
.SECONDEXPANSION:
.DELETE_ON_ERROR:
.PHONY: all tidy clean clean-tools
.PRECIOUS: $(SBIN)
all: $(MWAS)
.PHONY: $(MWAS)
$(MWAS):
$(ASPATCH) -q $@
ifeq ($(NODEP),)
ifneq ($(WINPATH),)
PROJECT_ROOT_NT := $(shell $(WINPATH) -w $(PROJECT_ROOT) | $(SED) 's/\\/\//g')
define fixdep
$(SED) -i 's/\r//g; s/\\/\//g; s/\/$$/\\/g; s#$(PROJECT_ROOT_NT)#$(PROJECT_ROOT)#g' $(1)
touch -r $(1:%.d=%.o) $(1)
endef
define fixdep_precompile
$(SED) -i 's/\r//g; s/\\/\//g; s/\/$$/\\/g; s#$(PROJECT_ROOT_NT)#$(PROJECT_ROOT)#g' $(1)
touch -r $(1:%.d=%.mch) $(1)
endef
else
define fixdep
$(SED) -i 's/\r//g; s/\\/\//g; s/\/$$/\\/g' $(1)
touch -r $(1:%.d=%.o) $(1)
endef
define fixdep_precompile
$(SED) -i 's/\r//g; s/\\/\//g; s/\/$$/\\/g' $(1)
touch -r $(1:%.d=%.mch) $(1)
endef
endif
DEPFLAGS := -gccdep -MD
DEPFILES := $(ALL_OBJS:%.o=%.d)
MW_COMPILE_SRC += $(DEPFLAGS)
MW_COMPILE_SRC_PRECOMPILE += $(DEPFLAGS)
MW_COMPILE_LIB += $(DEPFLAGS)
MW_COMPILE_LIB_PRECOMPILE += $(DEPFLAGS)
$(GLOBAL_ASM_OBJS): BUILD_C_SRC := $(ASM_PROCESSOR) "$(MW_COMPILE_SRC)" "$(MW_ASSEMBLE)"
BUILD_C_SRC ?= $(MW_COMPILE_SRC) -c -o
BUILD_C_LIB := $(MW_COMPILE_LIB) -c -o
# STILL IN NODEP=FALSE
$(PRECOMPILE_DEPFILE):
$(DEPFILES):
# TODO: figure out exact compiler versions for each SDK component
$(BUILD_DIR)/lib/NitroSDK/%.o: MWCCVER := 2.0/sp2
$(PRECOMPILE_OBJ): $(PRECOMPILE_SRC)
$(MW_COMPILE_SRC_PRECOMPILE) $(PRECOMPILE_SRC) -precompile $(PRECOMPILE_OBJ)
@$(call fixdep_precompile,$(PRECOMPILE_DEPFILE))
$(BUILD_DIR)/src/%.o: src/%.c $(PRECOMPILE_OBJ)
$(BUILD_DIR)/src/%.o: src/%.c $(BUILD_DIR)/src/%.d $(PRECOMPILE_OBJ)
$(BUILD_C_SRC) $@ $<
@$(call fixdep,$(BUILD_DIR)/src/$*.d)
$(NITRO_PRECOMPILE_OBJ): $(NITRO_PRECOMPILE_SRC)
$(MW_COMPILE_LIB_PRECOMPILE) $(NITRO_PRECOMPILE_SRC) -precompile $(NITRO_PRECOMPILE_OBJ)
@$(call fixdep_precompile,$(NITRO_PRECOMPILE_DEPFILE))
$(BUILD_DIR)/lib/%.o: lib/%.c $(NITRO_PRECOMPILE_OBJ)
$(BUILD_DIR)/lib/%.o: lib/%.c $(BUILD_DIR)/lib/%.d $(NITRO_PRECOMPILE_OBJ)
$(MW_COMPILE_LIB) -I$(dir $<) -c -o $@ $<
@$(call fixdep,$(BUILD_DIR)/lib/$*.d)
$(BUILD_DIR)/%.o: %.s
$(BUILD_DIR)/%.o: %.s $(BUILD_DIR)/%.d
$(WINE) $(MWAS) $(MWASFLAGS) -I$(dir $<) $(DEPFLAGS) -o $@ $<
@$(call fixdep,$(BUILD_DIR)/$*.d)
include $(wildcard $(DEPFILES))
-include $(PRECOMPILE_DEPFILE)
-include $(NITRO_PRECOMPILE_DEPFILE)
# END NODEP=FALSE
else
$(error NODEP not fully implemented)
$(GLOBAL_ASM_OBJS): BUILD_C_SRC := $(ASM_PROCESSOR) "$(MW_COMPILE_SRC)" "$(MW_ASSEMBLE)"
BUILD_C_SRC ?= $(MW_COMPILE_SRC) -c -o
$(BUILD_DIR)/%.o: %.c
$(BUILD_C_SRC) $@ $<
$(BUILD_DIR)/%.o: %.s
$(WINE) $(MWAS) $(MWASFLAGS) -o $@ $<
endif
clean-tools:
$(foreach tool,$(TOOLDIRS),$(MAKE) -C $(tool) clean;)
$(LCF): $(LSF) $(LCF_TEMPLATE)
$(WINE) $(MAKELCF) $(MAKELCF_FLAGS) $^ $@
ifeq ($(PROC),arm946e)
$(SED) -i '1i KEEP_SECTION\n{\n\t.exceptix\n}' $@
else
$(SED) -i '/\} > check\.WORKRAM/a SDK_SUBPRIV_ARENA_LO = SDK_SUBPRIV_ARENA_LO + SDK_AUTOLOAD.EXT_WRAM.SIZE + SDK_AUTOLOAD.EXT_WRAM.BSS_SIZE;' $@
endif
RESPONSE_TEMPLATE := $(PROJECT_ROOT)/mwldarm.response.template
RESPONSE_TEMPLATE_NT := $(PROJECT_ROOT_NT)/mwldarm.response.template
$(RESPONSE): $(LSF) $(RESPONSE_TEMPLATE)
$(WINE) $(MAKELCF) $(MAKELCF_FLAGS) $< $(RESPONSE_TEMPLATE_NT) $@
# Locate crt0.o
CRT0_OBJ := lib/NitroSDK/src/init/crt0.o
$(NEF): $(LCF) $(RESPONSE) $(ALL_OBJS)
cd $(BUILD_DIR) && LM_LICENSE_FILE=$(BACK_REL)/$(LM_LICENSE_FILE) $(WINE) $(MWLD) $(MWLDFLAGS) $(LIBS) -o $(BACK_REL)/$(NEF) $(LCF:$(BUILD_DIR)/%=%) @$(RESPONSE:$(BUILD_DIR)/%=%) $(CRT0_OBJ)
.INTERMEDIATE: $(BUILD_DIR)/obj.list
$(SBIN): build/%.sbin: build/%.nef
ifeq ($(COMPARE),1)
-$(SHA1SUM) --quiet -c $*.sha1
endif
$(ELF): %.elf: %.nef
$(NTRMERGE) $*
print-% : ; $(info $* is a $(flavor $*) variable set to [$($*)]) @true

72
config.sh Executable file
View File

@@ -0,0 +1,72 @@
#!/bin/sh
set -e
build="build"
if [ "$#" -ge 1 ]; then
build="$1"
shift
fi
wrap=tools/cw
# Build the wrapper
if ! "$wrap/mwrap" -test 2> /dev/null; then
rm -rf "$wrap/mwrap" "$wrap/build"
"${MESON:-meson}" setup "$wrap/build" "$wrap"
"${MESON:-meson}" compile -C "$wrap/build"
install -m755 "$wrap/build/mwrap" "$wrap/mwrap"
rm -rf "$wrap/build"
fi
is_wsl_accessing_windows() {
kernel=$(uname -r)
script_path=$(realpath "$0")
if echo "$kernel" | grep -q Microsoft && echo "$script_path" | grep -qE '^/mnt/'; then
return 0
else
return 1
fi
}
mkdir -p "$build"
root="$PWD"
if [ -n "$MSYSTEM" -a "$MSYSTEM" != MSYS ]; then
root="$(cygpath -w "$root")"
fi
# Bootstrap machine file pointing to the repo
echo "[constants]" > "$build/root.ini"
echo "root = '$root'" >> "$build/root.ini"
# Select toolchain
if [ "$(uname -s)" = "Linux" ]; then
if is_wsl_accessing_windows; then
native_file="native.ini"
cross_file="cross_unix.ini"
else
native_file="native_unix.ini"
cross_file="cross_unix.ini"
fi
else
native_file="native.ini"
cross_file="cross.ini"
fi
export MWCONFIG="$(realpath "$build/.mwconfig")"
if [ "$native_file" = "native_unix.ini" ]; then
wrap_wine="$(command -v "${WINELOADER:-wine}")"
wrap_path_unx="$PWD"
wrap_path_win="$("$wrap_wine" winepath -w "$wrap_path_unx")"
"$wrap/mwrap" -conf -wine "$wrap_wine" \
-path_unx "$wrap_path_unx" -path_win "$wrap_path_win"
elif is_wsl_accessing_windows; then
wrap_path_unx="$PWD"
wrap_path_win="$(wslpath -w "$wrap_path_unx")"
"$wrap/mwrap" -conf \
-path_unx "$wrap_path_unx" -path_win "$wrap_path_win"
fi
# Launch meson
"${MESON:-meson}" setup "$build" --native-file=meson/"$native_file" --native-file="$build/root.ini" --cross-file=meson/"$cross_file" --cross-file="$build/root.ini" "$@"

View File

@@ -1 +0,0 @@
* -text

View File

@@ -1,341 +0,0 @@
NITROFS_FILES := \
./data/UTF16.dat \
./data/arealight.narc \
./data/battle_win.NSCR \
./data/btower_canm.resdat \
./data/btower_celact.cldat \
./data/btower_cell.resdat \
./data/btower_chr.resdat \
./data/btower_pal.resdat \
./data/cell0.NCGR \
./data/cell0.NCLR \
./data/clact_default.NANR \
./data/crystal.nsbmd \
./data/demo_climax.narc \
./data/dp_areawindow.NCGR \
./data/dp_areawindow.NCLR \
./data/dt_test_celact.txt \
./data/dt_test_res_cell.txt \
./data/dt_test_res_cellanm.txt \
./data/dt_test_res_char.txt \
./data/dt_test_res_multi.txt \
./data/dt_test_res_multianm.txt \
./data/dt_test_res_pltt.txt \
./data/dun_sea.nsbtx \
./data/eoo.dat \
./data/exdata.dat \
./data/field_cutin.narc \
./data/fld_anime0.bin \
./data/fld_anime1.bin \
./data/fld_anime10.bin \
./data/fld_anime2.bin \
./data/fld_anime3.bin \
./data/fld_anime4.bin \
./data/fld_anime5.bin \
./data/fld_anime6.bin \
./data/fld_anime7.bin \
./data/fld_anime8.bin \
./data/fld_anime9.bin \
./data/fldtanime.narc \
./data/fs_kanban.nsbca \
./data/ground0.NCGR \
./data/ground0.NCLR \
./data/ground0.NSCR \
./data/guru2.narc \
./data/kemu_itpconv.dat \
./data/lake_anim.nsbtx \
./data/miniasahamabe.nsbtx \
./data/miniasasea.nsbtx \
./data/minihamabe.nsbtx \
./data/minimum.nsbtx \
./data/minirhana.nsbtx \
./data/namein.narc \
./data/nfont.NCGR \
./data/nfont.NCLR \
./data/pc.nsbca \
./data/pl_wifi.ncgr \
./data/pl_wm.ncgr \
./data/pl_wm.nclr \
./data/plbr.dat \
./data/plist_canm.resdat \
./data/plist_cell.resdat \
./data/plist_chr.resdat \
./data/plist_h.cldat \
./data/plist_pal.resdat \
./data/porucase_canm.resdat \
./data/porucase_celact.cldat \
./data/porucase_cell.resdat \
./data/porucase_chr.resdat \
./data/porucase_pal.resdat \
./data/pst_canm.resdat \
./data/pst_cell.resdat \
./data/pst_chr.resdat \
./data/pst_h.cldat \
./data/pst_pal.resdat \
./data/shop_canm.resdat \
./data/shop_cell.resdat \
./data/shop_chr.resdat \
./data/shop_h.cldat \
./data/shop_pal.resdat \
./data/slot.narc \
./data/smptm_koori.NANR \
./data/smptm_koori.NCER \
./data/smptm_koori.NCGR \
./data/smptm_koori.NCLR \
./data/smptm_nemuri.NANR \
./data/smptm_nemuri.NCER \
./data/smptm_nemuri.NCGR \
./data/smptm_nemuri.NCLR \
./data/str2uni.bin \
./data/t3_fl_b.nsbtx \
./data/t3_fl_p.nsbtx \
./data/t3_fl_r.nsbtx \
./data/t3_fl_y.nsbtx \
./data/test.atr \
./data/tmap_block.dat \
./data/tmap_flags.dat \
./data/tmapn_canm.resdat \
./data/tmapn_celact.cldat \
./data/tmapn_celact.txt \
./data/tmapn_cell.resdat \
./data/tmapn_chr.resdat \
./data/tmapn_pal.resdat \
./data/tmapn_res_canm.txt \
./data/tmapn_res_cell.txt \
./data/tmapn_res_chr.txt \
./data/tmapn_res_pal.txt \
./data/tradelist.narc \
./data/trapmark.narc \
./data/tw_arc_etc.naix \
./data/tw_arc_etc.narc \
./data/ug_anim.narc \
./data/ug_base_cur.nsbmd \
./data/ug_boygirl.NCGR \
./data/ug_boygirl.NCLR \
./data/ug_fossil.narc \
./data/ug_hero.NANR \
./data/ug_hero.NCER \
./data/ug_hole.NANR \
./data/ug_hole.NCER \
./data/ug_hole.NCGR \
./data/ug_parts.narc \
./data/ug_radar.narc \
./data/ug_trap.narc \
./data/ugeffect_obj_graphic.narc \
./data/uground_cell.resdat \
./data/uground_cellanm.resdat \
./data/uground_char.resdat \
./data/uground_char2.resdat \
./data/uground_clact.cldat \
./data/uground_pltt.resdat \
./data/uground_pltt2.resdat \
./data/ugroundeffect.naix \
./data/ugroundeffect.narc \
./data/underg_radar.narc \
./data/utility.bin \
./data/weather_sys.narc \
./data/wifi.ncgr \
./data/wifip2pmatch.narc \
./data/wm.ncgr \
./data/wm.nclr \
./data/sound/sound_data.sdat \
./data/sound/pl_sound_data.sdat \
./msgdata/pl_msg.narc \
./msgdata/msg.narc \
./msgdata/scenario/scr_msg.narc \
./poketool/pokegra/dp_height.narc \
./poketool/pokegra/dp_height_o.narc \
./poketool/pokegra/height.narc \
./poketool/pokegra/height_o.narc \
./poketool/pokegra/otherpoke.narc \
./poketool/pokegra/pl_otherpoke.narc \
./poketool/pokegra/pl_pokegra.narc \
./poketool/pokegra/poke_shadow.narc \
./poketool/pokegra/poke_shadow_ofx.narc \
./poketool/pokegra/poke_yofs.narc \
./poketool/pokegra/pokegra.narc \
./poketool/trgra/trbgra.narc \
./poketool/trgra/trfgra.narc \
./poketool/personal/personal.narc \
./poketool/personal/pl_personal.narc \
./poketool/personal/evo.narc \
./poketool/personal/growtbl.narc \
./poketool/personal/pl_growtbl.narc \
./poketool/personal/pms.narc \
./poketool/personal/wotbl.narc \
./poketool/trainer/trdata.narc \
./poketool/trainer/trpoke.narc \
./poketool/trmsg/trtbl.narc \
./poketool/trmsg/trtblofs.narc \
./battle/graphic/b_bag_gra.narc \
./battle/graphic/b_plist_gra.narc \
./battle/graphic/batt_bg.narc \
./battle/graphic/batt_obj.narc \
./battle/graphic/pl_b_plist_gra.narc \
./battle/graphic/pl_batt_bg.narc \
./battle/graphic/pl_batt_obj.narc \
./battle/graphic/vs_demo_gra.narc \
./wazaeffect/we.arc \
./wazaeffect/we_sub.narc \
./battle/skill/be_seq.narc \
./battle/skill/sub_seq.narc \
./battle/skill/waza_seq.narc \
./wazaeffect/effectclact/wecell.narc \
./wazaeffect/effectclact/wecellanm.narc \
./wazaeffect/effectclact/wechar.narc \
./wazaeffect/effectclact/wepltt.narc \
./poketool/waza/pl_waza_tbl.narc \
./poketool/waza/waza_tbl.narc \
./fielddata/script/scr_seq.narc \
./graphic/bag_gra.narc \
./graphic/box.narc \
./graphic/btower.narc \
./graphic/bucket.narc \
./graphic/config_gra.narc \
./graphic/demo_trade.narc \
./graphic/dendou_demo.narc \
./graphic/dendou_pc.narc \
./graphic/ending.narc \
./graphic/ev_pokeselect.narc \
./graphic/f_note_gra.narc \
./graphic/field_board.narc \
./graphic/field_encounteffect.narc \
./graphic/fld_comact.narc \
./graphic/font.narc \
./graphic/fontoam.narc \
./graphic/footprint_board.narc \
./graphic/hiden_effect.narc \
./graphic/imageclip.narc \
./graphic/library_tv.narc \
./graphic/lobby_news.narc \
./graphic/mail_gra.narc \
./graphic/menu_gra.narc \
./graphic/mysign.narc \
./graphic/mystery.narc \
./graphic/ntag_gra.narc \
./graphic/nutmixer.narc \
./graphic/oekaki.narc \
./graphic/opening.narc \
./graphic/pl_bag_gra.narc \
./graphic/pl_font.narc \
./graphic/pl_plist_gra.narc \
./graphic/pl_pst_gra.narc \
./graphic/pl_wifinote.narc \
./graphic/pl_winframe.narc \
./graphic/plist_gra.narc \
./graphic/pmsi.narc \
./graphic/poketch.narc \
./graphic/poru_gra.narc \
./graphic/poruact.narc \
./graphic/porudemo.narc \
./graphic/pst_gra.narc \
./graphic/ranking.narc \
./graphic/record.narc \
./graphic/shop_gra.narc \
./graphic/tmap_gra.narc \
./graphic/touch_subwindow.narc \
./graphic/trainer_case.narc \
./graphic/unionobj2d_onlyfront.narc \
./graphic/unionroom.narc \
./graphic/waza_oshie_gra.narc \
./graphic/wifi2dchar.narc \
./graphic/wifi_lobby.narc \
./graphic/wifi_lobby_other.narc \
./graphic/wifi_unionobj.narc \
./graphic/winframe.narc \
./graphic/worldtimer.narc \
./graphic/worldtrade.narc \
./itemtool/itemdata/item_data.narc \
./itemtool/itemdata/item_icon.narc \
./itemtool/itemdata/nuts_data.narc \
./itemtool/itemdata/pl_item_data.narc \
./poketool/icongra/pl_poke_icon.narc \
./poketool/icongra/poke_icon.narc \
./poketool/pokefoot/pokefoot.narc \
./data/mmodel/mmodel.narc \
./data/mmodel/fldeff.narc \
./wazaeffect/effectdata/ball_particle.narc \
./wazaeffect/effectdata/waza_particle.narc \
./fielddata/eventdata/zone_event.narc \
./fielddata/encountdata/d_enc_data.narc \
./fielddata/encountdata/p_enc_data.narc \
./fielddata/encountdata/pl_enc_data.narc \
./fielddata/build_model/build_model.narc \
./fielddata/build_model/build_model_matshp.dat \
./fielddata/mapmatrix/map_matrix.narc \
./fielddata/areadata/area_data.narc \
./fielddata/areadata/area_build_model/area_build.narc \
./fielddata/areadata/area_build_model/areabm_texset.narc \
./fielddata/areadata/area_map_tex/map_tex_set.narc \
./fielddata/areadata/area_move_model/move_model_list.narc \
./fielddata/land_data/land_data.narc \
./contest/data/contest_data.narc \
./particledata/particledata.narc \
./application/zukanlist/zkn_data/zukan_data.narc \
./application/zukanlist/zkn_data/zukan_data_gira.narc \
./application/wifi_earth/wifi_earth.narc \
./application/wifi_earth/wifi_earth_place.narc \
./application/custom_ball/data/cb_data.narc \
./demo/egg/data/egg_data.narc \
./demo/egg/data/particle/egg_demo_particle.narc \
./fielddata/mm_list/move_model_list.narc \
./pokeanime/poke_anm.narc \
./pokeanime/pl_poke_anm.narc \
./battle/tr_ai/tr_ai_seq.narc \
./arc/area_win_gra.narc \
./arc/balance_ball_gra.narc \
./arc/bm_anime.narc \
./arc/bm_anime_list.narc \
./arc/codein_gra.narc \
./arc/demo_tengan_gra.narc \
./arc/email_gra.narc \
./arc/encdata_ex.narc \
./arc/manene.narc \
./arc/plgym_ghost.narc \
./arc/ppark.narc \
./arc/ship_demo.narc \
./arc/ship_demo_pl.narc \
./arc/tv.narc \
./fielddata/maptable/mapname.bin \
./poketool/pokezukan.narc \
./poketool/pl_pokezukan.narc \
./poketool/shinzukan.narc \
./poketool/pokeanm/pokeanm.narc \
./poketool/pokeanm/pl_pokeanm.narc \
./demo/shinka/data/particle/shinka_demo_particle.narc \
./demo/intro/intro.narc \
./demo/intro/intro_tv.narc \
./demo/syoujyou/syoujyou.narc \
./battle/b_tower/btdpm.narc \
./battle/b_tower/btdtr.narc \
./application/zukanlist/zkn_data/zukan_enc_diamond.narc \
./application/zukanlist/zkn_data/zukan_enc_pearl.narc \
./application/zukanlist/zkn_data/zukan_enc_platinum.narc \
./poketool/poke_edit/pl_poke_data.narc \
./debug/cb_edit/d_test.narc \
./application/custom_ball/edit/pl_cb_data.narc \
./frontier/script/fr_script.narc \
./particledata/pl_frontier/frontier_particle.narc \
./application/balloon/graphic/balloon_gra.narc \
./application/wifi_lobby/map_conv/wflby_map.narc \
./fielddata/tornworld/tw_arc.narc \
./fielddata/tornworld/tw_arc_attr.narc \
./particledata/pl_pokelist/pokelist_particle.narc \
./battle/b_pl_stage/pl_bsdpm.narc \
./battle/b_pl_tower/pl_btdpm.narc \
./battle/b_pl_tower/pl_btdtr.narc \
./application/bucket/ballslow_data.narc \
./particledata/pl_etc/pl_etc_particle.narc \
./contest/graphic/contest_bg.narc \
./contest/graphic/contest_obj.narc \
./demo/title/op_demo.narc \
./demo/title/titledemo.narc \
./fielddata/pokemon_trade/fld_trade.narc \
./resource/eng/zukan/zukan.narc \
./resource/eng/batt_rec/batt_rec_gra.narc \
./resource/eng/wifi_lobby_minigame/wlmngm_tool.narc \
./resource/eng/frontier_graphic/frontier_bg.narc \
./resource/eng/frontier_graphic/frontier_obj.narc \
./resource/eng/scratch/scratch.narc \
./resource/eng/pms_aikotoba/pms_aikotoba.narc \
./dwc/utility.bin

View File

@@ -1,5 +0,0 @@
FORCE_ACTIVE_SYMBOLS := \
DGTi_hash2_arm4_small, \
Exception_Table_Index, \
Unk_02101B00, \
Unk_02101CE4

View File

@@ -2,7 +2,7 @@
#define POKEPLATINUM_FUNCPTR_020146F4_H
#include "library/spl.h"
#include "spl.h"
typedef void (* UnkFuncPtr_020146F4)(UnkSPLStruct6 *);

View File

@@ -1,7 +0,0 @@
#ifndef POKEPLATINUM_THUMB_H
#define POKEPLATINUM_THUMB_H
// doesn't work for asm functions if included in a precompiled header for some reason
#pragma thumb on
#endif // POKEPLATINUM_THUMB_H

View File

@@ -20,7 +20,7 @@
#include "overlay016/struct_ov16_02265BBC.h"
#include "overlay104/struct_ov104_0223F9E0.h"
#include "library/spl.h"
#include "spl.h"
UnkStruct_ov12_0221FCDC * ov12_0221FCDC(int param0);
void ov12_0221FDC0(UnkStruct_ov12_0221FCDC * param0, BOOL param1);

View File

@@ -4,7 +4,7 @@
#include "struct_decls/struct_02006C24_decl.h"
#include "struct_decls/struct_02014014_decl.h"
#include "library/spl.h"
#include "spl.h"
UnkStruct_02014014 * ov12_022237F0(int param0, int param1, int param2);
UnkStruct_02014014 * ov12_02223818(int param0, int param1, int param2, int param3);

View File

@@ -2,7 +2,7 @@
#define POKEPLATINUM_OV12_0222389C_H
#include "library/spl.h"
#include "spl.h"
void ov12_022238DC(UnkSPLStruct6 * param0);
void ov12_022238E0(UnkSPLStruct6 * param0);

View File

@@ -3,7 +3,7 @@
#include "overlay012/struct_ov12_02225640.h"
#include "library/spl.h"
#include "spl.h"
void ov12_02224F14(UnkSPLStruct6 * param0);
s8 ov12_02224FC4(UnkStruct_ov12_02225640 * param0);

View File

@@ -3,7 +3,7 @@
#include "overlay012/struct_ov12_02225640.h"
#include "library/spl.h"
#include "spl.h"
void ov12_022255D4(int param0, UnkSPLStruct6 * param1, UnkStruct_ov12_02225640 * param2);
int ov12_022255EC(int param0);

View File

@@ -3,7 +3,7 @@
#include "overlay012/struct_ov12_02225640.h"
#include "library/spl.h"
#include "spl.h"
void ov12_0222584C(int param0, UnkSPLStruct6 * param1, UnkStruct_ov12_02225640 * param2);

View File

@@ -4,7 +4,7 @@
#include "struct_decls/struct_02014014_decl.h"
#include "overlay077/struct_ov77_021D6CFC_decl.h"
#include "library/spl.h"
#include "spl.h"
const int ov77_021D6CB8(void);
UnkStruct_02014014 * ov77_021D6CBC(UnkStruct_ov77_021D6CFC * param0);

View File

@@ -4,7 +4,7 @@
#include "struct_decls/struct_02014014_decl.h"
#include "overlay119/struct_ov119_021D1930.h"
#include "library/spl.h"
#include "spl.h"
typedef struct {
UnkStruct_ov119_021D1930 unk_00;

View File

@@ -9,7 +9,6 @@
#include <stddef.h>
#include "global/config.h" // MUST COME BEFORE ANY OTHER GAMEFREAK HEADERS
//#include "constants/global.h"
#include "global/pm_version.h"
#include "global/assert.h"
#include "constants/pokemon.h"

View File

@@ -4,7 +4,7 @@
#include "struct_decls/struct_02014014_decl.h"
#include "struct_defs/struct_0207C894.h"
#include "library/spl.h"
#include "spl.h"
typedef struct {
UnkStruct_0207C894 unk_00;

View File

@@ -6,7 +6,7 @@
#include "functypes/funcptr_020146F4.h"
#include "struct_decls/struct_020203AC_decl.h"
#include "library/spl.h"
#include "spl.h"
#include <nnsys.h>
#include <nitro/fx/fx.h>

View File

@@ -1,3 +0,0 @@
.public OS_SleepThread
.public OS_DisableInterrupts
.public OS_RestoreInterrupts

View File

@@ -1,44 +0,0 @@
.include "macros/function.inc"
.include "include/os_irqhandler.inc"
.extern OS_IRQTable
.extern OSi_IrqThreadQueue
.text
arm_func_start OS_WaitIrq
OS_WaitIrq: ; 0x020C12B4
stmfd sp!, {r4, r5, r6, lr}
mov r5, r0
mov r4, r1
bl OS_DisableInterrupts
cmp r5, #0
beq _020C12E4
ldr r1, _020C1320 ; =0x027E0000
mvn r2, r4
add r1, r1, #0x3000
ldr r3, [r1, #0xff8]
and r2, r3, r2
str r2, [r1, #0xff8]
_020C12E4:
bl OS_RestoreInterrupts
ldr r1, _020C1320 ; =0x027E0000
add r0, r1, #0x3000
ldr r0, [r0, #0xff8]
tst r4, r0
ldmneia sp!, {r4, r5, r6, pc}
add r0, r1, #0x3f8
ldr r5, _020C1324 ; =0x027E0060
add r6, r0, #0x3c00
_020C1308:
mov r0, r5
bl OS_SleepThread
ldr r0, [r6, #0]
tst r4, r0
beq _020C1308
ldmia sp!, {r4, r5, r6, pc}
; .align 2, 0
_020C1320: .word OS_IRQTable
_020C1324: .word OSi_IrqThreadQueue
arm_func_end OS_WaitIrq

View File

@@ -0,0 +1,29 @@
#pragma once
.macro arm_func_start name
.balign 4, 0
.global \name
.type \name, @function
.arm
.endm
.macro arm_func_end name
.size \name, .-\name
.endm
.macro thumb_func_start name
.balign 4, 0
.global \name
.type \name, @function
.thumb
.endm
.macro non_word_aligned_thumb_func_start name
.global \name
.type \name, @function
.thumb
.endm
.macro thumb_func_end name
.size \name, .-\name
.endm

Some files were not shown because too many files have changed in this diff Show More