Migrate to dtk-template

Co-authored-by: NWPlayer123 <NWPlayer123@users.noreply.github.com>
This commit is contained in:
Luke Street 2024-10-28 18:57:33 -06:00
parent b05a6d3ed8
commit 1b0b96665a
1586 changed files with 116505 additions and 84895 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

64
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,64 @@
name: Build
on:
push:
pull_request:
jobs:
build:
container: ghcr.io/acreteam/ac-build:main
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: [GAFE01_00]
steps:
# Checkout the repository
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
# Set Git config
- name: Git config
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
# Copy the original files to the workspace
- name: Prepare
run: cp -R /orig .
# Build the project
- name: Build
run: |
python configure.py --map --version ${{ matrix.version }} \
--binutils /binutils --compilers /compilers
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: animalcrossing
PROGRESS_API_KEY: ${{ secrets.PROGRESS_API_KEY }}
run: |
python tools/upload_progress.py -b https://progress.decomp.club/ \
-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

65
.gitignore vendored
View File

@ -1,30 +1,43 @@
__pycache__/
.vscode/
build/
expected/
out/
dump/*
!dump/foresta.rel.sha1
!dump/static.dol.sha1
# IDE folders
.idea/
.vs/
# Caches
__pycache__
.mypy_cache
.cache/
# Original files
orig/*/*
!orig/*/.gitkeep
*.dol
*.rel
*.exe
*.dll
*.arc
*.ctx
ctx.*
!tools/orthrus.exe
!tools/sjiswrap.exe
*.elf
*.o
*.map
*.MAP
# Build files
build/
.ninja_*
build.ninja
ac-decomp.code-workspace
assets/
tools/cli.ini
tools/cli.py
src/data/bin1
src/data/bin2
# decompctx output
ctx.*
*.ctx
# Generated configs
objdiff.json
src/data/item/player_room_floor
src/data/item/player_room_wall
tools/1.2.5n/
tools/1.3.2r/
tools/1.3.2/
compile_commands.json
# Miscellaneous
/*.txt
!requirements.txt
*.exe
# For saving work files into (like IDB)
temp/
# Ignore the N64 SDK headers since we download them
include/PR/
include/gcc/

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "tools/ppcdis"]
path = tools/ppcdis
url = https://github.com/SeekyCt/ppcdis

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

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

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

@ -0,0 +1,22 @@
{
"[c]": {
"files.encoding": "utf8",
"editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd"
},
"[cpp]": {
"files.encoding": "utf8",
"editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd"
},
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"editor.tabSize": 2,
"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

@ -1,56 +0,0 @@
FROM ubuntu:24.04 as build
# --- basic package installation ---
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
cmake \
git \
ninja-build \
python3 \
python3-pip \
wget
# --- python package installation ---
COPY ./requirements.txt /temp/requirements.txt
COPY ./tools/ppcdis/requirements.txt /temp/tools/ppcdis/requirements.txt
# why bother setting up a venv for this, right? ¯\_(ツ)_/¯
RUN pip install --break-system-packages -r /temp/requirements.txt
RUN rm -rf /temp
# --- wibo installation ---
RUN wget https://github.com/decompals/wibo/releases/latest/download/wibo
RUN install ./wibo /usr/bin
RUN rm wibo
# --- devkitpro installation ---
RUN wget https://apt.devkitpro.org/install-devkitpro-pacman
RUN chmod +x install-devkitpro-pacman
# assume yes for in-script apt commands
RUN sed -i 's/^apt-get.*$/& -y/g' install-devkitpro-pacman
RUN ./install-devkitpro-pacman
RUN rm install-devkitpro-pacman
# workaround for a dumb bug that happens with Windows Docker. if we don't do this, devkitPPC installation fails on Windows.
RUN if [ ! -e /etc/mtab ]; then ln -s /proc/self/mounts /etc/mtab; fi
RUN dkp-pacman -S devkitPPC --noconfirm
# dear fucking god this is hacky but it works (needed otherwise next step fails)
RUN rm /usr/bin/cpp /usr/bin/g++ /lib/cpp
# set devkitPPC executables as the default ones
RUN for file in $(find "/opt/devkitpro/devkitPPC/bin" -type f -name 'powerpc-eabi*'); do new_file=$(basename "$file" | sed 's/powerpc-eabi-//g'); update-alternatives --install "/usr/bin/$new_file" "$new_file" "$file" 0; done
# --- stage ultralib headers ---
RUN git clone https://github.com/decompals/ultralib.git /N64_SDK/ultra/usr/
# dockerfile does not seem to support extglob, so this monstrous command works around it to delete all of ultralib except the headers we need.
RUN cd /N64_SDK/ultra/usr/ && find -type f -maxdepth 1 -delete && find . -not -name 'include' -type d -maxdepth 1 -exec rm -r "{}" \;
# modify Gpopmtx's param member to be unsigned int
RUN sed -i 's/unsigned char param:8;/unsigned int param:8;/g' /N64_SDK/ultra/usr/include/PR/gbi.h
# --- set up work directory and env vars ---
RUN mkdir /ac-decomp
WORKDIR /ac-decomp
ENV PATH="/ac-decomp/tools:${PATH}"
ENV N64_SDK="/N64_SDK"
ENV DEVKITPPC="/opt/devkitpro/devkitPPC"
CMD echo 'Usage: docker run --rm -v ${PWD}:/ac-decomp ac-decomp python3 configure.py && python3 build.py\n'\
'See https://github.com/Prakxo/ac-decomp/blob/master/README.MD for more information'

116
LICENSE Normal file
View File

@ -0,0 +1,116 @@
CC0 1.0 Universal
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator and
subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for the
purpose of contributing to a commons of creative, cultural and scientific
works ("Commons") that the public can reliably and without fear of later
claims of infringement build upon, modify, incorporate in other works, reuse
and redistribute as freely as possible in any form whatsoever and for any
purposes, including without limitation commercial purposes. These owners may
contribute to the Commons to promote the ideal of a free culture and the
further production of creative, cultural and scientific works, or to gain
reputation or greater distribution for their Work in part through the use and
efforts of others.
For these and/or other purposes and motivations, and without any expectation
of additional consideration or compensation, the person associating CC0 with a
Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
and publicly distribute the Work under its terms, with knowledge of his or her
Copyright and Related Rights in the Work and the meaning and intended legal
effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not limited
to, the following:
i. the right to reproduce, adapt, distribute, perform, display, communicate,
and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or likeness
depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data in
a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation thereof,
including any amended or successor version of such directive); and
vii. other similar, equivalent or corresponding rights throughout the world
based on applicable law or treaty, and any national implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention of,
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
and Related Rights and associated claims and causes of action, whether now
known or unknown (including existing as well as future claims and causes of
action), in the Work (i) in all territories worldwide, (ii) for the maximum
duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
the Waiver for the benefit of each member of the public at large and to the
detriment of Affirmer's heirs and successors, fully intending that such Waiver
shall not be subject to revocation, rescission, cancellation, termination, or
any other legal or equitable action to disrupt the quiet enjoyment of the Work
by the public as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason be
judged legally invalid or ineffective under applicable law, then the Waiver
shall be preserved to the maximum extent permitted taking into account
Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
is so judged Affirmer hereby grants to each affected person a royalty-free,
non transferable, non sublicensable, non exclusive, irrevocable and
unconditional license to exercise Affirmer's Copyright and Related Rights in
the Work (i) in all territories worldwide, (ii) for the maximum duration
provided by applicable law or treaty (including future time extensions), (iii)
in any current or future medium and for any number of copies, and (iv) for any
purpose whatsoever, including without limitation commercial, advertising or
promotional purposes (the "License"). The License shall be deemed effective as
of the date CC0 was applied by Affirmer to the Work. Should any part of the
License for any reason be judged legally invalid or ineffective under
applicable law, such partial invalidity or ineffectiveness shall not
invalidate the remainder of the License, and in such case Affirmer hereby
affirms that he or she will not (i) exercise any of his or her remaining
Copyright and Related Rights in the Work or (ii) assert any associated claims
and causes of action with respect to the Work, in either case contrary to
Affirmer's express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or warranties
of any kind concerning the Work, express, implied, statutory or otherwise,
including without limitation warranties of title, merchantability, fitness
for a particular purpose, non infringement, or the absence of latent or
other defects, accuracy, or the present or absence of errors, whether or not
discoverable, all to the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without limitation
any person's Copyright and Related Rights in the Work. Further, Affirmer
disclaims responsibility for obtaining any necessary consents, permissions
or other rights required for any use of the Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to this
CC0 or use of the Work.
For more information, please see
<http://creativecommons.org/publicdomain/zero/1.0/>

View File

@ -1,66 +0,0 @@
# Animal Crossing Decompilation [![Discord Channel][discord-badge]][discord] ![rel progress] ![dol progress]
[discord]: https://discord.gg/hKx3FJJgrV
[discord-badge]: https://img.shields.io/discord/727908905392275526?color=%237289DA&logo=discord&logoColor=%23FFFFFF
[rel progress]: https://img.shields.io/endpoint?label=rel&url=https%3A%2F%2Fprogress.decomp.club%2Fdata%2Fanimalcrossing%2Fus%2Frel%2F%3Fmode%3Dshield%26measure%3Dcode
[dol progress]: https://img.shields.io/endpoint?label=dol&url=https%3A%2F%2Fprogress.decomp.club%2Fdata%2Fanimalcrossing%2Fus%2Fdol%2F%3Fmode%3Dshield%26measure%3Dcode
Decompilation in progress of Animal Crossing (GAFE01)
A decompilation of the original N64 version of the game is being worked on [here](https://github.com/zeldaret/af).
## Cloning
Use `--recursive` when cloning to have ppcdis in the repository.
## Building
> [!NOTE]
> On Windows, the build is known to run disproportionately slow when ran natively, so WSL is recommended.
### Docker
1. [Dump a copy of the game](./docs/extract_game.md) and extract all files.
2. Place **main.dol**, **foresta.rel.szs**, **forest_1st.arc**, and **forest_2nd.arc** in *dump/*.
3. Install Docker.
4. Set up the Docker image. If using MacOS or Linux (including WSL), run `chmod +x docker-setup.sh && ./docker-setup.sh`. If using Windows, run the `docker-setup.bat` file.
5. Run configure.py (`docker run --rm -v ${PWD}:/ac-decomp ac-decomp python3 configure.py`).
6. Run build.py (`docker run --rm -v ${PWD}:/ac-decomp ac-decomp python3 build.py`).
### Build manually
> [!TIP]
> When building manually from a work directory previously used for Docker, `sudo ninja -t clean` will need to be ran for the build to execute properly.
1. [Dump a copy of the game](./docs/extract_game.md) and extract all files.
2. Place **main.dol**, **foresta.rel.szs**, **forest_1st.arc**, and **forest_2nd.arc** in *dump/*.
3. Download the [CodeWarrior 1.3.2, 1.3.2r, and 1.2.5n compilers](https://files.decomp.dev/compilers_latest.zip) and extract them to *tools/1.3.2/*, *tools/1.3.2r/*, and *tools/1.2.5n/*, respectively.
4. Install Python, pip, and [ninja](https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages#package-managers) using a package manager of choice.
- If using an ARM-based device, cmake will also need to be installed.
5. Install Python modules from requirements.txt (`pip install -r requirements.txt`).
6. Install [wibo](https://github.com/decompals/wibo)
- Wibo is a lightweight Wine replacement that's tailor-made for use with decomp projects. Regular Wine can be used if preferred, but for the purposes of this guide, these instructions will use wibo.
- Download [the latest GitHub release](https://github.com/decompals/wibo/releases/latest) and run `install ./wibo /usr/bin` to install it to the system.
7. Install devkitPPC.
- [devkitPro Pacman](https://devkitpro.org/wiki/devkitPro_pacman#Installing_devkitPro_Pacman) is needed to get devkitPPC.
- Run `dkp-pacman -S devkitPPC` once dkp-pacman is installed to install devkitPPC.
- Set the `DEVKITPPC` environment variable to */opt/devkitpro/devkitPPC*.
8. Set the `N64_SDK` environment variable to the path of libultra or equivalent headers. Headers from [ultralib](https://github.com/decompals/ultralib) can be used.
- Headers should be located at `$N64_SDK/ultra/usr/include`.
- `Gpopmtx`'s `param` member must be modified to be `unsigned int` in **gbi.h**.
9. Run `python3 configure.py`.
10. Run `python3 build.py`.
## Quick Guides
- [Dumping Game Files](./docs/extract_game.md)
- [Ghidra Setup](./docs/ghidra_setup.md)
- [Generating Decomp Context](./docs/generating_decomp_context.md)
- [decomp.me Basics](./docs/decomp_me_basics.md)
- [Ghidra Basics](./docs/ghidra_basics.md)
- [m2c Basics](./docs/m2c_basics.md)
- [Decomp Basics](./docs/decomp_basics.md)
## Credits
- jamchamb, Cuyler36, NWPlayer123 and fraser125 for past documentation of Animal Crossing.
- SeekyCt for [ppcdis](https://github.com/SeekyCt/ppcdis/) and helping setting up the project.
- msg for helping with *tools/map.py*.

126
README.md Normal file
View File

@ -0,0 +1,126 @@
Animal Crossing
[![Build Status]][actions] ![DOL Progress] ![REL Progress] [![Discord Badge]][discord]
=============
[Build Status]: https://github.com/Prakxo/ac-decomp/actions/workflows/build.yml/badge.svg
[actions]: https://github.com/Prakxo/ac-decomp/actions/workflows/build.yml
[DOL Progress]: https://img.shields.io/endpoint?label=DOL&url=https%3A%2F%2Fprogress.decomp.club%2Fdata%2Fanimalcrossing%2Fus%2Fdol%2F%3Fmode%3Dshield%26measure%3Dcode
[REL Progress]: https://img.shields.io/endpoint?label=REL&url=https%3A%2F%2Fprogress.decomp.club%2Fdata%2Fanimalcrossing%2Fus%2Frel%2F%3Fmode%3Dshield%26measure%3Dcode
[Discord Badge]: https://img.shields.io/discord/727908905392275526?color=%237289DA&logo=discord&logoColor=%23FFFFFF
[discord]: https://discord.gg/hKx3FJJgrV
A work-in-progress decompilation of Animal Crossing.
This repository does **not** contain any game assets or assembly whatsoever. An existing copy of the game is required.
Supported versions:
- `GAFE01_00`: Rev 0 (USA)
A decompilation of the original N64 version of the game is being worked on [here](https://github.com/zeldaret/af).
<!--
Quick Guides
============
- [Dumping Game Files](./docs/extract_game.md)
- [Ghidra Setup](./docs/ghidra_setup.md)
- [Generating Decomp Context](./docs/generating_decomp_context.md)
- [decomp.me Basics](./docs/decomp_me_basics.md)
- [Ghidra Basics](./docs/ghidra_basics.md)
- [m2c Basics](./docs/m2c_basics.md)
- [Decomp Basics](./docs/decomp_basics.md)
-->
Dependencies
============
Windows
--------
On Windows, it's **highly recommended** to use native tooling. WSL or msys2 are **not** required.
When running under WSL, [objdiff](#diffing) is unable to get filesystem notifications for automatic rebuilds.
- Install [Python](https://www.python.org/downloads/) and add it to `%PATH%`.
- Also available from the [Windows Store](https://apps.microsoft.com/store/detail/python-311/9NRWMJP3717K).
- Download [ninja](https://github.com/ninja-build/ninja/releases) and add it to `%PATH%`.
- Quick install via pip: `pip install ninja`
macOS
------
- Install [ninja](https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages):
```sh
brew install ninja
```
- Install [wine-crossover](https://github.com/Gcenx/homebrew-wine):
```sh
brew install --cask --no-quarantine gcenx/wine/wine-crossover
```
After OS upgrades, if macOS complains about `Wine Crossover.app` being unverified, you can unquarantine it using:
```sh
sudo xattr -rd com.apple.quarantine '/Applications/Wine Crossover.app'
```
Linux
------
- Install [ninja](https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages).
- For non-x86(_64) platforms: Install wine from your package manager.
- For x86(_64), [wibo](https://github.com/decompals/wibo), a minimal 32-bit Windows binary wrapper, will be automatically downloaded and used.
Building
========
- Clone the repository:
```sh
git clone --recursive https://github.com/Prakxo/ac-decomp.git
```
- Update and Initialize submodules:
```sh
git submodule update --init --recursive
```
- Copy your game's disc image to `orig/GAFE01_00`.
- Supported formats: ISO (GCM), RVZ, WIA, WBFS, CISO, NFS, GCZ, TGC
- After the initial build, the disc image can be deleted to save space.
- Configure:
```sh
python configure.py
```
To use a version other than `GAFE01_00` (USA), specify it with `--version`.
- Build:
```sh
ninja
```
Diffing
=======
Once the initial build succeeds, an `objdiff.json` should exist in the project root.
Download the latest release from [encounter/objdiff](https://github.com/encounter/objdiff). Under project settings, set `Project directory`. The configuration should be loaded automatically.
Select an object from the left sidebar to begin diffing. Changes to the project will rebuild automatically: changes to source files, headers, `configure.py`, `splits.txt` or `symbols.txt`.
![](assets/objdiff.png)
Credits
=======
- jamchamb, Cuyler36, NWPlayer123 and fraser125 for past documentation of Animal Crossing.
- SeekyCt for [ppcdis](https://github.com/SeekyCt/ppcdis/) and helping setting up the project.
- msg for helping with *tools/map.py*.

BIN
assets/objdiff.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

106
build.py
View File

@ -1,106 +0,0 @@
import subprocess
import sys
import os
import hashlib
import argparse
import common as c
# List of Ninja build targets
NINJA_BUILD_TARGETS = [ ['src/data/bin1', 'out/forest_1st.arc', 'dump/forest_1st.arc'], ['src/data/bin2', 'out/forest_2nd.arc', 'dump/forest_2nd.arc'] ]
def calculate_directory_hash(path, hash_func):
if not os.path.isdir(path):
raise NotADirectoryError(f"{path} is not a directory")
hasher = hash_func()
for root, dirs, files in os.walk(path):
for names in files:
filepath = os.path.join(root, names)
try:
with open(filepath, 'rb') as f:
while True:
data = f.read(65536) # Read in chunks to handle large files
if not data:
break
hasher.update(data)
except IOError:
# Handle errors as needed
pass
return hasher.hexdigest()
def directory_changed(path, build_dir, hash_func=hashlib.md5):
hash_file = os.path.join(build_dir, f'{os.path.basename(os.path.normpath(path))}.dirhash')
current_hash = calculate_directory_hash(path, hash_func)
try:
with open(hash_file, 'r') as f:
stored_hash = f.read()
except FileNotFoundError:
stored_hash = None
if current_hash != stored_hash:
os.makedirs(build_dir, exist_ok=True)
with open(hash_file, 'w') as f:
f.write(current_hash)
return True
return False
def run_ninja_build(target):
try:
subprocess.run(['ninja', '-v', target], check=True)
except subprocess.CalledProcessError as e:
print(f"Error running Ninja build for target {target}: {e}")
sys.exit(1)
def check_and_dump_arc(target, dump, verbose=False):
if not os.path.exists(target):
assert os.path.exists(dump), f"Please add missing file: {dump}"
print(f'Dumping {dump}')
try:
if verbose:
subprocess.run(['python3', 'tools/arc_tool.py', dump, os.path.dirname(target)])
else:
subprocess.run(['python3', 'tools/arc_tool.py', '-v', dump, os.path.dirname(target)])
except subprocess.CalledProcessError as e:
print(f"Error running arc_tool")
sys.exit(1)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Build Animal Crossing')
parser.add_argument('--clean', help='Cleans all build artifacts', required=False, action='store_true')
parser.add_argument('-v', help='Enable verbose logging', required=False, action='store_true')
args = parser.parse_args()
if args.clean:
for target in NINJA_BUILD_TARGETS:
rel_path = f'{os.path.basename(os.path.normpath(target[0]))}.dirhash'
path = os.path.join('build', rel_path)
if os.path.exists(path):
os.remove(path)
try:
subprocess.run(['ninja', '-t', 'clean'], check=True)
except subprocess.CalledProcessError as e:
print(f"Error running ninja -t clean")
sys.exit(1)
else:
for target in NINJA_BUILD_TARGETS:
check_and_dump_arc(target[0], target[2], args.v)
if directory_changed(target[0], 'build'):
if os.path.exists(target[1]):
os.remove(target[1])
run_ninja_build(target[1])
else:
print(f"No changes in {target[0]}, skipping build.")
try:
if args.v:
subprocess.run(['ninja', '-v'], check=True)
else:
subprocess.run(['ninja'], check=True)
# Compress foresta.rel
if os.path.exists(c.REL_OUT):
print("Compressing foresta.rel to foresta.rel.szs")
subprocess.call([f'./{c.ORTHRUS}', 'ncompress', 'yaz0', '-c', c.REL_OUT, c.REL_SZS_OUT])
except subprocess.CalledProcessError as e:
print(f"Error running Ninja build")
sys.exit(1)

537
common.py
View File

@ -1,537 +0,0 @@
"""
Common functions & definitions
"""
from dataclasses import dataclass
from enum import Enum
from hashlib import sha1
import json
import os
from subprocess import PIPE, run
from sys import executable as PYTHON, platform
from typing import List, Tuple, Union
import yaml
try:
from yaml import CLoader as Loader
except ImportError:
from yaml import Loader
#############
# Functions #
#############
def get_file_sha1(path: str) -> bytes:
"""Gets the SHA1 hash of a file"""
with open(path, 'rb') as f:
return sha1(f.read()).digest()
def get_cmd_stdout(cmd: str, text=True) -> str:
"""Run a command and get the stdout output as a string"""
ret = run(cmd.split(), stdout=PIPE, text=text)
assert ret.returncode == 0, f"Command '{cmd}' returned {ret.returncode}"
return ret.stdout
class Binary(Enum):
DOL = 1
REL = 2
# ppcdis source output
SourceDesc = Union[str, Tuple[str, int, int]]
def get_containing_slice(addr: int) -> Tuple[Binary, SourceDesc]:
"""Finds the binary containing an address and its source file
Source file is empty string if not decompiled"""
dol_raw = get_cmd_stdout(f"{SLICES} {DOL_YML} {DOL_SLICES} -p {DOL_SRCDIR}/ --containing {addr:x}")
containing = json.loads(dol_raw)
if containing is None:
rel_raw = get_cmd_stdout(
f"{SLICES} {REL_YML} {REL_SLICES} -p {REL_SRCDIR}/ --containing {addr:x}"
)
containing = json.loads(rel_raw)
assert containing is not None, f"Unknown address {addr:x}"
return (Binary.REL, containing)
else:
return (Binary.DOL, containing)
def lookup_sym(sym: str, dol: bool = False, rel: bool = False, source_name: str = None) -> int:
"""Takes a symbol as a name or address and returns the address"""
# Get binary
if dol:
binary_name = DOL_YML
elif rel:
binary_name = REL_YML
else:
binary_name = None
# Determine type
try:
return int(sym, 16)
except ValueError:
return get_address(sym, binary_name, source_name)
def lookup_sym_full(sym: str, dol: bool = False, rel: bool = False, source_name: str = None
) -> int:
"""Takes a symbol as a name or address and returns both the name and address"""
# Get binary
if dol:
binary_name = DOL_YML
elif rel:
binary_name = REL_YML
else:
binary_name = None
# Determine type
try:
return int(sym, 16), get_name(sym)
except ValueError:
return get_address(sym, binary_name, source_name), sym
def get_address(name: str, binary: bool = None, source_name: bool = None) -> int:
"""Finds the address of a symbol"""
args = [name]
if binary is not None:
args.append(f"-b {binary}")
if source_name is not None:
args.append(f"-n {source_name}")
raw = get_cmd_stdout(f"{SYMBOLS} {GAME_SYMBOLS} --get-addr {' '.join(args)}")
return json.loads(raw)
def get_name(addr: int, binary: bool = None, source_name: bool = None) -> int:
"""Finds the name of a symbol"""
args = [addr]
if binary is not None:
args.append(f"-b {binary}")
if source_name is not None:
args.append(f"-n {source_name}")
raw = get_cmd_stdout(f"{SYMBOLS} {GAME_SYMBOLS} --get-name {' '.join(args)}")
return json.loads(raw)
def find_headers(dirname: str, base=None) -> List[str]:
"""Returns a list of all headers in a folder recursively"""
if base is None:
base = dirname
ret = []
for name in os.listdir(dirname):
path = dirname + '/' + name
if os.path.isdir(path):
ret.extend(find_headers(path, base))
elif name.endswith('.h'):
ret.append(path[len(base)+1:])
return ret
def load_from_yaml(path: str, default=None):
"""Loads an object from a yaml file"""
if default is None:
default = {}
with open(path) as f:
ret = yaml.load(f.read(), Loader)
if ret is None:
ret = default
return ret
################
# Project dirs #
################
# Directory for decompiled dol code
DOL_SRCDIR = "src/static"
# Directory for decompiled rel code
REL_SRCDIR = "src"
# Include directory
INCDIR = "include"
# Directory for forest_1st data
FOREST_1STDIR = "src/data/bin1"
# Directory for forest_2nd data
FOREST_2NDDIR = "src/data/bin2"
# Build artifacts directory
BUILDDIR = "build"
# Build include directory
BUILD_INCDIR = f"{BUILDDIR}/include"
# Output binaries directory
OUTDIR = "out"
# Original binaries directory
ORIG = "dump"
# Tools directory
TOOLS = "tools"
# Config directory
CONFIG = "config"
# Extracted assets directory
ASSETS = "assets"
#########
# Tools #
#########
# ppcdis
PPCDIS = "tools/ppcdis"
PPCDIS_INCDIR = f"{PPCDIS}/include"
RELEXTERN = f"{PYTHON} {PPCDIS}/relextern.py"
ANALYSER = f"{PYTHON} {PPCDIS}/analyser.py"
DISASSEMBLER = f"{PYTHON} {PPCDIS}/disassembler.py"
ORDERSTRINGS = f"{PYTHON} {PPCDIS}/orderstrings.py"
ORDERFLOATS = f"{PYTHON} {PPCDIS}/orderfloats.py"
ASSETRIP = f"{PYTHON} {PPCDIS}/assetrip.py"
ASSETINC = f"{PYTHON} {PPCDIS}/assetinc.py"
BATCHASSETRIP = f"{PYTHON} {PPCDIS}/batchassetrip.py"
FORCEACTIVEGEN = f"{PYTHON} {PPCDIS}/forceactivegen.py"
ELF2DOL = f"{PYTHON} {PPCDIS}/elf2dol.py"
ELF2REL = f"{PYTHON} {PPCDIS}/elf2rel.py"
SLICES = f"{PYTHON} {PPCDIS}/slices.py"
PROGRESS = f"{PYTHON} {PPCDIS}/progress.py"
SYMBOLS = f"{PYTHON} {PPCDIS}/symbols.py"
FORCEFILESGEN = f"{PYTHON} {PPCDIS}/forcefilesgen.py"
# Codewarrior
TOOLS = "tools"
CODEWARRIOR = os.path.join(TOOLS, "1.3.2")
CODEWARRIOR_RODATA_POOL_FIX = os.path.join(TOOLS, "1.3.2r")
ORTHRUS = os.path.join(TOOLS, "orthrus")
SDK_CW = os.path.join(TOOLS, "1.2.5n")
CC = os.path.join(CODEWARRIOR, "mwcceppc.exe")
CC_R = os.path.join(CODEWARRIOR_RODATA_POOL_FIX, "mwcceppc.exe")
OCC = os.path.join(SDK_CW, "mwcceppc.exe")
LD = os.path.join(CODEWARRIOR, "mwldeppc.exe")
if platform != "win32":
LD = f"wibo {LD}"
SJISWRAP = f"wibo {TOOLS}/sjiswrap.exe"
else:
ORTHRUS = os.path.join(TOOLS, "orthrus.exe")
SJISWRAP = os.path.join(TOOLS, "sjiswrap.exe")
# DevkitPPC
DEVKITPPC = os.environ.get("DEVKITPPC")
AS = os.path.join(DEVKITPPC, "bin", "powerpc-eabi-as")
OBJDUMP = os.path.join(DEVKITPPC, "bin", "powerpc-eabi-objdump")
CPP = os.path.join(DEVKITPPC, "bin", "powerpc-eabi-cpp")
# Asset Converters
VTXDIS = f"{PYTHON} {TOOLS}/converters/vtxdis.py"
PAL16DIS = f"{PYTHON} {TOOLS}/converters/pal16dis.py"
# JSystem JKernel archive tool
ARC_TOOL = f"{PYTHON} {TOOLS}/arc_tool.py"
# N64 SDK path for GBI
N64SDK = os.environ.get("N64_SDK")
assert N64SDK != None, "N64_SDK is not defined as a system environment variable"
#########
# Files #
#########
# Slices
DOL_SLICES = f"{CONFIG}/dol_slices.yml"
REL_SLICES = f"{CONFIG}/rel_slices.yml"
# Overrides
ANALYSIS_OVERRIDES = f"{CONFIG}/analysis_overrides.yml"
DOL_DISASM_OVERRIDES = f"{CONFIG}/disasm_overrides.yml"
REL_DISASM_OVERRIDES = f"{CONFIG}/rel_disasm_overrides.yml"
# Binaries
DOL = f"{ORIG}/static.dol" # read in python code
REL = f"{ORIG}/foresta.rel" # read in python code
REL_SZS = f"{ORIG}/foresta.rel.szs"
DOL_YML = f"{CONFIG}/dol.yml"
REL_YML = f"{CONFIG}/rel.yml"
DOL_SHA = f"{ORIG}/static.dol.sha1"
REL_SHA = f"{ORIG}/foresta.rel.sha1"
DOL_OK = f"{BUILDDIR}/static.dol.ok"
REL_OK = f"{BUILDDIR}/foresta.rel.ok"
DOL_ASM_LIST = f"{BUILDDIR}/static.dol.asml"
REL_ASM_LIST = f"{BUILDDIR}/foresta.rel.asml"
# Symbols
GAME_SYMBOLS = f"{CONFIG}/symbols.yml"
# Assets
ASSETS_YML = f"{CONFIG}/assets.yml"
# Analysis outputs
EXTERNS = f"{BUILDDIR}/externs.pickle"
DOL_LABELS = f"{BUILDDIR}/labels.pickle"
DOL_RELOCS = f"{BUILDDIR}/relocs.pickle"
REL_LABELS = f"{BUILDDIR}/rel_labels.pickle"
REL_RELOCS = f"{BUILDDIR}/rel_relocs.pickle"
# Linker
DOL_LCF_TEMPLATE = f"{CONFIG}/dol.lcf"
DOL_LCF_TEMP = f"{BUILDDIR}/dol_temp.lcf"
DOL_LCF = f"{BUILDDIR}/dol.lcf"
REL_LCF = f"{CONFIG}/rel.lcf"
# Outputs
DOL_ELF = f"{BUILDDIR}/static.elf"
REL_PLF = f"{BUILDDIR}/foresta.plf"
DOL_OUT = f"{OUTDIR}/static.dol"
REL_OUT = f"{OUTDIR}/foresta.rel"
REL_SZS_OUT = f"{OUTDIR}/foresta.rel.szs"
DOL_MAP = f"{OUTDIR}/static.map"
REL_MAP = f"{OUTDIR}/foresta.map"
# Optional full disassembly
DOL_FULL = f"{OUTDIR}/dol.s"
REL_FULL = f"{OUTDIR}/rel.s"
##############
# Tool Flags #
##############
ASFLAGS = ' '.join([
"-m gekko",
f"-I {INCDIR}",
f"-I {PPCDIS_INCDIR}",
f"-I orig",
f"-I {N64SDK}/ultra/usr/include"
])
CPPFLAGS = ' '.join([
"-nostdinc",
f"-I {INCDIR}",
f"-I {PPCDIS_INCDIR}",
f"-I {BUILD_INCDIR}",
f"-I {N64SDK}/ultra/usr/include"
])
DOL_SDATA2_SIZE = 8
REL_SDATA2_SIZE = 0
CFLAGS = [
"-O4",
"-char unsigned",
"-fp hard"
]
CPLFLAGS = [
"-lang=c++",
"-O0"
]
COMMON_DEFINES = [
"-d _LANGUAGE_C",
"-d F3DEX_GBI_2",
"-d NDEBUG",
"-d DEBUG=0",
"-d MUST_MATCH"
]
DOL_DEFINES = COMMON_DEFINES + []
REL_DEFINES = COMMON_DEFINES + [
#"-d OPTIMIZED_SQRTF",
"-d IS_REL"
]
BASE_DOL_CFLAGS = CFLAGS + [
"-inline on",
"-sdata 8",
f"-sdata2 {DOL_SDATA2_SIZE}"
] + DOL_DEFINES
BOOT_CFLAGS = CFLAGS + [
"-inline on",
"-sdata 0",
"-sdata2 0"
] + DOL_DEFINES
DOL_CFLAGS_NO_SDATA = CFLAGS + [
"-inline on",
"-enum int",
"-sdata 0",
"-sdata2 0"
] + DOL_DEFINES
DVDERR_CFLAGS = CFLAGS + [
"-inline on",
"-sdata 0",
"-sdata2 0",
"-pool off"
] + DOL_DEFINES
TRK_CFLAGS = [
"-O4,p",
"-sdata 0",
"-sdata2 0",
"-fp hard",
"-enum int",
"-char unsigned",
"-inline deferred",
"-rostr"
] + DOL_DEFINES
BASE_REL_CFLAGS = CFLAGS + [
"-sdata 0",
f"-sdata2 {REL_SDATA2_SIZE}",
"-enum int",
"-requireprotos",
#"-pool off",
"-sym on"
] + REL_DEFINES
LOCAL_CFLAGS = [
"-nostdinc",
"-proc gekko",
"-maxerrors 1",
"-Cpp_exceptions off",
"-I-",
f"-i {INCDIR}",
f"-i {PPCDIS_INCDIR}",
f"-i {BUILD_INCDIR}",
f"-ir {N64SDK}/ultra/usr/include"
]
PREPROCESSOR_CFLAGS = [
"-E",
"-P"
]
SDK_CFLAG = [
"-O4,p",
"-inline all",
"-sdata 8",
f"-sdata2 {DOL_SDATA2_SIZE}",
"-fp hard"
]
ALIGN16_CFLAG = [
"-func_align 16",
]
JSYSTEM_BASE = [
"-lang=c++",
"-inline on",
"-fp fmadd",
#"-fp_contract on",
#"-pool off", # this is wrong
"-Cpp_exceptions off",
"-RTTI on",
"-char signed",
"-enum int",
"-sym on", # might also be on for base flags?
"-O4,s" # in mkdd some libraries use O4,p, might be the case here too
]
JSYSTEM_JGADGET_BASE = [
"-lang=c++",
"-inline on",
"-fp fmadd",
#"-fp_contract on",
#"-pool off", # this is wrong
"-Cpp_exceptions off",
"-RTTI on",
"-char signed",
"-enum int",
# "-sym on", # might also be on for base flags?
"-O4,s" # in mkdd some libraries use O4,p, might be the case here too
]
FAMICOM_BASE = CFLAGS + [
"-lang=c++",
"-sdata 0",
"-sdata2 0",
"-enum int",
"-sym on"
] + DOL_DEFINES
JAUDIO_BASE = CFLAGS + [
"-lang=c++",
"-char signed",
"-sdata 8",
"-sdata2 8",
"-enum int",
"-common on"
] + DOL_DEFINES
JAUDIO_FUNC_ALIGN_32 = [
"-func_align 32",
"-str readonly",
"-inline off"
]
JAUDIO_USER = [
"-d _LANGUAGE_C_PLUS_PLUS",
"-O0",
"-char unsigned",
"-fp hard",
"-lang=c++",
"-sdata 8",
"-sdata2 8",
"-enum int",
"-common on"
]
JSYSTEM_CFLAGS = ' '.join(JSYSTEM_BASE + LOCAL_CFLAGS)
JSYSTEM_JGADGET_CFLAGS = ' '.join(JSYSTEM_JGADGET_BASE + LOCAL_CFLAGS)
DOL_CFLAGS = ' '.join(BASE_DOL_CFLAGS + LOCAL_CFLAGS)
DOL_BOOT_CFLAGS = ' '.join(BOOT_CFLAGS + LOCAL_CFLAGS)
DOL_DVDERR_CFLAGS = ' '.join(DVDERR_CFLAGS + LOCAL_CFLAGS)
DOL_CFLAGS_SDATA0_CFLAGS = ' '.join(DOL_CFLAGS_NO_SDATA + LOCAL_CFLAGS)
DOL_TRK_CFLAGS = ' '.join(TRK_CFLAGS + LOCAL_CFLAGS)
SDK_FLAGS = ' '.join(SDK_CFLAG + LOCAL_CFLAGS)
ALIGN16 = ' '.join(BASE_DOL_CFLAGS + LOCAL_CFLAGS + ALIGN16_CFLAG)
DOL_CPPFLAGS = ' '.join(CPLFLAGS + BASE_DOL_CFLAGS + LOCAL_CFLAGS)
REL_CFLAGS = ' '.join(BASE_REL_CFLAGS + LOCAL_CFLAGS)
EXTERNAL_DOL_CFLAGS = ' '.join(BASE_DOL_CFLAGS)
EXTERNAL_REL_CFLAGS = ' '.join(BASE_REL_CFLAGS)
PREPROCESS_CFLAGS = ' '.join(PREPROCESSOR_CFLAGS)
FAMICOM_CLFAGS = ' '.join(FAMICOM_BASE + LOCAL_CFLAGS)
JAUDIO_CFLAGS = ' '.join(JAUDIO_BASE + LOCAL_CFLAGS)
JAUDIO_FUNC_ALIGN_32_CFLAGS = ' '.join(JAUDIO_BASE + JAUDIO_FUNC_ALIGN_32 + LOCAL_CFLAGS)
JAUDIO_USER_CFLAGS = ' '.join(JAUDIO_USER + LOCAL_CFLAGS)
DOL_LDFLAGS = ' '.join([
"-maxerrors 1",
"-mapunused",
"-fp hardware"
])
LDFLAGS = ' '.join([
"-maxerrors 1",
"-mapunused",
"-opt_partial",
"-strip_partial",
"-fp hardware"
])
PPCDIS_ANALYSIS_FLAGS = ' '.join([
f"-o {ANALYSIS_OVERRIDES}",
f"-l {EXTERNS}"
])
############
# Contexts #
############
@dataclass
class SourceContext:
srcdir: str
cflags: str
binary: str
labels: str
relocs: str
slices: str
compiler: str
sdata2_threshold: int
disasm_overrides: int
DOL_CTX = SourceContext(DOL_SRCDIR, DOL_CFLAGS, DOL_YML, DOL_LABELS, DOL_RELOCS, DOL_SLICES,
CC, DOL_SDATA2_SIZE, DOL_DISASM_OVERRIDES)
REL_CTX = SourceContext(REL_SRCDIR, REL_CFLAGS, REL_YML, REL_LABELS, REL_RELOCS, REL_SLICES,
CC, REL_SDATA2_SIZE, REL_DISASM_OVERRIDES)
####################
# diff.py Expected #
####################
EXPECTED = "expected"
DOL_EXPECTED = f"{EXPECTED}/build/main.elf"
REL_EXPECTED = f"{EXPECTED}/build/foresta.plf"

View File

@ -0,0 +1,2 @@
2AE8F56E7791D37E165BD5900921F2269F9515BF build/GAFE01_00/static.dol
C59D278AD8542BB05D6CBB632F60A0DB05BEF203 build/GAFE01_00/foresta/foresta.rel

24281
config/GAFE01_00/config.yml Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1555
config/GAFE01_00/splits.txt Normal file

File diff suppressed because it is too large Load Diff

6541
config/GAFE01_00/symbols.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,416 +0,0 @@
blocked_pointers:
- 0x800A8440
- 0x800A8514
blocked_targets:
- 0x800A97E0 # boot.c local static const tbl, also start of .rodata
- 0x80008000
- 0x80018800
- 0x800189C0
- 0x801F6C7C # tcs_bad
- 0x801F6C7D # ics_bad
- 0x800a9a90
# - 0x800a9838
- 0x800a9938
- 0x800a9a3a
- 0x800a99f6
- 0x800a9a18
forced_types:
0x80003534: FUNCTION
0x80005468: FUNCTION
0x8003ab3c: ENTRY
0x8003ab70: ENTRY
0x8003ab70: ENTRY
0x8003ab70: ENTRY
0x8003ab70: ENTRY
0x8003ab78: ENTRY
0x8003ab88: ENTRY
0x8003abe0: ENTRY
0x8003abf0: ENTRY
0x8003abfc: ENTRY
0x8003ac0c: ENTRY
0x8003ac48: ENTRY
0x8003ac48: ENTRY
0x8003ac48: ENTRY
0x8003ac58: ENTRY
0x8003ac70: ENTRY
0x8003ac90: ENTRY
0x8003aca4: ENTRY
0x8003acb4: ENTRY
0x8003acd0: ENTRY
0x8003ace0: ENTRY
0x8003ada4: ENTRY
0x8003ada4: ENTRY
0x8003ada4: ENTRY
0x8003ada4: ENTRY
0x8003ada4: ENTRY
0x8003adac: ENTRY
0x8003b5d4: ENTRY
0x8003b5f4: ENTRY
0x8003b61c: ENTRY
0x8003b648: ENTRY
0x8003b674: ENTRY
0x8003b684: ENTRY
0x8003b698: ENTRY
0x8003b6c4: ENTRY
0x8003b6f0: ENTRY
0x8003b6f0: ENTRY
0x8003b6f0: ENTRY
0x8003b6f0: ENTRY
0x8003b6f0: ENTRY
0x8003b6f0: ENTRY
0x8003b6f0: ENTRY
0x8003b6f0: ENTRY
0x8003b700: ENTRY
0x8003b70c: ENTRY
0x8003b70c: ENTRY
0x8003b70c: ENTRY
0x8003b70c: ENTRY
0x8003b71c: ENTRY
0x8003b71c: ENTRY
0x8003b71c: ENTRY
0x8003b71c: ENTRY
0x8003b71c: ENTRY
0x8003b72c: ENTRY
0x8003b734: ENTRY
0x8003b73c: ENTRY
0x8003b744: ENTRY
0x8003b754: ENTRY
0x8003b764: ENTRY
0x8003b774: ENTRY
0x8003b784: ENTRY
0x8003b794: ENTRY
0x8003b7a4: ENTRY
0x8003b7bc: ENTRY
0x8003b7d4: ENTRY
0x8003b7fc: ENTRY
0x8003b82c: ENTRY
0x8003b834: ENTRY
0x8003b83c: ENTRY
0x8003b84c: ENTRY
0x8003b85c: ENTRY
0x8003b86c: ENTRY
0x8003b87c: ENTRY
0x8003b88c: ENTRY
0x8003b89c: ENTRY
0x8003b8ac: ENTRY
0x8003b8bc: ENTRY
0x8003b8bc: ENTRY
0x8003b8bc: ENTRY
0x8003b8bc: ENTRY
0x8003b8bc: ENTRY
0x8003b8bc: ENTRY
0x8003b8bc: ENTRY
0x8003b8bc: ENTRY
0x8003b8d0: ENTRY
0x8003b8d0: ENTRY
0x8003b8d0: ENTRY
0x8003b8e4: ENTRY
0x8003b8e4: ENTRY
0x8003b8e4: ENTRY
0x8003b8f8: ENTRY
0x8003b8f8: ENTRY
0x8003b8f8: ENTRY
0x8003b8f8: ENTRY
0x8003b8f8: ENTRY
0x8003b8f8: ENTRY
0x8003b8f8: ENTRY
0x8003b8f8: ENTRY
0x8003b928: ENTRY
0x8003b928: ENTRY
0x8003b928: ENTRY
0x8003b928: ENTRY
0x8003b928: ENTRY
0x8003b928: ENTRY
0x8003b928: ENTRY
0x8003b928: ENTRY
0x8003b960: ENTRY
0x8003b960: ENTRY
0x8003b960: ENTRY
0x8003b960: ENTRY
0x8003b960: ENTRY
0x8003b960: ENTRY
0x8003b960: ENTRY
0x8003b960: ENTRY
0x8003b970: ENTRY
0x8003b970: ENTRY
0x8003b970: ENTRY
0x8003b970: ENTRY
0x8003b970: ENTRY
0x8003b970: ENTRY
0x8003b970: ENTRY
0x8003b970: ENTRY
0x8003b980: ENTRY
0x8003b980: ENTRY
0x8003b990: ENTRY
0x8003b990: ENTRY
0x8003b990: ENTRY
0x8003b990: ENTRY
0x8003b990: ENTRY
0x8003b990: ENTRY
0x8003b990: ENTRY
0x8003b990: ENTRY
0x8003b9a0: ENTRY
0x8003b9a0: ENTRY
0x8003b9a0: ENTRY
0x8003b9a0: ENTRY
0x8003b9b8: ENTRY
0x8003b9b8: ENTRY
0x8003b9b8: ENTRY
0x8003b9b8: ENTRY
0x8003b9d0: ENTRY
0x8003b9e4: ENTRY
0x8003b9e4: ENTRY
0x8003b9e4: ENTRY
0x8003b9e4: ENTRY
0x8003ba00: ENTRY
0x8003ba14: ENTRY
0x8003ba14: ENTRY
0x8003ba14: ENTRY
0x8003ba14: ENTRY
0x8003ba30: ENTRY
0x8003ba48: ENTRY
0x8003ba48: ENTRY
0x8003ba48: ENTRY
0x8003ba48: ENTRY
0x8003ba68: ENTRY
0x8003ba80: ENTRY
0x8003ba80: ENTRY
0x8003ba80: ENTRY
0x8003ba80: ENTRY
0x8003baa0: ENTRY
0x8003babc: ENTRY
0x8003bad8: ENTRY
0x8003baf4: ENTRY
0x8003bb10: ENTRY
0x8003bb2c: ENTRY
0x8003bb48: ENTRY
0x8003bb64: ENTRY
0x8003bb80: ENTRY
0x8003bb88: ENTRY
0x8003bbac: ENTRY
0x8003bbc0: ENTRY
0x8003bbdc: ENTRY
0x8003bbe0: ENTRY
0x8003bc10: ENTRY
0x8003bc18: ENTRY
0x8003bc44: ENTRY
0x8003bc54: ENTRY
0x8003bc5c: ENTRY
0x8003bcc8: ENTRY
0x8003bcd0: ENTRY
0x8003bd20: ENTRY
0x8003bd30: ENTRY
0x8003bd3c: ENTRY
0x8003bd60: ENTRY
0x8003bd70: ENTRY
0x8003bd78: ENTRY
0x8003bd88: ENTRY
0x8003bd98: ENTRY
0x8003bda8: ENTRY
0x8003bdb0: ENTRY
0x8003bdb4: ENTRY
0x8003bdbc: ENTRY
0x8003bdc8: ENTRY
0x8003bdc8: ENTRY
0x8003bdd4: ENTRY
0x8003be64: ENTRY
0x8003bf28: ENTRY
0x8003bf38: ENTRY
0x8003bf9c: ENTRY
0x8003bfd0: ENTRY
0x8003bfdc: ENTRY
0x8003bfe8: ENTRY
0x8003bfec: ENTRY
0x8003c000: ENTRY
0x8003c020: ENTRY
0x8003c030: ENTRY
0x8003c034: ENTRY
0x8003c094: ENTRY
0x8003c0e0: ENTRY
0x8003c1f4: ENTRY
0x8003c210: ENTRY
0x8003c214: ENTRY
0x8003c24c: ENTRY
0x8003c260: ENTRY
0x8003c274: ENTRY
0x8003c274: ENTRY
0x8003c274: ENTRY
0x8003c274: ENTRY
0x8003c28c: ENTRY
0x8003c28c: ENTRY
0x8003c28c: ENTRY
0x8003c28c: ENTRY
0x8003c28c: ENTRY
0x8003c28c: ENTRY
0x8003c28c: ENTRY
0x8003c28c: ENTRY
0x8003c28c: ENTRY
0x8003c28c: ENTRY
0x8003c28c: ENTRY
0x8003c28c: ENTRY
0x8003c28c: ENTRY
0x8003c28c: ENTRY
0x8003c2ac: ENTRY
0x8003c2e0: ENTRY
0x8003c32c: ENTRY
0x8003c540: ENTRY
0x8003c5cc: ENTRY
0x8003c5cc: ENTRY
0x8003c5d8: ENTRY
0x8003c60c: ENTRY
0x8003c614: ENTRY
0x8003c640: ENTRY
0x8003c6e4: ENTRY
0x8003c6ec: ENTRY
0x8003c894: ENTRY
0x8003c8bc: ENTRY
0x8003c8e8: ENTRY
0x8003c930: ENTRY
0x8003caf0: ENTRY
0x8003cb20: ENTRY
0x8003cb6c: ENTRY
0x8003cb78: ENTRY
0x8003cb8c: ENTRY
0x8003cba0: ENTRY
0x8003ccf4: ENTRY
0x8003cd0c: ENTRY
0x8003ce58: ENTRY
0x8003ce58: ENTRY
0x8003ce58: ENTRY
0x8003ce58: ENTRY
0x8003ce58: ENTRY
0x8003ce64: ENTRY
0x8003cf80: ENTRY
0x8003cf80: ENTRY
0x8003cf80: ENTRY
0x8003cf80: ENTRY
0x8003cf80: ENTRY
0x8003cf80: ENTRY
0x8003cf80: ENTRY
0x8003cf80: ENTRY
0x8003cf98: ENTRY
0x8003cf98: ENTRY
0x8003cf98: ENTRY
0x8003cf98: ENTRY
0x8003cfb0: ENTRY
0x8003cfb0: ENTRY
0x8003cfbc: ENTRY
0x8003cfc8: ENTRY
0x8003d010: ENTRY
0x8003d010: ENTRY
0x8003d01c: ENTRY
0x8003d0ac: ENTRY
0x8003d0f8: ENTRY
0x8003d0fc: ENTRY
0x8003d13c: ENTRY
0x8003d16c: ENTRY
0x8003d1b0: ENTRY
0x8003d1b4: ENTRY
0x8003d1e4: ENTRY
0x8003d1e4: ENTRY
0x8003d1e4: ENTRY
0x8003d1e4: ENTRY
0x8003d1f8: ENTRY
0x8003d264: ENTRY
0x8003d2b0: ENTRY
0x8003d368: ENTRY
0x8003d3dc: ENTRY
0x8003d444: ENTRY
0x8003d45c: ENTRY
0x8003d4a4: ENTRY
0x8003d4ec: ENTRY
0x8003d514: ENTRY
0x8003d53c: ENTRY
0x8003d564: ENTRY
0x8003d584: ENTRY
0x8003d590: ENTRY
0x8003d5b4: ENTRY
0x8003d5d8: ENTRY
0x8003d614: ENTRY
0x8003d678: ENTRY
0x8003d6ac: ENTRY
0x8003d700: ENTRY
0x8003d754: ENTRY
0x8003d76c: ENTRY
0x8003d7e8: ENTRY
0x8003d7f4: ENTRY
0x8003d82c: ENTRY
0x8003d8d4: ENTRY
0x8003d928: ENTRY
0x8003d940: ENTRY
0x8003d96c: ENTRY
0x8003d990: ENTRY
0x8003da50: ENTRY
0x8003da88: ENTRY
0x8003da90: ENTRY
0x8003db68: ENTRY
0x8003dbd8: ENTRY
0x8003dbf4: ENTRY
0x8003dc20: ENTRY
0x8003dc28: ENTRY
0x8003dc28: ENTRY
0x8003dcd4: ENTRY
0x8003dd3c: ENTRY
0x8003ddb8: ENTRY
0x8003dddc: ENTRY
0x8003de50: ENTRY
0x8003de78: ENTRY
0x80078edc: ENTRY
0x80078f00: ENTRY
0x80078f00: ENTRY
0x80078f04: ENTRY
0x80078f34: ENTRY
0x80078f8c: ENTRY
0x80078f9c: ENTRY
0x80078fcc: ENTRY
0x8007ac24: ENTRY
0x8007ac34: ENTRY
# 0x8007db20: ENTRY
0x8007db3c: ENTRY
0x8009ae2c: ENTRY
0x8009ae34: ENTRY
0x8009ae38: ENTRY
0x8009ae3c: ENTRY
0x8009ae78: ENTRY
0x8009ae80: ENTRY
0x8009ae84: ENTRY
0x8009ae88: ENTRY
0x8009ae98: ENTRY
0x8009ae9c: ENTRY
0x8009aea0: ENTRY
0x8009aea4: ENTRY
0x8009aea8: ENTRY
0x8009aeac: ENTRY
0x8009aeb0: ENTRY
0x8009aeb4: ENTRY
0x8009aeb8: ENTRY
0x8009aebc: ENTRY
0x8009aec0: ENTRY
0x8009aec4: ENTRY
0x8009aec8: ENTRY
0x8009aecc: ENTRY
0x8009aed0: ENTRY
0x8009aed4: ENTRY
0x8009aee4: ENTRY
0x8009aee8: ENTRY
0x8009aeec: ENTRY
0x8009aef0: ENTRY
0x8009aef4: ENTRY
0x8009aef8: ENTRY
0x8009aefc: ENTRY
0x8009af00: ENTRY
0x8009af04: ENTRY
0x8009af08: ENTRY
0x8009af0c: ENTRY
0x8009af10: ENTRY
0x8009af14: ENTRY
0x8009af18: ENTRY
0x8009af1c: ENTRY
0x8009af20: ENTRY
0x800A6A74: FUNCTION # TRKExceptionHandler
0x800A6BD4: FUNCTION # TRKInterruptHandlerEnableInterrupts
0x800a8130: ENTRY
0x800a8138: ENTRY
0x800a8140: ENTRY
0x800a8148: ENTRY
# 0x800ab260: ENTRY

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +0,0 @@
trim_ctors: true
symbol_aligns:
0x80008480: 32
0x80016d20: 32
0x80018920: 32
0x800190e0: 32
0x80019380: 32
0x80019760: 32
0x8001a0c0: 32
0x80026400: 32
0x8002c920: 32 # __DSPCheckMXICBoot2__FP16STRUCT_DSP_TASK2
0x80031d80: 32
0x8001ada0: 32
0x8002cfe0: 32
0x8018f1a8: 8
0x80207458: 8 # align RunQueue to 0x001251d8
0x800b9140: 32 # align gam_win_moji1_tex to 32 bytes
0x801f71c0: 32 # align texture_buffer_data to 32 bytes
0x800daaa0: 32 # align texture_cache_data_func to 32 bytes
0x80206f30: 16 # malloc.c align 16 bytes
0x800ab260: 32
0x800d3b00: 32 # dspboot data section has alignment to 32
0x801864b0: 8 # dspbuf align 8 (not sure why this doesn't happen)

View File

@ -1,47 +0,0 @@
MEMORY {
text : origin = 0x80003100
forcestrip : origin = 0
}
SECTIONS
{
GROUP:{
.init ALIGN(0x20):{}
extab_ ALIGN(0x20):{}
extabindex_ ALIGN(0x20):{}
.text ALIGN(0x20):{}
.ctors ALIGN(0x20):{}
.dtors ALIGN(0x20):{}
.rodata ALIGN(0x20):{}
.data ALIGN(0x20):{}
.bss ALIGN(0x20):{}
.sdata ALIGN(0x20):{}
.sbss ALIGN(0x20):{}
.sdata2 ALIGN(0x20):{}
.sbss2 ALIGN(0x20):{}
.stack ALIGN(0x100):{}
} > text
GROUP:{
forcestrip ALIGN(0x20):{}
} > forcestrip
_stack_addr = (_f_sbss2 + SIZEOF(.sbss2) + 65536 + 0x7) & ~0x7;
_stack_end = _f_sbss2 + SIZEOF(.sbss2);
_db_stack_addr = (_stack_addr + 0x2000);
_db_stack_end = _stack_addr;
__ArenaLo = (_db_stack_addr + 0x1f) & ~0x1f;
__ArenaHi = 0x81700000;
_eti_init_info = 0x80005684;
}
FORCEACTIVE {
PPCDIS_FORCEACTIVE
}
FORCEFILES
{
PPCDIS_FORCEFILES
}
__dummy_str = 0;
__dummy_float = 0;
__dummy_double = 0;
__dummy_pointer = 0;

View File

@ -1,25 +0,0 @@
path: dump/static.dol
r13: 0x8021fb80
r2: 0x80220be0
section_defs:
text:
- name: .init
- name: .text
data:
- name: extab_
attr: a
- name: extabindex_
attr: a
- name: .ctors
balign: 0
- name: .dtors
balign: 0
- name: .rodata
- name: .data
- name: .sdata
- name: .sdata2
bss:
- name: .bss
balign: 4
- name: .sbss
label_prefix: ".L"

View File

@ -1,396 +0,0 @@
ctors.s:
.ctors: [0x800a97b4, 0x800a97c0] # remove trailing 0s from ctor area
#dolphin/os/__start.c:
# .init: [0x80003100, 0x80003354]
runtime/__mem.c:
.init: [0x800033a8, 0x800034e0]
TRK/init/mem_TRK.c:
.init: [0x800034e0, 0x80003534]
asm/__exception.s:
.init: [0x80003534, 0x80005468]
boot.c:
.text: [0x800056c0, 0x8000663c]
.rodata: [0x800a97e0, 0x800a97e8]
.data: [0x800af860, 0x800afe50]
.bss: [0x800e2280, 0x800e2318]
jsyswrap.cpp:
.text: [0x8000663c, 0x80007188]
.ctors: [0x800a9784, 0x800a9788]
.data: [0x800afe50, 0x800b05e8]
.bss: [0x800e2318, 0x800e2640]
initial_menu.c:
.text: [0x80007188, 0x80007e58]
.rodata: [0x800a97e8, 0x800a97f8]
.data: [0x800b0608, 0x800b0a60]
.bss: [0x800e2640, 0x800e2790]
dvderr.c:
.text: [0x80007e58, 0x800083f8]
.rodata: [0x800a97f8, 0x800a9838]
.data: [0x800b0a60, 0x800b9140]
.bss: [0x800e2790, 0x800e2b88]
jaudio_NES/game/dummyprobe.c:
.text: [0x800083f8, 0x80008400]
jaudio_NES/game/audioheaders.c:
.data: [0x800cca40, 0x800ce880]
jaudio_NES/game/verysimple.c:
.text: [0x80008400, 0x80008480]
.sdata: [0x80217b80, 0x80217b88]
# jaudio_NES/game/game64.c: # TODO: finish
# .rodata: [0x800a9938, 0x800a9b98]
jaudio_NES/game/melody.c:
.text: [0x8001561c, 0x80015a4c]
.rodata: [0x800a9b98, 0x800aa500]
.sbss: [0x80218390, 0x802183a0]
.sdata2: [0x80218d58, 0x80218d60]
jaudio_NES/game/rhythm.c:
.text: [0x80015a4c, 0x800165ec]
.bss: [0x8017bdd8, 0x8017be80]
.sdata: [0x80217bd0, 0x80217bd8]
.sbss: [0x802183a0, 0x802183b0]
.sdata2: [0x80218d60, 0x80218d78]
jaudio_NES/game/radio.c:
.text: [0x800165ec, 0x8001676c]
.sdata2: [0x80218d78, 0x80218d88]
jaudio_NES/game/kappa.c:
.text: [0x8001676c,0x80016840]
.sbss: [0x802183b0, 0x802183b8]
jaudio_NES/game/staff.c:
.text: [0x80016840, 0x80016d20]
.data: [0x800cfe10, 0x800cff20]
.sbss: [0x802183b8, 0x802183c8]
.sdata2: [0x80218d98, 0x80218da0]
jaudio_NES/internal/aictrl.c:
.text: [0x80017e80, 0x80018640]
.rodata: [0x800aa500, 0x800aa518]
.bss: [0x8017cfa0, 0x8017cfc0]
.sbss: [0x802183f0, 0x80218420]
.sdata2: [0x80218da8, 0x80218db8]
jaudio_NES/internal/sample.c:
.text: [0x80018640, 0x80018920]
jaudio_NES/internal/dummyrom.c:
.text: [0x80018920, 0x80018bc0]
.rodata: [0x800aa518, 0x800aa528]
# .bss: [0x8020d78c, 0x8020d7a0] # placed in common bss
.sbss: [0x80218420, 0x80218440]
jaudio_NES/internal/audiothread.c:
.text: [0x80018bc0, 0x800190e0]
.rodata: [0x800aa528, 0x800aa538]
.bss: [0x8017cfc0, 0x80180020]
.sbss: [0x80218440, 0x80218460]
.sdata2: [0x80218db8, 0x80218dc0]
jaudio_NES/internal/neosthread.c:
.text: [0x800190e0, 0x80019380]
.rodata: [0x800aa538, 0x800aa558]
.bss: [0x80180020, 0x80186440]
.sdata: [0x80217be0, 0x80217be8]
.sbss: [0x80218460, 0x80218478]
jaudio_NES/internal/streamctrl.c:
.text: [0x80019380, 0x80019760]
.data: [0x800d01a8, 0x800d0278]
.bss: [0x80186440, 0x801864b0]
.sdata2: [0x80218dc0, 0x80218dd0]
jaudio_NES/internal/dspbuf.c:
.text: [0x80019760, 0x80019ae0]
.rodata: [0x800aa558, 0x800aa570]
.bss: [0x801864b0, 0x801864c0]
.sbss: [0x80218478, 0x80218488]
jaudio_NES/internal/cpubuf.c:
.text: [0x80019ae0, 0x80019dc0]
.bss: [0x801864c0, 0x801864d0]
.sbss: [0x80218488, 0x80218498]
jaudio_NES/internal/playercall.c:
.text: [0x80019dc0, 0x8001a0c0]
.bss: [0x801864d0,0x80186590]
jaudio_NES/internal/dvdthread.c:
.text: [0x8001a0c0, 0x8001ada0]
.data: [0x800d0278, 0x800d0298]
.bss: [0x80186590, 0x8018f1a8]
.sbss: [0x80218498, 0x802184e8]
jaudio_NES/internal/sub_sys.c:
.text: [0x80024ae0, 0x80026120]
.rodata: [0x800aa700, 0x800aa720]
.data: [0x800d0300, 0x800d0390]
.sbss: [0x80218510, 0x80218528]
.sdata2: [0x80218e48, 0x80218e60]
jaudio_NES/internal/os.c:
.text: [0x80026120, 0x80026300]
jaudio_NES/internal/astest.c:
.text: [0x80026300, 0x80026400]
jaudio_NES/internal/track.c:
.text: [0x80028e60, 0x8002c920]
.rodata: [0x800aa720, 0x800aa780]
.data: [0x800d36f0, 0x800d3b00]
.sbss: [0x80218540, 0x80218548]
.sdata2: [0x80218ec8, 0x80218f08]
jaudio_NES/internal/dspboot.c:
.text: [0x8002c920, 0x8002cd20]
.rodata: [0x800aa780, 0x800aa7a0]
.data: [0x800d3b00, 0x800d5500]
.sdata2: [0x80218f08, 0x80218f10]
jaudio_NES/internal/dspproc.c:
.text: [0x8002cd20, 0x8002cfe0]
.sdata: [0x80217c18, 0x80217c20]
jaudio_NES/internal/random.c:
.text: [0x80031ce0, 0x80031d80]
.sdata: [0x80217c38, 0x80217c40]
.sdata2: [0x80218f60, 0x80218f70]
Famicom/famicom.cpp:
.text: [0x80041614, 0x80046888] # TODO: get ~J2DOrthoGraph's dtor in here somehow? 0x800468fc, also add in JUTGamePad::getPortStatus when JUTGamePad is linked?
.rodata: [0x800aa9a8, 0x800aaa30]
.data: [0x800d8778, 0x800d99a0]
.bss: [0x801ef540, 0x801f6bd8]
Famicom/famicom_nesinfo.cpp:
.text: [0x800468fc, 0x80047e40]
.rodata: [0x800aaa30, 0x800aab60]
.data: [0x800d99a0, 0x800da9c8]
.bss: [0x801f6bd8, 0x801f6c80]
GBA2/JoyBoot.c:
.text: [0x80049788, 0x8004ae00]
.data: [0x800daa08, 0x800daaa0]
.bss: [0x801f7180, 0x801f71c0]
libforest/osreport.c:
.text: [0x8005a654, 0x8005a92c]
.data: [0x800dc6d8, 0x800dc738]
.bss: [0x80206f08, 0x80206f20]
.sbss: [0x80218618, 0x80218628]
libforest/fault.c:
.text: [0x8005a92c, 0x8005adac]
.data: [0x800dc738, 0x800dc7c8]
.bss: [0x80206f20, 0x80206f30]
.sbss: [0x80218628, 0x80218630]
libforest/ReconfigBATs.c:
.text: [0x8005adac, 0x8005aed4]
libu64/debug.c:
.text: [0x8005aed4, 0x8005af30]
.data: [0x800dc7c8, 0x800dc7f0]
libu64/gfxprint.c:
.text: [0x8005af30, 0x8005b9a8]
.data: [0x800dc7f0, 0x800dc810]
.sbss: [0x80218630, 0x80218638]
libu64/pad.c:
.text: [0x8005b9a8, 0x8005ba2c]
libc64/aprintf.c:
.text: [0x8005cbdc, 0x8005cc14]
libc64/math64.c:
.text: [0x8005cc14, 0x8005cccc]
.sdata2: [0x80219118, 0x80219130]
libc64/qrand.c:
.text: [0x8005cccc, 0x8005cd64]
.sdata: [0x80217de8, 0x80217df0]
.sbss: [0x80218640, 0x80218648]
.sdata2: [0x80219130, 0x80219138]
libc64/sprintf.c:
.text: [0x8005ce18, 0x8005cf08]
libc64/malloc.c:
.text: [0x8005cf08, 0x8005d01c]
.bss: [0x80206F30, 0x80206F60]
libultra/ultra.c:
.text: [0x8005d01c, 0x8005d15c]
.bss: [0x80206f60, 0x80206fa0]
#libultra/gu/scale.c:
# .text: [0x8005e7d4, 0x8005e860]
# .sdata2: [0x80219208, 0x80219210]
#libultra/gu/translate.c:
# .text: [0x8005e8ac, 0x8005e918]
libultra/gu/sins.c:
.text: [0x8005e860, 0x8005e8ac]
.data: [0x800dd360, 0x800ddb60]
#libultra/xldtob.c:
# .text: [0x8005e918, 0x8005f2a0]
# .rodata: [0x800ab110, 0x800ab158]
# .sdata: [0x80217df8, 0x80217e08]
# .sdata2: [0x80219210, 0x80219230]
#libultra/xlitob.c:
# .text: [0x8005f2a0, 0x8005f4cc]
# .data: [0x800ddb60, 0x800ddb88]
#libultra/xprintf.c:
# .text: [0x8005f4cc, 0x8005ff74]
# .rodata: [0x800ab158, 0x800ab170]
# .data: [0x800ddb88, 0x800ddd20]
# .sdata: [0x80217e08, 0x80217e10]
# .sdata2: [0x80219230, 0x80219238]
JSystem/JKernel/JKRHeap.cpp:
.text: [0x80063748, 0x80064028]
.data: [0x800ddf20, 0x800ddf98]
.sdata: [0x80217e58, 0x80217e80]
.sbss: [0x802186d8, 0x80218700]
JSystem/JKernel/JKRExpHeap.cpp:
.text: [0x80064028, 0x80065aa0]
.data: [0x800ddf98, 0x800de3a8]
.sdata: [0x80217e80, 0x80217ec0]
.sbss: [0x80218700, 0x80218720]
.sdata2: [0x80219278, 0x80219288]
JSystem/JKernel/JKRDisposer.cpp:
.text: [0x80065aa0, 0x80065b8c]
.data: [0x800de3a8, 0x800de3c0]
.sdata: [0x80217ec0, 0x80217ec8]
JSystem/JKernel/JKRThread.cpp:
.text: [0x80065b8c, 0x80065ef0]
.ctors: [0x800a978c, 0x800a9790]
.data: [0x800de3c0, 0x800de3f8]
.bss: [0x80207008, 0x80207020]
.sdata: [0x80217ec8, 0x80217ed8]
JSystem/JKernel/JKRAram.cpp:
.text: [0x80065ef8, 0x80066e84]
.ctors: [0x800a9790, 0x800a9794]
.data: [0x800de3f8, 0x800de4c0]
.bss: [0x80207020, 0x80207038]
.sdata: [0x80217ed8, 0x80217ef8]
.sbss: [0x80218720, 0x80218758]
JSystem/JKernel/JKRAramHeap.cpp:
.text: [0x80066e84, 0x80067258]
.ctors: [0x800a9794, 0x800a9798]
.data: [0x800de4c0, 0x800de4f0]
.bss: [0x80207038, 0x80207050]
.sdata: [0x80217ef8, 0x80217f08]
JSystem/JKernel/JKRAramBlock.cpp:
.text: [0x80067258, 0x800674c8]
.data: [0x800de4f0, 0x800de510]
.sdata: [0x80217f08, 0x80217f10]
JSystem/JKernel/JKRAramPiece.cpp:
.text: [0x800674c8, 0x80067a88]
.ctors: [0x800a9798, 0x800a979c]
.data: [0x800de510, 0x800de568]
.bss: [0x80207050, 0x80207080]
.sdata: [0x80217f10, 0x80217f18]
JSystem/JKernel/JKRAramStream.cpp:
.text: [0x80067a88, 0x80067ff4]
.data: [0x800de568, 0x800de608]
.sdata: [0x80217f18, 0x80217f38]
.sbss: [0x80218758, 0x80218768]
JSystem/JKernel/JKRFileLoader.cpp:
.text: [0x80067ff4, 0x800685b0]
.ctors: [0x800a979c, 0x800a97a0]
.data: [0x800de608, 0x800de670]
.bss: [0x80207080, 0x80207098]
.sdata: [0x80217f38, 0x80217f50]
.sbss: [0x80218768, 0x80218770]
JSystem/JKernel/JKRFileFinder.cpp:
.text: [0x800685b0, 0x80068744]
.data: [0x800de670, 0x800de6b0]
.sdata: [0x80217f50, 0x80217f60]
JSystem/JKernel/JKRArchivePub.cpp:
.text: [0x80068744, 0x80068ed0]
.data: [0x800de6b0, 0x800de740]
.sdata: [0x80217f60, 0x80217f78]
JSystem/JKernel/JKRArchivePri.cpp:
.text: [0x80068ed0, 0x80069530]
.sbss: [0x80218770, 0x80218778]
JSystem/JKernel/JKRMemArchive.cpp:
.text: [0x80069530, 0x80069a28]
.data: [0x800de740, 0x800de828]
.sdata: [0x80217f78, 0x80217f98]
JSystem/JKernel/JKRAramArchive.cpp:
.text: [0x80069a28, 0x8006a4fc]
.data: [0x800de828, 0x800de938]
.sdata: [0x80217f98, 0x80217fc8]
JSystem/JKernel/JKRDvdArchive.cpp:
.text: [0x8006a4fc, 0x8006add0]
.data: [0x800de938, 0x800dea70]
.sdata: [0x80217fc8, 0x80217fe8]
JSystem/JKernel/JKRCompArchive.cpp:
.text: [0x8006add0, 0x8006b8a4]
.data: [0x800dea70, 0x800deba8]
.sdata: [0x80217fe8, 0x80218008]
JSystem/JKernel/JKRDvdFile.cpp:
.text: [0x8006b8a4, 0x8006be0c]
.ctors: [0x800a97a0, 0x800a97a4]
.data: [0x800deba8, 0x800dec30]
.bss: [0x80207098, 0x802070b0]
.sdata: [0x80218008, 0x80218028]
JSystem/JKernel/JKRDvdRipper.cpp:
.text: [0x8006be0c, 0x8006c8fc]
.ctors: [0x800a97a4, 0x800a97a8]
.data: [0x800dec30, 0x800dec90]
.bss: [0x802070b0, 0x802070c8]
.sdata: [0x80218028, 0x80218030]
.sbss: [0x80218778, 0x802187a8]
JSystem/JKernel/JKRDvdAramRipper.cpp:
.text: [0x8006c8fc, 0x8006d608]
.ctors: [0x800a97a8, 0x800a97ac]
.bss: [0x802070c8, 0x802070e0]
.sdata: [0x80218030, 0x80218038]
.sbss: [0x802187a8, 0x802187e8]
JSystem/JKernel/JKRDecomp.cpp:
.text: [0x8006d608, 0x8006dd58]
.data: [0x800dec90, 0x800ded18]
.sdata: [0x80218038, 0x80218050]
.sbss: [0x802187e8, 0x802187f0]
JSystem/JSupport/JSUInputStream.cpp:
.text: [0x8006e168, 0x8006e3e4]
.data: [0x800ded18, 0x800dedb8]
.sdata: [0x80218050, 0x80218068]
#JSystem/JSupport/JSUFileStream.cpp: # JSUFileStream linkage disabled until we can resolve order of RTTI strings in .data
# .text: [0x8006e3e4, 0x8006e604]
# .data: [0x800dedb8, 0x800dee60]
# .sdata: [0x80218068, 0x80218088]
JSystem/JGadget/linklist.cpp:
.text: [0x8006e604, 0x8006e800]
JSystem/JUtility/JUTGamePad.cpp:
.text: [0x80070274, 0x800713b0]
.ctors: [0x800a97ac, 0x800a97b0]
.rodata: [0x800ab240, 0x800ab260]
.data: [0x800def60, 0x800defa0]
.bss: [0x802070e0, 0x80207268]
.sdata: [0x802180b8, 0x802180d0]
.sbss: [0x80218808, 0x80218838]
.sdata2: [0x802192c0, 0x80219300]
dolphin/BASE/ppcarch.c:
.text: [0x8007867c, 0x80078718]
dolphin/os/OSArena.c:
.text: [0x8007988c, 0x800798ac]
.sdata: [0x80218178, 0x80218180]
.sbss: [0x802188f8, 0x80218900]
#dolphin/os/OSCache.c:
# .text: [0x80079b40, 0x8007a01c]
# .data: [0x800dfa00, 0x800dfc30]
#dolphin/os/OSDisableInterrupts.c:
# .text: [0x8007ac24, 0x8007ac38]
dolphin/os/OSEnableInterrupts.c:
.text: [0x8007ac38, 0x8007ac4c]
dolphin/os/OSRestoreInterrupts.c:
.text: [0x8007ac4c, 0x8007ac70]
dolphin/os/OSRtc.c:
.text: [0x8007d050, 0x8007db20]
.bss: [0x80207400, 0x80207458]
dolphin/__ppc_eabi_init.cpp:
.init: [0x80003354, 0x800033a8]
.text: [0x8007fdfc, 0x8007fe90]
dolphin/gx/GXStubs.c:
.text: [0x800998d4, 0x800998d8]
MSL_C/rand.c:
.text: [0x8009f46c, 0x8009f494]
.sdata: [0x80218260, 0x80218268]
TRK/mainloop.c:
.text: [0x800A1FF4, 0x800A20EC]
TRK/nubevent.c:
.text: [0x800A20EC, 0x800A2314]
.bss: [0x802095C8, 0x802095F0]
dolphin/amcstubs/AmcExi2Stubs.c:
.text: [0x800a8cc0, 0x800a8cf0]
#TRK/nubinit.c: #things break, fix later
# .text: [0x800A2314, 0x800A2494]
# .rodata: [0x800AF750, 0x800AF770]
# .bss: [0x802095F0, 0x802095F8]
#TRK/usr_put.c:
# .text: [0x800A3468, 0x800A34F4]
#TRK/dispatch.c:
# .text: [0x800A34F4, 0x800A3590]
# .data: [0x800E2128, 0x800E21B0]
# .bss: [0x8020AFC0, 0x8020AFC8]
dolphin/odenotstub/odenotstub.c:
.text: [0x800a9770, 0x800a9780]
version.c:
.data: [0x800b05e8, 0x800b0608]
bootdata/gam_win1.c:
.data: [0x800b9140, 0x800bb500]
bootdata/gam_win2.c:
.data: [0x800bb500, 0x800bd820]
bootdata/gam_win3.c:
.data: [0x800bd820, 0x800be460]
bootdata/logo_nin.c:
.data: [0x800be460, 0x800c3140]
nintendo_hi_0.c:
.data: [0x800c3140, 0x800cca40]
libu64/gfxprint_data.c:
.data: [0x800dc810, 0x800dd090]

View File

@ -1,24 +0,0 @@
SECTIONS {
GROUP:{
.init:{}
.text:{}
.ctors:{}
.dtors:{}
.rodata:{}
.data:{}
.bss:{}
// Removed by elf2rel
forcestrip:{}
relsymdef:{}
}
}
FORCEFILES {
}
FORCEACTIVE {
_prolog _epilog _unresolved
}
__dummy_str = 0;
__dummy_float = 0;
__dummy_double = 0;

View File

@ -1,5 +0,0 @@
path: dump/foresta.rel
address: 0x803701C0
bss_address: 0x8125A7C0
dol: config/dol.yml
label_prefix: ".L"

View File

@ -1,24 +0,0 @@
trim_ctors: true
trim_dtors: true
symbol_aligns:
0x8064d500 : 0x20
0x81295C80 : 0x20 # .bss m_handbill.o
0x8125a7c0 : 0x20 # construct_skip
0x81361820 : 0x20 # S_back_title_timer
0x806D4D40: 32 # align fFTR_myhome_off_pal_table to 32 bytes
0x8064F860: 32 # data right after m_camera2 TU
0x80C78B20: 32 # mFM_grd_s_cliff_tex
0x80F8C460: 32 # mFM_grd_s_rail_tex
0x80657200: 32 # .data msg.o
0x81297E80: 32 # .bss msg.o
0x81296140: 32 # .bss m_island.o
0x80904700: 32 # rom_myhome1_floor_v
0x80751140: 32 # dataobject.obj/.data/obj_zassou_tex
0x80DD61A0: 32 # dataobject/obj/.data/cKF_ckcb_r_int_hnw001_tbl (TU is aligned to 32 because of 32-byte aligned entries)
0x80F1CCA0: 32 # dataobject/obj/.data/rom_museum5_wall_pal
0x80F85720: 32 # dataobject/obj/.data/grd_player_select_evw_anime_1 (TU is aligned to 32)
0x80FACE20: 32 # dataobject/obj/.data/rom_shop4_1_floor_tex_pal
0x8074B840: 32 # dataobject/obj/.data/mFM_obj_a_01_flower_pal
0x808DF220: 32 # obj_otiba01_pal
0x809C8FA0: 32 # ef_hanabira01_0
0x80C0CBA0: 32 # crw_anrium1_pal

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

3117
diff.py

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +0,0 @@
from argparse import ArgumentParser, Namespace
import common as c
def apply(config, args: Namespace):
if args.rel:
config["mapfile"] = c.REL_MAP
config["myimg"] = c.REL_PLF
config["baseimg"] = c.REL_EXPECTED
config["source_directories"] = [c.REL_SRCDIR, c.INCDIR]
else:
config["mapfile"] = c.DOL_MAP
config["myimg"] = c.DOL_ELF
config["baseimg"] = c.DOL_EXPECTED
config["source_directories"] = [c.DOL_SRCDIR, c.INCDIR]
config["make_command"] = ["ninja"]
config["makeflags"] = []
config["arch"] = "ppc"
config["map_format"] = "mw"
config["mw_build_dir"] = c.BUILDDIR
config["objdump_executable"] = c.OBJDUMP
config["show_line_numbers_default"] = True
def add_custom_arguments(parser: ArgumentParser):
parser.add_argument("-r", "--rel", action="store_true", help="(AC) Diff a function in foresta.rel")

View File

@ -1,26 +0,0 @@
@echo off
echo "Please ensure Docker Desktop is running before continuing."
pause
:: Check if the compilers are present. If any one compiler doesn't exist, the download process will be initiated.
IF exist tools\1.2.5n\ ( echo 1.2.5n exists ) ELSE ( goto compilers )
IF exist tools\1.3.2\ ( echo 1.3.2 exists ) ELSE ( goto compilers )
IF exist tools\1.3.2r\ ( echo 1.3.2r exists ) ELSE ( goto compilers )
goto buildimage
:buildimage
docker build -t ac-decomp .
echo "Docker image setup is now complete. You may proceed with the instructions."
pause
exit
:compilers
curl -O https://files.decomp.dev/compilers_latest.zip
mkdir compilers_temp
powershell -command "Expand-Archive -LiteralPath 'compilers_latest.zip' -DestinationPath compilers_temp"
:: Only copy compilers that the user doesn't already have.
IF exist tools\1.2.5n\ ( echo 1.2.5n already exists, skipping copy ) ELSE ( xcopy compilers_temp\GC\1.2.5n\ tools\1.2.5n\ /E /I )
IF exist tools\1.3.2\ ( echo 1.3.2 already exists, skipping copy ) ELSE ( xcopy compilers_temp\GC\1.3.2\ tools\1.3.2\ /E /I )
IF exist tools\1.3.2r\ ( echo 1.3.2r already exists, skipping copy ) ELSE ( xcopy compilers_temp\GC\1.3.2r\ tools\1.3.2r\ /E /I )
del compilers_latest.zip
rmdir /S /Q compilers_temp\
goto buildimage

View File

@ -1,31 +0,0 @@
echo "Please ensure Docker is installed before continuing."
read -p "Press Enter to continue or CTRL-C to exit."
if [ -d "tools/1.2.5n" ]; then echo "1.2.5n exists" && export one_two_five_n_exist=1; fi
if [ -d "tools/1.3.2" ]; then echo "1.3.2 exists" && export one_three_two_exist=1; fi
if [ -d "tools/1.3.2r" ]; then echo "1.3.2r exists" && export one_three_two_r_exist=1; fi
if [ "$one_two_five_n_exist" -eq 1 ] && [ "$one_three_two_exist" -eq 1 ] && [ "$one_three_two_r_exist" -eq 1 ]; then docker build -t ac-decomp . && echo "Docker image setup is now complete. You may proceed with the instructions." && exit; fi
if command -v curl &> /dev/null; then
curl -O https://files.decomp.dev/compilers_latest.zip
elif command -v wget &> /dev/null; then
wget https://files.decomp.dev/compilers_latest.zip
else
echo "You do not seem to have curl or wget installed on this system. Please install one or the other to continue."
exit 0
fi
mkdir compilers_temp
if command -v unzip &> /dev/null; then
unzip compilers_latest.zip -d compilers_temp
else
echo "You do not seem to have unzip installed on this system. Please install it to continue."
rm -r compilers_temp compilers_latest.zip
exit 1
fi
if [ ! -d "tools/1.2.5n" ]; then mv compilers_temp/GC/1.2.5n/ tools/; fi
if [ ! -d "tools/1.3.2" ]; then mv compilers_temp/GC/1.3.2/ tools/; fi
if [ ! -d "tools/1.3.2r" ]; then mv compilers_temp/GC/1.3.2r/ tools/; fi
rm -r compilers_temp compilers_latest.zip
docker build -t ac-decomp .
echo "Docker image setup is now complete. You may proceed with the instructions."

View File

@ -1 +0,0 @@
c59d278ad8542bb05d6cbb632f60a0db05bef203 *out/foresta.rel

View File

@ -1 +0,0 @@
2ae8f56e7791d37e165bd5900921f2269f9515bf *out/static.dol

View File

@ -1,17 +0,0 @@
"""
Creates the expected folder for diff.py
"""
from shutil import copytree, rmtree
import common as c
# Remove it if already existing
try:
rmtree(c.EXPECTED)
except FileNotFoundError:
pass
# Copy in builddir and outdir
copytree(c.BUILDDIR, f"{c.EXPECTED}/build")
copytree(c.OUTDIR, f"{c.EXPECTED}/out")

View File

@ -1,47 +0,0 @@
from argparse import ArgumentParser
import os.path
import pickle
import json
from typing import Dict, Tuple
import common as c
def load_progress_info(ctx: c.SourceContext, asm_list: str
) -> Tuple[Dict[str, int], Dict[str, int]]:
assert os.path.exists(ctx.labels), "Error: analysis has not ran!"
# Get data
raw = c.get_cmd_stdout(f"{c.PROGRESS} {ctx.binary} {ctx.labels} {ctx.slices}")
dat = json.loads(raw)
assert dat.get("version") == 2, "Outdated progress json version, try a clean & rebuild"
decomp_sizes = dat["decomp_slices_sizes"]
total_sizes = dat["total_sizes"]
symbol_sizes = dat["symbol_sizes"]
# Subtract undecompiled functions in decompiled slices
# TODO: this assumes none of .init is decompiled
with open(asm_list, 'rb') as f:
funcs = pickle.load(f)
for func in funcs:
decomp_sizes[".text"] -= symbol_sizes[str(func)]
return decomp_sizes, total_sizes
def generate_frogress_json(dol_size, dol_total, rel_size, rel_total):
return json.dumps({
"rel": {
"code": rel_size,
"code/total": rel_total
},
"dol": {
"code": dol_size,
"code/total": dol_total
}
})
if __name__=="__main__":
decomp_sizes, total_sizes = load_progress_info(c.DOL_CTX, c.DOL_ASM_LIST)
rel_decomp_sizes, rel_total_sizes = load_progress_info(c.REL_CTX, c.REL_ASM_LIST)
json_str = generate_frogress_json(decomp_sizes[".text"], total_sizes[".text"], rel_decomp_sizes[".text"], rel_total_sizes[".text"])
with open("out/progress.json", "w") as f:
f.write(json_str)

View File

@ -14,54 +14,57 @@ extern "C" {
typedef void (*GBATransferCallback)(s32 chan);
typedef struct GBASecParam {
u8 readbuf[4];
s32 paletteColor;
s32 paletteSpeed;
s32 length;
u32* out;
u8 _padding0[12];
u32 keyA;
s32 keyB;
u8 _padding1[24];
// total size: 0x40
u8 readbuf[4]; // offset 0x0, size 0x4
s32 paletteColor; // offset 0x4, size 0x4
s32 paletteSpeed; // offset 0x8, size 0x4
s32 length; // offset 0xC, size 0x4
u32* out; // offset 0x10, size 0x4
u8 _padding0[12]; // offset 0x14, size 0xC
u32 keyA; // offset 0x20, size 0x4
s32 keyB; // offset 0x24, size 0x4
u8 _padding1[24]; // offset 0x28, size 0x18
} GBASecParam;
typedef struct GBABootInfo {
s32 paletteColor;
s32 paletteSpeed;
u8* programp;
s32 length;
u8* status;
GBACallback callback;
u8 readbuf[4];
u8 writebuf[4];
int i;
OSTick start;
OSTime begin;
int firstXfer;
int curOffset;
u32 crc;
u32 dummyWord[7];
u32 keyA;
s32 keyB;
u32 initialCode;
int realLength;
// total size: 0x68
s32 paletteColor; // offset 0x0, size 0x4
s32 paletteSpeed; // offset 0x4, size 0x4
u8* programp; // offset 0x8, size 0x4
s32 length; // offset 0xC, size 0x4
u8* status; // offset 0x10, size 0x4
GBACallback callback; // offset 0x14, size 0x4
u8 readbuf[4]; // offset 0x18, size 0x4
u8 writebuf[4]; // offset 0x1C, size 0x4
int i; // offset 0x20, size 0x4
OSTick start; // offset 0x24, size 0x4
OSTime begin; // offset 0x28, size 0x8
BOOL firstXfer; // offset 0x30, size 0x4
int curOffset; // offset 0x34, size 0x4
u32 crc; // offset 0x38, size 0x4
u32 dummyWord[7]; // offset 0x3C, size 0x1C
u32 keyA; // offset 0x58, size 0x4
s32 keyB; // offset 0x5C, size 0x4
u32 initialCode; // offset 0x60, size 0x4
int realLength; // offset 0x64, size 0x4
} GBABootInfo;
typedef struct GBAControl {
u8 output[5];
u8 input[5];
s32 outputBytes;
s32 inputBytes;
u8* status;
u8* ptr;
GBACallback callback;
s32 ret;
OSThreadQueue threadQueue;
OSTime delay;
GBATransferCallback proc;
GBABootInfo bootInfo;
DSPTaskInfo task;
GBASecParam* param;
// total size: 0x100
u8 output[5]; // offset 0x0, size 0x5
u8 input[5]; // offset 0x5, size 0x5
u32 outputBytes; // offset 0xC, size 0x4
u32 inputBytes; // offset 0x10, size 0x4
u8* status; // offset 0x14, size 0x4
void* ptr; // offset 0x18, size 0x4
GBACallback callback; // offset 0x1C, size 0x4
s32 ret; // offset 0x20, size 0x4
OSThreadQueue threadQueue; // offset 0x24, size 0x8
OSTime delay; // offset 0x30, size 0x8
GBATransferCallback proc; // offset 0x38, size 0x4
GBABootInfo bootInfo; // offset 0x40, size 0x68
DSPTaskInfo task; // offset 0xA8, size 0x50
GBASecParam * param; // offset 0xF8, size 0x4
} GBAControl;
extern GBAControl __GBA[4];
@ -71,7 +74,9 @@ void __GBAHandler(s32 chan, u32 error, OSContext* context);
void __GBASyncCallback(s32 chan, s32 ret);
s32 __GBASync(s32 chan);
OSTime __GBASetDelay(s32 chan, OSTime delay);
s32 __GBATransfer(s32 chan, s32 w1, s32 w2, GBATransferCallback callback);
s32 __GBATransfer(s32 chan, u32 outputBytes, u32 inputBytes, GBATransferCallback proc);
void __GBAX01(s32 chan, s32 ret);
void __GBAX02(s32 chan, u8* readbuf);
#ifdef __cplusplus
}

View File

@ -13,7 +13,7 @@ extern "C" {
#define GBA_CHAN3 3
#define GBA_MAX_CHAN 4
#define GBA_ALL_KEY_MASK 0x03ff
#define GBA_ALL_KEY_MASK 0x03FF
#define GBA_A_BUTTON 0x0001
#define GBA_B_BUTTON 0x0002
#define GBA_SELECT_BUTTON 0x0004
@ -25,7 +25,7 @@ extern "C" {
#define GBA_R_BUTTON 0x0100
#define GBA_L_BUTTON 0x0200
#define GBA_JSTAT_MASK 0x3a
#define GBA_JSTAT_MASK 0x3A
#define GBA_JSTAT_FLAGS_SHIFT 4
#define GBA_JSTAT_FLAGS_MASK 0x30
#define GBA_JSTAT_PSF1 0x20
@ -41,9 +41,11 @@ extern "C" {
#define GBA_JOYBOOT_PROGRAM_SIZE_MAX 0x40000
#define GBA_JOYBOOT_BOOTPARAM_OFFSET 0xc8
#define GBA_JOYBOOT_BOOTPARAM_OFFSET 0xC8
#define GBA_JOYBOOT_BOOTPARAM_SIZE 0x18
typedef void (*GBACallback)(s32 chan, s32 ret);
void GBAInit(void);
s32 GBAGetStatus(s32 chan, u8* status);
s32 GBAGetStatusAsync(s32 chan, u8* status, GBACallback callback);
@ -58,6 +60,7 @@ s32 GBAJoyBoot(s32 chan, s32 palette_color, s32 palette_speed, u8* programp, s32
u8* status);
s32 GBAJoyBootAsync(s32 chan, s32 palette_color, s32 palette_speed, u8* programp, s32 length,
u8* status, GBACallback callback);
#ifdef __cplusplus
}
#endif

View File

@ -25,24 +25,12 @@ private:
int mLine;
};
#ifdef DEBUG
#define JGADGET_ASSERTWARN(cond) \
((cond) || ((JGadget_outMessage(JGadget_outMessage::warning, __FILE__, __LINE__) << (#cond)), false))
#define JGADGET_EXITWARN(cond) \
if (!(cond)) { JGadget_outMessage(JGadget_outMessage::warning, __FILE__, __LINE__) << (#cond), false; return false; }
#else
#define JGADGET_ASSERTWARN(cond) \
((cond) || (false))
#define JGADGET_EXITWARN(cond) \
if (!(cond)) { false; return false; }
#endif
}
#endif

View File

@ -92,7 +92,6 @@ public:
}
TLinkListNode& operator*() const {
JUT_ASSERT(p_!=0);
return *this->p_;
}

View File

@ -3,9 +3,6 @@
#include "types.h"
#ifdef __cplusplus
extern "C" {
class JSUPtrLink;
class JSUPtrList
@ -174,11 +171,11 @@ public:
bool insertChild(JSUTree<T> *before, JSUTree<T> *child) { return this->insert(before, child); }
JSUTree<T> *getEndChild() const { return nullptr; }
JSUTree<T> *getFirstChild() const { return (JSUTree<T> *)getFirstLink(); }
JSUTree<T> *getFirstChild() const { return (JSUTree<T> *)this->getFirstLink(); }
JSUTree<T> *getLastChild() const { return (JSUTree<T> *)this->getLast(); }
JSUTree<T> *getNextChild() const { return (JSUTree<T> *)mNext; }
JSUTree<T> *getNextChild() const { return (JSUTree<T> *)this->mNext; }
JSUTree<T> *getPrevChild() const { return (JSUTree<T> *)this->getPrev(); }
u32 getNumChildren() const { return mLinkCount; }
u32 getNumChildren() const { return this->mLinkCount; }
T *getObject() const { return (T *)this->mData; }
JSUTree<T> *getParent() const { return (JSUTree<T> *)this->mPtrList; }
};
@ -223,7 +220,4 @@ private:
JSUTree<T> *mTree;
};
}
#endif
#endif /* JSULIST_H */
#endif /* JSULIST_H */

View File

@ -44,22 +44,8 @@ namespace JUTAssertion
#define JUT_MINMAX_ASSERT(...)
#define JUT_MAX_ASSERT(...)
#define JUT_LOG_F(...)
#if defined(DEBUG) || 1
#define JUT_ASSERT(...)
#define JUT_ASSERT_F(...)
#else
#define JUT_ASSERT(COND) \
((COND)) ? (void)0 : (JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, __LINE__, #COND), OSHalt("Halt"));
#define JUT_ASSERT_F(COND, ...) \
if ((COND) == false) \
{ \
JUTAssertion::showAssert_f(JUTAssertion::getSDevice(), __FILE__, __LINE__, __VA_ARGS__); \
OSHalt("Halt"); \
}
#endif
}
#endif

View File

@ -1,9 +1,17 @@
#ifndef _JSYSTEM_JUT_JUTDBPRINT_H
#define _JSYSTEM_JUT_JUTDBPRINT_H
#ifdef __cplusplus
extern "C" {
#endif
void* JC_JUTDbPrint_getManager(void);
void JC_JUTDbPrint_setVisible(void*, int); // I know these are C++ but these were used to match a c function so I'll fix these when I need them or fix zurumode update.
void JUTReport(int x, int y, int show_count, const char* fmt, ...);
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,8 +1,8 @@
#ifndef RAND_H
#define RAND_H
#include "types.h"
void srand(u32 seed);
int rand(void);
#endif
#ifndef RAND_H
#define RAND_H
#include "types.h"
void srand(u32 seed);
int rand(void);
#endif

View File

@ -1,22 +1,22 @@
#ifndef _MEM_H
#define _MEM_H
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
#pragma section code_type ".init"
void * memcpy(void * dst, const void * src, size_t n);
void * memset(void * dst, int val, size_t n);
int memcmp(const void* src1, const void* src2, size_t n);
void __fill_mem(void * dst, int val, unsigned long n);
#pragma section code_type
#ifdef __cplusplus
};
#endif
#ifndef _MEM_H
#define _MEM_H
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
#pragma section code_type ".init"
void * memcpy(void * dst, const void * src, size_t n);
void * memset(void * dst, int val, size_t n);
int memcmp(const void* src1, const void* src2, size_t n);
void __fill_mem(void * dst, int val, unsigned long n);
#pragma section code_type
#ifdef __cplusplus
};
#endif
#endif

View File

@ -2,7 +2,7 @@
#define BOOTDATA_H
#include "types.h"
#include "PR/mbi.h"
#include "PR/gbi.h"
#ifdef __cplusplus
extern "C" {

View File

@ -1,36 +0,0 @@
#ifndef PPCARCH_H
#define PPCARCH_H
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
u32 PPCMfmsr(void);
void PPCMtmsr(u32);
u32 PPCMfhid0(void);
void PPCMthid0(u32);
u32 PPCMfl2cr(void);
void PPCMtl2cr(u32);
void PPCMtdec(u32);
void PPCSync(void);
void PPCHalt(void);
u32 PPCMfhid2(void);
void PPCMthid2(u32);
void PPCMtwpar(u32);
void PPCDisableSpeculation(void);
void PPCSetFpNonIEEEMode(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,100 @@
#ifndef PPCARCH_H
#define PPCARCH_H
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
u32 PPCMfmsr(void);
void PPCMtmsr(u32);
u32 PPCMfhid0(void);
void PPCMthid0(u32);
u32 PPCMfl2cr(void);
void PPCMtl2cr(u32);
void PPCMtdec(u32);
void PPCSync(void);
void PPCHalt(void);
u32 PPCMfhid2(void);
void PPCMthid2(u32);
void PPCMtwpar(u32);
void PPCDisableSpeculation(void);
void PPCSetFpNonIEEEMode(void);
#define HID0_EMCP 0x80000000u // Enable MCP
#define HID0_DBP 0x40000000u // Enable 60x bus address and data parity chk
#define HID0_EBA 0x20000000u // Enable 60x address parity checking
#define HID0_EBD 0x10000000u // Enable 60x data parity checking
#define HID0_BCLK 0x08000000u // CLK_OUT output enable and clk selection
#define HID0_ECLK 0x02000000u // CLK_OUT output enable and clk selection
#define HID0_PAR 0x01000000u // Disable !ARTRY precharge
#define HID0_DOZE 0x00800000u // Doze mode enable
#define HID0_NAP 0x00400000u // Nap mode enable
#define HID0_SLEEP 0x00200000u // Sleep mode enable
#define HID0_DPM 0x00100000u // Dynamic power management enable
#define HID0_NHR 0x00010000u // Not hard reset (0 hard reset if s/w set it)
#define HID0_ICE 0x00008000u // Instruction cache enable
#define HID0_DCE 0x00004000u // Data cache enable
#define HID0_ILOCK 0x00002000u // ICache lock
#define HID0_DLOCK 0x00001000u // DCache lock
#define HID0_ICFI 0x00000800u // ICache flash invalidate
#define HID0_DCFI 0x00000400u // DCache flash invalidate
#define HID0_SPD 0x00000200u // Speculative cache access enable (0 enable)
#define HID0_IFEM 0x00000100u // Enable M bit on bus for Ifetch
#define HID0_SGE 0x00000080u // Store gathering enable
#define HID0_DCFA 0x00000040u // DCache flush assist - set before a flush
#define HID0_BTIC 0x00000020u // Branch target icache enable
#define HID0_ABE 0x00000008u // Address bcast enable
#define HID0_BHT 0x00000004u // Branch history table enable
#define HID0_NOOPTI 0x00000001u // No-op Dcache touch instructions
#define HID2_DCHERR 0x00800000 // ERROR: dcbz_l cache hit
#define HID2_DNCERR 0x00400000 // ERROR: DMA access to normal cache
#define HID2_DCMERR 0x00200000 // ERROR: DMA cache miss error
#define HID2_DQOERR 0x00100000 // ERROR: DMA queue overflow
#define HID2_DCHEE 0x00080000 // dcbz_l cache hit error enable
#define HID2_DNCEE 0x00040000 // DMA access to normal cache error enable
#define HID2_DCMEE 0x00020000 // DMA cache miss error error enable
#define HID2_DQOEE 0x00010000 // DMA queue overflow error enable
#define SRR1_DMA_BIT 0x00200000
#define SRR1_L2DP_BIT 0x00100000
#define L2CR_L2E 0x80000000 // L2 Enable
#define L2CR_L2PE 0x40000000 // L2 data parity generation and checking enable
#define L2CR_L2DO 0x00400000 // Data only
#define L2CR_L2I 0x00200000 // Global invalidate
#define L2CR_L2CTL 0x00100000 // ZZ enable
#define L2CR_L2WT 0x00080000 // L2 write through
#define L2CR_L2TS 0x00040000 // L2 test support
#define MSR_POW 0x00040000 // Power Management
#define MSR_ILE 0x00010000 // Interrupt Little Endian
#define MSR_EE 0x00008000 // external interrupt
#define MSR_PR 0x00004000 // privilege level(should be 0)
#define MSR_FP 0x00002000 // floating point available
#define MSR_ME 0x00001000 // machine check enable
#define MSR_FE0 0x00000800 // floating point exception enable
#define MSR_SE 0x00000400 // single step trace enable
#define MSR_BE 0x00000200 // branch trace enable
#define MSR_FE1 0x00000100 // floating point exception enable
#define MSR_IP 0x00000040 // Exception prefix
#define MSR_IR 0x00000020 // instruction relocate
#define MSR_DR 0x00000010 // data relocate
#define MSR_PM 0x00000004 // Performance monitor marked mode
#define MSR_RI 0x00000002 // Recoverable interrupt
#define MSR_LE 0x00000001 // Little Endian
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,6 @@
#ifndef OS_AUDIO_SYSTEM_H
#define OS_AUDIO_SYSTEM_H
#include "types.h"
#endif

View File

@ -1,45 +1,173 @@
#ifndef OS_CONTEXT_H
#define OS_CONTEXT_H
#ifndef _DOLPHIN_OSCONTEXT_H_
#define _DOLPHIN_OSCONTEXT_H_
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OSContext{
u32 gprs[32];
u32 cr;
u32 lr;
u32 ctr;
u32 xer;
f64 fprs[32];
u32 fpscr_tmp;
u32 fpscr;
u32 srr0;
u32 srr1;
u16 mode;
u16 state;
u32 gqrs[8];
char UNK_0x1C4;
f64 psfs[32];
#define __OS_CONTEXT_FRAME 768
#define OS_CONTEXT_R0 0
#define OS_CONTEXT_R1 4
#define OS_CONTEXT_R2 8
#define OS_CONTEXT_R3 12
#define OS_CONTEXT_R4 16
#define OS_CONTEXT_R5 20
#define OS_CONTEXT_R6 24
#define OS_CONTEXT_R7 28
#define OS_CONTEXT_R8 32
#define OS_CONTEXT_R9 36
#define OS_CONTEXT_R10 40
#define OS_CONTEXT_R11 44
#define OS_CONTEXT_R12 48
#define OS_CONTEXT_R13 52
#define OS_CONTEXT_R14 56
#define OS_CONTEXT_R15 60
#define OS_CONTEXT_R16 64
#define OS_CONTEXT_R17 68
#define OS_CONTEXT_R18 72
#define OS_CONTEXT_R19 76
#define OS_CONTEXT_R20 80
#define OS_CONTEXT_R21 84
#define OS_CONTEXT_R22 88
#define OS_CONTEXT_R23 92
#define OS_CONTEXT_R24 96
#define OS_CONTEXT_R25 100
#define OS_CONTEXT_R26 104
#define OS_CONTEXT_R27 108
#define OS_CONTEXT_R28 112
#define OS_CONTEXT_R29 116
#define OS_CONTEXT_R30 120
#define OS_CONTEXT_R31 124
#define OS_CONTEXT_CR 128
#define OS_CONTEXT_LR 132
#define OS_CONTEXT_CTR 136
#define OS_CONTEXT_XER 140
#define OS_CONTEXT_FPR0 144
#define OS_CONTEXT_FPR1 152
#define OS_CONTEXT_FPR2 160
#define OS_CONTEXT_FPR3 168
#define OS_CONTEXT_FPR4 176
#define OS_CONTEXT_FPR5 184
#define OS_CONTEXT_FPR6 192
#define OS_CONTEXT_FPR7 200
#define OS_CONTEXT_FPR8 208
#define OS_CONTEXT_FPR9 216
#define OS_CONTEXT_FPR10 224
#define OS_CONTEXT_FPR11 232
#define OS_CONTEXT_FPR12 240
#define OS_CONTEXT_FPR13 248
#define OS_CONTEXT_FPR14 256
#define OS_CONTEXT_FPR15 264
#define OS_CONTEXT_FPR16 272
#define OS_CONTEXT_FPR17 280
#define OS_CONTEXT_FPR18 288
#define OS_CONTEXT_FPR19 296
#define OS_CONTEXT_FPR20 304
#define OS_CONTEXT_FPR21 312
#define OS_CONTEXT_FPR22 320
#define OS_CONTEXT_FPR23 328
#define OS_CONTEXT_FPR24 336
#define OS_CONTEXT_FPR25 344
#define OS_CONTEXT_FPR26 352
#define OS_CONTEXT_FPR27 360
#define OS_CONTEXT_FPR28 368
#define OS_CONTEXT_FPR29 376
#define OS_CONTEXT_FPR30 384
#define OS_CONTEXT_FPR31 392
#define OS_CONTEXT_FPSCR 400
#define OS_CONTEXT_SRR0 408
#define OS_CONTEXT_SRR1 412
#define OS_CONTEXT_MODE 416
#define OS_CONTEXT_STATE 418
#define OS_CONTEXT_GQR0 420
#define OS_CONTEXT_GQR1 424
#define OS_CONTEXT_GQR2 428
#define OS_CONTEXT_GQR3 432
#define OS_CONTEXT_GQR4 436
#define OS_CONTEXT_GQR5 440
#define OS_CONTEXT_GQR6 444
#define OS_CONTEXT_GQR7 448
#define __OSCONTEXT_PADDING 452
#define OS_CONTEXT_PSF0 456
#define OS_CONTEXT_PSF1 464
#define OS_CONTEXT_PSF2 472
#define OS_CONTEXT_PSF3 480
#define OS_CONTEXT_PSF4 488
#define OS_CONTEXT_PSF5 496
#define OS_CONTEXT_PSF6 504
#define OS_CONTEXT_PSF7 512
#define OS_CONTEXT_PSF8 520
#define OS_CONTEXT_PSF9 528
#define OS_CONTEXT_PSF10 536
#define OS_CONTEXT_PSF11 544
#define OS_CONTEXT_PSF12 552
#define OS_CONTEXT_PSF13 560
#define OS_CONTEXT_PSF14 568
#define OS_CONTEXT_PSF15 576
#define OS_CONTEXT_PSF16 584
#define OS_CONTEXT_PSF17 592
#define OS_CONTEXT_PSF18 600
#define OS_CONTEXT_PSF19 608
#define OS_CONTEXT_PSF20 616
#define OS_CONTEXT_PSF21 624
#define OS_CONTEXT_PSF22 632
#define OS_CONTEXT_PSF23 640
#define OS_CONTEXT_PSF24 648
#define OS_CONTEXT_PSF25 656
#define OS_CONTEXT_PSF26 664
#define OS_CONTEXT_PSF27 672
#define OS_CONTEXT_PSF28 680
#define OS_CONTEXT_PSF29 688
#define OS_CONTEXT_PSF30 696
#define OS_CONTEXT_PSF31 704
#define OS_CONTEXT_STATE_EXC 0x02u
#define OS_CONTEXT_STATE_FPSAVED 0x01u
typedef struct OSContext
{
/*0x000*/ u32 gpr[32];
/*0x080*/ u32 cr;
/*0x084*/ u32 lr;
/*0x088*/ u32 ctr;
/*0x08C*/ u32 xer;
/*0x090*/ f64 fpr[32];
/*0x190*/ u32 fpscr_pad;
/*0x194*/ u32 fpscr;
/*0x198*/ u32 srr0;
/*0x19C*/ u32 srr1;
/*0x1A0*/ u16 mode;
/*0x1A2*/ u16 state;
/*0x1A4*/ u32 gqr[8];
/*0x1C4*/ f64 psf[32];
} OSContext;
OSContext* OS_CURRENT_CONTEXT_PHYS AT_ADDRESS(0x800000C0);
OSContext* OS_CURRENT_CONTEXT AT_ADDRESS(0x800000D4);
OSContext* OS_CURRENT_FPU_CONTEXT AT_ADDRESS(0x800000D8);
u32 OSGetStackPointer(void);
void OSDumpContext(OSContext *context);
void OSLoadContext(OSContext *context);
u32 OSSaveContext(OSContext *context);
void OSClearContext(OSContext *context);
OSContext *OSGetCurrentContext(void);
void OSSetCurrentContext(OSContext *context);
void OSLoadFPUContext(OSContext *fpuContext);
void OSSaveFPUContext(OSContext *fpuContext);
u32 OSSwitchStack(u32 newsp);
int OSSwitchFiber(u32 pc, u32 newsp);
void OSInitContext(OSContext *context, u32 pc, u32 newsp);
void OSFillFPUContext(OSContext *context);
void OSSaveFPUContext(OSContext*);
void OSSetCurrentContext(OSContext*);
OSContext* OSGetCurrentContext(void);
BOOL OSSaveContext(OSContext*);
void OSLoadContext(OSContext*);
void* OSGetStackPointer(void);
void OSClearContext(OSContext*);
void OSInitContext(register OSContext*, register u32 srr, register u32 sp);
void OSDumpContext(const OSContext*);
void __OSContextInit(void);
#ifdef __cplusplus
};
}
#endif
#endif

View File

@ -1,32 +1,37 @@
#ifndef OS_ERROR_H
#define OS_ERROR_H
#include "types.h"
#ifndef _DOLPHIN_OSERROR_H_
#define _DOLPHIN_OSERROR_H_
#include <dolphin/os/OSContext.h>
#ifdef __cplusplus
extern "C"{
extern "C" {
#endif
typedef enum {
OS_ERR_SYSTEM_RESET,
OS_ERR_MACHINE_CHECK,
OS_ERR_DSI,
OS_ERR_ISI,
OS_ERR_EXT_INTERRUPT,
OS_ERR_ALIGMENT,
OS_ERR_PROGRAM,
OS_ERR_FP_UNAVAIL,
OS_ERR_DECREMENTER,
OS_ERR_SYSTEM_CALL,
OS_ERR_TRACE,
OS_ERR_PERF_MONITOR,
OS_ERR_IABR,
OS_ERR_SMI,
OS_ERR_THERMAL_INT,
OS_ERR_PROTECTION,
OS_ERR_FP_EXCEPTION,
OS_ERR_MAX,
};
typedef u16 OSError;
typedef void (*OSErrorHandler)(OSError error, OSContext *context, ...);
#define OS_ERROR_SYSTEM_RESET 0
#define OS_ERROR_MACHINE_CHECK 1
#define OS_ERROR_DSI 2
#define OS_ERROR_ISI 3
#define OS_ERROR_EXTERNAL_INTERRUPT 4
#define OS_ERROR_ALIGNMENT 5
#define OS_ERROR_PROGRAM 6
#define OS_ERROR_FLOATING_POINT 7
#define OS_ERROR_DECREMENTER 8
#define OS_ERROR_SYSTEM_CALL 9
#define OS_ERROR_TRACE 10
#define OS_ERROR_PERFORMACE_MONITOR 11
#define OS_ERROR_BREAKPOINT 12
#define OS_ERROR_SYSTEM_INTERRUPT 13
#define OS_ERROR_THERMAL_INTERRUPT 14
#define OS_ERROR_PROTECTION 15
#define OS_ERROR_MAX (OS_ERROR_THERMAL_INTERRUPT + 1)
OSErrorHandler OSSetErrorHandler(OSError error, OSErrorHandler handler);
#ifdef __cplusplus
}
#endif
#endif
#endif

View File

@ -1,9 +1,37 @@
#ifndef DOLPHIN_OSEXCEPTION_H
#define DOLPHIN_OSEXCEPTION_H
#ifndef _DOLPHIN_OSEXCEPTION_H_
#define _DOLPHIN_OSEXCEPTION_H_
typedef enum OSException {
OS_EXCEPTION_FLOATING_POINT = 7,
OS_EXCEPTION_COUNT = 15,
} OSException;
#include <dolphin/os/OSContext.h>
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
#define __OS_EXCEPTION_SYSTEM_RESET 0
#define __OS_EXCEPTION_MACHINE_CHECK 1
#define __OS_EXCEPTION_DSI 2
#define __OS_EXCEPTION_ISI 3
#define __OS_EXCEPTION_EXTERNAL_INTERRUPT 4
#define __OS_EXCEPTION_ALIGNMENT 5
#define __OS_EXCEPTION_PROGRAM 6
#define __OS_EXCEPTION_FLOATING_POINT 7
#define __OS_EXCEPTION_DECREMENTER 8
#define __OS_EXCEPTION_SYSTEM_CALL 9
#define __OS_EXCEPTION_TRACE 10
#define __OS_EXCEPTION_PERFORMACE_MONITOR 11
#define __OS_EXCEPTION_BREAKPOINT 12
#define __OS_EXCEPTION_SYSTEM_INTERRUPT 13
#define __OS_EXCEPTION_THERMAL_INTERRUPT 14
#define __OS_EXCEPTION_MAX (__OS_EXCEPTION_THERMAL_INTERRUPT + 1)
typedef u8 __OSException;
typedef void (*__OSExceptionHandler)(__OSException exception, OSContext* context);
__OSExceptionHandler __OSSetExceptionHandler(__OSException exception, __OSExceptionHandler handler);
__OSExceptionHandler __OSGetExceptionHandler(__OSException exception);
#ifdef __cplusplus
}
#endif
#endif // _DOLPHIN_OSEXCEPTION_H_

View File

@ -126,7 +126,7 @@ u32 __OSMaskInterrupts(u32);
u32 __OSUnmaskInterrupts(u32);
u32 SetInterruptMask(OSInterruptMask mask, OSInterruptMask current);
void __OSDispatchInterrupt(OSException exception, OSContext* context);
void __OSDispatchInterrupt(__OSException exception, OSContext* context);
#ifdef __cplusplus

View File

@ -30,6 +30,7 @@ u32 OSGetResetCode();
void OSResetSystem(int reset, u32 resetCode, BOOL forceMenu);
BOOL OSGetResetSwitchState();
void OSGetSaveRegion(void** start, void** end);
void OSRegisterResetFunction(OSResetFunctionInfo* info);
#ifdef __cplusplus
}

View File

@ -26,6 +26,7 @@ u32 __busclock AT_ADDRESS(0x800000F8);
#define OSNanosecondsToTicks(nsec) (((nsec) * (OS_TIMER_CLOCK / 125000)) / 8000)
OSTime OSGetTime(void);
OSTime __OSGetSystemTime(void);
OSTick OSGetTick(void);
typedef struct OSCalendarTime_s {

View File

@ -1,6 +1,8 @@
#ifndef PPC_EABI_INIT_H
#define PPC_EABI_INIT_H
#include "types.h"
#ifdef __cplusplus
extern "C"{
#endif
@ -61,7 +63,6 @@ DECL_BSS_SECTION(_sbss2);
void __init_hardware(void);
void __flush_cache(void*, size_t);
void __init_user(void);
void __fini_cpp(void);
void _ExitProcess(void);
typedef struct RomSection {

View File

@ -0,0 +1,32 @@
#ifndef OS_ADDRESS_H
#define OS_ADDRESS_H
// maybe put this in OSUtil instead
#include "types.h"
#ifdef __cplusplus
extern "C"
{
#endif
// Defines for cached and uncached memory.
#define OS_BASE_CACHED (0x80000000)
#define OS_BASE_UNCACHED (0xC0000000)
// Address conversions.
#define OSPhysicalToCached(paddr) ((void *)((u32)(paddr) + OS_BASE_CACHED))
#define OSPhysicalToUncached(paddr) ((void *)((u32)(paddr) + OS_BASE_UNCACHED))
#define OSCachedToPhysical(caddr) ((u32)((u8 *)(caddr)-OS_BASE_CACHED))
#define OSUncachedToPhysical(ucaddr) ((u32)((u8 *)(ucaddr)-OS_BASE_UNCACHED))
#define OSCachedToUncached(caddr) ((void *)((u8 *)(caddr) + (OS_BASE_UNCACHED - OS_BASE_CACHED)))
#define OSUncachedToCached(ucaddr) ((void *)((u8 *)(ucaddr) - (OS_BASE_UNCACHED - OS_BASE_CACHED)))
#define OS_CACHED_REGION_PREFIX 0x8000
#define OS_UNCACHED_REGION_PREFIX 0xC000
#define OS_PHYSICAL_MASK 0x3FFF
#ifdef __cplusplus
};
#endif
#endif

View File

@ -0,0 +1,41 @@
#ifndef DOLPHIN_OS_ALARM_H
#define DOLPHIN_OS_ALARM_H
#include "types.h"
#include "dolphin/os/OSTime.h"
#include "dolphin/os/OSContext.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OSAlarm OSAlarm;
typedef void (*OSAlarmHandler)(OSAlarm* alarm, OSContext* context);
struct OSAlarm
{
OSAlarmHandler handler;
OSTime fire;
OSAlarm *prev;
OSAlarm *next;
// Periodic alarm
OSTime period;
OSTime start;
};
void OSInitAlarm(void);
void OSSetAlarm(OSAlarm *alarm, OSTime tick, OSAlarmHandler handler);
void OSSetAbsAlarm(OSAlarm *alarm, OSTime time, OSAlarmHandler handler);
void OSSetPeriodicAlarm(OSAlarm *alarm, OSTime start, OSTime period,
OSAlarmHandler handler);
void OSCreateAlarm(OSAlarm *alarm);
void OSCancelAlarm(OSAlarm *alarm);
BOOL OSCheckAlarmQueue(void);
#ifdef __cplusplus
}
#endif
#endif // DOLPHIN_OS_ALARM_H

View File

@ -0,0 +1,32 @@
#ifndef OS_ALLOC_H
#define OS_ALLOC_H
#ifdef __cplusplus
extern "C" {
#endif
typedef int OSHeapHandle;
extern volatile OSHeapHandle __OSCurrHeap;
void* OSAllocFromHeap(int heap, unsigned long size);
void* OSAllocFixed(void* rstart, void* rend);
void OSFreeToHeap(int heap, void* ptr);
int OSSetCurrentHeap(int heap);
void* OSInitAlloc(void* arenaStart, void* arenaEnd, int maxHeaps);
int OSCreateHeap(void* start, void* end);
void OSDestroyHeap(int heap);
void OSAddToHeap(int heap, void* start, void* end);
long OSCheckHeap(int heap);
unsigned long OSReferentSize(void* ptr);
void OSDumpHeap(int heap);
void OSVisitAllocated(void (*visitor)(void*, unsigned long));
#define OSAlloc(size) OSAllocFromHeap(__OSCurrHeap, (size))
#define OSFree(ptr) OSFreeToHeap(__OSCurrHeap, (ptr))
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,18 @@
#ifndef OS_ARENA_H
#define OS_ARENA_H
#include "types.h"
#ifdef __cplusplus
extern "C"{
#endif
void* OSGetArenaHi(void);
void* OSGetArenaLo(void);
void OSSetArenaHi(void*);
void OSSetArenaLo(void*);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,30 @@
#ifndef OS_CACHE_H
#define OS_CACHE_H
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
void DCEnable(void);
void DCInvalidateRange(void*, u32);
void DCFlushRange(void*, u32);
void DCStoreRange(void*, u32);
void DCFlushRangeNoSync(void*, u32);
void DCStoreRangeNoSync(void*, u32);
void DCZeroRange(void*, u32);
void DCTouchRange(void*, u32 len);
void ICInvalidateRange(void*, u32);
void ICFlashInvalidate(void);
void ICEnable(void);
void LCDisable(void);
//void L2GlobalInvalidate(void);
//void DMAErrorHandler(u8, struct OSContext*, u32, u32, ...);
//void __OSCacheInit(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,45 @@
#ifndef OS_CONTEXT_H
#define OS_CONTEXT_H
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OSContext{
u32 gprs[32];
u32 cr;
u32 lr;
u32 ctr;
u32 xer;
f64 fprs[32];
u32 fpscr_tmp;
u32 fpscr;
u32 srr0;
u32 srr1;
u16 mode;
u16 state;
u32 gqrs[8];
char UNK_0x1C4;
f64 psfs[32];
} OSContext;
OSContext* OS_CURRENT_CONTEXT_PHYS AT_ADDRESS(0x800000C0);
OSContext* OS_CURRENT_CONTEXT AT_ADDRESS(0x800000D4);
OSContext* OS_CURRENT_FPU_CONTEXT AT_ADDRESS(0x800000D8);
void OSSaveFPUContext(OSContext*);
void OSSetCurrentContext(OSContext*);
OSContext* OSGetCurrentContext(void);
BOOL OSSaveContext(OSContext*);
void OSLoadContext(OSContext*);
void* OSGetStackPointer(void);
void OSClearContext(OSContext*);
void OSInitContext(register OSContext*, register u32 srr, register u32 sp);
void OSDumpContext(const OSContext*);
void __OSContextInit(void);
#ifdef __cplusplus
};
#endif
#endif

View File

@ -0,0 +1,32 @@
#ifndef OS_ERROR_H
#define OS_ERROR_H
#include "types.h"
#ifdef __cplusplus
extern "C"{
#endif
typedef enum {
OS_ERR_SYSTEM_RESET,
OS_ERR_MACHINE_CHECK,
OS_ERR_DSI,
OS_ERR_ISI,
OS_ERR_EXT_INTERRUPT,
OS_ERR_ALIGMENT,
OS_ERR_PROGRAM,
OS_ERR_FP_UNAVAIL,
OS_ERR_DECREMENTER,
OS_ERR_SYSTEM_CALL,
OS_ERR_TRACE,
OS_ERR_PERF_MONITOR,
OS_ERR_IABR,
OS_ERR_SMI,
OS_ERR_THERMAL_INT,
OS_ERR_PROTECTION,
OS_ERR_FP_EXCEPTION,
OS_ERR_MAX,
};
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,9 @@
#ifndef DOLPHIN_OSEXCEPTION_H
#define DOLPHIN_OSEXCEPTION_H
typedef enum OSException {
OS_EXCEPTION_FLOATING_POINT = 7,
OS_EXCEPTION_COUNT = 15,
} OSException;
#endif

View File

@ -0,0 +1,72 @@
#ifndef DOLPHIN_OSEXI_H
#define DOLPHIN_OSEXI_H
#include "dolphin/os/OSContext.h"
#include "dolphin/os/OSInterrupt.h"
#include "types.h"
typedef enum {
EXI_STATE_DMA_ACCESS = (1 << 0),
EXI_STATE_IMM_ACCESS = (1 << 1),
EXI_STATE_SELECTED = (1 << 2),
EXI_STATE_ATTACHED = (1 << 3),
EXI_STATE_LOCKED = (1 << 4),
EXI_STATE_BUSY = EXI_STATE_DMA_ACCESS | EXI_STATE_IMM_ACCESS
} EXIState;
typedef enum {
EXI_CHAN_0,
EXI_CHAN_1,
EXI_CHAN_2,
EXI_MAX_CHAN
} EXIChannel;
typedef enum {
EXI_READ,
EXI_WRITE,
EXI_TYPE_2,
EXI_MAX_TYPE
} EXIType;
typedef void (*EXICallback)(EXIChannel, OSContext*);
typedef struct EXIControl {
EXICallback exiCallback;
EXICallback tcCallback;
EXICallback extCallback;
vu32 state;
int immLen;
u8* immBuf;
u32 dev;
u32 id;
s32 idTime;
int items;
struct {
u32 dev;
EXICallback callback;
} queue[3];
} EXIControl;
#define EXI_REG_MAX 5
extern vu32 __EXIRegs[EXI_MAX_CHAN][EXI_REG_MAX] AT_ADDRESS(0xCC006800);
void SetExiInterruptMask(EXIChannel, volatile EXIControl*);
BOOL EXIImm(EXIChannel, void* buf, s32 len, u32 type, EXICallback);
BOOL EXIImmEx(EXIChannel, void* buf, s32 len, u32 mode);
BOOL EXIDma(EXIChannel, void* buf, s32 len, u32 type, EXICallback);
BOOL EXISync(EXIChannel);
u32 EXIClearInterrupts(EXIChannel, BOOL exi, BOOL tc, BOOL ext);
EXICallback EXISetExiCallback(EXIChannel, EXICallback exiCallback);
BOOL EXIProbe(EXIChannel);
s32 EXIProbeEx(EXIChannel);
BOOL EXIAttach(EXIChannel, EXICallback);
BOOL EXIDetach(EXIChannel);
BOOL EXISelect(EXIChannel, u32 dev, u32 freq);
BOOL EXIDeselect(EXIChannel);
void EXIInit(void);
BOOL EXILock(EXIChannel, u32 dev, EXICallback unlockedCallback);
BOOL EXIUnlock(EXIChannel);
u32 EXIGetState(EXIChannel);
s32 EXIGetID(EXIChannel, u32 dev, u32* id);
#endif

View File

@ -0,0 +1,124 @@
#ifndef _DOLPHIN_OS_OSFASTCAST_H
#define _DOLPHIN_OS_OSFASTCAST_H
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif // ifdef __cplusplus
/////// FAST CAST DEFINES ////////
// GQR formats.
#define OS_GQR_U8 (0x0004) // GQR 1
#define OS_GQR_U16 (0x0005) // GQR 2
#define OS_GQR_S8 (0x0006) // GQR 3
#define OS_GQR_S16 (0x0007) // GQR 4
// GQRs for fast casting.
#define OS_FASTCAST_U8 (2)
#define OS_FASTCAST_U16 (3)
#define OS_FASTCAST_S8 (4)
#define OS_FASTCAST_S16 (5)
//////////////////////////////////
/////// FAST CAST INLINES ////////
// Initialise fast casting.
static inline void OSInitFastCast() {
#ifdef __MWERKS__ // clang-format off
asm {
li r3, OS_GQR_U8
oris r3, r3, OS_GQR_U8
mtspr 0x392, r3
li r3, OS_GQR_U16
oris r3, r3, OS_GQR_U16
mtspr 0x393, r3
li r3, OS_GQR_S8
oris r3, r3, OS_GQR_S8
mtspr 0x394, r3
li r3, OS_GQR_S16
oris r3, r3, OS_GQR_S16
mtspr 0x395, r3
}
#endif // clang-format on
}
// Float to int.
static inline s16 __OSf32tos16(register f32 inF) {
register s16 out;
u32 tmp;
register u32* tmpPtr = &tmp;
#ifdef __MWERKS__ // clang-format off
asm {
psq_st inF, 0(tmpPtr), 0x1, OS_FASTCAST_S16
lha out, 0(tmpPtr)
}
#endif // clang-format on
return out;
}
static inline void OSf32tos16(f32* f, s16* out) {
*out = __OSf32tos16(*f);
}
static inline u8 __OSf32tou8(register f32 inF) {
register u8 out;
u32 tmp;
register u32* tmpPtr = &tmp;
#ifdef __MWERKS__ // clang-format off
asm {
psq_st inF, 0(tmpPtr), 0x1, OS_FASTCAST_U8
lbz out, 0(tmpPtr)
}
#endif // clang-format on
return out;
}
static inline void OSf32tou8(f32* f, u8* out) {
*out = __OSf32tou8(*f);
}
static inline s8 __OSf32tos8(register f32 inF) {
register s8 out;
u32 tmp;
register u32* tmpPtr = &tmp;
#ifdef __MWERKS__ // clang-format off
asm {
psq_st inF, 0(tmpPtr), 0x1, OS_FASTCAST_S8
lbz out, 0(tmpPtr)
extsb out, out
}
#endif // clang-format on
return out;
}
static inline void OSf32tos8(f32* f, s8* out) {
*out = __OSf32tos8(*f);
}
static inline float __OSs16tof32(register s16* s) {
register float f;
#ifdef __MWERKS__ // clang-format off
asm {
psq_l f, 0(s), 1, 5
}
#endif // clang-format on
return f;
}
static inline void OSs16tof32(register s16* s, volatile register f32* f) {
*f = __OSs16tof32(s);
}
//////////////////////////////////
#ifdef __cplusplus
};
#endif // ifdef __cplusplus
#endif

View File

@ -0,0 +1,55 @@
#ifndef OSFONT_H
#define OSFONT_H
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OSFontHeader {
u16 fontType; // _00
u16 firstChar; // _02, first char code defined in font.
u16 lastChar; // _04, last char code defined in font.
u16 invalChar; // _06, code to sub for invalid chars.
u16 ascent; // _08
u16 descent; // _0A
u16 width; // _0C, max width.
u16 leading; // _0E
u16 cellWidth; // _10
u16 cellHeight; // _12
u32 sheetSize; // _14
u16 sheetFormat; // _18, see GX_TF_* part of GXTexFmt enum
u16 sheetColumn; // _1A
u16 sheetRow; // _1C
u16 sheetWidth; // _1E
u16 sheetHeight; // _20
u16 widthTable; // _22
u32 sheetImage; // _24
u32 sheetFullSize; // _28
u8 c0; // _2C, font color components?
u8 c1; // _2D
u8 c2; // _2E
u8 c3; // _2F
} OSFontHeader;
#define OS_FONT_ENCODE_NULL -1
#define OS_FONT_ENCODE_ANSI 0u
#define OS_FONT_ENCODE_SJIS 1u
#define OS_FONT_ENCODE_UTF8 3u // UTF-8 [RFC 3629]
#define OS_FONT_ENCODE_UTF16 4u // UTF-16BE [RFC 2781]
#define OS_FONT_ENCODE_UTF32 5u // UTF-32
#define OS_FONT_ENCODE_MAX 5u
#define OS_FONT_ENCODE_VOID 0xffffu
#define OS_FONT_PROPORTIONAL FALSE
#define OS_FONT_FIXED TRUE
u16 OSGetFontEncode(void);
u16 OSSetFontEncode(u16 encode);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,136 @@
#ifndef DOLPHIN_OSINTERRUPT_H
#define DOLPHIN_OSINTERRUPT_H
#include "dolphin/os/OSContext.h"
#include "dolphin/os/OSException.h"
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef s16 __OSInterrupt;
typedef u32 OSInterruptMask;
typedef enum OSInterruptType {
OS_INTR_MEM_0,
OS_INTR_MEM_1,
OS_INTR_MEM_2,
OS_INTR_MEM_3,
OS_INTR_MEM_ADDRESS,
OS_INTR_DSP_AI,
OS_INTR_DSP_ARAM,
OS_INTR_DSP_DSP,
OS_INTR_AI_AI,
OS_INTR_EXI_0_EXI,
OS_INTR_EXI_0_TC,
OS_INTR_EXI_0_EXT,
OS_INTR_EXI_1_EXI,
OS_INTR_EXI_1_TC,
OS_INTR_EXI_1_EXT,
OS_INTR_EXI_2_EXI,
OS_INTR_EXI_2_TC,
OS_INTR_PI_CP,
OS_INTR_PI_PE_TOKEN,
OS_INTR_PI_PE_FINISH,
OS_INTR_PI_SI,
OS_INTR_PI_DI,
OS_INTR_PI_RSW,
OS_INTR_PI_ERROR,
OS_INTR_PI_VI,
OS_INTR_PI_DEBUG,
OS_INTR_PI_HSP,
OS_INTR_PI_ACR,
OS_INTR_28,
OS_INTR_29,
OS_INTR_30,
OS_INTR_31,
OS_INTR_MAX
} OSInterruptType;
#define OS_INTRMASK_MEM_0 (0x80000000U >> OS_INTR_MEM_0)
#define OS_INTRMASK_MEM_1 (0x80000000U >> OS_INTR_MEM_1)
#define OS_INTRMASK_MEM_2 (0x80000000U >> OS_INTR_MEM_2)
#define OS_INTRMASK_MEM_3 (0x80000000U >> OS_INTR_MEM_3)
#define OS_INTRMASK_MEM_ADDRESS (0x80000000U >> OS_INTR_MEM_ADDRESS)
#define OS_INTRMASK_DSP_AI (0x80000000U >> OS_INTR_DSP_AI)
#define OS_INTRMASK_DSP_ARAM (0x80000000U >> OS_INTR_DSP_ARAM)
#define OS_INTRMASK_DSP_DSP (0x80000000U >> OS_INTR_DSP_DSP)
#define OS_INTRMASK_AI_AI (0x80000000U >> OS_INTR_AI_AI)
#define OS_INTRMASK_EXI_0_EXI (0x80000000U >> OS_INTR_EXI_0_EXI)
#define OS_INTRMASK_EXI_0_TC (0x80000000U >> OS_INTR_EXI_0_TC)
#define OS_INTRMASK_EXI_0_EXT (0x80000000U >> OS_INTR_EXI_0_EXT)
#define OS_INTRMASK_EXI_1_EXI (0x80000000U >> OS_INTR_EXI_1_EXI)
#define OS_INTRMASK_EXI_1_TC (0x80000000U >> OS_INTR_EXI_1_TC)
#define OS_INTRMASK_EXI_1_EXT (0x80000000U >> OS_INTR_EXI_1_EXT)
#define OS_INTRMASK_EXI_2_EXI (0x80000000U >> OS_INTR_EXI_2_EXI)
#define OS_INTRMASK_EXI_2_TC (0x80000000U >> OS_INTR_EXI_2_TC)
#define OS_INTRMASK_PI_CP (0x80000000U >> OS_INTR_PI_CP)
#define OS_INTRMASK_PI_PE_TOKEN (0x80000000U >> OS_INTR_PI_PE_TOKEN)
#define OS_INTRMASK_PI_PE_FINISH (0x80000000U >> OS_INTR_PI_PE_FINISH)
#define OS_INTRMASK_PI_SI (0x80000000U >> OS_INTR_PI_SI)
#define OS_INTRMASK_PI_DI (0x80000000U >> OS_INTR_PI_DI)
#define OS_INTRMASK_PI_RSW (0x80000000U >> OS_INTR_PI_RSW)
#define OS_INTRMASK_PI_ERROR (0x80000000U >> OS_INTR_PI_ERROR)
#define OS_INTRMASK_PI_VI (0x80000000U >> OS_INTR_PI_VI)
#define OS_INTRMASK_PI_DEBUG (0x80000000U >> OS_INTR_PI_DEBUG)
#define OS_INTRMASK_PI_HSP (0x80000000U >> OS_INTR_PI_HSP)
#define OS_INTRMASK_MEM \
(OS_INTRMASK_MEM_0 | OS_INTRMASK_MEM_1 | OS_INTRMASK_MEM_2 | \
OS_INTRMASK_MEM_3 | OS_INTRMASK_MEM_ADDRESS)
#define OS_INTRMASK_AI (OS_INTRMASK_AI_AI)
#define OS_INTRMASK_DSP \
(OS_INTRMASK_DSP_AI | OS_INTRMASK_DSP_ARAM | OS_INTRMASK_DSP_DSP)
#define OS_INTRMASK_EXI_0 \
(OS_INTRMASK_EXI_0_EXI | OS_INTRMASK_EXI_0_TC | OS_INTRMASK_EXI_0_EXT)
#define OS_INTRMASK_EXI_1 \
(OS_INTRMASK_EXI_1_EXI | OS_INTRMASK_EXI_1_TC | OS_INTRMASK_EXI_1_EXT)
#define OS_INTRMASK_EXI_2 (OS_INTRMASK_EXI_2_EXI | OS_INTRMASK_EXI_2_TC)
#define OS_INTRMASK_EXI \
(OS_INTRMASK_EXI_0_EXI | OS_INTRMASK_EXI_0_TC | OS_INTRMASK_EXI_0_EXT | \
OS_INTRMASK_EXI_1_EXI | OS_INTRMASK_EXI_1_TC | OS_INTRMASK_EXI_1_EXT | \
OS_INTRMASK_EXI_2_EXI | OS_INTRMASK_EXI_2_TC)
#define OS_INTRMASK_PI \
(OS_INTRMASK_PI_CP | OS_INTRMASK_PI_SI | OS_INTRMASK_PI_DI | \
OS_INTRMASK_PI_RSW | OS_INTRMASK_PI_ERROR | OS_INTRMASK_PI_VI | \
OS_INTRMASK_PI_PE_TOKEN | OS_INTRMASK_PI_PE_FINISH | \
OS_INTRMASK_PI_DEBUG | OS_INTRMASK_PI_HSP)
#define OS_INTRMASK_PI_PE (OS_INTRMASK_PI_PE_TOKEN | OS_INTRMASK_PI_PE_FINISH)
typedef void (*OSInterruptHandler)(__OSInterrupt, OSContext*);
extern volatile u32 __OSLastInterruptSrr0;
extern volatile s16 __OSLastInterrupt;
extern volatile s64 __OSLastInterruptTime;
void __RAS_OSDisableInterrupts_begin(void);
void __RAS_OSDisableInterrupts_end(void);
BOOL OSDisableInterrupts(void);
BOOL OSEnableInterrupts(void);
BOOL OSRestoreInterrupts(BOOL);
OSInterruptHandler __OSSetInterruptHandler(__OSInterrupt, OSInterruptHandler);
OSInterruptHandler __OSGetInterruptHandler(__OSInterrupt);
void __OSInterruptInit(void);
u32 __OSMaskInterrupts(u32);
u32 __OSUnmaskInterrupts(u32);
u32 SetInterruptMask(OSInterruptMask mask, OSInterruptMask current);
void __OSDispatchInterrupt(OSException exception, OSContext* context);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,17 @@
#ifndef OS_MEMORY_H
#define OS_MEMORY_H
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
#define SIM_MEM *(u32 *)0x800000f0
static void Config24MB();
static void Config48MB();
u32 OSGetConsoleSimulatedMemSize(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,51 @@
#ifndef _DOLPHIN_OS_OSMESSAGE_H
#define _DOLPHIN_OS_OSMESSAGE_H
#include "types.h"
#include "dolphin/os/OSUtil.h"
#include "dolphin/os/OSThread.h"
#ifdef __cplusplus
extern "C" {
#endif // ifdef __cplusplus
///////// MESSAGE TYPES //////////
typedef struct OSMessageQueue OSMessageQueue;
// Useful typedef for messages.
typedef void* OSMessage;
// Struct for managing the message queue.
struct OSMessageQueue {
OSThreadQueue queueSend; // _00
OSThreadQueue queueReceive; // _08
OSMessage* msgArray; // _10, array of messages.
int msgCount; // _14, array limit size.
int firstIndex; // _18, first message index in array.
int usedCount; // _1C, actual number of used messages.
};
// Defines for message flags for sending/receiving.
#define OS_MESSAGE_NOBLOCK (0)
#define OS_MESSAGE_BLOCK (1)
typedef enum {
OS_MSG_PERSISTENT = (1 << 0),
} OSMessageFlags;
//////////////////////////////////
/////// MESSAGE FUNCTIONS ////////
// Functions for handling messages.
void OSInitMessageQueue(OSMessageQueue* queue, OSMessage* msgArray, int msgCount);
BOOL OSSendMessage(OSMessageQueue* queue, OSMessage msg, int flags);
BOOL OSJamMessage(OSMessageQueue* queue, OSMessage msg, int flags);
BOOL OSReceiveMessage(OSMessageQueue* queue, OSMessage* msgPtr, int flags);
//////////////////////////////////
#ifdef __cplusplus
};
#endif // ifdef __cplusplus
#endif

View File

@ -0,0 +1,72 @@
#ifndef DOLPHIN_OSMODULE_H
#define DOLPHIN_OSMODULE_H
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OSModuleInfo_s OSModuleInfo;
typedef struct OSModuleQueue_s {
OSModuleInfo* head;
OSModuleInfo* tail;
} OSModuleQueue;
typedef struct OSModuleLink_s {
OSModuleInfo* next;
OSModuleInfo* prev;
} OSModuleLink;
typedef struct OSModuleInfo_s {
u32 id;
OSModuleLink link;
u32 numSections;
u32 sectionInfoOfs;
u32 nameOfs;
u32 nameSize;
u32 version;
} OSModuleInfo;
typedef struct OSModuleHeader_s {
OSModuleInfo info;
u32 bssSize;
u32 relOfs;
u32 impOfs;
u32 impSize;
u8 prologSection;
u8 epilogSection;
u8 unresolvedSection;
u8 bssSection;
u32 prolog;
u32 epilog;
u32 unresolved;
/* OS_MODULE_VERSION >= 2 */
u32 align;
u32 bssAlign;
} OSModuleHeader;
typedef struct OSSectionInfo_s {
u32 offset;
u32 size;
} OSSectionInfo;
#define OSGetSectionInfo(module) \
((OSSectionInfo*) (((OSModuleInfo*) (module))->sectionInfoOfs))
#define OS_SECTIONINFO_EXEC 1
#define OS_SECTIONINFO_OFFSET(offset) ((offset) & ~OS_SECTIONINFO_EXEC)
void OSSetStringTable (const void* strTable);
BOOL OSLink(OSModuleInfo* module, void* bss);
BOOL OSUnlink(OSModuleInfo* module);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,36 @@
#ifndef OS_MUTEX_H
#define OS_MUTEX_H
#ifdef __cplusplus
extern "C"
{
#endif
#include "dolphin/os/OSThread.h"
struct OSMutex
{
OSThreadQueue queue;
OSThread *thread; // the current owner
s32 count; // lock count
OSMutexLink link; // for OSThread.queueMutex
};
struct OSCond
{
OSThreadQueue queue;
};
void OSInitMutex(OSMutex *mutex);
void OSLockMutex(OSMutex *mutex);
void OSUnlockMutex(OSMutex *mutex);
BOOL OSTryLockMutex(OSMutex *mutex);
void OSInitCond(OSCond *cond);
void OSWaitCond(OSCond *cond, OSMutex *mutex);
void OSSignalCond(OSCond *cond);
#ifdef __cplusplus
}
#endif
#endif // DOLPHIN_OSMUTEX_H

View File

@ -0,0 +1,38 @@
#ifndef OSRESET_H
#define OSRESET_H
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
#define OS_RESETCODE_RESTART 0x80000000
#define OS_RESET_RESTART 0
#define OS_RESET_HOTRESET 1 /* Soft reset */
#define OS_RESET_SHUTDOWN 2
typedef BOOL (*OSResetFunction)(BOOL final);
typedef struct OSResetFunctionInfo OSResetFunctionInfo;
struct OSResetFunctionInfo {
// public
OSResetFunction func;
u32 priority;
// private
OSResetFunctionInfo* next;
OSResetFunctionInfo* prev;
};
u32 OSGetResetCode();
void OSResetSystem(int reset, u32 resetCode, BOOL forceMenu);
BOOL OSGetResetSwitchState();
void OSGetSaveRegion(void** start, void** end);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,16 @@
#ifndef OSRESETSW_H
#define OSRESETSW_H
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
BOOL OSGetResetSwitchState();
#ifdef __cplusplus
}
#endif
#endif

111
include/dolphin/os1/OSRtc.h Normal file
View File

@ -0,0 +1,111 @@
#ifndef DOLPHIN_OSRTC_H
#define DOLPHIN_OSTRC_H
#include "types.h"
#include "dolphin/os/OSExi.h"
#ifdef __cplusplus
extern "C" {
#endif
#define OS_SOUND_MODE_MONO 0
#define OS_SOUND_MODE_STEREO 1
#define OS_PROGRESSIVE_MODE_OFF 0
#define OS_PROGRESSIVE_MODE_ON 1
#define OS_BOOT_MODE_DEBUG (0 << 7)
#define OS_BOOT_MODE_RETAIL (1 << 7)
#define RTC_CMD_READ 0x20000000
#define RTC_CMD_WRITE 0xA0000000
#define RTC_SRAM_ADDR 0x00000100
#define RTC_SRAM_SIZE 64
#define RTC_CHAN EXI_CHAN_0
#define RTC_DEVICE 1
#define RTC_FREQUENCY 3
typedef struct OSSram_s {
u16 checkSum;
u16 checkSumInv;
u32 ead0;
u32 ead1;
u32 counterBias;
s8 displayOffsetH;
u8 ntd;
u8 language;
u8 flags;
} OSSram;
typedef struct OSSramEx_s {
u8 flashID[2][12];
u32 wirelessKeyboardID;
u16 wirelessPadID[4];
u8 dvdErrorCode;
u8 pad0;
u8 flashIDCheckSum[2];
u16 gbs;
u8 pad1[2];
} OSSramEx;
typedef struct SramControlBlock_s {
u8 sram[RTC_SRAM_SIZE];
u32 offset;
BOOL enabled;
BOOL locked;
BOOL sync;
void (*callback)(void);
} SramControlBlock;
// static void GetRTC();
// extern void __OSGetRTC();
// extern void __OSSetRTC();
static inline BOOL ReadSram(void* buffer);
static void WriteSramCallback(EXIChannel chan, OSContext* ctx);
static BOOL WriteSram(void* buffer, u32 offset, u32 size);
extern void __OSInitSram();
static inline void* LockSram(u32 offset);
extern OSSram* __OSLockSram();
extern OSSramEx* __OSLockSramEx();
static BOOL UnlockSram(BOOL commit, u32 offset);
extern void __OSUnlockSram(BOOL commit);
extern void __OSUnlockSramEx(BOOL commit);
extern BOOL __OSSyncSram();
// extern void __OSCheckSram();
// extern void __OSReadROM();
// extern void __OSReadROMCallback();
// extern void __OSReadROMAsync();
extern u32 OSGetSoundMode();
extern void OSSetSoundMode(u32 mode);
extern u32 OSGetProgressiveMode();
extern void OSSetProgressiveMode(u32 on);
// extern void OSGetVideoMode();
// extern void OSSetVideoMode();
// extern void OSGetLanguage();
// extern void OSSetLanguage();
// extern void __OSGetBootMode();
extern void __OSSetBootMode(u8 mode);
// extern void OSGetEuRgb60Mode();
// extern void OSSetEuRgb60Mode();
extern u16 OSGetWirelessID(u32 chan);
extern void OSSetWirelessID(u32 chan, u16 id);
#define GET_SOUNDMODE(flags) ((flags) & (1 << 2))
#define CLR_SOUNDMODE(flags) ((flags) & (~(1 << 2)))
#define SET_SOUNDMODE(mode) (((mode) & 1) << 2)
#define GET_PROGMODE(flags) ((flags) & (1 << 7))
#define CLR_PROGMODE(flags) ((flags) & (~(1 << 7)))
#define SET_PROGMODE(mode) (((mode) & 1) << 7)
#define GET_BOOTMODE(flags) ((flags) & (1 << 7))
#define CLR_BOOTMODE(flags) ((flags) & (~(1 << 7)))
#define SET_BOOTMODE(mode) (mode)
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,70 @@
#ifndef DOLPHIN_OSSERIAL
#define DOLPHIN_OSSERIAL
#include <types.h>
#ifdef __cplusplus
extern "C" {
#endif
#define SI_MAX_CHAN 4
#define SI_MAX_COMCSR_INLNGTH 128
#define SI_MAX_COMCSR_OUTLNGTH 128
#define SI_ERROR_UNDER_RUN 0x0001
#define SI_ERROR_OVER_RUN 0x0002
#define SI_ERROR_COLLISION 0x0004
#define SI_ERROR_NO_RESPONSE 0x0008
#define SI_ERROR_WRST 0x0010
#define SI_ERROR_RDST 0x0020
#define SI_ERROR_UNKNOWN 0x0040
#define SI_ERROR_BUSY 0x0080
#define SI_CHAN0 0
#define SI_CHAN1 1
#define SI_CHAN2 2
#define SI_CHAN3 3
#define SI_CHAN0_BIT 0x80000000
#define SI_CHAN1_BIT 0x40000000
#define SI_CHAN2_BIT 0x20000000
#define SI_CHAN3_BIT 0x10000000
#define SI_CHAN_BIT(chan) (SI_CHAN0_BIT >> (chan))
#define SI_TYPE_MASK 0x18000000u
#define SI_TYPE_N64 0x00000000u
#define SI_TYPE_DOLPHIN 0x08000000u
#define SI_TYPE_GC SI_TYPE_DOLPHIN
#define SI_GC_WIRELESS 0x80000000
#define SI_GC_NOMOTOR 0x20000000
#define SI_GC_STANDARD 0x01000000
#define SI_WIRELESS_RECEIVED 0x40000000
#define SI_WIRELESS_IR 0x04000000
#define SI_WIRELESS_STATE 0x02000000
#define SI_WIRELESS_ORIGIN 0x00200000
#define SI_WIRELESS_FIX_ID 0x00100000
#define SI_WIRELESS_TYPE 0x000f0000
#define SI_WIRELESS_LITE_MASK 0x000c0000
#define SI_WIRELESS_LITE 0x00040000
#define SI_WIRELESS_CONT_MASK 0x00080000
#define SI_WIRELESS_CONT 0x00000000
#define SI_WIRELESS_ID 0x00c0ff00
#define SI_WIRELESS_TYPE_ID (SI_WIRELESS_TYPE | SI_WIRELESS_ID)
#define SI_N64_CONTROLLER (SI_TYPE_N64 | 0x05000000)
#define SI_N64_MIC (SI_TYPE_N64 | 0x00010000)
#define SI_N64_KEYBOARD (SI_TYPE_N64 | 0x00020000)
#define SI_N64_MOUSE (SI_TYPE_N64 | 0x02000000)
#define SI_GBA (SI_TYPE_N64 | 0x00040000)
#define SI_GC_CONTROLLER (SI_TYPE_GC | SI_GC_STANDARD)
#define SI_GC_RECEIVER (SI_TYPE_GC | SI_GC_WIRELESS)
#define SI_GC_WAVEBIRD \
(SI_TYPE_GC | SI_GC_WIRELESS | SI_GC_STANDARD | SI_WIRELESS_STATE | SI_WIRELESS_FIX_ID)
#define SI_GC_KEYBOARD (SI_TYPE_GC | 0x00200000)
#define SI_GC_STEERING (SI_TYPE_GC | 0x00000000)
u32 SIProbe(s32 chan);
char* SIGetTypeString(u32 type);
void SIRefreshSamplingRate(void);
void SISetSamplingRate(u32 msec);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,129 @@
#ifndef OS_THREAD_H
#define OS_THREAD_H
#ifdef __cplusplus
extern "C"
{
#endif
#include "dolphin/os/OSContext.h"
typedef struct OSThread OSThread;
typedef struct OSThreadQueue OSThreadQueue;
typedef struct OSThreadLink OSThreadLink;
typedef s32 OSPriority; // 0 highest, 31 lowest
typedef struct OSMutex OSMutex;
typedef struct OSMutexQueue OSMutexQueue;
typedef struct OSMutexLink OSMutexLink;
typedef struct OSCond OSCond;
typedef void (*OSIdleFunction)(void *param);
struct OSThreadQueue
{
OSThread *head;
OSThread *tail;
};
struct OSThreadLink
{
OSThread *next;
OSThread *prev;
};
struct OSMutexQueue
{
OSMutex *head;
OSMutex *tail;
};
struct OSMutexLink
{
OSMutex *next;
OSMutex *prev;
};
struct OSThread
{
OSContext context; // register context
u16 state; // OS_THREAD_STATE_*
u16 attr; // OS_THREAD_ATTR_*
s32 suspend; // suspended if the count is greater than zero
OSPriority priority; // effective scheduling priority
OSPriority base; // base scheduling priority
void *val; // exit value
OSThreadQueue *queue; // queue thread is on
OSThreadLink link; // queue link
OSThreadQueue queueJoin; // list of threads waiting for termination (join)
OSMutex *mutex; // mutex trying to lock
OSMutexQueue queueMutex; // list of mutexes owned
OSThreadLink linkActive; // link of all threads for debugging
u8 *stackBase; // the thread's designated stack (high address)
u32 *stackEnd; // last word of stack (low address)
};
// Thread states
enum OS_THREAD_STATE
{
OS_THREAD_STATE_READY = 1,
OS_THREAD_STATE_RUNNING = 2,
OS_THREAD_STATE_WAITING = 4,
OS_THREAD_STATE_MORIBUND = 8
};
// Thread priorities
#define OS_PRIORITY_MIN 0 // highest
#define OS_PRIORITY_MAX 31 // lowest
#define OS_PRIORITY_IDLE OS_PRIORITY_MAX
// Thread attributes
#define OS_THREAD_ATTR_DETACH 0x0001u // detached
// Stack magic value
#define OS_THREAD_STACK_MAGIC 0xDEADBABE
void OSInitThreadQueue(OSThreadQueue *queue);
OSThread *OSGetCurrentThread(void);
BOOL OSIsThreadSuspended(OSThread *thread);
BOOL OSIsThreadTerminated(OSThread *thread);
s32 OSDisableScheduler(void);
s32 OSEnableScheduler(void);
void OSYieldThread(void);
BOOL OSCreateThread(OSThread *thread,
void *(*func)(void *),
void *param,
void *stack,
u32 stackSize,
OSPriority priority,
u16 attr);
void OSExitThread(void *val);
void OSCancelThread(OSThread *thread);
BOOL OSJoinThread(OSThread *thread, void **val);
void OSDetachThread(OSThread *thread);
s32 OSResumeThread(OSThread *thread);
s32 OSSuspendThread(OSThread *thread);
BOOL OSSetThreadPriority(OSThread *thread, OSPriority priority);
OSPriority OSGetThreadPriority(OSThread *thread);
void OSSleepThread(OSThreadQueue *queue);
void OSWakeupThread(OSThreadQueue *queue);
OSThread *OSSetIdleFunction(OSIdleFunction idleFunction,
void *param,
void *stack,
u32 stackSize);
OSThread *OSGetIdleFunction(void);
long OSCheckActiveThreads(void);
#ifdef __cplusplus
}
#endif
#endif // DOLPHIN_OSTHREAD_H

View File

@ -0,0 +1,51 @@
#ifndef OS_TIME_H
#define OS_TIME_H
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
#define OSDiffTick(tick1, tick0) ((s32)(tick1) - (s32)(tick0))
typedef s64 OSTime;
typedef u32 OSTick;
u32 __busclock AT_ADDRESS(0x800000F8);
#define OS_BUS_CLOCK __busclock
#define OS_TIMER_CLOCK (OS_BUS_CLOCK / 4)
#define OSTicksToSeconds(ticks) ((ticks) / OS_TIMER_CLOCK)
#define OSTicksToMilliseconds(ticks) ((ticks) / (OS_TIMER_CLOCK / 1000))
#define OSTicksToMicroseconds(ticks) (((ticks)*8) / (OS_TIMER_CLOCK / 125000))
#define OSTicksToNanoseconds(ticks) (((ticks)*8000) / (OS_TIMER_CLOCK / 125000))
#define OSSecondsToTicks(sec) ((sec)*OS_TIMER_CLOCK)
#define OSMillisecondsToTicks(msec) ((msec) * (OS_TIMER_CLOCK / 1000))
#define OSMicrosecondsToTicks(usec) (((usec) * (OS_TIMER_CLOCK / 125000)) / 8)
#define OSNanosecondsToTicks(nsec) (((nsec) * (OS_TIMER_CLOCK / 125000)) / 8000)
OSTime OSGetTime(void);
OSTick OSGetTick(void);
typedef struct OSCalendarTime_s {
int sec;
int min;
int hour;
int mday;
int mon;
int year;
int wday;
int yday;
int msec;
int usec;
} OSCalendarTime;
OSTime OSCalendarTimeToTicks(OSCalendarTime* td);
void OSTicksToCalendarTime(OSTime ticks, OSCalendarTime* td);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,28 @@
/* TODO: not sure if this should live here or in libultra/OSTimer.h */
#ifndef DOLPHIN_OS_TIMER_H
#define DOLPHIN_OS_TIMER_H
#include "types.h"
#include "dolphin/os/OSAlarm.h"
#include "dolphin/os/OSMessage.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OSTimer_s {
OSAlarm alarm;
struct OSTimer_s* next;
struct OSTimer_s* prev;
OSTime interval;
OSTime value;
OSMessageQueue* mq;
OSMessage msg;
} OSTimer;
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,18 @@
#ifndef OS_UTIL_H
#define OS_UTIL_H
#include "types.h"
#ifdef __cplusplus
extern "C"
{
#endif
#define OSRoundUp32B(x) (((u32)(x) + 0x1F) & ~(0x1F))
#define OSRoundDown32B(x) (((u32)(x)) & ~(0x1F))
#ifdef __cplusplus
};
#endif
#endif

View File

@ -0,0 +1,94 @@
#ifndef PPC_EABI_INIT_H
#define PPC_EABI_INIT_H
#include "types.h"
#ifdef __cplusplus
extern "C"{
#endif
typedef void (*voidfunctionptr)(void); // pointer to function returning void
__declspec(section ".ctors") extern voidfunctionptr _ctors[];
__declspec(section ".dtors") extern voidfunctionptr _dtors[];
/**
* Linker Generated Symbols
*/
// Declare linker symbols for a section in the ROM
#define DECL_ROM_SECTION(x) \
extern u8 _f##x[]; \
extern u8 _f##x##_rom[]; \
extern u8 _e##x[];
// Declare linker symbols for a BSS section
#define DECL_BSS_SECTION(x) \
extern u8 _f##x[]; \
extern u8 _e##x[];
// Debugger stack
extern u8 _db_stack_addr[];
extern u8 _db_stack_end[];
// Program arena
extern u8 __ArenaLo[];
extern u8 __ArenaHi[];
// Program stack
extern u8 _stack_addr[];
extern u8 _stack_end[];
// Small data bases
extern u8 _SDA_BASE_[];
extern u8 _SDA2_BASE_[];
// ROM sections
DECL_ROM_SECTION(_init);
DECL_ROM_SECTION(extab);
DECL_ROM_SECTION(extabindex);
DECL_ROM_SECTION(_text);
DECL_ROM_SECTION(_ctors);
DECL_ROM_SECTION(_dtors);
DECL_ROM_SECTION(_rodata);
DECL_ROM_SECTION(_data);
DECL_ROM_SECTION(_sdata);
DECL_ROM_SECTION(_sdata2);
DECL_ROM_SECTION(_stack);
// BSS sections
DECL_BSS_SECTION(_bss);
DECL_BSS_SECTION(_sbss);
DECL_BSS_SECTION(_sbss2);
void __init_hardware(void);
extern void __flush_cache(void *address, unsigned int size);
void __init_user(void);
void __fini_cpp(void);
void _ExitProcess(void);
typedef struct RomSection {
void* romOfs; // at 0x4
void* virtualOfs; // at 0x0
size_t size; // at 0x8
} RomSection;
typedef struct BssSection {
void* virtualOfs; // at 0x0
size_t size; // at 0x8
} BssSection;
typedef struct ExtabIndexInfo {
void* etiStart; // at 0x0
void* etiEnd; // at 0x4
void* codeStart; // at 0x8
u32 codeSize; // at 0x10
} ExtabIndexInfo;
__declspec(section ".init") extern RomSection _rom_copy_info[];
__declspec(section ".init") extern BssSection _bss_init_info[];
__declspec(section ".init") extern ExtabIndexInfo _eti_init_info[];
#ifdef __cplusplus
}
#endif
#endif

View File

@ -10,9 +10,6 @@
#define AUDIO_THREAD_FLAG_NEOS (1 << 2)
extern volatile int intcount;
OSThread jac_audioThread[3];
OSThread jac_neosThread;
OSThread jac_dvdThread;
extern void NeosSync(void);

View File

@ -1,21 +1,21 @@
#ifndef LIB_C_MATH_H
#define LIB_C_MATH_H
#include "types.h"
#define SQRT_OF_2_F 1.41421356237309504880f
#define SQRT_OF_3_F 1.73205080756887729353f
#define SQRT_3_OVER_3_F (SQRT_OF_3_F / 3.0f)
#define M_PI 3.14159265358979323846f
s16 sins(u16);
s16 coss(u16);
f32 fatan2(f32, f32);
f64 fsqrt(f32);
f32 facos(f32);
#endif
#ifndef LIB_C_MATH_H
#define LIB_C_MATH_H
#include "types.h"
#define SQRT_OF_2_F 1.41421356237309504880f
#define SQRT_OF_3_F 1.73205080756887729353f
#define SQRT_3_OVER_3_F (SQRT_OF_3_F / 3.0f)
#define M_PI 3.14159265358979323846f
s16 sins(u16);
s16 coss(u16);
f32 fatan2(f32, f32);
f64 fsqrt(f32);
f32 facos(f32);
#endif

View File

@ -4,16 +4,15 @@
#include "types.h"
#include "dolphin/os/OSTime.h"
#ifdef __cplusplus
extern "C" {
#endif
void csleep(OSTime c);
void msleep(int);
void msleep(u32);
#ifdef __cplusplus
}
#endif
#endif
#endif

View File

@ -1,22 +1,22 @@
#ifndef BATCONFIG_H
#define BATCONFIG_H
#include "types.h"
#include "dolphin/os/OSMemory.h"
#include "dolphin/os/OSInterrupt.h"
#ifdef __cplusplus
extern "C" {
#endif
void Config24MB();
void Config48MB();
void ReconfigBATs();
#ifdef __cplusplus
}
#endif
#ifndef BATCONFIG_H
#define BATCONFIG_H
#include "types.h"
#include "dolphin/os/OSMemory.h"
#include "dolphin/os/OSInterrupt.h"
#ifdef __cplusplus
extern "C" {
#endif
void Config24MB();
void Config48MB();
void ReconfigBATs();
#ifdef __cplusplus
}
#endif
#endif

View File

@ -23,7 +23,7 @@
#define EMU64_TEX_BLOCK_SIZE_Y 4
#define NUM_COMMANDS 64
#define NUM_SEGMENTS 16
#define EMU64_NUM_SEGMENTS 16
#define DL_MAX_STACK_LEVEL 18
#define DL_HISTORY_COUNT 16
#define NUM_TILES 8
@ -494,70 +494,6 @@ class emu64_print {
#define EMU64_ASSERT(cond) EMU64_PANICLINE(cond, __LINE__)
class emu64_print {
public:
void Printf(const char* fmt, ...) {
va_list list;
if ((this->print_flags & EMU64_PRINTF_FLAG)) {
va_start(list, fmt);
this->Vprintf(fmt, list);
va_end(list);
}
}
void Printf0(const char* fmt, ...) {
va_list list;
va_start(list, fmt);
this->Vprintf(fmt, list);
va_end(list);
}
void Printf1(const char* fmt, ...) {
va_list list;
if ((this->print_flags & EMU64_PRINTF1_FLAG)) {
va_start(list, fmt);
this->Vprintf(fmt, list);
va_end(list);
}
}
void Printf2(const char* fmt, ...) {
va_list list;
if ((this->print_flags & EMU64_PRINTF2_FLAG)) {
va_start(list, fmt);
this->Vprintf(fmt, list);
va_end(list);
}
}
void Printf3(const char* fmt, ...) {
va_list list;
if ((this->print_flags & EMU64_PRINTF3_FLAG)) {
va_start(list, fmt);
this->Vprintf(fmt, list);
va_end(list);
}
}
protected:
u8 print_flags;
private:
void Vprintf(const char* fmt, std::__tag_va_List* va_list) {
vprintf(fmt, va_list);
}
};
#define EMU64_ASSERTLINE(cond, line) \
if (!(cond)) { \
this->panic(#cond, __FILE__, line); \
}
#define EMU64_PRINTF(msg, ...) this->Printf0(msg, __VA_ARGS__);
#ifdef EMU64_DEBUG
@ -604,8 +540,6 @@ class emu64_print {
} while (0)
#endif
#define EMU64_ASSERT(cond) EMU64_ASSERTLINE(cond, __LINE__)
#define EMU64_PRINT_MEMBER(member) \
do { \
this->Printf0(#member " = %u\n", this->##member); \
@ -786,7 +720,7 @@ class emu64 : public emu64_print {
/* 0x0060 */ ucode_info* ucode_info_p;
/* 0x0064 */ int ucode_type; // maybe?
/* 0x0068 */ int _0068; /* ??? */
/* 0x006C */ u32 segments[NUM_SEGMENTS];
/* 0x006C */ u32 segments[EMU64_NUM_SEGMENTS];
/* 0x00AC */ u32 DL_stack[DL_MAX_STACK_LEVEL];
/* 0x00F4 */ s8 DL_stack_level;
/* 0x00F8 */ u32 othermode_high;

View File

@ -1,59 +1,59 @@
#ifndef FAULT_H
#define FAULT_H
#include "types.h"
#include "dolphin/os/OSInterrupt.h"
#include "libultra/libultra.h"
#ifdef __cplusplus
extern "C"{
#endif
#define FAULT_MIN_PRIORITY 0
#define FAULT_STAGE_POST 0
#define FAULT_STAGE_PRE 1
#define FAULT_FLAG_POSTEXCEPTION (1 << FAULT_STAGE_POST)
#define FAULT_FLAG_PREEXCEPTION (1 << FAULT_STAGE_PRE)
#define FAULT_FLAG_SKIP_DRAW_SEPARATOR (1 << 2)
#define FAULT_FLAG_SKIP_DRAW_CALLBACK_INFO (1 << 3)
#define FAULT_PAD_READ_SUCCESS 0
#define FAULT_PAD_READ_FAILED -1
typedef void (*FaultCallback)(const char* msg, u32 param);
typedef struct fault_client_s fault_client;
struct fault_client_s {
fault_client* next;
FaultCallback callback;
const char* msg;
u32 param;
u8 priority;
u8 flags;
};
typedef struct {
u8 _0, _1, _2, _3;
u8 num_clients;
fault_client* first_client;
} fault;
extern void fault_AddClientEx(fault_client* client, FaultCallback callback, const char* msg, u32 param, u8 priority, u8 flags);
extern void fault_AddClient(fault_client* client, FaultCallback callback, const char* msg, u32 param);
extern void fault_Printf(const char* msg, ...);
static void fault_DrawUpdate();
extern void fault_WaitTime(u32 waitTime);
extern int fault_ReadPad(u32* outTriggers, u32* outButtons);
static void fault_CallBackFunc(int stage);
extern void fault_Init();
static void my_PreExceptionCallback();
static void my_PostExceptionCallback();
#ifdef __cplusplus
}
#endif
#endif
#ifndef FAULT_H
#define FAULT_H
#include "types.h"
#include "dolphin/os/OSInterrupt.h"
#include "libultra/libultra.h"
#ifdef __cplusplus
extern "C"{
#endif
#define FAULT_MIN_PRIORITY 0
#define FAULT_STAGE_POST 0
#define FAULT_STAGE_PRE 1
#define FAULT_FLAG_POSTEXCEPTION (1 << FAULT_STAGE_POST)
#define FAULT_FLAG_PREEXCEPTION (1 << FAULT_STAGE_PRE)
#define FAULT_FLAG_SKIP_DRAW_SEPARATOR (1 << 2)
#define FAULT_FLAG_SKIP_DRAW_CALLBACK_INFO (1 << 3)
#define FAULT_PAD_READ_SUCCESS 0
#define FAULT_PAD_READ_FAILED -1
typedef void (*FaultCallback)(const char* msg, u32 param);
typedef struct fault_client_s fault_client;
struct fault_client_s {
fault_client* next;
FaultCallback callback;
const char* msg;
u32 param;
u8 priority;
u8 flags;
};
typedef struct {
u8 _0, _1, _2, _3;
u8 num_clients;
fault_client* first_client;
} fault;
extern void fault_AddClientEx(fault_client* client, FaultCallback callback, const char* msg, u32 param, u8 priority, u8 flags);
extern void fault_AddClient(fault_client* client, FaultCallback callback, const char* msg, u32 param);
extern void fault_Printf(const char* msg, ...);
static void fault_DrawUpdate();
extern void fault_WaitTime(u32 waitTime);
extern int fault_ReadPad(u32* outTriggers, u32* outButtons);
static void fault_CallBackFunc(int stage);
extern void fault_Init();
static void my_PreExceptionCallback();
static void my_PostExceptionCallback();
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,129 +1,129 @@
#ifndef GFXPRINT_H
#define GFXPRINT_H
#include "types.h"
#include "libu64/u64types.h"
#include "PR/mbi.h"
#include "va_args.h"
#ifdef __cplusplus
extern "C"{
#endif
#define GFXPRINT_NUM_SUBPIXELS 4
#define GFXPRINT_PIXELS_PER_BLOCK 8
#define GFXPRINT_PAD GFXPRINT_PIXELS_PER_BLOCK * GFXPRINT_NUM_SUBPIXELS
#define GFXPRINT_FLAG_KANA_MODE (1 << 0) /* Japanese characters displayed as hiragana or katakana */
#define GFXPRINT_FLAG_GRADIENT (1 << 1) /* Gradient state */
#define GFXPRINT_FLAG_SHADOW (1 << 2) /* Shadow state */
#define GFXPRINT_FLAG_CHANGED (1 << 3) /* Text changed */
/* Unused...? */
#define GFXPRINT_FLAG_HIGHRES (1 << 6) /* Highres text */
#define GFXPRINT_FLAG_OPENED (1 << 7) /* Open state */
#define GFXPRINT_KANA_MODE_KATAKANA 0
#define GFXPRINT_KANA_MODE_HIRAGANA 1
#define GFXPRINT_CLEAR_GRADIENT_CHAR "\x8A"
#define GFXPRINT_ENABLE_GRADIENT_CHAR "\x8B"
#define GFXPRINT_KATAKANA_MODE_CHAR "\x8C"
#define GFXPRINT_HIRAGANA_MODE_CHAR "\x8D"
#define GFXPRINT_UNUSED_CHAR "\x8E"
/* NOTE: this should be a void return type but we're going to use a void* for readibility */
typedef void* (*PrintCallback)(void*, const char*, int);
typedef struct gfxprint_obj {
PrintCallback prout_func; /* Current print out func */
Gfx* glistp; /* Current display list to write text to */
u16 position_x; /* Display coords (sub-pixel units) */
u16 position_y; /* Display coords (sub-pixel units) */
u16 offset_x; /* Display offset */
u8 offset_y; /* Display offset */
u8 flags; /* 1: Kana mode -> 0: Katakana/1: Hiragana
2: Gradient displayed
4: Shadow displayed
8: Attribute changed
64: Low-res -> high-res conversion
128: Opened state */
rgba8888 color; /* Current font color */
u8 dummy[28]; /* For size compatibility */
} gfxprint_t;
/* Default gfxprint flag values set in game_ct func, default value is 0x40 (GFXPRINT_FLAG_HIGHRES on) */
extern u8 __gfxprint_default_flags;
extern u16 gfxprint_moji_tlut[];
extern u8 gfxprint_font[];
/* Macros for quickly checking state of gfxprint struct */
#define gfxprint_isFlagOn(this, flag) ((this->flags & flag) != 0)
#define gfxprint_setFlag(this, flag) (this->flags |= flag)
#define gfxprint_clrFlag(this, flag) (this->flags &= ~flag)
#define gfxprint_isOpened(this) (gfxprint_isFlagOn(this, GFXPRINT_FLAG_OPENED))
#define gfxprint_setOpened(this) (gfxprint_setFlag(this, GFXPRINT_FLAG_OPENED))
#define gfxprint_clrOpened(this) (gfxprint_clrFlag(this, GFXPRINT_FLAG_OPENED))
#define gfxprint_isHighres(this) (gfxprint_isFlagOn(this, GFXPRINT_FLAG_HIGHRES))
#define gfxprint_setHighres(this) (gfxprint_setFlag(this, GFXPRINT_FLAG_HIGHRES))
#define gfxprint_clrHighres(this) (gfxprint_clrFlag(this, GFXPRINT_FLAG_HIGHRES))
#define gfxprint_isHiragana(this) ((this->flags & GFXPRINT_FLAG_KANA_MODE) != GFXPRINT_KANA_MODE_KATAKANA)
#define gfxprint_isKatakana(this) ((this->flags & GFXPRINT_FLAG_KANA_MODE) == GFXPRINT_KANA_MODE_KATAKANA)
#define gfxprint_setHiragana(this) (this->flags |= GFXPRINT_FLAG_KANA_MODE)
#define gfxprint_setKatakana(this) (this->flags &= ~GFXPRINT_FLAG_KANA_MODE)
#define gfxprint_isGradient(this) (gfxprint_isFlagOn(this, GFXPRINT_FLAG_GRADIENT))
#define gfxprint_setGradient(this) (gfxprint_setFlag(this, GFXPRINT_FLAG_GRADIENT))
#define gfxprint_clrGradient(this) (gfxprint_clrFlag(this, GFXPRINT_FLAG_GRADIENT))
#define gfxprint_isShadow(this) (gfxprint_isFlagOn(this, GFXPRINT_FLAG_SHADOW))
#define gfxprint_setShadow(this) (gfxprint_setFlag(this, GFXPRINT_FLAG_SHADOW))
#define gfxprint_clrShadow(this) (gfxprint_clrFlag(this, GFXPRINT_FLAG_SHADOW))
#define gfxprint_isChanged(this) (gfxprint_isFlagOn(this, GFXPRINT_FLAG_CHANGED))
#define gfxprint_setChanged(this) (gfxprint_setFlag(this, GFXPRINT_FLAG_CHANGED))
#define gfxprint_clrChanged(this) (gfxprint_clrFlag(this, GFXPRINT_FLAG_CHANGED))
static void gfxprint_setup(gfxprint_t* this);
static void gfxprint_putc1(gfxprint_t* this, char c);
static void* gfxprint_prout(void* this, const char* buffer, int n);
extern void gfxprint_color(gfxprint_t* this, u32 r, u32 g, u32 b, u32 a);
extern void gfxprint_locate(gfxprint_t* this, int x, int y);
extern void gfxprint_locate8x8(gfxprint_t* this, int x, int y);
extern void gfxprint_setoffset(gfxprint_t* this, int x, int y);
extern void gfxprint_putc(gfxprint_t* this, char c);
extern void gfxprint_write(gfxprint_t* this, const void* buffer, size_t size, size_t n);
extern void gfxprint_puts(gfxprint_t* this, char* string);
extern void gfxprint_init(gfxprint_t* this);
extern void gfxprint_cleanup(gfxprint_t* this);
extern void gfxprint_open(gfxprint_t* this, Gfx* glistp);
extern Gfx* gfxprint_close(gfxprint_t* this);
extern int gfxprint_vprintf(gfxprint_t* this, const char* fmt, va_list ap);
extern int gfxprint_printf(gfxprint_t* this, const char* fmt, ...);
/* Custom macro to match gDPLoadTLUT_pal16 but with N palette entries */
#define gDPLoadTLUT_palX(pkt, pal, dram, count) \
do { \
gDPSetTextureImage(pkt, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, dram); \
gDPTileSync(pkt); \
gDPSetTile(pkt, 0, 0, 0, (256+(((pal)&0xf)*16)), \
G_TX_LOADTILE, 0 , 0, 0, 0, 0, 0, 0); \
gDPLoadSync(pkt); \
gDPLoadTLUTCmd(pkt, G_TX_LOADTILE, (count)-1); \
gDPPipeSync(pkt); \
} while (0)
#ifdef __cplusplus
}
#endif
#endif
#ifndef GFXPRINT_H
#define GFXPRINT_H
#include "types.h"
#include "libu64/u64types.h"
#include "PR/mbi.h"
#include "va_args.h"
#ifdef __cplusplus
extern "C"{
#endif
#define GFXPRINT_NUM_SUBPIXELS 4
#define GFXPRINT_PIXELS_PER_BLOCK 8
#define GFXPRINT_PAD GFXPRINT_PIXELS_PER_BLOCK * GFXPRINT_NUM_SUBPIXELS
#define GFXPRINT_FLAG_KANA_MODE (1 << 0) /* Japanese characters displayed as hiragana or katakana */
#define GFXPRINT_FLAG_GRADIENT (1 << 1) /* Gradient state */
#define GFXPRINT_FLAG_SHADOW (1 << 2) /* Shadow state */
#define GFXPRINT_FLAG_CHANGED (1 << 3) /* Text changed */
/* Unused...? */
#define GFXPRINT_FLAG_HIGHRES (1 << 6) /* Highres text */
#define GFXPRINT_FLAG_OPENED (1 << 7) /* Open state */
#define GFXPRINT_KANA_MODE_KATAKANA 0
#define GFXPRINT_KANA_MODE_HIRAGANA 1
#define GFXPRINT_CLEAR_GRADIENT_CHAR "\x8A"
#define GFXPRINT_ENABLE_GRADIENT_CHAR "\x8B"
#define GFXPRINT_KATAKANA_MODE_CHAR "\x8C"
#define GFXPRINT_HIRAGANA_MODE_CHAR "\x8D"
#define GFXPRINT_UNUSED_CHAR "\x8E"
/* NOTE: this should be a void return type but we're going to use a void* for readibility */
typedef void* (*PrintCallback)(void*, const char*, int);
typedef struct gfxprint_obj {
PrintCallback prout_func; /* Current print out func */
Gfx* glistp; /* Current display list to write text to */
u16 position_x; /* Display coords (sub-pixel units) */
u16 position_y; /* Display coords (sub-pixel units) */
u16 offset_x; /* Display offset */
u8 offset_y; /* Display offset */
u8 flags; /* 1: Kana mode -> 0: Katakana/1: Hiragana
2: Gradient displayed
4: Shadow displayed
8: Attribute changed
64: Low-res -> high-res conversion
128: Opened state */
rgba8888 color; /* Current font color */
u8 dummy[28]; /* For size compatibility */
} gfxprint_t;
/* Default gfxprint flag values set in game_ct func, default value is 0x40 (GFXPRINT_FLAG_HIGHRES on) */
extern u8 __gfxprint_default_flags;
extern u16 gfxprint_moji_tlut[];
extern u8 gfxprint_font[];
/* Macros for quickly checking state of gfxprint struct */
#define gfxprint_isFlagOn(this, flag) ((this->flags & flag) != 0)
#define gfxprint_setFlag(this, flag) (this->flags |= flag)
#define gfxprint_clrFlag(this, flag) (this->flags &= ~flag)
#define gfxprint_isOpened(this) (gfxprint_isFlagOn(this, GFXPRINT_FLAG_OPENED))
#define gfxprint_setOpened(this) (gfxprint_setFlag(this, GFXPRINT_FLAG_OPENED))
#define gfxprint_clrOpened(this) (gfxprint_clrFlag(this, GFXPRINT_FLAG_OPENED))
#define gfxprint_isHighres(this) (gfxprint_isFlagOn(this, GFXPRINT_FLAG_HIGHRES))
#define gfxprint_setHighres(this) (gfxprint_setFlag(this, GFXPRINT_FLAG_HIGHRES))
#define gfxprint_clrHighres(this) (gfxprint_clrFlag(this, GFXPRINT_FLAG_HIGHRES))
#define gfxprint_isHiragana(this) ((this->flags & GFXPRINT_FLAG_KANA_MODE) != GFXPRINT_KANA_MODE_KATAKANA)
#define gfxprint_isKatakana(this) ((this->flags & GFXPRINT_FLAG_KANA_MODE) == GFXPRINT_KANA_MODE_KATAKANA)
#define gfxprint_setHiragana(this) (this->flags |= GFXPRINT_FLAG_KANA_MODE)
#define gfxprint_setKatakana(this) (this->flags &= ~GFXPRINT_FLAG_KANA_MODE)
#define gfxprint_isGradient(this) (gfxprint_isFlagOn(this, GFXPRINT_FLAG_GRADIENT))
#define gfxprint_setGradient(this) (gfxprint_setFlag(this, GFXPRINT_FLAG_GRADIENT))
#define gfxprint_clrGradient(this) (gfxprint_clrFlag(this, GFXPRINT_FLAG_GRADIENT))
#define gfxprint_isShadow(this) (gfxprint_isFlagOn(this, GFXPRINT_FLAG_SHADOW))
#define gfxprint_setShadow(this) (gfxprint_setFlag(this, GFXPRINT_FLAG_SHADOW))
#define gfxprint_clrShadow(this) (gfxprint_clrFlag(this, GFXPRINT_FLAG_SHADOW))
#define gfxprint_isChanged(this) (gfxprint_isFlagOn(this, GFXPRINT_FLAG_CHANGED))
#define gfxprint_setChanged(this) (gfxprint_setFlag(this, GFXPRINT_FLAG_CHANGED))
#define gfxprint_clrChanged(this) (gfxprint_clrFlag(this, GFXPRINT_FLAG_CHANGED))
static void gfxprint_setup(gfxprint_t* this);
static void gfxprint_putc1(gfxprint_t* this, char c);
static void* gfxprint_prout(void* this, const char* buffer, int n);
extern void gfxprint_color(gfxprint_t* this, u32 r, u32 g, u32 b, u32 a);
extern void gfxprint_locate(gfxprint_t* this, int x, int y);
extern void gfxprint_locate8x8(gfxprint_t* this, int x, int y);
extern void gfxprint_setoffset(gfxprint_t* this, int x, int y);
extern void gfxprint_putc(gfxprint_t* this, char c);
extern void gfxprint_write(gfxprint_t* this, const void* buffer, size_t size, size_t n);
extern void gfxprint_puts(gfxprint_t* this, char* string);
extern void gfxprint_init(gfxprint_t* this);
extern void gfxprint_cleanup(gfxprint_t* this);
extern void gfxprint_open(gfxprint_t* this, Gfx* glistp);
extern Gfx* gfxprint_close(gfxprint_t* this);
extern int gfxprint_vprintf(gfxprint_t* this, const char* fmt, va_list ap);
extern int gfxprint_printf(gfxprint_t* this, const char* fmt, ...);
/* Custom macro to match gDPLoadTLUT_pal16 but with N palette entries */
#define gDPLoadTLUT_palX(pkt, pal, dram, count) \
do { \
gDPSetTextureImage(pkt, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, dram); \
gDPTileSync(pkt); \
gDPSetTile(pkt, 0, 0, 0, (256+(((pal)&0xf)*16)), \
G_TX_LOADTILE, 0 , 0, 0, 0, 0, 0, 0); \
gDPLoadSync(pkt); \
gDPLoadTLUTCmd(pkt, G_TX_LOADTILE, (count)-1); \
gDPPipeSync(pkt); \
} while (0)
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,41 +1,41 @@
#ifndef LIBULTRA_H
#define LIBULTRA_H
#include "types.h"
#include "dolphin/os/OSTime.h"
#include "dolphin/os/OSCache.h"
#include "libultra/gu.h"
#include "libultra/osMesg.h"
#include "libultra/shutdown.h"
#include "libultra/os_timer.h"
#include "libultra/os_thread.h"
#include "libultra/os_pi.h"
#include "libultra/initialize.h"
#include "libc/math.h" /* TODO: sins and coss belong in libultra */
#define N64_SCREEN_HEIGHT 240
#define N64_SCREEN_WIDTH 320
#ifdef __cplusplus
extern "C" {
#endif
typedef u64 Z_OSTime;
int bcmp(void* v1, void* v2, u32 size);
void bcopy(void* src, void* dst, size_t n);
void bzero(void* ptr, size_t size);
void osSyncPrintf(const char* fmt, ...);
void osWritebackDCache(void* vaddr, u32 nbytes);
u32 osGetCount(void);
OSTime osGetTime(void);
extern s32 osAppNMIBuffer[];
extern int osShutdown;
extern u8 __osResetSwitchPressed;
#ifdef __cplusplus
}
#endif
#endif
#ifndef LIBULTRA_H
#define LIBULTRA_H
#include "types.h"
#include "dolphin/os/OSTime.h"
#include "dolphin/os/OSCache.h"
#include "libultra/gu.h"
#include "libultra/osMesg.h"
#include "libultra/shutdown.h"
#include "libultra/os_timer.h"
#include "libultra/os_thread.h"
#include "libultra/os_pi.h"
#include "libultra/initialize.h"
#include "libc/math.h" /* TODO: sins and coss belong in libultra */
#define N64_SCREEN_HEIGHT 240
#define N64_SCREEN_WIDTH 320
#ifdef __cplusplus
extern "C" {
#endif
typedef u64 Z_OSTime;
int bcmp(void* v1, void* v2, u32 size);
void bcopy(void* src, void* dst, size_t n);
void bzero(void* ptr, size_t size);
void osSyncPrintf(const char* fmt, ...);
void osWritebackDCache(void* vaddr, u32 nbytes);
u32 osGetCount(void);
OSTime osGetTime(void);
extern s32 osAppNMIBuffer[];
extern int osShutdown;
extern u8 __osResetSwitchPressed;
#ifdef __cplusplus
}
#endif
#endif

View File

@ -28,22 +28,22 @@ extern "C" {
#define CHAR_ACUTE_I 14
#define CHAR_CIRCUMFLEX_I 15
#define CHAR_DIARESIS_I 16
#define CHAR_ETH 17 /* Đ */
#define CHAR_ETH 17
#define CHAR_TILDE_N 18
#define CHAR_GRAVE_O 19
#define CHAR_ACUTE_O 20
#define CHAR_CIRCUMFLEX_O 21
#define CHAR_TILDE_O 22
#define CHAR_DIARESIS_O 23
#define CHAR_OE 24 /* Ø */
#define CHAR_OE 24
#define CHAR_GRAVE_U 25
#define CHAR_ACUTE_U 26
#define CHAR_CIRCUMFLEX_U 27
#define CHAR_DIARESIS_U 28
#define CHAR_LOWER_BETA 29 /* β */
#define CHAR_THORN 30 /* Þ */
#define CHAR_LOWER_BETA 29
#define CHAR_THORN 30
#define CHAR_GRAVE_a 31
#define CHAR_SPACE 32 /* ' ' */
#define CHAR_SPACE 32
#define CHAR_EXCLAMATION 33
#define CHAR_QUOTATION 34
#define CHAR_ACUTE_a 35
@ -144,8 +144,8 @@ extern "C" {
#define CHAR_ACUTE_i 130
#define CHAR_CIRCUMFLEX_i 131
#define CHAR_DIARESIS_i 132
#define CHAR_INTERPUNCT 133 /* · */
#define CHAR_LOWER_ETH 134 /* đ */
#define CHAR_INTERPUNCT 133
#define CHAR_LOWER_ETH 134
#define CHAR_TILDE_n 135
#define CHAR_GRAVE_o 136
#define CHAR_ACUTE_o 137
@ -162,10 +162,10 @@ extern "C" {
#define CHAR_DIARESIS_y 148
#define CHAR_LOWER_THORN 149
#define CHAR_ACUTE_Y 150
#define CHAR_BROKEN_BAR 151 /* ¦ */
#define CHAR_SILCROW 152 /* § */
#define CHAR_BROKEN_BAR 151
#define CHAR_SILCROW 152
#define CHAR_FEMININE_ORDINAL 153
#define CHAR_MASCULINE_ORDINAL 154 /* ° */
#define CHAR_MASCULINE_ORDINAL 154
#define CHAR_DOUBLE_VERTICAL_BAR 155
#define CHAR_LATIN_MU 156
#define CHAR_SUPERSCRIPT_THREE 157

View File

@ -4,6 +4,7 @@
#include "types.h"
#include "m_music_ovl_h.h"
#include "m_submenu_ovl.h"
#include "m_item_name.h"
#ifdef __cplusplus
extern "C" {

View File

@ -1,184 +1,184 @@
#ifndef ROOM_TYPE_H
#define ROOM_TYPE_H
#include "types.h"
#include "libu64/gfxprint.h"
#include "m_actor_type.h"
#include "m_play_h.h"
#define mRmTp_FTR_UNIT_MAX 4
enum {
mRmTp_FTRSIZE_1x1, /* x */
mRmTp_FTRSIZE_1x2, /* yy OR y */
/* y */
mRmTp_FTRSIZE_2x2, /* zz */
/* zz */
mRmTp_FTRSIZE_NUM
};
enum birth_type {
mRmTp_BIRTH_TYPE_GRP_A = 0,
mRmTp_BIRTH_TYPE_GRP_B = 1,
mRmTp_BIRTH_TYPE_GRP_C = 2,
mRmTp_BIRTH_TYPE_EVENT = 3,
mRmTp_BIRTH_TYPE_BIRTHDAY = 4,
mRmTp_BIRTH_TYPE_HALLOWEEN = 5,
mRmTp_BIRTH_TYPE_HANIWA = 6,
mRmTp_BIRTH_TYPE_LOTTERY = 7,
mRmTp_BIRTH_TYPE_FTR_CLOTH = 8,
mRmTp_BIRTH_TYPE_FTR_UMBRELLA = 9,
mRmTp_BIRTH_TYPE_FTR_INSECT = 10,
mRmTp_BIRTH_TYPE_FTR_FISH = 11,
mRmTp_BIRTH_TYPE_SINGLE_FOSSIL = 12,
mRmTp_BIRTH_TYPE_MULTI_FOSSIL = 13,
mRmTp_BIRTH_TYPE_XMAS = 14,
mRmTp_BIRTH_TYPE_SANTA = 15,
mRmTp_BIRTH_TYPE_UNOBTAINABLE = 16,
mRmTp_BIRTH_TYPE_SNOWMAN = 17,
mRmTp_BIRTH_TYPE_HALLOWEEN_TRICK = 18,
mRmTp_BIRTH_TYPE_POST_OFFICE = 19,
mRmTp_BIRTH_TYPE_MARK_ROOM = 20,
mRmTp_BIRTH_TYPE_SONCHO = 21,
mRmTp_BIRTH_TYPE_JONASON = 22,
mRmTp_BIRTH_TYPE_UNUSED_23 = 23,
mRmTp_BIRTH_TYPE_FAMICOM_EREADER = 24,
mRmTp_BIRTH_TYPE_ISLAND = 25,
mRmTp_BIRTH_TYPE_FAMICOM_ISLAND = 26,
mRmTp_BIRTH_TYPE_MY_ORIGINAL = 27,
mRmTp_BIRTH_TYPE_FAMICOM_CODE = 28,
mRmTp_BIRTH_TYPE_MUSEUM = 29,
mRmTp_BIRTH_TYPE_SONCHO_LIGHTHOUSE_QUEST = 30,
mRmTp_BIRTH_TYPE_FTR_DIARY = 31,
mRmTp_BIRTH_TYPE_GROUNDHOG = 32,
mRmTp_BIRTH_TYPE_KAMAKURA = 33,
mRmTp_BIRTH_TYPE_NINTENDO_CODE = 34,
mRmTp_BIRTH_TYPE_HARVEST_FESTIVAL = 35,
mRmTp_BIRTH_TYPE_UNUSED_36 = 36,
mRmTp_BIRTH_TYPE_SUMMER_CAMPER = 37,
mRmTp_BIRTH_TYPE_NUM
};
enum {
mRmTp_DIRECT_SOUTH,
mRmTp_DIRECT_EAST,
mRmTp_DIRECT_NORTH,
mRmTp_DIRECT_WEST,
mRmTp_DIRECT_NUM
};
enum {
mRmTp_FTR_SE_NONE,
mRmTp_FTR_SE_SOFT_CHAIR,
mRmTp_FTR_SE_HARD_CHAIR,
mRmTp_FTR_SE_BUBU_CHAIR,
mRmTp_FTR_SE_TOILET_CHAIR,
mRmTp_FTR_SE_NUM
};
enum {
mRmTp_CHAIR_ACTION_SIT,
mRmTp_CHAIR_ACTION_STAND,
mRmTp_CHAIR_ACTION_NUM
};
typedef struct room_type_place_info_one_s {
int exists;
int ut_x;
int ut_z;
} mRmTp_FtrPlaceInfoOne_t;
#define FTR_NUM 1266
#define FTR_GET_ROTATION(f) ((f)&3)
#define FTR_IDX_2_NO(f) ((f) >> 2)
#define FTR_NO_2_IDX(f) ((f) << 2)
#define FTR_NO_ROT_2_IDX(f, rot) (FTR_NO_2_IDX(f) | ((rot)&3))
// TEMPORARY. Should be generated with .decl files
#define ITEM0_NO_START 0x0000
#define ITEM0_1_NO_START ITEM0_NO_START + 0x800
#define FTR0_NO_START 0x1000
#define ITEM1_NO_START 0x2000
#define ITEM1_0_NO_START ITEM0_1_NO_START // paper
#define ITEM1_1_NO_START ITEM1_NO_START + 0x100 // money
#define ITEM1_2_NO_START ITEM1_NO_START + 0x200 // tools
#define ITEM1_3_NO_START ITEM1_NO_START + 0x300 // fish
#define ITEM1_4_NO_START ITEM1_NO_START + 0x400 // clothing
#define ITEM1_5_NO_START ITEM1_NO_START + 0x500 // etc
#define ITEM1_6_NO_START ITEM1_NO_START + 0x600 // carpets
#define ITEM1_7_NO_START ITEM1_NO_START + 0x700 // wallpaper
#define ITEM1_8_NO_START ITEM1_NO_START + 0x800 // food
#define ITEM1_9_NO_START ITEM1_NO_START + 0x900 // seeds
#define ITEM1_A_NO_START ITEM1_NO_START + 0xA00 // mini disks
#define ITEM1_B_NO_START ITEM1_NO_START + 0xB00 // diaries
#define ITEM1_C_NO_START ITEM1_NO_START + 0xC00 // tickets
#define ITEM1_D_NO_START ITEM1_NO_START + 0xD00 // insects
#define ITEM1_E_NO_START ITEM1_NO_START + 0xE00 // hukubukuro
#define ITEM1_F_NO_START ITEM1_NO_START + 0xF00 // kabu
#define FTR1_NO_START 0x3000
enum {
mRmTp_LIGHT_SWITCH_HOUSE0_MAIN_UPPER,
mRmTp_LIGHT_SWITCH_HOUSE0_BASEMENT,
mRmTp_LIGHT_SWITCH_HOUSE1_MAIN_UPPER,
mRmTp_LIGHT_SWITCH_HOUSE1_BASEMENT,
mRmTp_LIGHT_SWITCH_HOUSE2_MAIN_UPPER,
mRmTp_LIGHT_SWITCH_HOUSE2_BASEMENT,
mRmTp_LIGHT_SWITCH_HOUSE3_MAIN_UPPER,
mRmTp_LIGHT_SWITCH_HOUSE3_BASEMENT,
mRmTp_LIGHT_SWITCH_COTTAGE_MY,
mRmTp_LIGHT_SWITCH_9,
mRmTp_LIGHT_SWITCH_NPC,
mRmTp_LIGHT_SWITCH_LIGHTHOUSE,
mRmTp_LIGHT_SWITCH_TENT,
mRmTp_LIGHT_SWITCH_NUM
};
extern int mRmTp_ItemNo2FtrSize(mActor_name_t item_no);
extern int mRmTp_GetFurnitureData(mActor_name_t ftr, int ut_x, int ut_z, mRmTp_FtrPlaceInfoOne_t* place_info);
extern void mRmTp_MakeFtrNoTable(mActor_name_t* dst, mActor_name_t* src);
extern int mRmTp_GetFtrActionSE(int ftr_idx, int mode);
extern u8* mRmTp_CheckFtrBirthInfoTop();
extern int mRmTp_GetFloorIdx();
extern int mRmTp_GetWallIdx();
extern mActor_name_t mRmTp_Item1ItemNo2FtrItemNo_AtPlayerRoom(mActor_name_t item1_no, int no_convert_tools);
extern mActor_name_t mRmTp_FtrItemNo2Item1ItemNo(mActor_name_t ftr_no, int no_convert_tools);
extern void mRmTp_MakeMelodyData();
extern u8* mRmTp_GetMelodyData();
extern void mRmTp_DrawFamicomInfo(gfxprint_t* gfxprint);
extern void mRmTp_MakeFamicom_Fdebug();
extern mActor_name_t mRmTp_GetPlayerRoomCollisionIdx(mActor_name_t field_id, mActor_name_t bg_idx);
extern int mRmTp_FurnitureIdx2FurnitureKind(int ftr_idx);
extern void mRmTp_CopyWallData(u8* dst, int wall_no);
extern void mRmTp_CopyFloorData(u8* dst, int floor_no);
extern int mRmTp_CheckTalkAble(s16* rot, xyz_t* pos, int required_dir, f32 max_dist, GAME_PLAY* play);
extern int mRmTp_CheckWallIsMyOriginalInThisScene();
extern int mRmTp_CheckFloorIsMyOriginalInThisScene();
extern int mRmTp_GetEntranceBasePosition(xyz_t* pos);
extern int mRmTp_GetNowSceneLightSwitchIndex();
extern int mRmTp_PleaseDrawLightSwitch();
extern int mRmTp_NowSceneLightSwitchON();
extern int mRmTp_IndexLightSwitchON(int switch_index);
extern int mRmTp_NowSceneLightSwitchOFF();
extern int mRmTp_IndexLightSwitchOFF(int switch_index);
extern int mRmTp_Index2LightSwitchStatus(int switch_index);
extern int mRmTp_SetDefaultLightSwitchData(int state);
extern void mRmTp_DecideCottageDefaultLightSwitch();
extern int mRmTp_GetNowSceneOriginalWallStatus();
extern int mRmTp_GetNowSceneOriginalFloorStatus();
extern void mRmTp_SetNowSceneOriginalWallStatus(int enabled);
extern void mRmTp_SetNowSceneOriginalFloorStatus(int enabled);
extern int mRmTp_FtrItemNo2FtrIdx(mActor_name_t ftr_item_no);
extern mActor_name_t mRmTp_FtrIdx2FtrItemNo(int ftr_idx, int direct);
extern int mRmTp_SoundStepWalkSE(xyz_t* wpos);
#ifndef ROOM_TYPE_H
#define ROOM_TYPE_H
#include "types.h"
#include "libu64/gfxprint.h"
#include "m_actor_type.h"
#include "m_play_h.h"
#define mRmTp_FTR_UNIT_MAX 4
enum {
mRmTp_FTRSIZE_1x1, /* x */
mRmTp_FTRSIZE_1x2, /* yy OR y */
/* y */
mRmTp_FTRSIZE_2x2, /* zz */
/* zz */
mRmTp_FTRSIZE_NUM
};
enum birth_type {
mRmTp_BIRTH_TYPE_GRP_A = 0,
mRmTp_BIRTH_TYPE_GRP_B = 1,
mRmTp_BIRTH_TYPE_GRP_C = 2,
mRmTp_BIRTH_TYPE_EVENT = 3,
mRmTp_BIRTH_TYPE_BIRTHDAY = 4,
mRmTp_BIRTH_TYPE_HALLOWEEN = 5,
mRmTp_BIRTH_TYPE_HANIWA = 6,
mRmTp_BIRTH_TYPE_LOTTERY = 7,
mRmTp_BIRTH_TYPE_FTR_CLOTH = 8,
mRmTp_BIRTH_TYPE_FTR_UMBRELLA = 9,
mRmTp_BIRTH_TYPE_FTR_INSECT = 10,
mRmTp_BIRTH_TYPE_FTR_FISH = 11,
mRmTp_BIRTH_TYPE_SINGLE_FOSSIL = 12,
mRmTp_BIRTH_TYPE_MULTI_FOSSIL = 13,
mRmTp_BIRTH_TYPE_XMAS = 14,
mRmTp_BIRTH_TYPE_SANTA = 15,
mRmTp_BIRTH_TYPE_UNOBTAINABLE = 16,
mRmTp_BIRTH_TYPE_SNOWMAN = 17,
mRmTp_BIRTH_TYPE_HALLOWEEN_TRICK = 18,
mRmTp_BIRTH_TYPE_POST_OFFICE = 19,
mRmTp_BIRTH_TYPE_MARK_ROOM = 20,
mRmTp_BIRTH_TYPE_SONCHO = 21,
mRmTp_BIRTH_TYPE_JONASON = 22,
mRmTp_BIRTH_TYPE_UNUSED_23 = 23,
mRmTp_BIRTH_TYPE_FAMICOM_EREADER = 24,
mRmTp_BIRTH_TYPE_ISLAND = 25,
mRmTp_BIRTH_TYPE_FAMICOM_ISLAND = 26,
mRmTp_BIRTH_TYPE_MY_ORIGINAL = 27,
mRmTp_BIRTH_TYPE_FAMICOM_CODE = 28,
mRmTp_BIRTH_TYPE_MUSEUM = 29,
mRmTp_BIRTH_TYPE_SONCHO_LIGHTHOUSE_QUEST = 30,
mRmTp_BIRTH_TYPE_FTR_DIARY = 31,
mRmTp_BIRTH_TYPE_GROUNDHOG = 32,
mRmTp_BIRTH_TYPE_KAMAKURA = 33,
mRmTp_BIRTH_TYPE_NINTENDO_CODE = 34,
mRmTp_BIRTH_TYPE_HARVEST_FESTIVAL = 35,
mRmTp_BIRTH_TYPE_UNUSED_36 = 36,
mRmTp_BIRTH_TYPE_SUMMER_CAMPER = 37,
mRmTp_BIRTH_TYPE_NUM
};
enum {
mRmTp_DIRECT_SOUTH,
mRmTp_DIRECT_EAST,
mRmTp_DIRECT_NORTH,
mRmTp_DIRECT_WEST,
mRmTp_DIRECT_NUM
};
enum {
mRmTp_FTR_SE_NONE,
mRmTp_FTR_SE_SOFT_CHAIR,
mRmTp_FTR_SE_HARD_CHAIR,
mRmTp_FTR_SE_BUBU_CHAIR,
mRmTp_FTR_SE_TOILET_CHAIR,
mRmTp_FTR_SE_NUM
};
enum {
mRmTp_CHAIR_ACTION_SIT,
mRmTp_CHAIR_ACTION_STAND,
mRmTp_CHAIR_ACTION_NUM
};
typedef struct room_type_place_info_one_s {
int exists;
int ut_x;
int ut_z;
} mRmTp_FtrPlaceInfoOne_t;
#define FTR_NUM 1266
#define FTR_GET_ROTATION(f) ((f)&3)
#define FTR_IDX_2_NO(f) ((f) >> 2)
#define FTR_NO_2_IDX(f) ((f) << 2)
#define FTR_NO_ROT_2_IDX(f, rot) (FTR_NO_2_IDX(f) | ((rot)&3))
// TEMPORARY. Should be generated with .decl files
#define ITEM0_NO_START 0x0000
#define ITEM0_1_NO_START ITEM0_NO_START + 0x800
#define FTR0_NO_START 0x1000
#define ITEM1_NO_START 0x2000
#define ITEM1_0_NO_START ITEM0_1_NO_START // paper
#define ITEM1_1_NO_START ITEM1_NO_START + 0x100 // money
#define ITEM1_2_NO_START ITEM1_NO_START + 0x200 // tools
#define ITEM1_3_NO_START ITEM1_NO_START + 0x300 // fish
#define ITEM1_4_NO_START ITEM1_NO_START + 0x400 // clothing
#define ITEM1_5_NO_START ITEM1_NO_START + 0x500 // etc
#define ITEM1_6_NO_START ITEM1_NO_START + 0x600 // carpets
#define ITEM1_7_NO_START ITEM1_NO_START + 0x700 // wallpaper
#define ITEM1_8_NO_START ITEM1_NO_START + 0x800 // food
#define ITEM1_9_NO_START ITEM1_NO_START + 0x900 // seeds
#define ITEM1_A_NO_START ITEM1_NO_START + 0xA00 // mini disks
#define ITEM1_B_NO_START ITEM1_NO_START + 0xB00 // diaries
#define ITEM1_C_NO_START ITEM1_NO_START + 0xC00 // tickets
#define ITEM1_D_NO_START ITEM1_NO_START + 0xD00 // insects
#define ITEM1_E_NO_START ITEM1_NO_START + 0xE00 // hukubukuro
#define ITEM1_F_NO_START ITEM1_NO_START + 0xF00 // kabu
#define FTR1_NO_START 0x3000
enum {
mRmTp_LIGHT_SWITCH_HOUSE0_MAIN_UPPER,
mRmTp_LIGHT_SWITCH_HOUSE0_BASEMENT,
mRmTp_LIGHT_SWITCH_HOUSE1_MAIN_UPPER,
mRmTp_LIGHT_SWITCH_HOUSE1_BASEMENT,
mRmTp_LIGHT_SWITCH_HOUSE2_MAIN_UPPER,
mRmTp_LIGHT_SWITCH_HOUSE2_BASEMENT,
mRmTp_LIGHT_SWITCH_HOUSE3_MAIN_UPPER,
mRmTp_LIGHT_SWITCH_HOUSE3_BASEMENT,
mRmTp_LIGHT_SWITCH_COTTAGE_MY,
mRmTp_LIGHT_SWITCH_9,
mRmTp_LIGHT_SWITCH_NPC,
mRmTp_LIGHT_SWITCH_LIGHTHOUSE,
mRmTp_LIGHT_SWITCH_TENT,
mRmTp_LIGHT_SWITCH_NUM
};
extern int mRmTp_ItemNo2FtrSize(mActor_name_t item_no);
extern int mRmTp_GetFurnitureData(mActor_name_t ftr, int ut_x, int ut_z, mRmTp_FtrPlaceInfoOne_t* place_info);
extern void mRmTp_MakeFtrNoTable(mActor_name_t* dst, mActor_name_t* src);
extern int mRmTp_GetFtrActionSE(int ftr_idx, int mode);
extern u8* mRmTp_CheckFtrBirthInfoTop();
extern int mRmTp_GetFloorIdx();
extern int mRmTp_GetWallIdx();
extern mActor_name_t mRmTp_Item1ItemNo2FtrItemNo_AtPlayerRoom(mActor_name_t item1_no, int no_convert_tools);
extern mActor_name_t mRmTp_FtrItemNo2Item1ItemNo(mActor_name_t ftr_no, int no_convert_tools);
extern void mRmTp_MakeMelodyData();
extern u8* mRmTp_GetMelodyData();
extern void mRmTp_DrawFamicomInfo(gfxprint_t* gfxprint);
extern void mRmTp_MakeFamicom_Fdebug();
extern mActor_name_t mRmTp_GetPlayerRoomCollisionIdx(mActor_name_t field_id, mActor_name_t bg_idx);
extern int mRmTp_FurnitureIdx2FurnitureKind(int ftr_idx);
extern void mRmTp_CopyWallData(u8* dst, int wall_no);
extern void mRmTp_CopyFloorData(u8* dst, int floor_no);
extern int mRmTp_CheckTalkAble(s16* rot, xyz_t* pos, int required_dir, f32 max_dist, GAME_PLAY* play);
extern int mRmTp_CheckWallIsMyOriginalInThisScene();
extern int mRmTp_CheckFloorIsMyOriginalInThisScene();
extern int mRmTp_GetEntranceBasePosition(xyz_t* pos);
extern int mRmTp_GetNowSceneLightSwitchIndex();
extern int mRmTp_PleaseDrawLightSwitch();
extern int mRmTp_NowSceneLightSwitchON();
extern int mRmTp_IndexLightSwitchON(int switch_index);
extern int mRmTp_NowSceneLightSwitchOFF();
extern int mRmTp_IndexLightSwitchOFF(int switch_index);
extern int mRmTp_Index2LightSwitchStatus(int switch_index);
extern int mRmTp_SetDefaultLightSwitchData(int state);
extern void mRmTp_DecideCottageDefaultLightSwitch();
extern int mRmTp_GetNowSceneOriginalWallStatus();
extern int mRmTp_GetNowSceneOriginalFloorStatus();
extern void mRmTp_SetNowSceneOriginalWallStatus(int enabled);
extern void mRmTp_SetNowSceneOriginalFloorStatus(int enabled);
extern int mRmTp_FtrItemNo2FtrIdx(mActor_name_t ftr_item_no);
extern mActor_name_t mRmTp_FtrIdx2FtrItemNo(int ftr_idx, int direct);
extern int mRmTp_SoundStepWalkSE(xyz_t* wpos);
#endif

View File

@ -20,7 +20,7 @@ extern int ScreenHeight;
extern OSThread graphThread;
extern u8 SegmentBaseAddress[0x40];
void foresta_main();
void main();
extern void mainproc(void* val);
#ifdef __cplusplus

View File

@ -1,11 +1,11 @@
#ifndef RANDOM_FIELD_H
#define RANDOM_FIELD_H
#include "types.h"
#define mRF_PERFECT_BIT 9
int mRF_GetRandom(int val);
#ifndef RANDOM_FIELD_H
#define RANDOM_FIELD_H
#include "types.h"
#define mRF_PERFECT_BIT 9
int mRF_GetRandom(int val);
#endif

View File

@ -1,139 +1,173 @@
#ifndef TYPES_H
#define TYPES_H
#include "../tools/ppcdis/include/ppcdis.h"
#ifdef IS_REL
// #pragma section const_type sconst_type ".rodata" ".rodata" data_mode=far_abs code_mode=pc_rel
#endif
typedef signed char s8;
typedef signed short s16;
typedef signed long s32;
typedef signed long long s64;
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned long u32;
typedef unsigned long size_t;
typedef unsigned long long u64;
typedef unsigned int uint;
typedef volatile u8 vu8;
typedef volatile u16 vu16;
typedef volatile u32 vu32;
typedef volatile u64 vu64;
typedef volatile s8 vs8;
typedef volatile s16 vs16;
typedef volatile s32 vs32;
typedef volatile s64 vs64;
typedef float f32;
typedef double f64;
typedef volatile f32 vf32;
typedef volatile f64 vf64;
typedef int BOOL;
typedef unsigned int uintptr_t; // Manually added
// Pointer to unknown, to be determined at a later date.
typedef void* unkptr;
typedef u32 unknown;
#define TRUE 1
#define FALSE 0
#define NULL ((void*)0)
#define nullptr 0
#define AT_ADDRESS(x) : (x)
#define ALIGN_PREV(u, align) (u & (~(align - 1)))
#define ALIGN_NEXT(u, align) ((u + (align - 1)) & (~(align - 1)))
#define IS_ALIGNED(X, N) (((X) & ((N) - 1)) == 0)
#define IS_NOT_ALIGNED(X, N) (((X) & ((N) - 1)) != 0)
#define FLAG_ON(V, F) (((V) & (F)) == 0)
#define FLAG_OFF(V, F) (((V) & (F)) != 0)
#ifndef ATTRIBUTE_ALIGN
#if defined(__MWERKS__) || defined(__GNUC__)
#define ATTRIBUTE_ALIGN(num) __attribute__((aligned(num)))
#elif defined(_MSC_VER)
#define ATTRIBUTE_ALIGN(num)
#else
#error unknown compiler
#endif
#endif
#define BUTTON_NONE 0x0000
#define BUTTON_CRIGHT 0x0001
#define BUTTON_CLEFT 0x0002
#define BUTTON_CDOWN 0x0004
#define BUTTON_CUP 0x0008
#define BUTTON_R 0x0010
#define BUTTON_L 0x0020
#define BUTTON_X 0x0040
#define BUTTON_Y 0x0080
#define BUTTON_DRIGHT 0x0100
#define BUTTON_DLEFT 0x0200
#define BUTTON_DDOWN 0x0400
#define BUTTON_DUP 0x0800
#define BUTTON_START 0x1000
#define BUTTON_Z 0x2000
#define BUTTON_B 0x4000
#define BUTTON_A 0x8000
#define FRAMES_PER_SECOND 60
#define ARRAY_SIZE(arr, type) (sizeof(arr) / sizeof(type))
#define ARRAY_COUNT(arr) (int)(sizeof(arr) / sizeof(arr[0]))
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define FLOOR(n, f) (((n) / (f)) * (f))
#define F32_IS_ZERO(v) (fabsf(v) < 0.008f)
/* ARGB8 color format (32 bits) to RGB5A3 color format (16 bits) */
#define ARGB8_to_RGB5A3(argb8) \
((u16)(((argb8) & 0xFF000000) >= 0xE0000000 \
? /* Fully opaque, 5 bits per color channel */ (0x8000 | ((((argb8) >> 16) & 0xF8) << 7) | \
((((argb8) >> 8) & 0xF8) << 2) | \
(((argb8) & 0xFF) >> 3)) \
: /* 3 bits of transparency, 4 bits per color channel */ ( \
((((argb8) >> 24) & 0xE0) << 7) | ((((argb8) >> 16) & 0xF0) << 4) | (((argb8) >> 8) & 0xF0) | \
(((argb8) & 0xF0) >> 4))))
#define GPACK_RGB5A3(r, g, b, a) \
ARGB8_to_RGB5A3((((a) & 0xFF) << 24) | (((r) & 0xFF) << 16) | (((g) & 0xFF) << 8) | ((b) & 0xFF))
#pragma section RX "forcestrip"
#ifndef __INTELLISENSE__
#define FORCESTRIP __declspec(section "forcestrip")
#else
#define FORCESTRIP
#endif
#ifdef MUST_MATCH
#define MATCH_FORCESTRIP FORCESTRIP
#else
#define MATCH_FORCESTRIP
#endif
#if !defined(__INTELLISENSE__) && defined(MUST_MATCH)
#define BSS_ORDER_GROUP_START FORCESTRIP ORDER_BSS_DATA {
#define BSS_ORDER_GROUP_END }
#define BSS_ORDER_ITEM(v) ORDER_BSS(v)
#else
#define BSS_ORDER_GROUP_START
#define BSS_ORDER_GROUP_END
#define BSS_ORDER_ITEM(v)
#endif
#ifndef __cplusplus
// Some definitions rely on wchar_t being defined
typedef short wchar_t;
#endif
#endif
#ifndef TYPES_H
#define TYPES_H
typedef signed char s8;
typedef signed short s16;
typedef signed long s32;
typedef signed long long s64;
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned long u32;
#ifndef _SIZE_T_DEF
#define _SIZE_T_DEF
typedef unsigned long size_t;
#endif
typedef unsigned long long u64;
typedef unsigned int uint;
typedef volatile u8 vu8;
typedef volatile u16 vu16;
typedef volatile u32 vu32;
typedef volatile u64 vu64;
typedef volatile s8 vs8;
typedef volatile s16 vs16;
typedef volatile s32 vs32;
typedef volatile s64 vs64;
typedef float f32;
typedef double f64;
typedef volatile f32 vf32;
typedef volatile f64 vf64;
typedef int BOOL;
typedef unsigned int uintptr_t; // Manually added
// Pointer to unknown, to be determined at a later date.
typedef void* unkptr;
typedef u32 unknown;
#define TRUE 1
#define FALSE 0
#ifndef NULL
#define NULL ((void*)0)
#endif
#define nullptr 0
#ifdef __MWERKS__
#define AT_ADDRESS(x) : (x)
#else
#define AT_ADDRESS(x) __attribute__((section(".data." #x)))
#endif
#define ALIGN_PREV(u, align) (u & (~(align - 1)))
#define ALIGN_NEXT(u, align) ((u + (align - 1)) & (~(align - 1)))
#define IS_ALIGNED(X, N) (((X) & ((N) - 1)) == 0)
#define IS_NOT_ALIGNED(X, N) (((X) & ((N) - 1)) != 0)
#define FLAG_ON(V, F) (((V) & (F)) == 0)
#define FLAG_OFF(V, F) (((V) & (F)) != 0)
#ifndef ATTRIBUTE_ALIGN
#if defined(__MWERKS__) || defined(__GNUC__)
#define ATTRIBUTE_ALIGN(num) __attribute__((aligned(num)))
#elif defined(_MSC_VER)
#define ATTRIBUTE_ALIGN(num)
#else
#error unknown compiler
#endif
#endif
#define BUTTON_NONE 0x0000
#define BUTTON_CRIGHT 0x0001
#define BUTTON_CLEFT 0x0002
#define BUTTON_CDOWN 0x0004
#define BUTTON_CUP 0x0008
#define BUTTON_R 0x0010
#define BUTTON_L 0x0020
#define BUTTON_X 0x0040
#define BUTTON_Y 0x0080
#define BUTTON_DRIGHT 0x0100
#define BUTTON_DLEFT 0x0200
#define BUTTON_DDOWN 0x0400
#define BUTTON_DUP 0x0800
#define BUTTON_START 0x1000
#define BUTTON_Z 0x2000
#define BUTTON_B 0x4000
#define BUTTON_A 0x8000
#define FRAMES_PER_SECOND 60
#define ARRAY_SIZE(arr, type) (sizeof(arr) / sizeof(type))
#define ARRAY_COUNT(arr) (int)(sizeof(arr) / sizeof(arr[0]))
#ifndef MAX
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
#define FLOOR(n, f) (((n) / (f)) * (f))
#define F32_IS_ZERO(v) (fabsf(v) < 0.008f)
/* ARGB8 color format (32 bits) to RGB5A3 color format (16 bits) */
#define ARGB8_to_RGB5A3(argb8) \
((u16)(((argb8) & 0xFF000000) >= 0xE0000000 \
? /* Fully opaque, 5 bits per color channel */ (0x8000 | ((((argb8) >> 16) & 0xF8) << 7) | \
((((argb8) >> 8) & 0xF8) << 2) | \
(((argb8) & 0xFF) >> 3)) \
: /* 3 bits of transparency, 4 bits per color channel */ ( \
((((argb8) >> 24) & 0xE0) << 7) | ((((argb8) >> 16) & 0xF0) << 4) | (((argb8) >> 8) & 0xF0) | \
(((argb8) & 0xF0) >> 4))))
#define GPACK_RGB5A3(r, g, b, a) \
ARGB8_to_RGB5A3((((a) & 0xFF) << 24) | (((r) & 0xFF) << 16) | (((g) & 0xFF) << 8) | ((b) & 0xFF))
#pragma section RX "forcestrip"
#ifndef __INTELLISENSE__
#define FORCESTRIP __declspec(section "forcestrip")
#else
#define FORCESTRIP
#endif
#if defined(MUST_MATCH) && defined(__MWERKS__)
#define MATCH_FORCESTRIP FORCESTRIP
#else
#define MATCH_FORCESTRIP
#endif
#if !defined(__INTELLISENSE__) && defined(MUST_MATCH)
#define ORDER_BSS_DATA static asm void order_bss()
#define ORDER_BSS(s) lis r3, s @ha
#define BSS_ORDER_GROUP_START FORCESTRIP ORDER_BSS_DATA {
#define BSS_ORDER_GROUP_END }
#define BSS_ORDER_ITEM(v) ORDER_BSS(v)
#else
#define BSS_ORDER_GROUP_START
#define BSS_ORDER_GROUP_END
#define BSS_ORDER_ITEM(v)
#endif
#ifndef __cplusplus
// Some definitions rely on wchar_t being defined
typedef short wchar_t;
#endif
#if DEBUG
#define ASSERTLINE(line, cond) \
((cond) || (OSPanic(__FILE__, line, "Failed assertion " #cond), 0))
#define ASSERTMSGLINE(line, cond, msg) \
((cond) || (OSPanic(__FILE__, line, msg), 0))
// This is dumb but we dont have a Metrowerks way to do variadic macros in the macro to make this done in a not scrubby way.
#define ASSERTMSG1LINE(line, cond, msg, arg1) \
((cond) || (OSPanic(__FILE__, line, msg, arg1), 0))
#define ASSERTMSG2LINE(line, cond, msg, arg1, arg2) \
((cond) || (OSPanic(__FILE__, line, msg, arg1, arg2), 0))
#define ASSERTMSGLINEV(line, cond, ...) \
((cond) || (OSPanic(__FILE__, line, __VA_ARGS__), 0))
#else
#define ASSERTLINE(line, cond) (void)0
#define ASSERTMSGLINE(line, cond, msg) (void)0
#define ASSERTMSG1LINE(line, cond, msg, arg1) (void)0
#define ASSERTMSG2LINE(line, cond, msg, arg1, arg2) (void)0
#define ASSERTMSGLINEV(line, cond, ...) (void)0
#endif
#endif

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