Merge pull request #13 from encounter/dtk-update

Update dtk-template & fix building all source files
This commit is contained in:
SwareJonge 2024-10-19 04:49:21 +02:00 committed by GitHub
commit 0247fc326a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
41 changed files with 1497 additions and 627 deletions

4
.flake8 Normal file
View File

@ -0,0 +1,4 @@
[flake8]
# E203: whitespace before ':'
# E501: line too long
extend-ignore = E203,E501

13
.gitattributes vendored Normal file
View File

@ -0,0 +1,13 @@
# Auto detect text files and perform LF normalization
* text=auto
# Explicitly declare text files
*.py text
# Enforce platform-specific encodings
*.bat text eol=crlf
*.sh text eol=lf
*.sha1 text eol=lf
# decomp-toolkit writes files with LF
config/**/*.txt text eol=lf

View File

@ -15,11 +15,10 @@ jobs:
version: [MarioClub_us]
steps:
# Checkout the repository (shallow clone)
# Checkout the repository
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
# Set Git config
@ -33,17 +32,33 @@ jobs:
# Build the project
- name: Build
run: |
python configure.py --version ${{ matrix.version }} \
python configure.py --map --version ${{ matrix.version }} \
--binutils /binutils --compilers /compilers
ninja build/${{ matrix.version }}/progress.json
ninja all_source build/${{ matrix.version }}/progress.json \
build/${{ matrix.version }}/report.json
# Upload progress if we're on the main branch
- name: Upload progress
if: github.ref == 'refs/heads/main'
continue-on-error: true
env:
PROGRESS_SLUG: mkdd
PROGRESS_API_KEY: ${{ secrets.PROGRESS_API_KEY }}
run: |
python tools/upload_progress.py -b https://progress.decomp.club/ \
-p mkdd -v ${{ matrix.version }} \
-p $PROGRESS_SLUG -v ${{ matrix.version }} \
build/${{ matrix.version }}/progress.json
# Upload map files
- name: Upload map
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.version }}_maps
path: build/${{ matrix.version }}/**/*.MAP
# Upload progress report
- name: Upload report
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.version }}_report
path: build/${{ matrix.version }}/report.json

56
.gitignore vendored
View File

@ -1,23 +1,43 @@
# IDE folders
.idea/
.vs/
# Caches
__pycache__
.vs
.vscode
build
devkitppc
expected
out
.mypy_cache
.cache/
# Original files
orig/*/*
!orig/*/.gitkeep
*.dol
*.rel
*.elf
*.o
*.map
*.MAP
# Build files
build/
.ninja_*
build.ninja
# decompctx output
ctx.*
*.ctx
# Generated configs
objdiff.json
compile_commands.json
# Miscellaneous
/*.txt
*.exe
*.dll
*.bin
*.bfn
*.arc
*.d
*.o
*.dol
*.elf
*.MAP
*.exe
*.dll
build.ninja
build_opts.yml
.ninja_log
.ninja_deps
objdiff.json
ctx.c
devkitppc
expected
out

10
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,10 @@
{
"recommendations": [
"llvm-vs-code-extensions.vscode-clangd",
],
"unwantedRecommendations": [
"ms-vscode.cmake-tools",
"ms-vscode.cpptools-extension-pack",
"ms-vscode.cpptools",
]
}

21
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,21 @@
{
"[c]": {
"files.encoding": "shiftjis",
"editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd"
},
"[cpp]": {
"files.encoding": "shiftjis",
"editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd"
},
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.associations": {
"*.inc": "c",
".clangd": "yaml"
},
// Disable C/C++ IntelliSense, use clangd instead
"C_Cpp.intelliSenseEngine": "disabled",
}

16
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,16 @@
{
// Use Ctrl+Shift+B to run build tasks.
// Or "Run Build Task" in the Command Palette.
"version": "2.0.0",
"tasks": [
{
"label": "ninja",
"type": "shell",
"command": "ninja",
"group": {
"kind": "build",
"isDefault": true
}
},
]
}

View File

@ -21,7 +21,8 @@ Currently only the debug version is supported
- Install python, 3.10.4 is recommended as it gets installed by default on most recent Linux distros
- Add the path where ninja is located to your environment variables under `PATH`
- Clone the repository using `git clone https://github.com/SwareJonge/mkdd`
- Dump a copy of the Debug version and extract `main.dol` and put it in `orig/MarioClub_us/`
- Dump a copy of the Debug version and copy the disc image to `orig/MarioClub_us`
- After the initial build, the disc image can be removed to save space
### Instructions
- run `python configure.py`

View File

@ -1,6 +1,7 @@
object: orig/MarioClub_us/main.dol
object_base: orig/MarioClub_us
object: sys/main.dol
hash: db87a9ec1a34275efc45d965dcdcb1a9eb131885
#map: orig/MarioClub_us/debugInfoM.MAP
#map: orig/MarioClub_us/files/debugInfoM.MAP
symbols: config/MarioClub_us/symbols.txt
splits: config/MarioClub_us/splits.txt
mw_comment_version: 8

View File

@ -5128,7 +5128,7 @@ __ptmf_test = .text:0x80105EA4; // type:function size:0x30 scope:global align:4
__ptmf_scall = .text:0x80105ED4; // type:function size:0x28 scope:global align:4
__ptmf_scall4 = .text:0x80105EFC; // type:function size:0x28 scope:global align:4
__cvt_fp2unsigned = .text:0x80105F24; // type:function size:0x5C scope:global align:4
__save_fpr = .text:0x80105F80; // type:function size:0x4C scope:local align:4
__save_fpr = .text:0x80105F80; // type:function size:0x4C scope:global align:4
_savefpr_14 = .text:0x80105F80; // type:label scope:global
_savefpr_15 = .text:0x80105F84; // type:label scope:global
_savefpr_16 = .text:0x80105F88; // type:label scope:global
@ -5147,7 +5147,7 @@ _savefpr_28 = .text:0x80105FB8; // type:label scope:global
_savefpr_29 = .text:0x80105FBC; // type:label scope:global
_savefpr_30 = .text:0x80105FC0; // type:label scope:global
_savefpr_31 = .text:0x80105FC4; // type:label scope:global
__restore_fpr = .text:0x80105FCC; // type:function size:0x4C scope:local align:4
__restore_fpr = .text:0x80105FCC; // type:function size:0x4C scope:global align:4
_restfpr_14 = .text:0x80105FCC; // type:label scope:global
_restfpr_15 = .text:0x80105FD0; // type:label scope:global
_restfpr_16 = .text:0x80105FD4; // type:label scope:global
@ -5166,7 +5166,7 @@ _restfpr_28 = .text:0x80106004; // type:label scope:global
_restfpr_29 = .text:0x80106008; // type:label scope:global
_restfpr_30 = .text:0x8010600C; // type:label scope:global
_restfpr_31 = .text:0x80106010; // type:label scope:global
__save_gpr = .text:0x80106018; // type:function size:0x4C scope:local align:4
__save_gpr = .text:0x80106018; // type:function size:0x4C scope:global align:4
_savegpr_14 = .text:0x80106018; // type:label scope:global
_savegpr_15 = .text:0x8010601C; // type:label scope:global
_savegpr_16 = .text:0x80106020; // type:label scope:global
@ -5185,7 +5185,7 @@ _savegpr_28 = .text:0x80106050; // type:label scope:global
_savegpr_29 = .text:0x80106054; // type:label scope:global
_savegpr_30 = .text:0x80106058; // type:label scope:global
_savegpr_31 = .text:0x8010605C; // type:label scope:global
__restore_gpr = .text:0x80106064; // type:function size:0x4C scope:local align:4
__restore_gpr = .text:0x80106064; // type:function size:0x4C scope:global align:4
_restgpr_14 = .text:0x80106064; // type:label scope:global
_restgpr_15 = .text:0x80106068; // type:label scope:global
_restgpr_16 = .text:0x8010606C; // type:label scope:global

View File

@ -1,5 +1,6 @@
# doesn't work yet!
object: orig/Release_eu/main.dol
object_base: orig/Release_eu
object: sys/main.dol
hash: f3bf225dd81cd9eb094fa9f8415f95f6bbcb9d10
symbols: config/Release_eu/symbols.txt
splits: config/Release_eu/splits.txt

147
configure.py Normal file → Executable file
View File

@ -1,3 +1,5 @@
#!/usr/bin/env python3
###
# Generates build files for the project.
# This file also includes the project configuration,
@ -70,11 +72,6 @@ parser.add_argument(
action="store_true",
help="generate map file(s)",
)
parser.add_argument(
"--no-asm",
action="store_true",
help="don't incorporate .s files from asm directory",
)
parser.add_argument(
"--debug",
action="store_true",
@ -93,6 +90,12 @@ parser.add_argument(
type=Path,
help="path to decomp-toolkit binary or source (optional)",
)
parser.add_argument(
"--objdiff",
metavar="BINARY | DIR",
type=Path,
help="path to objdiff-cli binary or source (optional)",
)
parser.add_argument(
"--sjiswrap",
metavar="EXE",
@ -110,32 +113,46 @@ parser.add_argument(
action="store_true",
help="builds equivalent (but non-matching) or modded objects",
)
parser.add_argument(
"--no-progress",
dest="progress",
action="store_false",
help="disable progress calculation",
)
args = parser.parse_args()
config = ProjectConfig()
config.version = str(args.version)
version_num = VERSIONS.index(config.version)
debug = args.debug
if config.version == "MarioClub_us":
debug = True
# Apply arguments
config.build_dir = args.build_dir
config.dtk_path = args.dtk
config.objdiff_path = args.objdiff
config.binutils_path = args.binutils
config.compilers_path = args.compilers
config.debug = args.debug
config.generate_map = args.map
config.non_matching = args.non_matching
config.sjiswrap_path = args.sjiswrap
config.progress = args.progress
if not is_windows():
config.wrapper = args.wrapper
if args.no_asm:
# Don't build asm unless we're --non-matching
if not config.non_matching:
config.asm_dir = None
# Disable sjiswrap
config.shift_jis = False
# Tool versions
config.binutils_tag = "2.42-1"
config.compilers_tag = "20231018"
config.dtk_tag = "v0.9.0"
config.compilers_tag = "20240706"
config.dtk_tag = "v1.1.4"
config.objdiff_tag = "v2.3.2"
config.sjiswrap_tag = "v1.1.1"
config.wibo_tag = "0.6.11"
@ -152,9 +169,12 @@ config.asflags = [
config.ldflags = [
"-fp hardware",
"-nodefaults",
"-warn off",
# "-listclosure", # Uncomment for Wii linkers
]
if debug:
config.ldflags.append("-g")
if args.map:
config.ldflags.append("-mapunused")
# Use for any additional files that should cause a re-configure when modified
config.reconfig_deps = []
@ -181,12 +201,8 @@ cflags_base = [
f"-i build/{config.version}/include"
]
if config.version == "MarioClub_us":
config.debug = True
# Debug flags
if config.debug:
if debug:
cflags_base.extend(["-DDEBUG=1", "-DHIO_SCREENSHOT=1"])
else:
cflags_base.append("-DNDEBUG=1")
@ -198,7 +214,7 @@ elif "_us" in config.version:
elif "_jp" in config.version:
cflags_base.extend(["-DREGION_JP=1",])
if config.non_matching == False:
if not config.non_matching:
cflags_base.extend(["-DMATCHING=1"])
# Metrowerks library flags
@ -256,17 +272,19 @@ def DolphinLib(lib_name: str, objects: List[Object]) -> Dict[str, Any]:
"objects": objects,
}
# Helper function for MSL libraries
def mslLib(lib_name: str, extra_cflags: str, objects: List[Object]) -> Dict[str, Any]:
def mslLib(lib_name: str, extra_cflags: List[str], objects: List[Object]) -> Dict[str, Any]:
return {
"lib": lib_name,
"src_dir": "libs/PowerPC_EABI_Support/src",
"mw_version": "GC/2.6",
"cflags": cflags_runtime + [ f"{extra_cflags}" ],
"cflags": cflags_runtime + extra_cflags,
"host": True,
"objects": objects,
}
def trkLib(lib_name: str, objects: List[Object]) -> Dict[str, Any]:
return {
"lib": lib_name,
@ -277,23 +295,25 @@ def trkLib(lib_name: str, objects: List[Object]) -> Dict[str, Any]:
"objects": objects,
}
# Helper function for JSystem libraries
def JSystemLib(lib_name: str, extra_cflags: str, objects: List[Object]) -> Dict[str, Any]:
def JSystemLib(lib_name: str, extra_cflags: List[str], objects: List[Object]) -> Dict[str, Any]:
return {
"lib": lib_name,
"src_dir": "libs",
"mw_version": "GC/2.6",
"cflags": cflags_jsystem + [ f"{extra_cflags}" ],
"cflags": cflags_jsystem + extra_cflags,
"host": True,
"objects": objects,
}
# Helper function for Game libraries
def GameLib(lib_name: str, extra_cflags: str, objects: List[Object]) -> Dict[str, Any]:
def GameLib(lib_name: str, extra_cflags: List[str], objects: List[Object]) -> Dict[str, Any]:
return {
"lib": lib_name,
"mw_version": "GC/2.6",
"cflags": cflags_game + [ f"{extra_cflags}" ],
"cflags": cflags_game + extra_cflags,
"host": True,
"objects": objects,
}
@ -303,23 +323,26 @@ Matching = True # Object matches and should be linked
NonMatching = False # Object does not match and should not be linked
Equivalent = config.non_matching # Object should be linked when configured with --non-matching
# Object is only matching for specific versions
def MatchingFor(*versions):
return config.version in versions
config.warn_missing_config = True
config.warn_missing_source = True
config.progress_all = False
#Object(Matching, "kartLocale.cpp")
config.libs = [
GameLib(
"Localize",
"",
[],
[
Object(Matching, "kartLocale.cpp")
Object(Matching, "kartLocale.cpp"),
]
),
mslLib(
"Runtime.PPCEABI.H",
"",
[],
[
Object(Matching, "Runtime/__mem.c"),
Object(Matching, "Runtime/__va_arg.c"),
@ -335,7 +358,7 @@ config.libs = [
),
mslLib(
"MSL_C.PPCEABI.H",
"-str pool -opt level=0, peephole, schedule, nospace -inline off -sym on",
["-str pool", "-opt level=0, peephole, schedule, nospace", "-inline off", "-sym on"],
[
Object(Matching, "MSL_C/PPC_EABI/abort_exit.c"),
Object(Matching, "MSL_C/MSL_Common/alloc.c"),
@ -368,7 +391,7 @@ config.libs = [
),
mslLib(
"fdlibm.PPCEABI.H",
"",
[],
[
Object(Matching, "MSL_C/MSL_Common_Embedded/Math/Double_precision/e_asin.c"),
Object(Matching, "MSL_C/MSL_Common_Embedded/Math/Double_precision/e_atan2.c"),
@ -400,7 +423,7 @@ config.libs = [
),
mslLib(
"MSL_C.PPCEABI.bare.H",
"",
[],
[
Object(Matching, "MSL_C/MSL_Common/extras.c")
]
@ -698,7 +721,7 @@ config.libs = [
),
JSystemLib(
"J2DGraph",
"-O4,s",
["-O4,s"],
[
Object(Matching, "JSystem/J2DGraph/J2DAnimation.cpp"),
Object(NonMatching, "JSystem/J2DGraph/J2DAnmLoader.cpp"),
@ -724,7 +747,7 @@ config.libs = [
),
JSystemLib(
"J3D",
"-O4,p",
["-O4,p"],
[
Object(NonMatching, "JSystem/J3D/GraphAnimator/J3DAnimation.cpp"),
Object(NonMatching, "JSystem/J3D/GraphAnimator/J3DCluster.cpp"),
@ -767,7 +790,7 @@ config.libs = [
),
JSystemLib(
"J3DU",
"-O4,p",
["-O4,p"],
[
Object(NonMatching, "JSystem/J3DU/J3DUPerf.cpp"),
Object(NonMatching, "JSystem/J3DU/J3DUDL.cpp"),
@ -777,7 +800,7 @@ config.libs = [
),
JSystemLib(
"JAudio",
"-O4,p",
["-O4,p"],
[
Object(Matching, "JSystem/JAudio/Interface/JAIAudience.cpp"),
Object(Matching, "JSystem/JAudio/Interface/JAISe.cpp"),
@ -835,10 +858,10 @@ config.libs = [
Object(NonMatching, "JSystem/JAudio/System/JASTrack.cpp"),
Object(NonMatching, "JSystem/JAudio/System/JASTrackPort.cpp"),
Object(Matching, "JSystem/JAudio/Task/dspproc.c", extra_cflags="-O4,s, -inline noauto -use_lmw_stmw off -func_align 32"),
Object(Matching, "JSystem/JAudio/Task/dsptask.c", extra_cflags="-O4,s, -inline noauto -use_lmw_stmw off -func_align 32"),
Object(Matching, "JSystem/JAudio/Task/osdsp.c", extra_cflags="-O4,s, -inline noauto -use_lmw_stmw off -func_align 32"),
Object(Matching, "JSystem/JAudio/Task/osdsp_task.c", extra_cflags="-O4,s, -inline noauto -use_lmw_stmw off -func_align 32"),
Object(Matching, "JSystem/JAudio/Task/dspproc.c", extra_cflags=["-O4,s", "-inline noauto", "-use_lmw_stmw off", "-func_align 32"]),
Object(Matching, "JSystem/JAudio/Task/dsptask.c", extra_cflags=["-O4,s", "-inline noauto", "-use_lmw_stmw off", "-func_align 32"]),
Object(Matching, "JSystem/JAudio/Task/osdsp.c", extra_cflags=["-O4,s", "-inline noauto", "-use_lmw_stmw off", "-func_align 32"]),
Object(Matching, "JSystem/JAudio/Task/osdsp_task.c", extra_cflags=["-O4,s", "-inline noauto", "-use_lmw_stmw off", "-func_align 32"]),
Object(Matching, "JSystem/JAudio/Utility/JAUAudioArcInterpreter.cpp"),
Object(Matching, "JSystem/JAudio/Utility/JAUAudioArcLoader.cpp"),
@ -859,7 +882,7 @@ config.libs = [
),
JSystemLib(
"JFramework",
"-O4,p",
["-O4,p"],
[
Object(Matching, "JSystem/JFramework/JFWSystem.cpp"),
Object(Matching, "JSystem/JFramework/JFWDisplay.cpp")
@ -867,7 +890,7 @@ config.libs = [
),
JSystemLib(
"JGadget",
"-O4,p",
["-O4,p"],
[
Object(Matching, "JSystem/JGadget/hashcode.cpp"),
Object(Matching, "JSystem/JGadget/linklist.cpp")
@ -875,7 +898,7 @@ config.libs = [
),
JSystemLib(
"JKernel",
"-O4,s",
["-O4,s"],
[
Object(Matching, "JSystem/JKernel/JKRAram.cpp"),
Object(Matching, "JSystem/JKernel/JKRAramArchive.cpp"),
@ -905,7 +928,7 @@ config.libs = [
),
JSystemLib(
"JMath",
"-O4,p",
["-O4,p"],
[
Object(Matching, "JSystem/JMath/JMath.cpp"),
Object(Matching, "JSystem/JMath/random.cpp"),
@ -914,7 +937,7 @@ config.libs = [
),
JSystemLib(
"JParticle",
"-O4,p",
["-O4,p"],
[
Object(Equivalent, "JSystem/JParticle/JPABaseShape.cpp"),
Object(NonMatching, "JSystem/JParticle/JPAChildShape.cpp"),
@ -935,7 +958,7 @@ config.libs = [
),
JSystemLib(
"JSupport",
"-O4,p",
["-O4,p"],
[
Object(Matching, "JSystem/JSupport/JSUInputStream.cpp"),
Object(Matching, "JSystem/JSupport/JSUList.cpp"),
@ -945,7 +968,7 @@ config.libs = [
),
JSystemLib(
"JUtility",
"-O4,s",
["-O4,s"],
[
Object(Matching, "JSystem/JUtility/JUTAssert.cpp"),
Object(Matching, "JSystem/JUtility/JUTConsole.cpp"),
@ -965,12 +988,12 @@ config.libs = [
Object(Matching, "JSystem/JUtility/JUTTexture.cpp"),
Object(Matching, "JSystem/JUtility/JUTVideo.cpp"),
Object(Matching, "JSystem/JUtility/JUTXfb.cpp"),
Object(Matching, "JSystem/JUtility/JUTFontData_Ascfont_fix12.s", extra_asflags=f"-I build/{config.version}/bin",)
Object(Matching, "JSystem/JUtility/JUTFontData_Ascfont_fix12.s", extra_asflags=[f"-I build/{config.version}/bin"],)
]
),
JSystemLib(
"Logitech",
"-O4,p",
["-O4,p"],
[
Object(NonMatching, "JSystem/Logitech/Conditon.cpp"),
Object(NonMatching, "JSystem/Logitech/Constant.cpp"),
@ -983,14 +1006,14 @@ config.libs = [
),
GameLib(
"Bando",
"",
[],
[
Object(Matching, "Bando/EngineSound.cpp")
]
),
GameLib(
"Inagaki",
"",
[],
[
Object(NonMatching, "Inagaki/CharacterSoundMgr.cpp"),
Object(NonMatching, "Inagaki/GameAudioCamera.cpp"),
@ -1014,7 +1037,7 @@ config.libs = [
),
GameLib(
"Kameda",
"",
[],
[
Object(NonMatching, "Kameda/Motor.cpp"),
Object(NonMatching, "Kameda/MotorManager.cpp"),
@ -1064,7 +1087,7 @@ config.libs = [
),
GameLib(
"Kaneshige",
"-inline off",
["-inline off"],
[
Object(Matching, "Kaneshige/DrawBuffer.cpp"),
Object(Equivalent, "Kaneshige/Course/Course.cpp"),
@ -1142,7 +1165,7 @@ config.libs = [
),
GameLib(
"Kawano",
"",
[],
[
Object(NonMatching, "Kawano/driverData.cpp"),
Object(NonMatching, "Kawano/driver.cpp"),
@ -1165,7 +1188,7 @@ config.libs = [
),
GameLib(
"Osako",
"",
[],
[
Object(Matching, "Osako/clock.cpp"),
Object(NonMatching, "Osako/animator.cpp"),
@ -1222,7 +1245,7 @@ config.libs = [
),
GameLib(
"Sato",
"",
[],
[
Object(NonMatching, "Sato/logbridge.cpp"),
Object(Matching, "Sato/stMath.cpp"),
@ -1278,7 +1301,7 @@ config.libs = [
),
GameLib(
"Shiraiwa",
"",
[],
[
Object(NonMatching, "Shiraiwa/Coord3D.cpp"),
Object(NonMatching, "Shiraiwa/MapObjDossun.cpp"),
@ -1367,7 +1390,7 @@ config.libs = [
),
GameLib(
"Yamamoto",
"-inline off",
["-inline off"],
[
Object(NonMatching, "Yamamoto/kartBody.cpp"),
Object(Matching, "Yamamoto/kartCamera.cpp"),
@ -1407,12 +1430,18 @@ config.libs = [
),
]
# Optional extra categories for progress tracking
config.progress_categories = [
# ProgressCategory("game", "Game Code"),
# ProgressCategory("sdk", "SDK Code"),
]
config.progress_each_module = args.verbose
if args.mode == "configure":
# Write build.ninja and objdiff.json
generate_build(config)
elif args.mode == "progress":
# Print progress and write progress.json
config.progress_each_module = args.verbose
calculate_progress(config)
else:
sys.exit("Unknown mode: " + args.mode)

View File

@ -8,8 +8,11 @@
#include "JSystem/JAudio/System/JASHeapCtrl.h"
#include "JSystem/JAudio/System/JASTrack.h"
template <>
JASMemPool_MultiThreaded<JASTrack::TChannelMgr> JASPoolAllocObject_MultiThreaded<JASTrack::TChannelMgr>::memPool_;
template <>
JASMemPool_MultiThreaded<JASTrack> JASPoolAllocObject_MultiThreaded<JASTrack>::memPool_;
template <>
JASMemPool_MultiThreaded<JASChannel> JASPoolAllocObject_MultiThreaded<JASChannel>::memPool_;
#endif

View File

@ -7,6 +7,7 @@
class JAISe;
#include "JSystem/JAudio/JASFakeMatch.h"
template <>
JASMemPool<JAISe> JASPoolAllocObject<JAISe>::memPool_;
#endif

View File

@ -10,9 +10,13 @@ class JAISeq;
class JAISe;
#include "JSystem/JAudio/JASFakeMatch.h"
template <>
JASMemPool<JAIStream> JASPoolAllocObject<JAIStream>::memPool_;
template <>
JASMemPool<JAISoundChild> JASPoolAllocObject<JAISoundChild>::memPool_;
template <>
JASMemPool<JAISeq> JASPoolAllocObject<JAISeq>::memPool_;
template <>
JASMemPool<JAISe> JASPoolAllocObject<JAISe>::memPool_;
#endif

View File

@ -136,6 +136,7 @@ JAUSectionHeap *JAUNewSectionHeap(bool);
// TODO: probably move this to a different file(JASFakeMatch?)
#define createJASInstance(TYPE) \
template <> \
DECL_WEAK TYPE *JASGlobalInstance<TYPE>::sInstance
createJASInstance(JAUSectionHeap);

View File

@ -54,10 +54,10 @@ struct TBox2 : TBox<TVec2<T> > {
TBox2(f32 x0, f32 y0, const TVec2<f32>& f) { set(x0, y0, x0 + f.x, y0 + f.y); }
TBox2(f32 val)
{
f.y = val;
f.x = val;
i.y = val;
i.x = val;
this->f.y = val;
this->f.x = val;
this->i.y = val;
this->i.x = val;
}
void absolute() {
@ -77,7 +77,7 @@ struct TBox2 : TBox<TVec2<T> > {
void set(const TBox2& other) { set(other.i, other.f); }
void set(const TVec2<f32>& i, const TVec2<f32>& f) { this->i.set(i), this->f.set(f); }
void set(f32 x0, f32 y0, f32 x1, f32 y1) { i.set(x0, y0); f.set(x1, y1); }
void set(f32 x0, f32 y0, f32 x1, f32 y1) { this->i.set(x0, y0); this->f.set(x1, y1); }
};
// clang-format on

View File

@ -139,22 +139,22 @@ namespace JGeometry {
void identity() // TODO: OK?
{
const T zero = (T)0;
ref(2, 3) = zero;
ref(1, 3) = zero;
ref(0, 3) = zero;
this->ref(2, 3) = zero;
this->ref(1, 3) = zero;
this->ref(0, 3) = zero;
ref(1, 2) = zero;
ref(0, 2) = zero;
this->ref(1, 2) = zero;
this->ref(0, 2) = zero;
ref(2, 1) = zero;
ref(0, 1) = zero;
ref(2, 0) = zero;
ref(1, 0) = zero;
this->ref(2, 1) = zero;
this->ref(0, 1) = zero;
this->ref(2, 0) = zero;
this->ref(1, 0) = zero;
const T one = TUtil<T>::one();
ref(2, 2) = one;
ref(1, 1) = one;
ref(0, 0) = one;
this->ref(2, 2) = one;
this->ref(1, 1) = one;
this->ref(0, 0) = one;
}
void concat(const T &rSrcA, const T &rSrcB);
void concat(const T &rSrc);
@ -174,17 +174,17 @@ namespace JGeometry {
void getXDir(TVec3f &rDest) const
{
rDest.set<f32>(mMtx[0][0], mMtx[1][0], mMtx[2][0]);
rDest.set<f32>(this->mMtx[0][0], this->mMtx[1][0], this->mMtx[2][0]);
};
void getYDir(TVec3f &rDest) const
{
rDest.set<f32>(mMtx[0][1], mMtx[1][1], mMtx[2][1]);
rDest.set<f32>(this->mMtx[0][1], this->mMtx[1][1], this->mMtx[2][1]);
};
void getZDir(TVec3f &rDest) const
{
rDest.set<f32>(mMtx[0][2], mMtx[1][2], mMtx[2][2]);
rDest.set<f32>(this->mMtx[0][2], this->mMtx[1][2], this->mMtx[2][2]);
};
void getXYZDir(TVec3f &rDestX, TVec3f &rDestY, TVec3f &rDestZ) const;
@ -196,15 +196,15 @@ namespace JGeometry {
void setZDir(f32 x, f32 y, f32 z);
void setXYZDir(const TVec3f &rSrcX, const TVec3f &rSrcY, const TVec3f &rSrcZ)
{
ref(0, 0) = rSrcX.x;
ref(1, 0) = rSrcX.y;
ref(2, 0) = rSrcX.z;
ref(0, 1) = rSrcY.x;
ref(1, 1) = rSrcY.y;
ref(2, 1) = rSrcY.z;
ref(0, 2) = rSrcZ.x;
ref(1, 2) = rSrcZ.y;
ref(2, 2) = rSrcZ.z;
this->ref(0, 0) = rSrcX.x;
this->ref(1, 0) = rSrcX.y;
this->ref(2, 0) = rSrcX.z;
this->ref(0, 1) = rSrcY.x;
this->ref(1, 1) = rSrcY.y;
this->ref(2, 1) = rSrcY.z;
this->ref(0, 2) = rSrcZ.x;
this->ref(1, 2) = rSrcZ.y;
this->ref(2, 2) = rSrcZ.z;
}
void getEuler(TVec3f &rDest) const;
@ -226,9 +226,9 @@ namespace JGeometry {
inline void getXDirInline(TVec3f &rDest) const
{
f32 z = mMtx[2][0];
f32 y = mMtx[1][0];
f32 x = mMtx[0][0];
f32 z = this->mMtx[2][0];
f32 y = this->mMtx[1][0];
f32 x = this->mMtx[0][0];
rDest.set(x, y, z);
}
@ -253,9 +253,9 @@ namespace JGeometry {
void setTrans(f32 x, f32 y, f32 z);
void zeroTrans()
{
ref(0, 3) = 0.0f;
ref(1, 3) = 0.0f;
ref(2, 3) = 0.0f;
this->ref(0, 3) = 0.0f;
this->ref(1, 3) = 0.0f;
this->ref(2, 3) = 0.0f;
}
void makeRotate(const TVec3f &, f32);
@ -265,9 +265,9 @@ namespace JGeometry {
inline void getTransInline(TVec3f &rDest) const
{
f32 z = mMtx[2][3];
f32 y = mMtx[1][3];
f32 x = mMtx[0][3];
f32 z = this->mMtx[2][3];
f32 y = this->mMtx[1][3];
f32 x = this->mMtx[0][3];
rDest.set(x, y, z);
}
};

View File

@ -12,8 +12,8 @@ namespace JGeometry {
/* Constructors */
inline TQuat4() {}
template <typename T>
TQuat4(T _x, T _y, T _z, T _w)
template <typename A>
TQuat4(A _x, A _y, A _z, A _w)
{
x = _x;
y = _y;

View File

@ -28,7 +28,7 @@ namespace JGeometry {
return equal;
}
f32 invert(f32 x) { return 1.0f/x; }
static f32 invert(f32 x) { return 1.0f/x; }
static f32 sqrt(f32 x)
{

View File

@ -7,6 +7,7 @@
namespace JGeometry {
inline void setTVec3f(register const f32 *src, register f32 *dst)
{
#ifdef __MWERKS__
register f32 xy, z;
__asm {
// clang-format off
@ -16,10 +17,12 @@ namespace JGeometry {
stfs z, 8(dst)
// clang-format on
}
#endif
}
inline void negateInternal(register const f32 *src, register f32 *dst)
{
#ifdef __MWERKS__
register f32 xy;
__asm {
// clang-format off
@ -29,10 +32,12 @@ namespace JGeometry {
// clang-format on
}
dst[2] = -src[2];
#endif
}
inline void mulInternal(register const f32 *vec1, register const f32 *vec2, register f32 *dst)
{
#ifdef __MWERKS__
register f32 xy1, xy2, res;
__asm {
// clang-format off
@ -43,6 +48,7 @@ namespace JGeometry {
// clang-format on
}
dst[2] = vec1[2] * vec2[2];
#endif
}
template <typename T>

View File

@ -12,7 +12,7 @@ public:
void getTagName(u32); // UNUSED
virtual ~RaceSceneLight(); // overide
virtual Mtx *getEffectMtx(); // overide
virtual MtxPtr getEffectMtx(); // overide
virtual void calc(); // overide
private:
u8 _90[0xf4 - 0x90];
@ -23,7 +23,7 @@ class RaceBalloonLight : public LtObjDiffuse
public:
RaceBalloonLight(u32);
virtual ~RaceBalloonLight(); // overide
virtual Mtx *getEffectMtx(); // overide
virtual MtxPtr getEffectMtx(); // overide
virtual void draw(); // overide
private:
@ -36,7 +36,7 @@ public:
RaceKartLight(RaceSceneLight *, int);
virtual ~RaceKartLight(); // overide
virtual Mtx *getEffectMtx(); // overide
virtual MtxPtr getEffectMtx(); // overide
virtual void draw(); // overide
virtual void calc(); // overide

View File

@ -87,7 +87,7 @@ public:
// Virtual Table
virtual void update(u16); // override
virtual void createModel(JKRSolidHeap *, u32, u32); // override
virtual bool createModel(JKRSolidHeap *, u32, u32); // override
virtual void setCurrentViewNo(u32); // override
virtual ~DriverModel();

View File

@ -20,9 +20,15 @@
#define CLEAR_PATH(x) __memclr((x), sizeof((x)))
#define ALIGN(x) __attribute__((aligned(x)))
#ifdef __MWERKS__
#define DECL_SECTION(x) __declspec(section x)
#define DECL_WEAK __declspec(weak)
#define DONT_INLINE __attribute__((never_inline))
#else
#define DECL_SECTION(x)
#define DECL_WEAK __attribute__((weak))
#define DONT_INLINE __attribute__((noinline))
#endif
// Align X to the previous N bytes (N must be power of two)
#define ALIGN_PREV(X, N) ((X) & ~((N)-1))

View File

@ -12,7 +12,11 @@ int __fpclassifyf(float);
int __signbitd(double);
int __fpclassifyd(double);
inline int __fpclassifyf(f32 x)
#ifndef MATH_INLINE
#define MATH_INLINE inline
#endif
MATH_INLINE int __fpclassifyf(f32 x)
{
switch ((*(s32*)&x) & 0x7f800000) {
case 0x7f800000: {
@ -32,7 +36,8 @@ inline int __fpclassifyf(f32 x)
}
return 4;
}
inline int __fpclassifyd(f64 x)
MATH_INLINE int __fpclassifyd(f64 x)
{
switch (__HI(x) & 0x7ff00000) {
case 0x7ff00000: {

View File

@ -0,0 +1,231 @@
#ifndef _RUNTIME_GECKO_EXCEPTIONPPC_H
#define _RUNTIME_GECKO_EXCEPTIONPPC_H
#include "types.h"
typedef u8 exaction_type;
#define EXACTION_ENDBIT 0x80
#define EXACTION_MASK 0x7F
// EXAction structs
#define EXACTION_ENDOFLIST 0
#define EXACTION_BRANCH 1
typedef struct ex_branch {
exaction_type action;
u8 unused;
u16 target;
} ex_branch;
#define EXACTION_DESTROYLOCAL 2
typedef struct ex_destroylocal {
exaction_type action;
u8 unused;
s16 local;
void* dtor;
} ex_destroylocal;
#define EXACTION_DESTROYLOCALCOND 3
typedef struct ex_destroylocalcond {
exaction_type action;
u8 dlc_field;
s16 cond;
s16 local;
void* dtor;
} ex_destroylocalcond;
#define ex_destroylocalcond_MakeField(regcond) (((regcond) << 7))
#define ex_destroylocalcond_GetRegCond(field) ((field) >> 7)
#define EXACTION_DESTROYLOCALPOINTER 4
typedef struct ex_destroylocalpointer {
exaction_type action;
u8 dlp_field;
s16 pointer;
void* dtor;
} ex_destroylocalpointer;
#define ex_destroylocalpointer_MakeField(regpointer) (((regpointer) << 7))
#define ex_destroylocalpointer_GetRegPointer(field) ((field) >> 7)
#define EXACTION_DESTROYLOCALARRAY 5
typedef struct ex_destroylocalarray {
exaction_type action;
u8 unused;
s16 localarray;
u16 elements;
u16 element_size;
void* dtor;
} ex_destroylocalarray;
#define EXACTION_DESTROYBASE 6
#define EXACTION_DESTROYMEMBER 7
typedef struct ex_destroymember {
exaction_type action;
u8 dm_field;
s16 objectptr;
s32 offset;
void* dtor;
} ex_destroymember;
#define ex_destroymember_MakeField(regpointer) (((regpointer) << 7))
#define ex_destroymember_GetRegPointer(field) ((field) >> 7)
#define EXACTION_DESTROYMEMBERCOND 8
typedef struct ex_destroymembercond {
exaction_type action;
u8 dmc_field;
s16 cond;
s16 objectptr;
s32 offset;
void* dtor;
} ex_destroymembercond;
#define ex_destroymembercond_MakeField(regcond, regpointer) (((regcond) << 7) | (((regpointer)&0x1) << 6))
#define ex_destroymembercond_GetRegCond(field) ((field) >> 7)
#define ex_destroymembercond_GetRegPointer(field) (((field) >> 6) & 0x1)
#define EXACTION_DESTROYMEMBERARRAY 9
typedef struct ex_destroymemberarray {
exaction_type action;
u8 dma_field;
s16 objectptr;
s32 offset;
s32 elements;
s32 element_size;
void* dtor;
} ex_destroymemberarray;
#define ex_destroymemberarray_MakeField(regpointer) (((regpointer) << 7))
#define ex_destroymemberarray_GetRegPointer(field) ((field) >> 7)
#define EXACTION_DELETEPOINTER 10
typedef struct ex_deletepointer {
exaction_type action;
u8 dp_field;
s16 objectptr;
void* deletefunc;
} ex_deletepointer;
#define ex_deletepointer_MakeField(regpointer) (((regpointer) << 7))
#define ex_deletepointer_GetRegPointer(field) ((field) >> 7)
#define EXACTION_DELETEPOINTERCOND 11
typedef struct ex_deletepointercond {
exaction_type action;
u8 dpc_field;
s16 cond;
s16 objectptr;
void* deletefunc;
} ex_deletepointercond;
#define ex_deletepointercond_MakeField(regcond, regpointer) (((regcond) << 7) | (((regpointer)&0x1) << 6))
#define ex_deletepointercond_GetRegCond(field) ((field) >> 7)
#define ex_deletepointercond_GetRegPointer(field) (((field) >> 6) & 0x1)
#define EXACTION_CATCHBLOCK 12
typedef struct ex_catchblock {
exaction_type action;
u8 unused;
char* catch_type;
u16 catch_pcoffset;
s16 cinfo_ref;
} ex_catchblock;
#define EXACTION_ACTIVECATCHBLOCK 13
typedef struct ex_activecatchblock {
exaction_type action;
u8 unused;
s16 cinfo_ref;
} ex_activecatchblock;
#define EXACTION_TERMINATE 14
typedef struct ex_terminate {
exaction_type action;
u8 unused;
} ex_terminate;
#define EXACTION_SPECIFICATION 15
typedef struct ex_specification {
exaction_type action;
u8 unused;
u16 specs;
s32 pcoffset;
s32 cinfo_ref;
char* spec[];
} ex_specification;
#define EXACTION_CATCHBLOCK_32 16
typedef struct ex_catchblock_32 {
exaction_type action;
u8 unused;
char* catch_type;
s32 catch_pcoffset;
s32 cinfo_ref;
} ex_catchblock_32;
// Other structs
typedef struct ExceptionRangeSmall {
u16 start;
u16 end;
u16 action;
} ExceptionRangeSmall;
typedef struct ExceptionTableSmall {
u16 et_field;
ExceptionRangeSmall ranges[0];
} ExceptionTableSmall;
typedef struct ExceptionRangeLarge {
u32 start;
u16 size;
u16 action;
} ExceptionRangeLarge;
typedef struct ExceptionTableLarge {
u16 et_field;
u16 et_field2;
ExceptionRangeLarge ranges[];
} ExceptionTableLarge;
#define ET_MakeField(savedGPRs, savedFPRs, savedCR, hasframeptr, isLarge) \
(((savedGPRs) << 11) | ((savedFPRs & 0x1f) << 6) | ((savedCR & 0x1) << 5) | ((hasframeptr & 0x1) << 4) | ((isLarge & 1) << 3))
#define ET_GetSavedGPRs(field) ((field) >> 11)
#define ET_GetSavedFPRs(field) (((field) >> 6) & 0x1f)
#define ET_GetSavedCR(field) (((field) >> 5) & 0x1)
#define ET_GetHasFramePtr(field) (((field) >> 4) & 0x1)
#define ET_IsLargeTable(field) (((field) >> 3) & 0x1)
#define ET_ClearLargeBit(field) ((field) & ~(1 << 3))
#define ET_SetLargeBit(field) ((field) | (1 << 3))
#define ET_HasElfVector(field) (((field) >> 1) & 0x1)
typedef struct ExceptionTableIndex {
u32 functionoffset;
u32 eti_field;
u32 exceptionoffset;
} ExceptionTableIndex;
#define ETI_MakeField(direct, fsize) ((((s32)(direct)) << 31) | ((fsize)&0x7fffffff))
#define ETI_GetDirectStore(field) ((field) >> 31)
#define ETI_GetFunctionSize(field) ((field)&0x7fffffff)
#endif

View File

@ -8,21 +8,24 @@
extern "C" {
#endif
#define CTORARG_TYPE int
#define CTORARG_PARTIAL (0)
#define CTORARG_COMPLETE (1)
typedef s16 vbase_ctor_arg_type;
typedef char local_cond_type;
#define CTORCALL_COMPLETE(ctor, objptr) (((void (*)(void*, CTORARG_TYPE))ctor)(objptr, CTORARG_COMPLETE))
#define DTORARG_TYPE int
#define DTORCALL_COMPLETE(dtor, objptr) (((void (*)(void*, DTORARG_TYPE))dtor)(objptr, -1))
typedef struct CatchInfo {
void* location;
void* typeinfo;
void* dtor;
void* sublocation;
s32 pointercopy;
void* stacktop;
} CatchInfo;
void __unregister_fragment(int fragmentID);
// struct __eti_init_info* info
int __register_fragment(void* info, char* TOC);
void* __register_global_object(void* object, void* destructor, void* regmem);
void __destroy_global_chain(void);
extern char __throw_catch_compare(const char* throwtype, const char* catchtype, s32* offset_result);
#ifdef __cplusplus
}

View File

@ -1,13 +1,14 @@
#ifndef RUNTIME_MEM_H
#define RUNTIME_MEM_H
#include "macros.h"
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
__declspec(section ".init") void* memcpy(void* dest, const void* src, size_t n);
__declspec(section ".init") void __fill_mem(void* dest, int val, size_t count);
__declspec(section ".init") void* memset(void* dest, int val, size_t count);
DECL_SECTION(".init") void* memcpy(void* dest, const void* src, size_t n);
DECL_SECTION(".init") void __fill_mem(void* dest, int val, size_t count);
DECL_SECTION(".init") void* memset(void* dest, int val, size_t count);
#ifdef __cplusplus
}

View File

@ -1,17 +1,19 @@
#ifndef __PPC_EABI_LINKER
#define __PPC_EABI_LINKER
#define __ppc_eabi_linker
__declspec(section ".init") extern char _stack_addr[];
__declspec(section ".init") extern char _stack_end[];
__declspec(section ".init") extern char _heap_addr[];
__declspec(section ".init") extern char _heap_end[];
__declspec(section ".init") extern const char _fextabindex_rom[];
__declspec(section ".init") extern char _fextabindex[];
__declspec(section ".init") extern char _eextabindex[];
#include "macros.h"
__declspec(section ".init") extern char _SDA_BASE_[];
DECL_SECTION(".init") extern char _stack_addr[];
DECL_SECTION(".init") extern char _stack_end[];
DECL_SECTION(".init") extern char _heap_addr[];
DECL_SECTION(".init") extern char _heap_end[];
DECL_SECTION(".init") extern const char _fextabindex_rom[];
DECL_SECTION(".init") extern char _fextabindex[];
DECL_SECTION(".init") extern char _eextabindex[];
__declspec(section ".init") extern char _SDA2_BASE_[];
DECL_SECTION(".init") extern char _SDA_BASE_[];
DECL_SECTION(".init") extern char _SDA2_BASE_[];
typedef struct __rom_copy_info {
char* rom;
@ -19,14 +21,14 @@ typedef struct __rom_copy_info {
unsigned int size;
} __rom_copy_info;
__declspec(section ".init") extern __rom_copy_info _rom_copy_info[];
DECL_SECTION(".init") extern __rom_copy_info _rom_copy_info[];
typedef struct __bss_init_info {
char* addr;
unsigned int size;
} __bss_init_info;
__declspec(section ".init") extern __bss_init_info _bss_init_info[];
DECL_SECTION(".init") extern __bss_init_info _bss_init_info[];
typedef struct __eti_init_info {
void* eti_start;
@ -35,38 +37,38 @@ typedef struct __eti_init_info {
unsigned long code_size;
} __eti_init_info;
__declspec(section ".init") extern __eti_init_info _eti_init_info[];
__declspec(section ".init") extern const char _f_init_rom[];
__declspec(section ".init") extern char _f_init[];
__declspec(section ".init") extern char _e_init[];
__declspec(section ".init") extern const char _f_text_rom[];
__declspec(section ".init") extern char _f_text[];
__declspec(section ".init") extern char _e_text[];
__declspec(section ".init") extern const char _f_rodata_rom[];
__declspec(section ".init") extern char _f_rodata[];
__declspec(section ".init") extern char _e_rodata[];
__declspec(section ".init") extern const char _fextab_rom[];
__declspec(section ".init") extern char _fextab[];
__declspec(section ".init") extern char _eextab[];
__declspec(section ".init") extern const char _f_data_rom[];
__declspec(section ".init") extern char _f_data[];
__declspec(section ".init") extern char _e_data[];
__declspec(section ".init") extern char _f_bss[];
__declspec(section ".init") extern char _e_bss[];
__declspec(section ".init") extern const char _f_sdata_rom[];
__declspec(section ".init") extern char _f_sdata[];
__declspec(section ".init") extern char _e_sdata[];
__declspec(section ".init") extern char _f_sbss[];
__declspec(section ".init") extern char _e_sbss[];
__declspec(section ".init") extern const char _f_sdata2_rom[];
__declspec(section ".init") extern char _f_sdata2[];
__declspec(section ".init") extern char _e_sdata2[];
__declspec(section ".init") extern char _f_sbss2[];
__declspec(section ".init") extern char _e_sbss2[];
__declspec(section ".init") extern const char _f_PPC_EMB_sdata0_rom[];
__declspec(section ".init") extern char _f_PPC_EMB_sdata0[];
__declspec(section ".init") extern char _e_PPC_EMB_sdata0[];
__declspec(section ".init") extern char _f_PPC_EMB_sbss0[];
__declspec(section ".init") extern char _e_PPC_EMB_sbss0[];
DECL_SECTION(".init") extern __eti_init_info _eti_init_info[];
DECL_SECTION(".init") extern const char _f_init_rom[];
DECL_SECTION(".init") extern char _f_init[];
DECL_SECTION(".init") extern char _e_init[];
DECL_SECTION(".init") extern const char _f_text_rom[];
DECL_SECTION(".init") extern char _f_text[];
DECL_SECTION(".init") extern char _e_text[];
DECL_SECTION(".init") extern const char _f_rodata_rom[];
DECL_SECTION(".init") extern char _f_rodata[];
DECL_SECTION(".init") extern char _e_rodata[];
DECL_SECTION(".init") extern const char _fextab_rom[];
DECL_SECTION(".init") extern char _fextab[];
DECL_SECTION(".init") extern char _eextab[];
DECL_SECTION(".init") extern const char _f_data_rom[];
DECL_SECTION(".init") extern char _f_data[];
DECL_SECTION(".init") extern char _e_data[];
DECL_SECTION(".init") extern char _f_bss[];
DECL_SECTION(".init") extern char _e_bss[];
DECL_SECTION(".init") extern const char _f_sdata_rom[];
DECL_SECTION(".init") extern char _f_sdata[];
DECL_SECTION(".init") extern char _e_sdata[];
DECL_SECTION(".init") extern char _f_sbss[];
DECL_SECTION(".init") extern char _e_sbss[];
DECL_SECTION(".init") extern const char _f_sdata2_rom[];
DECL_SECTION(".init") extern char _f_sdata2[];
DECL_SECTION(".init") extern char _e_sdata2[];
DECL_SECTION(".init") extern char _f_sbss2[];
DECL_SECTION(".init") extern char _e_sbss2[];
DECL_SECTION(".init") extern const char _f_PPC_EMB_sdata0_rom[];
DECL_SECTION(".init") extern char _f_PPC_EMB_sdata0[];
DECL_SECTION(".init") extern char _e_PPC_EMB_sdata0[];
DECL_SECTION(".init") extern char _f_PPC_EMB_sbss0[];
DECL_SECTION(".init") extern char _e_PPC_EMB_sbss0[];
#endif // __PPC_EABI_LINKER

View File

@ -7,16 +7,6 @@
extern "C" {
#endif
#define CTORARG_TYPE int
#define CTORARG_PARTIAL (0)
#define CTORARG_COMPLETE (1)
#define CTORCALL_COMPLETE(ctor, objptr) (((void (*)(void*, CTORARG_TYPE))ctor)(objptr, CTORARG_COMPLETE))
#define DTORARG_TYPE int
#define DTORCALL_COMPLETE(dtor, objptr) (((void (*)(void*, DTORARG_TYPE))dtor)(objptr, -1))
typedef struct DestructorChain {
struct DestructorChain* next;
void* destructor;

View File

@ -1,53 +1,12 @@
#define MATH_INLINE
#include "PowerPC_EABI_Support/MSL_C/PPC_EABI/math_ppc.h"
#include "fdlibm.h"
int __fpclassifyf(float x)
{
switch ((*(s32 *)&x) & 0x7f800000)
{
case 0x7f800000:
{
if ((*(s32 *)&x) & 0x007fffff)
return 1;
else
return 2;
break;
}
case 0:
{
if ((*(s32 *)&x) & 0x007fffff)
return 5;
else
return 3;
break;
}
}
return 4;
}
// Generated via math_api.h
// int __fpclassifyf(float x);
int __fpclassifyd(double x)
{
switch (__HI(x) & 0x7ff00000)
{
case 0x7ff00000:
{
if ((__HI(x) & 0x000fffff) || (__LO(x) & 0xffffffff))
return 1;
else
return 2;
break;
}
case 0:
{
if ((__HI(x) & 0x000fffff) || (__LO(x) & 0xffffffff))
return 5;
else
return 3;
break;
}
}
return 4;
}
// Generated via math_api.h
// int __fpclassifyd(double x);
/*double scalbn(double x, int y)
{
@ -324,11 +283,11 @@ void atan2f(void)
// UNUSED FUNCTION
}*/
__declspec(weak) float cosf(float __x) { return cos((double)__x); }
DECL_WEAK float cosf(float __x) { return cos((double)__x); }
__declspec(weak) float sinf(float __x) { return sin((double)__x); }
DECL_WEAK float sinf(float __x) { return sin((double)__x); }
__declspec(weak) float tanf(float __x) { return tan((double)__x); }
DECL_WEAK float tanf(float __x) { return tan((double)__x); }
/*void coshf(void)
{

View File

@ -1,6 +1,5 @@
#include "PowerPC_EABI_Support/Runtime/MWCPlusLib.h"
#include <exception.h>
#include "PowerPC_EABI_Support/Runtime/Gecko_ExceptionPPC.h"
#include "PowerPC_EABI_Support/Runtime/MWCPlusPlusLib.h"
#include "PowerPC_EABI_Support/Runtime/NMWException.h"
#include "PowerPC_EABI_Support/Runtime/__ppc_eabi_linker.h"
@ -238,7 +237,7 @@ static exaction_type ExPPC_NextAction(ActionIterator* iter){
ExPPC_FindExceptionRecord(return_addr, &iter->info);
if(iter->info.exception_record == 0){
terminate();
std::terminate();
}
iter->current_SP = callers_SP;
@ -288,7 +287,7 @@ static exaction_type ExPPC_NextAction(ActionIterator* iter){
iter->info.action_pointer += sizeof(ex_specification) + ((ex_specification*)iter->info.action_pointer)->specs * sizeof(void*);
break;
default:
terminate();
std::terminate();
}
}
@ -436,7 +435,7 @@ static void ExPPC_UnwindStack(ThrowContext* context, MWExceptionInfo* info, void
ExPPC_FindExceptionRecord(return_addr, info);
if(info->exception_record == 0){
terminate();
std::terminate();
}
context->FP = (ET_GetHasFramePtr(info->exception_record->et_field)) ? (char*)context->GPR[31] : context->SP;
@ -518,7 +517,7 @@ static void ExPPC_UnwindStack(ThrowContext* context, MWExceptionInfo* info, void
info->action_pointer += sizeof(ex_specification) + ((ex_specification*)info->action_pointer)->specs * sizeof(void*);
break;
default:
terminate();
std::terminate();
}
if(action & EXACTION_ENDBIT) info->action_pointer = 0;
@ -656,7 +655,7 @@ static void ExPPC_ThrowHandler(ThrowContext* context){
ExPPC_FindExceptionRecord(context->returnaddr, &info);
if(info.exception_record == 0){
terminate();
std::terminate();
}
context->FP = (ET_GetHasFramePtr(info.exception_record->et_field)) ? (char*)context->GPR[31] : context->SP;
@ -688,7 +687,7 @@ static void ExPPC_ThrowHandler(ThrowContext* context){
continue;
case EXACTION_TERMINATE:
default:
terminate();
std::terminate();
}
break;
}
@ -739,7 +738,7 @@ static void ExPPC_ThrowHandler(ThrowContext* context){
continue;
case EXACTION_TERMINATE:
default:
terminate();
std::terminate();
}
break;
}

View File

@ -1,4 +1,5 @@
#include "PowerPC_EABI_Support/Runtime/NMWException.h"
#include "PowerPC_EABI_Support/Runtime/MWCPlusPlusLib.h"
#pragma exceptions on
@ -14,14 +15,14 @@ namespace std
abort();
}
static terminate_handler thandler = dthandler;
terminate_handler thandler = dthandler;
static void duhandler()
{
terminate();
}
static unexpected_handler uhandler = duhandler;
unexpected_handler uhandler = duhandler;
extern void terminate()
{
@ -33,11 +34,11 @@ namespace std
}
}
extern "C" void __throw_catch_compare() {
extern "C" char __throw_catch_compare(const char* throwtype, const char* catchtype, s32* offset_result) {
}
extern "C" void __construct_new_array()
extern "C" void *__construct_new_array(void *block, ConstructorDestructor ctor, ConstructorDestructor dtor_arg, size_t size, size_t n)
{
}
@ -83,7 +84,7 @@ extern "C" void __construct_array(void *ptr, void *ctor, void *dtor, size_t size
}
extern "C" void __destroy_arr(void *block, void *dtor, size_t size, size_t n)
extern "C" void __destroy_arr(void *block, ConstructorDestructor *dtor, size_t size, size_t n)
{
}

View File

@ -1,4 +1,5 @@
#include "PowerPC_EABI_Support/Runtime/global_destructor_chain.h"
#include "PowerPC_EABI_Support/Runtime/MWCPlusPlusLib.h"
DestructorChain *__global_destructor_chain;

View File

@ -1867,13 +1867,14 @@ bool Course::Area::check(TVec3f *areaCoord, const TVec3f &worldPos)
switch (mData->shape)
{
case 1:
case 1: {
f32 lenXZ = (areaCoord->x * areaCoord->x) + (areaCoord->z * areaCoord->z);
if (lenXZ > mScale.x * mScale.x)
return false;
if (areaCoord->y < -100.0f || areaCoord->y > mScale.y)
return false;
break;
}
default:
if ((areaCoord->x < -mScale.x) || (areaCoord->x > mScale.x))
return false;

4
tools/decompctx.py Normal file → Executable file
View File

@ -23,8 +23,8 @@ include_dirs = [
# Add additional include directories here
]
include_pattern = re.compile(r'^#include\s*[<"](.+?)[>"]$')
guard_pattern = re.compile(r"^#ifndef\s+(.*)$")
include_pattern = re.compile(r'^#\s*include\s*[<"](.+?)[>"]')
guard_pattern = re.compile(r"^#\s*ifndef\s+(.*)$")
defines = set()

17
tools/download_tool.py Normal file → Executable file
View File

@ -56,6 +56,22 @@ def dtk_url(tag: str) -> str:
return f"{repo}/releases/download/{tag}/dtk-{system}-{arch}{suffix}"
def objdiff_cli_url(tag: str) -> str:
uname = platform.uname()
suffix = ""
system = uname.system.lower()
if system == "darwin":
system = "macos"
elif system == "windows":
suffix = ".exe"
arch = uname.machine.lower()
if arch == "amd64":
arch = "x86_64"
repo = "https://github.com/encounter/objdiff"
return f"{repo}/releases/download/{tag}/objdiff-cli-{system}-{arch}{suffix}"
def sjiswrap_url(tag: str) -> str:
repo = "https://github.com/encounter/sjiswrap"
return f"{repo}/releases/download/{tag}/sjiswrap-windows-x86.exe"
@ -70,6 +86,7 @@ TOOLS: Dict[str, Callable[[str], str]] = {
"binutils": binutils_url,
"compilers": compilers_url,
"dtk": dtk_url,
"objdiff-cli": objdiff_cli_url,
"sjiswrap": sjiswrap_url,
"wibo": wibo_url,
}

File diff suppressed because it is too large Load Diff

0
tools/transform_dep.py Normal file → Executable file
View File

0
tools/upload_progress.py Normal file → Executable file
View File