mirror of
https://github.com/Mr-Wiseguy/Zelda64Recomp.git
synced 2025-04-07 05:56:53 +02:00
Compare commits
136 Commits
v1.0.0-rc1
...
dev
Author | SHA1 | Date | |
---|---|---|---|
![]() |
fd16c379ff | ||
![]() |
3d3524ffe7 | ||
![]() |
1c8668fb65 | ||
![]() |
c6d77fe5ca | ||
![]() |
21a6f4046f | ||
![]() |
25e7b31228 | ||
![]() |
91db87632c | ||
![]() |
0d0f64e32f | ||
![]() |
d99a84f04f | ||
![]() |
af1404b83d | ||
![]() |
83ecc68d18 | ||
![]() |
7697a972a3 | ||
![]() |
473b3d3d02 | ||
![]() |
d782d3dcb9 | ||
![]() |
142b4d021b | ||
![]() |
6598da434e | ||
![]() |
3346400775 | ||
![]() |
c90434962f | ||
![]() |
9981b922dc | ||
![]() |
528a22d86f | ||
![]() |
4c2cc2003a | ||
![]() |
c21d55938b | ||
![]() |
5aa650bffa | ||
![]() |
a8a5e216fe | ||
![]() |
97912578e9 | ||
![]() |
e35bb0700f | ||
![]() |
c7baa7ef8f | ||
![]() |
19d2e38499 | ||
![]() |
79fc56f1fd | ||
![]() |
5e3aac4b45 | ||
![]() |
6dd618e5a4 | ||
![]() |
208e3044fc | ||
![]() |
cbb5e8e7a4 | ||
![]() |
4abd0fe720 | ||
![]() |
07cfe51010 | ||
![]() |
b086945b67 | ||
![]() |
1a6a3b3082 | ||
![]() |
19fcd9bf31 | ||
![]() |
b31cf0a76b | ||
![]() |
0e31d3b582 | ||
![]() |
2607c8098f | ||
![]() |
e819c62da2 | ||
![]() |
b0d0cab6c2 | ||
![]() |
1c00519938 | ||
![]() |
030d793056 | ||
![]() |
bec699f0bd | ||
![]() |
6e9ee3498b | ||
![]() |
4d682fac8a | ||
![]() |
d1f5ff3bba | ||
![]() |
9ab97993e1 | ||
![]() |
49baa68ea1 | ||
![]() |
db1def4280 | ||
![]() |
7d3ae05436 | ||
![]() |
763c714653 | ||
![]() |
ce406e9c5d | ||
![]() |
3e5efc935e | ||
![]() |
a3d287575d | ||
![]() |
8319d97ad1 | ||
![]() |
b6b3bca731 | ||
![]() |
95b7a64f1c | ||
![]() |
790b10a4b4 | ||
![]() |
32b0fc5f53 | ||
![]() |
1ea7d4ebe9 | ||
![]() |
4ebe71bfcc | ||
![]() |
d4898f2316 | ||
![]() |
3c34fa63c1 | ||
![]() |
a4f61016bb | ||
![]() |
773cc3bbb0 | ||
![]() |
332a45cd64 | ||
![]() |
23eb6b7eea | ||
![]() |
169155953e | ||
![]() |
41e737249e | ||
![]() |
02a774e4ff | ||
![]() |
466b766cfa | ||
![]() |
26f5fcc952 | ||
![]() |
b803da8a58 | ||
![]() |
0a0699f272 | ||
![]() |
0b609752ce | ||
![]() |
f872ca87cc | ||
![]() |
671d94a6d5 | ||
![]() |
6121e5aa3c | ||
![]() |
b791a4aa1d | ||
![]() |
3f9478c7e6 | ||
![]() |
511fca8393 | ||
![]() |
7e8782c114 | ||
![]() |
008dfa5b0b | ||
![]() |
29161d17f2 | ||
![]() |
ada320a184 | ||
![]() |
4873460b88 | ||
![]() |
abbf090153 | ||
![]() |
89af45ae34 | ||
![]() |
d5fb5f50c1 | ||
![]() |
a72f4d6072 | ||
![]() |
452d2af067 | ||
![]() |
b1109f66c1 | ||
![]() |
028fa7fd17 | ||
![]() |
c9c1726a8b | ||
![]() |
82c449045f | ||
![]() |
b18262c692 | ||
![]() |
c898edd749 | ||
![]() |
b89d9c8508 | ||
![]() |
f56b6c6b87 | ||
![]() |
8a035386c0 | ||
![]() |
25461da8ab | ||
![]() |
ac14e4ca3f | ||
![]() |
4c3d48ba8f | ||
![]() |
18be149b7b | ||
![]() |
af165cb21c | ||
![]() |
47de6032d9 | ||
![]() |
db41873d69 | ||
![]() |
300af8c8c4 | ||
![]() |
d1fb2bd278 | ||
![]() |
73eac7c88d | ||
![]() |
2a72fc25ca | ||
![]() |
83b196a4e5 | ||
![]() |
9ff794f502 | ||
![]() |
a324b7853d | ||
![]() |
54b862599c | ||
![]() |
7034243ff6 | ||
![]() |
0faf51e8a2 | ||
![]() |
b7775e1e96 | ||
![]() |
3fdb2dc001 | ||
![]() |
55aa02c4b3 | ||
![]() |
619325366e | ||
![]() |
20d6f56644 | ||
![]() |
6aaf0bbd71 | ||
![]() |
76a879359e | ||
![]() |
7491eabde0 | ||
![]() |
956db3366f | ||
![]() |
11012cdfc6 | ||
![]() |
1ef8656a93 | ||
![]() |
b9c9e65672 | ||
![]() |
52278c5a4d | ||
![]() |
1ec20de2f5 | ||
![]() |
0aafcb6ee2 | ||
![]() |
d555f0c65b |
40
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
40
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Report a bug in the project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
## If you have a crash on startup, please make sure your graphics drivers are up to date before submitting a bug report.
|
||||
|
||||
**What is your GPU driver version? Old drivers, particularly on Nvidia, are known to cause crashes on boot on 1.1.0. If you are on Nvidia and the game is crashing on boot, please update to driver version 555.85 or newer before opening an issue.**
|
||||
|
||||
**Have you checked whether this issue is vanilla behavior? In other words, does it occur on original hardware?**
|
||||
|
||||
**Were you playing with intended mechanics, or using glitches? If it's the latter, which glitches?**
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. etc.
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
Please attach a screenshot of the bug.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [Windows 10, Windows 11, Linux distro]
|
||||
- Version: [e.g. 1.0.0]
|
||||
- CPU: [e.g. Intel Core ..., AMD Ryzen ..., etc.]
|
||||
- GPU: [e.g. NVIDIA GeForce .../Radeon RX .../Intel UHD .../etc.]
|
||||
- GPU driver: [e.g Nvidia driver 545.XX, AMD driver 24.X.X, etc]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
9
.github/linux/Zelda64Recompiled.desktop
vendored
Normal file
9
.github/linux/Zelda64Recompiled.desktop
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
[Desktop Entry]
|
||||
Name=Zelda64Recompiled
|
||||
Type=Application
|
||||
Terminal=false
|
||||
Icon=Zelda64Recompiled
|
||||
Exec=Zelda64Recompiled
|
||||
GenericName=Zelda64Recompiled
|
||||
Categories=Game;
|
||||
|
45
.github/linux/appimage.sh
vendored
Executable file
45
.github/linux/appimage.sh
vendored
Executable file
@ -0,0 +1,45 @@
|
||||
ARCH=$(uname -m)
|
||||
LINUX_DEPLOY_ARCH=$(uname -m)
|
||||
|
||||
if [ "$ARCH" = "x86_64" ]; then
|
||||
ARCH="x86_64"
|
||||
LINUX_DEPLOY_ARCH="x86_64"
|
||||
elif [ "$ARCH" = "aarch64" ]; then
|
||||
ARCH="arm_aarch64"
|
||||
LINUX_DEPLOY_ARCH="aarch64"
|
||||
else
|
||||
echo "Unsupported architecture: $ARCH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
curl -sSfLO "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-$LINUX_DEPLOY_ARCH.AppImage"
|
||||
curl -sSfLO "https://github.com/linuxdeploy/linuxdeploy-plugin-gtk/raw/master/linuxdeploy-plugin-gtk.sh"
|
||||
|
||||
chmod a+x linuxdeploy*
|
||||
|
||||
mkdir -p AppDir/usr/bin
|
||||
cp Zelda64Recompiled AppDir/usr/bin/
|
||||
cp -r assets/ AppDir/usr/bin/
|
||||
cp gamecontrollerdb.txt AppDir/usr/bin/
|
||||
cp icons/512.png AppDir/Zelda64Recompiled.png
|
||||
cp .github/linux/Zelda64Recompiled.desktop AppDir/
|
||||
|
||||
"./linuxdeploy-$LINUX_DEPLOY_ARCH.AppImage" --appimage-extract
|
||||
mv squashfs-root/ deploy
|
||||
./deploy/AppRun --appdir=AppDir/ -d AppDir/Zelda64Recompiled.desktop -i AppDir/Zelda64Recompiled.png -e AppDir/usr/bin/Zelda64Recompiled --plugin gtk
|
||||
sed -i 's/exec/#exec/g' AppDir/AppRun
|
||||
echo 'if [ -f "portable.txt" ]; then' >> AppDir/AppRun
|
||||
echo ' APP_FOLDER_PATH=$PWD' >> AppDir/AppRun
|
||||
echo ' cd "$this_dir"/usr/bin/' >> AppDir/AppRun
|
||||
echo ' APP_FOLDER_PATH=$APP_FOLDER_PATH ./Zelda64Recompiled' >> AppDir/AppRun
|
||||
echo 'else' >> AppDir/AppRun
|
||||
echo ' cd "$this_dir"/usr/bin/' >> AppDir/AppRun
|
||||
echo ' ./Zelda64Recompiled' >> AppDir/AppRun
|
||||
echo 'fi' >> AppDir/AppRun
|
||||
|
||||
# Remove conflicting libraries
|
||||
rm -rf AppDir/usr/lib/libgmodule*
|
||||
rm -rf AppDir/usr/lib/gio/modules/*.so
|
||||
rm -rf AppDir/usr/lib/libwayland*
|
||||
|
||||
./deploy/usr/bin/linuxdeploy-plugin-appimage --appdir=AppDir
|
26
.github/macos/Info.plist.in
vendored
Normal file
26
.github/macos/Info.plist.in
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleName</key>
|
||||
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>Zelda64Recompiled</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.games</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>11</string>
|
||||
<key>GCSupportsGameMode</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
87
.github/macos/apple_bundle.cmake
vendored
Normal file
87
.github/macos/apple_bundle.cmake
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
# Define the path to the entitlements file
|
||||
set(ENTITLEMENTS_FILE ${CMAKE_SOURCE_DIR}/.github/macos/entitlements.plist)
|
||||
|
||||
# Set bundle properties
|
||||
set_target_properties(Zelda64Recompiled PROPERTIES
|
||||
MACOSX_BUNDLE TRUE
|
||||
MACOSX_BUNDLE_BUNDLE_NAME "Zelda64Recompiled"
|
||||
MACOSX_BUNDLE_GUI_IDENTIFIER "com.github.zelda64recompiled"
|
||||
MACOSX_BUNDLE_BUNDLE_VERSION "1.0"
|
||||
MACOSX_BUNDLE_SHORT_VERSION_STRING "1.0"
|
||||
MACOSX_BUNDLE_ICON_FILE "AppIcon.icns"
|
||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_BINARY_DIR}/Info.plist
|
||||
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "-"
|
||||
XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${ENTITLEMENTS_FILE}
|
||||
)
|
||||
|
||||
# Create icon files for macOS bundle
|
||||
set(ICON_SOURCE ${CMAKE_SOURCE_DIR}/icons/512.png)
|
||||
set(ICONSET_DIR ${CMAKE_BINARY_DIR}/AppIcon.iconset)
|
||||
set(ICNS_FILE ${CMAKE_BINARY_DIR}/resources/AppIcon.icns)
|
||||
|
||||
# Create iconset directory and add PNG file
|
||||
add_custom_command(
|
||||
OUTPUT ${ICONSET_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${ICONSET_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${ICON_SOURCE} ${ICONSET_DIR}/icon_512x512.png
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${ICON_SOURCE} ${ICONSET_DIR}/icon_512x512@2x.png
|
||||
COMMAND touch ${ICONSET_DIR}
|
||||
COMMENT "Creating iconset directory and copying PNG file"
|
||||
)
|
||||
|
||||
# Convert iconset to icns
|
||||
add_custom_command(
|
||||
OUTPUT ${ICNS_FILE}
|
||||
DEPENDS ${ICONSET_DIR}
|
||||
COMMAND iconutil -c icns ${ICONSET_DIR} -o ${ICNS_FILE}
|
||||
COMMENT "Converting iconset to icns"
|
||||
)
|
||||
|
||||
# Custom target to ensure icns creation
|
||||
add_custom_target(create_icns ALL DEPENDS ${ICNS_FILE})
|
||||
|
||||
# Set source file properties for the resulting icns file
|
||||
set_source_files_properties(${ICNS_FILE} PROPERTIES
|
||||
MACOSX_PACKAGE_LOCATION "Resources"
|
||||
)
|
||||
|
||||
# Add the icns file to the executable target
|
||||
target_sources(Zelda64Recompiled PRIVATE ${ICNS_FILE})
|
||||
|
||||
# Ensure Zelda64Recompiled depends on create_icns
|
||||
add_dependencies(Zelda64Recompiled create_icns)
|
||||
|
||||
# Configure Info.plist
|
||||
configure_file(${CMAKE_SOURCE_DIR}/.github/macos/Info.plist.in ${CMAKE_BINARY_DIR}/Info.plist @ONLY)
|
||||
|
||||
# Install the app bundle
|
||||
install(TARGETS Zelda64Recompiled BUNDLE DESTINATION .)
|
||||
|
||||
# Ensure the entitlements file exists
|
||||
if(NOT EXISTS ${ENTITLEMENTS_FILE})
|
||||
message(FATAL_ERROR "Entitlements file not found at ${ENTITLEMENTS_FILE}")
|
||||
endif()
|
||||
|
||||
# Post-build steps for macOS bundle
|
||||
add_custom_command(TARGET Zelda64Recompiled POST_BUILD
|
||||
# Copy and fix frameworks first
|
||||
COMMAND ${CMAKE_COMMAND} -D CMAKE_BUILD_TYPE=$<CONFIG> -D CMAKE_GENERATOR=${CMAKE_GENERATOR} -P ${CMAKE_SOURCE_DIR}/.github/macos/fixup_bundle.cmake
|
||||
|
||||
# Copy all resources
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/assets ${CMAKE_BINARY_DIR}/temp_assets
|
||||
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/temp_assets/scss
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/temp_assets $<TARGET_BUNDLE_DIR:Zelda64Recompiled>/Contents/Resources/assets
|
||||
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/temp_assets
|
||||
|
||||
# Copy controller database
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/gamecontrollerdb.txt $<TARGET_BUNDLE_DIR:Zelda64Recompiled>/Contents/Resources/
|
||||
|
||||
# Set RPATH
|
||||
COMMAND install_name_tool -add_rpath "@executable_path/../Frameworks/" $<TARGET_BUNDLE_DIR:Zelda64Recompiled>/Contents/MacOS/Zelda64Recompiled
|
||||
|
||||
# Sign the bundle
|
||||
COMMAND codesign --verbose=4 --options=runtime --no-strict --sign - --entitlements ${ENTITLEMENTS_FILE} --deep --force $<TARGET_BUNDLE_DIR:Zelda64Recompiled>
|
||||
|
||||
COMMENT "Performing post-build steps for macOS bundle"
|
||||
VERBATIM
|
||||
)
|
14
.github/macos/entitlements.plist
vendored
Normal file
14
.github/macos/entitlements.plist
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.cs.allow-jit</key>
|
||||
<true/>
|
||||
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
|
||||
<true/>
|
||||
<key>com.apple.security.cs.disable-executable-page-protection</key>
|
||||
<true/>
|
||||
<key>com.apple.security.cs.disable-library-validation</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
44
.github/macos/fixup_bundle.cmake
vendored
Normal file
44
.github/macos/fixup_bundle.cmake
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
include(BundleUtilities)
|
||||
|
||||
# Check for pkgx installation
|
||||
find_program(PKGX_EXECUTABLE pkgx)
|
||||
|
||||
# Xcode generator puts the build type in the build directory
|
||||
set(BUILD_PREFIX "")
|
||||
if (CMAKE_GENERATOR STREQUAL "Xcode")
|
||||
set(BUILD_PREFIX "${CMAKE_BUILD_TYPE}/")
|
||||
endif()
|
||||
|
||||
# Use generator expressions to get the absolute path to the bundle
|
||||
set(APPS "${BUILD_PREFIX}Zelda64Recompiled.app/Contents/MacOS/Zelda64Recompiled")
|
||||
|
||||
# Set up framework search paths
|
||||
set(DIRS "${BUILD_PREFIX}Zelda64Recompiled.app/Contents/Frameworks")
|
||||
|
||||
# Detect if we're using pkgx
|
||||
if(PKGX_EXECUTABLE)
|
||||
message(STATUS "pkgx detected, adding pkgx directories to framework search path")
|
||||
list(APPEND DIRS "$ENV{HOME}/.pkgx/")
|
||||
endif()
|
||||
|
||||
# Convert all paths to absolute paths
|
||||
file(REAL_PATH ${APPS} APPS)
|
||||
|
||||
set(RESOLVED_DIRS "")
|
||||
foreach(DIR IN LISTS DIRS)
|
||||
# Handle home directory expansion
|
||||
string(REPLACE "~" "$ENV{HOME}" DIR "${DIR}")
|
||||
# Convert to absolute path, but don't fail if directory doesn't exist
|
||||
if(EXISTS "${DIR}")
|
||||
file(REAL_PATH "${DIR}" RESOLVED_DIR)
|
||||
list(APPEND RESOLVED_DIRS "${RESOLVED_DIR}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Debug output
|
||||
message(STATUS "Bundle fixup paths:")
|
||||
message(STATUS " App: ${APPS}")
|
||||
message(STATUS " Search dirs: ${RESOLVED_DIRS}")
|
||||
|
||||
# Fix up the bundle
|
||||
fixup_bundle("${APPS}" "" "${RESOLVED_DIRS}")
|
73
.github/macos/ld64
vendored
Executable file
73
.github/macos/ld64
vendored
Executable file
@ -0,0 +1,73 @@
|
||||
#!/usr/bin/python3
|
||||
"""
|
||||
Custom ld64 wrapper for macOS
|
||||
|
||||
This script wraps the standard macOS linker (/usr/bin/ld) to modify executable memory
|
||||
protection flags in the resulting Mach-O binary. It works in three stages:
|
||||
|
||||
1. First, it passes through all arguments to the regular macOS linker to create the binary
|
||||
2. Then, it parses command line arguments to identify output file and segment protection flags
|
||||
3. Finally, it modifies the output binary's Mach-O headers to ensure segments (particularly __TEXT)
|
||||
have the maximum protection flags (rwx) we specify, even if the default macOS linker would restrict them
|
||||
|
||||
This is necessary because macOS restricts writable+executable memory by default,
|
||||
but certain applications need this capability for dynamic code generation or JIT compilation.
|
||||
|
||||
Usage: Same as the standard ld64 linker, with the added benefit that -segprot options
|
||||
will have their max_prot values properly preserved in the output binary.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import subprocess
|
||||
from itertools import takewhile
|
||||
from macholib import MachO, ptypes
|
||||
|
||||
def parse_rwx(text):
|
||||
return ('r' in text and 1) | ('w' in text and 2) | ('x' in text and 4)
|
||||
|
||||
def apply_maxprots(path, maxprots):
|
||||
mach = MachO.MachO(path)
|
||||
header = mach.headers[0]
|
||||
offset = ptypes.sizeof(header.mach_header)
|
||||
|
||||
for cload, ccmd, cdata in header.commands:
|
||||
if not hasattr(ccmd, 'segname'):
|
||||
break
|
||||
|
||||
if hasattr(ccmd.segname, 'to_str'):
|
||||
segname = ccmd.segname.to_str().decode('utf-8').strip('\0')
|
||||
else:
|
||||
segname = ccmd.segname.decode('utf-8').strip('\0')
|
||||
|
||||
if segname in maxprots and ccmd.maxprot != maxprots[segname]:
|
||||
fields = list(takewhile(lambda field: field[0] != 'maxprot', cload._fields_ + ccmd._fields_))
|
||||
index = offset + sum(ptypes.sizeof(typ) for _, typ in fields)
|
||||
|
||||
with open(path, 'r+b') as fh:
|
||||
fh.seek(index)
|
||||
fh.write(bytes([maxprots[segname]]))
|
||||
|
||||
offset += cload.cmdsize
|
||||
|
||||
try:
|
||||
subprocess.check_call(['/usr/bin/ld'] + sys.argv[1:])
|
||||
except subprocess.CalledProcessError as ex:
|
||||
sys.exit(ex.returncode)
|
||||
|
||||
output_file = 'a.out'
|
||||
segprots = {'__TEXT': parse_rwx('rwx')} # maxprot = rwx
|
||||
|
||||
i = 1
|
||||
while i < len(sys.argv):
|
||||
if sys.argv[i] == '-o' and i + 1 < len(sys.argv):
|
||||
output_file = sys.argv[i + 1]
|
||||
i += 2
|
||||
elif sys.argv[i] == '-segprot' and i + 3 < len(sys.argv):
|
||||
segment = sys.argv[i + 1]
|
||||
maxprot = sys.argv[i + 2]
|
||||
segprots[segment] = parse_rwx(maxprot)
|
||||
i += 4
|
||||
else:
|
||||
i += 1
|
||||
|
||||
apply_maxprots(output_file, segprots)
|
14
.github/macos/macports.yaml
vendored
Normal file
14
.github/macos/macports.yaml
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
version: '2.9.3'
|
||||
prefix: '/opt/local'
|
||||
variants:
|
||||
select:
|
||||
- aqua
|
||||
- metal
|
||||
deselect: x11
|
||||
ports:
|
||||
- name: clang-18
|
||||
- name: llvm-18
|
||||
- name: libsdl2
|
||||
select: universal
|
||||
- name: freetype
|
||||
select: universal
|
64
.github/workflows/update-pr-artifacts.yml
vendored
Normal file
64
.github/workflows/update-pr-artifacts.yml
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
name: update-pr-artifacts
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: [validate-external, validate-internal]
|
||||
types:
|
||||
- completed
|
||||
jobs:
|
||||
update-pr-artifacts:
|
||||
runs-on: ubuntu-latest
|
||||
if: (github.event.workflow_run.event == 'pull_request' || github.event.workflow_run.event == 'pull_request_target') && github.event.workflow_run.conclusion == 'success'
|
||||
name: Update PR Artifacts
|
||||
steps:
|
||||
- name: Get PR Number
|
||||
id: pr-number
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
result-encoding: string
|
||||
script: |
|
||||
const { owner, repo } = context.repo;
|
||||
|
||||
const findPRNumber = async () => {
|
||||
const pulls = await github.rest.pulls.list({ owner, repo });
|
||||
for await (const { data } of github.paginate.iterator(pulls)) {
|
||||
for (const pull of data) {
|
||||
if (pull.head.sha === '${{ github.event.workflow_run.head_sha }}' && pull.user.id === ${{ github.event.sender.id }}) {
|
||||
return pull.number;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
const prNumber = await findPRNumber();
|
||||
if (!prNumber) {
|
||||
core.error(`No matching pull request found`);
|
||||
} else {
|
||||
return prNumber;
|
||||
}
|
||||
- name: Create Artifacts Content
|
||||
id: artifacts-content
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
result-encoding: string
|
||||
script: |
|
||||
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
run_id: context.payload.workflow_run.id,
|
||||
});
|
||||
|
||||
const nightlyLinks = artifacts.data.artifacts.reduce((acc, item) => {
|
||||
acc += `- [${item.name}.zip](https://nightly.link/${context.repo.owner}/${context.repo.repo}/actions/artifacts/${item.id}.zip)\n`;
|
||||
return acc;
|
||||
}, '### Build Artifacts\n');
|
||||
|
||||
return nightlyLinks;
|
||||
- name: Update PR Description
|
||||
uses: garrettjoecox/pr-section@3.1.0
|
||||
with:
|
||||
section-name: 'artifacts'
|
||||
repo-token: '${{ secrets.GITHUB_TOKEN }}'
|
||||
pr-number: ${{ steps.pr-number.outputs.result }}
|
||||
section-value: '${{ steps.artifacts-content.outputs.result }}'
|
19
.github/workflows/validate-external.yml
vendored
Normal file
19
.github/workflows/validate-external.yml
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
name: validate-external
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, synchronize]
|
||||
jobs:
|
||||
authorize:
|
||||
if: github.repository != github.event.pull_request.head.repo.full_name
|
||||
environment:
|
||||
${{ github.event_name == 'pull_request_target' &&
|
||||
github.event.pull_request.head.repo.full_name != github.repository &&
|
||||
'external' || 'internal' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo ✓
|
||||
build:
|
||||
needs: authorize
|
||||
uses: ./.github/workflows/validate.yml
|
||||
secrets:
|
||||
ZRE_REPO_WITH_PAT: ${{ secrets.ZRE_REPO_WITH_PAT }}
|
12
.github/workflows/validate-internal.yml
vendored
Normal file
12
.github/workflows/validate-internal.yml
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
name: validate-internal
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
jobs:
|
||||
build:
|
||||
if: github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name
|
||||
uses: ./.github/workflows/validate.yml
|
||||
secrets: inherit
|
363
.github/workflows/validate.yml
vendored
Normal file
363
.github/workflows/validate.yml
vendored
Normal file
@ -0,0 +1,363 @@
|
||||
name: validate
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
SDL2_VERSION:
|
||||
type: string
|
||||
required: false
|
||||
default: '2.30.3'
|
||||
N64RECOMP_COMMIT:
|
||||
type: string
|
||||
required: false
|
||||
default: '989a86b36912403cd323de884bf834f2605ea770'
|
||||
DXC_CHECKSUM:
|
||||
type: string
|
||||
required: false
|
||||
default: '4e6f4e52989aca69739880b40b9f988357f15d10ca03284377b81f1502463ff5'
|
||||
secrets:
|
||||
ZRE_REPO_WITH_PAT:
|
||||
required: true
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
jobs:
|
||||
build-linux:
|
||||
runs-on: ${{ format('blaze/compute/{0}-amd64', matrix.os) }}
|
||||
container:
|
||||
image: dcvz/n64recomp:ubuntu-18.04
|
||||
volumes:
|
||||
# create a volume that we'll use as the new source for the node binary
|
||||
# https://github.com/actions/checkout/issues/1809
|
||||
- /nodeoverride:/nodeoverride:rw,rshared
|
||||
- /nodeoverride:/__e/node20:ro,rshared
|
||||
strategy:
|
||||
matrix:
|
||||
type: [ Debug, Release ]
|
||||
os: [ ubuntu-22.04 ]
|
||||
name: ubuntu-18.04 (x64, ${{ matrix.type }})
|
||||
steps:
|
||||
- name: Copy the Node20 binary
|
||||
run: |
|
||||
cp -r /node20217/* /nodeoverride/
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha || github.ref }}
|
||||
submodules: recursive
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{ matrix.os }}-z64re-ccache-${{ matrix.type }}-x64-${{ inputs.N64RECOMP_COMMIT }}
|
||||
- name: Prepare Build
|
||||
run: |-
|
||||
git clone ${{ secrets.ZRE_REPO_WITH_PAT }}
|
||||
unzip zre/files.zip > /dev/null 2>&1
|
||||
- name: Build N64Recomp & RSPRecomp
|
||||
run: |
|
||||
git clone https://github.com/Mr-Wiseguy/N64Recomp.git --recurse-submodules N64RecompSource
|
||||
cd N64RecompSource
|
||||
git checkout ${{ inputs.N64RECOMP_COMMIT }}
|
||||
git submodule update --init --recursive
|
||||
|
||||
# enable ccache
|
||||
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
|
||||
# Build N64Recomp & RSPRecomp
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER=g++-11 -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_MAKE_PROGRAM=ninja -G Ninja -S . -B cmake-build
|
||||
cmake --build cmake-build --config Release --target N64RecompCLI -j $(nproc)
|
||||
cmake --build cmake-build --config Release --target RSPRecomp -j $(nproc)
|
||||
|
||||
# Copy N64Recomp & RSPRecomp to root directory
|
||||
cp cmake-build/N64Recomp ..
|
||||
cp cmake-build/RSPRecomp ..
|
||||
- name: Run N64Recomp & RSPRecomp
|
||||
run: |
|
||||
./N64Recomp us.rev1.toml
|
||||
./RSPRecomp aspMain.us.rev1.toml
|
||||
./RSPRecomp njpgdspMain.us.rev1.toml
|
||||
- name: Hotpatch DXC into RT64's contrib
|
||||
run: |
|
||||
# check if dxc was updated before we replace it, to detect changes
|
||||
echo ${{ inputs.DXC_CHECKSUM }} ./lib/rt64/src/contrib/dxc/bin/x64/dxc-linux | sha256sum --status -c -
|
||||
|
||||
cp -v /usr/local/lib/libdxcompiler.so ./lib/rt64/src/contrib/dxc/lib/x64/libdxcompiler.so
|
||||
cp -v /usr/local/bin/dxc ./lib/rt64/src/contrib/dxc/bin/x64/dxc-linux
|
||||
- name: Build ZeldaRecomp
|
||||
run: |-
|
||||
# enable ccache
|
||||
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
|
||||
cmake -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER=clang++-17 -DCMAKE_C_COMPILER=clang-17 -DCMAKE_MAKE_PROGRAM=ninja -G Ninja -S . -B cmake-build -DPATCHES_C_COMPILER=clang-17 -DPATCHES_LD=ld.lld-17
|
||||
cmake --build cmake-build --config ${{ matrix.type }} --target Zelda64Recompiled -j $(nproc)
|
||||
- name: Prepare Archive
|
||||
run: |
|
||||
mv cmake-build/Zelda64Recompiled Zelda64Recompiled
|
||||
rm -rf assets/scss
|
||||
tar -czf Zelda64Recompiled.tar.gz Zelda64Recompiled assets/ gamecontrollerdb.txt
|
||||
- name: Archive Zelda64Recomp
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Zelda64Recompiled-${{ runner.os }}-X64-${{ matrix.type }}
|
||||
path: Zelda64Recompiled.tar.gz
|
||||
- name: Build AppImage
|
||||
run: |-
|
||||
./.github/linux/appimage.sh
|
||||
- name: Zelda64Recomp AppImage
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Zelda64Recompiled-AppImage-X64-${{ matrix.type }}
|
||||
path: Zelda64Recompiled-*.AppImage
|
||||
build-linux-arm64:
|
||||
runs-on: ${{ format('blaze/compute/{0}', matrix.os) }}
|
||||
strategy:
|
||||
matrix:
|
||||
type: [ Debug, Release ]
|
||||
os: [ ubuntu-22.04 ]
|
||||
name: ${{ matrix.os }} (arm64, ${{ matrix.type }})
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha || github.ref }}
|
||||
submodules: recursive
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{ matrix.os }}-z64re-ccache-${{ matrix.type }}-arm64-${{ inputs.N64RECOMP_COMMIT }}
|
||||
- name: Install Linux Dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ninja-build libsdl2-dev libgtk-3-dev lld llvm clang-15 libfuse2
|
||||
|
||||
# Install SDL2
|
||||
echo ::group::install SDL2
|
||||
|
||||
# Enable ccache
|
||||
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
|
||||
wget https://github.com/libsdl-org/SDL/releases/download/release-${{ inputs.SDL2_VERSION }}/SDL2-${{ inputs.SDL2_VERSION }}.tar.gz
|
||||
tar -xzf SDL2-${{ inputs.SDL2_VERSION }}.tar.gz
|
||||
cd SDL2-${{ inputs.SDL2_VERSION }}
|
||||
./configure
|
||||
make -j 10
|
||||
sudo make install
|
||||
sudo cp -av /usr/local/lib/libSDL* /lib/aarch64-linux-gnu/
|
||||
echo ::endgroup::
|
||||
- name: Prepare Build
|
||||
run: |-
|
||||
git clone ${{ secrets.ZRE_REPO_WITH_PAT }}
|
||||
./zre/process.sh
|
||||
cp ./zre/mm_shader_cache.bin ./shadercache/
|
||||
- name: Build N64Recomp & RSPRecomp
|
||||
run: |
|
||||
git clone https://github.com/Mr-Wiseguy/N64Recomp.git --recurse-submodules N64RecompSource
|
||||
cd N64RecompSource
|
||||
git checkout ${{ inputs.N64RECOMP_COMMIT }}
|
||||
git submodule update --init --recursive
|
||||
|
||||
# enable ccache
|
||||
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
|
||||
# Build N64Recomp & RSPRecomp
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER=g++-11 -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_MAKE_PROGRAM=ninja -G Ninja -S . -B cmake-build
|
||||
cmake --build cmake-build --config Release --target N64RecompCLI -j $(nproc)
|
||||
cmake --build cmake-build --config Release --target RSPRecomp -j $(nproc)
|
||||
|
||||
# Copy N64Recomp & RSPRecomp to root directory
|
||||
cp cmake-build/N64Recomp ..
|
||||
cp cmake-build/RSPRecomp ..
|
||||
- name: Run N64Recomp & RSPRecomp
|
||||
run: |
|
||||
./N64Recomp us.rev1.toml
|
||||
./RSPRecomp aspMain.us.rev1.toml
|
||||
./RSPRecomp njpgdspMain.us.rev1.toml
|
||||
- name: Build ZeldaRecomp
|
||||
run: |-
|
||||
# enable ccache
|
||||
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
|
||||
cmake -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER=clang++-15 -DCMAKE_C_COMPILER=clang-15 -DCMAKE_MAKE_PROGRAM=ninja -G Ninja -S . -B cmake-build
|
||||
cmake --build cmake-build --config ${{ matrix.type }} --target Zelda64Recompiled -j $(nproc)
|
||||
- name: Prepare Archive
|
||||
run: |
|
||||
mv cmake-build/Zelda64Recompiled Zelda64Recompiled
|
||||
rm -rf assets/scss
|
||||
tar -czf Zelda64Recompiled.tar.gz Zelda64Recompiled assets/ gamecontrollerdb.txt
|
||||
- name: Archive Zelda64Recomp
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Zelda64Recompiled-${{ runner.os }}-ARM64-${{ matrix.type }}
|
||||
path: Zelda64Recompiled.tar.gz
|
||||
- name: Prepare AppImage
|
||||
run: ./.github/linux/appimage.sh
|
||||
- name: Zelda64Recomp AppImage
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Zelda64Recompiled-AppImage-ARM64-${{ matrix.type }}
|
||||
path: Zelda64Recompiled-*.AppImage
|
||||
build-windows:
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
type: [ Debug, RelWithDebInfo ]
|
||||
name: windows (${{ matrix.type }})
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha || github.ref }}
|
||||
submodules: recursive
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{ runner.os }}-z64re-ccache-${{ matrix.type }}
|
||||
- name: Install Windows Dependencies
|
||||
run: |
|
||||
choco install ninja
|
||||
Remove-Item -Path "C:\ProgramData\Chocolatey\bin\ccache.exe" -Force -ErrorAction SilentlyContinue
|
||||
- name: Download portable LLVM
|
||||
run: |
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
Invoke-WebRequest -Uri "https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.3/LLVM-19.1.3-Windows-X64.tar.xz" -OutFile "LLVM.tar.xz"
|
||||
New-Item -ItemType Directory -Path portable-llvm > $null
|
||||
7z x LLVM.tar.xz
|
||||
7z x LLVM.tar -oportable-llvm
|
||||
- name: Configure Developer Command Prompt
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
- name: Prepare Build
|
||||
run: |-
|
||||
git clone ${{ secrets.ZRE_REPO_WITH_PAT }}
|
||||
./zre/process.ps1
|
||||
cp ./zre/mm_shader_cache.bin ./shadercache/
|
||||
- name: Build N64Recomp & RSPRecomp
|
||||
run: |
|
||||
git clone https://github.com/Mr-Wiseguy/N64Recomp.git --recurse-submodules N64RecompSource
|
||||
cd N64RecompSource
|
||||
git checkout ${{ inputs.N64RECOMP_COMMIT }}
|
||||
git submodule update --init --recursive
|
||||
|
||||
# enable ccache
|
||||
set $env:PATH="$env:USERPROFILE/.cargo/bin;$env:PATH"
|
||||
$cpuCores = (Get-CimInstance -ClassName Win32_Processor).NumberOfLogicalProcessors
|
||||
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_MAKE_PROGRAM=ninja -G Ninja -S . -B cmake-build
|
||||
cmake --build cmake-build --config Release --target N64RecompCLI -j $cpuCores
|
||||
cmake --build cmake-build --config Release --target RSPRecomp -j $cpuCores
|
||||
|
||||
# Copy N64Recomp & RSPRecomp to root directory
|
||||
cp cmake-build/N64Recomp.exe ..
|
||||
cp cmake-build/RSPRecomp.exe ..
|
||||
- name: Run N64Recomp & RSPRecomp
|
||||
run: |
|
||||
./N64Recomp.exe us.rev1.toml
|
||||
./RSPRecomp.exe aspMain.us.rev1.toml
|
||||
./RSPRecomp.exe njpgdspMain.us.rev1.toml
|
||||
- name: Build ZeldaRecomp
|
||||
run: |-
|
||||
# enable ccache
|
||||
set $env:PATH="$env:USERPROFILE/.cargo/bin;$env:PATH"
|
||||
$cpuCores = (Get-CimInstance -ClassName Win32_Processor).NumberOfLogicalProcessors
|
||||
|
||||
# remove LLVM from PATH so it doesn't overshadow the one provided by VS
|
||||
$env:PATH = ($env:PATH -split ';' | Where-Object { $_ -ne 'C:\Program Files\LLVM\bin' }) -join ';'
|
||||
|
||||
cmake -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl -DCMAKE_MAKE_PROGRAM=ninja -DPATCHES_C_COMPILER="..\portable-llvm\LLVM-19.1.3-Windows-X64\bin\clang" -DPATCHES_LD="..\portable-llvm\LLVM-19.1.3-Windows-X64\bin\ld.lld" -G Ninja -S . -B cmake-build -DCMAKE_CXX_FLAGS="-Xclang -fexceptions -Xclang -fcxx-exceptions"
|
||||
cmake --build cmake-build --config ${{ matrix.type }} --target Zelda64Recompiled -j $cpuCores
|
||||
env:
|
||||
SDL2_VERSION: ${{ inputs.SDL2_VERSION }}
|
||||
- name: Prepare Archive
|
||||
run: |
|
||||
Move-Item -Path "cmake-build/Zelda64Recompiled.exe" -Destination "Zelda64Recompiled.exe"
|
||||
Move-Item -Path "cmake-build/dxcompiler.dll" -Destination "dxcompiler.dll"
|
||||
Move-Item -Path "cmake-build/dxil.dll" -Destination "dxil.dll"
|
||||
Move-Item -Path "cmake-build/SDL2.dll" -Destination "SDL2.dll"
|
||||
Move-Item -Path "cmake-build/Zelda64Recompiled.pdb" -Destination "Zelda64Recompiled.pdb"
|
||||
Remove-Item -Path "assets/scss" -Recurse -Force
|
||||
- name: Archive Zelda64Recomp
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Zelda64Recompiled-${{ runner.os }}-${{ matrix.type }}
|
||||
path: |
|
||||
Zelda64Recompiled.exe
|
||||
dxcompiler.dll
|
||||
dxil.dll
|
||||
SDL2.dll
|
||||
assets/
|
||||
gamecontrollerdb.txt
|
||||
- name: Archive Debug Files
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Zelda64Recompiled-PDB-${{ matrix.type }}
|
||||
path: |
|
||||
Zelda64Recompiled.pdb
|
||||
build-macos:
|
||||
runs-on: blaze/macos-14
|
||||
strategy:
|
||||
matrix:
|
||||
type: [ Debug, Release ]
|
||||
name: macos (x64, arm64, ${{ matrix.type }})
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha || github.ref }}
|
||||
submodules: recursive
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{ runner.os }}-z64re-ccache-${{ matrix.type }}
|
||||
- name: Homebrew Setup
|
||||
run: |
|
||||
brew install ninja
|
||||
brew uninstall --ignore-dependencies libpng freetype
|
||||
- name: MacPorts Setup
|
||||
uses: melusina-org/setup-macports@v1
|
||||
id: 'macports'
|
||||
with:
|
||||
parameters: '.github/macos/macports.yaml'
|
||||
- name: Prepare Build
|
||||
run: |-
|
||||
git clone ${{ secrets.ZRE_REPO_WITH_PAT }}
|
||||
./zre/process.sh
|
||||
cp ./zre/mm_shader_cache.bin ./shadercache/
|
||||
- name: Build N64Recomp & RSPRecomp
|
||||
run: |
|
||||
git clone https://github.com/Mr-Wiseguy/N64Recomp.git --recurse-submodules N64RecompSource
|
||||
cd N64RecompSource
|
||||
git checkout ${{ inputs.N64RECOMP_COMMIT }}
|
||||
git submodule update --init --recursive
|
||||
|
||||
# enable ccache
|
||||
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
|
||||
# Build N64Recomp & RSPRecomp
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_MAKE_PROGRAM=ninja -G Ninja -S . -B cmake-build
|
||||
cmake --build cmake-build --config Release --target N64Recomp -j $(sysctl -n hw.ncpu)
|
||||
cmake --build cmake-build --config Release --target RSPRecomp -j $(sysctl -n hw.ncpu)
|
||||
|
||||
# Copy N64Recomp & RSPRecomp to root directory
|
||||
cp cmake-build/N64Recomp ..
|
||||
cp cmake-build/RSPRecomp ..
|
||||
- name: Run N64Recomp & RSPRecomp
|
||||
run: |
|
||||
./N64Recomp us.rev1.toml
|
||||
./RSPRecomp aspMain.us.rev1.toml
|
||||
./RSPRecomp njpgdspMain.us.rev1.toml
|
||||
- name: Build ZeldaRecomp
|
||||
run: |-
|
||||
# enable ccache
|
||||
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||
|
||||
cmake -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_MAKE_PROGRAM=ninja -G Ninja -S . -B cmake-build \
|
||||
-DPATCHES_LD=/opt/local/bin/ld.lld-mp-18 -DCMAKE_AR=/opt/local/bin/llvm-ar-mp-18 -DPATCHES_C_COMPILER=/opt/local/bin/clang-mp-18 \
|
||||
-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"
|
||||
cmake --build cmake-build --config ${{ matrix.type }} --target Zelda64Recompiled -j $(sysctl -n hw.ncpu)
|
||||
- name: Prepare Archive
|
||||
run: |
|
||||
mv cmake-build/Zelda64Recompiled.app Zelda64Recompiled.app
|
||||
zip -r -y Zelda64Recompiled.zip Zelda64Recompiled.app
|
||||
- name: Archive Zelda64Recomp
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Zelda64Recompiled-${{ runner.os }}-${{ matrix.type }}
|
||||
path: Zelda64Recompiled.zip
|
13
.gitignore
vendored
13
.gitignore
vendored
@ -1,6 +1,8 @@
|
||||
# VSCode file settings
|
||||
.vscode/settings.json
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/launch.json
|
||||
.vscode/tasks.json
|
||||
|
||||
# Input elf and rom files
|
||||
*.elf
|
||||
@ -56,3 +58,14 @@ node_modules/
|
||||
|
||||
# Recompiler Linux binary
|
||||
N64Recomp
|
||||
RSPRecomp
|
||||
.DS_Store
|
||||
|
||||
# Controller mappings file
|
||||
gamecontrollerdb.txt
|
||||
|
||||
# Cmake build directory
|
||||
.cache
|
||||
.idea
|
||||
build-*
|
||||
cmake-build-*
|
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -13,3 +13,9 @@
|
||||
[submodule "lib/lunasvg"]
|
||||
path = lib/lunasvg
|
||||
url = https://github.com/sammycage/lunasvg
|
||||
[submodule "lib/N64ModernRuntime"]
|
||||
path = lib/N64ModernRuntime
|
||||
url = https://github.com/N64Recomp/N64ModernRuntime.git
|
||||
[submodule "Zelda64RecompSyms"]
|
||||
path = Zelda64RecompSyms
|
||||
url = https://github.com/Zelda64Recomp/Zelda64RecompSyms
|
||||
|
77
BUILDING.md
Normal file
77
BUILDING.md
Normal file
@ -0,0 +1,77 @@
|
||||
# Building Guide
|
||||
|
||||
This guide will help you build the project on your local machine. The process will require you to provide a decompressed ROM of the US version of the game.
|
||||
|
||||
These steps cover: decompressing the ROM, running the recompiler and finally building the project.
|
||||
|
||||
## 1. Clone the Zelda64Recomp Repository
|
||||
This project makes use of submodules so you will need to clone the repository with the `--recurse-submodules` flag.
|
||||
|
||||
```bash
|
||||
git clone --recurse-submodules
|
||||
# if you forgot to clone with --recurse-submodules
|
||||
# cd /path/to/cloned/repo && git submodule update --init --recursive
|
||||
```
|
||||
|
||||
## 2. Install Dependencies
|
||||
|
||||
### Linux
|
||||
For Linux the instructions for Ubuntu are provided, but you can find the equivalent packages for your preferred distro.
|
||||
|
||||
```bash
|
||||
# For Ubuntu, simply run:
|
||||
sudo apt-get install cmake ninja-build libsdl2-dev libgtk-3-dev lld llvm clang
|
||||
```
|
||||
|
||||
### Windows
|
||||
You will need to install [Visual Studio 2022](https://visualstudio.microsoft.com/downloads/).
|
||||
In the setup process you'll need to select the following options and tools for installation:
|
||||
- Desktop development with C++
|
||||
- C++ Clang Compiler for Windows
|
||||
- C++ CMake tools for Windows
|
||||
|
||||
The other tool necessary will be `make` which can be installe via [Chocolatey](https://chocolatey.org/):
|
||||
```bash
|
||||
choco install make
|
||||
```
|
||||
|
||||
## 3. Decompressing the target ROM
|
||||
You will need to decompress the NTSC-U N64 Majora's Mask ROM (sha1: d6133ace5afaa0882cf214cf88daba39e266c078) before running the recompiler.
|
||||
|
||||
There are a few tools that can do it:
|
||||
* This python script from the Majora's Mask decompilation project: https://github.com/zeldaret/mm/blob/main/tools/decompress_baserom.py
|
||||
* https://github.com/z64tools/z64decompress
|
||||
|
||||
Regardless of which method you use, copy the decompressed ROM to the root of the Zelda64Recomp repository with this filename:
|
||||
- `mm.us.rev1.rom_uncompressed.z64`
|
||||
|
||||
## 4. Generating the C code
|
||||
|
||||
Now that you have the required files, you must build [N64Recomp](https://github.com/Mr-Wiseguy/N64Recomp) and run it to generate the C code to be compiled. The building instructions can be found [here](https://github.com/Mr-Wiseguy/N64Recomp?tab=readme-ov-file#building). That will build the executables: `N64Recomp` and `RSPRecomp` which you should copy to the root of the Zelda64Recomp repository.
|
||||
|
||||
After that, go back to the repository root, and run the following commands:
|
||||
```bash
|
||||
./N64Recomp us.rev1.toml
|
||||
./RSPRecomp aspMain.us.rev1.toml
|
||||
./RSPRecomp njpgdspMain.us.rev1.toml
|
||||
```
|
||||
|
||||
## 5. Building the Project
|
||||
|
||||
Finally, you can build the project! :rocket:
|
||||
|
||||
On Windows, you can open the repository folder with Visual Studio, and you'll be able to `[build / run / debug]` the project from there.
|
||||
|
||||
If you prefer the command line or you're on a Unix platform you can build the project using CMake:
|
||||
|
||||
```bash
|
||||
cmake -S . -B build-cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -G Ninja -DCMAKE_BUILD_TYPE=Release # or Debug if you want to debug
|
||||
cmake --build build-cmake --target Zelda64Recompiled -j$(nproc) --config Release # or Debug
|
||||
```
|
||||
|
||||
## 6. Success
|
||||
|
||||
Voilà! You should now have a `Zelda64Recompiled` executable in the build directory! If you used Visual Studio this will be `out/build/x64-[Configuration]` and if you used the provided CMake commands then this will be `build-cmake`. You will need to run the executable out of the root folder of this project or copy the assets folder to the build folder to run it.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> In the game itself, you should be using a standard ROM, not the decompressed one.
|
213
CMakeLists.txt
213
CMakeLists.txt
@ -1,22 +1,34 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
project(Zelda64Recompiled)
|
||||
|
||||
if (APPLE)
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "Minimum OS X deployment version")
|
||||
endif()
|
||||
|
||||
project(Zelda64Recompiled LANGUAGES C CXX)
|
||||
set(CMAKE_C_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
# set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-everything -Wall -Wextra")
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-everything /W4")
|
||||
endif()
|
||||
|
||||
# Opt out of constexpr mutex constructor on windows to prevent vcredist issues
|
||||
if (WIN32)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR")
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
enable_language(OBJC OBJCXX)
|
||||
endif()
|
||||
|
||||
# Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24:
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
|
||||
cmake_policy(SET CMP0135 NEW)
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(LINUX TRUE)
|
||||
endif()
|
||||
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
|
||||
@ -25,6 +37,7 @@ if (WIN32)
|
||||
endif()
|
||||
|
||||
set(RT64_STATIC TRUE)
|
||||
set(RT64_SDL_WINDOW_VULKAN TRUE)
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/lib/rt64 ${CMAKE_BINARY_DIR}/rt64)
|
||||
|
||||
# set(BUILD_SHARED_LIBS_SAVED "${BUILD_SHARED_LIBS}")
|
||||
@ -33,8 +46,11 @@ SET(LUNASVG_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/lib/lunasvg)
|
||||
# set(BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS_SAVED}")
|
||||
SET(ENABLE_SVG_PLUGIN ON CACHE BOOL "" FORCE)
|
||||
SET(RMLUI_TESTS_ENABLED OFF CACHE BOOL "" FORCE)
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/lib/RmlUi)
|
||||
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/lib/N64ModernRuntime)
|
||||
|
||||
target_include_directories(rt64 PRIVATE ${CMAKE_BINARY_DIR}/rt64/src)
|
||||
|
||||
# RecompiledFuncs - Library containing the primary recompiler output
|
||||
@ -43,10 +59,15 @@ add_library(RecompiledFuncs STATIC)
|
||||
target_compile_options(RecompiledFuncs PRIVATE
|
||||
# -Wno-unused-but-set-variable
|
||||
-fno-strict-aliasing
|
||||
-Wno-unused-variable
|
||||
-Wno-implicit-function-declaration
|
||||
)
|
||||
|
||||
target_include_directories(RecompiledFuncs PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/lib/N64ModernRuntime/ultramodern/include
|
||||
${CMAKE_SOURCE_DIR}/lib/N64ModernRuntime/librecomp/include
|
||||
${CMAKE_SOURCE_DIR}/lib/N64ModernRuntime/N64Recomp/include
|
||||
)
|
||||
|
||||
file(GLOB FUNC_C_SOURCES ${CMAKE_SOURCE_DIR}/RecompiledFuncs/*.c)
|
||||
@ -60,10 +81,15 @@ add_library(PatchesLib STATIC)
|
||||
target_compile_options(PatchesLib PRIVATE
|
||||
# -Wno-unused-but-set-variable
|
||||
-fno-strict-aliasing
|
||||
-Wno-unused-variable
|
||||
-Wno-implicit-function-declaration
|
||||
)
|
||||
|
||||
target_include_directories(PatchesLib PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/lib/N64ModernRuntime/ultramodern/include
|
||||
${CMAKE_SOURCE_DIR}/lib/N64ModernRuntime/librecomp/include
|
||||
${CMAKE_SOURCE_DIR}/lib/N64ModernRuntime/N64Recomp/include
|
||||
)
|
||||
|
||||
target_sources(PatchesLib PRIVATE
|
||||
@ -74,72 +100,59 @@ target_sources(PatchesLib PRIVATE
|
||||
set_source_files_properties(${CMAKE_SOURCE_DIR}/RecompiledPatches/patches.c PROPERTIES COMPILE_FLAGS -fno-strict-aliasing)
|
||||
|
||||
# Build patches elf
|
||||
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/patches/patches.bin
|
||||
COMMAND make
|
||||
if(NOT DEFINED PATCHES_C_COMPILER)
|
||||
set(PATCHES_C_COMPILER clang)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED PATCHES_LD)
|
||||
set(PATCHES_LD ld.lld)
|
||||
endif()
|
||||
|
||||
add_custom_target(PatchesBin
|
||||
COMMAND ${CMAKE_COMMAND} -E env CC=${PATCHES_C_COMPILER} LD=${PATCHES_LD} make
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/patches
|
||||
BYPRODUCTS ${CMAKE_SOURCE_DIR}/patches/patches.bin}
|
||||
BYPRODUCTS ${CMAKE_SOURCE_DIR}/patches/patches.elf
|
||||
)
|
||||
|
||||
# Generate patches_bin.c from patches.bin
|
||||
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/RecompiledPatches/patches_bin.c
|
||||
COMMAND file_to_c ${CMAKE_SOURCE_DIR}/patches/patches.bin mm_patches_bin ${CMAKE_SOURCE_DIR}/RecompiledPatches/patches_bin.c ${CMAKE_SOURCE_DIR}/RecompiledPatches/patches_bin.h
|
||||
COMMAND file_to_c ${CMAKE_SOURCE_DIR}/patches/patches.bin mm_patches_bin ${CMAKE_SOURCE_DIR}/RecompiledPatches/patches_bin.c ${CMAKE_SOURCE_DIR}/RecompiledPatches/patches_bin.h
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/patches/patches.bin
|
||||
)
|
||||
|
||||
# Generate mm_shader_cache.c from the MM shader cache
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mm_shader_cache.c ${CMAKE_CURRENT_BINARY_DIR}/mm_shader_cache.h
|
||||
COMMAND file_to_c ${CMAKE_SOURCE_DIR}/shadercache/mm_shader_cache.bin mm_shader_cache_bytes ${CMAKE_CURRENT_BINARY_DIR}/mm_shader_cache.c ${CMAKE_CURRENT_BINARY_DIR}/mm_shader_cache.h
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/shadercache/mm_shader_cache.bin
|
||||
)
|
||||
|
||||
# Recompile patches elf into patches.c
|
||||
# Recompile patches elf into patches.c and patches.bin
|
||||
add_custom_command(OUTPUT
|
||||
${CMAKE_SOURCE_DIR}/patches/patches.bin
|
||||
${CMAKE_SOURCE_DIR}/RecompiledPatches/patches.c
|
||||
${CMAKE_SOURCE_DIR}/RecompiledPatches/recomp_overlays.inl
|
||||
${CMAKE_SOURCE_DIR}/RecompiledPatches/funcs.h
|
||||
${CMAKE_SOURCE_DIR}/src/recomp/patch_loading.cpp
|
||||
COMMAND ./N64Recomp patches.toml && ${CMAKE_COMMAND} -E touch ${CMAKE_SOURCE_DIR}/src/recomp/patch_loading.cpp
|
||||
# TODO: Look into why modifying patches requires two builds to take
|
||||
COMMAND ./N64Recomp patches.toml
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/patches/patches.bin
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/patches/patches.elf
|
||||
)
|
||||
|
||||
# Download controller db file for controller support via SDL2
|
||||
set(GAMECONTROLLERDB_COMMIT "b1e4090b3d4266e55feb0793efa35792e05faf66")
|
||||
set(GAMECONTROLLERDB_URL "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/${GAMECONTROLLERDB_COMMIT}/gamecontrollerdb.txt")
|
||||
|
||||
file(DOWNLOAD ${GAMECONTROLLERDB_URL} ${CMAKE_SOURCE_DIR}/gamecontrollerdb.txt
|
||||
TLS_VERIFY ON)
|
||||
|
||||
add_custom_target(DownloadGameControllerDB
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/gamecontrollerdb.txt)
|
||||
|
||||
# Main executable
|
||||
add_executable(Zelda64Recompiled)
|
||||
add_dependencies(Zelda64Recompiled DownloadGameControllerDB)
|
||||
|
||||
set (SOURCES
|
||||
${CMAKE_SOURCE_DIR}/ultramodern/audio.cpp
|
||||
${CMAKE_SOURCE_DIR}/ultramodern/events.cpp
|
||||
${CMAKE_SOURCE_DIR}/ultramodern/mesgqueue.cpp
|
||||
${CMAKE_SOURCE_DIR}/ultramodern/misc_ultra.cpp
|
||||
${CMAKE_SOURCE_DIR}/ultramodern/port_main.c
|
||||
${CMAKE_SOURCE_DIR}/ultramodern/scheduling.cpp
|
||||
${CMAKE_SOURCE_DIR}/ultramodern/threadqueue.cpp
|
||||
${CMAKE_SOURCE_DIR}/ultramodern/task_win32.cpp
|
||||
${CMAKE_SOURCE_DIR}/ultramodern/threads.cpp
|
||||
${CMAKE_SOURCE_DIR}/ultramodern/timer.cpp
|
||||
${CMAKE_SOURCE_DIR}/ultramodern/ultrainit.cpp
|
||||
${CMAKE_SOURCE_DIR}/ultramodern/rt64_layer.cpp
|
||||
|
||||
${CMAKE_SOURCE_DIR}/src/recomp/ai.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/recomp/cont.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/recomp/dp.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/recomp/eep.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/recomp/euc-jp.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/recomp/flash.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/recomp/math_routines.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/recomp/overlays.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/recomp/patch_loading.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/recomp/pak.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/recomp/pi.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/recomp/ultra_stubs.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/recomp/ultra_translation.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/recomp/print.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/recomp/recomp.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/recomp/sp.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/recomp/vi.cpp
|
||||
|
||||
${CMAKE_SOURCE_DIR}/src/main/main.cpp
|
||||
|
||||
${CMAKE_SOURCE_DIR}/src/main/support.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/main/register_overlays.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/main/register_patches.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/main/rt64_render_context.cpp
|
||||
|
||||
${CMAKE_SOURCE_DIR}/src/game/input.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/game/controls.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/game/config.cpp
|
||||
@ -147,6 +160,7 @@ set (SOURCES
|
||||
${CMAKE_SOURCE_DIR}/src/game/debug.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/game/quicksaving.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/game/recomp_api.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/game/rom_decompression.cpp
|
||||
|
||||
${CMAKE_SOURCE_DIR}/src/ui/ui_renderer.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/ui/ui_launcher.cpp
|
||||
@ -158,12 +172,15 @@ set (SOURCES
|
||||
${CMAKE_SOURCE_DIR}/rsp/njpgdspMain.cpp
|
||||
|
||||
${CMAKE_SOURCE_DIR}/lib/RmlUi/Backends/RmlUi_Platform_SDL.cpp
|
||||
|
||||
${CMAKE_CURRENT_BINARY_DIR}/mm_shader_cache.c
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
list(APPEND SOURCES ${CMAKE_SOURCE_DIR}/src/main/support_apple.mm)
|
||||
endif()
|
||||
|
||||
target_include_directories(Zelda64Recompiled PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/lib/N64ModernRuntime/N64Recomp/include
|
||||
${CMAKE_SOURCE_DIR}/lib/concurrentqueue
|
||||
${CMAKE_SOURCE_DIR}/lib/GamepadMotionHelpers
|
||||
${CMAKE_SOURCE_DIR}/lib/RmlUi/Include
|
||||
@ -180,19 +197,43 @@ target_include_directories(Zelda64Recompiled PRIVATE
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
target_compile_options(Zelda64Recompiled PRIVATE
|
||||
-march=nehalem
|
||||
-fno-strict-aliasing
|
||||
-fms-extensions
|
||||
)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64")
|
||||
target_compile_options(Zelda64Recompiled PRIVATE
|
||||
-march=nehalem
|
||||
-fno-strict-aliasing
|
||||
-fms-extensions
|
||||
)
|
||||
else()
|
||||
target_compile_options(Zelda64Recompiled PRIVATE
|
||||
-fno-strict-aliasing
|
||||
-fms-extensions
|
||||
)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
# Disable identical code folding, since this breaks mod function patching as multiple functions can get merged into one.
|
||||
target_link_options(Zelda64Recompiled PRIVATE /OPT:NOICF)
|
||||
elseif (APPLE)
|
||||
# Use a wrapper around ld64 that respects segprot's `max_prot` value in order
|
||||
# to make our executable memory writable (required for mod function patching)
|
||||
target_link_options(Zelda64Recompiled PRIVATE
|
||||
"-fuse-ld=${CMAKE_SOURCE_DIR}/.github/macos/ld64"
|
||||
)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
include(FetchContent)
|
||||
|
||||
if (DEFINED ENV{SDL2_VERSION})
|
||||
set(SDL2_VERSION $ENV{SDL2_VERSION})
|
||||
else()
|
||||
set(SDL2_VERSION "2.30.3")
|
||||
endif()
|
||||
|
||||
# Fetch SDL2 on windows
|
||||
FetchContent_Declare(
|
||||
sdl2
|
||||
URL https://github.com/libsdl-org/SDL/releases/download/release-2.28.5/SDL2-devel-2.28.5-VC.zip
|
||||
URL_HASH MD5=d8173db078e54040c666f411c5a6afff
|
||||
URL https://github.com/libsdl-org/SDL/releases/download/release-${SDL2_VERSION}/SDL2-devel-${SDL2_VERSION}-VC.zip
|
||||
)
|
||||
FetchContent_MakeAvailable(sdl2)
|
||||
target_include_directories(Zelda64Recompiled PRIVATE
|
||||
@ -209,7 +250,7 @@ if (WIN32)
|
||||
"${CMAKE_SOURCE_DIR}/lib/rt64/src/contrib/dxc/bin/x64/dxil.dll"
|
||||
"${CMAKE_SOURCE_DIR}/lib/rt64/src/contrib/dxc/bin/x64/dxcompiler.dll"
|
||||
$<TARGET_FILE_DIR:Zelda64Recompiled>)
|
||||
|
||||
|
||||
set_target_properties(
|
||||
Zelda64Recompiled
|
||||
PROPERTIES
|
||||
@ -220,15 +261,31 @@ if (WIN32)
|
||||
)
|
||||
|
||||
target_sources(Zelda64Recompiled PRIVATE ${CMAKE_SOURCE_DIR}/icons/app.rc)
|
||||
target_link_libraries(Zelda64Recompiled PRIVATE SDL2)
|
||||
endif()
|
||||
|
||||
if (LINUX)
|
||||
if (APPLE)
|
||||
find_package(SDL2 REQUIRED)
|
||||
target_include_directories(Zelda64Recompiled PRIVATE ${SDL2_INCLUDE_DIRS})
|
||||
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
target_link_libraries(Zelda64Recompiled PRIVATE ${CMAKE_DL_LIBS} Threads::Threads SDL2::SDL2)
|
||||
|
||||
include(${CMAKE_SOURCE_DIR}/.github/macos/apple_bundle.cmake)
|
||||
endif()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
find_package(SDL2 REQUIRED)
|
||||
find_package(X11 REQUIRED)
|
||||
|
||||
|
||||
add_compile_definitions("RT64_SDL_WINDOW_VULKAN")
|
||||
|
||||
# Generate icon_bytes.c from the app icon PNG.
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/icon_bytes.c ${CMAKE_CURRENT_BINARY_DIR}/icon_bytes.h
|
||||
COMMAND file_to_c ${CMAKE_SOURCE_DIR}/icons/512.png icon_bytes ${CMAKE_CURRENT_BINARY_DIR}/icon_bytes.c ${CMAKE_CURRENT_BINARY_DIR}/icon_bytes.h
|
||||
COMMAND file_to_c ${CMAKE_SOURCE_DIR}/icons/512.png icon_bytes ${CMAKE_CURRENT_BINARY_DIR}/icon_bytes.c ${CMAKE_CURRENT_BINARY_DIR}/icon_bytes.h
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/icons/512.png
|
||||
)
|
||||
target_sources(Zelda64Recompiled PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/icon_bytes.c)
|
||||
@ -253,19 +310,20 @@ if (LINUX)
|
||||
message(STATUS "FREETYPE_LIBRARIES = ${FREETYPE_LIBRARIES}")
|
||||
|
||||
include_directories(${FREETYPE_LIBRARIES})
|
||||
target_link_libraries(Zelda64Recompiled PRIVATE ${FREETYPE_LIBRARIES})
|
||||
target_link_libraries(Zelda64Recompiled PRIVATE ${FREETYPE_LIBRARIES} SDL2::SDL2)
|
||||
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
|
||||
target_link_libraries(Zelda64Recompiled PRIVATE "-latomic -static-libstdc++" ${CMAKE_DL_LIBS} Threads::Threads)
|
||||
endif()
|
||||
|
||||
target_link_libraries(Zelda64Recompiled PRIVATE
|
||||
PatchesLib
|
||||
RecompiledFuncs
|
||||
SDL2
|
||||
librecomp
|
||||
ultramodern
|
||||
rt64
|
||||
RmlCore
|
||||
RmlDebugger
|
||||
@ -288,13 +346,26 @@ if (${WIN32})
|
||||
set (DXC "${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/bin/x64/dxc.exe")
|
||||
add_compile_definitions(NOMINMAX)
|
||||
else()
|
||||
set (DXC "LD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/lib/x64" "${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/bin/x64/dxc")
|
||||
if (APPLE)
|
||||
# Apple's binary is universal, so it'll work on both x86_64 and arm64
|
||||
set (DXC "DYLD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/lib/arm64" "${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/bin/arm64/dxc-macos")
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64")
|
||||
set(SPIRVCROSS "DYLD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/spirv-cross/lib/x64" "${PROJECT_SOURCE_DIR}/lib/rt64//src/contrib/spirv-cross/bin/x64/spirv-cross")
|
||||
else()
|
||||
set(SPIRVCROSS "DYLD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/spirv-cross/lib/arm64" "${PROJECT_SOURCE_DIR}/lib/rt64//src/contrib/spirv-cross/bin/x64/spirv-cross")
|
||||
endif()
|
||||
else()
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64")
|
||||
set (DXC "LD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/lib/x64" "${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/bin/x64/dxc-linux")
|
||||
else()
|
||||
set (DXC "LD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/lib/arm64" "${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/bin/arm64/dxc-linux")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
build_vertex_shader(Zelda64Recompiled "shaders/InterfaceVS.hlsl" "shaders/InterfaceVS.hlsl")
|
||||
build_pixel_shader (Zelda64Recompiled "shaders/InterfacePS.hlsl" "shaders/InterfacePS.hlsl")
|
||||
build_pixel_shader(Zelda64Recompiled "shaders/InterfacePS.hlsl" "shaders/InterfacePS.hlsl")
|
||||
|
||||
target_sources(Zelda64Recompiled PRIVATE ${SOURCES})
|
||||
|
||||
set_property(TARGET Zelda64Recompiled PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
|
||||
|
||||
|
674
COPYING
Normal file
674
COPYING
Normal file
@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
150
README.md
Normal file
150
README.md
Normal file
@ -0,0 +1,150 @@
|
||||
# Zelda 64: Recompiled
|
||||
Zelda 64: Recompiled is a project that uses [N64: Recompiled](https://github.com/Mr-Wiseguy/N64Recomp) to **statically recompile** Majora's Mask (and soon Ocarina of Time) into a native port with many new features and enhancements. This project uses [RT64](https://github.com/rt64/rt64) as the rendering engine to provide some of these enhancements.
|
||||
|
||||
### [Check out the latest release here](https://github.com/Mr-Wiseguy/Zelda64Recomp/releases/latest).
|
||||
|
||||
### **This repository and its releases do not contain game assets. The original game is required to build or run this project.**
|
||||
|
||||
<div align="left" valign="middle">
|
||||
<a href="https://runblaze.dev">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://www.runblaze.dev/logo_dark.png">
|
||||
<img align="right" src="https://www.runblaze.dev/logo_light.png" height="102px"/>
|
||||
</picture>
|
||||
</a>
|
||||
|
||||
<br style="display: none;"/>
|
||||
|
||||
_Special thanks to [Blaze](https://runblaze.dev) for their support of this project. They provide high-performance Linux (AMD64 & ARM64) and Apple Silicon macOS runners for GitHub Actions, greatly reducing our automated build times._
|
||||
|
||||
</div>
|
||||
|
||||
## Table of Contents
|
||||
* [System Requirements](#system-requirements)
|
||||
* [Features](#features)
|
||||
* [Plug and Play](#plug-and-play)
|
||||
* [Fully Intact N64 Effects](#fully-intact-n64-effects)
|
||||
* [Easy-to-Use Menus](#easy-to-use-menus)
|
||||
* [High Framerate Support](#high-framerate-support)
|
||||
* [Widescreen and Ultrawide Support](#widescreen-and-ultrawide-support)
|
||||
* [Dual Analog Camera](#dual-analog-camera)
|
||||
* [Gyro Aim](#gyro-aim)
|
||||
* [Additional Control Options](#additional-control-options)
|
||||
* [Autosaving](#autosaving)
|
||||
* [Low Input Lag](#low-input-lag)
|
||||
* [Instant Load Times](#instant-load-times)
|
||||
* [Linux and Steam Deck Support](#linux-and-steam-deck-support)
|
||||
* [Planned Features](#planned-features)
|
||||
* [FAQ](#faq)
|
||||
* [Known Issues](#known-issues)
|
||||
* [Building](#building)
|
||||
* [Libraries Used and Projects Referenced](#libraries-used-and-projects-referenced)
|
||||
|
||||
## System Requirements
|
||||
A GPU supporting Direct3D 12.0 (Shader Model 6) or Vulkan 1.2 is required to run this project. The oldest GPUs that should be supported for each vendor are:
|
||||
* GeForce GT 630
|
||||
* Radeon HD 7750 (the one from 2012, not to be confused with the RX 7000 series) and newer
|
||||
* Intel HD 510 (Skylake)
|
||||
|
||||
A CPU supporting the AVX instruction set is also required (Intel Core 2000 series or AMD Bulldozer and newer).
|
||||
|
||||
If you have issues with crashes on startup, make sure your graphics drivers are fully up to date.
|
||||
|
||||
## Features
|
||||
|
||||
#### Plug and Play
|
||||
Simply provide your copy of the North American version of the game in the main menu and start playing! This project will automatically load assets from the provided copy, so there is no need to go through a separate extraction step or build the game yourself. Other versions of the game may be supported in the future.
|
||||
|
||||
#### Fully Intact N64 Effects
|
||||
A lot of care was put into RT64 to make sure all graphical effects were rendered exactly as they did originally on the N64. No workarounds or "hacks" were made to replicate these effects, with the only modifications to them being made for enhancement purposes such as widescreen support. This includes framebuffer effects like the grayscale cutscenes and the Deku bubble projectile, depth effects like the lens of truth, decals such as shadows or impact textures, accurate lighting, shading effects like the fire arrows and bomb explosions, and various textures that are often rendered incorrectly.
|
||||
|
||||
#### Easy-to-Use Menus
|
||||
Gameplay settings, graphics settings, input mappings, and audio settings can all be configured with the in-game config menu. The menus can all be used with mouse, controller, or keyboard for maximum convenience.
|
||||
|
||||
#### High Framerate Support
|
||||
Play at any framerate you want thanks to functionality provided by RT64! Game objects and terrain, texture scrolling, screen effects, and most HUD elements are all rendered at high framerates. By default, this project is configured to run at your monitor's refresh rate. You can also play at the original framerate of the game if you prefer. **Changing framerate has no effect on gameplay.**
|
||||
|
||||
**Note**: External framerate limiters (such as the NVIDIA Control Panel) are known to potentially cause problems, so if you notice any stuttering then turn them off and use the manual framerate slider in the in-game graphics menu instead.
|
||||
|
||||
#### Widescreen and Ultrawide Support
|
||||
Any aspect ratio is supported, with most effects modded to work correctly in widescreen. The HUD can also be positioned at 16:9 when using ultrawide aspect ratios if preferred.
|
||||
|
||||
**Note**: Some animation quirks can be seen at the edges of the screen in certain cutscenes when using very wide aspect ratios.
|
||||
|
||||
#### Dual Analog Camera
|
||||
Play with a dual analog control layout like later entries in the series! When this option is enabled, the right stick will control the camera. You can still have the C-Buttons mapped to the right stick if you so wish, so long as you also map them to other buttons on the controller. The right stick C-button inputs will be "silenced", except when you take out the ocarina, so you can still play the ocarina with the right stick.
|
||||
|
||||
#### Gyro Aim
|
||||
When playing with a supported controller, first-person items such as the bow can be aimed with your controller's gyro sensor. This includes (but is not limited to) controllers such as the Dualshock 4, Dualsense, Switch Pro, and most third party Switch controllers (such as the 8BitDo Pro 2 in Switch mode).
|
||||
|
||||
**Note**: Gamepad mappers such as BetterJoy or DS4Windows may intercept gyro data and prevent the game from receiving it. Most controllers are natively supported, so turning gamepad mappers off is recommended if you want to use gyro.
|
||||
|
||||
#### Additional Control Options
|
||||
Customize your experience by setting your stick deadzone to your liking, as well as adjusting the X and Y axis inversion for both aiming and the optional dual analog camera.
|
||||
|
||||
#### Autosaving
|
||||
Never worry about losing progress if your power goes out thanks to autosaving! The autosave system is designed to respect Majora's Mask's original save system and maintain the intention of owl saves by triggering automatically and replacing the previous autosave or owl save. However, if you'd still rather play with the untouched save system, simply turn off autosaving in the ingame menu.
|
||||
|
||||
#### Low Input Lag
|
||||
This project has been optimized to have as little input lag as possible, making the game feel more responsive than ever!
|
||||
|
||||
#### Instant Load Times
|
||||
Saving and loading files, going from place to place, and pausing all happen in the blink of an eye thanks to the game running natively on modern hardware.
|
||||
|
||||
#### Linux and Steam Deck Support
|
||||
A Linux binary is available for playing on most up-to-date distros, including on the Steam Deck.
|
||||
|
||||
To play on Steam Deck, extract the Linux build onto your deck. Then, in desktop mode, right click the Zelda64Recompiled executable file and select "Add to Steam". From there, you can return to Gaming mode and configure the controls as needed. See the [Steam Deck gyro aim FAQ section](#how-do-i-set-up-gyro-aiming-on-steam-deck) for more detailed instructions.
|
||||
|
||||
## Planned Features
|
||||
* Ocarina of Time support
|
||||
* Mod support and Randomizer
|
||||
* Texture Packs
|
||||
* Model Replacements
|
||||
* Ray Tracing (via RT64)
|
||||
* Multi-language support with support for loading custom translations
|
||||
|
||||
## FAQ
|
||||
|
||||
#### What is static recompilation?
|
||||
Static recompilation is the process of automatically translating an application from one platform to another. For more details, check out the full description of how this project's recompilation works here: [N64: Recompiled](https://github.com/Mr-Wiseguy/N64Recomp).
|
||||
|
||||
#### How is this related to the decompilation project?
|
||||
Unlike N64 ports in the past, this project is not based on the source code provided by a decompilation of the game. This is because static recompilation bypasses the need for decompiled source code when making a port, allowing ports to be made **without source code**. However, the reverse engineering work done by the decompilation team was invaluable for providing some of the enhancements featured in this project. For this reason, the project uses headers and some functions from the decompilation project in order to make modifications to the game. Many thanks to the decompilation team for all of the hard work they've done.
|
||||
|
||||
#### How do I set up gyro aiming on Steam Deck?
|
||||
This project provides mouse aiming as a way to allow using gyro on Steam Deck, as the Steam Deck's gyro sensors cannot be read directly. First, launch the game in Gaming Mode, press the Steam button and go to "Controller Settings". Choose "Controller Settings" again in the menu that follows, and then set "Gyro Behavior" to "As Mouse".
|
||||
|
||||

|
||||
|
||||
You'll probably also want to change the default behavior so that you don't need to be touching the right stick to allow gyro input. To do so, click on the Gear icon to the right of "Gyro Behavior" and ensure that "Gyro Activation Buttons" is set to "None Selected (Gyro Always On)." If this isn't the case, then select that option and then press "Select None" in the following menu.
|
||||
|
||||
#### Where is the savefile stored?
|
||||
- Windows: `%LOCALAPPDATA%\Zelda64Recompiled\saves`
|
||||
- Linux: `~/.config/Zelda64Recompiled/saves`
|
||||
- macOS: `~/Library/Application Support/Zelda64Recompiled/saves`
|
||||
|
||||
#### How do I choose a different ROM?
|
||||
**You don't.** This project is **only** a port of Majora's Mask (and Ocarina of Time in the future), and it will only accept one specific ROM: the US version of the N64 release of Majora's Mask. ROMs in formats other than .z64 will be automatically converted, as long as it is the correct ROM. **It is not an emulator and it cannot run any arbitrary ROM.**
|
||||
|
||||
If you want to play a modded ROM or in another language, note that support for modding and other languages will be added to the project itself in the future and will not rely on you supplying a different ROM.
|
||||
|
||||
## Known Issues
|
||||
* Intel GPUs on Linux may not currently work. If you have experience with Vulkan development on Linux, help here would be greatly appreciated!
|
||||
* The prebuilt Linux binary may not work correctly on some distributions of Linux. If you encounter such an issue, building the project locally yourself is recommended. A Flatpak or AppImage may be provided in the future to solve this issue. Adding the Linux version to Steam and setting "Steam Linux Runtime" as the compatibility tool or launching it via Gamescope may work around the issue. Alternatively, running the Windows version with Proton is known to work well and may also work around this issue.
|
||||
* Overlays such as MSI Afterburner and other software such as Wallpaper Engine can cause performance issues with this project that prevent the game from rendering correctly. Disabling such software is recommended.
|
||||
|
||||
## Building
|
||||
Building is not required to play this project, as prebuilt binaries (which do not contain game assets) can be found in the [Releases](https://github.com/Mr-Wiseguy/Zelda64Recomp/releases) section. Instructions on how to build this project can be found in the [BUILDING.md](BUILDING.md) file.
|
||||
|
||||
## Libraries Used and Projects Referenced
|
||||
* [RT64](https://github.com/rt64/rt64) for the project's rendering engine
|
||||
* [RmlUi](https://github.com/mikke89/RmlUi) for building the menus and launcher
|
||||
* [lunasvg](https://github.com/sammycage/lunasvg) for SVG rendering, used by RmlUi
|
||||
* [FreeType](https://freetype.org/) for font rendering, used by RmlUi
|
||||
* [moodycamel::ConcurrentQueue](https://github.com/cameron314/concurrentqueue) for semaphores and fast, lock-free MPMC queues
|
||||
* [Gamepad Motion Helpers](https://github.com/JibbSmart/GamepadMotionHelpers) for sensor fusion and calibration algorithms to implement gyro aiming
|
||||
* [Majora's Mask Decompilation](https://github.com/zeldaret/mm) for headers and some function definitions, used for making patches or some enhancements
|
||||
* [Ares emulator](https://github.com/ares-emulator/ares) for RSP vector instruction reference implementations, used in RSP recompilation
|
||||
|
||||
Special thanks to [thecozies](https://github.com/thecozies) for designing and helping implement the launcher and config menus!
|
1
Zelda64RecompSyms
Submodule
1
Zelda64RecompSyms
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit a325f8fa5c48c925616bd43685ef14bbabc29537
|
11
aspMain.us.rev1.toml
Normal file
11
aspMain.us.rev1.toml
Normal file
@ -0,0 +1,11 @@
|
||||
text_offset = 0xC40FF0
|
||||
text_size = 0x1000
|
||||
text_address = 0x04001000
|
||||
rom_file_path = "mm.us.rev1.rom_uncompressed.z64"
|
||||
output_file_path = "rsp/aspMain.cpp"
|
||||
output_function_name = "aspMain"
|
||||
extra_indirect_branch_targets = [
|
||||
0x1F80, 0x1250, 0x1154, 0x1094, 0x1E0C, 0x1514, 0x1E7C, 0x1C90,
|
||||
0x1180, 0x1808, 0x11E8, 0x1ADC, 0x1B6C, 0x1194, 0x1EF8, 0x1240,
|
||||
0x17C0, 0x186C, 0x1A58, 0x18BC, 0x1ABC, 0x1ACC, 0x1A80, 0x1BD4
|
||||
]
|
@ -41,6 +41,7 @@
|
||||
data-for="input_bindings, i : inputs.array"
|
||||
data-event-mouseover="set_input_row_focus(i)"
|
||||
data-class-control-option--active="get_input_enum_name(i)==cur_input_row"
|
||||
data-if="!input_device_is_keyboard || (get_input_enum_name(i) != 'TOGGLE_MENU' && get_input_enum_name(i) != 'ACCEPT_MENU' && get_input_enum_name(i) != 'APPLY_MENU')"
|
||||
>
|
||||
<label
|
||||
class="control-option__label"
|
||||
@ -66,6 +67,7 @@
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
data-if="get_input_enum_name(i) != 'TOGGLE_MENU' && get_input_enum_name(i) != 'ACCEPT_MENU'"
|
||||
data-event-blur="set_input_row_focus(-1)"
|
||||
data-event-focus="set_input_row_focus(i)"
|
||||
data-event-click="clear_input_bindings(i)"
|
||||
@ -74,6 +76,16 @@
|
||||
>
|
||||
<svg src="icons/Trash.svg" />
|
||||
</button>
|
||||
<button
|
||||
data-if="get_input_enum_name(i) == 'TOGGLE_MENU' || get_input_enum_name(i) == 'ACCEPT_MENU'"
|
||||
data-event-blur="set_input_row_focus(-1)"
|
||||
data-event-focus="set_input_row_focus(i)"
|
||||
data-event-click="reset_single_input_binding_to_default(i)"
|
||||
class="icon-button icon-button--danger"
|
||||
data-attr-style="i == 0 ? 'nav-up:#cont_kb_toggle' : 'nav-up:auto'"
|
||||
>
|
||||
<svg src="icons/Reset.svg" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -92,36 +92,223 @@
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- joystick deadzone -->
|
||||
<div class="config-option" data-event-mouseover="set_cur_config_index(4)">
|
||||
<label class="config-option__title">Joystick Deadzone</label>
|
||||
<div class="config-option__range-wrapper config-option__list">
|
||||
<label class="config-option__range-label">{{joystick_deadzone}}%</label>
|
||||
<input
|
||||
class="nav-vert"
|
||||
data-event-blur="set_cur_config_index(-1)"
|
||||
data-event-focus="set_cur_config_index(4)"
|
||||
id="joystick_deadzone_input"
|
||||
type="range"
|
||||
min="0"
|
||||
max="100"
|
||||
style="flex: 1; margin: 0dp; nav-down: #bg_input_enabled"
|
||||
data-value="joystick_deadzone"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- targeting mode -->
|
||||
<div class="config-option" data-event-mouseover="set_cur_config_index(4)" id="conf-general__Background-Input">
|
||||
<!-- background input -->
|
||||
<div class="config-option" data-event-mouseover="set_cur_config_index(5)" id="conf-general__Background-Input">
|
||||
<label class="config-option__title">Background Input</label>
|
||||
<div class="config-option__list">
|
||||
<input
|
||||
type="radio"
|
||||
data-event-blur="set_cur_config_index(-1)"
|
||||
data-event-focus="set_cur_config_index(4)"
|
||||
data-event-focus="set_cur_config_index(5)"
|
||||
name="background_input_mode"
|
||||
data-checked="background_input_mode"
|
||||
value="On"
|
||||
id="bg_input_enabled"
|
||||
style="nav-up: #mouse_sensitivity_input"
|
||||
style="nav-up: #joystick_deadzone_input; nav-down: #autosave_enabled"
|
||||
/>
|
||||
<label class="config-option__tab-label" for="bg_input_enabled">On</label>
|
||||
|
||||
<input
|
||||
type="radio"
|
||||
data-event-blur="set_cur_config_index(-1)"
|
||||
data-event-focus="set_cur_config_index(4)"
|
||||
data-event-focus="set_cur_config_index(5)"
|
||||
name="background_input_mode"
|
||||
data-checked="background_input_mode"
|
||||
value="Off"
|
||||
id="bg_input_disabled"
|
||||
style="nav-up: #mouse_sensitivity_input"
|
||||
style="nav-up: #joystick_deadzone_input; nav-down: #autosave_disabled"
|
||||
/>
|
||||
<label class="config-option__tab-label" for="bg_input_disabled">Off</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- autosave -->
|
||||
<div class="config-option" data-event-mouseover="set_cur_config_index(6)">
|
||||
<label class="config-option__title">Autosaving</label>
|
||||
<div class="config-option__list">
|
||||
<input
|
||||
type="radio"
|
||||
data-event-blur="set_cur_config_index(-1)"
|
||||
data-event-focus="set_cur_config_index(6)"
|
||||
name="autosave_mode"
|
||||
data-checked="autosave_mode"
|
||||
value="On"
|
||||
id="autosave_enabled"
|
||||
style="nav-up: #bg_input_enabled; nav-down: #camera_inversion_none"
|
||||
/>
|
||||
<label class="config-option__tab-label" for="autosave_enabled">On</label>
|
||||
|
||||
<input
|
||||
type="radio"
|
||||
data-event-blur="set_cur_config_index(-1)"
|
||||
data-event-focus="set_cur_config_index(6)"
|
||||
name="autosave_mode"
|
||||
data-checked="autosave_mode"
|
||||
value="Off"
|
||||
id="autosave_disabled"
|
||||
style="nav-up: #bg_input_disabled; nav-down: #camera_inversion_x"
|
||||
/>
|
||||
<label class="config-option__tab-label" for="autosave_disabled">Off</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- camera inversion -->
|
||||
<div class="config-option" data-event-mouseover="set_cur_config_index(7)">
|
||||
<label class="config-option__title">Aiming Camera Mode</label>
|
||||
<div class="config-option__list">
|
||||
<input
|
||||
type="radio"
|
||||
data-event-blur="set_cur_config_index(-1)"
|
||||
data-event-focus="set_cur_config_index(7)"
|
||||
name="camera_invert_mode"
|
||||
data-checked="camera_invert_mode"
|
||||
value="InvertNone"
|
||||
id="camera_inversion_none"
|
||||
style="nav-up: #autosave_enabled; nav-down: #analog_cam_enabled"
|
||||
/>
|
||||
<label class="config-option__tab-label" for="camera_inversion_none">None</label>
|
||||
|
||||
<input
|
||||
type="radio"
|
||||
data-event-blur="set_cur_config_index(-1)"
|
||||
data-event-focus="set_cur_config_index(7)"
|
||||
name="camera_invert_mode"
|
||||
data-checked="camera_invert_mode"
|
||||
value="InvertX"
|
||||
id="camera_inversion_x"
|
||||
style="nav-up: #autosave_disabled; nav-down: #analog_cam_disabled"
|
||||
/>
|
||||
<label class="config-option__tab-label" for="camera_inversion_x">Invert X</label>
|
||||
|
||||
<input
|
||||
type="radio"
|
||||
data-event-blur="set_cur_config_index(-1)"
|
||||
data-event-focus="set_cur_config_index(7)"
|
||||
name="camera_invert_mode"
|
||||
data-checked="camera_invert_mode"
|
||||
value="InvertY"
|
||||
id="camera_inversion_y"
|
||||
style="nav-up: #autosave_disabled; nav-down: #analog_cam_disabled"
|
||||
/>
|
||||
<label class="config-option__tab-label" for="camera_inversion_y">Invert Y</label>
|
||||
|
||||
<input
|
||||
type="radio"
|
||||
data-event-blur="set_cur_config_index(-1)"
|
||||
data-event-focus="set_cur_config_index(7)"
|
||||
name="camera_invert_mode"
|
||||
data-checked="camera_invert_mode"
|
||||
value="InvertBoth"
|
||||
id="camera_inversion_both"
|
||||
style="nav-up: #autosave_disabled; nav-down: #analog_cam_disabled"
|
||||
/>
|
||||
<label class="config-option__tab-label" for="camera_inversion_both">Invert Both</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- analog camera -->
|
||||
<div class="config-option" data-event-mouseover="set_cur_config_index(8)">
|
||||
<label class="config-option__title">Analog Camera</label>
|
||||
<div class="config-option__list">
|
||||
<input
|
||||
type="radio"
|
||||
data-event-blur="set_cur_config_index(-1)"
|
||||
data-event-focus="set_cur_config_index(8)"
|
||||
name="analog_cam_mode"
|
||||
data-checked="analog_cam_mode"
|
||||
value="On"
|
||||
id="analog_cam_enabled"
|
||||
style="nav-up: #camera_inversion_none; nav-down: #analog_camera_inversion_none"
|
||||
/>
|
||||
<label class="config-option__tab-label" for="analog_cam_enabled">On</label>
|
||||
|
||||
<input
|
||||
type="radio"
|
||||
data-event-blur="set_cur_config_index(-1)"
|
||||
data-event-focus="set_cur_config_index(8)"
|
||||
name="analog_cam_mode"
|
||||
data-checked="analog_cam_mode"
|
||||
value="Off"
|
||||
id="analog_cam_disabled"
|
||||
style="nav-up: #camera_inversion_x; nav-down: #analog_camera_inversion_x"
|
||||
/>
|
||||
<label class="config-option__tab-label" for="analog_cam_disabled">Off</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- analog camera inversion -->
|
||||
<div class="config-option" data-event-mouseover="set_cur_config_index(9)">
|
||||
<label class="config-option__title">Analog Camera Mode</label>
|
||||
<div class="config-option__list">
|
||||
<input
|
||||
type="radio"
|
||||
data-event-blur="set_cur_config_index(-1)"
|
||||
data-event-focus="set_cur_config_index(9)"
|
||||
name="analog_camera_invert_mode"
|
||||
data-checked="analog_camera_invert_mode"
|
||||
value="InvertNone"
|
||||
id="analog_camera_inversion_none"
|
||||
style="nav-up: #analog_cam_enabled;"
|
||||
/>
|
||||
<label class="config-option__tab-label" for="analog_camera_inversion_none">None</label>
|
||||
|
||||
<input
|
||||
type="radio"
|
||||
data-event-blur="set_cur_config_index(-1)"
|
||||
data-event-focus="set_cur_config_index(9)"
|
||||
name="analog_camera_invert_mode"
|
||||
data-checked="analog_camera_invert_mode"
|
||||
value="InvertX"
|
||||
id="analog_camera_inversion_x"
|
||||
style="nav-up: #analog_cam_disabled;"
|
||||
/>
|
||||
<label class="config-option__tab-label" for="analog_camera_inversion_x">Invert X</label>
|
||||
|
||||
<input
|
||||
type="radio"
|
||||
data-event-blur="set_cur_config_index(-1)"
|
||||
data-event-focus="set_cur_config_index(9)"
|
||||
name="analog_camera_invert_mode"
|
||||
data-checked="analog_camera_invert_mode"
|
||||
value="InvertY"
|
||||
id="analog_camera_inversion_y"
|
||||
style="nav-up: #analog_cam_disabled;"
|
||||
/>
|
||||
<label class="config-option__tab-label" for="analog_camera_inversion_y">Invert Y</label>
|
||||
|
||||
<input
|
||||
type="radio"
|
||||
data-event-blur="set_cur_config_index(-1)"
|
||||
data-event-focus="set_cur_config_index(9)"
|
||||
name="analog_camera_invert_mode"
|
||||
data-checked="analog_camera_invert_mode"
|
||||
value="InvertBoth"
|
||||
id="analog_camera_inversion_both"
|
||||
style="nav-up: #analog_cam_disabled;"
|
||||
/>
|
||||
<label class="config-option__tab-label" for="analog_camera_inversion_both">Invert Both</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Descriptions -->
|
||||
<div class="config__wrapper">
|
||||
@ -138,16 +325,43 @@
|
||||
<b>Note: To recalibrate controller gyro, set the controller down on a still, flat surface for 5 seconds.</b>
|
||||
</p>
|
||||
<p data-if="cur_config_index == 3">
|
||||
Controls the sensitivity of mouse aiming. <b>Setting this to zero will disable mouse aiming.</b>
|
||||
Controls the sensitivity of mouse aiming when using items in first person. <b>Setting this to zero will disable mouse aiming.</b>
|
||||
<br />
|
||||
<br />
|
||||
<b>Note: This option does not allow mouse buttons to activate items. Mouse aiming is is intended to be used with inputs that are mapped to mouse movement, such as gyro on Steam Deck.</b>
|
||||
<b>Note: This option does not allow mouse buttons to activate items. Mouse aiming is intended to be used with inputs that are mapped to mouse movement, such as gyro on Steam Deck.</b>
|
||||
</p>
|
||||
<p data-if="cur_config_index == 4">
|
||||
Applies a deadzone to joystick inputs.
|
||||
</p>
|
||||
<p data-if="cur_config_index == 5">
|
||||
Allows the game to read controller input when out of focus.
|
||||
<br/>
|
||||
<b>This setting does not affect keyboard input.</b>
|
||||
</p>
|
||||
<p data-if="cur_config_index == 6">
|
||||
Turns on autosaving and prevents owl saves from being deleted on load. Autosaves act as owl saves and take up the same slot as they do.
|
||||
<br/>
|
||||
<br/>
|
||||
Loading an autosave will place you in Clock Town or at the entrance of the current dungeon if you were in one.
|
||||
<br/>
|
||||
<br/>
|
||||
<b>If autosaving is disabled, existing autosaves will be deleted when loaded.</b>
|
||||
</p>
|
||||
<p data-if="cur_config_index == 7">
|
||||
Inverts the camera controls for first-person aiming. <b>Invert Y</b> is the default and matches the original game.
|
||||
</p>
|
||||
<p data-if="cur_config_index == 8">
|
||||
Enables an analog "free" camera similar to later entries in the series that's mapped to the right analog stick on the controller.
|
||||
<br/>
|
||||
<br/>
|
||||
When you move the right stick, the camera will enter free mode and stop centering behind Link. Press the <b>Target</b> button at any time to go back into the normal camera mode. The camera will also return to normal mode after a cutscene plays or when you move between areas.
|
||||
<br/>
|
||||
<br/>
|
||||
This option also enables right stick control while looking and aiming.
|
||||
</p>
|
||||
<p data-if="cur_config_index == 9">
|
||||
Inverts the camera controls for the analog camera if it's enabled. <b>None</b> is the default.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -158,7 +158,8 @@
|
||||
data-checked="rr_option"
|
||||
value="Display"
|
||||
id="rr_display"
|
||||
data-attr-style="rr_option=='Manual' ? 'nav-up: #wm_fullscreen; nav-down: #rr_manual_input' : 'nav-up: #wm_fullscreen; nav-down: #msaa_2x'"
|
||||
style="nav-up: #wm_fullscreen"
|
||||
data-style-nav-down="rr_option=='Manual' ? '#rr_manual_input' : (msaa2x_supported ? '#msaa_2x' : '#msaa_none')"
|
||||
/>
|
||||
<label class="config-option__tab-label" for="rr_display">Display</label>
|
||||
<input type="radio"
|
||||
@ -168,7 +169,8 @@
|
||||
data-checked="rr_option"
|
||||
value="Manual"
|
||||
id="rr_manual"
|
||||
data-attr-style="rr_option=='Manual' ? 'nav-up: #wm_fullscreen; nav-down: #rr_manual_input' : 'nav-up: #wm_fullscreen; nav-down: #msaa_4x'"
|
||||
style="nav-up: #wm_fullscreen"
|
||||
data-style-nav-down="rr_option=='Manual' ? '#rr_manual_input' : (msaa4x_supported ? '#msaa_4x' : (msaa2x_supported ? '#msaa_2x' : '#msaa_none'))"
|
||||
/>
|
||||
<label class="config-option__tab-label" for="rr_manual">Manual</label>
|
||||
</div>
|
||||
@ -181,7 +183,7 @@
|
||||
type="range"
|
||||
min="20"
|
||||
max="360"
|
||||
style="flex:1;margin: 0dp;nav-up:auto;nav-down:auto;"
|
||||
style="flex:1;margin: 0dp;nav-up:#rr_manual;nav-down:#msaa_none;"
|
||||
data-value="rr_manual_value"
|
||||
/>
|
||||
</div>
|
||||
@ -209,6 +211,7 @@
|
||||
value="MSAA2X"
|
||||
id="msaa_2x"
|
||||
data-attr-style="rr_option=='Manual' ? 'nav-up: #rr_manual_input; nav-down: #hr_16_9' : 'nav-up: #rr_display; nav-down: #hr_16_9'"
|
||||
data-style-nav-right="msaa4x_supported ? '#msaa_4x' : 'none'"
|
||||
/>
|
||||
<label class="config-option__tab-label" for="msaa_2x">2x</label>
|
||||
<input type="radio"
|
||||
@ -247,6 +250,7 @@
|
||||
value="Clamp16x9"
|
||||
id="hr_16_9"
|
||||
style="nav-up: #msaa_2x; nav-down: #apply_button"
|
||||
data-style-nav-up="msaa2x_supported ? '#msaa_2x' : '#msaa_none'"
|
||||
/>
|
||||
<label class="config-option__tab-label" for="hr_16_9">16:9</label>
|
||||
<input type="radio"
|
||||
@ -257,6 +261,7 @@
|
||||
value="Full"
|
||||
id="hr_full"
|
||||
style="nav-up: #msaa_4x; nav-down: #apply_button"
|
||||
data-style-nav-up="msaa4x_supported ? '#msaa_4x' : (msaa2x_supported ? '#msaa_2x' : '#msaa_none')"
|
||||
/>
|
||||
<label class="config-option__tab-label" for="hr_full">Expand</label>
|
||||
</div>
|
||||
@ -277,7 +282,7 @@
|
||||
Sets the horizontal aspect ratio. <b>Original</b> uses the game's original 4:3 aspect ratio. <b>Expand</b> will adjust to match the game window's aspect ratio.
|
||||
</p>
|
||||
<p data-if="cur_config_index == 3">
|
||||
Sets whether the game should display <b>Windowed</b> or <b>Fullscreen</b>. You can also use <b>Alt + Enter</b> to toggle this option.
|
||||
Sets whether the game should display <b>Windowed</b> or <b>Fullscreen</b>. You can also use <b>F11</b> or <b>Alt + Enter</b> to toggle this option.
|
||||
</p>
|
||||
<p data-if="cur_config_index == 4">
|
||||
Sets the game's output framerate. This option does not affect gameplay.
|
||||
@ -311,7 +316,7 @@
|
||||
id="apply_button"
|
||||
style="nav-up:#hr_original"
|
||||
>
|
||||
<div class="button__label">Apply</div>
|
||||
<div class="button__label">Apply<span class="prompt-font-sm">{{gfx_help__apply}}</span></div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -7,30 +7,47 @@
|
||||
<!-- Options -->
|
||||
<div class="config__wrapper" data-event-mouseout="set_cur_config_index(-1)">
|
||||
<div class="config-option" data-event-mouseover="set_cur_config_index(0)">
|
||||
<label class="config-option__title">Main Volume</label>
|
||||
<div class="config-option__range-wrapper config-option__list">
|
||||
<label class="config-option__range-label">{{main_volume}}%</label>
|
||||
<input
|
||||
data-event-blur="set_cur_config_index(-1)"
|
||||
data-event-focus="set_cur_config_index(0)"
|
||||
class="nav-vert"
|
||||
id="main_volume_input"
|
||||
type="range"
|
||||
min="0"
|
||||
max="100"
|
||||
style="flex: 1; margin: 0dp; nav-up: #tab_sound; nav-down: #bgm_volume_input;"
|
||||
data-value="main_volume"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="config-option" data-event-mouseover="set_cur_config_index(1)">
|
||||
<label class="config-option__title">Background Music Volume</label>
|
||||
<div class="config-option__range-wrapper config-option__list">
|
||||
<label class="config-option__range-label">{{bgm_volume}}%</label>
|
||||
<input
|
||||
data-event-blur="set_cur_config_index(-1)"
|
||||
data-event-focus="set_cur_config_index(0)"
|
||||
data-event-focus="set_cur_config_index(1)"
|
||||
class="nav-vert"
|
||||
id="bgm_volume_input"
|
||||
type="range"
|
||||
min="0"
|
||||
max="100"
|
||||
style="flex: 1; margin: 0dp; nav-up: #tab_sound; nav-down: #lhb_on;"
|
||||
style="flex: 1; margin: 0dp; nav-up: #main_volume_input; nav-down: #lhb_on;"
|
||||
data-value="bgm_volume"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="config-option" data-event-mouseover="set_cur_config_index(1)">
|
||||
<div class="config-option" data-event-mouseover="set_cur_config_index(2)">
|
||||
<label class="config-option__title">Low Health Beeps</label>
|
||||
<div class="config-option__list">
|
||||
<input
|
||||
type="radio"
|
||||
data-event-blur="set_cur_config_index(-1)"
|
||||
data-event-focus="set_cur_config_index(1)"
|
||||
data-event-focus="set_cur_config_index(2)"
|
||||
name="lhb"
|
||||
data-checked="low_health_beeps_enabled"
|
||||
value="1"
|
||||
@ -42,7 +59,7 @@
|
||||
<input
|
||||
type="radio"
|
||||
data-event-blur="set_cur_config_index(-1)"
|
||||
data-event-focus="set_cur_config_index(1)"
|
||||
data-event-focus="set_cur_config_index(2)"
|
||||
name="lhb"
|
||||
data-checked="low_health_beeps_enabled"
|
||||
value="0"
|
||||
@ -55,10 +72,13 @@
|
||||
</div>
|
||||
<!-- Descriptions -->
|
||||
<div class="config__wrapper">
|
||||
<p data-if="cur_config_index == 0">
|
||||
<p data-if="cur_config_index == 0">
|
||||
Controls the main volume of the game.
|
||||
</p>
|
||||
<p data-if="cur_config_index == 1">
|
||||
Controls the overall volume of background music.
|
||||
</p>
|
||||
<p data-if="cur_config_index == 1">
|
||||
<p data-if="cur_config_index == 2">
|
||||
Toggles whether or not the low-health beeping sound plays.
|
||||
</p>
|
||||
</div>
|
||||
|
5
assets/icons/Reset.svg
Normal file
5
assets/icons/Reset.svg
Normal file
@ -0,0 +1,5 @@
|
||||
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M27.6949 10.3162C25.5859 5.98481 21.1415 3 16 3C8.8203 3 3 8.8203 3 16C3 23.1797 8.8203 29 16 29C21.1415 29 25.5859 26.0152 27.6949 21.6838" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round"/>
|
||||
<path d="M29.052 11.0519V5.0519" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M29.052 11.0519H23.052" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
After Width: | Height: | Size: 555 B |
@ -58,7 +58,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom-left">
|
||||
<label>{{version_number}}</label>
|
||||
<label>v{{version_number}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
File diff suppressed because one or more lines are too long
@ -13,7 +13,6 @@
|
||||
}
|
||||
|
||||
.centered-page__modal {
|
||||
@extend %nav-all;
|
||||
display: flex;
|
||||
position: relative;
|
||||
flex: 1 1 100%;
|
||||
|
@ -5,7 +5,7 @@ $prompt-space: 24;
|
||||
.prompt {
|
||||
&__overlay {
|
||||
background-color: $color-bg-overlay;
|
||||
pointer-events: none;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
&__overlay,
|
||||
|
BIN
docs/deck_gyro_1.jpg
Normal file
BIN
docs/deck_gyro_1.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 109 KiB |
@ -1,4 +0,0 @@
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic ignored "-Wunused-variable"
|
||||
#pragma clang diagnostic ignored "-Wimplicit-function-declaration"
|
||||
#endif
|
9
include/ovl_patches.hpp
Normal file
9
include/ovl_patches.hpp
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef __OVL_PATCHES_HPP__
|
||||
#define __OVL_PATCHES_HPP__
|
||||
|
||||
namespace zelda64 {
|
||||
void register_overlays();
|
||||
void register_patches();
|
||||
}
|
||||
|
||||
#endif
|
327
include/recomp.h
327
include/recomp.h
@ -1,327 +0,0 @@
|
||||
#ifndef __RECOMP_H__
|
||||
#define __RECOMP_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
#include <setjmp.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#if 0 // treat GPRs as 32-bit, should be better codegen
|
||||
typedef uint32_t gpr;
|
||||
|
||||
#define SIGNED(val) \
|
||||
((int32_t)(val))
|
||||
#else
|
||||
typedef uint64_t gpr;
|
||||
|
||||
#define SIGNED(val) \
|
||||
((int64_t)(val))
|
||||
#endif
|
||||
|
||||
#define ADD32(a, b) \
|
||||
((gpr)(int32_t)((a) + (b)))
|
||||
|
||||
#define SUB32(a, b) \
|
||||
((gpr)(int32_t)((a) - (b)))
|
||||
|
||||
#define MEM_W(offset, reg) \
|
||||
(*(int32_t*)(rdram + ((((reg) + (offset))) - 0xFFFFFFFF80000000)))
|
||||
//(*(int32_t*)(rdram + ((((reg) + (offset))) & 0x3FFFFFF)))
|
||||
|
||||
#define MEM_H(offset, reg) \
|
||||
(*(int16_t*)(rdram + ((((reg) + (offset)) ^ 2) - 0xFFFFFFFF80000000)))
|
||||
//(*(int16_t*)(rdram + ((((reg) + (offset)) ^ 2) & 0x3FFFFFF)))
|
||||
|
||||
#define MEM_B(offset, reg) \
|
||||
(*(int8_t*)(rdram + ((((reg) + (offset)) ^ 3) - 0xFFFFFFFF80000000)))
|
||||
//(*(int8_t*)(rdram + ((((reg) + (offset)) ^ 3) & 0x3FFFFFF)))
|
||||
|
||||
#define MEM_HU(offset, reg) \
|
||||
(*(uint16_t*)(rdram + ((((reg) + (offset)) ^ 2) - 0xFFFFFFFF80000000)))
|
||||
//(*(uint16_t*)(rdram + ((((reg) + (offset)) ^ 2) & 0x3FFFFFF)))
|
||||
|
||||
#define MEM_BU(offset, reg) \
|
||||
(*(uint8_t*)(rdram + ((((reg) + (offset)) ^ 3) - 0xFFFFFFFF80000000)))
|
||||
//(*(uint8_t*)(rdram + ((((reg) + (offset)) ^ 3) & 0x3FFFFFF)))
|
||||
|
||||
#define SD(val, offset, reg) { \
|
||||
*(uint32_t*)(rdram + ((((reg) + (offset) + 4)) - 0xFFFFFFFF80000000)) = (uint32_t)((gpr)(val) >> 0); \
|
||||
*(uint32_t*)(rdram + ((((reg) + (offset) + 0)) - 0xFFFFFFFF80000000)) = (uint32_t)((gpr)(val) >> 32); \
|
||||
}
|
||||
|
||||
//#define SD(val, offset, reg) { \
|
||||
// *(uint32_t*)(rdram + ((((reg) + (offset) + 4)) & 0x3FFFFFF)) = (uint32_t)((val) >> 32); \
|
||||
// *(uint32_t*)(rdram + ((((reg) + (offset) + 0)) & 0x3FFFFFF)) = (uint32_t)((val) >> 0); \
|
||||
//}
|
||||
|
||||
static inline uint64_t load_doubleword(uint8_t* rdram, gpr reg, gpr offset) {
|
||||
uint64_t ret = 0;
|
||||
uint64_t lo = (uint64_t)(uint32_t)MEM_W(reg, offset + 4);
|
||||
uint64_t hi = (uint64_t)(uint32_t)MEM_W(reg, offset + 0);
|
||||
ret = (lo << 0) | (hi << 32);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define LD(offset, reg) \
|
||||
load_doubleword(rdram, offset, reg)
|
||||
|
||||
static inline gpr do_lwl(uint8_t* rdram, gpr initial_value, gpr offset, gpr reg) {
|
||||
// Calculate the overall address
|
||||
gpr address = (offset + reg);
|
||||
|
||||
// Load the aligned word
|
||||
gpr word_address = address & ~0x3;
|
||||
uint32_t loaded_value = MEM_W(0, word_address);
|
||||
|
||||
// Mask the existing value and shift the loaded value appropriately
|
||||
gpr misalignment = address & 0x3;
|
||||
gpr masked_value = initial_value & ~(0xFFFFFFFFu << (misalignment * 8));
|
||||
loaded_value <<= (misalignment * 8);
|
||||
|
||||
// Cast to int32_t to sign extend first
|
||||
return (gpr)(int32_t)(masked_value | loaded_value);
|
||||
}
|
||||
|
||||
static inline gpr do_lwr(uint8_t* rdram, gpr initial_value, gpr offset, gpr reg) {
|
||||
// Calculate the overall address
|
||||
gpr address = (offset + reg);
|
||||
|
||||
// Load the aligned word
|
||||
gpr word_address = address & ~0x3;
|
||||
uint32_t loaded_value = MEM_W(0, word_address);
|
||||
|
||||
// Mask the existing value and shift the loaded value appropriately
|
||||
gpr misalignment = address & 0x3;
|
||||
gpr masked_value = initial_value & ~(0xFFFFFFFFu >> (24 - misalignment * 8));
|
||||
loaded_value >>= (24 - misalignment * 8);
|
||||
|
||||
// Cast to int32_t to sign extend first
|
||||
return (gpr)(int32_t)(masked_value | loaded_value);
|
||||
}
|
||||
|
||||
static inline void do_swl(uint8_t* rdram, gpr offset, gpr reg, gpr val) {
|
||||
// Calculate the overall address
|
||||
gpr address = (offset + reg);
|
||||
|
||||
// Get the initial value of the aligned word
|
||||
gpr word_address = address & ~0x3;
|
||||
uint32_t initial_value = MEM_W(0, word_address);
|
||||
|
||||
// Mask the initial value and shift the input value appropriately
|
||||
gpr misalignment = address & 0x3;
|
||||
uint32_t masked_initial_value = initial_value & ~(0xFFFFFFFFu >> (misalignment * 8));
|
||||
uint32_t shifted_input_value = ((uint32_t)val) >> (misalignment * 8);
|
||||
MEM_W(0, word_address) = masked_initial_value | shifted_input_value;
|
||||
}
|
||||
|
||||
static inline void do_swr(uint8_t* rdram, gpr offset, gpr reg, gpr val) {
|
||||
// Calculate the overall address
|
||||
gpr address = (offset + reg);
|
||||
|
||||
// Get the initial value of the aligned word
|
||||
gpr word_address = address & ~0x3;
|
||||
uint32_t initial_value = MEM_W(0, word_address);
|
||||
|
||||
// Mask the initial value and shift the input value appropriately
|
||||
gpr misalignment = address & 0x3;
|
||||
uint32_t masked_initial_value = initial_value & ~(0xFFFFFFFFu << (24 - misalignment * 8));
|
||||
uint32_t shifted_input_value = ((uint32_t)val) << (24 - misalignment * 8);
|
||||
MEM_W(0, word_address) = masked_initial_value | shifted_input_value;
|
||||
}
|
||||
|
||||
#define S32(val) \
|
||||
((int32_t)(val))
|
||||
|
||||
#define U32(val) \
|
||||
((uint32_t)(val))
|
||||
|
||||
#define S64(val) \
|
||||
((int64_t)(val))
|
||||
|
||||
#define U64(val) \
|
||||
((uint64_t)(val))
|
||||
|
||||
#define MUL_S(val1, val2) \
|
||||
((val1) * (val2))
|
||||
|
||||
#define MUL_D(val1, val2) \
|
||||
((val1) * (val2))
|
||||
|
||||
#define DIV_S(val1, val2) \
|
||||
((val1) / (val2))
|
||||
|
||||
#define DIV_D(val1, val2) \
|
||||
((val1) / (val2))
|
||||
|
||||
#define CVT_S_W(val) \
|
||||
((float)((int32_t)(val)))
|
||||
|
||||
#define CVT_D_W(val) \
|
||||
((double)((int32_t)(val)))
|
||||
|
||||
#define CVT_D_S(val) \
|
||||
((double)(val))
|
||||
|
||||
#define CVT_S_D(val) \
|
||||
((float)(val))
|
||||
|
||||
#define TRUNC_W_S(val) \
|
||||
((int32_t)(val))
|
||||
|
||||
#define TRUNC_W_D(val) \
|
||||
((int32_t)(val))
|
||||
|
||||
#define TRUNC_L_S(val) \
|
||||
((int64_t)(val))
|
||||
|
||||
#define TRUNC_L_D(val) \
|
||||
((int64_t)(val))
|
||||
|
||||
#define DEFAULT_ROUNDING_MODE 0
|
||||
|
||||
static inline int32_t do_cvt_w_s(float val, unsigned int rounding_mode) {
|
||||
switch (rounding_mode) {
|
||||
case 0: // round to nearest value
|
||||
return (int32_t)lroundf(val);
|
||||
case 1: // round to zero (truncate)
|
||||
return (int32_t)val;
|
||||
case 2: // round to positive infinity (ceil)
|
||||
return (int32_t)ceilf(val);
|
||||
case 3: // round to negative infinity (floor)
|
||||
return (int32_t)floorf(val);
|
||||
}
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define CVT_W_S(val) \
|
||||
do_cvt_w_s(val, rounding_mode)
|
||||
|
||||
static inline int32_t do_cvt_w_d(double val, unsigned int rounding_mode) {
|
||||
switch (rounding_mode) {
|
||||
case 0: // round to nearest value
|
||||
return (int32_t)lround(val);
|
||||
case 1: // round to zero (truncate)
|
||||
return (int32_t)val;
|
||||
case 2: // round to positive infinity (ceil)
|
||||
return (int32_t)ceil(val);
|
||||
case 3: // round to negative infinity (floor)
|
||||
return (int32_t)floor(val);
|
||||
}
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define CVT_W_D(val) \
|
||||
do_cvt_w_d(val, rounding_mode)
|
||||
|
||||
#define NAN_CHECK(val) \
|
||||
assert(val == val)
|
||||
|
||||
//#define NAN_CHECK(val)
|
||||
|
||||
typedef union {
|
||||
double d;
|
||||
struct {
|
||||
float fl;
|
||||
float fh;
|
||||
};
|
||||
struct {
|
||||
uint32_t u32l;
|
||||
uint32_t u32h;
|
||||
};
|
||||
uint64_t u64;
|
||||
} fpr;
|
||||
|
||||
typedef struct {
|
||||
gpr r0, r1, r2, r3, r4, r5, r6, r7,
|
||||
r8, r9, r10, r11, r12, r13, r14, r15,
|
||||
r16, r17, r18, r19, r20, r21, r22, r23,
|
||||
r24, r25, r26, r27, r28, r29, r30, r31;
|
||||
fpr f0, f1, f2, f3, f4, f5, f6, f7,
|
||||
f8, f9, f10, f11, f12, f13, f14, f15,
|
||||
f16, f17, f18, f19, f20, f21, f22, f23,
|
||||
f24, f25, f26, f27, f28, f29, f30, f31;
|
||||
uint64_t hi, lo;
|
||||
uint32_t* f_odd;
|
||||
uint32_t status_reg;
|
||||
uint8_t mips3_float_mode;
|
||||
} recomp_context;
|
||||
|
||||
// Checks if the target is an even float register or that mips3 float mode is enabled
|
||||
#define CHECK_FR(ctx, idx) \
|
||||
assert(((idx) & 1) == 0 || (ctx)->mips3_float_mode)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void cop0_status_write(recomp_context* ctx, gpr value);
|
||||
gpr cop0_status_read(recomp_context* ctx);
|
||||
void switch_error(const char* func, uint32_t vram, uint32_t jtbl);
|
||||
void do_break(uint32_t vram);
|
||||
|
||||
typedef void (recomp_func_t)(uint8_t* rdram, recomp_context* ctx);
|
||||
|
||||
recomp_func_t* get_function(int32_t vram);
|
||||
|
||||
#define LOOKUP_FUNC(val) \
|
||||
get_function((int32_t)(val))
|
||||
|
||||
extern int32_t section_addresses[];
|
||||
|
||||
#define LO16(x) \
|
||||
((x) & 0xFFFF)
|
||||
|
||||
#define HI16(x) \
|
||||
(((x) >> 16) + (((x) >> 15) & 1))
|
||||
|
||||
#define RELOC_HI16(section_index, offset) \
|
||||
HI16(section_addresses[section_index] + (offset))
|
||||
|
||||
#define RELOC_LO16(section_index, offset) \
|
||||
LO16(section_addresses[section_index] + (offset))
|
||||
|
||||
// For Banjo-Tooie
|
||||
void recomp_syscall_handler(uint8_t* rdram, recomp_context* ctx, int32_t instruction_vram);
|
||||
|
||||
// For the Mario Party games (not working)
|
||||
//// This has to be in this file so it can be inlined
|
||||
//struct jmp_buf_storage {
|
||||
// jmp_buf buffer;
|
||||
//};
|
||||
//
|
||||
//struct RecompJmpBuf {
|
||||
// int32_t owner;
|
||||
// struct jmp_buf_storage* storage;
|
||||
// uint64_t magic;
|
||||
//};
|
||||
//
|
||||
//// Randomly generated constant
|
||||
//#define SETJMP_MAGIC 0xe17afdfa939a437bu
|
||||
//
|
||||
//int32_t osGetThreadEx(void);
|
||||
//
|
||||
//#define setjmp_recomp(rdram, ctx) { \
|
||||
// struct RecompJmpBuf* buf = (struct RecompJmpBuf*)(&rdram[(uint64_t)ctx->r4 - 0xFFFFFFFF80000000]); \
|
||||
// \
|
||||
// /* Check if this jump buffer was previously set up */ \
|
||||
// if (buf->magic == SETJMP_MAGIC) { \
|
||||
// /* If so, free the old jmp_buf */ \
|
||||
// free(buf->storage); \
|
||||
// } \
|
||||
// \
|
||||
// buf->magic = SETJMP_MAGIC; \
|
||||
// buf->owner = osGetThreadEx(); \
|
||||
// buf->storage = (struct jmp_buf_storage*)calloc(1, sizeof(struct jmp_buf_storage)); \
|
||||
// ctx->r2 = setjmp(buf->storage->buffer); \
|
||||
//}
|
||||
|
||||
void pause_self(uint8_t *rdram);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,25 +0,0 @@
|
||||
#ifndef __RECOMP_CONFIG_H__
|
||||
#define __RECOMP_CONFIG_H__
|
||||
|
||||
#include <filesystem>
|
||||
#include <string_view>
|
||||
#include "../ultramodern/config.hpp"
|
||||
|
||||
namespace recomp {
|
||||
constexpr std::u8string_view program_id = u8"Zelda64Recompiled";
|
||||
constexpr std::u8string_view mm_game_id = u8"mm.n64.us.1.0";
|
||||
|
||||
void load_config();
|
||||
void save_config();
|
||||
|
||||
void reset_input_bindings();
|
||||
void reset_cont_input_bindings();
|
||||
void reset_kb_input_bindings();
|
||||
|
||||
std::filesystem::path get_app_folder_path();
|
||||
|
||||
bool get_debug_mode_enabled();
|
||||
void set_debug_mode_enabled(bool enabled);
|
||||
};
|
||||
|
||||
#endif
|
14
include/recomp_files.h
Normal file
14
include/recomp_files.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef __RECOMP_FILES_H__
|
||||
#define __RECOMP_FILES_H__
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
|
||||
namespace recomp {
|
||||
std::ifstream open_input_file_with_backup(const std::filesystem::path& filepath, std::ios_base::openmode mode = std::ios_base::in);
|
||||
std::ifstream open_input_backup_file(const std::filesystem::path& filepath, std::ios_base::openmode mode = std::ios_base::in);
|
||||
std::ofstream open_output_file_with_backup(const std::filesystem::path& filepath, std::ios_base::openmode mode = std::ios_base::out);
|
||||
bool finalize_output_file_with_backup(const std::filesystem::path& filepath);
|
||||
};
|
||||
|
||||
#endif
|
@ -1,39 +0,0 @@
|
||||
#ifndef __RECOMP_GAME__
|
||||
#define __RECOMP_GAME__
|
||||
|
||||
#include <vector>
|
||||
#include <filesystem>
|
||||
|
||||
#include "recomp.h"
|
||||
#include "../ultramodern/ultramodern.hpp"
|
||||
#include "rt64_layer.h"
|
||||
|
||||
namespace recomp {
|
||||
enum class Game {
|
||||
OoT,
|
||||
MM,
|
||||
None,
|
||||
Quit
|
||||
};
|
||||
enum class RomValidationError {
|
||||
Good,
|
||||
FailedToOpen,
|
||||
NotARom,
|
||||
IncorrectRom,
|
||||
NotYet,
|
||||
IncorrectVersion,
|
||||
OtherError
|
||||
};
|
||||
void check_all_stored_roms();
|
||||
bool load_stored_rom(Game game);
|
||||
RomValidationError select_rom(const std::filesystem::path& rom_path, Game game);
|
||||
bool is_rom_valid(Game game);
|
||||
bool is_rom_loaded();
|
||||
void set_rom_contents(std::vector<uint8_t>&& new_rom);
|
||||
void do_rom_read(uint8_t* rdram, gpr ram_address, uint32_t physical_addr, size_t num_bytes);
|
||||
void start(ultramodern::WindowHandle window_handle, const ultramodern::audio_callbacks_t& audio_callbacks, const ultramodern::input_callbacks_t& input_callbacks, const ultramodern::gfx_callbacks_t& gfx_callbacks);
|
||||
void start_game(Game game);
|
||||
void message_box(const char* message);
|
||||
}
|
||||
|
||||
#endif
|
@ -1,50 +0,0 @@
|
||||
#ifndef __RECOMP_HELPERS__
|
||||
#define __RECOMP_HELPERS__
|
||||
|
||||
#include "recomp.h"
|
||||
#include "../ultramodern/ultra64.h"
|
||||
|
||||
template<int index, typename T>
|
||||
T _arg(uint8_t* rdram, recomp_context* ctx) {
|
||||
static_assert(index < 4, "Only args 0 through 3 supported");
|
||||
gpr raw_arg = (&ctx->r4)[index];
|
||||
if constexpr (std::is_same_v<T, float>) {
|
||||
if constexpr (index < 2) {
|
||||
static_assert(index != 1, "Floats in arg 1 not supported");
|
||||
return ctx->f12.fl;
|
||||
}
|
||||
else {
|
||||
// static_assert in else workaround
|
||||
[] <bool flag = false>() {
|
||||
static_assert(flag, "Floats in a2/a3 not supported");
|
||||
}();
|
||||
}
|
||||
}
|
||||
else if constexpr (std::is_pointer_v<T>) {
|
||||
static_assert (!std::is_pointer_v<std::remove_pointer_t<T>>, "Double pointers not supported");
|
||||
return TO_PTR(std::remove_pointer_t<T>, raw_arg);
|
||||
}
|
||||
else if constexpr (std::is_integral_v<T>) {
|
||||
static_assert(sizeof(T) <= 4, "64-bit args not supported");
|
||||
return static_cast<T>(raw_arg);
|
||||
}
|
||||
else {
|
||||
// static_assert in else workaround
|
||||
[] <bool flag = false>() {
|
||||
static_assert(flag, "Unsupported type");
|
||||
}();
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void _return(recomp_context* ctx, T val) {
|
||||
static_assert(sizeof(T) <= 4 && "Only 32-bit value returns supported currently");
|
||||
if (std::is_same_v<T, float>) {
|
||||
ctx->f0.fl = val;
|
||||
}
|
||||
else if (std::is_integral_v<T> && sizeof(T) <= 4) {
|
||||
ctx->r2 = int32_t(val);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -9,11 +9,14 @@
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include "ultramodern/input.hpp"
|
||||
|
||||
#include "json/json.hpp"
|
||||
|
||||
namespace recomp {
|
||||
// x-macros to build input enums and arrays.
|
||||
// First parameter is the enum name, second parameter is the bit field for the input (or 0 if there is no associated one), third is the readable name.
|
||||
// TODO refactor this to allow projects to rename these, or get rid of the readable name and leave that up to individual projects to map.
|
||||
#define DEFINE_N64_BUTTON_INPUTS() \
|
||||
DEFINE_INPUT(A, 0x8000, "Action") \
|
||||
DEFINE_INPUT(B, 0x4000, "Attack/Cancel") \
|
||||
@ -36,9 +39,15 @@ namespace recomp {
|
||||
DEFINE_INPUT(X_AXIS_NEG, 0, "Left") \
|
||||
DEFINE_INPUT(X_AXIS_POS, 0, "Right") \
|
||||
|
||||
#define DEFINE_RECOMP_UI_INPUTS() \
|
||||
DEFINE_INPUT(TOGGLE_MENU, 0, "Toggle Menu") \
|
||||
DEFINE_INPUT(ACCEPT_MENU, 0, "Accept (Menu)") \
|
||||
DEFINE_INPUT(APPLY_MENU, 0, "Apply (Menu)")
|
||||
|
||||
#define DEFINE_ALL_INPUTS() \
|
||||
DEFINE_N64_BUTTON_INPUTS() \
|
||||
DEFINE_N64_AXIS_INPUTS()
|
||||
DEFINE_N64_AXIS_INPUTS() \
|
||||
DEFINE_RECOMP_UI_INPUTS()
|
||||
|
||||
// Enum containing every recomp input.
|
||||
#define DEFINE_INPUT(name, value, readable) name,
|
||||
@ -67,6 +76,7 @@ namespace recomp {
|
||||
bool get_input_digital(const std::span<const recomp::InputField> fields);
|
||||
void get_gyro_deltas(float* x, float* y);
|
||||
void get_mouse_deltas(float* x, float* y);
|
||||
void get_right_analog(float* x, float* y);
|
||||
|
||||
enum class InputDevice {
|
||||
Controller,
|
||||
@ -78,8 +88,9 @@ namespace recomp {
|
||||
void stop_scanning_input();
|
||||
void finish_scanning_input(InputField scanned_field);
|
||||
void cancel_scanning_input();
|
||||
void set_cont_or_kb(bool cont_interacted);
|
||||
void config_menu_set_cont_or_kb(bool cont_interacted);
|
||||
InputField get_scanned_input();
|
||||
int get_scanned_input_index();
|
||||
|
||||
struct DefaultN64Mappings {
|
||||
std::vector<InputField> a;
|
||||
@ -103,8 +114,40 @@ namespace recomp {
|
||||
std::vector<InputField> analog_right;
|
||||
std::vector<InputField> analog_up;
|
||||
std::vector<InputField> analog_down;
|
||||
|
||||
std::vector<InputField> toggle_menu;
|
||||
std::vector<InputField> accept_menu;
|
||||
std::vector<InputField> apply_menu;
|
||||
};
|
||||
|
||||
inline const std::vector<InputField>& get_default_mapping_for_input(const DefaultN64Mappings& defaults, const GameInput input) {
|
||||
static const std::vector<InputField> empty_input_field{};
|
||||
switch (input) {
|
||||
case GameInput::A: return defaults.a;
|
||||
case GameInput::B: return defaults.b;
|
||||
case GameInput::L: return defaults.l;
|
||||
case GameInput::R: return defaults.r;
|
||||
case GameInput::Z: return defaults.z;
|
||||
case GameInput::START: return defaults.start;
|
||||
case GameInput::C_LEFT: return defaults.c_left;
|
||||
case GameInput::C_RIGHT: return defaults.c_right;
|
||||
case GameInput::C_UP: return defaults.c_up;
|
||||
case GameInput::C_DOWN: return defaults.c_down;
|
||||
case GameInput::DPAD_LEFT: return defaults.dpad_left;
|
||||
case GameInput::DPAD_RIGHT: return defaults.dpad_right;
|
||||
case GameInput::DPAD_UP: return defaults.dpad_up;
|
||||
case GameInput::DPAD_DOWN: return defaults.dpad_down;
|
||||
case GameInput::X_AXIS_NEG: return defaults.analog_left;
|
||||
case GameInput::X_AXIS_POS: return defaults.analog_right;
|
||||
case GameInput::Y_AXIS_POS: return defaults.analog_up;
|
||||
case GameInput::Y_AXIS_NEG: return defaults.analog_down;
|
||||
case GameInput::TOGGLE_MENU: return defaults.toggle_menu;
|
||||
case GameInput::ACCEPT_MENU: return defaults.accept_menu;
|
||||
case GameInput::APPLY_MENU: return defaults.apply_menu;
|
||||
default: return empty_input_field;
|
||||
}
|
||||
}
|
||||
|
||||
extern const DefaultN64Mappings default_n64_keyboard_mappings;
|
||||
extern const DefaultN64Mappings default_n64_controller_mappings;
|
||||
|
||||
@ -117,10 +160,12 @@ namespace recomp {
|
||||
InputField& get_input_binding(GameInput input, size_t binding_index, InputDevice device);
|
||||
void set_input_binding(GameInput input, size_t binding_index, InputDevice device, InputField value);
|
||||
|
||||
void get_n64_input(uint16_t* buttons_out, float* x_out, float* y_out);
|
||||
void set_rumble(bool);
|
||||
bool get_n64_input(int controller_num, uint16_t* buttons_out, float* x_out, float* y_out);
|
||||
void set_rumble(int controller_num, bool);
|
||||
void update_rumble();
|
||||
void handle_events();
|
||||
|
||||
ultramodern::input::connected_device_info_t get_connected_device_info(int controller_num);
|
||||
|
||||
// Rumble strength ranges from 0 to 100.
|
||||
int get_rumble_strength();
|
||||
@ -129,22 +174,12 @@ namespace recomp {
|
||||
// Gyro and mouse sensitivities range from 0 to 100.
|
||||
int get_gyro_sensitivity();
|
||||
int get_mouse_sensitivity();
|
||||
int get_joystick_deadzone();
|
||||
void set_gyro_sensitivity(int strength);
|
||||
void set_mouse_sensitivity(int strength);
|
||||
|
||||
enum class TargetingMode {
|
||||
Switch,
|
||||
Hold,
|
||||
OptionCount
|
||||
};
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM(recomp::TargetingMode, {
|
||||
{recomp::TargetingMode::Switch, "Switch"},
|
||||
{recomp::TargetingMode::Hold, "Hold"}
|
||||
});
|
||||
|
||||
TargetingMode get_targeting_mode();
|
||||
void set_targeting_mode(TargetingMode mode);
|
||||
void set_joystick_deadzone(int strength);
|
||||
void apply_joystick_deadzone(float x_in, float y_in, float* x_out, float* y_out);
|
||||
void set_right_analog_suppressed(bool suppressed);
|
||||
|
||||
enum class BackgroundInputMode {
|
||||
On,
|
||||
@ -162,10 +197,6 @@ namespace recomp {
|
||||
|
||||
bool game_input_disabled();
|
||||
bool all_input_disabled();
|
||||
|
||||
// TODO move these
|
||||
void quicksave_save();
|
||||
void quicksave_load();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -14,7 +14,7 @@ namespace Rml {
|
||||
class Event;
|
||||
}
|
||||
|
||||
namespace recomp {
|
||||
namespace recompui {
|
||||
class UiEventListenerInstancer;
|
||||
|
||||
class MenuController {
|
||||
@ -114,6 +114,14 @@ namespace recomp {
|
||||
};
|
||||
|
||||
PromptContext *get_prompt_context(void);
|
||||
|
||||
bool get_cont_active(void);
|
||||
void set_cont_active(bool active);
|
||||
void activate_mouse();
|
||||
|
||||
void message_box(const char* msg);
|
||||
|
||||
void set_render_hooks();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,66 +0,0 @@
|
||||
#ifndef __RSP_H__
|
||||
#define __RSP_H__
|
||||
|
||||
#include "rsp_vu.h"
|
||||
#include "recomp.h"
|
||||
|
||||
enum class RspExitReason {
|
||||
Invalid,
|
||||
Broke,
|
||||
ImemOverrun,
|
||||
UnhandledJumpTarget,
|
||||
Unsupported
|
||||
};
|
||||
|
||||
extern uint8_t dmem[];
|
||||
extern uint16_t rspReciprocals[512];
|
||||
extern uint16_t rspInverseSquareRoots[512];
|
||||
|
||||
#define RSP_MEM_W(offset, addr) \
|
||||
(*reinterpret_cast<uint32_t*>(dmem + (0xFFF & ((offset) + (addr)))))
|
||||
|
||||
#define RSP_MEM_H(offset, addr) \
|
||||
(*reinterpret_cast<int16_t*>(dmem + (0xFFF & (((offset) + (addr)) ^ 2))))
|
||||
|
||||
#define RSP_MEM_HU(offset, addr) \
|
||||
(*reinterpret_cast<uint16_t*>(dmem + (0xFFF & (((offset) + (addr)) ^ 2))))
|
||||
|
||||
#define RSP_MEM_B(offset, addr) \
|
||||
(*reinterpret_cast<int8_t*>(dmem + (0xFFF & (((offset) + (addr)) ^ 3))))
|
||||
|
||||
#define RSP_MEM_BU(offset, addr) \
|
||||
(*reinterpret_cast<uint8_t*>(dmem + (0xFFF & (((offset) + (addr)) ^ 3))))
|
||||
|
||||
#define RSP_ADD32(a, b) \
|
||||
((int32_t)((a) + (b)))
|
||||
|
||||
#define RSP_SUB32(a, b) \
|
||||
((int32_t)((a) - (b)))
|
||||
|
||||
#define RSP_SIGNED(val) \
|
||||
((int32_t)(val))
|
||||
|
||||
#define SET_DMA_DMEM(dmem_addr) dma_dmem_address = (dmem_addr)
|
||||
#define SET_DMA_DRAM(dram_addr) dma_dram_address = (dram_addr)
|
||||
#define DO_DMA_READ(rd_len) dma_rdram_to_dmem(rdram, dma_dmem_address, dma_dram_address, (rd_len))
|
||||
#define DO_DMA_WRITE(wr_len) dma_dmem_to_rdram(rdram, dma_dmem_address, dma_dram_address, (wr_len))
|
||||
|
||||
static inline void dma_rdram_to_dmem(uint8_t* rdram, uint32_t dmem_addr, uint32_t dram_addr, uint32_t rd_len) {
|
||||
rd_len += 1; // Read length is inclusive
|
||||
dram_addr &= 0xFFFFF8;
|
||||
assert(dmem_addr + rd_len <= 0x1000);
|
||||
for (uint32_t i = 0; i < rd_len; i++) {
|
||||
RSP_MEM_B(i, dmem_addr) = MEM_B(0, (int64_t)(int32_t)(dram_addr + i + 0x80000000));
|
||||
}
|
||||
}
|
||||
|
||||
static inline void dma_dmem_to_rdram(uint8_t* rdram, uint32_t dmem_addr, uint32_t dram_addr, uint32_t wr_len) {
|
||||
wr_len += 1; // Write length is inclusive
|
||||
dram_addr &= 0xFFFFF8;
|
||||
assert(dmem_addr + wr_len <= 0x1000);
|
||||
for (uint32_t i = 0; i < wr_len; i++) {
|
||||
MEM_B(0, (int64_t)(int32_t)(dram_addr + i + 0x80000000)) = RSP_MEM_B(i, dmem_addr);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
204
include/rsp_vu.h
204
include/rsp_vu.h
@ -1,204 +0,0 @@
|
||||
// This file is modified from the Ares N64 emulator core. Ares can
|
||||
// be found at https://github.com/ares-emulator/ares. The original license
|
||||
// for this portion of Ares is as follows:
|
||||
// ----------------------------------------------------------------------
|
||||
// ares
|
||||
//
|
||||
// Copyright(c) 2004 - 2021 ares team, Near et al
|
||||
//
|
||||
// Permission to use, copy, modify, and /or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright noticeand this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS.IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
// ----------------------------------------------------------------------
|
||||
#include <cstdint>
|
||||
|
||||
#define ARCHITECTURE_AMD64
|
||||
#define ARCHITECTURE_SUPPORTS_SSE4_1 1
|
||||
|
||||
#if defined(ARCHITECTURE_AMD64)
|
||||
#include <nmmintrin.h>
|
||||
using v128 = __m128i;
|
||||
#elif defined(ARCHITECTURE_ARM64)
|
||||
#include <sse2neon.h>
|
||||
using v128 = __m128i;
|
||||
#endif
|
||||
|
||||
namespace Accuracy {
|
||||
namespace RSP {
|
||||
#if ARCHITECTURE_SUPPORTS_SSE4_1
|
||||
constexpr bool SISD = false;
|
||||
constexpr bool SIMD = true;
|
||||
#else
|
||||
constexpr bool SISD = true;
|
||||
constexpr bool SIMD = false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
using u8 = uint8_t;
|
||||
using s8 = int8_t;
|
||||
using u16 = uint16_t;
|
||||
using s16 = int16_t;
|
||||
using u32 = uint32_t;
|
||||
using s32 = int32_t;
|
||||
using u64 = uint64_t;
|
||||
using s64 = int64_t;
|
||||
using uint128_t = uint64_t[2];
|
||||
|
||||
template<u32 bits> inline auto sclamp(s64 x) -> s64 {
|
||||
enum : s64 { b = 1ull << (bits - 1), m = b - 1 };
|
||||
return (x > m) ? m : (x < -b) ? -b : x;
|
||||
}
|
||||
|
||||
template<u32 bits> inline auto sclip(s64 x) -> s64 {
|
||||
enum : u64 { b = 1ull << (bits - 1), m = b * 2 - 1 };
|
||||
return ((x & m) ^ b) - b;
|
||||
}
|
||||
|
||||
struct RSP {
|
||||
using r32 = uint32_t;
|
||||
using cr32 = const r32;
|
||||
|
||||
union r128 {
|
||||
struct { uint64_t u128[2]; };
|
||||
#if ARCHITECTURE_SUPPORTS_SSE4_1
|
||||
struct { __m128i v128; };
|
||||
|
||||
operator __m128i() const { return v128; }
|
||||
auto operator=(__m128i value) { v128 = value; }
|
||||
#endif
|
||||
|
||||
auto byte(u32 index) -> uint8_t& { return ((uint8_t*)&u128)[15 - index]; }
|
||||
auto byte(u32 index) const -> uint8_t { return ((uint8_t*)&u128)[15 - index]; }
|
||||
|
||||
auto element(u32 index) -> uint16_t& { return ((uint16_t*)&u128)[7 - index]; }
|
||||
auto element(u32 index) const -> uint16_t { return ((uint16_t*)&u128)[7 - index]; }
|
||||
|
||||
auto u8(u32 index) -> uint8_t& { return ((uint8_t*)&u128)[15 - index]; }
|
||||
auto u8(u32 index) const -> uint8_t { return ((uint8_t*)&u128)[15 - index]; }
|
||||
|
||||
auto s16(u32 index) -> int16_t& { return ((int16_t*)&u128)[7 - index]; }
|
||||
auto s16(u32 index) const -> int16_t { return ((int16_t*)&u128)[7 - index]; }
|
||||
|
||||
auto u16(u32 index) -> uint16_t& { return ((uint16_t*)&u128)[7 - index]; }
|
||||
auto u16(u32 index) const -> uint16_t { return ((uint16_t*)&u128)[7 - index]; }
|
||||
|
||||
//VCx registers
|
||||
auto get(u32 index) const -> bool { return u16(index) != 0; }
|
||||
auto set(u32 index, bool value) -> bool { return u16(index) = 0 - value, value; }
|
||||
|
||||
//vu-registers.cpp
|
||||
inline auto operator()(u32 index) const -> r128;
|
||||
};
|
||||
using cr128 = const r128;
|
||||
|
||||
struct VU {
|
||||
r128 r[32];
|
||||
r128 acch, accm, accl;
|
||||
r128 vcoh, vcol; //16-bit little endian
|
||||
r128 vcch, vccl; //16-bit little endian
|
||||
r128 vce; // 8-bit little endian
|
||||
s16 divin;
|
||||
s16 divout;
|
||||
bool divdp;
|
||||
} vpu;
|
||||
|
||||
static constexpr r128 zero{0};
|
||||
static constexpr r128 invert{(uint64_t)-1, (uint64_t)-1};
|
||||
|
||||
inline auto accumulatorGet(u32 index) const -> u64;
|
||||
inline auto accumulatorSet(u32 index, u64 value) -> void;
|
||||
inline auto accumulatorSaturate(u32 index, bool slice, u16 negative, u16 positive) const -> u16;
|
||||
|
||||
inline auto CFC2(r32& rt, u8 rd) -> void;
|
||||
inline auto CTC2(cr32& rt, u8 rd) -> void;
|
||||
template<u8 e> inline auto LBV(r128& vt, cr32& rs, s8 imm) -> void;
|
||||
template<u8 e> inline auto LDV(r128& vt, cr32& rs, s8 imm) -> void;
|
||||
template<u8 e> inline auto LFV(r128& vt, cr32& rs, s8 imm) -> void;
|
||||
template<u8 e> inline auto LHV(r128& vt, cr32& rs, s8 imm) -> void;
|
||||
template<u8 e> inline auto LLV(r128& vt, cr32& rs, s8 imm) -> void;
|
||||
template<u8 e> inline auto LPV(r128& vt, cr32& rs, s8 imm) -> void;
|
||||
template<u8 e> inline auto LQV(r128& vt, cr32& rs, s8 imm) -> void;
|
||||
template<u8 e> inline auto LRV(r128& vt, cr32& rs, s8 imm) -> void;
|
||||
template<u8 e> inline auto LSV(r128& vt, cr32& rs, s8 imm) -> void;
|
||||
template<u8 e> inline auto LTV(u8 vt, cr32& rs, s8 imm) -> void;
|
||||
template<u8 e> inline auto LUV(r128& vt, cr32& rs, s8 imm) -> void;
|
||||
template<u8 e> inline auto LWV(r128& vt, cr32& rs, s8 imm) -> void;
|
||||
template<u8 e> inline auto MFC2(r32& rt, cr128& vs) -> void;
|
||||
template<u8 e> inline auto MTC2(cr32& rt, r128& vs) -> void;
|
||||
template<u8 e> inline auto SBV(cr128& vt, cr32& rs, s8 imm) -> void;
|
||||
template<u8 e> inline auto SDV(cr128& vt, cr32& rs, s8 imm) -> void;
|
||||
template<u8 e> inline auto SFV(cr128& vt, cr32& rs, s8 imm) -> void;
|
||||
template<u8 e> inline auto SHV(cr128& vt, cr32& rs, s8 imm) -> void;
|
||||
template<u8 e> inline auto SLV(cr128& vt, cr32& rs, s8 imm) -> void;
|
||||
template<u8 e> inline auto SPV(cr128& vt, cr32& rs, s8 imm) -> void;
|
||||
template<u8 e> inline auto SQV(cr128& vt, cr32& rs, s8 imm) -> void;
|
||||
template<u8 e> inline auto SRV(cr128& vt, cr32& rs, s8 imm) -> void;
|
||||
template<u8 e> inline auto SSV(cr128& vt, cr32& rs, s8 imm) -> void;
|
||||
template<u8 e> inline auto STV(u8 vt, cr32& rs, s8 imm) -> void;
|
||||
template<u8 e> inline auto SUV(cr128& vt, cr32& rs, s8 imm) -> void;
|
||||
template<u8 e> inline auto SWV(cr128& vt, cr32& rs, s8 imm) -> void;
|
||||
template<u8 e> inline auto VABS(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VADD(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VADDC(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VAND(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VCH(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VCL(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VCR(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VEQ(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VGE(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VLT(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<bool U, u8 e>
|
||||
inline auto VMACF(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VMACF(r128& vd, cr128& vs, cr128& vt) -> void { VMACF<0, e>(vd, vs, vt); }
|
||||
template<u8 e> inline auto VMACU(r128& vd, cr128& vs, cr128& vt) -> void { VMACF<1, e>(vd, vs, vt); }
|
||||
inline auto VMACQ(r128& vd) -> void;
|
||||
template<u8 e> inline auto VMADH(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VMADL(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VMADM(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VMADN(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VMOV(r128& vd, u8 de, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VMRG(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VMUDH(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VMUDL(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VMUDM(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VMUDN(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<bool U, u8 e>
|
||||
inline auto VMULF(r128& rd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VMULF(r128& rd, cr128& vs, cr128& vt) -> void { VMULF<0, e>(rd, vs, vt); }
|
||||
template<u8 e> inline auto VMULU(r128& rd, cr128& vs, cr128& vt) -> void { VMULF<1, e>(rd, vs, vt); }
|
||||
template<u8 e> inline auto VMULQ(r128& rd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VNAND(r128& rd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VNE(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
inline auto VNOP() -> void;
|
||||
template<u8 e> inline auto VNOR(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VNXOR(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VOR(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<bool L, u8 e>
|
||||
inline auto VRCP(r128& vd, u8 de, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VRCP(r128& vd, u8 de, cr128& vt) -> void { VRCP<0, e>(vd, de, vt); }
|
||||
template<u8 e> inline auto VRCPL(r128& vd, u8 de, cr128& vt) -> void { VRCP<1, e>(vd, de, vt); }
|
||||
template<u8 e> inline auto VRCPH(r128& vd, u8 de, cr128& vt) -> void;
|
||||
template<bool D, u8 e>
|
||||
inline auto VRND(r128& vd, u8 vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VRNDN(r128& vd, u8 vs, cr128& vt) -> void { VRND<0, e>(vd, vs, vt); }
|
||||
template<u8 e> inline auto VRNDP(r128& vd, u8 vs, cr128& vt) -> void { VRND<1, e>(vd, vs, vt); }
|
||||
template<bool L, u8 e>
|
||||
inline auto VRSQ(r128& vd, u8 de, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VRSQ(r128& vd, u8 de, cr128& vt) -> void { VRSQ<0, e>(vd, de, vt); }
|
||||
template<u8 e> inline auto VRSQL(r128& vd, u8 de, cr128& vt) -> void { VRSQ<1, e>(vd, de, vt); }
|
||||
template<u8 e> inline auto VRSQH(r128& vd, u8 de, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VSAR(r128& vd, cr128& vs) -> void;
|
||||
template<u8 e> inline auto VSUB(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VSUBC(r128& vd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VXOR(r128& rd, cr128& vs, cr128& vt) -> void;
|
||||
template<u8 e> inline auto VZERO(r128& rd, cr128& vs, cr128& vt) -> void;
|
||||
};
|
File diff suppressed because it is too large
Load Diff
@ -1,38 +0,0 @@
|
||||
#ifndef __RT64_LAYER_H__
|
||||
#define __RT64_LAYER_H__
|
||||
|
||||
#include "../ultramodern/ultramodern.hpp"
|
||||
#include "../ultramodern/config.hpp"
|
||||
|
||||
namespace RT64 {
|
||||
struct Application;
|
||||
}
|
||||
|
||||
namespace ultramodern {
|
||||
struct WindowHandle;
|
||||
struct RT64Context {
|
||||
public:
|
||||
~RT64Context();
|
||||
RT64Context(uint8_t* rdram, WindowHandle window_handle, bool developer_mode);
|
||||
bool valid() { return static_cast<bool>(app); }
|
||||
|
||||
void update_config(const GraphicsConfig& old_config, const GraphicsConfig& new_config);
|
||||
void enable_instant_present();
|
||||
void send_dl(const OSTask* task);
|
||||
void update_screen(uint32_t vi_origin);
|
||||
void shutdown();
|
||||
void set_dummy_vi();
|
||||
uint32_t get_display_framerate();
|
||||
void load_shader_cache(std::span<const char> cache_binary);
|
||||
private:
|
||||
std::unique_ptr<RT64::Application> app;
|
||||
};
|
||||
|
||||
RT64::UserConfiguration::Antialiasing RT64MaxMSAA();
|
||||
bool RT64SamplePositionsSupported();
|
||||
}
|
||||
|
||||
void set_rt64_hooks();
|
||||
|
||||
#endif
|
||||
|
@ -1,23 +0,0 @@
|
||||
#ifndef __SECTIONS_H__
|
||||
#define __SECTIONS_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include "recomp.h"
|
||||
|
||||
#define ARRLEN(x) (sizeof(x) / sizeof((x)[0]))
|
||||
|
||||
typedef struct {
|
||||
recomp_func_t* func;
|
||||
uint32_t offset;
|
||||
} FuncEntry;
|
||||
|
||||
typedef struct {
|
||||
uint32_t rom_addr;
|
||||
uint32_t ram_addr;
|
||||
uint32_t size;
|
||||
FuncEntry *funcs;
|
||||
size_t num_funcs;
|
||||
size_t index;
|
||||
} SectionTableEntry;
|
||||
|
||||
#endif
|
93
include/zelda_config.h
Normal file
93
include/zelda_config.h
Normal file
@ -0,0 +1,93 @@
|
||||
#ifndef __ZELDA_CONFIG_H__
|
||||
#define __ZELDA_CONFIG_H__
|
||||
|
||||
#include <filesystem>
|
||||
#include <string_view>
|
||||
#include "ultramodern/config.hpp"
|
||||
#include "recomp_input.h"
|
||||
|
||||
namespace zelda64 {
|
||||
constexpr std::u8string_view program_id = u8"Zelda64Recompiled";
|
||||
constexpr std::string_view program_name = "Zelda 64: Recompiled";
|
||||
|
||||
// TODO: Move loading configs to the runtime once we have a way to allow per-project customization.
|
||||
void load_config();
|
||||
void save_config();
|
||||
|
||||
void reset_input_bindings();
|
||||
void reset_cont_input_bindings();
|
||||
void reset_kb_input_bindings();
|
||||
void reset_single_input_binding(recomp::InputDevice device, recomp::GameInput input);
|
||||
|
||||
std::filesystem::path get_app_folder_path();
|
||||
|
||||
bool get_debug_mode_enabled();
|
||||
void set_debug_mode_enabled(bool enabled);
|
||||
|
||||
enum class AutosaveMode {
|
||||
On,
|
||||
Off,
|
||||
OptionCount
|
||||
};
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM(zelda64::AutosaveMode, {
|
||||
{zelda64::AutosaveMode::On, "On"},
|
||||
{zelda64::AutosaveMode::Off, "Off"}
|
||||
});
|
||||
|
||||
enum class TargetingMode {
|
||||
Switch,
|
||||
Hold,
|
||||
OptionCount
|
||||
};
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM(zelda64::TargetingMode, {
|
||||
{zelda64::TargetingMode::Switch, "Switch"},
|
||||
{zelda64::TargetingMode::Hold, "Hold"}
|
||||
});
|
||||
|
||||
TargetingMode get_targeting_mode();
|
||||
void set_targeting_mode(TargetingMode mode);
|
||||
|
||||
enum class CameraInvertMode {
|
||||
InvertNone,
|
||||
InvertX,
|
||||
InvertY,
|
||||
InvertBoth,
|
||||
OptionCount
|
||||
};
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM(zelda64::CameraInvertMode, {
|
||||
{zelda64::CameraInvertMode::InvertNone, "InvertNone"},
|
||||
{zelda64::CameraInvertMode::InvertX, "InvertX"},
|
||||
{zelda64::CameraInvertMode::InvertY, "InvertY"},
|
||||
{zelda64::CameraInvertMode::InvertBoth, "InvertBoth"}
|
||||
});
|
||||
|
||||
CameraInvertMode get_camera_invert_mode();
|
||||
void set_camera_invert_mode(CameraInvertMode mode);
|
||||
|
||||
CameraInvertMode get_analog_camera_invert_mode();
|
||||
void set_analog_camera_invert_mode(CameraInvertMode mode);
|
||||
|
||||
enum class AnalogCamMode {
|
||||
On,
|
||||
Off,
|
||||
OptionCount
|
||||
};
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM(zelda64::AnalogCamMode, {
|
||||
{zelda64::AnalogCamMode::On, "On"},
|
||||
{zelda64::AnalogCamMode::Off, "Off"}
|
||||
});
|
||||
|
||||
AutosaveMode get_autosave_mode();
|
||||
void set_autosave_mode(AutosaveMode mode);
|
||||
|
||||
AnalogCamMode get_analog_cam_mode();
|
||||
void set_analog_cam_mode(AnalogCamMode mode);
|
||||
|
||||
void open_quit_game_prompt();
|
||||
};
|
||||
|
||||
#endif
|
@ -1,10 +1,10 @@
|
||||
#ifndef __RECOMP_DEBUG_H__
|
||||
#define __RECOMP_DEBUG_H__
|
||||
#ifndef __ZELDA_DEBUG_H__
|
||||
#define __ZELDA_DEBUG_H__
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace recomp {
|
||||
namespace zelda64 {
|
||||
struct SceneWarps {
|
||||
int index;
|
||||
std::string name;
|
14
include/zelda_game.h
Normal file
14
include/zelda_game.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef __ZELDA_GAME_H__
|
||||
#define __ZELDA_GAME_H__
|
||||
|
||||
#include <cstdint>
|
||||
#include <span>
|
||||
#include <vector>
|
||||
|
||||
namespace zelda64 {
|
||||
void quicksave_save();
|
||||
void quicksave_load();
|
||||
std::vector<uint8_t> decompress_mm(std::span<const uint8_t> compressed_rom);
|
||||
};
|
||||
|
||||
#endif
|
49
include/zelda_render.h
Normal file
49
include/zelda_render.h
Normal file
@ -0,0 +1,49 @@
|
||||
#ifndef __ZELDA_RENDER_H__
|
||||
#define __ZELDA_RENDER_H__
|
||||
|
||||
#include <set>
|
||||
#include <filesystem>
|
||||
|
||||
#include "common/rt64_user_configuration.h"
|
||||
#include "ultramodern/renderer_context.hpp"
|
||||
#include "librecomp/mods.hpp"
|
||||
|
||||
namespace RT64 {
|
||||
struct Application;
|
||||
}
|
||||
|
||||
namespace zelda64 {
|
||||
namespace renderer {
|
||||
class RT64Context final : public ultramodern::renderer::RendererContext {
|
||||
public:
|
||||
~RT64Context() override;
|
||||
RT64Context(uint8_t *rdram, ultramodern::renderer::WindowHandle window_handle, bool developer_mode);
|
||||
|
||||
bool valid() override { return static_cast<bool>(app); }
|
||||
|
||||
bool update_config(const ultramodern::renderer::GraphicsConfig &old_config, const ultramodern::renderer::GraphicsConfig &new_config) override;
|
||||
|
||||
void enable_instant_present() override;
|
||||
void send_dl(const OSTask *task) override;
|
||||
void update_screen(uint32_t vi_origin) override;
|
||||
void shutdown() override;
|
||||
uint32_t get_display_framerate() const override;
|
||||
float get_resolution_scale() const override;
|
||||
|
||||
protected:
|
||||
std::unique_ptr<RT64::Application> app;
|
||||
std::set<std::filesystem::path> enabled_texture_packs;
|
||||
};
|
||||
|
||||
std::unique_ptr<ultramodern::renderer::RendererContext> create_render_context(uint8_t *rdram, ultramodern::renderer::WindowHandle window_handle, bool developer_mode);
|
||||
|
||||
RT64::UserConfiguration::Antialiasing RT64MaxMSAA();
|
||||
bool RT64SamplePositionsSupported();
|
||||
bool RT64HighPrecisionFBEnabled();
|
||||
|
||||
void enable_texture_pack(const recomp::mods::ModHandle& mod);
|
||||
void disable_texture_pack(const recomp::mods::ModHandle& mod);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -1,8 +1,10 @@
|
||||
#ifndef __RECOMP_SOUND_H__
|
||||
#define __RECOMP_SOUND_H__
|
||||
#ifndef __ZELDA_SOUND_H__
|
||||
#define __ZELDA_SOUND_H__
|
||||
|
||||
namespace recomp {
|
||||
namespace zelda64 {
|
||||
void reset_sound_settings();
|
||||
void set_main_volume(int volume);
|
||||
int get_main_volume();
|
||||
void set_bgm_volume(int volume);
|
||||
int get_bgm_volume();
|
||||
void set_low_health_beeps_enabled(bool enabled);
|
22
include/zelda_support.h
Normal file
22
include/zelda_support.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef __ZELDA_SUPPORT_H__
|
||||
#define __ZELDA_SUPPORT_H__
|
||||
|
||||
#include <functional>
|
||||
#include <filesystem>
|
||||
#include <optional>
|
||||
|
||||
namespace zelda64 {
|
||||
std::filesystem::path get_asset_path(const char* asset);
|
||||
void open_file_dialog(std::function<void(bool success, const std::filesystem::path& path)> callback);
|
||||
void show_error_message_box(const char *title, const char *message);
|
||||
|
||||
// Apple specific methods that usually require Objective-C. Implemented in support_apple.mm.
|
||||
#ifdef __APPLE__
|
||||
void dispatch_on_ui_thread(std::function<void()> func);
|
||||
std::optional<std::filesystem::path> get_application_support_directory();
|
||||
std::filesystem::path get_bundle_resource_directory();
|
||||
std::filesystem::path get_bundle_directory();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
1
lib/N64ModernRuntime
Submodule
1
lib/N64ModernRuntime
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit ec56fb39b0d295d9636cb60e252088d7b23c7ac9
|
2
lib/rt64
2
lib/rt64
@ -1 +1 @@
|
||||
Subproject commit 92ae002acf9c344fed5575d6def79fb6a8207181
|
||||
Subproject commit ca146dbd312e91afeacb8e2b0e8702c33db35de6
|
6
njpgdspMain.us.rev1.toml
Normal file
6
njpgdspMain.us.rev1.toml
Normal file
@ -0,0 +1,6 @@
|
||||
text_offset = 0xC438B0
|
||||
text_size = 0xAF0
|
||||
text_address = 0x04001080
|
||||
rom_file_path = "mm.us.rev1.rom_uncompressed.z64"
|
||||
output_file_path = "rsp/njpgdspMain.cpp"
|
||||
output_function_name = "njpgdspMain"
|
13
patches.toml
13
patches.toml
@ -5,5 +5,16 @@
|
||||
elf_path = "patches/patches.elf"
|
||||
output_func_path = "RecompiledPatches"
|
||||
single_file_output = true
|
||||
# Allow absolute symbols to be used as jump targets
|
||||
# Allow absolute symbols to be used as jump targets.
|
||||
use_absolute_symbols = true
|
||||
# Point the recompiler at the symbol files so that it can resolve relocations during recompilation.
|
||||
func_reference_syms_file = "Zelda64RecompSyms/mm.us.rev1.syms.toml"
|
||||
data_reference_syms_files = [ "Zelda64RecompSyms/mm.us.rev1.datasyms.toml", "Zelda64RecompSyms/mm.us.rev1.datasyms_static.toml", "patches/custom_syms.toml" ]
|
||||
# Tell the recompiler to write the output binary. Doing this instead of using objcopy allows the recompiler to patch MIPS32 relocs.
|
||||
output_binary_path = "patches/patches.bin"
|
||||
# Do not emit warnings for unpaired LO16 values, as clang produces many of them.
|
||||
unpaired_lo16_warnings = false
|
||||
# Allow exporting functions and events for mods to use.
|
||||
allow_exports = true
|
||||
# # Enable strict patch mode, validates that patched symbols exist and that non-patch functions aren't symbols.
|
||||
strict_patch_mode = true
|
||||
|
1
patches/.gitignore
vendored
1
patches/.gitignore
vendored
@ -3,3 +3,4 @@
|
||||
*.elf
|
||||
*.bin
|
||||
./funcs.h
|
||||
patches.map
|
||||
|
@ -1,25 +1,18 @@
|
||||
TARGET = patches.elf
|
||||
|
||||
CC := clang
|
||||
LD := ld.lld
|
||||
OBJCOPY := llvm-objcopy
|
||||
CC ?= clang
|
||||
LD ?= ld.lld
|
||||
|
||||
CFLAGS := -target mips -mips2 -mabi=32 -O2 -G0 -mno-abicalls -mno-odd-spreg -mno-check-zero-division \
|
||||
-fomit-frame-pointer -ffast-math -fno-unsafe-math-optimizations -fno-builtin-memset \
|
||||
-Wall -Wextra -Wno-incompatible-library-redeclaration -Wno-unused-parameter -Wno-unknown-pragmas -Wno-unused-variable -Wno-missing-braces -Wno-unsupported-floating-point-opt
|
||||
CPPFLAGS := -nostdinc -D_LANGUAGE_C -DMIPS -I dummy_headers -I ../lib/mm-decomp/include -I ../lib/mm-decomp/src -I ../lib/mm-decomp/assets -I../lib/rt64/include
|
||||
LDFLAGS := -nostdlib -T patches.ld -T syms.ld --just-symbols=../mm.us.rev1.elf --allow-multiple-definition
|
||||
BINFLAGS := -O binary --remove-section=.bss --remove-section=.pad --remove-section=.text
|
||||
LDFLAGS := -nostdlib -T patches.ld -T syms.ld -Map patches.map --unresolved-symbols=ignore-all --emit-relocs
|
||||
|
||||
C_SRCS := $(wildcard *.c)
|
||||
C_OBJS := $(C_SRCS:.c=.o)
|
||||
C_DEPS := $(C_SRCS:.c=.d)
|
||||
|
||||
DATABIN := $(TARGET:.elf=.bin)
|
||||
|
||||
$(DATABIN): $(TARGET)
|
||||
$(OBJCOPY) $(BINFLAGS) $(TARGET) $@
|
||||
|
||||
$(TARGET): $(C_OBJS) patches.ld syms.ld
|
||||
$(LD) $(C_OBJS) $(LDFLAGS) -o $@
|
||||
|
||||
@ -27,7 +20,7 @@ $(C_OBJS): %.o : %.c
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) $< -MMD -MF $(@:.o=.d) -c -o $@
|
||||
|
||||
clean:
|
||||
rm -rf $(C_OBJS) $(TARGET) $(DATABIN)
|
||||
rm -rf $(C_OBJS) $(TARGET) $(C_DEPS)
|
||||
|
||||
-include $(C_DEPS)
|
||||
|
||||
|
@ -8,7 +8,7 @@ extern FaultClient sActorFaultClient;
|
||||
Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play);
|
||||
void ZeldaArena_Free(void* ptr);
|
||||
|
||||
void Actor_CleanupContext(ActorContext* actorCtx, PlayState* play) {
|
||||
RECOMP_PATCH void Actor_CleanupContext(ActorContext* actorCtx, PlayState* play) {
|
||||
s32 i;
|
||||
|
||||
Fault_RemoveClient(&sActorFaultClient);
|
||||
@ -47,7 +47,7 @@ u32 create_actor_transform_id() {
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Actor_Init(Actor* actor, PlayState* play) {
|
||||
RECOMP_PATCH void Actor_Init(Actor* actor, PlayState* play) {
|
||||
Actor_SetWorldToHome(actor);
|
||||
Actor_SetShapeRotToWorld(actor);
|
||||
Actor_SetFocus(actor, 0.0f);
|
||||
@ -135,7 +135,7 @@ Gfx* pop_post_limb_matrix_group(Gfx* dlist, Actor* actor) {
|
||||
/*
|
||||
* Draws the limb at `limbIndex` with a level of detail display lists index by `dListIndex`
|
||||
*/
|
||||
void SkelAnime_DrawLimbLod(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
|
||||
RECOMP_PATCH void SkelAnime_DrawLimbLod(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
|
||||
OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor, s32 lod) {
|
||||
LodLimb* limb;
|
||||
Gfx* dList;
|
||||
@ -197,7 +197,7 @@ void SkelAnime_DrawLimbLod(PlayState* play, s32 limbIndex, void** skeleton, Vec3
|
||||
* Draw all limbs of type `LodLimb` in a given skeleton
|
||||
* Near or far display list is specified via `lod`
|
||||
*/
|
||||
void SkelAnime_DrawLod(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw,
|
||||
RECOMP_PATCH void SkelAnime_DrawLod(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw,
|
||||
PostLimbDrawOpa postLimbDraw, Actor* actor, s32 lod) {
|
||||
LodLimb* rootLimb;
|
||||
s32 pad;
|
||||
@ -261,7 +261,7 @@ void SkelAnime_DrawLod(PlayState* play, void** skeleton, Vec3s* jointTable, Over
|
||||
* Draw a limb of type `LodLimb` contained within a flexible skeleton
|
||||
* Near or far display list is specified via `lod`
|
||||
*/
|
||||
void SkelAnime_DrawFlexLimbLod(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
|
||||
RECOMP_PATCH void SkelAnime_DrawFlexLimbLod(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
|
||||
OverrideLimbDrawFlex overrideLimbDraw, PostLimbDrawFlex postLimbDraw, Actor* actor,
|
||||
s32 lod, Mtx** mtx) {
|
||||
LodLimb* limb;
|
||||
@ -332,7 +332,7 @@ void SkelAnime_DrawFlexLimbLod(PlayState* play, s32 limbIndex, void** skeleton,
|
||||
* Limbs in a flexible skeleton have meshes that can stretch to line up with other limbs.
|
||||
* An array of matrices is dynamically allocated so each limb can access any transform to ensure its meshes line up.
|
||||
*/
|
||||
void SkelAnime_DrawFlexLod(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount,
|
||||
RECOMP_PATCH void SkelAnime_DrawFlexLod(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount,
|
||||
OverrideLimbDrawFlex overrideLimbDraw, PostLimbDrawFlex postLimbDraw, Actor* actor,
|
||||
s32 lod) {
|
||||
LodLimb* rootLimb;
|
||||
@ -403,7 +403,7 @@ void SkelAnime_DrawFlexLod(PlayState* play, void** skeleton, Vec3s* jointTable,
|
||||
/*
|
||||
* Draws the limb of the Skeleton `skeleton` at `limbIndex`
|
||||
*/
|
||||
void SkelAnime_DrawLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
|
||||
RECOMP_PATCH void SkelAnime_DrawLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
|
||||
OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor) {
|
||||
StandardLimb* limb;
|
||||
Gfx* dList;
|
||||
@ -463,7 +463,7 @@ void SkelAnime_DrawLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3
|
||||
/**
|
||||
* Draw all limbs of type `StandardLimb` in a given skeleton to the polyOpa buffer
|
||||
*/
|
||||
void SkelAnime_DrawOpa(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw,
|
||||
RECOMP_PATCH void SkelAnime_DrawOpa(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw,
|
||||
PostLimbDrawOpa postLimbDraw, Actor* actor) {
|
||||
StandardLimb* rootLimb;
|
||||
s32 pad;
|
||||
@ -521,7 +521,7 @@ void SkelAnime_DrawOpa(PlayState* play, void** skeleton, Vec3s* jointTable, Over
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
void SkelAnime_DrawFlexLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
|
||||
RECOMP_PATCH void SkelAnime_DrawFlexLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
|
||||
OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor,
|
||||
Mtx** limbMatricies) {
|
||||
StandardLimb* limb;
|
||||
@ -591,7 +591,7 @@ void SkelAnime_DrawFlexLimbOpa(PlayState* play, s32 limbIndex, void** skeleton,
|
||||
* Limbs in a flexible skeleton have meshes that can stretch to line up with other limbs.
|
||||
* An array of matrices is dynamically allocated so each limb can access any transform to ensure its meshes line up.
|
||||
*/
|
||||
void SkelAnime_DrawFlexOpa(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount,
|
||||
RECOMP_PATCH void SkelAnime_DrawFlexOpa(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount,
|
||||
OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor) {
|
||||
StandardLimb* rootLimb;
|
||||
s32 pad;
|
||||
@ -661,7 +661,7 @@ void SkelAnime_DrawFlexOpa(PlayState* play, void** skeleton, Vec3s* jointTable,
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
void SkelAnime_DrawTransformFlexLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
|
||||
RECOMP_PATCH void SkelAnime_DrawTransformFlexLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
|
||||
OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw,
|
||||
TransformLimbDrawOpa transformLimbDraw, Actor* actor, Mtx** mtx) {
|
||||
StandardLimb* limb;
|
||||
@ -744,7 +744,7 @@ void SkelAnime_DrawTransformFlexLimbOpa(PlayState* play, s32 limbIndex, void** s
|
||||
* coordinates.
|
||||
* Note that the `TransformLimbDraw` does not have a NULL check, so must be provided even if empty.
|
||||
*/
|
||||
void SkelAnime_DrawTransformFlexOpa(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount,
|
||||
RECOMP_PATCH void SkelAnime_DrawTransformFlexOpa(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount,
|
||||
OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw,
|
||||
TransformLimbDrawOpa transformLimbDraw, Actor* actor) {
|
||||
StandardLimb* rootLimb;
|
||||
@ -825,7 +825,7 @@ void SkelAnime_DrawTransformFlexOpa(PlayState* play, void** skeleton, Vec3s* joi
|
||||
* Draws the Skeleton `skeleton`'s limb at index `limbIndex`. Appends all generated graphics commands to
|
||||
* `gfx`. Returns a pointer to the next gfx to be appended to.
|
||||
*/
|
||||
Gfx* SkelAnime_DrawLimb(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
|
||||
RECOMP_PATCH Gfx* SkelAnime_DrawLimb(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
|
||||
OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, Gfx* gfx) {
|
||||
StandardLimb* limb;
|
||||
Gfx* dList;
|
||||
@ -884,7 +884,7 @@ Gfx* SkelAnime_DrawLimb(PlayState* play, s32 limbIndex, void** skeleton, Vec3s*
|
||||
* Draws the Skeleton `skeleton` Appends all generated graphics to `gfx`, and returns a pointer to the
|
||||
* next gfx to be appended to.
|
||||
*/
|
||||
Gfx* SkelAnime_Draw(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw,
|
||||
RECOMP_PATCH Gfx* SkelAnime_Draw(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw,
|
||||
PostLimbDraw postLimbDraw, Actor* actor, Gfx* gfx) {
|
||||
StandardLimb* rootLimb;
|
||||
s32 pad;
|
||||
@ -944,7 +944,7 @@ Gfx* SkelAnime_Draw(PlayState* play, void** skeleton, Vec3s* jointTable, Overrid
|
||||
/**
|
||||
* Draw a limb of type `StandardLimb` contained within a flexible skeleton to the specified display buffer
|
||||
*/
|
||||
Gfx* SkelAnime_DrawFlexLimb(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
|
||||
RECOMP_PATCH Gfx* SkelAnime_DrawFlexLimb(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
|
||||
OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, Mtx** mtx,
|
||||
Gfx* gfx) {
|
||||
StandardLimb* limb;
|
||||
@ -1014,7 +1014,7 @@ Gfx* SkelAnime_DrawFlexLimb(PlayState* play, s32 limbIndex, void** skeleton, Vec
|
||||
* Limbs in a flexible skeleton have meshes that can stretch to line up with other limbs.
|
||||
* An array of matrices is dynamically allocated so each limb can access any transform to ensure its meshes line up.
|
||||
*/
|
||||
Gfx* SkelAnime_DrawFlex(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount,
|
||||
RECOMP_PATCH Gfx* SkelAnime_DrawFlex(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount,
|
||||
OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, Gfx* gfx) {
|
||||
StandardLimb* rootLimb;
|
||||
s32 pad;
|
||||
@ -1085,7 +1085,7 @@ Gfx* SkelAnime_DrawFlex(PlayState* play, void** skeleton, Vec3s* jointTable, s32
|
||||
|
||||
extern MtxF gSkinLimbMatrices[];
|
||||
|
||||
void Skin_DrawImpl(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw,
|
||||
RECOMP_PATCH void Skin_DrawImpl(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw,
|
||||
SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6, s32 drawFlags) {
|
||||
s32 i;
|
||||
SkinLimb** skeleton;
|
||||
@ -1145,7 +1145,7 @@ close_disps:;
|
||||
CLOSE_DISPS(gfxCtx);
|
||||
}
|
||||
|
||||
__attribute__((noinline)) s32 scan_for_matrices(Gfx* start, Gfx* end) {
|
||||
s32 scan_for_matrices(Gfx* start, Gfx* end) {
|
||||
s32 matrix_count = 0;
|
||||
Gfx* cur = start;
|
||||
// Count any G_MTX commands between the start and end commands.
|
||||
@ -1201,7 +1201,7 @@ void tag_actor_displaylists(Actor* actor, PlayState* play, Gfx* opa_start, Gfx*
|
||||
}
|
||||
|
||||
// @recomp Patched to automatically add transform tagging to actor matrices based on what DL commands they write in their draw function
|
||||
void Actor_Draw(PlayState* play, Actor* actor) {
|
||||
RECOMP_PATCH void Actor_Draw(PlayState* play, Actor* actor) {
|
||||
Lights* light;
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
BIN
patches/autosave.rgba32.bin
Normal file
BIN
patches/autosave.rgba32.bin
Normal file
Binary file not shown.
BIN
patches/autosave.rgba32.png
Normal file
BIN
patches/autosave.rgba32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 794 B |
814
patches/autosaving.c
Normal file
814
patches/autosaving.c
Normal file
@ -0,0 +1,814 @@
|
||||
#include "patches.h"
|
||||
#include "play_patches.h"
|
||||
#include "z64save.h"
|
||||
#include "z64horse.h"
|
||||
#include "overlays/gamestates/ovl_file_choose/z_file_select.h"
|
||||
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
|
||||
#include "overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.h"
|
||||
#include "misc_funcs.h"
|
||||
|
||||
#define SAVE_TYPE_AUTOSAVE 2
|
||||
|
||||
u8 gCanPause;
|
||||
s32 ShrinkWindow_Letterbox_GetSizeTarget(void);
|
||||
void ShrinkWindow_Letterbox_SetSizeTarget(s32 target);
|
||||
|
||||
// @recomp Patched function to set a global variable if the player can pause
|
||||
RECOMP_PATCH void KaleidoSetup_Update(PlayState* play) {
|
||||
Input* input = CONTROLLER1(&play->state);
|
||||
MessageContext* msgCtx = &play->msgCtx;
|
||||
Player* player = GET_PLAYER(play);
|
||||
PauseContext* pauseCtx = &play->pauseCtx;
|
||||
|
||||
if (CHECK_BTN_ALL(input->cur.button, BTN_R)) {
|
||||
if (msgCtx && msgCtx) {}
|
||||
}
|
||||
|
||||
if ((pauseCtx->state == PAUSE_STATE_OFF) && (pauseCtx->debugEditor == DEBUG_EDITOR_NONE) &&
|
||||
(play->gameOverCtx.state == GAMEOVER_INACTIVE)) {
|
||||
if ((play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) {
|
||||
if ((gSaveContext.save.cutsceneIndex < 0xFFF0) && (gSaveContext.nextCutsceneIndex < 0xFFF0)) {
|
||||
if (!Play_InCsMode(play) || ((msgCtx->msgMode != MSGMODE_NONE) && (msgCtx->currentTextId == 0xFF))) {
|
||||
if ((play->unk_1887C < 2) && (gSaveContext.magicState != MAGIC_STATE_STEP_CAPACITY) &&
|
||||
(gSaveContext.magicState != MAGIC_STATE_FILL)) {
|
||||
if (!CHECK_EVENTINF(EVENTINF_17) && !(player->stateFlags1 & PLAYER_STATE1_20)) {
|
||||
if (!(play->actorCtx.flags & ACTORCTX_FLAG_TELESCOPE_ON) &&
|
||||
!(play->actorCtx.flags & ACTORCTX_FLAG_PICTO_BOX_ON)) {
|
||||
if (!play->actorCtx.isOverrideInputOn) {
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_START)) {
|
||||
gSaveContext.prevHudVisibility = gSaveContext.hudVisibility;
|
||||
pauseCtx->itemDescriptionOn = false;
|
||||
pauseCtx->state = PAUSE_STATE_OPENING_0;
|
||||
func_800F4A10(play);
|
||||
// Set next page mode to scroll left
|
||||
pauseCtx->nextPageMode = pauseCtx->pageIndex * 2 + 1;
|
||||
Audio_SetPauseState(true);
|
||||
}
|
||||
// @recomp Create a variable to check if the player can pause or not, which is used to determine when to autosave
|
||||
else {
|
||||
gCanPause = true;
|
||||
}
|
||||
}
|
||||
if (pauseCtx->state == PAUSE_STATE_OPENING_0) {
|
||||
GameState_SetFramerateDivisor(&play->state, 2);
|
||||
if (ShrinkWindow_Letterbox_GetSizeTarget() != 0) {
|
||||
ShrinkWindow_Letterbox_SetSizeTarget(0);
|
||||
}
|
||||
Audio_PlaySfx_PauseMenuOpenOrClose(SFX_PAUSE_MENU_OPEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Sram_SyncWriteToFlash(SramContext* sramCtx, s32 curPage, s32 numPages);
|
||||
|
||||
void recomp_reset_autosave_timer();
|
||||
void recomp_reset_autosave_timer_slow();
|
||||
|
||||
RECOMP_EXPORT void recomp_do_autosave(PlayState* play) {
|
||||
// Transfer the scene flags into the cycle flags.
|
||||
Play_SaveCycleSceneFlags(&play->state);
|
||||
// Transfer the cycle flags into the save buffer. Logic copied from func_8014546C.
|
||||
for (s32 i = 0; i < ARRAY_COUNT(gSaveContext.cycleSceneFlags); i++) {
|
||||
gSaveContext.save.saveInfo.permanentSceneFlags[i].chest = gSaveContext.cycleSceneFlags[i].chest;
|
||||
gSaveContext.save.saveInfo.permanentSceneFlags[i].switch0 = gSaveContext.cycleSceneFlags[i].switch0;
|
||||
gSaveContext.save.saveInfo.permanentSceneFlags[i].switch1 = gSaveContext.cycleSceneFlags[i].switch1;
|
||||
gSaveContext.save.saveInfo.permanentSceneFlags[i].clearedRoom = gSaveContext.cycleSceneFlags[i].clearedRoom;
|
||||
gSaveContext.save.saveInfo.permanentSceneFlags[i].collectible = gSaveContext.cycleSceneFlags[i].collectible;
|
||||
}
|
||||
|
||||
s32 fileNum = gSaveContext.fileNum;
|
||||
|
||||
gSaveContext.save.isOwlSave = SAVE_TYPE_AUTOSAVE;
|
||||
|
||||
gSaveContext.save.saveInfo.checksum = 0;
|
||||
gSaveContext.save.saveInfo.checksum = Sram_CalcChecksum(&gSaveContext, offsetof(SaveContext, fileNum));
|
||||
|
||||
SramContext* sramCtx = &play->sramCtx;
|
||||
// Copy the saved parts of the global save context into the sram saving buffer.
|
||||
Lib_MemCpy(sramCtx->saveBuf, &gSaveContext, offsetof(SaveContext, fileNum));
|
||||
// Synchronously save into the owl save slot and the backup owl save slot.
|
||||
Sram_SyncWriteToFlash(sramCtx, gFlashOwlSaveStartPages[fileNum * 2], gFlashOwlSaveNumPages[fileNum * 2]);
|
||||
Sram_SyncWriteToFlash(sramCtx, gFlashOwlSaveStartPages[fileNum * 2 + 1], gFlashOwlSaveNumPages[fileNum * 2 + 1]);
|
||||
|
||||
gSaveContext.save.isOwlSave = false;
|
||||
}
|
||||
|
||||
bool loading_deletes_owl_save = true;
|
||||
|
||||
// @recomp_export void recomp_set_loading_deletes_owl_save(bool new_val): Set whether loading an owl save should also delete it.
|
||||
RECOMP_EXPORT void recomp_set_loading_deletes_owl_save(bool new_val)
|
||||
{
|
||||
loading_deletes_owl_save = new_val;
|
||||
}
|
||||
|
||||
// @recomp Do not clear the save if the save was an autosave, or if mods have disabled save deletion.
|
||||
RECOMP_PATCH void func_80147314(SramContext* sramCtx, s32 fileNum) {
|
||||
s32 save_type = gSaveContext.save.isOwlSave;
|
||||
gSaveContext.save.isOwlSave = false;
|
||||
|
||||
// @recomp Prevent owl save/autosave deletion if autosaving is enabled, and...
|
||||
// @recomp_use_export_var loading_deletes_owl_save: Prevent owl save deletion if mods disable it.
|
||||
if (!recomp_get_autosave_enabled() && loading_deletes_owl_save) {
|
||||
gSaveContext.save.saveInfo.playerData.newf[0] = '\0';
|
||||
gSaveContext.save.saveInfo.playerData.newf[1] = '\0';
|
||||
gSaveContext.save.saveInfo.playerData.newf[2] = '\0';
|
||||
gSaveContext.save.saveInfo.playerData.newf[3] = '\0';
|
||||
gSaveContext.save.saveInfo.playerData.newf[4] = '\0';
|
||||
gSaveContext.save.saveInfo.playerData.newf[5] = '\0';
|
||||
|
||||
gSaveContext.save.saveInfo.checksum = 0;
|
||||
gSaveContext.save.saveInfo.checksum = Sram_CalcChecksum(&gSaveContext, offsetof(SaveContext, fileNum));
|
||||
|
||||
Lib_MemCpy(sramCtx->saveBuf, &gSaveContext, offsetof(SaveContext, fileNum));
|
||||
Sram_SyncWriteToFlash(sramCtx, gFlashOwlSaveStartPages[fileNum * 2], gFlashOwlSaveNumPages[fileNum * 2]);
|
||||
//! Note: should be `gFlashOwlSaveNumPages[fileNum * 2 + 1]`?
|
||||
Sram_SyncWriteToFlash(sramCtx, gFlashOwlSaveStartPages[fileNum * 2 + 1], gFlashOwlSaveNumPages[fileNum * 2]);
|
||||
|
||||
gSaveContext.save.isOwlSave = true;
|
||||
|
||||
gSaveContext.save.saveInfo.playerData.newf[0] = 'Z';
|
||||
gSaveContext.save.saveInfo.playerData.newf[1] = 'E';
|
||||
gSaveContext.save.saveInfo.playerData.newf[2] = 'L';
|
||||
gSaveContext.save.saveInfo.playerData.newf[3] = 'D';
|
||||
gSaveContext.save.saveInfo.playerData.newf[4] = 'A';
|
||||
gSaveContext.save.saveInfo.playerData.newf[5] = '3';
|
||||
}
|
||||
}
|
||||
|
||||
void delete_owl_save(SramContext* sramCtx, s32 fileNum) {
|
||||
gSaveContext.save.saveInfo.playerData.newf[0] = '\0';
|
||||
gSaveContext.save.saveInfo.playerData.newf[1] = '\0';
|
||||
gSaveContext.save.saveInfo.playerData.newf[2] = '\0';
|
||||
gSaveContext.save.saveInfo.playerData.newf[3] = '\0';
|
||||
gSaveContext.save.saveInfo.playerData.newf[4] = '\0';
|
||||
gSaveContext.save.saveInfo.playerData.newf[5] = '\0';
|
||||
|
||||
gSaveContext.save.saveInfo.checksum = 0;
|
||||
gSaveContext.save.saveInfo.checksum = Sram_CalcChecksum(&gSaveContext, offsetof(SaveContext, fileNum));
|
||||
|
||||
Lib_MemCpy(sramCtx->saveBuf, &gSaveContext, offsetof(SaveContext, fileNum));
|
||||
Sram_SyncWriteToFlash(sramCtx, gFlashOwlSaveStartPages[fileNum * 2], gFlashOwlSaveNumPages[fileNum * 2]);
|
||||
Sram_SyncWriteToFlash(sramCtx, gFlashOwlSaveStartPages[fileNum * 2 + 1], gFlashOwlSaveNumPages[fileNum * 2 + 1]);
|
||||
|
||||
gSaveContext.save.saveInfo.playerData.newf[0] = 'Z';
|
||||
gSaveContext.save.saveInfo.playerData.newf[1] = 'E';
|
||||
gSaveContext.save.saveInfo.playerData.newf[2] = 'L';
|
||||
gSaveContext.save.saveInfo.playerData.newf[3] = 'D';
|
||||
gSaveContext.save.saveInfo.playerData.newf[4] = 'A';
|
||||
gSaveContext.save.saveInfo.playerData.newf[5] = '3';
|
||||
}
|
||||
|
||||
// @recomp Patched to delete owl saves when making regular saves.
|
||||
RECOMP_PATCH void func_8014546C(SramContext* sramCtx) {
|
||||
s32 i;
|
||||
|
||||
if (gSaveContext.save.isOwlSave) {
|
||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.cycleSceneFlags); i++) {
|
||||
gSaveContext.save.saveInfo.permanentSceneFlags[i].chest = gSaveContext.cycleSceneFlags[i].chest;
|
||||
gSaveContext.save.saveInfo.permanentSceneFlags[i].switch0 = gSaveContext.cycleSceneFlags[i].switch0;
|
||||
gSaveContext.save.saveInfo.permanentSceneFlags[i].switch1 = gSaveContext.cycleSceneFlags[i].switch1;
|
||||
gSaveContext.save.saveInfo.permanentSceneFlags[i].clearedRoom = gSaveContext.cycleSceneFlags[i].clearedRoom;
|
||||
gSaveContext.save.saveInfo.permanentSceneFlags[i].collectible = gSaveContext.cycleSceneFlags[i].collectible;
|
||||
}
|
||||
|
||||
gSaveContext.save.saveInfo.checksum = 0;
|
||||
gSaveContext.save.saveInfo.checksum = Sram_CalcChecksum(&gSaveContext, offsetof(SaveContext, fileNum));
|
||||
|
||||
Lib_MemCpy(sramCtx->saveBuf, &gSaveContext, offsetof(SaveContext, fileNum));
|
||||
} else {
|
||||
// @recomp Delete the owl save.
|
||||
delete_owl_save(sramCtx, gSaveContext.fileNum);
|
||||
// @recomp Reset the autosave timer.
|
||||
recomp_reset_autosave_timer();
|
||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.cycleSceneFlags); i++) {
|
||||
gSaveContext.save.saveInfo.permanentSceneFlags[i].chest = gSaveContext.cycleSceneFlags[i].chest;
|
||||
gSaveContext.save.saveInfo.permanentSceneFlags[i].switch0 = gSaveContext.cycleSceneFlags[i].switch0;
|
||||
gSaveContext.save.saveInfo.permanentSceneFlags[i].switch1 = gSaveContext.cycleSceneFlags[i].switch1;
|
||||
gSaveContext.save.saveInfo.permanentSceneFlags[i].clearedRoom = gSaveContext.cycleSceneFlags[i].clearedRoom;
|
||||
gSaveContext.save.saveInfo.permanentSceneFlags[i].collectible = gSaveContext.cycleSceneFlags[i].collectible;
|
||||
}
|
||||
|
||||
gSaveContext.save.saveInfo.checksum = 0;
|
||||
gSaveContext.save.saveInfo.checksum = Sram_CalcChecksum(&gSaveContext.save, sizeof(Save));
|
||||
|
||||
if (gSaveContext.flashSaveAvailable) {
|
||||
Lib_MemCpy(sramCtx->saveBuf, &gSaveContext, sizeof(Save));
|
||||
Lib_MemCpy(&sramCtx->saveBuf[0x2000], &gSaveContext.save, sizeof(Save));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern u16 D_801F6AF0;
|
||||
extern u8 D_801F6AF2;
|
||||
|
||||
// @recomp Patched to call the new owl save deletion function.
|
||||
RECOMP_PATCH void Sram_EraseSave(FileSelectState* fileSelect2, SramContext* sramCtx, s32 fileNum) {
|
||||
FileSelectState* fileSelect = fileSelect2;
|
||||
s32 pad;
|
||||
|
||||
if (gSaveContext.flashSaveAvailable) {
|
||||
if (fileSelect->isOwlSave[fileNum + 2]) {
|
||||
// @recomp Call the new owl save deletion function.
|
||||
delete_owl_save(sramCtx, fileNum);
|
||||
fileSelect->isOwlSave[fileNum + 2] = false;
|
||||
}
|
||||
bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE);
|
||||
Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, sizeof(Save));
|
||||
}
|
||||
|
||||
gSaveContext.save.time = D_801F6AF0;
|
||||
gSaveContext.flashSaveAvailable = D_801F6AF2;
|
||||
}
|
||||
|
||||
SaveContext prev_save_ctx;
|
||||
int bcmp_recomp(void* __s1, void* __s2, int __n);
|
||||
|
||||
#define SAVE_COMPARE_MEMBER(ctx1, ctx2, member) \
|
||||
if ((ctx1)->member != ((ctx2)->member)) { \
|
||||
return true; \
|
||||
}
|
||||
|
||||
#define SAVE_COMPARE_MEMBER_ARRAY(ctx1, ctx2, member) \
|
||||
if (bcmp_recomp(&(ctx1)->member, &(ctx2)->member, sizeof((ctx1)->member))) { \
|
||||
recomp_printf(#member " differed\n"); \
|
||||
return true; \
|
||||
}
|
||||
|
||||
bool autosave_compare_saves(SaveContext* a, SaveContext* b) {
|
||||
SAVE_COMPARE_MEMBER_ARRAY(a, b, save.saveInfo.playerData.healthCapacity);
|
||||
SAVE_COMPARE_MEMBER_ARRAY(a, b, save.saveInfo.playerData.isMagicAcquired);
|
||||
SAVE_COMPARE_MEMBER_ARRAY(a, b, save.saveInfo.playerData.isDoubleMagicAcquired);
|
||||
SAVE_COMPARE_MEMBER_ARRAY(a, b, save.saveInfo.playerData.doubleDefense);
|
||||
SAVE_COMPARE_MEMBER_ARRAY(a, b, save.saveInfo.playerData.owlActivationFlags);
|
||||
SAVE_COMPARE_MEMBER_ARRAY(a, b, save.saveInfo.inventory.items);
|
||||
SAVE_COMPARE_MEMBER_ARRAY(a, b, save.saveInfo.inventory.upgrades);
|
||||
SAVE_COMPARE_MEMBER_ARRAY(a, b, save.saveInfo.inventory.questItems);
|
||||
SAVE_COMPARE_MEMBER_ARRAY(a, b, save.saveInfo.inventory.dungeonItems);
|
||||
SAVE_COMPARE_MEMBER_ARRAY(a, b, save.saveInfo.inventory.dungeonKeys);
|
||||
SAVE_COMPARE_MEMBER_ARRAY(a, b, save.saveInfo.inventory.strayFairies);
|
||||
SAVE_COMPARE_MEMBER_ARRAY(a, b, save.saveInfo.permanentSceneFlags);
|
||||
SAVE_COMPARE_MEMBER_ARRAY(a, b, save.saveInfo.dekuPlaygroundHighScores);
|
||||
SAVE_COMPARE_MEMBER_ARRAY(a, b, save.saveInfo.scenesVisible);
|
||||
SAVE_COMPARE_MEMBER_ARRAY(a, b, save.saveInfo.stolenItems);
|
||||
SAVE_COMPARE_MEMBER_ARRAY(a, b, save.saveInfo.highScores);
|
||||
SAVE_COMPARE_MEMBER_ARRAY(a, b, save.saveInfo.weekEventReg);
|
||||
SAVE_COMPARE_MEMBER_ARRAY(a, b, save.saveInfo.regionsVisited);
|
||||
SAVE_COMPARE_MEMBER_ARRAY(a, b, save.saveInfo.worldMapCloudVisibility);
|
||||
SAVE_COMPARE_MEMBER_ARRAY(a, b, save.saveInfo.scarecrowSpawnSongSet);
|
||||
SAVE_COMPARE_MEMBER_ARRAY(a, b, save.saveInfo.scarecrowSpawnSong);
|
||||
// SAVE_COMPARE_MEMBER_ARRAY(a, b, eventInf);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Gfx* Gfx_DrawRect_DropShadow(Gfx* gfx, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy,
|
||||
s16 r, s16 g, s16 b, s16 a);
|
||||
|
||||
int autosave_icon_counter = 0;
|
||||
|
||||
#define AUTOSAVE_ICON_FADE_OUT_FRAMES 5
|
||||
#define AUTOSAVE_ICON_FADE_IN_FRAMES 5
|
||||
#define AUTOSAVE_ICON_SHOW_FRAMES 30
|
||||
#define AUTOSAVE_ICON_TOTAL_FRAMES (AUTOSAVE_ICON_FADE_IN_FRAMES + AUTOSAVE_ICON_SHOW_FRAMES + AUTOSAVE_ICON_FADE_OUT_FRAMES)
|
||||
|
||||
#define AUTOSAVE_ICON_WIDTH 24
|
||||
#define AUTOSAVE_ICON_HEIGHT 16
|
||||
#define AUTOSAVE_ICON_DRAW_WIDTH (AUTOSAVE_ICON_WIDTH * 3 / 4)
|
||||
#define AUTOSAVE_ICON_DRAW_HEIGHT (AUTOSAVE_ICON_HEIGHT * 3 / 4)
|
||||
#define AUTOSAVE_ICON_X (SCREEN_WIDTH - AUTOSAVE_ICON_DRAW_WIDTH - 4)
|
||||
#define AUTOSAVE_ICON_Y (SCREEN_HEIGHT - AUTOSAVE_ICON_DRAW_HEIGHT - 4)
|
||||
|
||||
INCBIN(autosave_icon, "autosave.rgba32.bin");
|
||||
|
||||
Gfx* GfxEx_DrawRect_DropShadow(Gfx* gfx, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy,
|
||||
s16 r, s16 g, s16 b, s16 a, u16 origin) {
|
||||
s16 dropShadowAlpha = a;
|
||||
|
||||
if (a > 100) {
|
||||
dropShadowAlpha = 100;
|
||||
}
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, dropShadowAlpha);
|
||||
gEXTextureRectangle(gfx++, origin, origin, (rectLeft + 2) * 4, (rectTop + 2) * 4, (rectLeft + rectWidth + 2) * 4,
|
||||
(rectTop + rectHeight + 2) * 4, G_TX_RENDERTILE, 0, 0, dsdx, dtdy);
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
gDPSetPrimColor(gfx++, 0, 0, r, g, b, a);
|
||||
|
||||
gEXTextureRectangle(gfx++, origin, origin, rectLeft * 4, rectTop * 4, (rectLeft + rectWidth) * 4, (rectTop + rectHeight) * 4,
|
||||
G_TX_RENDERTILE, 0, 0, dsdx, dtdy);
|
||||
|
||||
return gfx;
|
||||
}
|
||||
|
||||
bool autosave_was_ready = false;
|
||||
|
||||
s32 recomp_autosave_debug_enabled() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void draw_autosave_icon(PlayState* play) {
|
||||
s32 alpha = 0;
|
||||
if (autosave_icon_counter > (AUTOSAVE_ICON_SHOW_FRAMES + AUTOSAVE_ICON_FADE_OUT_FRAMES)) {
|
||||
alpha = (255 * (AUTOSAVE_ICON_FADE_IN_FRAMES - (autosave_icon_counter - AUTOSAVE_ICON_SHOW_FRAMES - AUTOSAVE_ICON_FADE_OUT_FRAMES))) / AUTOSAVE_ICON_FADE_IN_FRAMES;
|
||||
}
|
||||
else if (autosave_icon_counter > AUTOSAVE_ICON_FADE_OUT_FRAMES) {
|
||||
alpha = 255;
|
||||
}
|
||||
else if (autosave_icon_counter > 0) {
|
||||
alpha = (255 * autosave_icon_counter) / AUTOSAVE_ICON_FADE_OUT_FRAMES;
|
||||
}
|
||||
|
||||
if (autosave_icon_counter > 0) {
|
||||
autosave_icon_counter--;
|
||||
}
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
if (alpha != 0) {
|
||||
gEXForceUpscale2D(OVERLAY_DISP++, 1);
|
||||
gDPLoadTextureBlock(OVERLAY_DISP++, autosave_icon, G_IM_FMT_RGBA, G_IM_SIZ_32b, AUTOSAVE_ICON_WIDTH, AUTOSAVE_ICON_HEIGHT, 0,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
|
||||
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
|
||||
OVERLAY_DISP = GfxEx_DrawRect_DropShadow(OVERLAY_DISP, AUTOSAVE_ICON_X - SCREEN_WIDTH, AUTOSAVE_ICON_Y, AUTOSAVE_ICON_DRAW_WIDTH, AUTOSAVE_ICON_DRAW_HEIGHT,
|
||||
(s32)(1024.0f * AUTOSAVE_ICON_WIDTH / AUTOSAVE_ICON_DRAW_WIDTH), (s32)(1024.0f * AUTOSAVE_ICON_HEIGHT / AUTOSAVE_ICON_DRAW_HEIGHT),
|
||||
255, 255, 255, alpha, G_EX_ORIGIN_RIGHT);
|
||||
gEXForceUpscale2D(OVERLAY_DISP++, 0);
|
||||
}
|
||||
|
||||
if (recomp_autosave_debug_enabled() && autosave_was_ready) {
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 0, 0, 255);
|
||||
gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE);
|
||||
gEXFillRectangle(OVERLAY_DISP++, G_EX_ORIGIN_LEFT, G_EX_ORIGIN_LEFT, 0, SCREEN_HEIGHT - 10, 20, SCREEN_HEIGHT);
|
||||
}
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
RECOMP_EXPORT void recomp_show_autosave_icon() {
|
||||
autosave_icon_counter = AUTOSAVE_ICON_TOTAL_FRAMES;
|
||||
}
|
||||
|
||||
RECOMP_EXPORT u32 recomp_autosave_interval() {
|
||||
return 2 * 60 * 1000;
|
||||
}
|
||||
|
||||
#define MIN_FRAMES_SINCE_CHANGED 10
|
||||
#define MIN_FRAMES_SINCE_READY 20
|
||||
OSTime last_autosave_time = 0;
|
||||
u32 extra_autosave_delay_milliseconds = 0;
|
||||
|
||||
bool reached_final_three_hours() {
|
||||
// Logic copied with modifications from Interface_DrawClock.
|
||||
if ((CURRENT_DAY >= 4) ||
|
||||
((CURRENT_DAY == 3) && (CURRENT_TIME >= CLOCK_TIME(3, 0)) && (CURRENT_TIME < CLOCK_TIME(6, 0)))
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
RECOMP_EXPORT void recomp_reset_autosave_timer() {
|
||||
last_autosave_time = osGetTime();
|
||||
extra_autosave_delay_milliseconds = 0;
|
||||
}
|
||||
|
||||
RECOMP_EXPORT void recomp_reset_autosave_timer_slow() {
|
||||
// Set the most recent autosave time in the future to give extra time before an autosave triggers.
|
||||
last_autosave_time = osGetTime();
|
||||
extra_autosave_delay_milliseconds = 2 * 60 * 1000;
|
||||
}
|
||||
|
||||
void autosave_post_play_update(PlayState* play) {
|
||||
static int frames_since_save_changed = 0;
|
||||
static int frames_since_autosave_ready = 0;
|
||||
if (recomp_get_autosave_enabled()) {
|
||||
if (autosave_compare_saves(&gSaveContext, &prev_save_ctx)) {
|
||||
frames_since_save_changed = 0;
|
||||
Lib_MemCpy(&prev_save_ctx, &gSaveContext, offsetof(SaveContext, fileNum));
|
||||
}
|
||||
else {
|
||||
frames_since_save_changed++;
|
||||
}
|
||||
|
||||
OSTime time_now = osGetTime();
|
||||
|
||||
// Check the following conditions:
|
||||
// * The UI is in a normal state.
|
||||
// * Time is passing.
|
||||
// * No message is on screen.
|
||||
// * The game is not paused.
|
||||
// * No cutscene is running.
|
||||
// * The game is not in cutscene mode.
|
||||
// * The clock has not reached the final 3 hours.
|
||||
// * The player is allowed to pause.
|
||||
if (gSaveContext.hudVisibility == HUD_VISIBILITY_ALL &&
|
||||
R_TIME_SPEED != 0 &&
|
||||
!Environment_IsTimeStopped() &&
|
||||
play->msgCtx.msgMode == MSGMODE_NONE &&
|
||||
play->pauseCtx.state == PAUSE_STATE_OFF &&
|
||||
gSaveContext.save.cutsceneIndex < 0xFFF0 &&
|
||||
!Play_InCsMode(play) &&
|
||||
!reached_final_three_hours() &&
|
||||
gCanPause
|
||||
) {
|
||||
frames_since_autosave_ready++;
|
||||
autosave_was_ready = true;
|
||||
}
|
||||
else {
|
||||
frames_since_autosave_ready = 0;
|
||||
autosave_was_ready = false;
|
||||
}
|
||||
|
||||
// Check if the frame count thresholds for the save data remaining unchanged and autosaving being ready have both been met
|
||||
// and that enough time has passed since the previous autosave to create a new one.
|
||||
if (frames_since_save_changed >= MIN_FRAMES_SINCE_CHANGED &&
|
||||
frames_since_autosave_ready >= MIN_FRAMES_SINCE_READY &&
|
||||
time_now - last_autosave_time > (OS_USEC_TO_CYCLES(1000 * (recomp_autosave_interval() + extra_autosave_delay_milliseconds)))
|
||||
) {
|
||||
recomp_do_autosave(play);
|
||||
recomp_show_autosave_icon();
|
||||
recomp_reset_autosave_timer();
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Update the last autosave time to the current time to prevent autosaving immediately if autosaves are turned back on.
|
||||
recomp_reset_autosave_timer();
|
||||
}
|
||||
gCanPause = false;
|
||||
}
|
||||
|
||||
void autosave_init() {
|
||||
recomp_reset_autosave_timer_slow();
|
||||
Lib_MemCpy(&prev_save_ctx, &gSaveContext, offsetof(SaveContext, fileNum));
|
||||
}
|
||||
|
||||
extern s32 gFlashSaveSizes[];
|
||||
extern u16 D_801C6A58[];
|
||||
|
||||
#define CHECK_NEWF(newf) \
|
||||
((newf)[0] != 'Z' || (newf)[1] != 'E' || (newf)[2] != 'L' || (newf)[3] != 'D' || (newf)[4] != 'A' || \
|
||||
(newf)[5] != '3')
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s16 csId;
|
||||
/* 0x02 */ s16 length;
|
||||
/* 0x04 */ s16 endCsId;
|
||||
/* 0x06 */ s16 subCamId;
|
||||
/* 0x08 */ Actor* targetActor;
|
||||
/* 0x0C */ s32 startMethod;
|
||||
/* 0x10 */ PlayState* play;
|
||||
/* 0x14 */ s16 retCamId;
|
||||
/* 0x16 */ s16 isCameraStored;
|
||||
} CutsceneManager; // size = 0x18
|
||||
|
||||
extern CutsceneManager sCutsceneMgr;
|
||||
extern ActorCutscene* sSceneCutsceneList;
|
||||
extern s16 sSceneCutsceneCount;
|
||||
|
||||
bool skip_entry_cutscene = false;
|
||||
|
||||
// @recomp Patched to skip the entrance cutscene if the flag is enabled.
|
||||
RECOMP_PATCH s16 CutsceneManager_FindEntranceCsId(void) {
|
||||
PlayState* play;
|
||||
s32 csId;
|
||||
|
||||
for (csId = 0; csId < sSceneCutsceneCount; csId++) {
|
||||
//! FAKE:
|
||||
if ((sSceneCutsceneList[csId].scriptIndex != CS_SCRIPT_ID_NONE) &&
|
||||
(sSceneCutsceneList[csId].scriptIndex < (play = sCutsceneMgr.play)->csCtx.scriptListCount) &&
|
||||
(sCutsceneMgr.play->curSpawn ==
|
||||
sCutsceneMgr.play->csCtx.scriptList[sSceneCutsceneList[csId].scriptIndex].spawn)) {
|
||||
|
||||
// @recomp Check if the entry cutscene should be skipped and do so.
|
||||
if (skip_entry_cutscene) {
|
||||
skip_entry_cutscene = false;
|
||||
return -1;
|
||||
}
|
||||
return csId;
|
||||
}
|
||||
}
|
||||
|
||||
for (csId = 0; csId < sSceneCutsceneCount; csId++) {
|
||||
if ((sSceneCutsceneList[csId].customValue >= 100) &&
|
||||
(sSceneCutsceneList[csId].customValue == (sCutsceneMgr.play->curSpawn + 100))) {
|
||||
return csId;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
s32 spawn_entrance_from_autosave_entrance(s16 autosave_entrance) {
|
||||
s32 scene_id = Entrance_GetSceneIdAbsolute(gSaveContext.save.entrance);
|
||||
recomp_printf("Loaded entrance: %d in scene: %d\n", autosave_entrance, scene_id);
|
||||
|
||||
switch (scene_id) {
|
||||
default:
|
||||
return ENTRANCE(SOUTH_CLOCK_TOWN, 0);
|
||||
case SCENE_MITURIN: // Woodfall Temple
|
||||
case SCENE_MITURIN_BS: // Odolwa's Lair
|
||||
return ENTRANCE(WOODFALL_TEMPLE, 0);
|
||||
case SCENE_HAKUGIN: // Snowhead Temple
|
||||
case SCENE_HAKUGIN_BS: // Goht's Lair
|
||||
return ENTRANCE(SNOWHEAD_TEMPLE, 0);
|
||||
case SCENE_SEA: // Great Bay Temple
|
||||
case SCENE_SEA_BS: // Gyorg's Lair
|
||||
return ENTRANCE(GREAT_BAY_TEMPLE, 0);
|
||||
case SCENE_INISIE_N: // Stone Tower Temple
|
||||
return ENTRANCE(STONE_TOWER_TEMPLE, 0);
|
||||
case SCENE_INISIE_R: // Inverted Stone Tower Temple
|
||||
case SCENE_INISIE_BS: // Twinmold's Lair
|
||||
return ENTRANCE(STONE_TOWER_TEMPLE_INVERTED, 0);
|
||||
}
|
||||
}
|
||||
|
||||
RECOMP_DECLARE_EVENT(recomp_on_load_save(FileSelectState* fileSelect, SramContext* sramCtx));
|
||||
RECOMP_DECLARE_EVENT(recomp_after_load_save(FileSelectState* fileSelect, SramContext* sramCtx));
|
||||
|
||||
// @recomp Patched to change the entrance for autosaves and initialize autosaves.
|
||||
RECOMP_PATCH void Sram_OpenSave(FileSelectState* fileSelect, SramContext* sramCtx) {
|
||||
s32 i;
|
||||
s32 pad;
|
||||
s32 phi_t1 = 0;
|
||||
s32 pad1;
|
||||
s32 fileNum;
|
||||
|
||||
// @recomp_event recomp_on_load_save(FileSelectState* fileSelect, SramContext* sramCtx): A save-file was just chosen.
|
||||
recomp_on_load_save(fileSelect, sramCtx);
|
||||
|
||||
if (gSaveContext.flashSaveAvailable) {
|
||||
bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE);
|
||||
|
||||
if (gSaveContext.fileNum == 0xFF) {
|
||||
SysFlashrom_ReadData(sramCtx->saveBuf, gFlashSaveStartPages[0], gFlashSaveNumPages[0]);
|
||||
} else if (fileSelect->isOwlSave[gSaveContext.fileNum + 2]) {
|
||||
phi_t1 = gSaveContext.fileNum + 2;
|
||||
phi_t1 *= 2;
|
||||
|
||||
if (SysFlashrom_ReadData(sramCtx->saveBuf, gFlashSaveStartPages[phi_t1], gFlashSaveNumPages[phi_t1]) != 0) {
|
||||
SysFlashrom_ReadData(sramCtx->saveBuf, gFlashSaveStartPages[phi_t1 + 1],
|
||||
gFlashSaveNumPages[phi_t1 + 1]);
|
||||
}
|
||||
} else {
|
||||
phi_t1 = gSaveContext.fileNum;
|
||||
phi_t1 *= 2;
|
||||
|
||||
if (SysFlashrom_ReadData(sramCtx->saveBuf, gFlashSaveStartPages[phi_t1], gFlashSaveNumPages[phi_t1]) != 0) {
|
||||
SysFlashrom_ReadData(sramCtx->saveBuf, gFlashSaveStartPages[phi_t1 + 1],
|
||||
gFlashSaveNumPages[phi_t1 + 1]);
|
||||
}
|
||||
}
|
||||
|
||||
Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, gFlashSaveSizes[phi_t1]);
|
||||
|
||||
if (CHECK_NEWF(gSaveContext.save.saveInfo.playerData.newf)) {
|
||||
SysFlashrom_ReadData(sramCtx->saveBuf, gFlashSaveStartPages[phi_t1 + 1], gFlashSaveNumPages[phi_t1 + 1]);
|
||||
Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, gFlashSaveSizes[phi_t1]);
|
||||
}
|
||||
}
|
||||
|
||||
gSaveContext.save.saveInfo.playerData.magicLevel = 0;
|
||||
|
||||
if (!gSaveContext.save.isOwlSave) {
|
||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.eventInf); i++) {
|
||||
gSaveContext.eventInf[i] = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.cycleSceneFlags); i++) {
|
||||
gSaveContext.cycleSceneFlags[i].chest = gSaveContext.save.saveInfo.permanentSceneFlags[i].chest;
|
||||
gSaveContext.cycleSceneFlags[i].switch0 = gSaveContext.save.saveInfo.permanentSceneFlags[i].switch0;
|
||||
gSaveContext.cycleSceneFlags[i].switch1 = gSaveContext.save.saveInfo.permanentSceneFlags[i].switch1;
|
||||
gSaveContext.cycleSceneFlags[i].clearedRoom = gSaveContext.save.saveInfo.permanentSceneFlags[i].clearedRoom;
|
||||
gSaveContext.cycleSceneFlags[i].collectible = gSaveContext.save.saveInfo.permanentSceneFlags[i].collectible;
|
||||
}
|
||||
|
||||
for (i = 0; i < TIMER_ID_MAX; i++) {
|
||||
gSaveContext.timerStates[i] = TIMER_STATE_OFF;
|
||||
gSaveContext.timerCurTimes[i] = SECONDS_TO_TIMER(0);
|
||||
gSaveContext.timerTimeLimits[i] = SECONDS_TO_TIMER(0);
|
||||
gSaveContext.timerStartOsTimes[i] = 0;
|
||||
gSaveContext.timerStopTimes[i] = SECONDS_TO_TIMER(0);
|
||||
gSaveContext.timerPausedOsTimes[i] = 0;
|
||||
}
|
||||
|
||||
if (gSaveContext.save.isFirstCycle) {
|
||||
gSaveContext.save.entrance = ENTRANCE(SOUTH_CLOCK_TOWN, 0);
|
||||
gSaveContext.save.day = 0;
|
||||
gSaveContext.save.time = CLOCK_TIME(6, 0) - 1;
|
||||
} else {
|
||||
gSaveContext.save.entrance = ENTRANCE(CUTSCENE, 0);
|
||||
gSaveContext.nextCutsceneIndex = 0;
|
||||
gSaveContext.save.playerForm = PLAYER_FORM_HUMAN;
|
||||
}
|
||||
}
|
||||
// @recomp Handle autosaves.
|
||||
else if (gSaveContext.save.isOwlSave == SAVE_TYPE_AUTOSAVE) {
|
||||
gSaveContext.save.entrance = spawn_entrance_from_autosave_entrance(gSaveContext.save.entrance);
|
||||
|
||||
// Skip the turtle cutscene that happens when entering Great Bay Temple.
|
||||
if (gSaveContext.save.entrance == ENTRANCE(GREAT_BAY_TEMPLE, 0)) {
|
||||
skip_entry_cutscene = true;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.cycleSceneFlags); i++) {
|
||||
gSaveContext.cycleSceneFlags[i].chest = gSaveContext.save.saveInfo.permanentSceneFlags[i].chest;
|
||||
gSaveContext.cycleSceneFlags[i].switch0 = gSaveContext.save.saveInfo.permanentSceneFlags[i].switch0;
|
||||
gSaveContext.cycleSceneFlags[i].switch1 = gSaveContext.save.saveInfo.permanentSceneFlags[i].switch1;
|
||||
gSaveContext.cycleSceneFlags[i].clearedRoom = gSaveContext.save.saveInfo.permanentSceneFlags[i].clearedRoom;
|
||||
gSaveContext.cycleSceneFlags[i].collectible = gSaveContext.save.saveInfo.permanentSceneFlags[i].collectible;
|
||||
}
|
||||
|
||||
if (gSaveContext.save.saveInfo.scarecrowSpawnSongSet) {
|
||||
Lib_MemCpy(gScarecrowSpawnSongPtr, gSaveContext.save.saveInfo.scarecrowSpawnSong,
|
||||
sizeof(gSaveContext.save.saveInfo.scarecrowSpawnSong));
|
||||
|
||||
for (i = 0; i != ARRAY_COUNT(gSaveContext.save.saveInfo.scarecrowSpawnSong); i++) {}
|
||||
}
|
||||
|
||||
fileNum = gSaveContext.fileNum;
|
||||
func_80147314(sramCtx, fileNum);
|
||||
}
|
||||
else {
|
||||
gSaveContext.save.entrance = D_801C6A58[(void)0, gSaveContext.save.owlWarpId];
|
||||
if ((gSaveContext.save.entrance == ENTRANCE(SOUTHERN_SWAMP_POISONED, 10)) &&
|
||||
CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE)) {
|
||||
gSaveContext.save.entrance = ENTRANCE(SOUTHERN_SWAMP_CLEARED, 10);
|
||||
} else if ((gSaveContext.save.entrance == ENTRANCE(MOUNTAIN_VILLAGE_WINTER, 8)) &&
|
||||
CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) {
|
||||
gSaveContext.save.entrance = ENTRANCE(MOUNTAIN_VILLAGE_SPRING, 8);
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.cycleSceneFlags); i++) {
|
||||
gSaveContext.cycleSceneFlags[i].chest = gSaveContext.save.saveInfo.permanentSceneFlags[i].chest;
|
||||
gSaveContext.cycleSceneFlags[i].switch0 = gSaveContext.save.saveInfo.permanentSceneFlags[i].switch0;
|
||||
gSaveContext.cycleSceneFlags[i].switch1 = gSaveContext.save.saveInfo.permanentSceneFlags[i].switch1;
|
||||
gSaveContext.cycleSceneFlags[i].clearedRoom = gSaveContext.save.saveInfo.permanentSceneFlags[i].clearedRoom;
|
||||
gSaveContext.cycleSceneFlags[i].collectible = gSaveContext.save.saveInfo.permanentSceneFlags[i].collectible;
|
||||
}
|
||||
|
||||
if (gSaveContext.save.saveInfo.scarecrowSpawnSongSet) {
|
||||
Lib_MemCpy(gScarecrowSpawnSongPtr, gSaveContext.save.saveInfo.scarecrowSpawnSong,
|
||||
sizeof(gSaveContext.save.saveInfo.scarecrowSpawnSong));
|
||||
|
||||
for (i = 0; i != ARRAY_COUNT(gSaveContext.save.saveInfo.scarecrowSpawnSong); i++) {}
|
||||
}
|
||||
|
||||
fileNum = gSaveContext.fileNum;
|
||||
func_80147314(sramCtx, fileNum);
|
||||
}
|
||||
|
||||
// @recomp Initialize the autosave state tracking.
|
||||
autosave_init();
|
||||
|
||||
// @recomp_event recomp_after_load_save(FileSelectState* fileSelect, SramContext* sramCtx): The save has finished loading.
|
||||
recomp_after_load_save(fileSelect, sramCtx);
|
||||
}
|
||||
|
||||
bool moon_crash_resets_save = true;
|
||||
|
||||
// @recomp_export void recomp_set_moon_crash_resets_save(bool new_val): Set whether a moon crash should revert the player's save data.
|
||||
RECOMP_EXPORT void recomp_set_moon_crash_resets_save(bool new_val)
|
||||
{
|
||||
moon_crash_resets_save = new_val;
|
||||
}
|
||||
|
||||
extern s32 Actor_ProcessTalkRequest(Actor* actor, GameState* gameState);
|
||||
|
||||
RECOMP_DECLARE_EVENT(recomp_on_moon_crash(SramContext* sramCtx));
|
||||
RECOMP_DECLARE_EVENT(recomp_after_moon_crash(SramContext* sramCtx));
|
||||
|
||||
// @recomp Reset the autosave timer when the moon crashes.
|
||||
RECOMP_PATCH void Sram_ResetSaveFromMoonCrash(SramContext* sramCtx) {
|
||||
s32 i;
|
||||
s32 cutsceneIndex = gSaveContext.save.cutsceneIndex;
|
||||
|
||||
// @recomp_event recomp_on_moon_crash(SramContext* sramCtx): A moon crash has just been triggered.
|
||||
recomp_on_moon_crash(sramCtx);
|
||||
|
||||
if (moon_crash_resets_save)
|
||||
{
|
||||
bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE);
|
||||
|
||||
if (SysFlashrom_ReadData(sramCtx->saveBuf, gFlashSaveStartPages[gSaveContext.fileNum * 2],
|
||||
gFlashSaveNumPages[gSaveContext.fileNum * 2]) != 0) {
|
||||
SysFlashrom_ReadData(sramCtx->saveBuf, gFlashSaveStartPages[gSaveContext.fileNum * 2 + 1],
|
||||
gFlashSaveNumPages[gSaveContext.fileNum * 2 + 1]);
|
||||
}
|
||||
Lib_MemCpy(&gSaveContext.save, sramCtx->saveBuf, sizeof(Save));
|
||||
if (CHECK_NEWF(gSaveContext.save.saveInfo.playerData.newf)) {
|
||||
SysFlashrom_ReadData(sramCtx->saveBuf, gFlashSaveStartPages[gSaveContext.fileNum * 2 + 1],
|
||||
gFlashSaveNumPages[gSaveContext.fileNum * 2 + 1]);
|
||||
Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, sizeof(Save));
|
||||
}
|
||||
gSaveContext.save.cutsceneIndex = cutsceneIndex;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.eventInf); i++) {
|
||||
gSaveContext.eventInf[i] = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.cycleSceneFlags); i++) {
|
||||
gSaveContext.cycleSceneFlags[i].chest = gSaveContext.save.saveInfo.permanentSceneFlags[i].chest;
|
||||
gSaveContext.cycleSceneFlags[i].switch0 = gSaveContext.save.saveInfo.permanentSceneFlags[i].switch0;
|
||||
gSaveContext.cycleSceneFlags[i].switch1 = gSaveContext.save.saveInfo.permanentSceneFlags[i].switch1;
|
||||
gSaveContext.cycleSceneFlags[i].clearedRoom = gSaveContext.save.saveInfo.permanentSceneFlags[i].clearedRoom;
|
||||
gSaveContext.cycleSceneFlags[i].collectible = gSaveContext.save.saveInfo.permanentSceneFlags[i].collectible;
|
||||
}
|
||||
|
||||
for (i = 0; i < TIMER_ID_MAX; i++) {
|
||||
gSaveContext.timerStates[i] = TIMER_STATE_OFF;
|
||||
gSaveContext.timerCurTimes[i] = SECONDS_TO_TIMER(0);
|
||||
gSaveContext.timerTimeLimits[i] = SECONDS_TO_TIMER(0);
|
||||
gSaveContext.timerStartOsTimes[i] = 0;
|
||||
gSaveContext.timerStopTimes[i] = SECONDS_TO_TIMER(0);
|
||||
gSaveContext.timerPausedOsTimes[i] = 0;
|
||||
}
|
||||
|
||||
D_801BDAA0 = true;
|
||||
gHorseIsMounted = false;
|
||||
gSaveContext.powderKegTimer = 0;
|
||||
gSaveContext.unk_1014 = 0;
|
||||
gSaveContext.jinxTimer = 0;
|
||||
|
||||
// @recomp Use the slow autosave timer to give the player extra time to respond to the moon crashing to decide if they want to reload their autosave.
|
||||
recomp_reset_autosave_timer_slow();
|
||||
|
||||
// @recomp_event recomp_after_moon_crash(SramContext* sramCtx): The effects of moon crash have been written.
|
||||
recomp_after_moon_crash(sramCtx);
|
||||
}
|
||||
|
||||
|
||||
bool owls_save_and_quit = true;
|
||||
|
||||
// @recomp_export void recomp_set_owls_save_and_quit(bool new_val): Set if owls should use their code to save and quit. If false is passed, owl saves now do nothing.
|
||||
RECOMP_EXPORT void recomp_set_owls_save_and_quit(bool new_val)
|
||||
{
|
||||
owls_save_and_quit = new_val;
|
||||
}
|
||||
|
||||
RECOMP_DECLARE_EVENT(recomp_on_owl_update(ObjWarpstone* this, PlayState* play));
|
||||
RECOMP_DECLARE_EVENT(recomp_on_owl_save(ObjWarpstone* this, PlayState* play));
|
||||
RECOMP_DECLARE_EVENT(recomp_after_owl_save(ObjWarpstone* this, PlayState* play));
|
||||
|
||||
// @recomp If autosave is enabled or owl save deletion is disabled, skip the part of the owl statue dialog that talks about the file being deleted on load, since it's not true.
|
||||
RECOMP_PATCH void ObjWarpstone_Update(Actor* thisx, PlayState* play) {
|
||||
ObjWarpstone* this = (ObjWarpstone*)thisx;
|
||||
s32 pad;
|
||||
|
||||
// @recomp_event recomp_on_owl_update(ObjWarpstone* this, PlayState* play): Allow mods to handle owl update frames.
|
||||
recomp_on_owl_update(this, play);
|
||||
|
||||
if (this->isTalking) {
|
||||
if (Actor_TextboxIsClosing(&this->dyna.actor, play)) {
|
||||
this->isTalking = false;
|
||||
} else if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) {
|
||||
if (play->msgCtx.choiceIndex != 0) {
|
||||
// @recomp_event recomp_on_owl_save(ObjWarpstone* this, PlayState* play): The player chose to save from an owl statue.
|
||||
recomp_on_owl_save(this, play);
|
||||
|
||||
Audio_PlaySfx_MessageDecide();
|
||||
|
||||
// @recomp_use_export_var owls_save_and_quit: Only use normal owl save if quit flag is set.
|
||||
if (owls_save_and_quit) {
|
||||
play->msgCtx.msgMode = MSGMODE_OWL_SAVE_0;
|
||||
} else {
|
||||
Message_CloseTextbox(play);
|
||||
}
|
||||
|
||||
play->msgCtx.unk120D6 = 0;
|
||||
play->msgCtx.unk120D4 = 0;
|
||||
gSaveContext.save.owlWarpId = OBJ_WARPSTONE_GET_OWL_WARP_ID(&this->dyna.actor);
|
||||
|
||||
// @recomp_event recomp_after_owl_save(ObjWarpstone* this, PlayState* play): Owl save is finished.
|
||||
recomp_after_owl_save(this, play);
|
||||
} else {
|
||||
Message_CloseTextbox(play);
|
||||
}
|
||||
}
|
||||
} else if (Actor_ProcessTalkRequest(&this->dyna.actor, &play->state)) {
|
||||
this->isTalking = true;
|
||||
} else if (!this->actionFunc(this, play)) {
|
||||
Actor_OfferTalkNearColChkInfoCylinder(&this->dyna.actor, play);
|
||||
}
|
||||
|
||||
// @recomp_use_export_var loading_deletes_owl_save: Skip the text talking about the save being deleted on load, if autosave is enabled or if owl save deletion is disabled.
|
||||
if (recomp_get_autosave_enabled() || !loading_deletes_owl_save) {
|
||||
if (this->isTalking && play->msgCtx.currentTextId == 0xC01 && play->msgCtx.msgBufPos == 269) {
|
||||
play->msgCtx.msgBufPos = 530;
|
||||
}
|
||||
}
|
||||
|
||||
Collider_ResetCylinderAC(play, &this->collider.base);
|
||||
Collider_UpdateCylinder(&this->dyna.actor, &this->collider);
|
||||
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
|
||||
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
|
||||
}
|
@ -61,7 +61,7 @@ void edit_billboard_groups(PlayState* play) {
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx) {
|
||||
RECOMP_PATCH Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx) {
|
||||
Mtx* ret = Matrix_ToMtx(GRAPH_ALLOC(gfxCtx, sizeof(Mtx)));
|
||||
|
||||
if (*current_billboard_state) {
|
||||
@ -77,7 +77,7 @@ Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Matrix_Init(GameState* gameState) {
|
||||
RECOMP_PATCH void Matrix_Init(GameState* gameState) {
|
||||
sMatrixStack = THA_AllocTailAlign16(&gameState->tha, MATRIX_STACK_SIZE * sizeof(MtxF));
|
||||
sCurrentMatrix = sMatrixStack;
|
||||
|
||||
@ -94,7 +94,7 @@ void matrix_play_update(PlayState* play) {
|
||||
play_billboard_matrix = &play->billboardMtxF;
|
||||
}
|
||||
|
||||
void Matrix_Push(void) {
|
||||
RECOMP_PATCH void Matrix_Push(void) {
|
||||
MtxF* prev = sCurrentMatrix;
|
||||
|
||||
sCurrentMatrix++;
|
||||
@ -106,20 +106,20 @@ void Matrix_Push(void) {
|
||||
*current_billboard_state = *prev_billboard;
|
||||
}
|
||||
|
||||
void Matrix_Pop(void) {
|
||||
RECOMP_PATCH void Matrix_Pop(void) {
|
||||
sCurrentMatrix--;
|
||||
// @recomp Pop the matrix stack billboard state.
|
||||
current_billboard_state--;
|
||||
}
|
||||
|
||||
void Matrix_Put(MtxF* src) {
|
||||
RECOMP_PATCH void Matrix_Put(MtxF* src) {
|
||||
Matrix_MtxFCopy(sCurrentMatrix, src);
|
||||
|
||||
// @recomp Update the current billboard state.
|
||||
*current_billboard_state = (src == play_billboard_matrix);
|
||||
}
|
||||
|
||||
void Matrix_ReplaceRotation(MtxF* mf) {
|
||||
RECOMP_PATCH void Matrix_ReplaceRotation(MtxF* mf) {
|
||||
MtxF* cmf = sCurrentMatrix;
|
||||
f32 acc;
|
||||
f32 component;
|
||||
@ -168,7 +168,7 @@ void Matrix_ReplaceRotation(MtxF* mf) {
|
||||
*current_billboard_state = (mf == play_billboard_matrix);
|
||||
}
|
||||
|
||||
void Matrix_Mult(MtxF* mf, MatrixMode mode) {
|
||||
RECOMP_PATCH void Matrix_Mult(MtxF* mf, MatrixMode mode) {
|
||||
MtxF* cmf = Matrix_GetCurrent();
|
||||
|
||||
if (mode == MTXMODE_APPLY) {
|
||||
@ -183,7 +183,7 @@ void Matrix_Mult(MtxF* mf, MatrixMode mode) {
|
||||
}
|
||||
}
|
||||
|
||||
void Matrix_Translate(f32 x, f32 y, f32 z, MatrixMode mode) {
|
||||
RECOMP_PATCH void Matrix_Translate(f32 x, f32 y, f32 z, MatrixMode mode) {
|
||||
MtxF* cmf = sCurrentMatrix;
|
||||
f32 tempX;
|
||||
f32 tempY;
|
||||
@ -209,7 +209,7 @@ void Matrix_Translate(f32 x, f32 y, f32 z, MatrixMode mode) {
|
||||
}
|
||||
}
|
||||
|
||||
void Matrix_Scale(f32 x, f32 y, f32 z, MatrixMode mode) {
|
||||
RECOMP_PATCH void Matrix_Scale(f32 x, f32 y, f32 z, MatrixMode mode) {
|
||||
MtxF* cmf = sCurrentMatrix;
|
||||
|
||||
if (mode == MTXMODE_APPLY) {
|
||||
@ -233,7 +233,7 @@ void Matrix_Scale(f32 x, f32 y, f32 z, MatrixMode mode) {
|
||||
}
|
||||
}
|
||||
|
||||
void Matrix_RotateXS(s16 x, MatrixMode mode) {
|
||||
RECOMP_PATCH void Matrix_RotateXS(s16 x, MatrixMode mode) {
|
||||
MtxF* cmf;
|
||||
f32 sin;
|
||||
f32 cos;
|
||||
@ -300,7 +300,7 @@ void Matrix_RotateXS(s16 x, MatrixMode mode) {
|
||||
}
|
||||
}
|
||||
|
||||
void Matrix_RotateXF(f32 x, MatrixMode mode) {
|
||||
RECOMP_PATCH void Matrix_RotateXF(f32 x, MatrixMode mode) {
|
||||
MtxF* cmf;
|
||||
f32 sin;
|
||||
f32 cos;
|
||||
@ -369,7 +369,7 @@ void Matrix_RotateXF(f32 x, MatrixMode mode) {
|
||||
}
|
||||
}
|
||||
|
||||
void Matrix_RotateXFNew(f32 x) {
|
||||
RECOMP_PATCH void Matrix_RotateXFNew(f32 x) {
|
||||
MtxF* cmf = sCurrentMatrix;
|
||||
s32 pad[2];
|
||||
f32 sin;
|
||||
@ -406,7 +406,7 @@ void Matrix_RotateXFNew(f32 x) {
|
||||
// @recomp Clear the current billboard state.
|
||||
*current_billboard_state = false;
|
||||
}
|
||||
void Matrix_RotateYS(s16 y, MatrixMode mode) {
|
||||
RECOMP_PATCH void Matrix_RotateYS(s16 y, MatrixMode mode) {
|
||||
MtxF* cmf;
|
||||
f32 sin;
|
||||
f32 cos;
|
||||
@ -473,7 +473,7 @@ void Matrix_RotateYS(s16 y, MatrixMode mode) {
|
||||
}
|
||||
}
|
||||
|
||||
void Matrix_RotateYF(f32 y, MatrixMode mode) {
|
||||
RECOMP_PATCH void Matrix_RotateYF(f32 y, MatrixMode mode) {
|
||||
MtxF* cmf;
|
||||
f32 sin;
|
||||
f32 cos;
|
||||
@ -542,7 +542,7 @@ void Matrix_RotateYF(f32 y, MatrixMode mode) {
|
||||
}
|
||||
}
|
||||
|
||||
void Matrix_RotateZS(s16 z, MatrixMode mode) {
|
||||
RECOMP_PATCH void Matrix_RotateZS(s16 z, MatrixMode mode) {
|
||||
MtxF* cmf;
|
||||
f32 sin;
|
||||
f32 cos;
|
||||
@ -611,7 +611,7 @@ void Matrix_RotateZS(s16 z, MatrixMode mode) {
|
||||
}
|
||||
}
|
||||
|
||||
void Matrix_RotateZF(f32 z, MatrixMode mode) {
|
||||
RECOMP_PATCH void Matrix_RotateZF(f32 z, MatrixMode mode) {
|
||||
MtxF* cmf;
|
||||
f32 sin;
|
||||
f32 cos;
|
||||
@ -678,7 +678,7 @@ void Matrix_RotateZF(f32 z, MatrixMode mode) {
|
||||
}
|
||||
}
|
||||
|
||||
void Matrix_RotateZYX(s16 x, s16 y, s16 z, MatrixMode mode) {
|
||||
RECOMP_PATCH void Matrix_RotateZYX(s16 x, s16 y, s16 z, MatrixMode mode) {
|
||||
MtxF* cmf = sCurrentMatrix;
|
||||
f32 temp1;
|
||||
f32 temp2;
|
||||
@ -768,7 +768,7 @@ void Matrix_RotateZYX(s16 x, s16 y, s16 z, MatrixMode mode) {
|
||||
}
|
||||
}
|
||||
|
||||
void Matrix_SetTranslateRotateYXZ(f32 x, f32 y, f32 z, Vec3s* rot) {
|
||||
RECOMP_PATCH void Matrix_SetTranslateRotateYXZ(f32 x, f32 y, f32 z, Vec3s* rot) {
|
||||
MtxF* cmf = sCurrentMatrix;
|
||||
f32 sinY = Math_SinS(rot->y);
|
||||
f32 cosY = Math_CosS(rot->y);
|
||||
@ -829,7 +829,7 @@ void Matrix_SetTranslateRotateYXZ(f32 x, f32 y, f32 z, Vec3s* rot) {
|
||||
*current_billboard_state = false;
|
||||
}
|
||||
|
||||
void Matrix_RotateAxisF(f32 angle, Vec3f* axis, MatrixMode mode) {
|
||||
RECOMP_PATCH void Matrix_RotateAxisF(f32 angle, Vec3f* axis, MatrixMode mode) {
|
||||
MtxF* cmf;
|
||||
f32 sin;
|
||||
f32 cos;
|
||||
@ -926,7 +926,7 @@ void Matrix_RotateAxisF(f32 angle, Vec3f* axis, MatrixMode mode) {
|
||||
}
|
||||
}
|
||||
|
||||
void Matrix_RotateAxisS(s16 angle, Vec3f* axis, MatrixMode mode) {
|
||||
RECOMP_PATCH void Matrix_RotateAxisS(s16 angle, Vec3f* axis, MatrixMode mode) {
|
||||
MtxF* cmf;
|
||||
f32 cos;
|
||||
f32 sin;
|
||||
|
File diff suppressed because it is too large
Load Diff
15
patches/camera_patches.h
Normal file
15
patches/camera_patches.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef __CAMERA_PATCHES_H__
|
||||
#define __CAMERA_PATCHES_H__
|
||||
|
||||
#include "z64camera.h"
|
||||
|
||||
#define RELOAD_PARAMS(camera) ((camera->animState == 0) || (camera->animState == 10) || (camera->animState == 20))
|
||||
#define CAM_RODATA_SCALE(x) ((x)*100.0f)
|
||||
#define CAM_RODATA_UNSCALE(x) ((x)*0.01f)
|
||||
|
||||
// Load the next value from camera read-only data stored in CameraModeValue
|
||||
#define GET_NEXT_RO_DATA(values) ((values++)->val)
|
||||
// Load the next value and scale down from camera read-only data stored in CameraModeValue
|
||||
#define GET_NEXT_SCALED_RO_DATA(values) CAM_RODATA_UNSCALE(GET_NEXT_RO_DATA(values))
|
||||
|
||||
#endif
|
@ -1,9 +1,12 @@
|
||||
#include "patches.h"
|
||||
#include "camera_patches.h"
|
||||
#include "transform_ids.h"
|
||||
#include "z64cutscene.h"
|
||||
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
|
||||
#include "overlays/gamestates/ovl_file_choose/z_file_select.h"
|
||||
|
||||
// #define PRINT_CAMERA_INFO
|
||||
|
||||
static bool camera_interpolation_forced = false;
|
||||
static bool camera_skip_interpolation_forced = false;
|
||||
static bool camera_ignore_tracking = false;
|
||||
@ -36,6 +39,44 @@ void camera_post_play_update(PlayState* play) {
|
||||
}
|
||||
else {
|
||||
in_kaleido = false;
|
||||
|
||||
if (play->activeCamId >= 0 && play->activeCamId < NUM_CAMS) {
|
||||
Camera *active_cam = play->cameraPtrs[play->activeCamId];
|
||||
#ifdef PRINT_CAMERA_INFO
|
||||
recomp_printf("active_cam->setting %d active_cam->mode %d play->sceneId %d\n", active_cam->setting, active_cam->mode, play->sceneId);
|
||||
#endif
|
||||
|
||||
// Dedicated section for workarounds where the heuristic fails to detect the large amount of movements the camera does in these particular areas.
|
||||
bool force_interpolation = false;
|
||||
if (active_cam->setting == CAM_SET_BOSS_MAJORA) {
|
||||
// Majora's Mask final fight. All cameras should transition smoothly during this fight while not in a cutscene.
|
||||
force_interpolation = true;
|
||||
}
|
||||
else if (active_cam->setting == CAM_SET_NORMAL0 || active_cam->setting == CAM_SET_DUNGEON0) {
|
||||
force_interpolation =
|
||||
// Pirates' Fortress Moat. Pushing the switch that unlocks the fortress will cause very large camera movement.
|
||||
play->sceneId == SCENE_TORIDE ||
|
||||
// Z-targetting an actor.
|
||||
active_cam->mode == CAM_MODE_FOLLOWTARGET ||
|
||||
// Z-targetting nothing.
|
||||
active_cam->mode == CAM_MODE_TARGET ||
|
||||
// Z-targetting in battle.
|
||||
active_cam->mode == CAM_MODE_BATTLE;
|
||||
}
|
||||
// TODO: This setting claims "Smoothly and gradually return camera to Player after a cutscene "CONNECT0"". It might be worth it to enable this globally regardless of the scene.
|
||||
else if (active_cam->setting == CAM_SET_CONNECT0) {
|
||||
// Stone tower and inverted stone tower. The block puzzles will cause very large camera movement after they're activated.
|
||||
force_interpolation = play->sceneId == SCENE_F40 || play->sceneId == SCENE_F41;
|
||||
}
|
||||
else if (active_cam->setting == CAM_SET_FREE0) {
|
||||
// Cutscene after Majora fight. The camera zooms out while facing the moon with a very large movement.
|
||||
force_interpolation = play->sceneId == SCENE_00KEIKOKU && play->csCtx.scriptIndex == 0 && play->csCtx.curFrame <= 98 && gSaveContext.sceneLayer == 8;
|
||||
}
|
||||
|
||||
if (force_interpolation) {
|
||||
force_camera_interpolation();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,7 +95,7 @@ void force_camera_ignore_tracking() {
|
||||
camera_ignore_tracking = true;
|
||||
}
|
||||
|
||||
void KaleidoScope_SetView(PauseContext* pauseCtx, f32 eyeX, f32 eyeY, f32 eyeZ) {
|
||||
RECOMP_PATCH void KaleidoScope_SetView(PauseContext* pauseCtx, f32 eyeX, f32 eyeY, f32 eyeZ) {
|
||||
Vec3f eye;
|
||||
Vec3f at;
|
||||
Vec3f up;
|
||||
@ -76,7 +117,7 @@ void KaleidoScope_SetView(PauseContext* pauseCtx, f32 eyeX, f32 eyeY, f32 eyeZ)
|
||||
}
|
||||
|
||||
|
||||
void FileSelect_SetView(FileSelectState* this, f32 eyeX, f32 eyeY, f32 eyeZ) {
|
||||
RECOMP_PATCH void FileSelect_SetView(FileSelectState* this, f32 eyeX, f32 eyeY, f32 eyeZ) {
|
||||
Vec3f eye;
|
||||
Vec3f lookAt;
|
||||
Vec3f up;
|
||||
@ -156,7 +197,7 @@ bool should_interpolate_perspective(Vec3f* eye, Vec3f* at) {
|
||||
/**
|
||||
* Apply view to POLY_OPA_DISP, POLY_XLU_DISP (and OVERLAY_DISP if ortho)
|
||||
*/
|
||||
void View_Apply(View* view, s32 mask) {
|
||||
RECOMP_PATCH void View_Apply(View* view, s32 mask) {
|
||||
mask = (view->flags & mask) | (mask >> 4);
|
||||
|
||||
// @recomp Determine if the camera should be interpolated this frame.
|
||||
@ -246,17 +287,12 @@ void Camera_ScaledStepToCeilVec3f(Vec3f* target, Vec3f* cur, f32 xzStepScale, f3
|
||||
void Camera_SetFocalActorAtOffset(Camera* camera, Vec3f* focalActorPos);
|
||||
void Camera_SetUpdateRatesSlow(Camera* camera);
|
||||
Vec3f Camera_Vec3sToVec3f(Vec3s* src);
|
||||
#define RELOAD_PARAMS(camera) ((camera->animState == 0) || (camera->animState == 10) || (camera->animState == 20))
|
||||
#define CAM_RODATA_SCALE(x) ((x)*100.0f)
|
||||
#define CAM_RODATA_UNSCALE(x) ((x)*0.01f)
|
||||
#define GET_NEXT_RO_DATA(values) ((values++)->val)
|
||||
#define GET_NEXT_SCALED_RO_DATA(values) CAM_RODATA_UNSCALE(GET_NEXT_RO_DATA(values))
|
||||
|
||||
/**
|
||||
* Used for many fixed-based camera settings i.e. camera is fixed in rotation, and often position (but not always)
|
||||
*/
|
||||
// @recomp Modified to not force interpolation while panning.
|
||||
s32 Camera_Fixed1(Camera* camera) {
|
||||
RECOMP_PATCH s32 Camera_Fixed1(Camera* camera) {
|
||||
s32 pad[2];
|
||||
s32 yawDiff;
|
||||
VecGeo eyeOffset;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "patches.h"
|
||||
|
||||
// Disable frustum culling for actors, but leave distance culling intact
|
||||
s32 func_800BA2FC(PlayState* play, Actor* actor, Vec3f* projectedPos, f32 projectedW) {
|
||||
RECOMP_PATCH s32 func_800BA2FC(PlayState* play, Actor* actor, Vec3f* projectedPos, f32 projectedW) {
|
||||
if ((-actor->uncullZoneScale < projectedPos->z) &&
|
||||
(projectedPos->z < (actor->uncullZoneForward + actor->uncullZoneScale))) {
|
||||
// f32 phi_f12;
|
||||
@ -30,7 +30,7 @@ s32 func_800BA2FC(PlayState* play, Actor* actor, Vec3f* projectedPos, f32 projec
|
||||
}
|
||||
|
||||
// Disable frustum culling for bush spawning
|
||||
// s32 EnWood02_SpawnZoneCheck(EnWood02* this, PlayState* play, Vec3f* arg2) {
|
||||
// RECOMP_PATCH s32 EnWood02_SpawnZoneCheck(EnWood02* this, PlayState* play, Vec3f* arg2) {
|
||||
// f32 phi_f12;
|
||||
|
||||
// SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, arg2, &this->actor.projectedPos, &this->actor.projectedW);
|
||||
@ -52,7 +52,7 @@ s32 func_800BA2FC(PlayState* play, Actor* actor, Vec3f* projectedPos, f32 projec
|
||||
// }
|
||||
|
||||
// Disable frustum culling for grass
|
||||
s32 func_809A9110(PlayState* play, Vec3f* pos) {
|
||||
RECOMP_PATCH s32 func_809A9110(PlayState* play, Vec3f* pos) {
|
||||
f32 w;
|
||||
Vec3f projectedPos;
|
||||
|
||||
@ -73,7 +73,7 @@ s32 func_809A9110(PlayState* play, Vec3f* pos) {
|
||||
|
||||
// Replace point light glow effect with RT64 point Z test so it works in widescreen
|
||||
|
||||
void Lights_GlowCheck(PlayState* play) {
|
||||
RECOMP_PATCH void Lights_GlowCheck(PlayState* play) {
|
||||
LightNode* light = play->lightCtx.listHead;
|
||||
|
||||
while (light != NULL) {
|
||||
@ -107,7 +107,7 @@ extern Gfx gameplay_keep_DL_029CF0[];
|
||||
|
||||
Vtx light_test_vert = VTX(0, 0, 0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF);
|
||||
|
||||
void Lights_DrawGlow(PlayState* play) {
|
||||
RECOMP_PATCH void Lights_DrawGlow(PlayState* play) {
|
||||
Gfx* dl;
|
||||
LightPoint* params;
|
||||
LightNode* light = play->lightCtx.listHead;
|
||||
|
16
patches/custom_syms.toml
Normal file
16
patches/custom_syms.toml
Normal file
@ -0,0 +1,16 @@
|
||||
# Custom symbols used for patches.
|
||||
[[section]]
|
||||
name = "ABSOLUTE_SYMS"
|
||||
vram = 0x00000000
|
||||
size = 0x0
|
||||
|
||||
symbols = [
|
||||
# Alternate references to symbols that would otherwise be relocated
|
||||
{ name = "Setup_Init_NORELOCATE", vram = 0x80173338 }, # Not relocatable, but here for uniformity with the other gamestate funcs
|
||||
{ name = "MapSelect_Init_NORELOCATE", vram = 0x80801B4C },
|
||||
{ name = "ConsoleLogo_Init_NORELOCATE", vram = 0x8080074C },
|
||||
{ name = "Play_Init_NORELOCATE", vram = 0x8016A2C8 },
|
||||
{ name = "TitleSetup_Init_NORELOCATE", vram = 0x80803F30 },
|
||||
{ name = "FileSelect_Init_NORELOCATE", vram = 0x80813C98 },
|
||||
{ name = "DayTelop_Init_NORELOCATE", vram = 0x80815820 },
|
||||
]
|
@ -6,7 +6,7 @@
|
||||
|
||||
CsCmdActorCue* prev_cues_checked[ARRAY_COUNT(((CutsceneContext*)0)->actorCues)] = {0};
|
||||
|
||||
void Cutscene_ActorTranslate(Actor* actor, PlayState* play, s32 cueChannel) {
|
||||
RECOMP_PATCH void Cutscene_ActorTranslate(Actor* actor, PlayState* play, s32 cueChannel) {
|
||||
Vec3f startPos;
|
||||
Vec3f endPos;
|
||||
CsCmdActorCue* cue = play->csCtx.actorCues[cueChannel];
|
||||
@ -39,7 +39,7 @@ extern EnHorseCsFunc D_808890F0[];
|
||||
extern EnHorseCsFunc D_8088911C[];
|
||||
|
||||
// @recomp Patched to skip interpolation on Epona when she's teleported by a cutscene.
|
||||
void func_80884718(EnHorse* this, PlayState* play) {
|
||||
RECOMP_PATCH void func_80884718(EnHorse* this, PlayState* play) {
|
||||
CsCmdActorCue* cue;
|
||||
|
||||
if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_112)) {
|
||||
@ -63,23 +63,19 @@ void func_80884718(EnHorse* this, PlayState* play) {
|
||||
}
|
||||
|
||||
this->cueId = cue->id;
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
EnHorseCsFunc* D_808890F0_reloc = actor_relocate(&this->actor, D_808890F0);
|
||||
if (D_808890F0_reloc[this->cueId] != NULL) {
|
||||
D_808890F0_reloc[this->cueId](this, play, cue);
|
||||
if (D_808890F0[this->cueId] != NULL) {
|
||||
D_808890F0[this->cueId](this, play, cue);
|
||||
}
|
||||
}
|
||||
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
EnHorseCsFunc* D_8088911C_reloc = actor_relocate(&this->actor, D_8088911C);
|
||||
if (D_8088911C_reloc[this->cueId] != NULL) {
|
||||
D_8088911C_reloc[this->cueId](this, play, cue);
|
||||
if (D_8088911C[this->cueId] != NULL) {
|
||||
D_8088911C[this->cueId](this, play, cue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// @recomp Patched to skip interpolation on Epona when she's teleported by a cutscene.
|
||||
void func_80883B70(EnHorse* this, CsCmdActorCue* cue) {
|
||||
RECOMP_PATCH void func_80883B70(EnHorse* this, CsCmdActorCue* cue) {
|
||||
// @recomp Being teleported by a new cue, so skip interpolation.
|
||||
actor_set_interpolation_skipped(&this->actor);
|
||||
|
||||
@ -94,7 +90,7 @@ void func_80883B70(EnHorse* this, CsCmdActorCue* cue) {
|
||||
}
|
||||
|
||||
// @recomp Patched to skip interpolation on Link when he's teleported to a new cue.
|
||||
void Player_Cutscene_SetPosAndYawToStart(Player* this, CsCmdActorCue* cue) {
|
||||
RECOMP_PATCH void Player_Cutscene_SetPosAndYawToStart(Player* this, CsCmdActorCue* cue) {
|
||||
// @recomp Being teleported by a new cue, so skip interpolation.
|
||||
actor_set_interpolation_skipped(&this->actor);
|
||||
|
||||
@ -108,7 +104,7 @@ void Player_Cutscene_SetPosAndYawToStart(Player* this, CsCmdActorCue* cue) {
|
||||
CsCmdActorCue* prev_link_cue = NULL;
|
||||
|
||||
// @recomp Patched to skip interpolation on Link when he's teleported to a new cue.
|
||||
void Player_Cutscene_Translate(PlayState* play, Player* this, CsCmdActorCue* cue) {
|
||||
RECOMP_PATCH void Player_Cutscene_Translate(PlayState* play, Player* this, CsCmdActorCue* cue) {
|
||||
f32 startX = cue->startPos.x;
|
||||
f32 startY = cue->startPos.y;
|
||||
f32 startZ = cue->startPos.z;
|
||||
|
@ -9,7 +9,7 @@ extern Gfx sTransWipe3DL[];
|
||||
|
||||
#define THIS ((TransitionWipe3*)thisx)
|
||||
// @recomp patched to scale the transition based on aspect ratio
|
||||
void TransitionWipe3_Draw(void* thisx, Gfx** gfxP) {
|
||||
RECOMP_PATCH void TransitionWipe3_Draw(void* thisx, Gfx** gfxP) {
|
||||
Gfx* gfx = *gfxP;
|
||||
Mtx* modelView = &THIS->modelView[THIS->frame];
|
||||
f32 scale = 14.8f;
|
||||
@ -17,7 +17,7 @@ void TransitionWipe3_Draw(void* thisx, Gfx** gfxP) {
|
||||
|
||||
// @recomp Modify the scale based on the aspect ratio to make sure the transition circle covers the whole screen
|
||||
float original_aspect_ratio = ((float)SCREEN_WIDTH) / ((float)SCREEN_HEIGHT);
|
||||
scale *= recomp_get_aspect_ratio(original_aspect_ratio) / original_aspect_ratio;
|
||||
scale *= recomp_get_target_aspect_ratio(original_aspect_ratio) / original_aspect_ratio;
|
||||
|
||||
THIS->frame ^= 1;
|
||||
gDPPipeSync(gfx++);
|
||||
@ -34,12 +34,7 @@ void TransitionWipe3_Draw(void* thisx, Gfx** gfxP) {
|
||||
guScale(modelView, scale, scale, 1.0f);
|
||||
gSPMatrix(gfx++, modelView, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
}
|
||||
// sTransWipe3DL is an overlay symbol, so its addresses need to be offset to get the actual loaded vram address.
|
||||
// TODO remove this once the recompiler is able to handle overlay symbols automatically for patch functions.
|
||||
ptrdiff_t reloc_offset;
|
||||
TransitionOverlay* overlay_entry = &gTransitionOverlayTable[FBDEMO_WIPE3];
|
||||
reloc_offset = (uintptr_t)Lib_PhysicalToVirtual(overlay_entry->loadInfo.addr) - (uintptr_t)overlay_entry->vramStart;
|
||||
gSPDisplayList(gfx++, (Gfx*)((u8*)sTransWipe3DL + reloc_offset));
|
||||
gSPDisplayList(gfx++, sTransWipe3DL);
|
||||
gDPPipeSync(gfx++);
|
||||
*gfxP = gfx;
|
||||
}
|
||||
@ -58,7 +53,7 @@ extern s32 gFramerateDivisor;
|
||||
|
||||
// @recomp Motion blur works fine normally, but when running at a higher framerate the effect is much less pronounced
|
||||
// as the previous frames decay quicker due to there being more frames drawn in the same period of time.
|
||||
void Play_DrawMotionBlur(PlayState* this) {
|
||||
RECOMP_PATCH void Play_DrawMotionBlur(PlayState* this) {
|
||||
GraphicsContext* gfxCtx = this->state.gfxCtx;
|
||||
s32 alpha;
|
||||
Gfx* gfx;
|
||||
@ -98,11 +93,20 @@ void Play_DrawMotionBlur(PlayState* this) {
|
||||
f32 exponent = 20.0f / recomp_get_target_framerate(gFramerateDivisor);
|
||||
f32 alpha_float = recomp_powf(alpha / 255.0f, exponent);
|
||||
// Clamp the blur alpha, which ensures that the output color converges to within a reasonable delta of the target color
|
||||
// when using an R8G8B8A8 framebuffer as RT64 currently does. Although this makes the effect less noticeable at high framerates,
|
||||
// when using an R8G8B8A8 framebuffer. Although this makes the effect less noticeable at high framerates,
|
||||
// not clamping leads to noticeable image retention.
|
||||
alpha_float = MIN(alpha_float, 0.825f);
|
||||
// Skip clamping if high precision framebuffers are in use, as there's no risk of ghosting with those.
|
||||
if (!recomp_high_precision_fb_enabled()) {
|
||||
alpha_float = MIN(alpha_float, 0.825f);
|
||||
}
|
||||
alpha = (s32)(alpha_float * 255.0f);
|
||||
|
||||
// @recomp Set the dither noise strength based on the resolution scale to make it easier to see at higher resolutions.
|
||||
float res_scale = recomp_get_resolution_scale();
|
||||
float dither_noise_strength = CLAMP(1.0 + (res_scale - 1.0f) / 8.0f, 1.0f, 2.0f);
|
||||
// recomp_printf("res scale: %5.3f dither noise strength: %5.3f\n", res_scale, dither_noise_strength);
|
||||
gEXSetDitherNoiseStrength(OVERLAY_DISP++, dither_noise_strength);
|
||||
|
||||
if (sMotionBlurStatus == MOTION_BLUR_PROCESS) {
|
||||
func_80170AE0(&this->pauseBgPreRender, &gfx, alpha);
|
||||
} else {
|
||||
@ -122,10 +126,10 @@ void Play_DrawMotionBlur(PlayState* this) {
|
||||
}
|
||||
|
||||
// @recomp Patched to increase the scale based on the aspect ratio.
|
||||
void Actor_DrawLensOverlay(Gfx** gfxP, s32 lensMaskSize) {
|
||||
RECOMP_PATCH void Actor_DrawLensOverlay(Gfx** gfxP, s32 lensMaskSize) {
|
||||
// @recomp Calculate the increase in aspect ratio.
|
||||
f32 original_aspect_ratio = (float)SCREEN_WIDTH / SCREEN_HEIGHT;
|
||||
f32 aspect_ratio_scale = recomp_get_aspect_ratio(original_aspect_ratio) / original_aspect_ratio;
|
||||
f32 aspect_ratio_scale = recomp_get_target_aspect_ratio(original_aspect_ratio) / original_aspect_ratio;
|
||||
|
||||
// @recomp Increase the circle's scale based on the aspect ratio scale. Also increase the base scaling
|
||||
// from 0.003f to 0.004f to account for overscan removal.
|
||||
@ -135,7 +139,7 @@ void Actor_DrawLensOverlay(Gfx** gfxP, s32 lensMaskSize) {
|
||||
|
||||
|
||||
// @recomp Patched to use ortho tris for interpolation and to prevent the telescope and lens effects from getting stretched wide.
|
||||
void TransitionCircle_LoadAndSetTexture(Gfx** gfxp, TexturePtr texture, s32 fmt, s32 arg3, s32 masks, s32 maskt,
|
||||
RECOMP_PATCH void TransitionCircle_LoadAndSetTexture(Gfx** gfxp, TexturePtr texture, s32 fmt, s32 arg3, s32 masks, s32 maskt,
|
||||
f32 arg6) {
|
||||
Gfx* gfx = *gfxp;
|
||||
s32 xh = gCfbWidth;
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "patches.h"
|
||||
#include "transform_ids.h"
|
||||
#include "overlays/actors/ovl_Object_Kankyo/z_object_kankyo.h"
|
||||
#include "overlays/actors/ovl_Eff_Stk/z_eff_stk.h"
|
||||
#include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h"
|
||||
#include "z64effect.h"
|
||||
|
||||
@ -14,7 +13,7 @@ extern Gfx gEffDustDL[];
|
||||
((&(particle).unk_1C)[1])
|
||||
|
||||
// @recomp Patched to record when a particle is moved to skip interpolation.
|
||||
void func_808DC454(ObjectKankyo* this, PlayState* play) {
|
||||
RECOMP_PATCH void func_808DC454(ObjectKankyo* this, PlayState* play) {
|
||||
s16 i;
|
||||
s32 pad1;
|
||||
f32 phi_f20;
|
||||
@ -156,7 +155,7 @@ void func_808DC454(ObjectKankyo* this, PlayState* play) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_808DD3C8(Actor* thisx, PlayState* play2) {
|
||||
RECOMP_PATCH void func_808DD3C8(Actor* thisx, PlayState* play2) {
|
||||
PlayState* play = play2;
|
||||
ObjectKankyo* this = (ObjectKankyo*)thisx;
|
||||
Vec3f worldPos;
|
||||
@ -179,15 +178,12 @@ void func_808DD3C8(Actor* thisx, PlayState* play2) {
|
||||
spB4 = false;
|
||||
|
||||
if (this->actor.params == 3) {
|
||||
// @recomp Manual relocation, TODO remove when the recompiler handles this automatically.
|
||||
f32* D_808DE5B0_ptr = actor_relocate(thisx, &D_808DE5B0);
|
||||
|
||||
temp_f0 = func_80173B48(&play->state) / 1.4e7f;
|
||||
temp_f0 = CLAMP(temp_f0, 0.0f, 1.0f);
|
||||
Math_SmoothStepToF(D_808DE5B0_ptr, temp_f0, 0.2f, 0.1f, 0.001f);
|
||||
Math_SmoothStepToF(&D_808DE5B0, temp_f0, 0.2f, 0.1f, 0.001f);
|
||||
|
||||
sp68 = play->envCtx.precipitation[PRECIP_SNOW_CUR];
|
||||
sp68 *= *D_808DE5B0_ptr;
|
||||
sp68 *= D_808DE5B0;
|
||||
|
||||
if ((play->envCtx.precipitation[PRECIP_SNOW_CUR] >= 32) && (sp68 < 32)) {
|
||||
sp68 = 32;
|
||||
@ -335,7 +331,7 @@ static inline void pop_effect_tag(GraphicsContext* gfxCtx) {
|
||||
}
|
||||
|
||||
// @recomp Patched to tag effects.
|
||||
void Effect_DrawAll(GraphicsContext* gfxCtx) {
|
||||
RECOMP_PATCH void Effect_DrawAll(GraphicsContext* gfxCtx) {
|
||||
s32 i;
|
||||
|
||||
|
||||
@ -392,51 +388,6 @@ void Effect_DrawAll(GraphicsContext* gfxCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
extern Gfx object_stk2_DL_008920[];
|
||||
extern Gfx object_stk2_DL_008A38[];
|
||||
extern AnimatedMaterial object_stk2_Matanimheader_009F60[];
|
||||
|
||||
void EffStk_Draw(Actor* thisx, PlayState* play) {
|
||||
EffStk* this = (EffStk*)thisx;
|
||||
s32 pad;
|
||||
Camera* activeCam = GET_ACTIVE_CAM(play);
|
||||
Vec3f eye = activeCam->eye;
|
||||
Vec3f quakeOffset;
|
||||
|
||||
quakeOffset = Camera_GetQuakeOffset(activeCam);
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
Gfx_SetupDL25_Xlu(play->state.gfxCtx);
|
||||
Matrix_Translate(eye.x + quakeOffset.x, eye.y + quakeOffset.y, eye.z + quakeOffset.z, MTXMODE_NEW);
|
||||
Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY);
|
||||
Matrix_ReplaceRotation(&play->billboardMtxF);
|
||||
Matrix_Translate(0.0f, 0.0f, this->unk148, MTXMODE_APPLY);
|
||||
|
||||
Mtx* mtx = Matrix_NewMtx(play->state.gfxCtx);
|
||||
|
||||
// @recomp Tag the transform. Do not allow edits as this will get edited by the billboard detection and we'll want to skip position during a camera cut too.
|
||||
if (camera_was_skipped()) {
|
||||
gEXMatrixGroupDecomposedSkipPosRot(POLY_XLU_DISP++, actor_transform_id(thisx), G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_NONE);
|
||||
}
|
||||
else {
|
||||
gEXMatrixGroupDecomposedNormal(POLY_XLU_DISP++, actor_transform_id(thisx), G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_NONE);
|
||||
}
|
||||
|
||||
gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
AnimatedMat_DrawAlphaStep(play, Lib_SegmentedToVirtual(object_stk2_Matanimheader_009F60), 1.0f, this->unk144);
|
||||
gDPSetColorDither(POLY_XLU_DISP++, G_CD_NOISE);
|
||||
gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_NOISE);
|
||||
gSPDisplayList(POLY_XLU_DISP++, object_stk2_DL_008920);
|
||||
gSPDisplayList(POLY_XLU_DISP++, object_stk2_DL_008A38);
|
||||
|
||||
// @recomp Pop the transform tag.
|
||||
gEXPopMatrixGroup(POLY_XLU_DISP++, G_MTX_MODELVIEW);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
|
||||
typedef enum {
|
||||
/* 0x00 */ CLEAR_TAG_EFFECT_AVAILABLE,
|
||||
/* 0x01 */ CLEAR_TAG_EFFECT_DEBRIS,
|
||||
@ -491,7 +442,7 @@ static TexturePtr sWaterSplashTextures[] = {
|
||||
* applies to all effects of that type while drawing the first effect of that type.
|
||||
*/
|
||||
// @recomp Patched to tag matrices.
|
||||
void EnClearTag_DrawEffects(Actor* thisx, PlayState* play) {
|
||||
RECOMP_PATCH void EnClearTag_DrawEffects(Actor* thisx, PlayState* play) {
|
||||
u8 isMaterialApplied = false;
|
||||
s16 i;
|
||||
s16 j;
|
||||
@ -515,8 +466,7 @@ void EnClearTag_DrawEffects(Actor* thisx, PlayState* play) {
|
||||
// Apply the debris effect material if it has not already been applied.
|
||||
if (!isMaterialApplied) {
|
||||
isMaterialApplied++;
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
gSPDisplayList(POLY_OPA_DISP++, actor_relocate(thisx, gClearTagDebrisEffectMaterialDL));
|
||||
gSPDisplayList(POLY_OPA_DISP++, gClearTagDebrisEffectMaterialDL);
|
||||
}
|
||||
|
||||
// Draw the debris effect.
|
||||
@ -527,8 +477,7 @@ void EnClearTag_DrawEffects(Actor* thisx, PlayState* play) {
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
// @recomp Tag the matrix.
|
||||
gEXMatrixGroupDecomposedNormal(POLY_OPA_DISP++, actor_transform_id(thisx) + i, G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_NONE);
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
gSPDisplayList(POLY_OPA_DISP++, actor_relocate(thisx, gClearTagDebrisEffectDL));
|
||||
gSPDisplayList(POLY_OPA_DISP++, gClearTagDebrisEffectDL);
|
||||
// @recomp Pop the matrix tag.
|
||||
gEXPopMatrixGroup(POLY_OPA_DISP++, G_MTX_MODELVIEW);
|
||||
}
|
||||
@ -577,8 +526,7 @@ void EnClearTag_DrawEffects(Actor* thisx, PlayState* play) {
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
// @recomp Tag the matrix.
|
||||
gEXMatrixGroupDecomposedNormal(POLY_XLU_DISP++, actor_transform_id(thisx) + i, G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_NONE);
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
gSPDisplayList(POLY_XLU_DISP++, actor_relocate(thisx, gClearTagFlashEffectGroundDL));
|
||||
gSPDisplayList(POLY_XLU_DISP++, gClearTagFlashEffectGroundDL);
|
||||
// @recomp Pop the matrix tag.
|
||||
gEXPopMatrixGroup(POLY_XLU_DISP++, G_MTX_MODELVIEW);
|
||||
}
|
||||
@ -592,8 +540,7 @@ void EnClearTag_DrawEffects(Actor* thisx, PlayState* play) {
|
||||
if ((effect->type == CLEAR_TAG_EFFECT_SMOKE) || (effect->type == CLEAR_TAG_EFFECT_ISOLATED_SMOKE)) {
|
||||
// Apply the smoke effect material if it has not already been applied.
|
||||
if (!isMaterialApplied) {
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
gSPDisplayList(POLY_XLU_DISP++, actor_relocate(thisx, gClearTagFireEffectMaterialDL));
|
||||
gSPDisplayList(POLY_XLU_DISP++, gClearTagFireEffectMaterialDL);
|
||||
isMaterialApplied++;
|
||||
}
|
||||
|
||||
@ -612,8 +559,7 @@ void EnClearTag_DrawEffects(Actor* thisx, PlayState* play) {
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
// @recomp Tag the matrix.
|
||||
gEXMatrixGroupDecomposedNormal(POLY_XLU_DISP++, actor_transform_id(thisx) + i, G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_NONE);
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
gSPDisplayList(POLY_XLU_DISP++, actor_relocate(thisx, gClearTagFireEffectDL));
|
||||
gSPDisplayList(POLY_XLU_DISP++, gClearTagFireEffectDL);
|
||||
// @recomp Pop the matrix tag.
|
||||
gEXPopMatrixGroup(POLY_XLU_DISP++, G_MTX_MODELVIEW);
|
||||
}
|
||||
@ -626,8 +572,7 @@ void EnClearTag_DrawEffects(Actor* thisx, PlayState* play) {
|
||||
if (effect->type == CLEAR_TAG_EFFECT_FIRE) {
|
||||
// Apply the fire effect material if it has not already been applied.
|
||||
if (!isMaterialApplied) {
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
gSPDisplayList(POLY_XLU_DISP++, actor_relocate(thisx, gClearTagFireEffectMaterialDL));
|
||||
gSPDisplayList(POLY_XLU_DISP++, gClearTagFireEffectMaterialDL);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 255, 215, 255, 128);
|
||||
isMaterialApplied++;
|
||||
}
|
||||
@ -642,8 +587,7 @@ void EnClearTag_DrawEffects(Actor* thisx, PlayState* play) {
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
// @recomp Tag the matrix.
|
||||
gEXMatrixGroupDecomposedNormal(POLY_XLU_DISP++, actor_transform_id(thisx) + i, G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_NONE);
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
gSPDisplayList(POLY_XLU_DISP++, actor_relocate(thisx, gClearTagFireEffectDL));
|
||||
gSPDisplayList(POLY_XLU_DISP++, gClearTagFireEffectDL);
|
||||
// @recomp Pop the matrix tag.
|
||||
gEXPopMatrixGroup(POLY_XLU_DISP++, G_MTX_MODELVIEW);
|
||||
}
|
||||
@ -669,8 +613,7 @@ void EnClearTag_DrawEffects(Actor* thisx, PlayState* play) {
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
// @recomp Tag the matrix.
|
||||
gEXMatrixGroupDecomposedNormal(POLY_XLU_DISP++, actor_transform_id(thisx) + i, G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_NONE);
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
gSPDisplayList(POLY_XLU_DISP++, actor_relocate(thisx, gClearTagFlashEffectDL));
|
||||
gSPDisplayList(POLY_XLU_DISP++, gClearTagFlashEffectDL);
|
||||
// @recomp Pop the matrix tag.
|
||||
gEXPopMatrixGroup(POLY_XLU_DISP++, G_MTX_MODELVIEW);
|
||||
}
|
||||
@ -686,8 +629,7 @@ void EnClearTag_DrawEffects(Actor* thisx, PlayState* play) {
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, (u8)effect->envColor.r, (u8)effect->envColor.g, (u8)effect->envColor.b,
|
||||
0);
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
gSPDisplayList(POLY_XLU_DISP++, actor_relocate(thisx, gClearTagLightRayEffectMaterialDL));
|
||||
gSPDisplayList(POLY_XLU_DISP++, gClearTagLightRayEffectMaterialDL);
|
||||
isMaterialApplied++;
|
||||
}
|
||||
|
||||
@ -703,8 +645,7 @@ void EnClearTag_DrawEffects(Actor* thisx, PlayState* play) {
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
// @recomp Tag the matrix.
|
||||
gEXMatrixGroupDecomposedNormal(POLY_XLU_DISP++, actor_transform_id(thisx) + i, G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_NONE);
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
gSPDisplayList(POLY_XLU_DISP++, actor_relocate(thisx, gClearTagLightRayEffectDL));
|
||||
gSPDisplayList(POLY_XLU_DISP++, gClearTagLightRayEffectDL);
|
||||
// @recomp Pop the matrix tag.
|
||||
gEXPopMatrixGroup(POLY_XLU_DISP++, G_MTX_MODELVIEW);
|
||||
}
|
||||
@ -751,3 +692,75 @@ void EnClearTag_DrawEffects(Actor* thisx, PlayState* play) {
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
// @recomp Patched to tag the two custom lens flares (used by the Igos du Ikana curtains).
|
||||
RECOMP_PATCH void Environment_DrawCustomLensFlare(PlayState* play) {
|
||||
Vec3f pos;
|
||||
|
||||
// @recomp Set up the graphics context.
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
if (gCustomLensFlare1On) {
|
||||
pos.x = gCustomLensFlare1Pos.x;
|
||||
pos.y = gCustomLensFlare1Pos.y;
|
||||
pos.z = gCustomLensFlare1Pos.z;
|
||||
// @recomp Tag the entire lens flare effect, using order linear. Skip interpolation when the camera is skipped.
|
||||
if (camera_was_skipped()) {
|
||||
gEXMatrixGroupDecomposedSkipAll(POLY_XLU_DISP++, CUSTOM_LENS_FLARE_TRANSFORM_ID_START + 0, G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_NONE);
|
||||
}
|
||||
else {
|
||||
gEXMatrixGroupDecomposedNormal(POLY_XLU_DISP++, CUSTOM_LENS_FLARE_TRANSFORM_ID_START + 0, G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_NONE);
|
||||
}
|
||||
Environment_DrawLensFlare(play, &play->envCtx, &play->view, play->state.gfxCtx, pos, D_801F4E44, D_801F4E48,
|
||||
D_801F4E4C, false);
|
||||
// @recomp Pop the matrix group.
|
||||
gEXPopMatrixGroup(POLY_XLU_DISP++, G_MTX_MODELVIEW);
|
||||
}
|
||||
|
||||
if (gCustomLensFlare2On) {
|
||||
pos.x = gCustomLensFlare2Pos.x;
|
||||
pos.y = gCustomLensFlare2Pos.y;
|
||||
pos.z = gCustomLensFlare2Pos.z;
|
||||
// @recomp Tag the entire lens flare effect, using order linear. Skip interpolation when the camera is skipped.
|
||||
if (camera_was_skipped()) {
|
||||
gEXMatrixGroupDecomposedSkipAll(POLY_XLU_DISP++, CUSTOM_LENS_FLARE_TRANSFORM_ID_START + 1, G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_NONE);
|
||||
}
|
||||
else {
|
||||
gEXMatrixGroupDecomposedNormal(POLY_XLU_DISP++, CUSTOM_LENS_FLARE_TRANSFORM_ID_START + 1, G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_NONE);
|
||||
}
|
||||
Environment_DrawLensFlare(play, &play->envCtx, &play->view, play->state.gfxCtx, pos, D_801F4E5C, D_801F4E60,
|
||||
D_801F4E64, false);
|
||||
// @recomp Pop the matrix group.
|
||||
gEXPopMatrixGroup(POLY_XLU_DISP++, G_MTX_MODELVIEW);
|
||||
}
|
||||
|
||||
// @recomp Close the graphics context.
|
||||
CLOSE_DISPS();
|
||||
}
|
||||
|
||||
// @recomp Patched to tag the sun lens flare.
|
||||
RECOMP_PATCH void Environment_DrawSunLensFlare(PlayState* play, EnvironmentContext* envCtx, View* view, GraphicsContext* gfxCtx,
|
||||
Vec3f vec) {
|
||||
if ((play->envCtx.precipitation[PRECIP_RAIN_CUR] == 0) &&
|
||||
!(GET_ACTIVE_CAM(play)->stateFlags & CAM_STATE_UNDERWATER) && (play->skyboxId == SKYBOX_NORMAL_SKY)) {
|
||||
f32 v0 = Math_CosS(CURRENT_TIME - CLOCK_TIME(12, 0));
|
||||
|
||||
// @recomp Set up the graphics context.
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
// @recomp Tag the entire lens flare effect, using order linear. Skip interpolation when the camera is skipped.
|
||||
if (camera_was_skipped()) {
|
||||
gEXMatrixGroupDecomposedSkipAll(POLY_XLU_DISP++, SUN_LENS_FLARE_TRANSFORM_ID, G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_NONE);
|
||||
}
|
||||
else {
|
||||
gEXMatrixGroupDecomposedNormal(POLY_XLU_DISP++, SUN_LENS_FLARE_TRANSFORM_ID, G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_NONE);
|
||||
}
|
||||
Environment_DrawLensFlare(play, &play->envCtx, &play->view, play->state.gfxCtx, vec, 370.0f, v0 * 120.0f, 0x190,
|
||||
true);
|
||||
// @recomp Pop the matrix group.
|
||||
gEXPopMatrixGroup(POLY_XLU_DISP++, G_MTX_MODELVIEW);
|
||||
|
||||
// @recomp Close the graphics context.
|
||||
CLOSE_DISPS();
|
||||
}
|
||||
}
|
||||
|
245
patches/fixes.c
245
patches/fixes.c
@ -1,11 +1,14 @@
|
||||
#include "patches.h"
|
||||
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
|
||||
#include "overlays/actors/ovl_En_Fall/z_en_fall.h"
|
||||
#include "overlays/actors/ovl_Demo_Effect/z_demo_effect.h"
|
||||
#include "overlays/gamestates/ovl_daytelop/z_daytelop.h"
|
||||
#include "z64shrink_window.h"
|
||||
|
||||
#define PAGE_BG_WIDTH (PAGE_BG_COLS * PAGE_BG_QUAD_WIDTH)
|
||||
#define PAGE_BG_HEIGHT (PAGE_BG_ROWS * PAGE_BG_QUAD_HEIGHT)
|
||||
|
||||
#define RECOMP_PAGE_ROW_HEIGHT 14
|
||||
#define RECOMP_PAGE_ROW_HEIGHT 15
|
||||
#define RECOMP_PAGE_ROW_COUNT ((PAGE_BG_HEIGHT + RECOMP_PAGE_ROW_HEIGHT - 1) / RECOMP_PAGE_ROW_HEIGHT)
|
||||
|
||||
extern s16* sVtxPageQuadsX[VTX_PAGE_MAX];
|
||||
@ -22,7 +25,7 @@ s16 sVtxPageGameOverSaveQuadsY[VTX_PAGE_SAVE_QUADS] = {
|
||||
};
|
||||
|
||||
// @recomp patched to draw as strips with bilerp compensation instead of tiles.
|
||||
s16 KaleidoScope_SetPageVertices(PlayState* play, Vtx* vtx, s16 vtxPage, s16 numQuads) {
|
||||
RECOMP_PATCH s16 KaleidoScope_SetPageVertices(PlayState* play, Vtx* vtx, s16 vtxPage, s16 numQuads) {
|
||||
PauseContext* pauseCtx = &play->pauseCtx;
|
||||
GameOverContext* gameOverCtx = &play->gameOverCtx;
|
||||
s16* quadsX;
|
||||
@ -32,11 +35,11 @@ s16 KaleidoScope_SetPageVertices(PlayState* play, Vtx* vtx, s16 vtxPage, s16 num
|
||||
s32 cur_y;
|
||||
u32 row;
|
||||
|
||||
cur_y = PAGE_BG_HEIGHT / 2;
|
||||
cur_y = (PAGE_BG_HEIGHT + 2) / 2;
|
||||
|
||||
// 2 verts per row plus 2 extra verts at the start and the end.
|
||||
for (row = 0; row < RECOMP_PAGE_ROW_COUNT + 2; row++) {
|
||||
s32 next_y = MAX(cur_y - RECOMP_PAGE_ROW_HEIGHT, -PAGE_BG_HEIGHT / 2);
|
||||
s32 next_y = MAX(cur_y - RECOMP_PAGE_ROW_HEIGHT, -(PAGE_BG_HEIGHT + 2) / 2);
|
||||
|
||||
vtx[4 * row + 0].v.ob[0] = -PAGE_BG_WIDTH / 2;
|
||||
vtx[4 * row + 1].v.ob[0] = PAGE_BG_WIDTH / 2;
|
||||
@ -52,16 +55,16 @@ s16 KaleidoScope_SetPageVertices(PlayState* play, Vtx* vtx, s16 vtxPage, s16 num
|
||||
|
||||
vtx[4 * row + 0].v.flag = vtx[4 * row + 1].v.flag = vtx[4 * row + 2].v.flag = vtx[4 * row + 3].v.flag = 0;
|
||||
|
||||
#define PIXEL_OFFSET ((1 << 4))
|
||||
#define PIXEL_OFFSET 0
|
||||
|
||||
vtx[4 * row + 0].v.tc[0] = PIXEL_OFFSET;
|
||||
vtx[4 * row + 0].v.tc[1] = (1 << 5) + PIXEL_OFFSET;
|
||||
vtx[4 * row + 1].v.tc[0] = PAGE_BG_WIDTH * (1 << 5) + PIXEL_OFFSET;
|
||||
vtx[4 * row + 1].v.tc[1] = (1 << 5) + PIXEL_OFFSET;
|
||||
vtx[4 * row + 0].v.tc[1] = PIXEL_OFFSET;
|
||||
vtx[4 * row + 1].v.tc[0] = (PAGE_BG_WIDTH + 2 - 1) * (1 << 5) + PIXEL_OFFSET;
|
||||
vtx[4 * row + 1].v.tc[1] = PIXEL_OFFSET;
|
||||
vtx[4 * row + 2].v.tc[0] = PIXEL_OFFSET;
|
||||
vtx[4 * row + 2].v.tc[1] = (cur_y - next_y + 1) * (1 << 5) + PIXEL_OFFSET;
|
||||
vtx[4 * row + 3].v.tc[0] = PAGE_BG_WIDTH * (1 << 5) + PIXEL_OFFSET;
|
||||
vtx[4 * row + 3].v.tc[1] = (cur_y - next_y + 1) * (1 << 5) + PIXEL_OFFSET;
|
||||
vtx[4 * row + 2].v.tc[1] = (cur_y - next_y + 1 - 1) * (1 << 5) + PIXEL_OFFSET;
|
||||
vtx[4 * row + 3].v.tc[0] = (PAGE_BG_WIDTH + 2 - 1) * (1 << 5) + PIXEL_OFFSET;
|
||||
vtx[4 * row + 3].v.tc[1] = (cur_y - next_y + 1 - 1) * (1 << 5) + PIXEL_OFFSET;
|
||||
|
||||
vtx[4 * row + 0].v.cn[0] = vtx[4 * row + 1].v.cn[0] = vtx[4 * row + 2].v.cn[0] = vtx[4 * row + 3].v.cn[0] = 0;
|
||||
vtx[4 * row + 0].v.cn[1] = vtx[4 * row + 1].v.cn[1] = vtx[4 * row + 2].v.cn[1] = vtx[4 * row + 3].v.cn[1] = 0;
|
||||
@ -70,21 +73,14 @@ s16 KaleidoScope_SetPageVertices(PlayState* play, Vtx* vtx, s16 vtxPage, s16 num
|
||||
|
||||
cur_y = next_y;
|
||||
}
|
||||
|
||||
// These are overlay symbols, so their addresses need to be offset to get their actual loaded vram address.
|
||||
// TODO remove this once the recompiler is able to handle overlay symbols automatically for patch functions.
|
||||
s16** sVtxPageQuadsXRelocated = (s16**)KaleidoManager_GetRamAddr(sVtxPageQuadsX);
|
||||
s16** sVtxPageQuadsWidthRelocated = (s16**)KaleidoManager_GetRamAddr(sVtxPageQuadsWidth);
|
||||
s16** sVtxPageQuadsYRelocated = (s16**)KaleidoManager_GetRamAddr(sVtxPageQuadsY);
|
||||
s16** sVtxPageQuadsHeightRelocated = (s16**)KaleidoManager_GetRamAddr(sVtxPageQuadsHeight);
|
||||
|
||||
|
||||
s16 k = 60;
|
||||
|
||||
if (numQuads != 0) {
|
||||
quadsX = sVtxPageQuadsXRelocated[vtxPage];
|
||||
quadsWidth = sVtxPageQuadsWidthRelocated[vtxPage];
|
||||
quadsY = sVtxPageQuadsYRelocated[vtxPage];
|
||||
quadsHeight = sVtxPageQuadsHeightRelocated[vtxPage];
|
||||
quadsX = sVtxPageQuadsX[vtxPage];
|
||||
quadsWidth = sVtxPageQuadsWidth[vtxPage];
|
||||
quadsY = sVtxPageQuadsY[vtxPage];
|
||||
quadsHeight = sVtxPageQuadsHeight[vtxPage];
|
||||
s16 i;
|
||||
|
||||
for (i = 0; i < numQuads; i++, k += 4) {
|
||||
@ -182,10 +178,10 @@ void KaleidoUpdateWrapper(PlayState* play) {
|
||||
|
||||
void KaleidoDrawWrapper(PlayState* play) {
|
||||
// @recomp Update the background image pointers to reflect the overlay's load address.
|
||||
bg_pointers[0] = KaleidoManager_GetRamAddr(sMaskPageBgTextures);
|
||||
bg_pointers[1] = KaleidoManager_GetRamAddr(sItemPageBgTextures);
|
||||
bg_pointers[2] = KaleidoManager_GetRamAddr(sMapPageBgTextures);
|
||||
bg_pointers[3] = KaleidoManager_GetRamAddr(sQuestPageBgTextures);
|
||||
bg_pointers[0] = sMaskPageBgTextures;
|
||||
bg_pointers[1] = sItemPageBgTextures;
|
||||
bg_pointers[2] = sMapPageBgTextures;
|
||||
bg_pointers[3] = sQuestPageBgTextures;
|
||||
|
||||
KaleidoScope_Draw(play);
|
||||
|
||||
@ -199,16 +195,16 @@ void KaleidoDrawWrapper(PlayState* play) {
|
||||
uintptr_t old_segment_0D = gSegments[0x0D];
|
||||
gSegments[0x08] = OS_K0_TO_PHYSICAL(play->pauseCtx.iconItemSegment);
|
||||
gSegments[0x0D] = OS_K0_TO_PHYSICAL(play->pauseCtx.iconItemLangSegment);
|
||||
assemble_image(KaleidoManager_GetRamAddr(sMaskPageBgTextures), &bg_images[0]);
|
||||
assemble_image(KaleidoManager_GetRamAddr(sItemPageBgTextures), &bg_images[1]);
|
||||
assemble_image(KaleidoManager_GetRamAddr(sMapPageBgTextures), &bg_images[2]);
|
||||
assemble_image(KaleidoManager_GetRamAddr(sQuestPageBgTextures), &bg_images[3]);
|
||||
assemble_image(sMaskPageBgTextures, &bg_images[0]);
|
||||
assemble_image(sItemPageBgTextures, &bg_images[1]);
|
||||
assemble_image(sMapPageBgTextures, &bg_images[2]);
|
||||
assemble_image(sQuestPageBgTextures, &bg_images[3]);
|
||||
gSegments[0x08] = old_segment_08;
|
||||
gSegments[0x0D] = old_segment_0D;
|
||||
}
|
||||
}
|
||||
|
||||
void KaleidoScopeCall_Init(PlayState* play) {
|
||||
RECOMP_PATCH void KaleidoScopeCall_Init(PlayState* play) {
|
||||
// @recomp Set the update and draw func pointers to the wrappers instead of the actual functions.
|
||||
sKaleidoScopeUpdateFunc = KaleidoUpdateWrapper;
|
||||
sKaleidoScopeDrawFunc = KaleidoDrawWrapper;
|
||||
@ -216,7 +212,7 @@ void KaleidoScopeCall_Init(PlayState* play) {
|
||||
}
|
||||
|
||||
// @recomp patched to fix bilerp seams.
|
||||
Gfx* KaleidoScope_DrawPageSections(Gfx* gfx, Vtx* vertices, TexturePtr* textures) {
|
||||
RECOMP_PATCH Gfx* KaleidoScope_DrawPageSections(Gfx* gfx, Vtx* vertices, TexturePtr* textures) {
|
||||
s32 i;
|
||||
s32 j;
|
||||
|
||||
@ -238,20 +234,21 @@ Gfx* KaleidoScope_DrawPageSections(Gfx* gfx, Vtx* vertices, TexturePtr* textures
|
||||
|
||||
// Draw the rows.
|
||||
for (u32 bg_row = 0; bg_row < RECOMP_PAGE_ROW_COUNT; bg_row++) {
|
||||
u32 cur_row_height = MIN(RECOMP_PAGE_ROW_HEIGHT, PAGE_BG_HEIGHT + 1 - bg_row * RECOMP_PAGE_ROW_HEIGHT);
|
||||
gDPLoadTextureTile(gfx++, *cur_image,
|
||||
G_IM_FMT_IA, G_IM_SIZ_8b, // fmt, siz
|
||||
PAGE_BG_WIDTH + 2, PAGE_BG_HEIGHT + 2, // width, height
|
||||
0, (bg_row + 0) * RECOMP_PAGE_ROW_HEIGHT, // uls, ult
|
||||
PAGE_BG_WIDTH + 2, (bg_row + 1) * RECOMP_PAGE_ROW_HEIGHT + 2, // lrs, lrt
|
||||
0, bg_row * RECOMP_PAGE_ROW_HEIGHT, // uls, ult
|
||||
PAGE_BG_WIDTH + 2 - 1, bg_row * RECOMP_PAGE_ROW_HEIGHT + cur_row_height + 1 - 1, // lrs, lrt
|
||||
0, // pal
|
||||
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP,
|
||||
G_TX_NOMASK, G_TX_NOMASK,
|
||||
G_TX_NOLOD, G_TX_NOLOD);
|
||||
gDPSetTileSize(gfx++, G_TX_RENDERTILE,
|
||||
0 << G_TEXTURE_IMAGE_FRAC,
|
||||
0 << G_TEXTURE_IMAGE_FRAC,
|
||||
(PAGE_BG_WIDTH + 2) <<G_TEXTURE_IMAGE_FRAC,
|
||||
(RECOMP_PAGE_ROW_HEIGHT + 2) << G_TEXTURE_IMAGE_FRAC);
|
||||
(PAGE_BG_WIDTH + 2 - 1) <<G_TEXTURE_IMAGE_FRAC,
|
||||
(cur_row_height + 1 - 1) << G_TEXTURE_IMAGE_FRAC);
|
||||
gSPVertex(gfx++, vertices + 4 * bg_row, 4, 0);
|
||||
gSP2Triangles(gfx++, 0, 3, 1, 0x0, 3, 0, 2, 0x0);
|
||||
}
|
||||
@ -267,7 +264,7 @@ int extra_vis = 0;
|
||||
|
||||
// @recomp Patch the giants cutscene to make certain frames take longer to mimic performance on console.
|
||||
// This prevents the music from desyncing from the cutscene as it was designed around the console's frame times.
|
||||
void Cutscene_UpdateScripted(PlayState* play, CutsceneContext* csCtx) {
|
||||
RECOMP_PATCH void Cutscene_UpdateScripted(PlayState* play, CutsceneContext* csCtx) {
|
||||
if ((gSaveContext.cutsceneTrigger != 0) && (play->transitionTrigger == TRANS_TRIGGER_START)) {
|
||||
gSaveContext.cutsceneTrigger = 0;
|
||||
}
|
||||
@ -298,3 +295,173 @@ void Cutscene_UpdateScripted(PlayState* play, CutsceneContext* csCtx) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// @recomp Fix a texture scroll using an incorrect tile size, which resulted in the scroll jumping during the animation.
|
||||
RECOMP_PATCH s32 DemoEffect_OverrideLimbDrawTimewarp(PlayState* play, SkelCurve* skelCurve, s32 limbIndex, Actor* thisx) {
|
||||
s32 pad;
|
||||
DemoEffect* this = (DemoEffect*)thisx;
|
||||
u32 frames = play->gameplayFrames;
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
Gfx_SetupDL25_Xlu(play->state.gfxCtx);
|
||||
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 170, 255, 255, 255);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, this->envXluColor[0], this->envXluColor[1], this->envXluColor[2], 255);
|
||||
|
||||
// @recomp Fix the tile size to be 64x64 for both tiles to match the actual texture size.
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08,
|
||||
Gfx_TwoTexScroll(play->state.gfxCtx,
|
||||
0, (frames * 6) % 256, 255 - ((frames * 16) % 256), 0x40, 0x40,
|
||||
1, (frames * 4) % 256, 255 - ((frames * 12) % 256), 0x40, 0x40));
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
|
||||
if (limbIndex == 0) {
|
||||
s16* transform = skelCurve->jointTable[0];
|
||||
|
||||
transform[2] = transform[0] = 1024;
|
||||
transform[1] = 1024;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void DayTelop_Main(GameState* thisx);
|
||||
void DayTelop_Destroy(GameState* thisx);
|
||||
void DayTelop_Noop(DayTelopState* this);
|
||||
void DayTelop_LoadGraphics(DayTelopState* this);
|
||||
|
||||
// @recomp Increase the length of the "Dawn of the X Day" screen to account for faster loading.
|
||||
RECOMP_PATCH void DayTelop_Init(GameState* thisx) {
|
||||
DayTelopState* this = (DayTelopState*)thisx;
|
||||
|
||||
GameState_SetFramerateDivisor(&this->state, 1);
|
||||
Matrix_Init(&this->state);
|
||||
ShrinkWindow_Destroy();
|
||||
View_Init(&this->view, this->state.gfxCtx);
|
||||
this->state.main = DayTelop_Main;
|
||||
this->state.destroy = DayTelop_Destroy;
|
||||
// @recomp Add 120 extra frames (2 seconds with a frame divisor of 1) to account for faster loading.
|
||||
this->transitionCountdown = 260;
|
||||
this->fadeInState = DAYTELOP_HOURSTEXT_OFF;
|
||||
|
||||
if (gSaveContext.save.day < 9) {
|
||||
if (gSaveContext.save.day == 0) {
|
||||
Sram_ClearFlagsAtDawnOfTheFirstDay();
|
||||
}
|
||||
Sram_IncrementDay();
|
||||
}
|
||||
|
||||
DayTelop_Noop(this);
|
||||
DayTelop_LoadGraphics(this);
|
||||
Audio_PlaySfx(NA_SE_OC_TELOP_IMPACT);
|
||||
}
|
||||
|
||||
extern PlayerAnimationHeader* D_8085D17C[PLAYER_FORM_MAX];
|
||||
void Player_TalkWithPlayer(PlayState* play, Actor* actor);
|
||||
void Player_Action_88(Player* this, PlayState* play);
|
||||
void Player_SetAction_PreserveItemAction(PlayState* play, Player* this, PlayerActionFunc actionFunc, s32 arg3);
|
||||
void Player_AnimationPlayOnceReverse(PlayState* play, Player* this, PlayerAnimationHeader* anim);
|
||||
s32 Player_ActionChange_13(Player* this, PlayState* play);
|
||||
s32 func_8085B28C(PlayState* play, Player* this, PlayerCsAction csAction);
|
||||
void func_808525C4(PlayState* play, Player* this);
|
||||
void func_8085255C(PlayState* play, Player* this);
|
||||
void func_80836A5C(Player* this, PlayState* play);
|
||||
s32 func_8082DA90(PlayState* play);
|
||||
|
||||
// @recomp Patched to fix the issue where ocarina inputs are discarded for the first 3 frames (150ms).
|
||||
RECOMP_PATCH void Player_Action_63(Player* this, PlayState* play) {
|
||||
if ((this->unk_AA5 != PLAYER_UNKAA5_4) && ((PlayerAnimation_Update(play, &this->skelAnime) &&
|
||||
(this->skelAnime.animation == D_8085D17C[this->transformation])) ||
|
||||
((this->skelAnime.mode == 0) && (this->av2.actionVar2 == 0)))) {
|
||||
func_808525C4(play, this);
|
||||
// @recomp Fix the bug where ocarina inputs are discarded for 3 frames by only running this on the first frame of this state.
|
||||
if (this->av2.actionVar2 == 1) {
|
||||
if (!(this->actor.flags & ACTOR_FLAG_20000000) || (this->unk_A90->id == ACTOR_EN_ZOT)) {
|
||||
Message_DisplayOcarinaStaff(play, OCARINA_ACTION_FREE_PLAY);
|
||||
}
|
||||
}
|
||||
} else if (this->av2.actionVar2 != 0) {
|
||||
if (play->msgCtx.ocarinaMode == OCARINA_MODE_END) {
|
||||
play->interfaceCtx.unk_222 = 0;
|
||||
CutsceneManager_Stop(play->playerCsIds[PLAYER_CS_ID_ITEM_OCARINA]);
|
||||
this->actor.flags &= ~ACTOR_FLAG_20000000;
|
||||
|
||||
if ((this->talkActor != NULL) && (this->talkActor == this->unk_A90) && (this->unk_A94 >= 0.0f)) {
|
||||
Player_TalkWithPlayer(play, this->talkActor);
|
||||
} else if (this->tatlTextId < 0) {
|
||||
this->talkActor = this->tatlActor;
|
||||
this->tatlActor->textId = -this->tatlTextId;
|
||||
Player_TalkWithPlayer(play, this->talkActor);
|
||||
} else if (!Player_ActionChange_13(this, play)) {
|
||||
func_80836A5C(this, play);
|
||||
Player_AnimationPlayOnceReverse(play, this, D_8085D17C[this->transformation]);
|
||||
}
|
||||
} else {
|
||||
s32 var_v1 = (play->msgCtx.ocarinaMode >= OCARINA_MODE_WARP_TO_GREAT_BAY_COAST) &&
|
||||
(play->msgCtx.ocarinaMode <= OCARINA_MODE_WARP_TO_ENTRANCE);
|
||||
s32 pad[2];
|
||||
|
||||
if (var_v1 || (play->msgCtx.ocarinaMode == OCARINA_MODE_APPLY_SOT) ||
|
||||
(play->msgCtx.ocarinaMode == OCARINA_MODE_APPLY_DOUBLE_SOT) ||
|
||||
(play->msgCtx.ocarinaMode == OCARINA_MODE_APPLY_INV_SOT_FAST) ||
|
||||
(play->msgCtx.ocarinaMode == OCARINA_MODE_APPLY_INV_SOT_SLOW)) {
|
||||
if (play->msgCtx.ocarinaMode == OCARINA_MODE_APPLY_SOT) {
|
||||
if (!func_8082DA90(play)) {
|
||||
if (gSaveContext.save.saveInfo.playerData.threeDayResetCount == 1) {
|
||||
play->nextEntrance = ENTRANCE(CUTSCENE, 1);
|
||||
} else {
|
||||
play->nextEntrance = ENTRANCE(CUTSCENE, 0);
|
||||
}
|
||||
|
||||
gSaveContext.nextCutsceneIndex = 0xFFF7;
|
||||
play->transitionTrigger = TRANS_TRIGGER_START;
|
||||
}
|
||||
} else {
|
||||
Actor* actor;
|
||||
|
||||
play->interfaceCtx.unk_222 = 0;
|
||||
CutsceneManager_Stop(play->playerCsIds[PLAYER_CS_ID_ITEM_OCARINA]);
|
||||
this->actor.flags &= ~ACTOR_FLAG_20000000;
|
||||
|
||||
actor = Actor_Spawn(&play->actorCtx, play, var_v1 ? ACTOR_EN_TEST7 : ACTOR_EN_TEST6,
|
||||
this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0,
|
||||
0, play->msgCtx.ocarinaMode);
|
||||
if (actor != NULL) {
|
||||
this->stateFlags1 &= ~PLAYER_STATE1_20000000;
|
||||
this->csAction = PLAYER_CSACTION_NONE;
|
||||
func_8085B28C(play, NULL, PLAYER_CSACTION_19);
|
||||
this->stateFlags1 |= PLAYER_STATE1_10000000 | PLAYER_STATE1_20000000;
|
||||
} else {
|
||||
func_80836A5C(this, play);
|
||||
Player_AnimationPlayOnceReverse(play, this, D_8085D17C[this->transformation]);
|
||||
}
|
||||
}
|
||||
} else if ((play->msgCtx.ocarinaMode == OCARINA_MODE_EVENT) &&
|
||||
(play->msgCtx.lastPlayedSong == OCARINA_SONG_ELEGY)) {
|
||||
play->interfaceCtx.unk_222 = 0;
|
||||
CutsceneManager_Stop(play->playerCsIds[PLAYER_CS_ID_ITEM_OCARINA]);
|
||||
|
||||
this->actor.flags &= ~ACTOR_FLAG_20000000;
|
||||
Player_SetAction_PreserveItemAction(play, this, Player_Action_88, 0);
|
||||
this->stateFlags1 |= PLAYER_STATE1_10000000 | PLAYER_STATE1_20000000;
|
||||
} else if (this->unk_AA5 == PLAYER_UNKAA5_4) {
|
||||
f32 temp_fa0 = this->skelAnime.jointTable[PLAYER_LIMB_ROOT - 1].x;
|
||||
f32 temp_fa1 = this->skelAnime.jointTable[PLAYER_LIMB_ROOT - 1].z;
|
||||
f32 var_fv1;
|
||||
|
||||
var_fv1 = sqrtf(SQ(temp_fa0) + SQ(temp_fa1));
|
||||
if (var_fv1 != 0.0f) {
|
||||
var_fv1 = (var_fv1 - 100.0f) / var_fv1;
|
||||
var_fv1 = CLAMP_MIN(var_fv1, 0.0f);
|
||||
}
|
||||
|
||||
this->skelAnime.jointTable[PLAYER_LIMB_ROOT - 1].x = temp_fa0 * var_fv1;
|
||||
this->skelAnime.jointTable[PLAYER_LIMB_ROOT - 1].z = temp_fa1 * var_fv1;
|
||||
} else {
|
||||
func_8085255C(play, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,10 @@
|
||||
|
||||
#include "patch_helpers.h"
|
||||
|
||||
DECLARE_FUNC(float, recomp_get_aspect_ratio, float);
|
||||
DECLARE_FUNC(void, recomp_get_window_resolution, u32*, u32*);
|
||||
DECLARE_FUNC(float, recomp_get_target_aspect_ratio, float);
|
||||
DECLARE_FUNC(s32, recomp_get_target_framerate, s32);
|
||||
DECLARE_FUNC(s32, recomp_high_precision_fb_enabled);
|
||||
DECLARE_FUNC(float, recomp_get_resolution_scale);
|
||||
|
||||
#endif
|
||||
|
841
patches/input.c
841
patches/input.c
File diff suppressed because it is too large
Load Diff
@ -8,10 +8,22 @@ typedef enum {
|
||||
RECOMP_CAMERA_DUALANALOG,
|
||||
} RecompCameraMode;
|
||||
|
||||
typedef enum {
|
||||
RECOMP_AIMING_OVERRIDE_OFF = 0,
|
||||
RECOMP_AIMING_OVERRIDE_DISABLE_LEFT_STICK = 1,
|
||||
RECOMP_AIMING_OVERRIDE_FORCE_RIGHT_STICK = 2
|
||||
} RecompAimingOverideMode;
|
||||
|
||||
extern RecompCameraMode recomp_camera_mode;
|
||||
extern RecompAimingOverideMode recomp_aiming_override_mode;
|
||||
|
||||
DECLARE_FUNC(void, recomp_get_gyro_deltas, float* x, float* y);
|
||||
DECLARE_FUNC(void, recomp_get_mouse_deltas, float* x, float* y);
|
||||
DECLARE_FUNC(int, recomp_get_targeting_mode);
|
||||
DECLARE_FUNC(s32, recomp_get_targeting_mode);
|
||||
DECLARE_FUNC(void, recomp_get_inverted_axes, s32* x, s32* y);
|
||||
DECLARE_FUNC(s32, recomp_get_analog_cam_enabled);
|
||||
DECLARE_FUNC(void, recomp_get_analog_inverted_axes, s32* x, s32* y);
|
||||
DECLARE_FUNC(void, recomp_get_camera_inputs, float* x, float* y);
|
||||
DECLARE_FUNC(void, recomp_set_right_analog_suppressed, s32 suppressed);
|
||||
|
||||
#endif
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "z64viscvg.h"
|
||||
#include "z64vismono.h"
|
||||
#include "z64viszbuf.h"
|
||||
#include "input.h"
|
||||
|
||||
void recomp_set_current_frame_poll_id();
|
||||
void PadMgr_HandleRetrace(void);
|
||||
@ -33,7 +34,7 @@ typedef enum {
|
||||
/* 2 */ VOICE_INIT_SUCCESS // voice initialized
|
||||
} VoiceInitStatus;
|
||||
|
||||
void PadMgr_HandleRetrace(void) {
|
||||
RECOMP_PATCH void PadMgr_HandleRetrace(void) {
|
||||
// Execute rumble callback
|
||||
if (sPadMgrInstance->rumbleRetraceCallback != NULL) {
|
||||
sPadMgrInstance->rumbleRetraceCallback(sPadMgrInstance->rumbleRetraceArg);
|
||||
@ -62,11 +63,19 @@ void PadMgr_HandleRetrace(void) {
|
||||
}
|
||||
}
|
||||
|
||||
extern u8 sOcarinaInstrumentId;
|
||||
|
||||
void poll_inputs(void) {
|
||||
OSMesgQueue* serialEventQueue = PadMgr_AcquireSerialEventQueue();
|
||||
// Begin reading controller data
|
||||
osContStartReadData(serialEventQueue);
|
||||
|
||||
bool needs_right_stick = recomp_get_analog_cam_enabled() || recomp_aiming_override_mode == RECOMP_AIMING_OVERRIDE_FORCE_RIGHT_STICK;
|
||||
// Suppress the right analog stick if analog camera is active unless the ocarina is in use.
|
||||
recomp_set_right_analog_suppressed(needs_right_stick && sOcarinaInstrumentId == OCARINA_INSTRUMENT_OFF);
|
||||
// Resets this flag for the next frame;
|
||||
recomp_aiming_override_mode = RECOMP_AIMING_OVERRIDE_OFF;
|
||||
|
||||
// Wait for controller data
|
||||
osRecvMesg(serialEventQueue, NULL, OS_MESG_BLOCK);
|
||||
osContGetReadData(sPadMgrInstance->pads);
|
||||
@ -107,7 +116,7 @@ void poll_inputs(void) {
|
||||
}
|
||||
|
||||
// @recomp Patched to do the actual input polling.
|
||||
void PadMgr_GetInput(Input* inputs, s32 gameRequest) {
|
||||
RECOMP_PATCH void PadMgr_GetInput(Input* inputs, s32 gameRequest) {
|
||||
// @recomp Do an actual poll if gameRequest is true.
|
||||
if (gameRequest) {
|
||||
poll_inputs();
|
||||
@ -120,7 +129,7 @@ void PadMgr_GetInput(Input* inputs, s32 gameRequest) {
|
||||
}
|
||||
|
||||
// @recomp Just call PadMgr_GetInput.
|
||||
void PadMgr_GetInput2(Input* inputs, s32 gameRequest) {
|
||||
RECOMP_PATCH void PadMgr_GetInput2(Input* inputs, s32 gameRequest) {
|
||||
PadMgr_GetInput(inputs, gameRequest);
|
||||
}
|
||||
|
||||
@ -132,7 +141,7 @@ void* osViGetCurrentFramebuffer_recomp();
|
||||
OSMesgQueue *rdp_queue_ptr = NULL;
|
||||
|
||||
// @recomp Immediately sends the graphics task instead of queueing it in the scheduler.
|
||||
void Graph_TaskSet00(GraphicsContext* gfxCtx, GameState* gameState) {
|
||||
RECOMP_PATCH void Graph_TaskSet00(GraphicsContext* gfxCtx, GameState* gameState) {
|
||||
static s32 retryCount = 10;
|
||||
static s32 cfbIdx = 0;
|
||||
OSTask_t* task = &gfxCtx->task.list.t;
|
||||
@ -265,7 +274,7 @@ extern VisZbuf sGameVisZbuf;
|
||||
extern VisMono sGameVisMono;
|
||||
extern ViMode sGameViMode;
|
||||
|
||||
void GameState_Destroy(GameState* gameState) {
|
||||
RECOMP_PATCH void GameState_Destroy(GameState* gameState) {
|
||||
AudioMgr_StopAllSfxExceptSystem();
|
||||
Audio_Update();
|
||||
|
||||
|
@ -2,13 +2,12 @@
|
||||
#include "transform_ids.h"
|
||||
#include "overlays/actors/ovl_Arms_Hook/z_arms_hook.h"
|
||||
|
||||
// TODO replace these with externs when the recompiler can handle relocations in patches automatically.
|
||||
Vec3f D_808C1C10 = { 0.0f, 0.0f, 0.0f };
|
||||
Vec3f D_808C1C1C = { 0.0f, 0.0f, 900.0f };
|
||||
Vec3f D_808C1C28 = { 0.0f, 500.0f, -3000.0f };
|
||||
Vec3f D_808C1C34 = { 0.0f, -500.0f, -3000.0f };
|
||||
Vec3f D_808C1C40 = { 0.0f, 500.0f, 0.0f };
|
||||
Vec3f D_808C1C4C = { 0.0f, -500.0f, 0.0f };
|
||||
extern Vec3f D_808C1C10;
|
||||
extern Vec3f D_808C1C1C;
|
||||
extern Vec3f D_808C1C28;
|
||||
extern Vec3f D_808C1C34;
|
||||
extern Vec3f D_808C1C40;
|
||||
extern Vec3f D_808C1C4C;
|
||||
|
||||
extern Gfx object_link_child_DL_01D960[];
|
||||
extern Gfx gHookshotChainDL[];
|
||||
@ -17,7 +16,7 @@ extern Gfx gHookshotChainDL[];
|
||||
|
||||
void ArmsHook_Shoot(ArmsHook* this, PlayState* play);
|
||||
|
||||
void ArmsHook_Draw(Actor* thisx, PlayState* play) {
|
||||
RECOMP_PATCH void ArmsHook_Draw(Actor* thisx, PlayState* play) {
|
||||
ArmsHook* this = THIS;
|
||||
f32 f0;
|
||||
Player* player = GET_PLAYER(play);
|
||||
@ -31,10 +30,7 @@ void ArmsHook_Draw(Actor* thisx, PlayState* play) {
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
|
||||
// @recomp Manually relocate ArmsHook_Shoot because it's an overlay symbol.
|
||||
// TODO remove this when the recompiler handles relocations in patches automatically.
|
||||
if (((ArmsHookActionFunc)actor_relocate(thisx, ArmsHook_Shoot) != this->actionFunc) || (this->timer <= 0)) {
|
||||
if ((ArmsHook_Shoot != this->actionFunc) || (this->timer <= 0)) {
|
||||
Matrix_MultVec3f(&D_808C1C10, &this->unk1E0);
|
||||
Matrix_MultVec3f(&D_808C1C28, &sp5C);
|
||||
Matrix_MultVec3f(&D_808C1C34, &sp50);
|
||||
@ -77,7 +73,7 @@ void ArmsHook_Draw(Actor* thisx, PlayState* play) {
|
||||
#undef THIS
|
||||
|
||||
extern Gfx gHookshotReticleDL[];
|
||||
void Player_DrawHookshotReticle(PlayState* play, Player* player, f32 hookshotDistance) {
|
||||
RECOMP_PATCH void Player_DrawHookshotReticle(PlayState* play, Player* player, f32 hookshotDistance) {
|
||||
static Vec3f D_801C094C = { -500.0f, -100.0f, 0.0f };
|
||||
CollisionPoly* poly;
|
||||
s32 bgId;
|
||||
@ -147,7 +143,7 @@ Gfx bowstring_end_hook_dl[] = {
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
void Player_DrawGameplay(PlayState* play, Player* this, s32 lod, Gfx* cullDList,
|
||||
RECOMP_PATCH void Player_DrawGameplay(PlayState* play, Player* this, s32 lod, Gfx* cullDList,
|
||||
OverrideLimbDrawFlex overrideLimbDraw) {
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
|
@ -3,11 +3,13 @@
|
||||
|
||||
#include "patch_helpers.h"
|
||||
|
||||
DECLARE_FUNC(void, recomp_load_overlays, u32 rom, void* ram, u32 size);
|
||||
DECLARE_FUNC(void, recomp_puts, const char* data, u32 size);
|
||||
DECLARE_FUNC(void, recomp_exit);
|
||||
DECLARE_FUNC(void, recomp_handle_quicksave_actions, OSMesgQueue* enter_mq, OSMesgQueue* exit_mq);
|
||||
DECLARE_FUNC(void, recomp_handle_quicksave_actions_main, OSMesgQueue* enter_mq, OSMesgQueue* exit_mq);
|
||||
DECLARE_FUNC(u16, recomp_get_pending_warp);
|
||||
DECLARE_FUNC(u32, recomp_get_pending_set_time);
|
||||
DECLARE_FUNC(s32, recomp_get_autosave_enabled);
|
||||
|
||||
#endif
|
||||
|
@ -6,6 +6,8 @@
|
||||
#include "overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.h"
|
||||
#include "overlays/actors/ovl_Oceff_Wipe6/z_oceff_wipe6.h"
|
||||
#include "overlays/actors/ovl_Oceff_Wipe7/z_oceff_wipe7.h"
|
||||
#include "overlays/actors/ovl_Eff_Stk/z_eff_stk.h"
|
||||
#include "transform_ids.h"
|
||||
|
||||
// @recomp Custom verts to extend the effects past the camera so they cover any aspect ratio.
|
||||
Vtx time_override_verts[156] = {
|
||||
@ -779,6 +781,204 @@ Gfx healing_override_dl[] = {
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
Vtx skull_kid_curse_1_override_verts[52] = { // 008A38
|
||||
{{ {71, 23, 0}, 0, {614, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {121, 88, 500}, 0, {716, 0}, {255, 255, 255, 255} }},
|
||||
{{ {44, 61, 0}, 0, {819, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {46, 143, 500}, 0, {921, 0}, {255, 255, 255, 255} }},
|
||||
{{ {0, 75, 0}, 0, {1024, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {-46, 143, 500}, 0, {1126, 0}, {255, 255, 255, 255} }},
|
||||
{{ {-44, 61, 0}, 0, {1228, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {-121, 88, 500}, 0, {1331, 0}, {255, 255, 255, 255} }},
|
||||
{{ {-71, 23, 0}, 0, {1433, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {-150, 0, 500}, 0, {1536, 0}, {255, 255, 255, 255} }},
|
||||
{{ {-71, -23, 0}, 0, {1638, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {-121, -88, 500}, 0, {1740, 0}, {255, 255, 255, 255} }},
|
||||
{{ {-44, -61, 0}, 0, {1843, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {-46, -143, 500}, 0, {1945, 0}, {255, 255, 255, 255} }},
|
||||
{{ {0, -75, 0}, 0, {2048, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {0, -75, 0}, 0, {0, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {46, -143, 500}, 0, {102, 0}, {255, 255, 255, 255} }},
|
||||
{{ {44, -61, 0}, 0, {204, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {121, -88, 500}, 0, {307, 0}, {255, 255, 255, 255} }},
|
||||
{{ {71, -23, 0}, 0, {409, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {150, 0, 500}, 0, {512, 0}, {255, 255, 255, 255} }},
|
||||
{{ {248, 0, 1080}, 0, {580, -1192}, {255, 255, 255, 255} }},
|
||||
{{ {200, 146, 1080}, 0, {782, -1192}, {255, 255, 255, 255} }},
|
||||
{{ {200, 146, 1080}, 0, {782, -1192}, {255, 255, 255, 255} }},
|
||||
{{ {76, 237, 1080}, 0, {989, -1192}, {255, 255, 255, 255} }},
|
||||
{{ {76, 237, 1080}, 0, {988, -1192}, {255, 255, 255, 255} }},
|
||||
{{ {-76, 237, 1080}, 0, {1193, -1192}, {255, 255, 255, 255} }},
|
||||
{{ {-76, 237, 1080}, 0, {1194, -1192}, {255, 255, 255, 255} }},
|
||||
{{ {-200, 146, 1080}, 0, {1397, -1192}, {255, 255, 255, 255} }},
|
||||
{{ {-200, 146, 1080}, 0, {1397, -1192}, {255, 255, 255, 255} }},
|
||||
{{ {-248, 0, 1080}, 0, {1604, -1192}, {255, 255, 255, 255} }},
|
||||
{{ {-248, 0, 1080}, 0, {1604, -1192}, {255, 255, 255, 255} }},
|
||||
{{ {-121, -88, 500}, 0, {1740, 0}, {255, 255, 255, 255} }},
|
||||
{{ {-248, 0, 1080}, 0, {1604, -1192}, {255, 255, 255, 255} }},
|
||||
{{ {-200, -146, 1080}, 0, {1806, -1192}, {255, 255, 255, 255} }},
|
||||
{{ {-44, -61, 0}, 0, {1843, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {-46, -143, 500}, 0, {1945, 0}, {255, 255, 255, 255} }},
|
||||
{{ {-200, -146, 1080}, 0, {1806, -1192}, {255, 255, 255, 255} }},
|
||||
{{ {-76, -237, 1080}, 0, {2013, -1192}, {255, 255, 255, 255} }},
|
||||
{{ {0, -75, 0}, 0, {2048, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {46, -143, 500}, 0, {2150, 0}, {255, 255, 255, 255} }},
|
||||
{{ {-76, -237, 1080}, 0, {2012, -1192}, {255, 255, 255, 255} }},
|
||||
{{ {76, -237, 1080}, 0, {2217, -1192}, {255, 255, 255, 255} }},
|
||||
{{ {44, -61, 0}, 0, {204, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {46, -143, 500}, 0, {102, 0}, {255, 255, 255, 255} }},
|
||||
{{ {121, -88, 500}, 0, {307, 0}, {255, 255, 255, 255} }},
|
||||
{{ {76, -237, 1080}, 0, {170, -1192}, {255, 255, 255, 255} }},
|
||||
{{ {200, -146, 1080}, 0, {373, -1192}, {255, 255, 255, 255} }},
|
||||
{{ {71, -23, 0}, 0, {409, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {150, 0, 500}, 0, {512, 0}, {255, 255, 255, 255} }},
|
||||
{{ {200, -146, 1080}, 0, {373, -1192}, {255, 255, 255, 255} }},
|
||||
{{ {248, 0, 1080}, 0, {580, -1192}, {255, 255, 255, 255} }},
|
||||
};
|
||||
|
||||
extern u64 object_stk2_Tex_008B50[];
|
||||
extern u64 object_stk2_Tex_008B50[];
|
||||
|
||||
|
||||
Gfx skull_kid_curse_1_override_dl[] = { // 008A38
|
||||
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
|
||||
gsDPPipeSync(),
|
||||
gsDPSetCombineLERP(TEXEL1, PRIMITIVE, PRIM_LOD_FRAC, TEXEL0, TEXEL1, 0, PRIM_LOD_FRAC, TEXEL0, PRIMITIVE,
|
||||
ENVIRONMENT, COMBINED, ENVIRONMENT, COMBINED, 0, SHADE, 0),
|
||||
gsDPSetPrimColor(0, 0x80, 255, 255, 100, 255),
|
||||
gsDPSetEnvColor(255, 0, 150, 255),
|
||||
gsDPSetRenderMode(G_RM_PASS, G_RM_ZB_XLU_SURF2),
|
||||
gsDPSetTextureLUT(G_TT_NONE),
|
||||
gsDPLoadTextureBlock(object_stk2_Tex_008B50, G_IM_FMT_I, G_IM_SIZ_8b, 32, 64, 0, G_TX_NOMIRROR | G_TX_WRAP,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, 5, 6, 1, 15),
|
||||
gsDPLoadMultiBlock(object_stk2_Tex_008B50, 0x0000, 1, G_IM_FMT_I, G_IM_SIZ_8b, 32, 64, 0, G_TX_NOMIRROR | G_TX_WRAP,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, 5, 6, 15, 14),
|
||||
gsSPDisplayList(0x08000000),
|
||||
gsSPLoadGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH),
|
||||
gsSPVertex(skull_kid_curse_1_override_verts + 0, 32, 0),
|
||||
gsSP2Triangles(0, 1, 2, 0, 2, 3, 4, 0),
|
||||
gsSP2Triangles(4, 5, 6, 0, 6, 7, 8, 0),
|
||||
gsSP2Triangles(8, 9, 10, 0, 10, 11, 12, 0),
|
||||
gsSP2Triangles(12, 13, 14, 0, 15, 16, 17, 0),
|
||||
gsSP2Triangles(17, 18, 19, 0, 19, 20, 0, 0),
|
||||
gsSP2Triangles(0, 20, 1, 0, 1, 20, 21, 0),
|
||||
gsSP2Triangles(1, 21, 22, 0, 2, 1, 3, 0),
|
||||
gsSP2Triangles(3, 1, 23, 0, 3, 23, 24, 0),
|
||||
gsSP2Triangles(4, 3, 5, 0, 5, 3, 25, 0),
|
||||
gsSP2Triangles(5, 25, 26, 0, 6, 5, 7, 0),
|
||||
gsSP2Triangles(7, 5, 27, 0, 7, 27, 28, 0),
|
||||
gsSP2Triangles(8, 7, 9, 0, 9, 7, 29, 0),
|
||||
gsSP2Triangles(9, 29, 30, 0, 10, 9, 11, 0),
|
||||
gsSP1Triangle(11, 9, 31, 0),
|
||||
gsSPVertex(skull_kid_curse_1_override_verts + 32, 20, 0),
|
||||
gsSP2Triangles(0, 1, 2, 0, 3, 0, 4, 0),
|
||||
gsSP2Triangles(4, 0, 5, 0, 4, 5, 6, 0),
|
||||
gsSP2Triangles(7, 4, 8, 0, 8, 4, 9, 0),
|
||||
gsSP2Triangles(8, 9, 10, 0, 11, 12, 13, 0),
|
||||
gsSP2Triangles(13, 12, 14, 0, 13, 14, 15, 0),
|
||||
gsSP2Triangles(16, 13, 17, 0, 17, 13, 18, 0),
|
||||
gsSP1Triangle(17, 18, 19, 0),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
Vtx skull_kid_curse_2_override_verts[52] = { // 008920
|
||||
{{ {86, -28, 0}, 0, {409, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {180, 0, 500}, 0, {512, 0}, {255, 255, 255, 255} }},
|
||||
{{ {86, 28, 0}, 0, {614, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {53, -73, 0}, 0, {204, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {146, -106, 500}, 0, {307, 0}, {255, 255, 255, 255} }},
|
||||
{{ {0, -90, 0}, 0, {0, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {56, -171, 500}, 0, {102, 0}, {255, 255, 255, 255} }},
|
||||
{{ {-53, -73, 0}, 0, {1843, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {-56, -171, 500}, 0, {1945, 0}, {255, 255, 255, 255} }},
|
||||
{{ {0, -90, 0}, 0, {2048, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {-86, -28, 0}, 0, {1638, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {-146, -106, 500}, 0, {1740, 0}, {255, 255, 255, 255} }},
|
||||
{{ {-86, 28, 0}, 0, {1433, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {-180, 0, 500}, 0, {1536, 0}, {255, 255, 255, 255} }},
|
||||
{{ {-53, 73, 0}, 0, {1228, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {-146, 106, 500}, 0, {1331, 0}, {255, 255, 255, 255} }},
|
||||
{{ {0, 90, 0}, 0, {1024, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {-56, 171, 500}, 0, {1126, 0}, {255, 255, 255, 255} }},
|
||||
{{ {53, 73, 0}, 0, {819, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {56, 171, 500}, 0, {921, 0}, {255, 255, 255, 255} }},
|
||||
{{ {146, 106, 500}, 0, {716, 0}, {255, 255, 255, 255} }},
|
||||
{{ {218, -159, 1080}, 0, {359, -1185}, {255, 255, 255, 255} }},
|
||||
{{ {269, 0, 1080}, 0, {562, -1185}, {255, 255, 255, 255} }},
|
||||
{{ {84, -256, 1080}, 0, {152, -1185}, {255, 255, 255, 255} }},
|
||||
{{ {218, -159, 1080}, 0, {359, -1185}, {255, 255, 255, 255} }},
|
||||
{{ {56, -171, 500}, 0, {2150, 0}, {255, 255, 255, 255} }},
|
||||
{{ {-84, -256, 1080}, 0, {1996, -1185}, {255, 255, 255, 255} }},
|
||||
{{ {84, -256, 1080}, 0, {2201, -1185}, {255, 255, 255, 255} }},
|
||||
{{ {-218, -159, 1080}, 0, {1792, -1185}, {255, 255, 255, 255} }},
|
||||
{{ {-84, -256, 1080}, 0, {1995, -1185}, {255, 255, 255, 255} }},
|
||||
{{ {-269, 0, 1080}, 0, {1586, -1185}, {255, 255, 255, 255} }},
|
||||
{{ {-218, -159, 1080}, 0, {1791, -1185}, {255, 255, 255, 255} }},
|
||||
{{ {-180, 0, 500}, 0, {1536, 0}, {255, 255, 255, 255} }},
|
||||
{{ {-146, 106, 500}, 0, {1331, 0}, {255, 255, 255, 255} }},
|
||||
{{ {-218, 159, 1080}, 0, {1383, -1185}, {255, 255, 255, 255} }},
|
||||
{{ {-269, 0, 1080}, 0, {1586, -1185}, {255, 255, 255, 255} }},
|
||||
{{ {-53, 73, 0}, 0, {1228, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {-56, 171, 500}, 0, {1126, 0}, {255, 255, 255, 255} }},
|
||||
{{ {-84, 256, 1080}, 0, {1176, -1185}, {255, 255, 255, 255} }},
|
||||
{{ {-218, 159, 1080}, 0, {1383, -1185}, {255, 255, 255, 255} }},
|
||||
{{ {0, 90, 0}, 0, {1024, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {56, 171, 500}, 0, {921, 0}, {255, 255, 255, 255} }},
|
||||
{{ {84, 256, 1080}, 0, {972, -1185}, {255, 255, 255, 255} }},
|
||||
{{ {-84, 256, 1080}, 0, {1177, -1185}, {255, 255, 255, 255} }},
|
||||
{{ {53, 73, 0}, 0, {819, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {146, 106, 500}, 0, {716, 0}, {255, 255, 255, 255} }},
|
||||
{{ {218, 159, 1080}, 0, {768, -1185}, {255, 255, 255, 255} }},
|
||||
{{ {84, 256, 1080}, 0, {971, -1185}, {255, 255, 255, 255} }},
|
||||
{{ {86, 28, 0}, 0, {614, 1024}, {255, 255, 255, 0} }},
|
||||
{{ {180, 0, 500}, 0, {512, 0}, {255, 255, 255, 255} }},
|
||||
{{ {269, 0, 1080}, 0, {562, -1185}, {255, 255, 255, 255} }},
|
||||
{{ {218, 159, 1080}, 0, {767, -1185}, {255, 255, 255, 255} }},
|
||||
};
|
||||
|
||||
extern u64 object_stk2_Tex_009750[];
|
||||
extern u64 object_stk2_Tex_009350[];
|
||||
|
||||
Gfx skull_kid_curse_2_override_dl[] = { // 008920
|
||||
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
|
||||
gsDPPipeSync(),
|
||||
gsDPSetCombineLERP(TEXEL1, PRIMITIVE, PRIM_LOD_FRAC, TEXEL0, TEXEL1, 0, PRIM_LOD_FRAC, TEXEL0, PRIMITIVE,
|
||||
ENVIRONMENT, COMBINED, ENVIRONMENT, COMBINED, 0, SHADE, 0),
|
||||
gsDPSetPrimColor(0, 0x80, 0, 0, 255, 255),
|
||||
gsDPSetEnvColor(0, 220, 0, 255),
|
||||
gsDPSetRenderMode(G_RM_PASS, G_RM_AA_ZB_XLU_INTER2),
|
||||
gsDPSetTextureLUT(G_TT_NONE),
|
||||
gsDPLoadTextureBlock(object_stk2_Tex_009750, G_IM_FMT_I, G_IM_SIZ_8b, 32, 64, 0, G_TX_NOMIRROR | G_TX_WRAP,
|
||||
G_TX_MIRROR | G_TX_WRAP, 5, 6, 15, 14),
|
||||
gsDPLoadMultiBlock(object_stk2_Tex_009350, 0x0100, 1, G_IM_FMT_I, G_IM_SIZ_8b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, 5, 5, 15, 1),
|
||||
gsSPDisplayList(0x09000000),
|
||||
gsSPLoadGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH),
|
||||
gsSPVertex(skull_kid_curse_2_override_verts + 0, 32, 0),
|
||||
gsSP2Triangles(0, 1, 2, 0, 3, 4, 0, 0),
|
||||
gsSP2Triangles(5, 6, 3, 0, 7, 8, 9, 0),
|
||||
gsSP2Triangles(10, 11, 7, 0, 12, 13, 10, 0),
|
||||
gsSP2Triangles(14, 15, 12, 0, 16, 17, 14, 0),
|
||||
gsSP2Triangles(18, 19, 16, 0, 2, 20, 18, 0),
|
||||
gsSP2Triangles(0, 4, 1, 0, 1, 4, 21, 0),
|
||||
gsSP2Triangles(1, 21, 22, 0, 3, 6, 4, 0),
|
||||
gsSP2Triangles(4, 6, 23, 0, 4, 23, 24, 0),
|
||||
gsSP2Triangles(9, 8, 25, 0, 25, 8, 26, 0),
|
||||
gsSP2Triangles(25, 26, 27, 0, 7, 11, 8, 0),
|
||||
gsSP2Triangles(8, 11, 28, 0, 8, 28, 29, 0),
|
||||
gsSP2Triangles(10, 13, 11, 0, 11, 13, 30, 0),
|
||||
gsSP2Triangles(11, 30, 31, 0, 12, 15, 13, 0),
|
||||
gsSPVertex(skull_kid_curse_2_override_verts + 32, 20, 0),
|
||||
gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
|
||||
gsSP2Triangles(4, 5, 1, 0, 1, 5, 6, 0),
|
||||
gsSP2Triangles(1, 6, 7, 0, 8, 9, 5, 0),
|
||||
gsSP2Triangles(5, 9, 10, 0, 5, 10, 11, 0),
|
||||
gsSP2Triangles(12, 13, 9, 0, 9, 13, 14, 0),
|
||||
gsSP2Triangles(9, 14, 15, 0, 16, 17, 13, 0),
|
||||
gsSP2Triangles(13, 17, 18, 0, 13, 18, 19, 0),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
// Sets the flag to 1 for any vertex that has an alpha of 255.
|
||||
void set_vertex_flags(Vtx* verts, s32 count) {
|
||||
for (s32 i = 0; i < count; i++) {
|
||||
@ -810,14 +1010,12 @@ void set_all_vertex_flags() {
|
||||
|
||||
// Patches the given DL to replace a vertex command at the given position with a branch to the new DL.
|
||||
void patch_ocarina_effect(Actor* actor, Gfx* original_dl, u32 dl_offset, Gfx* override_dl) {
|
||||
Gfx* reloc_dl = (Gfx*)actor_relocate(actor, original_dl);
|
||||
|
||||
set_all_vertex_flags();
|
||||
|
||||
// Check if the DL hasn't been patched yet.
|
||||
if (reloc_dl[dl_offset].words.w0 >> 24 == G_VTX) {
|
||||
if (original_dl[dl_offset].words.w0 >> 24 == G_VTX) {
|
||||
// Redirect the DL away from the original vertex command and to the override DL.
|
||||
gSPBranchList(&reloc_dl[dl_offset], override_dl);
|
||||
gSPBranchList(&original_dl[dl_offset], override_dl);
|
||||
}
|
||||
}
|
||||
|
||||
@ -832,7 +1030,7 @@ void set_ocarina_vertex_alphas(Vtx* verts, s32 count, u8 alpha) {
|
||||
|
||||
extern Gfx sSongOfTimeFrustumMaterialDL[];
|
||||
|
||||
void OceffWipe_Draw(Actor* thisx, PlayState* play) {
|
||||
RECOMP_PATCH void OceffWipe_Draw(Actor* thisx, PlayState* play) {
|
||||
u32 scroll = play->state.frames & 0xFF;
|
||||
OceffWipe* this = (OceffWipe*)thisx;
|
||||
f32 z;
|
||||
@ -889,8 +1087,7 @@ void OceffWipe_Draw(Actor* thisx, PlayState* play) {
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 100, 0, 255, 128);
|
||||
}
|
||||
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
gSPDisplayList(POLY_XLU_DISP++, (Gfx*)actor_relocate(thisx, &sSongOfTimeFrustumMaterialDL));
|
||||
gSPDisplayList(POLY_XLU_DISP++, sSongOfTimeFrustumMaterialDL);
|
||||
gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0 - scroll, scroll * -2, 32,
|
||||
32, 1, 0 - scroll, scroll * -2, 32, 32));
|
||||
// @recomp Use the new DL instead of the original.
|
||||
@ -901,7 +1098,7 @@ void OceffWipe_Draw(Actor* thisx, PlayState* play) {
|
||||
|
||||
extern Gfx sEponaSongFrustumMaterialDL[];
|
||||
|
||||
void OceffWipe2_Draw(Actor* thisx, PlayState* play) {
|
||||
RECOMP_PATCH void OceffWipe2_Draw(Actor* thisx, PlayState* play) {
|
||||
u32 scroll = play->state.frames & 0xFF;
|
||||
OceffWipe2* this = (OceffWipe2*)thisx;
|
||||
f32 z;
|
||||
@ -944,8 +1141,7 @@ void OceffWipe2_Draw(Actor* thisx, PlayState* play) {
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 170, 255);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 255, 100, 0, 128);
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
gSPDisplayList(POLY_XLU_DISP++, (Gfx*)actor_relocate(thisx, sEponaSongFrustumMaterialDL));
|
||||
gSPDisplayList(POLY_XLU_DISP++, sEponaSongFrustumMaterialDL);
|
||||
gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, scroll * 6, scroll * -6, 64,
|
||||
64, 1, scroll * -6, 0, 64, 64));
|
||||
// @recomp Use the new DL instead of the original.
|
||||
@ -956,7 +1152,7 @@ void OceffWipe2_Draw(Actor* thisx, PlayState* play) {
|
||||
|
||||
extern Gfx sSariaSongFrustrumMaterialDL[];
|
||||
|
||||
void OceffWipe3_Draw(Actor* thisx, PlayState* play) {
|
||||
RECOMP_PATCH void OceffWipe3_Draw(Actor* thisx, PlayState* play) {
|
||||
u32 scroll = play->state.frames & 0xFFF;
|
||||
OceffWipe3* this = (OceffWipe3*)thisx;
|
||||
f32 z;
|
||||
@ -998,8 +1194,7 @@ void OceffWipe3_Draw(Actor* thisx, PlayState* play) {
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 170, 255);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 100, 200, 0, 128);
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
gSPDisplayList(POLY_XLU_DISP++, (Gfx*)actor_relocate(thisx, &sSariaSongFrustrumMaterialDL));
|
||||
gSPDisplayList(POLY_XLU_DISP++, sSariaSongFrustrumMaterialDL);
|
||||
gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, 0, scroll * 12, scroll * -12, 64, 64, 1,
|
||||
scroll * 8, scroll * -8, 64, 64));
|
||||
// @recomp Use the new DL instead of the original.
|
||||
@ -1012,7 +1207,7 @@ extern Gfx sScarecrowSongUnusedMaterialDL[];
|
||||
extern Gfx sScarecrowSongMaterialDL[];
|
||||
extern Gfx sScarecrowSongModelDL[];
|
||||
|
||||
void OceffWipe4_Draw(Actor* thisx, PlayState* play) {
|
||||
RECOMP_PATCH void OceffWipe4_Draw(Actor* thisx, PlayState* play) {
|
||||
u32 scroll = play->state.frames & 0xFFF;
|
||||
OceffWipe4* this = (OceffWipe4*)thisx;
|
||||
f32 z;
|
||||
@ -1053,17 +1248,16 @@ void OceffWipe4_Draw(Actor* thisx, PlayState* play) {
|
||||
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
// @recomp Manual relocations, TODO remove when automated.
|
||||
if (this->actor.params == OCEFF_WIPE4_UNUSED) {
|
||||
gSPDisplayList(POLY_XLU_DISP++, (Gfx*)actor_relocate(thisx, sScarecrowSongUnusedMaterialDL));
|
||||
gSPDisplayList(POLY_XLU_DISP++, sScarecrowSongUnusedMaterialDL);
|
||||
} else {
|
||||
gSPDisplayList(POLY_XLU_DISP++, (Gfx*)actor_relocate(thisx, sScarecrowSongMaterialDL));
|
||||
gSPDisplayList(POLY_XLU_DISP++, sScarecrowSongMaterialDL);
|
||||
}
|
||||
|
||||
gSPDisplayList(POLY_XLU_DISP++, (Gfx*)actor_relocate(thisx, sScarecrowSongModelDL));
|
||||
gSPDisplayList(POLY_XLU_DISP++, sScarecrowSongModelDL);
|
||||
gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, scroll * 2, scroll * -2, 32,
|
||||
64, 1, scroll * -1, scroll, 32, 32));
|
||||
gSPDisplayList(POLY_XLU_DISP++, (Gfx*)actor_relocate(thisx, &sScarecrowSongModelDL[11]));
|
||||
gSPDisplayList(POLY_XLU_DISP++, &sScarecrowSongModelDL[11]);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
@ -1079,7 +1273,7 @@ static u8 sEnvColors[] = {
|
||||
extern Gfx gOceff5DL[];
|
||||
extern AnimatedMaterial gOceff5TexAnim[];
|
||||
|
||||
void OceffWipe5_Draw(Actor* thisx, PlayState* play) {
|
||||
RECOMP_PATCH void OceffWipe5_Draw(Actor* thisx, PlayState* play) {
|
||||
OceffWipe5* this = (OceffWipe5*)thisx;
|
||||
f32 z;
|
||||
s32 pad;
|
||||
@ -1139,9 +1333,8 @@ void OceffWipe5_Draw(Actor* thisx, PlayState* play) {
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, sEnvColors[colorIndex], sEnvColors[colorIndex + 1], sEnvColors[colorIndex + 2],
|
||||
255);
|
||||
|
||||
// @recomp Manual relocations, TODO remove when automated.
|
||||
AnimatedMat_Draw(play, (AnimatedMaterial*)actor_relocate(thisx, gOceff5TexAnim));
|
||||
gSPDisplayList(POLY_XLU_DISP++, (Gfx*)actor_relocate(thisx, gOceff5DL));
|
||||
AnimatedMat_Draw(play, gOceff5TexAnim);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gOceff5DL);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
@ -1149,7 +1342,7 @@ void OceffWipe5_Draw(Actor* thisx, PlayState* play) {
|
||||
extern Gfx gOceff6DL[];
|
||||
extern AnimatedMaterial ovl_Oceff_Wipe6_Matanimheader_000338[];
|
||||
|
||||
void OceffWipe6_Draw(Actor* thisx, PlayState* play) {
|
||||
RECOMP_PATCH void OceffWipe6_Draw(Actor* thisx, PlayState* play) {
|
||||
OceffWipe6* this = (OceffWipe6*)thisx;
|
||||
f32 z;
|
||||
u8 alpha;
|
||||
@ -1192,9 +1385,8 @@ void OceffWipe6_Draw(Actor* thisx, PlayState* play) {
|
||||
Matrix_RotateXS(0x708, MTXMODE_APPLY);
|
||||
Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
// @recomp Manual relocations, TODO remove these when automatic.
|
||||
AnimatedMat_Draw(play, (AnimatedMaterial*)actor_relocate(thisx, ovl_Oceff_Wipe6_Matanimheader_000338));
|
||||
gSPDisplayList(POLY_XLU_DISP++, (Gfx*)actor_relocate(thisx, gOceff6DL));
|
||||
AnimatedMat_Draw(play, ovl_Oceff_Wipe6_Matanimheader_000338);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gOceff6DL);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
@ -1202,7 +1394,7 @@ void OceffWipe6_Draw(Actor* thisx, PlayState* play) {
|
||||
extern Gfx sSongOfHealingEffectFrustumDL[];
|
||||
extern AnimatedMaterial sSongofHealingEffectTexAnim[];
|
||||
|
||||
void OceffWipe7_Draw(Actor* thisx, PlayState* play) {
|
||||
RECOMP_PATCH void OceffWipe7_Draw(Actor* thisx, PlayState* play) {
|
||||
OceffWipe7* this = (OceffWipe7*)thisx;
|
||||
f32 z;
|
||||
u8 alpha;
|
||||
@ -1243,9 +1435,53 @@ void OceffWipe7_Draw(Actor* thisx, PlayState* play) {
|
||||
Matrix_RotateXS(0x708, MTXMODE_APPLY);
|
||||
Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
// @recomp Manual relocations, TODO remove when automated.
|
||||
AnimatedMat_Draw(play, (AnimatedMaterial*)actor_relocate(thisx, sSongofHealingEffectTexAnim));
|
||||
gSPDisplayList(POLY_XLU_DISP++, (Gfx*)actor_relocate(thisx, &sSongOfHealingEffectFrustumDL));
|
||||
AnimatedMat_Draw(play, sSongofHealingEffectTexAnim);
|
||||
gSPDisplayList(POLY_XLU_DISP++, sSongOfHealingEffectFrustumDL);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
extern AnimatedMaterial object_stk2_Matanimheader_009F60[];
|
||||
|
||||
// @recomp Patch the Skull Kid curse effect as well, which works similarly to the ocarina effects.
|
||||
// In this case, the patch also includes effect transform tagging patches.
|
||||
RECOMP_PATCH void EffStk_Draw(Actor* thisx, PlayState* play) {
|
||||
EffStk* this = (EffStk*)thisx;
|
||||
s32 pad;
|
||||
Camera* activeCam = GET_ACTIVE_CAM(play);
|
||||
Vec3f eye = activeCam->eye;
|
||||
Vec3f quakeOffset;
|
||||
|
||||
quakeOffset = Camera_GetQuakeOffset(activeCam);
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
Gfx_SetupDL25_Xlu(play->state.gfxCtx);
|
||||
Matrix_Translate(eye.x + quakeOffset.x, eye.y + quakeOffset.y, eye.z + quakeOffset.z, MTXMODE_NEW);
|
||||
Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY);
|
||||
Matrix_ReplaceRotation(&play->billboardMtxF);
|
||||
Matrix_Translate(0.0f, 0.0f, this->unk148, MTXMODE_APPLY);
|
||||
|
||||
Mtx* mtx = Matrix_NewMtx(play->state.gfxCtx);
|
||||
|
||||
// @recomp Tag the transform. Do not allow edits as this will get edited by the billboard detection and we'll want to skip position during a camera cut too.
|
||||
if (camera_was_skipped()) {
|
||||
gEXMatrixGroupDecomposedSkipPosRot(POLY_XLU_DISP++, actor_transform_id(thisx), G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_NONE);
|
||||
}
|
||||
else {
|
||||
gEXMatrixGroupDecomposedNormal(POLY_XLU_DISP++, actor_transform_id(thisx), G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_NONE);
|
||||
}
|
||||
|
||||
gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
AnimatedMat_DrawAlphaStep(play, Lib_SegmentedToVirtual(object_stk2_Matanimheader_009F60), 1.0f, this->unk144);
|
||||
gDPSetColorDither(POLY_XLU_DISP++, G_CD_NOISE);
|
||||
gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_NOISE);
|
||||
// @recomp Use the new DLs instead of the originals.
|
||||
gSPDisplayList(POLY_XLU_DISP++, skull_kid_curse_2_override_dl);
|
||||
gSPDisplayList(POLY_XLU_DISP++, skull_kid_curse_1_override_dl);
|
||||
|
||||
// @recomp Pop the transform tag.
|
||||
gEXPopMatrixGroup(POLY_XLU_DISP++, G_MTX_MODELVIEW);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
1059
patches/options.c
1059
patches/options.c
File diff suppressed because it is too large
Load Diff
@ -10,7 +10,7 @@ extern EffectSsInfo sEffectSsInfo;
|
||||
u8 particle_reset_list[MAX_PARTICLES];
|
||||
|
||||
// @recomp Patched to track that the particle has been reset.
|
||||
void EffectSS_ResetEntry(EffectSs* particle) {
|
||||
RECOMP_PATCH void EffectSS_ResetEntry(EffectSs* particle) {
|
||||
u32 i;
|
||||
|
||||
particle->type = EFFECT_SS_MAX;
|
||||
@ -39,7 +39,7 @@ void EffectSS_ResetEntry(EffectSs* particle) {
|
||||
}
|
||||
|
||||
// @recomp Check numEntries to be sure enough space has been allocated for tracking particle statuses.
|
||||
void EffectSS_Init(PlayState* play, s32 numEntries) {
|
||||
RECOMP_PATCH void EffectSS_Init(PlayState* play, s32 numEntries) {
|
||||
u32 i;
|
||||
EffectSs* effectsSs;
|
||||
EffectSsOverlay* overlay;
|
||||
@ -66,7 +66,7 @@ void EffectSS_Init(PlayState* play, s32 numEntries) {
|
||||
}
|
||||
|
||||
// @recomp Add transform tags to particles
|
||||
void EffectSS_DrawParticle(PlayState* play, s32 index) {
|
||||
RECOMP_PATCH void EffectSS_DrawParticle(PlayState* play, s32 index) {
|
||||
EffectSs* entry = &sEffectSsInfo.dataTable[index];
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
@ -101,7 +101,7 @@ extern Gfx gSunSparkleModelDL[];
|
||||
extern u8 D_80B23C40[];
|
||||
extern u8 D_80B23C2C[];
|
||||
|
||||
// @recomp Modified to take the actor as an argument for relocation and to tag firework transforms.
|
||||
// @recomp Modified to tag firework transforms.
|
||||
void func_80B22FA8_patched(Actor* thisx, EnHanabiStruct* arg0, PlayState* play2) {
|
||||
PlayState* play = play2;
|
||||
GraphicsContext* gfxCtx = play->state.gfxCtx;
|
||||
@ -119,10 +119,6 @@ void func_80B22FA8_patched(Actor* thisx, EnHanabiStruct* arg0, PlayState* play2)
|
||||
|
||||
sp53 = 0xFF;
|
||||
|
||||
// @recomp Manually relocate, TODO remove when automated by recompiler.
|
||||
u8* D_80B23C40_relocated = (u8*)actor_relocate(thisx, D_80B23C40);
|
||||
u8* D_80B23C2C_relocated = (u8*)actor_relocate(thisx, D_80B23C2C);
|
||||
|
||||
for (i = 0; i < 400; i++, arg0++) {
|
||||
if (arg0->unk_00 != 1) {
|
||||
continue;
|
||||
@ -145,18 +141,18 @@ void func_80B22FA8_patched(Actor* thisx, EnHanabiStruct* arg0, PlayState* play2)
|
||||
|
||||
if (sp53 != arg0->unk_02) {
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, D_80B23C40_relocated[arg0->unk_02], D_80B23C40_relocated[arg0->unk_02 + 1],
|
||||
D_80B23C40_relocated[arg0->unk_02 + 2], 255);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, D_80B23C40[arg0->unk_02], D_80B23C40[arg0->unk_02 + 1],
|
||||
D_80B23C40[arg0->unk_02 + 2], 255);
|
||||
|
||||
sp53 = arg0->unk_02;
|
||||
}
|
||||
|
||||
if (arg0->unk_01 < 6) {
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, D_80B23C2C_relocated[arg0->unk_02], D_80B23C2C_relocated[arg0->unk_02 + 1],
|
||||
D_80B23C2C_relocated[arg0->unk_02 + 2], arg0->unk_01 * 50);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, D_80B23C2C[arg0->unk_02], D_80B23C2C[arg0->unk_02 + 1],
|
||||
D_80B23C2C[arg0->unk_02 + 2], arg0->unk_01 * 50);
|
||||
} else {
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, D_80B23C2C_relocated[arg0->unk_02], D_80B23C2C_relocated[arg0->unk_02 + 1],
|
||||
D_80B23C2C_relocated[arg0->unk_02 + 2], 255);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, D_80B23C2C[arg0->unk_02], D_80B23C2C[arg0->unk_02 + 1],
|
||||
D_80B23C2C[arg0->unk_02 + 2], 255);
|
||||
}
|
||||
|
||||
gSPDisplayList(POLY_XLU_DISP++, gSunSparkleModelDL);
|
||||
@ -168,11 +164,11 @@ void func_80B22FA8_patched(Actor* thisx, EnHanabiStruct* arg0, PlayState* play2)
|
||||
}
|
||||
|
||||
// @recomp Patched to call a custom version of a vanilla function.
|
||||
void EnHanabi_Draw(Actor* thisx, PlayState* play) {
|
||||
RECOMP_PATCH void EnHanabi_Draw(Actor* thisx, PlayState* play) {
|
||||
EnHanabi* this = (EnHanabi*)thisx;
|
||||
|
||||
Matrix_Push();
|
||||
// @recomp Call a modified version of the function that takes the actor for relocation purposes.
|
||||
// @recomp Call a modified version of the function that takes the actor for tagging purposes.
|
||||
func_80B22FA8_patched(thisx, this->unk_148, play);
|
||||
Matrix_Pop();
|
||||
}
|
||||
@ -180,7 +176,7 @@ void EnHanabi_Draw(Actor* thisx, PlayState* play) {
|
||||
Vec3f kankyo_prev_pos_base[DEMOKANKYO_EFFECT_COUNT] = {0};
|
||||
|
||||
// @recomp Patched to draw the lost woods particles outside the 4:3 region and tag their transforms.
|
||||
void DemoKakyo_DrawLostWoodsSparkle(Actor* thisx, PlayState* play2) {
|
||||
RECOMP_PATCH void DemoKakyo_DrawLostWoodsSparkle(Actor* thisx, PlayState* play2) {
|
||||
PlayState* play = play2;
|
||||
DemoKankyo* this = (DemoKankyo*)thisx;
|
||||
s16 i;
|
||||
@ -290,7 +286,7 @@ extern Gfx gBubbleDL[];
|
||||
extern Gfx gLightOrbModelDL[];
|
||||
|
||||
// @recomp Patched to draw the lost woods particles outside the 4:3 region and tag their transforms.
|
||||
void DemoKankyo_DrawMoonAndGiant(Actor* thisx, PlayState* play2) {
|
||||
RECOMP_PATCH void DemoKankyo_DrawMoonAndGiant(Actor* thisx, PlayState* play2) {
|
||||
PlayState* play = play2;
|
||||
DemoKankyo* this = (DemoKankyo*)thisx;
|
||||
s16 i;
|
||||
@ -385,13 +381,12 @@ void DemoKankyo_DrawMoonAndGiant(Actor* thisx, PlayState* play2) {
|
||||
}
|
||||
|
||||
static Vec3f D_80A5AFB0 = { 0.0f, 0.0f, 0.0f };
|
||||
static Vec3f D_80A5AFBC = { 0.0f, -1.0f, 0.0f };
|
||||
|
||||
// The byte after unk_01 in EnWaterEffectStruct is unused, so we'll use it as a respawn flag.
|
||||
#define WATER_EFFECT_RESPAWNED(ptr) (&(ptr)->unk_01)[1]
|
||||
|
||||
// @recomp Mark respawned water effect particles so they can be skipped for the first frame.
|
||||
void func_80A599E8(EnWaterEffect* this, Vec3f* arg1, u8 arg2) {
|
||||
RECOMP_PATCH void func_80A599E8(EnWaterEffect* this, Vec3f* arg1, u8 arg2) {
|
||||
s16 i;
|
||||
EnWaterEffectStruct* ptr = &this->unk_144[0];
|
||||
|
||||
@ -438,7 +433,7 @@ extern Gfx object_water_effect_DL_0043E8[];
|
||||
extern Gfx gameplay_keep_DL_06AB30[];
|
||||
|
||||
// @recomp Tag the transforms for falling fire rocks.
|
||||
void func_80A5A184(Actor* thisx, PlayState* play2) {
|
||||
RECOMP_PATCH void func_80A5A184(Actor* thisx, PlayState* play2) {
|
||||
PlayState* play = play2;
|
||||
EnWaterEffect* this = (EnWaterEffect*)thisx;
|
||||
GraphicsContext* gfxCtx = play->state.gfxCtx;
|
||||
|
@ -1,6 +1,15 @@
|
||||
#ifndef __PATCHES_H__
|
||||
#define __PATCHES_H__
|
||||
|
||||
#define RECOMP_EXPORT __attribute__((section(".recomp_export")))
|
||||
#define RECOMP_PATCH __attribute__((section(".recomp_patch")))
|
||||
#define RECOMP_FORCE_PATCH __attribute__((section(".recomp_force_patch")))
|
||||
#define RECOMP_DECLARE_EVENT(func) \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wunused-parameter\"") \
|
||||
__attribute__((noinline, weak, used, section(".recomp_event"))) void func {} \
|
||||
_Pragma("GCC diagnostic pop")
|
||||
|
||||
// TODO fix renaming symbols in patch recompilation
|
||||
#define osCreateMesgQueue osCreateMesgQueue_recomp
|
||||
#define osRecvMesg osRecvMesg_recomp
|
||||
@ -9,6 +18,8 @@
|
||||
#define osFlashWriteArray osFlashWriteArray_recomp
|
||||
#define osFlashWriteBuffer osFlashWriteBuffer_recomp
|
||||
#define osWritebackDCache osWritebackDCache_recomp
|
||||
#define osInvalICache osInvalICache_recomp
|
||||
#define osGetTime osGetTime_recomp
|
||||
|
||||
#define osContStartReadData osContStartReadData_recomp
|
||||
#define osContGetReadData osContGetReadData_recomp
|
||||
@ -22,6 +33,17 @@
|
||||
#include "global.h"
|
||||
#include "rt64_extended_gbi.h"
|
||||
|
||||
#ifndef gEXFillRectangle
|
||||
#define gEXFillRectangle(cmd, lorigin, rorigin, ulx, uly, lrx, lry) \
|
||||
G_EX_COMMAND2(cmd, \
|
||||
PARAM(RT64_EXTENDED_OPCODE, 8, 24) | PARAM(G_EX_FILLRECT_V1, 24, 0), \
|
||||
PARAM(lorigin, 12, 0) | PARAM(rorigin, 12, 12), \
|
||||
\
|
||||
PARAM((ulx) * 4, 16, 16) | PARAM((uly) * 4, 16, 0), \
|
||||
PARAM((lrx) * 4, 16, 16) | PARAM((lry) * 4, 16, 0) \
|
||||
)
|
||||
#endif
|
||||
|
||||
#define gEXMatrixGroupNoInterpolation(cmd, push, proj, edit) \
|
||||
gEXMatrixGroup(cmd, G_EX_ID_IGNORE, G_EX_INTERPOLATE_SIMPLE, push, proj, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_COMPONENT_SKIP, G_EX_ORDER_LINEAR, edit)
|
||||
|
||||
@ -50,17 +72,6 @@
|
||||
int recomp_printf(const char* fmt, ...);
|
||||
float recomp_powf(float, float);
|
||||
|
||||
static inline void* actor_relocate(Actor* actor, void* addr) {
|
||||
if ((uintptr_t)addr >= 0x80800000) {
|
||||
return (void*)((uintptr_t)addr -
|
||||
(intptr_t)((uintptr_t)actor->overlayEntry->vramStart - (uintptr_t)actor->overlayEntry->loadedRamAddr));
|
||||
}
|
||||
else {
|
||||
recomp_printf("Not an overlay address!: 0x%08X 0x%08X 0x%08X\n", (u32)addr, (u32)actor->overlayEntry->vramStart, (u32)actor->overlayEntry->loadedRamAddr);
|
||||
return addr;
|
||||
}
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ PICTO_BOX_STATE_OFF, // Not using the pictograph
|
||||
/* 1 */ PICTO_BOX_STATE_LENS, // Looking through the lens of the pictograph
|
||||
@ -91,6 +102,7 @@ void clear_camera_skipped();
|
||||
void edit_billboard_groups(PlayState* play);
|
||||
bool camera_was_skipped();
|
||||
void room_load_hook(PlayState* play, Room* room);
|
||||
void draw_autosave_icon(PlayState* play);
|
||||
|
||||
void recomp_crash(const char* err);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
RAMBASE = 0x80801000; /* Used to hold any new symbols */
|
||||
EXTRA_RAM_SIZE = 0x01000000; /* Amount of extra ram allocated by recomp */
|
||||
PATCH_RAM_END = 0x81000000; /* Amount of extra ram allocated by recomp */
|
||||
|
||||
MEMORY {
|
||||
extram : ORIGIN = RAMBASE, LENGTH = 64M
|
||||
@ -7,19 +7,18 @@ MEMORY {
|
||||
}
|
||||
|
||||
SECTIONS {
|
||||
.ctors : { *(.ctors*) *(.init_array*) } >extram AT >rom
|
||||
.dtors : { *(.dtors*) } >extram AT >rom
|
||||
.rodata : { *(.rodata*) } >extram AT >rom
|
||||
.data : { *(.data*) } >extram AT >rom
|
||||
|
||||
/* The following sections will be removed from the objcopy */
|
||||
/* bss isn't noload to make .text rom addresses valid for the recompiler */
|
||||
.bss : { *(.bss*) *(COMMON) } >extram AT >rom
|
||||
ASSERT(. < RAMBASE + EXTRA_RAM_SIZE, "Maxed out recomp extra ram")
|
||||
/* Padding to push .text to avoid conflicts with original function addresses */
|
||||
.pad : { . += 0x1000000; } >extram AT >rom
|
||||
.text : { *(.text*) } >extram AT >rom
|
||||
.ctors : { *(.ctors*) *(.init_array*) } >extram AT >rom
|
||||
.dtors : { *(.dtors*) } >extram AT >rom
|
||||
.text : { *(.text*) } >extram AT >rom
|
||||
.recomp_patch : { *(.recomp_patch*) *(.recomp_force_patch*) } >extram AT >rom
|
||||
.recomp_export : { *(.recomp_export*) } >extram AT >rom
|
||||
.recomp_event : { *(.recomp_event*) } >extram AT >rom
|
||||
.rodata : { *(.rodata*) } >extram AT >rom
|
||||
.data : { *(.data*) } >extram AT >rom
|
||||
.bss (NOLOAD) : { *(.bss*) *(COMMON) } >extram
|
||||
ASSERT(. <= PATCH_RAM_END, "Maxed out recomp extra ram")
|
||||
|
||||
.reloc 0 : { *(.reloc*) }
|
||||
.symtab 0 : { *(.symtab) }
|
||||
.strtab 0 : { *(.strtab) }
|
||||
.shstrtab 0 : { *(.shstrtab) }
|
||||
|
@ -1,21 +1,53 @@
|
||||
#include "play_patches.h"
|
||||
#include "z64debug_display.h"
|
||||
#include "input.h"
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "z64.h"
|
||||
#include "regs.h"
|
||||
#include "functions.h"
|
||||
#include "z64vismono.h"
|
||||
#include "z64visfbuf.h"
|
||||
#include "buffers.h"
|
||||
|
||||
#include "variables.h"
|
||||
#include "macros.h"
|
||||
#include "buffers.h"
|
||||
#include "idle.h"
|
||||
#include "sys_cfb.h"
|
||||
#include "z64bombers_notebook.h"
|
||||
#include "z64quake.h"
|
||||
#include "z64rumble.h"
|
||||
#include "z64shrink_window.h"
|
||||
#include "z64view.h"
|
||||
|
||||
#include "overlays/gamestates/ovl_daytelop/z_daytelop.h"
|
||||
#include "overlays/gamestates/ovl_opening/z_opening.h"
|
||||
#include "overlays/gamestates/ovl_file_choose/z_file_select.h"
|
||||
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
|
||||
#include "debug.h"
|
||||
|
||||
extern Input D_801F6C18;
|
||||
|
||||
RECOMP_DECLARE_EVENT(recomp_on_play_main(PlayState* play));
|
||||
RECOMP_DECLARE_EVENT(recomp_on_play_update(PlayState* play));
|
||||
RECOMP_DECLARE_EVENT(recomp_after_play_update(PlayState* play));
|
||||
|
||||
void controls_play_update(PlayState* play) {
|
||||
gSaveContext.options.zTargetSetting = recomp_get_targeting_mode();
|
||||
}
|
||||
|
||||
// @recomp Patched to add hooks for various added functionality.
|
||||
void Play_Main(GameState* thisx) {
|
||||
RECOMP_PATCH void Play_Main(GameState* thisx) {
|
||||
static Input* prevInput = NULL;
|
||||
PlayState* this = (PlayState*)thisx;
|
||||
|
||||
// @recomp_event recomp_on_play_main(PlayState* play): Allow mods to execute code every frame.
|
||||
recomp_on_play_main(this);
|
||||
|
||||
// @recomp
|
||||
debug_play_update(this);
|
||||
controls_play_update(this);
|
||||
analog_cam_pre_play_update(this);
|
||||
matrix_play_update(this);
|
||||
|
||||
// @recomp avoid unused variable warning
|
||||
@ -31,8 +63,18 @@ void Play_Main(GameState* thisx) {
|
||||
this->state.gfxCtx = NULL;
|
||||
}
|
||||
camera_pre_play_update(this);
|
||||
|
||||
// @recomp_event recomp_on_play_update(PlayState* play): Play_Update is about to be called.
|
||||
recomp_on_play_update(this);
|
||||
|
||||
Play_Update(this);
|
||||
|
||||
// @recomp_event recomp_after_play_update(PlayState* play): Play_Update was called.
|
||||
recomp_after_play_update(this);
|
||||
|
||||
camera_post_play_update(this);
|
||||
analog_cam_post_play_update(this);
|
||||
autosave_post_play_update(this);
|
||||
this->state.gfxCtx = gfxCtx;
|
||||
}
|
||||
|
||||
@ -51,7 +93,7 @@ void Play_Main(GameState* thisx) {
|
||||
}
|
||||
|
||||
// @recomp Patched to add load a hook for loading rooms.
|
||||
s32 Room_HandleLoadCallbacks(PlayState* play, RoomContext* roomCtx) {
|
||||
RECOMP_PATCH s32 Room_HandleLoadCallbacks(PlayState* play, RoomContext* roomCtx) {
|
||||
if (roomCtx->status == 1) {
|
||||
if (osRecvMesg(&roomCtx->loadQueue, NULL, OS_MESG_NOBLOCK) == 0) {
|
||||
roomCtx->status = 0;
|
||||
@ -80,3 +122,322 @@ s32 Room_HandleLoadCallbacks(PlayState* play, RoomContext* roomCtx) {
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void ZeldaArena_Init(void* start, size_t size);
|
||||
|
||||
void Play_SpawnScene(PlayState* this, s32 sceneId, s32 spawn);
|
||||
void Play_InitMotionBlur(void);
|
||||
|
||||
extern s16 sTransitionFillTimer;
|
||||
extern Input D_801F6C18;
|
||||
extern TransitionTile sTransitionTile;
|
||||
extern s32 gTransitionTileState;
|
||||
extern VisMono sPlayVisMono;
|
||||
extern Color_RGBA8_u32 gVisMonoColor;
|
||||
extern VisFbuf sPlayVisFbuf;
|
||||
extern VisFbuf* sPlayVisFbufInstance;
|
||||
extern BombersNotebook sBombersNotebook;
|
||||
extern u8 sBombersNotebookOpen;
|
||||
extern u8 sMotionBlurStatus;
|
||||
|
||||
extern s32 gDbgCamEnabled;
|
||||
extern u8 D_801D0D54;
|
||||
|
||||
extern u8 gPictoPhotoI8[];
|
||||
extern u8 D_80784600[];
|
||||
|
||||
// Non-relocatable references to the original addresses of these game state functions.
|
||||
void DayTelop_Init_NORELOCATE(GameState*);
|
||||
void TitleSetup_Init_NORELOCATE(GameState*);
|
||||
|
||||
RECOMP_DECLARE_EVENT(recomp_on_play_init(PlayState* this));
|
||||
RECOMP_DECLARE_EVENT(recomp_after_play_init(PlayState* this));
|
||||
|
||||
bool allow_no_ocarina_tf = false;
|
||||
|
||||
// @recomp_export void recomp_set_allow_no_ocarina_tf(bool new_val): Set whether to force Termina Field to load normally even if Link has no ocarina.
|
||||
RECOMP_EXPORT void recomp_set_allow_no_ocarina_tf(bool new_val) {
|
||||
allow_no_ocarina_tf = new_val;
|
||||
}
|
||||
|
||||
RECOMP_PATCH void Play_Init(GameState* thisx) {
|
||||
PlayState* this = (PlayState*)thisx;
|
||||
GraphicsContext* gfxCtx = this->state.gfxCtx;
|
||||
s32 pad;
|
||||
uintptr_t zAlloc;
|
||||
s32 zAllocSize;
|
||||
Player* player;
|
||||
s32 i;
|
||||
s32 spawn;
|
||||
u8 sceneLayer;
|
||||
s32 scene;
|
||||
|
||||
// @recomp_event recomp_on_play_init(PlayState* this): A new PlayState is being initialized.
|
||||
recomp_on_play_init(this);
|
||||
|
||||
if ((gSaveContext.respawnFlag == -4) || (gSaveContext.respawnFlag == -0x63)) {
|
||||
if (CHECK_EVENTINF(EVENTINF_TRIGGER_DAYTELOP)) {
|
||||
CLEAR_EVENTINF(EVENTINF_TRIGGER_DAYTELOP);
|
||||
STOP_GAMESTATE(&this->state);
|
||||
// Use non-relocatable reference to DayTelop_Init instead.
|
||||
SET_NEXT_GAMESTATE(&this->state, DayTelop_Init_NORELOCATE, sizeof(DayTelopState));
|
||||
return;
|
||||
}
|
||||
|
||||
gSaveContext.unk_3CA7 = 1;
|
||||
if (gSaveContext.respawnFlag == -0x63) {
|
||||
gSaveContext.respawnFlag = 2;
|
||||
}
|
||||
} else {
|
||||
gSaveContext.unk_3CA7 = 0;
|
||||
}
|
||||
|
||||
if (gSaveContext.save.entrance == -1) {
|
||||
gSaveContext.save.entrance = 0;
|
||||
STOP_GAMESTATE(&this->state);
|
||||
// Use non-relocatable reference to TitleSetup_Init instead.
|
||||
SET_NEXT_GAMESTATE(&this->state, TitleSetup_Init_NORELOCATE, sizeof(TitleSetupState));
|
||||
return;
|
||||
}
|
||||
|
||||
if ((gSaveContext.nextCutsceneIndex == 0xFFEF) || (gSaveContext.nextCutsceneIndex == 0xFFF0)) {
|
||||
scene = ((void)0, gSaveContext.save.entrance) >> 9;
|
||||
spawn = (((void)0, gSaveContext.save.entrance) >> 4) & 0x1F;
|
||||
|
||||
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) {
|
||||
if (scene == ENTR_SCENE_MOUNTAIN_VILLAGE_WINTER) {
|
||||
scene = ENTR_SCENE_MOUNTAIN_VILLAGE_SPRING;
|
||||
} else if (scene == ENTR_SCENE_GORON_VILLAGE_WINTER) {
|
||||
scene = ENTR_SCENE_GORON_VILLAGE_SPRING;
|
||||
} else if (scene == ENTR_SCENE_PATH_TO_GORON_VILLAGE_WINTER) {
|
||||
scene = ENTR_SCENE_PATH_TO_GORON_VILLAGE_SPRING;
|
||||
} else if ((scene == ENTR_SCENE_SNOWHEAD) || (scene == ENTR_SCENE_PATH_TO_SNOWHEAD) ||
|
||||
(scene == ENTR_SCENE_PATH_TO_MOUNTAIN_VILLAGE) || (scene == ENTR_SCENE_GORON_SHRINE) ||
|
||||
(scene == ENTR_SCENE_GORON_RACETRACK)) {
|
||||
gSaveContext.nextCutsceneIndex = 0xFFF0;
|
||||
}
|
||||
}
|
||||
|
||||
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE)) {
|
||||
if (scene == ENTR_SCENE_SOUTHERN_SWAMP_POISONED) {
|
||||
scene = ENTR_SCENE_SOUTHERN_SWAMP_CLEARED;
|
||||
} else if (scene == ENTR_SCENE_WOODFALL) {
|
||||
gSaveContext.nextCutsceneIndex = 0xFFF1;
|
||||
}
|
||||
}
|
||||
|
||||
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE) && (scene == ENTR_SCENE_IKANA_CANYON)) {
|
||||
gSaveContext.nextCutsceneIndex = 0xFFF2;
|
||||
}
|
||||
|
||||
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE) &&
|
||||
((scene == ENTR_SCENE_GREAT_BAY_COAST) || (scene == ENTR_SCENE_ZORA_CAPE))) {
|
||||
gSaveContext.nextCutsceneIndex = 0xFFF0;
|
||||
}
|
||||
|
||||
// "First cycle" Termina Field
|
||||
// @recomp_use_export_var allow_no_ocarina_tf: Skip loading into "First cycle" Termina Field if mods enable it.
|
||||
if (!allow_no_ocarina_tf && INV_CONTENT(ITEM_OCARINA_OF_TIME) != ITEM_OCARINA_OF_TIME) {
|
||||
if ((scene == ENTR_SCENE_TERMINA_FIELD) &&
|
||||
(((void)0, gSaveContext.save.entrance) != ENTRANCE(TERMINA_FIELD, 10))) {
|
||||
gSaveContext.nextCutsceneIndex = 0xFFF4;
|
||||
}
|
||||
}
|
||||
//! FAKE:
|
||||
gSaveContext.save.entrance =
|
||||
Entrance_Create(((void)0, scene), spawn, ((void)0, gSaveContext.save.entrance) & 0xF);
|
||||
}
|
||||
|
||||
GameState_Realloc(&this->state, 0);
|
||||
KaleidoManager_Init(this);
|
||||
ShrinkWindow_Init();
|
||||
View_Init(&this->view, gfxCtx);
|
||||
Audio_SetExtraFilter(0);
|
||||
Quake_Init();
|
||||
Distortion_Init(this);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(this->cameraPtrs); i++) {
|
||||
this->cameraPtrs[i] = NULL;
|
||||
}
|
||||
|
||||
Camera_Init(&this->mainCamera, &this->view, &this->colCtx, this);
|
||||
Camera_ChangeStatus(&this->mainCamera, CAM_STATUS_ACTIVE);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(this->subCameras); i++) {
|
||||
Camera_Init(&this->subCameras[i], &this->view, &this->colCtx, this);
|
||||
Camera_ChangeStatus(&this->subCameras[i], CAM_STATUS_INACTIVE);
|
||||
}
|
||||
|
||||
this->cameraPtrs[CAM_ID_MAIN] = &this->mainCamera;
|
||||
this->cameraPtrs[CAM_ID_MAIN]->uid = CAM_ID_MAIN;
|
||||
this->activeCamId = CAM_ID_MAIN;
|
||||
|
||||
Camera_OverwriteStateFlags(&this->mainCamera, CAM_STATE_0 | CAM_STATE_CHECK_WATER | CAM_STATE_2 | CAM_STATE_3 |
|
||||
CAM_STATE_4 | CAM_STATE_DISABLE_MODE_CHANGE | CAM_STATE_6);
|
||||
Sram_Alloc(&this->state, &this->sramCtx);
|
||||
Regs_InitData(this);
|
||||
Message_Init(this);
|
||||
GameOver_Init(this);
|
||||
SoundSource_InitAll(this);
|
||||
EffFootmark_Init(this);
|
||||
Effect_Init(this);
|
||||
EffectSS_Init(this, 100);
|
||||
CollisionCheck_InitContext(this, &this->colChkCtx);
|
||||
AnimationContext_Reset(&this->animationCtx);
|
||||
Cutscene_InitContext(this, &this->csCtx);
|
||||
|
||||
if (gSaveContext.nextCutsceneIndex != 0xFFEF) {
|
||||
gSaveContext.save.cutsceneIndex = gSaveContext.nextCutsceneIndex;
|
||||
gSaveContext.nextCutsceneIndex = 0xFFEF;
|
||||
}
|
||||
|
||||
if (gSaveContext.save.cutsceneIndex == 0xFFFD) {
|
||||
gSaveContext.save.cutsceneIndex = 0;
|
||||
}
|
||||
|
||||
if (gSaveContext.nextDayTime != NEXT_TIME_NONE) {
|
||||
gSaveContext.save.time = gSaveContext.nextDayTime;
|
||||
gSaveContext.skyboxTime = gSaveContext.nextDayTime;
|
||||
}
|
||||
|
||||
if ((CURRENT_TIME >= CLOCK_TIME(18, 0)) || (CURRENT_TIME < CLOCK_TIME(6, 30))) {
|
||||
gSaveContext.save.isNight = true;
|
||||
} else {
|
||||
gSaveContext.save.isNight = false;
|
||||
}
|
||||
|
||||
func_800EDDB0(this);
|
||||
|
||||
if (((gSaveContext.gameMode != GAMEMODE_NORMAL) && (gSaveContext.gameMode != GAMEMODE_TITLE_SCREEN)) ||
|
||||
(gSaveContext.save.cutsceneIndex >= 0xFFF0)) {
|
||||
gSaveContext.nayrusLoveTimer = 0;
|
||||
Magic_Reset(this);
|
||||
gSaveContext.sceneLayer = (gSaveContext.save.cutsceneIndex & 0xF) + 1;
|
||||
|
||||
// Set saved cutscene to 0 so it doesn't immediately play, but instead let the `CutsceneManager` handle it.
|
||||
gSaveContext.save.cutsceneIndex = 0;
|
||||
} else {
|
||||
gSaveContext.sceneLayer = 0;
|
||||
}
|
||||
|
||||
sceneLayer = gSaveContext.sceneLayer;
|
||||
|
||||
Play_SpawnScene(
|
||||
this, Entrance_GetSceneIdAbsolute(((void)0, gSaveContext.save.entrance) + ((void)0, gSaveContext.sceneLayer)),
|
||||
Entrance_GetSpawnNum(((void)0, gSaveContext.save.entrance) + ((void)0, gSaveContext.sceneLayer)));
|
||||
KaleidoScopeCall_Init(this);
|
||||
Interface_Init(this);
|
||||
|
||||
if (gSaveContext.nextDayTime != NEXT_TIME_NONE) {
|
||||
if (gSaveContext.nextDayTime == NEXT_TIME_DAY) {
|
||||
gSaveContext.save.day++;
|
||||
gSaveContext.save.eventDayCount++;
|
||||
gSaveContext.dogIsLost = true;
|
||||
gSaveContext.nextDayTime = NEXT_TIME_DAY_SET;
|
||||
} else {
|
||||
gSaveContext.nextDayTime = NEXT_TIME_NIGHT_SET;
|
||||
}
|
||||
}
|
||||
|
||||
Play_InitMotionBlur();
|
||||
|
||||
R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_OFF;
|
||||
R_PICTO_PHOTO_STATE = PICTO_PHOTO_STATE_OFF;
|
||||
|
||||
PreRender_Init(&this->pauseBgPreRender);
|
||||
PreRender_SetValuesSave(&this->pauseBgPreRender, gCfbWidth, gCfbHeight, NULL, NULL, NULL);
|
||||
PreRender_SetValues(&this->pauseBgPreRender, gCfbWidth, gCfbHeight, NULL, NULL);
|
||||
|
||||
this->unk_18E64 = gWorkBuffer;
|
||||
this->pictoPhotoI8 = gPictoPhotoI8;
|
||||
this->unk_18E68 = D_80784600;
|
||||
this->unk_18E58 = D_80784600;
|
||||
this->unk_18E60 = D_80784600;
|
||||
gTransitionTileState = TRANS_TILE_OFF;
|
||||
this->transitionMode = TRANS_MODE_OFF;
|
||||
D_801D0D54 = false;
|
||||
|
||||
FrameAdvance_Init(&this->frameAdvCtx);
|
||||
Rand_Seed(osGetTime());
|
||||
Matrix_Init(&this->state);
|
||||
|
||||
this->state.main = Play_Main;
|
||||
this->state.destroy = Play_Destroy;
|
||||
|
||||
this->transitionTrigger = TRANS_TRIGGER_END;
|
||||
this->worldCoverAlpha = 0;
|
||||
this->bgCoverAlpha = 0;
|
||||
this->haltAllActors = false;
|
||||
this->unk_18844 = false;
|
||||
|
||||
if (gSaveContext.gameMode != GAMEMODE_TITLE_SCREEN) {
|
||||
if (gSaveContext.nextTransitionType == TRANS_NEXT_TYPE_DEFAULT) {
|
||||
this->transitionType =
|
||||
(Entrance_GetTransitionFlags(((void)0, gSaveContext.save.entrance) + sceneLayer) >> 7) & 0x7F;
|
||||
} else {
|
||||
this->transitionType = gSaveContext.nextTransitionType;
|
||||
gSaveContext.nextTransitionType = TRANS_NEXT_TYPE_DEFAULT;
|
||||
}
|
||||
} else {
|
||||
this->transitionType = TRANS_TYPE_FADE_BLACK;
|
||||
}
|
||||
|
||||
TransitionFade_Init(&this->unk_18E48);
|
||||
TransitionFade_SetType(&this->unk_18E48, 3);
|
||||
TransitionFade_SetColor(&this->unk_18E48, RGBA8(160, 160, 160, 255));
|
||||
TransitionFade_Start(&this->unk_18E48);
|
||||
VisMono_Init(&sPlayVisMono);
|
||||
|
||||
gVisMonoColor.a = 0;
|
||||
sPlayVisFbufInstance = &sPlayVisFbuf;
|
||||
VisFbuf_Init(sPlayVisFbufInstance);
|
||||
sPlayVisFbufInstance->lodProportion = 0.0f;
|
||||
sPlayVisFbufInstance->mode = VIS_FBUF_MODE_GENERAL;
|
||||
sPlayVisFbufInstance->primColor.r = 0;
|
||||
sPlayVisFbufInstance->primColor.g = 0;
|
||||
sPlayVisFbufInstance->primColor.b = 0;
|
||||
sPlayVisFbufInstance->primColor.a = 0;
|
||||
sPlayVisFbufInstance->envColor.r = 0;
|
||||
sPlayVisFbufInstance->envColor.g = 0;
|
||||
sPlayVisFbufInstance->envColor.b = 0;
|
||||
sPlayVisFbufInstance->envColor.a = 0;
|
||||
CutsceneFlags_UnsetAll(this);
|
||||
THA_GetRemaining(&this->state.tha);
|
||||
zAllocSize = THA_GetRemaining(&this->state.tha);
|
||||
zAlloc = (uintptr_t)THA_AllocTailAlign16(&this->state.tha, zAllocSize);
|
||||
|
||||
//! @bug: Incorrect ALIGN16s
|
||||
ZeldaArena_Init((void*)((zAlloc + 8) & ~0xF), (zAllocSize - ((zAlloc + 8) & ~0xF)) + zAlloc);
|
||||
|
||||
Actor_InitContext(this, &this->actorCtx, this->linkActorEntry);
|
||||
|
||||
while (!Room_HandleLoadCallbacks(this, &this->roomCtx)) {}
|
||||
|
||||
if ((CURRENT_DAY != 0) && ((this->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_1) ||
|
||||
(this->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_5))) {
|
||||
Actor_Spawn(&this->actorCtx, this, ACTOR_EN_TEST4, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
player = GET_PLAYER(this);
|
||||
|
||||
Camera_InitFocalActorSettings(&this->mainCamera, &player->actor);
|
||||
gDbgCamEnabled = false;
|
||||
|
||||
if (PLAYER_GET_BG_CAM_INDEX(&player->actor) != 0xFF) {
|
||||
Camera_ChangeActorCsCamIndex(&this->mainCamera, PLAYER_GET_BG_CAM_INDEX(&player->actor));
|
||||
}
|
||||
|
||||
CutsceneManager_StoreCamera(&this->mainCamera);
|
||||
Interface_SetSceneRestrictions(this);
|
||||
Environment_PlaySceneSequence(this);
|
||||
gSaveContext.seqId = this->sequenceCtx.seqId;
|
||||
gSaveContext.ambienceId = this->sequenceCtx.ambienceId;
|
||||
AnimationContext_Update(this, &this->animationCtx);
|
||||
Cutscene_HandleEntranceTriggers(this);
|
||||
gSaveContext.respawnFlag = 0;
|
||||
sBombersNotebookOpen = false;
|
||||
BombersNotebook_Init(&sBombersNotebook);
|
||||
|
||||
// @recomp_event recomp_after_play_init(PlayState* this): The new PlayState has finished initializing.
|
||||
recomp_after_play_init(this);
|
||||
}
|
||||
|
@ -6,6 +6,9 @@
|
||||
void debug_play_update(PlayState* play);
|
||||
void camera_pre_play_update(PlayState* play);
|
||||
void camera_post_play_update(PlayState* play);
|
||||
void analog_cam_pre_play_update(PlayState* play);
|
||||
void analog_cam_post_play_update(PlayState* play);
|
||||
void matrix_play_update(PlayState* play);
|
||||
void autosave_post_play_update(PlayState* play);
|
||||
|
||||
#endif
|
||||
|
@ -6,7 +6,7 @@ void* proutPrintf(void* dst, const char* fmt, size_t size) {
|
||||
return (void*)1;
|
||||
}
|
||||
|
||||
int recomp_printf(const char* fmt, ...) {
|
||||
RECOMP_EXPORT int recomp_printf(const char* fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
|
80
patches/required_patches.c
Normal file
80
patches/required_patches.c
Normal file
@ -0,0 +1,80 @@
|
||||
#include "patches.h"
|
||||
#include "misc_funcs.h"
|
||||
#include "loadfragment.h"
|
||||
|
||||
void Main_ClearMemory(void* begin, void* end);
|
||||
void Main_InitMemory(void);
|
||||
void Main_InitScreen(void);
|
||||
|
||||
|
||||
RECOMP_DECLARE_EVENT(recomp_on_init());
|
||||
|
||||
// @recomp Patched to load the code segment in the recomp runtime.
|
||||
RECOMP_PATCH void Main_Init(void) {
|
||||
DmaRequest dmaReq;
|
||||
OSMesgQueue mq;
|
||||
OSMesg msg[1];
|
||||
size_t prevSize;
|
||||
|
||||
// @recomp_event recomp_on_init(): Allow mods to initialize themselves once.
|
||||
recomp_on_init();
|
||||
|
||||
osCreateMesgQueue(&mq, msg, ARRAY_COUNT(msg));
|
||||
|
||||
prevSize = gDmaMgrDmaBuffSize;
|
||||
gDmaMgrDmaBuffSize = 0;
|
||||
|
||||
// @recomp Load the code segment in the recomp runtime.
|
||||
recomp_load_overlays(SEGMENT_ROM_START(code), SEGMENT_START(code), SEGMENT_ROM_END(code) - SEGMENT_ROM_START(code));
|
||||
|
||||
DmaMgr_SendRequestImpl(&dmaReq, SEGMENT_START(code), SEGMENT_ROM_START(code),
|
||||
SEGMENT_ROM_END(code) - SEGMENT_ROM_START(code), 0, &mq, NULL);
|
||||
Main_InitScreen();
|
||||
Main_InitMemory();
|
||||
osRecvMesg(&mq, NULL, OS_MESG_BLOCK);
|
||||
|
||||
gDmaMgrDmaBuffSize = prevSize;
|
||||
|
||||
Main_ClearMemory(SEGMENT_BSS_START(code), SEGMENT_BSS_END(code));
|
||||
}
|
||||
|
||||
void Overlay_Relocate(void* allocatedRamAddr, OverlayRelocationSection* ovlRelocs, uintptr_t vramStart);
|
||||
|
||||
// @recomp Patched to load the overlay in the recomp runtime.
|
||||
RECOMP_PATCH size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* ramStart, void* ramEnd, void* allocatedRamAddr) {
|
||||
uintptr_t vramStart = (uintptr_t)ramStart;
|
||||
uintptr_t vramEnd = (uintptr_t)ramEnd;
|
||||
s32 size = vromEnd - vromStart;
|
||||
uintptr_t end;
|
||||
OverlayRelocationSection* ovlRelocs;
|
||||
|
||||
// @recomp Load the overlay in the recomp runtime.
|
||||
recomp_load_overlays(vromStart, allocatedRamAddr, vromEnd - vromStart);
|
||||
|
||||
if (gOverlayLogSeverity >= 3) {}
|
||||
if (gOverlayLogSeverity >= 3) {}
|
||||
|
||||
end = (uintptr_t)allocatedRamAddr + size;
|
||||
DmaMgr_SendRequest0(allocatedRamAddr, vromStart, size);
|
||||
|
||||
ovlRelocs = (OverlayRelocationSection*)(end - ((s32*)end)[-1]);
|
||||
|
||||
if (gOverlayLogSeverity >= 3) {}
|
||||
if (gOverlayLogSeverity >= 3) {}
|
||||
|
||||
Overlay_Relocate(allocatedRamAddr, ovlRelocs, vramStart);
|
||||
|
||||
if (ovlRelocs->bssSize != 0) {
|
||||
if (gOverlayLogSeverity >= 3) {}
|
||||
bzero((void*)end, ovlRelocs->bssSize);
|
||||
}
|
||||
|
||||
size = vramEnd - vramStart;
|
||||
|
||||
osWritebackDCache(allocatedRamAddr, size);
|
||||
osInvalICache(allocatedRamAddr, size);
|
||||
|
||||
if (gOverlayLogSeverity >= 3) {}
|
||||
|
||||
return size;
|
||||
}
|
BIN
patches/rewind.ia16.bin
Normal file
BIN
patches/rewind.ia16.bin
Normal file
Binary file not shown.
BIN
patches/rewind.ia16.png
Normal file
BIN
patches/rewind.ia16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
@ -8,7 +8,7 @@ s32 SysFlashrom_IsInit(void);
|
||||
void Sleep_Msec(u32 ms);
|
||||
|
||||
// @recomp Patched to not wait a hardcoded amount of time for the save to complete.
|
||||
void Sram_UpdateWriteToFlashDefault(SramContext* sramCtx) {
|
||||
RECOMP_PATCH void Sram_UpdateWriteToFlashDefault(SramContext* sramCtx) {
|
||||
if (sramCtx->status == 2) {
|
||||
if (SysFlashrom_IsBusy() != 0) { // if task running
|
||||
if (SysFlashrom_AwaitResult() == 0) { // wait for task done
|
||||
@ -26,7 +26,7 @@ void Sram_UpdateWriteToFlashDefault(SramContext* sramCtx) {
|
||||
}
|
||||
|
||||
// @recomp Patched to not wait a hardcoded amount of time for the save to complete.
|
||||
void Sram_UpdateWriteToFlashOwlSave(SramContext* sramCtx) {
|
||||
RECOMP_PATCH void Sram_UpdateWriteToFlashOwlSave(SramContext* sramCtx) {
|
||||
if (sramCtx->status == 7) {
|
||||
if (SysFlashrom_IsBusy() != 0) { // Is task running
|
||||
if (SysFlashrom_AwaitResult() == 0) { // Wait for task done
|
||||
@ -56,30 +56,3 @@ void Sram_UpdateWriteToFlashOwlSave(SramContext* sramCtx) {
|
||||
Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, offsetof(SaveContext, fileNum));
|
||||
}
|
||||
}
|
||||
|
||||
// @recomp Patched to add a pause so that other threads can execute in the meantime.
|
||||
s32 SysFlashrom_ExecWrite(void* addr, u32 pageNum, u32 pageCount) {
|
||||
OSIoMesg msg;
|
||||
s32 result;
|
||||
u32 i;
|
||||
|
||||
if (!SysFlashrom_IsInit()) {
|
||||
return -1;
|
||||
}
|
||||
// Ensure the page is always aligned to a sector boundary.
|
||||
if ((pageNum % FLASH_BLOCK_SIZE) != 0) {
|
||||
Fault_AddHungupAndCrash("../sys_flashrom.c", 275);
|
||||
}
|
||||
osWritebackDCache(addr, pageCount * FLASH_BLOCK_SIZE);
|
||||
for (i = 0; i < pageCount; i++) {
|
||||
// @recomp Pause shortly to allow other threads to work.
|
||||
Sleep_Msec(5);
|
||||
osFlashWriteBuffer(&msg, OS_MESG_PRI_NORMAL, (u8*)addr + i * FLASH_BLOCK_SIZE, &sFlashromMesgQueue);
|
||||
osRecvMesg(&sFlashromMesgQueue, NULL, OS_MESG_BLOCK);
|
||||
result = osFlashWriteArray(i + pageNum);
|
||||
if (result != 0) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
29
patches/skip_sos.c
Normal file
29
patches/skip_sos.c
Normal file
@ -0,0 +1,29 @@
|
||||
#include "patches.h"
|
||||
|
||||
#include "overlays/actors/ovl_En_Test7/z_en_test7.h"
|
||||
|
||||
#define THIS ((EnTest7*)thisx)
|
||||
|
||||
void func_80AF118C(PlayState* play, OwlWarpFeather* feathers, EnTest7* this, s32 arg3, s32 arg4); // EnTest7_UpdateFeathers
|
||||
void func_80AF2350(EnTest7* this, PlayState* play); // EnTest7_WarpCsWarp
|
||||
|
||||
RECOMP_PATCH void EnTest7_Update(Actor* thisx, PlayState* play) {
|
||||
EnTest7* this = THIS;
|
||||
|
||||
this->actionFunc(this, play);
|
||||
|
||||
if (this->playerCamFunc != NULL) {
|
||||
this->playerCamFunc(this, play);
|
||||
}
|
||||
|
||||
this->timer++;
|
||||
|
||||
func_80AF118C(play, this->feathers, this, (this->flags & OWL_WARP_FLAGS_8) != 0,
|
||||
(this->flags & OWL_WARP_FLAGS_10) != 0);
|
||||
|
||||
// @recomp Allow skipping the Song of Soaring cutscene.
|
||||
Input* input = CONTROLLER1(&play->state);
|
||||
if (CHECK_BTN_ANY(input->press.button, BTN_A | BTN_B) && (OWL_WARP_CS_GET_OCARINA_MODE(&this->actor) != ENTEST7_ARRIVE)) {
|
||||
func_80AF2350(thisx, play);
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
|
||||
extern Mtx* sSkyboxDrawMatrix;
|
||||
|
||||
void Skybox_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyboxId, s16 blend, f32 x, f32 y, f32 z) {
|
||||
RECOMP_PATCH void Skybox_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyboxId, s16 blend, f32 x, f32 y, f32 z) {
|
||||
OPEN_DISPS(gfxCtx);
|
||||
|
||||
Gfx_SetupDL40_Opa(gfxCtx);
|
||||
@ -112,7 +112,7 @@ f32 view_aspect_ratio(View* view) {
|
||||
}
|
||||
|
||||
// @recomp Patched to set up the RSP for drawing stars with ortho rects and tag star transforms.
|
||||
void Environment_DrawSkyboxStarsImpl(PlayState* play, Gfx** gfxP) {
|
||||
RECOMP_PATCH void Environment_DrawSkyboxStarsImpl(PlayState* play, Gfx** gfxP) {
|
||||
static const Vec3s D_801DD880[] = {
|
||||
{ 0x0384, 0x2328, 0xD508 }, { 0x09C4, 0x2328, 0xDA1C }, { 0x0E74, 0x22D8, 0xDA1C }, { 0x1450, 0x2468, 0xD8F0 },
|
||||
{ 0x1C84, 0x28A0, 0xCBA8 }, { 0x1F40, 0x2134, 0xD8F0 }, { 0x1F40, 0x28A0, 0xDAE4 }, { 0xE4A8, 0x4A38, 0x4A38 },
|
||||
@ -150,7 +150,7 @@ void Environment_DrawSkyboxStarsImpl(PlayState* play, Gfx** gfxP) {
|
||||
f32(*viewProjectionMtxF)[4];
|
||||
// @recomp Get the original and actual aspect ratios.
|
||||
f32 original_aspect_ratio = view_aspect_ratio(&play->view);
|
||||
f32 recomp_aspect_ratio = recomp_get_aspect_ratio(original_aspect_ratio);
|
||||
f32 recomp_aspect_ratio = recomp_get_target_aspect_ratio(original_aspect_ratio);
|
||||
f32 recomp_aspect_ratio_scale = recomp_aspect_ratio / original_aspect_ratio;
|
||||
|
||||
// @recomp Store the original billboard matrix.
|
||||
|
@ -15,7 +15,7 @@ s32 func_80AF31D0(PlayState* play, SkeletonInfo* skeletonInfo, s32 limbIndex, Gf
|
||||
extern AnimatedMaterial gSoaringWarpCsWindCapsuleTexAnim;
|
||||
extern Gfx gSoaringWarpCsWindCapsuleDL[];
|
||||
|
||||
void EnTest7_Draw(Actor* thisx, PlayState* play) {
|
||||
RECOMP_PATCH void EnTest7_Draw(Actor* thisx, PlayState* play) {
|
||||
s32 pad[2];
|
||||
EnTest7* this = (EnTest7*)thisx;
|
||||
s32 sp40;
|
||||
@ -29,14 +29,10 @@ void EnTest7_Draw(Actor* thisx, PlayState* play) {
|
||||
if (mtx == NULL) {
|
||||
return;
|
||||
}
|
||||
// func_80AF31D0 is an overlay symbol, so its addresses need to be offset to get the actual loaded vram address.
|
||||
// TODO remove this once the recompiler is able to handle overlay symbols automatically for patch functions.
|
||||
OverrideKeyframeDrawScaled func_80AF31D0_relocated = (OverrideKeyframeDrawScaled)actor_relocate(thisx, func_80AF31D0);
|
||||
|
||||
// @recomp Push the matrix group for the song of soaring's wings.
|
||||
gEXMatrixGroupDecomposedNormal(POLY_OPA_DISP++, SOARING_WINGS_TRANSFORM_ID, G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_ALLOW);
|
||||
|
||||
func_8018450C(play, &this->skeletonInfo, mtx, func_80AF31D0_relocated, NULL, &this->actor);
|
||||
func_8018450C(play, &this->skeletonInfo, mtx, func_80AF31D0, NULL, &this->actor);
|
||||
|
||||
// @recomp Pop the wings matrix group.
|
||||
gEXPopMatrixGroup(POLY_OPA_DISP++, G_MTX_MODELVIEW);
|
||||
@ -64,8 +60,17 @@ void EnTest7_Draw(Actor* thisx, PlayState* play) {
|
||||
EnTest7_DrawFeathers(play, this->feathers);
|
||||
|
||||
if (this->flags & OWL_WARP_FLAGS_DRAW_LENS_FLARE) {
|
||||
// @recomp Tag the entire lens flare effect, using order linear. Skip interpolation when the camera is skipped.
|
||||
if (camera_was_skipped()) {
|
||||
gEXMatrixGroupDecomposedSkipAll(POLY_XLU_DISP++, SOARING_LENS_FLARE_TRANSFORM_ID, G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_NONE);
|
||||
}
|
||||
else {
|
||||
gEXMatrixGroupDecomposedNormal(POLY_XLU_DISP++, SOARING_LENS_FLARE_TRANSFORM_ID, G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_NONE);
|
||||
}
|
||||
Environment_DrawLensFlare(play, &play->envCtx, &play->view, play->state.gfxCtx, this->actor.world.pos, 70.0f,
|
||||
5.0f, 0, false);
|
||||
// @recomp Pop the lens flare matrix group.
|
||||
gEXPopMatrixGroup(POLY_XLU_DISP++, G_MTX_MODELVIEW);
|
||||
}
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
@ -99,7 +104,7 @@ extern SoTCsAmmoDrops sSoTCsAmmoDrops[12];
|
||||
/**
|
||||
* Draws clocks in a double spiral above and below player
|
||||
*/
|
||||
void EnTest6_DrawThreeDayResetSoTCutscene(EnTest6* this, PlayState* play) {
|
||||
RECOMP_PATCH void EnTest6_DrawThreeDayResetSoTCutscene(EnTest6* this, PlayState* play) {
|
||||
s16 clock1Yaw;
|
||||
s16 clock2Yaw;
|
||||
s16 angle;
|
||||
@ -171,12 +176,9 @@ void EnTest6_DrawThreeDayResetSoTCutscene(EnTest6* this, PlayState* play) {
|
||||
|
||||
POLY_OPA_DISP = this->gfx;
|
||||
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
SoTCsAmmoDrops* sSoTCsAmmoDrops_reloc = (SoTCsAmmoDrops*)actor_relocate(&this->actor, sSoTCsAmmoDrops);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sSoTCsAmmoDrops); i++) {
|
||||
if (sSoTCsAmmoDrops_reloc[i].scale > 0.0f) {
|
||||
sSoTCsAmmoDrops_reloc[i].draw(this, play, &sSoTCsAmmoDrops_reloc[i]);
|
||||
if (sSoTCsAmmoDrops[i].scale > 0.0f) {
|
||||
sSoTCsAmmoDrops[i].draw(this, play, &sSoTCsAmmoDrops[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ bool is_bgm_player(u8 player_index) {
|
||||
/**
|
||||
* Update different commands and requests for active sequences
|
||||
*/
|
||||
void AudioSeq_UpdateActiveSequences(void) {
|
||||
RECOMP_PATCH void AudioSeq_UpdateActiveSequences(void) {
|
||||
u32 tempoCmd;
|
||||
u16 tempoPrev;
|
||||
u16 seqId;
|
||||
@ -338,7 +338,7 @@ void AudioSeq_UpdateActiveSequences(void) {
|
||||
}
|
||||
|
||||
// @recomp Patched to add the ability to turn off low health beeps.
|
||||
void LifeMeter_UpdateSizeAndBeep(PlayState* play) {
|
||||
RECOMP_PATCH void LifeMeter_UpdateSizeAndBeep(PlayState* play) {
|
||||
InterfaceContext* interfaceCtx = &play->interfaceCtx;
|
||||
|
||||
if (interfaceCtx->lifeSizeChangeDirection != 0) {
|
||||
|
@ -8,6 +8,14 @@
|
||||
#include "overlays/actors/ovl_En_Osn/z_en_osn.h"
|
||||
#include "overlays/actors/ovl_En_Fall2/z_en_fall2.h"
|
||||
#include "overlays/actors/ovl_Obj_Entotu/z_obj_entotu.h"
|
||||
#include "overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h"
|
||||
#include "overlays/actors/ovl_En_Twig/z_en_twig.h"
|
||||
#include "overlays/actors/ovl_En_Honotrap/z_en_honotrap.h"
|
||||
#include "overlays/actors/ovl_En_Tanron1/z_en_tanron1.h"
|
||||
|
||||
// Decomp renames, TODO update decomp and remove these
|
||||
#define EnHonotrap_FlameGroup func_8092F878
|
||||
#define EnHonotrap_DrawFlameGroup func_80930190
|
||||
|
||||
extern EnTanron2* D_80BB8458[82];
|
||||
extern Boss04* D_80BB8450;
|
||||
@ -23,7 +31,7 @@ extern Gfx gEffWaterRippleDL[];
|
||||
u8 special_effect_reset_states[MAX_SPECIAL_EFFECTS];
|
||||
|
||||
// @recomp Tag Wart's bubbles
|
||||
void EnTanron2_Draw(Actor* thisx, PlayState* play2) {
|
||||
RECOMP_PATCH void EnTanron2_Draw(Actor* thisx, PlayState* play2) {
|
||||
PlayState* play = play2;
|
||||
s32 i;
|
||||
s32 j;
|
||||
@ -39,17 +47,14 @@ void EnTanron2_Draw(Actor* thisx, PlayState* play2) {
|
||||
|
||||
tanron2 = play->actorCtx.actorLists[ACTORCAT_BOSS].first;
|
||||
|
||||
// @recomp Manual relocation, TODO remove this when the recompiler does it automatically.
|
||||
EnTanron2** D_80BB8458_relocated = (EnTanron2**)actor_relocate(thisx, D_80BB8458);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(D_80BB8458); i++) {
|
||||
D_80BB8458_relocated[i] = NULL;
|
||||
D_80BB8458[i] = NULL;
|
||||
}
|
||||
|
||||
found = 0;
|
||||
while (tanron2 != NULL) {
|
||||
if (tanron2->params < 100) {
|
||||
D_80BB8458_relocated[found] = (EnTanron2*)tanron2;
|
||||
D_80BB8458[found] = (EnTanron2*)tanron2;
|
||||
found++;
|
||||
}
|
||||
tanron2 = tanron2->next;
|
||||
@ -57,26 +62,26 @@ void EnTanron2_Draw(Actor* thisx, PlayState* play2) {
|
||||
|
||||
for (j = 0; j < found - 1; j++) {
|
||||
for (i = 0; i < found - 1; i++) {
|
||||
if (D_80BB8458_relocated[i + 1] != NULL) {
|
||||
if (D_80BB8458_relocated[i]->actor.projectedPos.z < D_80BB8458_relocated[i + 1]->actor.projectedPos.z) {
|
||||
SWAP(EnTanron2*, D_80BB8458_relocated[i], D_80BB8458_relocated[i + 1]);
|
||||
if (D_80BB8458[i + 1] != NULL) {
|
||||
if (D_80BB8458[i]->actor.projectedPos.z < D_80BB8458[i + 1]->actor.projectedPos.z) {
|
||||
SWAP(EnTanron2*, D_80BB8458[i], D_80BB8458[i + 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(D_80BB8458); i++) {
|
||||
if (D_80BB8458_relocated[i] != NULL) {
|
||||
Matrix_Translate(D_80BB8458_relocated[i]->actor.world.pos.x, D_80BB8458_relocated[i]->actor.world.pos.y,
|
||||
D_80BB8458_relocated[i]->actor.world.pos.z, MTXMODE_NEW);
|
||||
if (D_80BB8458[i] != NULL) {
|
||||
Matrix_Translate(D_80BB8458[i]->actor.world.pos.x, D_80BB8458[i]->actor.world.pos.y,
|
||||
D_80BB8458[i]->actor.world.pos.z, MTXMODE_NEW);
|
||||
Matrix_ReplaceRotation(&play->billboardMtxF);
|
||||
Matrix_Scale(D_80BB8458_relocated[i]->actor.scale.x, D_80BB8458_relocated[i]->actor.scale.y, 0.0f, MTXMODE_APPLY);
|
||||
Matrix_RotateZS(D_80BB8458_relocated[i]->unk_14A, MTXMODE_APPLY);
|
||||
Matrix_Scale(D_80BB8458[i]->actor.scale.x, D_80BB8458[i]->actor.scale.y, 0.0f, MTXMODE_APPLY);
|
||||
Matrix_RotateZS(D_80BB8458[i]->unk_14A, MTXMODE_APPLY);
|
||||
Matrix_Scale(0.13f, 0.14299999f, 0.13f, MTXMODE_APPLY);
|
||||
Matrix_RotateZS(-D_80BB8458_relocated[i]->unk_14A, MTXMODE_APPLY);
|
||||
Matrix_RotateZS(-D_80BB8458[i]->unk_14A, MTXMODE_APPLY);
|
||||
|
||||
// @recomp Tag the transform.
|
||||
gEXMatrixGroupSimple(POLY_XLU_DISP++, actor_transform_id(&D_80BB8458_relocated[i]->actor) + 0,
|
||||
gEXMatrixGroupSimple(POLY_XLU_DISP++, actor_transform_id(&D_80BB8458[i]->actor) + 0,
|
||||
G_EX_PUSH, G_MTX_MODELVIEW,
|
||||
G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_INTERPOLATE, G_EX_COMPONENT_INTERPOLATE,
|
||||
G_EX_COMPONENT_INTERPOLATE, G_EX_ORDER_LINEAR, G_EX_EDIT_NONE);
|
||||
@ -93,14 +98,11 @@ void EnTanron2_Draw(Actor* thisx, PlayState* play2) {
|
||||
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, 150);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gWartShadowMaterialDL);
|
||||
|
||||
// @recomp Manual relocation, TODO remove this when the recompiler does it automatically.
|
||||
Boss04** D_80BB8450_relocated = (Boss04**)actor_relocate(thisx, &D_80BB8450);
|
||||
|
||||
tanron2 = play->actorCtx.actorLists[ACTORCAT_BOSS].first;
|
||||
while (tanron2 != NULL) {
|
||||
if ((tanron2->params < 100) && (((EnTanron2*)tanron2)->unk_15B != 0)) {
|
||||
Matrix_Translate(tanron2->world.pos.x, (*D_80BB8450_relocated)->actor.floorHeight, tanron2->world.pos.z, MTXMODE_NEW);
|
||||
Matrix_Translate(tanron2->world.pos.x, D_80BB8450->actor.floorHeight, tanron2->world.pos.z, MTXMODE_NEW);
|
||||
Matrix_Scale(0.6f, 0.0f, 0.6f, MTXMODE_APPLY);
|
||||
|
||||
// @recomp Tag the transform.
|
||||
@ -129,12 +131,9 @@ void EnTanron2_Draw(Actor* thisx, PlayState* play2) {
|
||||
while (tanron2 != NULL) {
|
||||
if ((tanron2->params < 100) && (((EnTanron2*)tanron2)->unk_15B != 0) &&
|
||||
(tanron2->world.pos.y <= tanron2->floorHeight)) {
|
||||
Matrix_Translate(tanron2->world.pos.x, (*D_80BB8450_relocated)->actor.floorHeight + 2.0f, tanron2->world.pos.z,
|
||||
Matrix_Translate(tanron2->world.pos.x, D_80BB8450->actor.floorHeight + 2.0f, tanron2->world.pos.z,
|
||||
MTXMODE_NEW);
|
||||
|
||||
// @recomp Manual relocation, TODO remove this when the recompiler does it automatically.
|
||||
f32 D_80BB8454_value = *(f32*)actor_relocate(thisx, &D_80BB8454);
|
||||
Matrix_Scale(D_80BB8454_value, 0.0f, D_80BB8454_value, MTXMODE_APPLY);
|
||||
Matrix_Scale(D_80BB8454, 0.0f, D_80BB8454, MTXMODE_APPLY);
|
||||
|
||||
// @recomp Tag the transform.
|
||||
gEXMatrixGroupSimple(POLY_XLU_DISP++, actor_transform_id(tanron2) + 2,
|
||||
@ -155,7 +154,7 @@ void EnTanron2_Draw(Actor* thisx, PlayState* play2) {
|
||||
}
|
||||
|
||||
// @recomp Track this effect's reset state.
|
||||
void Boss03_SpawnEffectWetSpot(PlayState* play, Vec3f* pos) {
|
||||
RECOMP_PATCH void Boss03_SpawnEffectWetSpot(PlayState* play, Vec3f* pos) {
|
||||
s16 i;
|
||||
GyorgEffect* eff = play->specialEffects;
|
||||
|
||||
@ -179,7 +178,7 @@ void Boss03_SpawnEffectWetSpot(PlayState* play, Vec3f* pos) {
|
||||
}
|
||||
|
||||
// @recomp Track this effect's reset state.
|
||||
void Boss03_SpawnEffectDroplet(PlayState* play, Vec3f* pos) {
|
||||
RECOMP_PATCH void Boss03_SpawnEffectDroplet(PlayState* play, Vec3f* pos) {
|
||||
s16 i;
|
||||
GyorgEffect* eff = play->specialEffects;
|
||||
|
||||
@ -206,7 +205,7 @@ void Boss03_SpawnEffectDroplet(PlayState* play, Vec3f* pos) {
|
||||
}
|
||||
|
||||
// @recomp Track this effect's reset state.
|
||||
void Boss03_SpawnEffectSplash(PlayState* play, Vec3f* pos, Vec3f* velocity) {
|
||||
RECOMP_PATCH void Boss03_SpawnEffectSplash(PlayState* play, Vec3f* pos, Vec3f* velocity) {
|
||||
Vec3f accel = { 0.0f, -1.0f, 0.0f };
|
||||
f32 temp_f2;
|
||||
GyorgEffect* eff = play->specialEffects;
|
||||
@ -233,7 +232,7 @@ void Boss03_SpawnEffectSplash(PlayState* play, Vec3f* pos, Vec3f* velocity) {
|
||||
}
|
||||
|
||||
// @recomp Track this effect's reset state.
|
||||
void Boss03_SpawnEffectBubble(PlayState* play, Vec3f* pos) {
|
||||
RECOMP_PATCH void Boss03_SpawnEffectBubble(PlayState* play, Vec3f* pos) {
|
||||
s16 i;
|
||||
GyorgEffect* eff = play->specialEffects;
|
||||
|
||||
@ -263,7 +262,7 @@ extern u8 gEffDust1Tex[];
|
||||
void Boss03_SetObject(PlayState* play, s16 objectId);
|
||||
|
||||
// @recomp Tag Gyorg's effects.
|
||||
void Boss03_DrawEffects(PlayState* play) {
|
||||
RECOMP_PATCH void Boss03_DrawEffects(PlayState* play) {
|
||||
u8 flag = false;
|
||||
s16 i;
|
||||
GraphicsContext* gfxCtx = play->state.gfxCtx;
|
||||
@ -412,7 +411,7 @@ extern Gfx object_water_effect_DL_000420[];
|
||||
extern Gfx object_water_effect_DL_000A48[];
|
||||
extern Gfx object_water_effect_DL_000CD8[];
|
||||
|
||||
void func_80A5A6B8(Actor* thisx, PlayState* play2) {
|
||||
RECOMP_PATCH void func_80A5A6B8(Actor* thisx, PlayState* play2) {
|
||||
PlayState* play = play2;
|
||||
EnWaterEffect* this = (EnWaterEffect*)thisx;
|
||||
EnWaterEffectStruct* ptr = &this->unk_144[0];
|
||||
@ -549,7 +548,7 @@ void func_80A5A6B8(Actor* thisx, PlayState* play2) {
|
||||
}
|
||||
|
||||
// @recomp Tag normal water effects.
|
||||
void EnWaterEffect_Draw(Actor* thisx, PlayState* play2) {
|
||||
RECOMP_PATCH void EnWaterEffect_Draw(Actor* thisx, PlayState* play2) {
|
||||
PlayState* play = play2;
|
||||
GraphicsContext* gfxCtx = play->state.gfxCtx;
|
||||
EnWaterEffect* this = (EnWaterEffect*)thisx;
|
||||
@ -643,7 +642,7 @@ extern Gfx gGohtStalactiteMaterialDL[];
|
||||
extern Gfx gGohtStalactiteModelDL[];
|
||||
|
||||
// @recomp Tag Goht's rocks.
|
||||
void func_80B0C398(BossHakugin* this, PlayState* play) {
|
||||
RECOMP_PATCH void func_80B0C398(BossHakugin* this, PlayState* play) {
|
||||
BossHakuginEffect* effect;
|
||||
s32 i;
|
||||
|
||||
@ -724,21 +723,16 @@ void EnOsn_HandleCsAction(EnOsn* this, PlayState* play);
|
||||
void EnOsn_Idle(EnOsn* this, PlayState* play);
|
||||
|
||||
// @recomp Patched to skip interpolation when the Happy Mask Salesman changes animations.
|
||||
void EnOsn_ChooseAction(EnOsn* this, PlayState* play) {
|
||||
// @recomp Manually relocate the static symbol.
|
||||
AnimationInfo* sAnimationInfo = (AnimationInfo*)actor_relocate(&this->actor, sHappyMaskSalesmanAnimationInfo);
|
||||
|
||||
RECOMP_PATCH void EnOsn_ChooseAction(EnOsn* this, PlayState* play) {
|
||||
u32 isSwitchFlagSet = Flags_GetSwitch(play, 0);
|
||||
|
||||
this->csId = this->actor.csId;
|
||||
|
||||
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, OSN_ANIM_IDLE);
|
||||
Actor_ChangeAnimationByInfo(&this->skelAnime, sHappyMaskSalesmanAnimationInfo, OSN_ANIM_IDLE);
|
||||
if (!isSwitchFlagSet) {
|
||||
// @recomp No need to relocate as this function is replaced, so the patch compilation will pick the new address.
|
||||
this->actionFunc = EnOsn_HandleCsAction;
|
||||
} else {
|
||||
// @recomp Manual relocation, TODO remove when automated by the recompiler.
|
||||
this->actionFunc = (EnOsnActionFunc)actor_relocate(&this->actor, EnOsn_Idle);
|
||||
this->actionFunc = EnOsn_Idle;
|
||||
}
|
||||
|
||||
// @recomp Skip interpolation this frame.
|
||||
@ -750,7 +744,7 @@ void EnOsn_LookFromMask(EnOsn* this);
|
||||
void EnOsn_FadeOut(EnOsn* this);
|
||||
|
||||
// @recomp Patched to skip interpolation when the Happy Mask Salesman changes animations.
|
||||
void EnOsn_HandleCsAction(EnOsn* this, PlayState* play) {
|
||||
RECOMP_PATCH void EnOsn_HandleCsAction(EnOsn* this, PlayState* play) {
|
||||
u8 pad;
|
||||
s32 cueChannel;
|
||||
|
||||
@ -847,11 +841,8 @@ void EnOsn_HandleCsAction(EnOsn* this, PlayState* play) {
|
||||
default:
|
||||
this->animIndex = OSN_ANIM_IDLE;
|
||||
break;
|
||||
}
|
||||
// @recomp Manually relocate the static symbol.
|
||||
AnimationInfo* sAnimationInfo = (AnimationInfo*)actor_relocate(&this->actor, sHappyMaskSalesmanAnimationInfo);
|
||||
|
||||
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex);
|
||||
}
|
||||
Actor_ChangeAnimationByInfo(&this->skelAnime, sHappyMaskSalesmanAnimationInfo, this->animIndex);
|
||||
|
||||
// @recomp Skip interpolation this frame.
|
||||
actor_set_interpolation_skipped(&this->actor);
|
||||
@ -890,7 +881,7 @@ void EnOsn_HandleCsAction(EnOsn* this, PlayState* play) {
|
||||
}
|
||||
|
||||
// @recomp Patched to tag this actor's draws using linear order matching.
|
||||
void EnFall2_Draw(Actor* thisx, PlayState* play) {
|
||||
RECOMP_PATCH void EnFall2_Draw(Actor* thisx, PlayState* play) {
|
||||
s32 pad;
|
||||
EnFall2* this = (EnFall2*)thisx;
|
||||
Mtx* mtx;
|
||||
@ -919,7 +910,7 @@ void EnFall2_Draw(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
// @recomp Skip interpolation on item pickups the frame they're collected.
|
||||
void func_800A6A40(EnItem00* this, PlayState* play) {
|
||||
RECOMP_PATCH void func_800A6A40(EnItem00* this, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
if (this->getItemId != GI_NONE) {
|
||||
@ -962,7 +953,7 @@ extern Vtx ovl_Obj_Entotu_Vtx_000D10[7];
|
||||
extern Gfx object_f53_obj_DL_001C00[];
|
||||
|
||||
// @recomp Skip rotation interpolation for the Clock Town chimney's smoke when the camera skips interolation.
|
||||
void func_80A34B28(ObjEntotu* this, PlayState* play) {
|
||||
RECOMP_PATCH void func_80A34B28(ObjEntotu* this, PlayState* play) {
|
||||
u8 sp57;
|
||||
u8 sp56;
|
||||
s32 i;
|
||||
@ -974,10 +965,8 @@ void func_80A34B28(ObjEntotu* this, PlayState* play) {
|
||||
|
||||
this->unk_1B8.x = CLAMP(this->unk_1B8.x, 0.0f, 1.0f);
|
||||
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
Vtx* verts = (Vtx*)actor_relocate(&this->actor, ovl_Obj_Entotu_Vtx_000D10);
|
||||
for (i = 0; i < ARRAY_COUNT(ovl_Obj_Entotu_Vtx_000D10); i++) {
|
||||
this->unk_148[i].v.cn[3] = verts[i].v.cn[3] * this->unk_1B8.x;
|
||||
this->unk_148[i].v.cn[3] = ovl_Obj_Entotu_Vtx_000D10[i].v.cn[3] * this->unk_1B8.x;
|
||||
}
|
||||
|
||||
if (this->unk_1B8.x > 0.0f) {
|
||||
@ -1014,7 +1003,7 @@ void func_80A34B28(ObjEntotu* this, PlayState* play) {
|
||||
extern Gfx object_f53_obj_DL_000158[];
|
||||
|
||||
// @recomp Skip rotation interpolation for the Clock Town chimney when the camera skips interolation.
|
||||
void func_80A34A44(ObjEntotu* this, PlayState* play) {
|
||||
RECOMP_PATCH void func_80A34A44(ObjEntotu* this, PlayState* play) {
|
||||
Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW);
|
||||
this->actor.shape.rot.y = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)));
|
||||
Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_APPLY);
|
||||
@ -1044,7 +1033,7 @@ void func_80A34A44(ObjEntotu* this, PlayState* play) {
|
||||
void Environment_DrawRainImpl(PlayState* play, View* view, GraphicsContext* gfxCtx);
|
||||
|
||||
// @recomp Skip interpolation for the splashes that raindrops make.
|
||||
void Environment_DrawRain(PlayState* play, View* view, GraphicsContext* gfxCtx) {
|
||||
RECOMP_PATCH void Environment_DrawRain(PlayState* play, View* view, GraphicsContext* gfxCtx) {
|
||||
if (!(GET_ACTIVE_CAM(play)->stateFlags & CAM_STATE_UNDERWATER) &&
|
||||
(play->envCtx.precipitation[PRECIP_SNOW_CUR] == 0)) {
|
||||
|
||||
@ -1068,3 +1057,277 @@ void Environment_DrawRain(PlayState* play, View* view, GraphicsContext* gfxCtx)
|
||||
CLOSE_DISPS(gfxCtx);
|
||||
}
|
||||
}
|
||||
|
||||
// @recomp Skip interpolation on the boulders in the path to Snowhead and the path to Ikana Canyon when they teleport back to their home position.
|
||||
RECOMP_PATCH void func_8093EE64(EnGoroiwa* this, s32 arg1) {
|
||||
Vec3s* temp_v0 = &this->pathPoints[arg1];
|
||||
|
||||
this->actor.world.pos.x = temp_v0->x;
|
||||
this->actor.world.pos.y = temp_v0->y;
|
||||
this->actor.world.pos.z = temp_v0->z;
|
||||
|
||||
// @recomp Skip interpolation if their next goal position is their home position.
|
||||
if (arg1 == 0) {
|
||||
actor_set_interpolation_skipped(&this->actor);
|
||||
}
|
||||
}
|
||||
|
||||
extern Gfx object_twig_DL_001C38[];
|
||||
extern Gfx object_twig_DL_0014C8[];
|
||||
|
||||
// @recomp Skip interpolation on the rotation for the beaver race rings in order to retain the intended animation look.
|
||||
RECOMP_PATCH void EnTwig_Draw(Actor* thisx, PlayState* play) {
|
||||
EnTwig* this = (EnTwig*)thisx;
|
||||
|
||||
switch (this->unk_160) {
|
||||
case 1:
|
||||
// @recomp Set the matrix group to skip interpolation on rotation.
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
gEXMatrixGroupDecomposedSkipRot(POLY_OPA_DISP++, actor_transform_id(thisx), G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_NONE);
|
||||
Gfx_DrawDListOpa(play, object_twig_DL_001C38);
|
||||
|
||||
// @recomp Pop the tag.
|
||||
gEXPopMatrixGroup(POLY_OPA_DISP++, G_MTX_MODELVIEW);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
break;
|
||||
case 2:
|
||||
Gfx_DrawDListOpa(play, object_twig_DL_0014C8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
extern Gfx gEffFire1DL[];
|
||||
|
||||
#define HONOTRAP_EXTRA_BYTE_1(flameGroup) (&(flameGroup)->flameList[0].isDrawn)[1]
|
||||
#define HONOTRAP_EXTRA_BYTE_2(flameGroup) (&(flameGroup)->flameList[1].isDrawn)[1]
|
||||
|
||||
RECOMP_PATCH void EnHonotrap_FlameGroup(EnHonotrap* this, PlayState* play) {
|
||||
s32 i;
|
||||
EnHonotrapFlameGroup* flameGroup = &this->flameGroup;
|
||||
f32 var_fs0;
|
||||
f32 temp_fs0;
|
||||
f32 temp_fs1;
|
||||
f32 sp88;
|
||||
f32 sp84;
|
||||
f32 sp80;
|
||||
s32 flameScrollDisplacement;
|
||||
s32 sp78 = false;
|
||||
f32 var_fs0_2;
|
||||
Vec3f sp68;
|
||||
EnHonotrapFlameElement* flameElem;
|
||||
|
||||
sp80 = fabsf(Math_CosS(Camera_GetCamDirPitch(GET_ACTIVE_CAM(play))));
|
||||
flameScrollDisplacement = (s32)(sp80 * -10.5f) - 10;
|
||||
Math_StepToF(&flameGroup->unk0, 1.0f, 0.05f);
|
||||
if (this->timer <= 40) {
|
||||
sp78 = Math_StepToF(&flameGroup->unk4, 1.0f, 0.05f);
|
||||
} else if (this->actor.parent == NULL) {
|
||||
this->timer = 40;
|
||||
}
|
||||
for (i = 0; i < ARRAY_COUNT(flameGroup->flameList); i++) {
|
||||
flameGroup->flameList[i].isDrawn = false;
|
||||
}
|
||||
|
||||
sp88 = Math_SinS(this->actor.shape.rot.y) * 120.0f;
|
||||
sp84 = Math_CosS(this->actor.shape.rot.y) * 120.0f;
|
||||
|
||||
flameGroup->unk8 += 0.050f * (1.0f - flameGroup->unk4);
|
||||
|
||||
if (flameGroup->unk8 > 1.0f / 6) {
|
||||
flameGroup->unk8 -= 1.0f / 6;
|
||||
// @recomp Indicate that a cycle of the flame group has occurred.
|
||||
HONOTRAP_EXTRA_BYTE_1(flameGroup) = true;
|
||||
HONOTRAP_EXTRA_BYTE_2(flameGroup)++;
|
||||
if (HONOTRAP_EXTRA_BYTE_2(flameGroup) == ARRAY_COUNT(flameGroup->flameList)) {
|
||||
HONOTRAP_EXTRA_BYTE_2(flameGroup) = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
HONOTRAP_EXTRA_BYTE_1(flameGroup) = false;
|
||||
}
|
||||
var_fs0 = flameGroup->unk4 + flameGroup->unk8;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(flameGroup->flameList) && (var_fs0 <= flameGroup->unk0); i++) {
|
||||
flameElem = &flameGroup->flameList[i];
|
||||
flameElem->isDrawn = true;
|
||||
|
||||
flameElem->pos.x = (sp88 * var_fs0) + this->actor.world.pos.x;
|
||||
flameElem->pos.y = this->actor.world.pos.y;
|
||||
flameElem->pos.z = (sp84 * var_fs0) + this->actor.world.pos.z;
|
||||
|
||||
flameElem->unkC = Math_SinS(TRUNCF_BINANG(var_fs0 * 25486.223f)) * 1.6f;
|
||||
if (flameElem->unkC > 1.0f) {
|
||||
flameElem->unkC = 1.0f;
|
||||
} else if (flameElem->unkC < 0.0f) {
|
||||
flameElem->unkC = 0.0f;
|
||||
}
|
||||
|
||||
var_fs0 += 1.0f / 6;
|
||||
flameElem->unkC *= (0.006f * (((1.0f - flameGroup->unk4) * 0.8f) + 0.2f));
|
||||
flameElem->flameScroll += flameScrollDisplacement;
|
||||
flameElem->flameScroll %= 0x200U;
|
||||
}
|
||||
|
||||
if (sp78 || (this->timer <= 0)) {
|
||||
Actor_Kill(&this->actor);
|
||||
return;
|
||||
}
|
||||
temp_fs0 = flameGroup->unk0 * 120.0f;
|
||||
temp_fs1 = flameGroup->unk4 * 120.0f;
|
||||
Actor_OffsetOfPointInActorCoords(&this->actor, &sp68, &GET_PLAYER(play)->actor.world.pos);
|
||||
|
||||
if (sp68.z < temp_fs1) {
|
||||
sp68.z = temp_fs1;
|
||||
} else if (temp_fs0 < sp68.z) {
|
||||
sp68.z = temp_fs0;
|
||||
}
|
||||
|
||||
var_fs0_2 = Math_SinS(TRUNCF_BINANG(sp68.z * 212.3852f)) * 1.6f;
|
||||
if (var_fs0_2 > 1.0f) {
|
||||
var_fs0_2 = 1.0f;
|
||||
}
|
||||
sp80 *= ((1.0f - flameGroup->unk4) * 0.8f) + 0.2f;
|
||||
if (sp80 > 0.2f) {
|
||||
this->collider.cyl.dim.pos.x =
|
||||
TRUNCF_BINANG((Math_SinS(this->actor.shape.rot.y) * sp68.z) + this->actor.world.pos.x);
|
||||
this->collider.cyl.dim.pos.y = TRUNCF_BINANG(this->actor.world.pos.y - (24.0f * var_fs0_2));
|
||||
this->collider.cyl.dim.pos.z =
|
||||
TRUNCF_BINANG((Math_CosS(this->actor.shape.rot.y) * sp68.z) + this->actor.world.pos.z);
|
||||
this->collider.cyl.dim.radius = TRUNCF_BINANG(15.0f * var_fs0_2);
|
||||
this->collider.cyl.dim.height = TRUNCF_BINANG(37.5f * var_fs0_2);
|
||||
CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.tris.base);
|
||||
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.tris.base);
|
||||
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.tris.base);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// @recomp Patched to tag the flames that come out of fire eyes.
|
||||
RECOMP_PATCH void EnHonotrap_DrawFlameGroup(Actor* thisx, PlayState* play) {
|
||||
s32 pad;
|
||||
EnHonotrap* this = (EnHonotrap*)thisx;
|
||||
EnHonotrapFlameElement* flameElem;
|
||||
EnHonotrapFlameGroup* flameGroup = &this->flameGroup;
|
||||
s32 i;
|
||||
s32 pad2;
|
||||
Vec3s camDir;
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
Gfx_SetupDL25_Xlu(play->state.gfxCtx);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 200, 0, 255);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0);
|
||||
camDir = Camera_GetCamDir(GET_ACTIVE_CAM(play));
|
||||
camDir.y += 0x8000;
|
||||
|
||||
// @recomp Get the transform ID for this actor.
|
||||
u32 base_transform_id = actor_transform_id(thisx);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(flameGroup->flameList); i++) {
|
||||
flameElem = &flameGroup->flameList[i];
|
||||
if (flameElem->isDrawn) {
|
||||
|
||||
// @recomp Tag the current flame.
|
||||
s32 transform_id_offset = i - HONOTRAP_EXTRA_BYTE_2(flameGroup);
|
||||
if (transform_id_offset < 0) {
|
||||
transform_id_offset += ARRAY_COUNT(flameGroup->flameList);
|
||||
}
|
||||
u32 transform_id = base_transform_id + transform_id_offset;
|
||||
|
||||
// @recomp Use the texscroll for the flame index based on the calculated transform offset to make it consistent in movement.
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08,
|
||||
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, flameGroup->flameList[transform_id_offset].flameScroll, 32, 128));
|
||||
Matrix_SetTranslateRotateYXZ(flameElem->pos.x, flameElem->pos.y - (4000.0f * flameElem->unkC),
|
||||
flameElem->pos.z, &camDir);
|
||||
Matrix_Scale(((fabsf(Math_SinS((s16)(camDir.y - thisx->shape.rot.y) >> 1)) * 0.2f) + 1.7f) *
|
||||
flameElem->unkC,
|
||||
flameElem->unkC, 1.0f, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
// @recomp Skip if a cycle occurred and this is the first flame.
|
||||
if (i == 0 && HONOTRAP_EXTRA_BYTE_1(flameGroup)) {
|
||||
gEXMatrixGroupDecomposedSkipAll(POLY_XLU_DISP++, transform_id, G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_NONE);
|
||||
}
|
||||
else {
|
||||
gEXMatrixGroupDecomposedNormal(POLY_XLU_DISP++, transform_id, G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_NONE);
|
||||
}
|
||||
gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL);
|
||||
// @recomp Pop the matrix group.
|
||||
gEXPopMatrixGroup(POLY_XLU_DISP++, G_MTX_MODELVIEW);
|
||||
}
|
||||
}
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
extern Gfx ovl_En_Tanron1_DL_001428[];
|
||||
extern Gfx ovl_En_Tanron1_DL_001888[];
|
||||
extern Gfx ovl_En_Tanron1_DL_001900[];
|
||||
|
||||
// @recomp Patched to interpolate the moths that circle torches.
|
||||
RECOMP_PATCH void func_80BB5AAC(EnTanron1* this, PlayState* play) {
|
||||
EnTanron1Struct* ptrBase = &this->unk_160[0];
|
||||
s16 i;
|
||||
u8 flag = 0;
|
||||
EnTanron1Struct* ptr = ptrBase;
|
||||
|
||||
// @recomp Get actor transform id
|
||||
u32 cur_transform_id = actor_transform_id(&this->actor);
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
Gfx_SetupDL25_Opa(play->state.gfxCtx);
|
||||
|
||||
for (i = 0; i < this->actor.params; i++, ptr++) {
|
||||
if (ptr->unk_24 == 1) {
|
||||
if (!flag) {
|
||||
gSPDisplayList(POLY_OPA_DISP++, ovl_En_Tanron1_DL_001888);
|
||||
flag++;
|
||||
}
|
||||
Matrix_Translate(ptr->unk_00.x, ptr->unk_00.y, ptr->unk_00.z, MTXMODE_NEW);
|
||||
Matrix_RotateYS(ptr->unk_1A, MTXMODE_APPLY);
|
||||
Matrix_RotateXS(ptr->unk_18 * -1, MTXMODE_APPLY);
|
||||
Matrix_Scale(1.2f, ptr->unk_2C, 1.2f, MTXMODE_APPLY);
|
||||
|
||||
// @recomp Write matrix group for POLY_OPA
|
||||
gEXMatrixGroupDecomposedNormal(POLY_OPA_DISP++, cur_transform_id + i, G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_ALLOW);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_OPA_DISP++, ovl_En_Tanron1_DL_001900);
|
||||
|
||||
// @recomp Pop matrix group
|
||||
gEXPopMatrixGroup(POLY_OPA_DISP++, G_MTX_MODELVIEW);
|
||||
}
|
||||
}
|
||||
|
||||
flag = 0;
|
||||
ptr = ptrBase;
|
||||
for (i = 0; i < this->actor.params; i++, ptr++) {
|
||||
if (ptr->unk_24 == 2) {
|
||||
if (!flag) {
|
||||
gSPDisplayList(POLY_OPA_DISP++, ovl_En_Tanron1_DL_001888);
|
||||
gDPLoadTextureBlock(POLY_OPA_DISP++, ovl_En_Tanron1_DL_001428, G_IM_FMT_RGBA, G_IM_SIZ_16b, 16, 32, 0,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 4, 5, G_TX_NOLOD,
|
||||
G_TX_NOLOD);
|
||||
flag++;
|
||||
}
|
||||
|
||||
Matrix_Translate(ptr->unk_00.x, ptr->unk_00.y, ptr->unk_00.z, MTXMODE_NEW);
|
||||
Matrix_RotateYS(ptr->unk_1A, MTXMODE_APPLY);
|
||||
Matrix_RotateXS(ptr->unk_18 * -1, MTXMODE_APPLY);
|
||||
Matrix_Scale(1.0f, ptr->unk_2C, 1.0f, MTXMODE_APPLY);
|
||||
|
||||
// @recomp Write matrix group for POLY_OPA
|
||||
gEXMatrixGroupDecomposedNormal(POLY_OPA_DISP++, cur_transform_id + i, G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_ALLOW);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_OPA_DISP++, ovl_En_Tanron1_DL_001900);
|
||||
|
||||
// @recomp Pop matrix group
|
||||
gEXPopMatrixGroup(POLY_OPA_DISP++, G_MTX_MODELVIEW);
|
||||
}
|
||||
}
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
@ -1,29 +1,14 @@
|
||||
__start = 0x80000000;
|
||||
|
||||
/* Manual symbol overrides to work around recompiler ambiguity issue (TODO fix this) */
|
||||
_ovl_daytelopSegmentOvlEnd = 0x0;
|
||||
_ovl_kaleido_scopeSegmentTextStart = 0x0;
|
||||
_ovl_kaleido_scopeSegmentStart = 0x0;
|
||||
_ovl_daytelopSegmentBssStart = 0x0;
|
||||
_ovl_daytelopSegmentEnd = 0x0;
|
||||
_ovl_daytelopSegmentBssEnd = 0x0;
|
||||
|
||||
/* Static symbols that aren't in the elf */
|
||||
sSceneEntranceTable = 0x801C5720;
|
||||
D_808DE5B0 = 0x808DE5B0;
|
||||
sHappyMaskSalesmanAnimationInfo = 0x80AD22C0;
|
||||
D_808890F0 = 0x808890F0;
|
||||
D_8088911C = 0x8088911C;
|
||||
|
||||
/* Dummy addresses that get recompiled into function calls */
|
||||
recomp_puts = 0x8F000000;
|
||||
recomp_exit = 0x8F000004;
|
||||
recomp_handle_quicksave_actions = 0x8F000008;
|
||||
recomp_handle_quicksave_actions_main = 0x8F00000C;
|
||||
/* recomp_handle_quicksave_actions = 0x8F000008;
|
||||
recomp_handle_quicksave_actions_main = 0x8F00000C; */
|
||||
osRecvMesg_recomp = 0x8F000010;
|
||||
osSendMesg_recomp = 0x8F000014;
|
||||
recomp_get_gyro_deltas = 0x8F000018;
|
||||
recomp_get_aspect_ratio = 0x8F00001C;
|
||||
recomp_get_target_aspect_ratio = 0x8F00001C;
|
||||
recomp_get_pending_warp = 0x8F000020;
|
||||
recomp_powf = 0x8F000024;
|
||||
recomp_get_target_framerate = 0x8F000028;
|
||||
@ -47,3 +32,16 @@ osContGetReadData_recomp = 0x8F000074;
|
||||
osContStartQuery_recomp = 0x8F000078;
|
||||
osContGetQuery_recomp = 0x8F00007C;
|
||||
recomp_get_mouse_deltas = 0x8F000080;
|
||||
bcmp_recomp = 0x8F000084;
|
||||
osGetTime_recomp = 0x8F000088;
|
||||
recomp_get_autosave_enabled = 0x8F00008C;
|
||||
recomp_load_overlays = 0x8F000090;
|
||||
osInvalICache_recomp = 0x8F000094;
|
||||
recomp_get_analog_cam_enabled = 0x8F000098;
|
||||
recomp_get_camera_inputs = 0x8F00009C;
|
||||
recomp_set_right_analog_suppressed = 0x8F0000A0;
|
||||
recomp_get_inverted_axes = 0x8F0000A4;
|
||||
recomp_high_precision_fb_enabled = 0x8F0000A8;
|
||||
recomp_get_resolution_scale = 0x8F0000AC;
|
||||
recomp_get_analog_inverted_axes = 0x8F0000B0;
|
||||
recomp_get_window_resolution = 0x8F0000B4;
|
||||
|
@ -1,12 +1,13 @@
|
||||
#include "patches.h"
|
||||
#include "transform_ids.h"
|
||||
#include "overlays/actors/ovl_Dm_Opstage/z_dm_opstage.h"
|
||||
#include "overlays/actors/ovl_Dm_Char01/z_dm_char01.h"
|
||||
|
||||
static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
extern RoomDrawHandler sRoomDrawHandlers[];
|
||||
|
||||
void Room_Draw(PlayState* play, Room* room, u32 flags) {
|
||||
RECOMP_PATCH void Room_Draw(PlayState* play, Room* room, u32 flags) {
|
||||
if (room->segment != NULL) {
|
||||
gSegments[3] = OS_K0_TO_PHYSICAL(room->segment);
|
||||
|
||||
@ -50,7 +51,7 @@ extern Gfx gKeikokuDemoTallTreeStraightDL[];
|
||||
extern Gfx gKeikokuDemoTallTreeStraightEmptyDL[];
|
||||
|
||||
// @recomp Tag the ground in the intro cutscene to not interpolate rotation.
|
||||
void DmOpstage_Draw(Actor* thisx, PlayState* play) {
|
||||
RECOMP_PATCH void DmOpstage_Draw(Actor* thisx, PlayState* play) {
|
||||
DmOpstage* this = (DmOpstage*)thisx;
|
||||
|
||||
if (DMOPSTAGE_GET_TYPE(&this->dyna.actor) > DMOPSTAGE_TYPE_GROUND) {
|
||||
@ -97,3 +98,197 @@ void DmOpstage_Draw(Actor* thisx, PlayState* play) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
extern AnimatedMaterial gWoodfallSceneryPoisonWaterTexAnim[];
|
||||
extern AnimatedMaterial gWoodfallSceneryPurifiedWaterTexAnim[];
|
||||
extern AnimatedMaterial gWoodfallSceneryDynamicPoisonWaterTexAnim[];
|
||||
extern AnimatedMaterial gWoodfallSceneryPoisonWallsTexAnim[];
|
||||
extern AnimatedMaterial gWoodfallSceneryPurifiedWallsTexAnim[];
|
||||
extern AnimatedMaterial gWoodfallSceneryTempleTexAnim[];
|
||||
extern AnimatedMaterial gWoodfallSceneryWaterFlowingOverTempleTexAnim[];
|
||||
extern Gfx gWoodfallSceneryPoisonWaterDL[];
|
||||
extern Gfx gWoodfallSceneryFloorDL[];
|
||||
extern Gfx gWoodfallSceneryPurifiedWaterDL[];
|
||||
extern Gfx gWoodfallSceneryPurifiedWallsDL[];
|
||||
extern Gfx gWoodfallSceneryDynamicPoisonWaterDL[];
|
||||
extern Gfx gWoodfallSceneryPoisonWallsDL[];
|
||||
extern Gfx gWoodfallSceneryTempleDL[];
|
||||
extern Gfx gWoodfallSceneryWaterFlowingOverTempleDL[];
|
||||
extern Gfx gWoodfallSceneryTempleEntrancesDL[];
|
||||
extern Gfx gWoodfallSceneryTempleRampAndPlatformDL[];
|
||||
extern Vtx gWoodfallSceneryDynamicPoisonWaterVtx[];
|
||||
|
||||
extern s16 D_80AAAE20;
|
||||
extern s16 D_80AAAE22;
|
||||
extern s16 D_80AAAE24;
|
||||
|
||||
extern f32 D_80AAAAB8;
|
||||
extern f32 D_80AAAABC;
|
||||
extern s16 D_80AAAAC0;
|
||||
extern s16 D_80AAAAC4;
|
||||
extern s16 D_80AAAAC8;
|
||||
extern s16 D_80AAAACC;
|
||||
|
||||
// @recomp Patched to enable vertex interpolation for the dynamic water as Woodfall temple rises from below the water.
|
||||
RECOMP_PATCH void DmChar01_Draw(Actor* thisx, PlayState* play) {
|
||||
// @recomp Move function statics to externs so they still get reset on overlay load like normal.
|
||||
DmChar01* this = (DmChar01*)thisx;
|
||||
f32 temp_f12;
|
||||
f32 spBC;
|
||||
s32 i;
|
||||
u8 spB7 = false;
|
||||
|
||||
switch (DMCHAR01_GET(thisx)) {
|
||||
case DMCHAR01_0:
|
||||
switch (this->unk_34C) {
|
||||
case 0:
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gWoodfallSceneryPoisonWaterTexAnim));
|
||||
Gfx_DrawDListOpa(play, gWoodfallSceneryPoisonWaterDL);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (gSaveContext.sceneLayer == 1) {
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gWoodfallSceneryPurifiedWaterTexAnim));
|
||||
Gfx_DrawDListOpa(play, gWoodfallSceneryFloorDL);
|
||||
Gfx_DrawDListXlu(play, gWoodfallSceneryPurifiedWaterDL);
|
||||
Matrix_Translate(0.0f, 10.0f, 0.0f, MTXMODE_APPLY);
|
||||
}
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gWoodfallSceneryDynamicPoisonWaterTexAnim));
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
if ((u8)this->unk_348 == 255) {
|
||||
Gfx_SetupDL25_Opa(play->state.gfxCtx);
|
||||
|
||||
gDPSetRenderMode(POLY_OPA_DISP++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2);
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x96, 255, 255, 255, 255);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x0B, gWoodfallSceneryDynamicPoisonWaterVtx);
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
// @recomp Tag the matrix to enable vertex interpolation.
|
||||
gEXMatrixGroupDecomposedVerts(POLY_OPA_DISP++, actor_transform_id(thisx), G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_NONE);
|
||||
gSPDisplayList(POLY_OPA_DISP++, gWoodfallSceneryDynamicPoisonWaterDL);
|
||||
// @recomp Tag the matrix to enable vertex interpolation.
|
||||
gEXPopMatrixGroup(POLY_OPA_DISP++, G_MTX_MODELVIEW);
|
||||
} else {
|
||||
Gfx_SetupDL25_Xlu(play->state.gfxCtx);
|
||||
|
||||
gDPSetRenderMode(POLY_XLU_DISP++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_XLU_SURF2);
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, (u8)this->unk_348);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x96, 255, 255, 255, (u8)this->unk_348);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x0B, gWoodfallSceneryDynamicPoisonWaterVtx);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
// @recomp Tag the matrix to enable vertex interpolation.
|
||||
gEXMatrixGroupDecomposedVerts(POLY_XLU_DISP++, actor_transform_id(thisx), G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_NONE);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gWoodfallSceneryDynamicPoisonWaterDL);
|
||||
// @recomp Tag the matrix to enable vertex interpolation.
|
||||
gEXPopMatrixGroup(POLY_XLU_DISP++, G_MTX_MODELVIEW);
|
||||
}
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gWoodfallSceneryPurifiedWaterTexAnim));
|
||||
Gfx_DrawDListOpa(play, gWoodfallSceneryFloorDL);
|
||||
Gfx_DrawDListXlu(play, gWoodfallSceneryPurifiedWaterDL);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case DMCHAR01_1:
|
||||
switch (this->unk_34C) {
|
||||
case 0:
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gWoodfallSceneryPoisonWallsTexAnim));
|
||||
Gfx_DrawDListOpa(play, gWoodfallSceneryPoisonWallsDL);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gWoodfallSceneryPurifiedWallsTexAnim));
|
||||
Gfx_DrawDListOpa(play, gWoodfallSceneryPurifiedWallsDL);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case DMCHAR01_2:
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gWoodfallSceneryTempleTexAnim));
|
||||
Gfx_DrawDListOpa(play, gWoodfallSceneryTempleDL);
|
||||
|
||||
if ((this->unk_34C != 0) && ((u8)this->unk_348 != 0)) {
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gWoodfallSceneryWaterFlowingOverTempleTexAnim));
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
Gfx_SetupDL25_Xlu(play->state.gfxCtx);
|
||||
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, (u8)this->unk_348);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, (u8)this->unk_348);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gWoodfallSceneryWaterFlowingOverTempleDL);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
if (D_80AAAE24 != 0) {
|
||||
if ((D_80AAAE22 > -1800) && (D_80AAAE22 < 3000)) {
|
||||
temp_f12 = D_80AAAE22 - 640.0f;
|
||||
if ((D_80AAAE20 == 380) && (D_80AAAE22 > 640)) {
|
||||
D_80AAAAC0 = 2;
|
||||
D_80AAAAC4 = 0;
|
||||
D_80AAAAC8 = 900;
|
||||
D_80AAAACC = 700;
|
||||
spB7 = true;
|
||||
if (D_80AAAE22 < 1350) {
|
||||
f32 temp_f0 = temp_f12 / 2000.0f;
|
||||
|
||||
D_80AAAAB8 = 420.0f - (420.0f * temp_f0);
|
||||
D_80AAAABC = (200.0f * temp_f0) + 200.0f;
|
||||
} else {
|
||||
f32 temp_f0 = temp_f12 / 2000.0f;
|
||||
|
||||
D_80AAAAB8 = 420.0f - (420.0f * temp_f0);
|
||||
D_80AAAABC = 400.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (spB7) {
|
||||
for (i = 0; i < D_80AAAAC0 * 2; i++) {
|
||||
Vec3f sp44;
|
||||
f32 phi_f2 = D_80AAAABC;
|
||||
s16 temp;
|
||||
|
||||
spBC = Rand_ZeroOne() * D_80AAAAC8;
|
||||
if ((play->state.frames % 2) != 0) {
|
||||
sp44.x = (Rand_ZeroOne() - 0.5f) * (2.0f * phi_f2);
|
||||
sp44.y = D_80AAAAB8;
|
||||
sp44.z = (Rand_ZeroOne() * D_80AAAAC4) + phi_f2;
|
||||
temp = (s16)spBC + D_80AAAACC;
|
||||
EffectSsGSplash_Spawn(play, &sp44, NULL, NULL, 0, temp);
|
||||
} else {
|
||||
sp44.x = -phi_f2 - (Rand_ZeroOne() * D_80AAAAC4);
|
||||
sp44.y = D_80AAAAB8;
|
||||
sp44.z = (Rand_ZeroOne() - 0.5f) * (2.0f * phi_f2);
|
||||
temp = (s16)spBC + D_80AAAACC;
|
||||
EffectSsGSplash_Spawn(play, &sp44, NULL, NULL, 0, temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Gfx_DrawDListXlu(play, gWoodfallSceneryTempleEntrancesDL);
|
||||
break;
|
||||
|
||||
case DMCHAR01_3:
|
||||
if (thisx->world.pos.y > -120.0f) {
|
||||
Gfx_DrawDListOpa(play, gWoodfallSceneryTempleRampAndPlatformDL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -17,10 +17,13 @@
|
||||
|
||||
#define SOARING_WINGS_TRANSFORM_ID 0x300U
|
||||
#define SOARING_CAPSULE_TRANSFORM_ID 0x301U
|
||||
#define SOARING_LENS_FLARE_TRANSFORM_ID 0x302U
|
||||
|
||||
#define BOWSTRING_TRANSFORM_ID 0x400U
|
||||
#define HOOKSHOT_RETICLE_TRANSFORM_ID 0x401U
|
||||
|
||||
#define CUSTOM_LENS_FLARE_TRANSFORM_ID_START 0x500 // Count: 2
|
||||
#define SUN_LENS_FLARE_TRANSFORM_ID 0x502 // Count: 1
|
||||
|
||||
#define GOHT_ROCKS_TRANSFORM_ID_START 0x600U // Count: 0x200
|
||||
#define SPECIAL_EFFECTS_TRANSFORM_ID_START 0x800U
|
||||
|
@ -22,7 +22,7 @@ typedef struct {
|
||||
BiggerGfxPool gBiggerGfxPools[2];
|
||||
|
||||
// @recomp Use the bigger gfx pools and enable RT64 extended GBI mode.
|
||||
void Graph_SetNextGfxPool(GraphicsContext* gfxCtx) {
|
||||
RECOMP_PATCH void Graph_SetNextGfxPool(GraphicsContext* gfxCtx) {
|
||||
GfxPool* pool = &gGfxPools[gfxCtx->gfxPoolIdx % 2];
|
||||
BiggerGfxPool* bigger_pool = &gBiggerGfxPools[gfxCtx->gfxPoolIdx % 2];
|
||||
|
||||
@ -56,9 +56,10 @@ void Graph_SetNextGfxPool(GraphicsContext* gfxCtx) {
|
||||
gSPEndDisplayList(&gGfxMasterDL->disps[4]);
|
||||
gSPBranchList(&gGfxMasterDL->debugDisp[0], bigger_pool->debugBuffer);
|
||||
|
||||
// @recomp Enable RT64 extended GBI mode and set the current framerate
|
||||
// @recomp Enable RT64 extended GBI mode and extended rdram.
|
||||
OPEN_DISPS(gfxCtx);
|
||||
gEXEnable(POLY_OPA_DISP++);
|
||||
gEXSetRDRAMExtended(POLY_OPA_DISP++, 1);
|
||||
CLOSE_DISPS(gfxCtx);
|
||||
}
|
||||
|
||||
@ -85,7 +86,7 @@ extern int extra_vis;
|
||||
* Run the game state logic, then finalize the gfx buffer
|
||||
* and run the graphics task for this frame.
|
||||
*/
|
||||
void Graph_ExecuteAndDraw(GraphicsContext* gfxCtx, GameState* gameState) {
|
||||
RECOMP_PATCH void Graph_ExecuteAndDraw(GraphicsContext* gfxCtx, GameState* gameState) {
|
||||
u32 problem;
|
||||
|
||||
gameState->unk_A3 = 0;
|
||||
@ -238,7 +239,7 @@ void Interface_SetOrthoView(InterfaceContext* interfaceCtx);
|
||||
void Interface_SetVertices(PlayState* play);
|
||||
void Magic_DrawMeter(PlayState* play);
|
||||
|
||||
void Interface_Draw(PlayState* play) {
|
||||
RECOMP_PATCH void Interface_Draw(PlayState* play) {
|
||||
s32 pad;
|
||||
InterfaceContext* interfaceCtx = &play->interfaceCtx;
|
||||
Player* player = GET_PLAYER(play);
|
||||
@ -486,10 +487,11 @@ void Interface_Draw(PlayState* play) {
|
||||
|
||||
Magic_DrawMeter(play);
|
||||
|
||||
// @recomp Draw the D-Pad and its item icons
|
||||
// @recomp Draw the D-Pad and its item icons as well as the autosave icon if the game is unpaused.
|
||||
if (pauseCtx->state != PAUSE_STATE_MAIN) {
|
||||
draw_dpad(play);
|
||||
draw_dpad_icons(play);
|
||||
draw_autosave_icon(play);
|
||||
}
|
||||
|
||||
// @recomp Right align and shift right/down for minimap
|
||||
@ -539,10 +541,10 @@ void Interface_Draw(PlayState* play) {
|
||||
extern s16 sMaskEquipAnimTimer;
|
||||
extern s16 sEquipState;
|
||||
extern s16 sMaskEquipState;
|
||||
s16 equip_timer = *(s16*)KaleidoManager_GetRamAddr(&sEquipAnimTimer);
|
||||
s16 mask_equip_timer = *(s16*)KaleidoManager_GetRamAddr(&sMaskEquipAnimTimer);
|
||||
s16 equip_state = *(s16*)KaleidoManager_GetRamAddr(&sEquipState);
|
||||
s16 mask_equip_state = *(s16*)KaleidoManager_GetRamAddr(&sMaskEquipState);
|
||||
s16 equip_timer = sEquipAnimTimer;
|
||||
s16 mask_equip_timer = sMaskEquipAnimTimer;
|
||||
s16 equip_state = sEquipState;
|
||||
s16 mask_equip_state = sMaskEquipState;
|
||||
|
||||
s16 timer = MIN(equip_timer, mask_equip_timer);
|
||||
s32 max_timer = 10;
|
||||
@ -627,16 +629,9 @@ void Interface_Draw(PlayState* play) {
|
||||
Interface_DrawPerfectLetters(play);
|
||||
}
|
||||
|
||||
// @recomp If carrots are being drawn, use default alignment and shift up
|
||||
if (interfaceCtx->unk_212 == DO_ACTION_FASTER) {
|
||||
gEXSetRectAlign(OVERLAY_DISP++, G_EX_ORIGIN_NONE, G_EX_ORIGIN_NONE, 0, -margin_reduction * 4, 0, -margin_reduction * 4);
|
||||
gEXSetViewportAlign(OVERLAY_DISP++, G_EX_ORIGIN_NONE, 0, -margin_reduction * 4);
|
||||
}
|
||||
// @recomp Otherwise align left and shift up
|
||||
else {
|
||||
gEXSetRectAlign(OVERLAY_DISP++, G_EX_ORIGIN_LEFT, G_EX_ORIGIN_LEFT, 0, -margin_reduction * 4, 0, -margin_reduction * 4);
|
||||
gEXSetViewportAlign(OVERLAY_DISP++, G_EX_ORIGIN_LEFT, 0, -margin_reduction * 4);
|
||||
}
|
||||
// @recomp Align left and shift up for minigame icons (carrot icons use an extended gbi texrect to ignore this state).
|
||||
gEXSetRectAlign(OVERLAY_DISP++, G_EX_ORIGIN_LEFT, G_EX_ORIGIN_LEFT, 0, -margin_reduction * 4, 0, -margin_reduction * 4);
|
||||
gEXSetViewportAlign(OVERLAY_DISP++, G_EX_ORIGIN_LEFT, 0, -margin_reduction * 4);
|
||||
Interface_SetOrthoView(interfaceCtx);
|
||||
|
||||
Interface_DrawMinigameIcons(play);
|
||||
@ -754,6 +749,132 @@ void Interface_Draw(PlayState* play) {
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
extern u64 gCarrotIconTex[];
|
||||
extern u64 gBeaverRingIconTex[];
|
||||
extern u64 gSwordTrainingLogIconTex[];
|
||||
extern u64 gFishermanMinigameTorchIconTex[];
|
||||
extern u64 gArcheryScoreIconTex[];
|
||||
extern u16 sMinigameScoreDigits[];
|
||||
|
||||
// @recomp Patched to draw the carrot icons with an extended gbi texrect so they don't inherit the current origin.
|
||||
RECOMP_PATCH void Interface_DrawMinigameIcons(PlayState* play) {
|
||||
InterfaceContext* interfaceCtx = &play->interfaceCtx;
|
||||
s16 i;
|
||||
s16 numDigitsDrawn;
|
||||
s16 rectX;
|
||||
s16 rectY;
|
||||
s16 width;
|
||||
s16 height;
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
Gfx_SetupDL39_Overlay(play->state.gfxCtx);
|
||||
|
||||
if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) {
|
||||
// Carrots rendering if the action corresponds to riding a horse
|
||||
if (interfaceCtx->unk_212 == DO_ACTION_FASTER) {
|
||||
// Load Carrot Icon
|
||||
gDPLoadTextureBlock(OVERLAY_DISP++, gCarrotIconTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 16, 16, 0,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
|
||||
G_TX_NOLOD, G_TX_NOLOD);
|
||||
|
||||
rectX = 110;
|
||||
rectY = (interfaceCtx->minigameState != MINIGAME_STATE_NONE) ? 200 : 56;
|
||||
|
||||
// Draw 6 carrots
|
||||
for (i = 1; i < 7; i++, rectX += 16) {
|
||||
// Carrot Color (based on availability)
|
||||
if ((interfaceCtx->numHorseBoosts == 0) || (interfaceCtx->numHorseBoosts < i)) {
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 150, 255, interfaceCtx->aAlpha);
|
||||
} else {
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->aAlpha);
|
||||
}
|
||||
|
||||
// @recomp Draw the carrot icons with an extended gbi texrect, using none as the origin to override the current alignment.
|
||||
gEXTextureRectangle(OVERLAY_DISP++, G_EX_ORIGIN_NONE, G_EX_ORIGIN_NONE, rectX << 2, rectY << 2, (rectX + 16) << 2, (rectY + 16) << 2,
|
||||
G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
|
||||
}
|
||||
}
|
||||
|
||||
if (gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) {
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
|
||||
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
|
||||
width = 24;
|
||||
height = 16;
|
||||
rectX = 20;
|
||||
if (gSaveContext.save.saveInfo.playerData.healthCapacity > 0xA0) {
|
||||
rectY = 75; // two rows of hearts
|
||||
} else {
|
||||
rectY = 67; // one row of hearts
|
||||
}
|
||||
|
||||
if (gSaveContext.save.entrance == ENTRANCE(WATERFALL_RAPIDS, 1)) {
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->bAlpha);
|
||||
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 255);
|
||||
gDPLoadTextureBlock(OVERLAY_DISP++, gBeaverRingIconTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 24, 16, 0,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
|
||||
G_TX_NOLOD, G_TX_NOLOD);
|
||||
} else if (play->sceneId == SCENE_DOUJOU) {
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 140, 50, interfaceCtx->bAlpha);
|
||||
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 255);
|
||||
gDPLoadTextureBlock(OVERLAY_DISP++, gSwordTrainingLogIconTex, G_IM_FMT_IA, G_IM_SIZ_8b, 24, 16, 0,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
|
||||
G_TX_NOLOD, G_TX_NOLOD);
|
||||
} else if (play->sceneId == SCENE_30GYOSON) {
|
||||
width = 16;
|
||||
height = 30;
|
||||
rectX = 24;
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 100, 75, interfaceCtx->bAlpha);
|
||||
gDPSetEnvColor(OVERLAY_DISP++, 55, 55, 0, 255);
|
||||
gDPLoadTextureBlock(OVERLAY_DISP++, gFishermanMinigameTorchIconTex, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 30, 0,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
|
||||
G_TX_NOLOD, G_TX_NOLOD);
|
||||
} else {
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->bAlpha);
|
||||
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 255);
|
||||
gDPLoadTextureBlock(OVERLAY_DISP++, gArcheryScoreIconTex, G_IM_FMT_RGBA, G_IM_SIZ_16b, 24, 16, 0,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
|
||||
G_TX_NOLOD, G_TX_NOLOD);
|
||||
}
|
||||
|
||||
gSPTextureRectangle(OVERLAY_DISP++, (rectX << 2), (rectY << 2), ((rectX + width) << 2),
|
||||
((rectY + height) << 2), G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->bAlpha);
|
||||
gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0,
|
||||
0, PRIMITIVE, 0);
|
||||
|
||||
if (play->sceneId == SCENE_30GYOSON) {
|
||||
rectX += 20;
|
||||
if (gSaveContext.save.saveInfo.playerData.healthCapacity > 0xA0) {
|
||||
rectY = 87; // two rows of hearts
|
||||
} else {
|
||||
rectY = 79; // one row of hearts
|
||||
}
|
||||
} else {
|
||||
rectX += 26;
|
||||
}
|
||||
|
||||
for (i = 0, numDigitsDrawn = 0; i < 4; i++) {
|
||||
if ((sMinigameScoreDigits[i] != 0) || (numDigitsDrawn != 0) || (i >= 3)) {
|
||||
OVERLAY_DISP =
|
||||
Gfx_DrawTexRectI8(OVERLAY_DISP, ((u8*)gCounterDigit0Tex + (8 * 16 * sMinigameScoreDigits[i])),
|
||||
8, 0x10, rectX, rectY - 2, 9, 0xFA, 0x370, 0x370);
|
||||
rectX += 9;
|
||||
numDigitsDrawn++;
|
||||
}
|
||||
}
|
||||
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
|
||||
}
|
||||
}
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
|
||||
extern s16 sTextboxWidth;
|
||||
extern s16 sTextboxHeight;
|
||||
extern s16 sTextboxTexWidth;
|
||||
@ -761,7 +882,7 @@ extern s16 sTextboxTexHeight;
|
||||
extern u64 gOcarinaTrebleClefTex[];
|
||||
|
||||
// @recomp Patch textboxes to use ortho tris with a matrix so they can be interpolated.
|
||||
void Message_DrawTextBox(PlayState* play, Gfx** gfxP) {
|
||||
RECOMP_PATCH void Message_DrawTextBox(PlayState* play, Gfx** gfxP) {
|
||||
MessageContext* msgCtx = &play->msgCtx;
|
||||
Gfx* gfx = *gfxP;
|
||||
|
||||
@ -898,7 +1019,7 @@ void View_SetScissor(Gfx** gfx, s32 ulx, s32 uly, s32 lrx, s32 lry);
|
||||
|
||||
// @recomp Patched to not actually letterbox the scissor. The letterbox effect will be achieved by drawing an overlay on top instead, which
|
||||
// will get interpolated unlike a scissor.
|
||||
void View_ApplyLetterbox(View* view) {
|
||||
RECOMP_PATCH void View_ApplyLetterbox(View* view) {
|
||||
s32 letterboxY;
|
||||
s32 letterboxX;
|
||||
s32 pad1;
|
||||
@ -965,7 +1086,7 @@ typedef struct {
|
||||
extern ShrinkWindow* sShrinkWindowPtr;
|
||||
|
||||
// @recomp Replace the rects used to letterbox with ortho tris so they can be interpolated.
|
||||
void ShrinkWindow_Draw(GraphicsContext* gfxCtx) {
|
||||
RECOMP_PATCH void ShrinkWindow_Draw(GraphicsContext* gfxCtx) {
|
||||
Gfx* gfx;
|
||||
s8 letterboxSize = sShrinkWindowPtr->letterboxSize;
|
||||
s8 pillarboxSize = sShrinkWindowPtr->pillarboxSize;
|
||||
@ -1064,3 +1185,37 @@ void ShrinkWindow_Draw(GraphicsContext* gfxCtx) {
|
||||
CLOSE_DISPS(gfxCtx);
|
||||
}
|
||||
}
|
||||
|
||||
extern u64 gSceneTitleCardGradientTex[];
|
||||
|
||||
// @recomp Patch the scene title card (the one with purple background when entering a new scene)
|
||||
// to not glitch out on the right edge, which is hidden by overscan on N64.
|
||||
RECOMP_PATCH void Message_DrawSceneTitleCard(PlayState* play, Gfx** gfxP) {
|
||||
MessageContext* msgCtx = &play->msgCtx;
|
||||
Gfx* gfx;
|
||||
|
||||
gfx = *gfxP;
|
||||
Gfx_SetupDL39_Ptr(&gfx);
|
||||
|
||||
gDPSetCombineLERP(gfx++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE,
|
||||
ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
|
||||
gDPSetTextureFilter(gfx++, G_TF_BILERP);
|
||||
gDPSetAlphaDither(gfx++, G_AD_NOTPATTERN);
|
||||
gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, msgCtx->textboxColorAlphaCurrent);
|
||||
gDPSetEnvColor(gfx++, 140, 40, 160, 255);
|
||||
gDPLoadTextureBlock(gfx++, gSceneTitleCardGradientTex, G_IM_FMT_I, G_IM_SIZ_8b, 64, 1, 0, G_TX_NOMIRROR | G_TX_WRAP,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, 6, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
// @recomp Decrease dsdx from the original 204 to 200 in order to hide the glitching on the right edge.
|
||||
gSPTextureRectangle(gfx++, 0, XREG(77) << 2, 320 << 2, (XREG(77) + XREG(76)) << 2, G_TX_RENDERTILE, 0, 0, 200,
|
||||
1 << 10);
|
||||
gDPPipeSync(gfx++);
|
||||
gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0);
|
||||
gDPSetEnvColor(gfx++, 0, 0, 0, 255);
|
||||
|
||||
if ((msgCtx->currentTextId < 0x1BB2) || (msgCtx->currentTextId >= 0x1BB7)) {
|
||||
msgCtx->unk11FF8 = XREG(75);
|
||||
}
|
||||
msgCtx->unk11FFA = XREG(74);
|
||||
Message_DrawTextNES(play, &gfx, 0);
|
||||
*gfxP = gfx++;
|
||||
}
|
||||
|
@ -54,17 +54,9 @@ extern TexturePtr sMapPageBgTextures[];
|
||||
extern TexturePtr sQuestPageBgTextures[];
|
||||
extern TexturePtr sMaskPageBgTextures[];
|
||||
|
||||
s16 kaleido_s16(s16* addr) {
|
||||
return *(s16*)KaleidoManager_GetRamAddr(addr);
|
||||
}
|
||||
|
||||
f32 kaleido_f32(f32* addr) {
|
||||
return *(f32*)KaleidoManager_GetRamAddr(addr);
|
||||
}
|
||||
|
||||
// @recomp Patched to set pageIndex to a dummy value when KaleidoScope_SetVertices is called to make it
|
||||
// allocate vertices for all pages at all times. This is simpler than patching KaleidoScope_SetVertices directly.
|
||||
void KaleidoScope_Draw(PlayState* play) {
|
||||
RECOMP_PATCH void KaleidoScope_Draw(PlayState* play) {
|
||||
s32 pad;
|
||||
PauseContext* pauseCtx = &play->pauseCtx;
|
||||
InterfaceContext* interfaceCtx = &play->interfaceCtx;
|
||||
@ -145,7 +137,7 @@ void KaleidoScope_Draw(PlayState* play) {
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
void KaleidoScope_DrawCursor(PlayState* play) {
|
||||
RECOMP_PATCH void KaleidoScope_DrawCursor(PlayState* play) {
|
||||
PauseContext* pauseCtx = &play->pauseCtx;
|
||||
s16 i;
|
||||
|
||||
@ -164,9 +156,8 @@ void KaleidoScope_DrawCursor(PlayState* play) {
|
||||
gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
|
||||
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
|
||||
|
||||
// @recomp manual relocations, TODO remove when recompiler can handle this.
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, kaleido_s16(&sCursorPrimR), kaleido_s16(&sCursorPrimG), kaleido_s16(&sCursorPrimB), 255);
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, kaleido_s16(&sCursorEnvR), kaleido_s16(&sCursorEnvG), kaleido_s16(&sCursorEnvB), 255);
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sCursorPrimR, sCursorPrimG, sCursorPrimB, 255);
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, sCursorEnvR, sCursorEnvG, sCursorEnvB, 255);
|
||||
|
||||
Matrix_Translate(pauseCtx->cursorX, pauseCtx->cursorY, -50.0f, MTXMODE_NEW);
|
||||
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
|
||||
@ -181,8 +172,7 @@ void KaleidoScope_DrawCursor(PlayState* play) {
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
Matrix_Push();
|
||||
// @recomp manual relocations, TODO remove when recompiler can handle this.
|
||||
Matrix_Translate(kaleido_f32(&sCursorCirclesX[i]), kaleido_f32(&sCursorCirclesY[i]), -50.0f, MTXMODE_APPLY);
|
||||
Matrix_Translate(sCursorCirclesX[i], sCursorCirclesY[i], -50.0f, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
@ -209,6 +199,13 @@ void KaleidoScope_DrawCursor(PlayState* play) {
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
extern s16 sPauseZRCursorColorTimer; // 8082B9C8 32899 -17976
|
||||
extern s16 sPauseZRCursorColorIndex; // 8082B9CC 32899 -17972
|
||||
extern s16 sPauseZRCursorRed; // 8082DA50 32899 -9648
|
||||
extern s16 sPauseZRCursorGreen; // 8082DA52 32899 -9646
|
||||
extern s16 sPauseZRCursorBlue; // 8082DA54 32899 -9644
|
||||
extern s16 sPauseZRCursorAlpha; // 8082DA56 32899 -9642
|
||||
|
||||
/**
|
||||
* infoPanelVtx
|
||||
*
|
||||
@ -222,17 +219,12 @@ void KaleidoScope_DrawCursor(PlayState* play) {
|
||||
*/
|
||||
|
||||
// @recomp Patched to tag the matrix for interpolating the vertices of the Z button, R button, and name panel.
|
||||
void KaleidoScope_DrawInfoPanel(PlayState* play) {
|
||||
static s16 sPauseZRCursorColorTargets[][4] = {
|
||||
RECOMP_PATCH void KaleidoScope_DrawInfoPanel(PlayState* play) {
|
||||
static const s16 sPauseZRCursorColorTargets[][4] = {
|
||||
{ 180, 210, 255, 220 },
|
||||
{ 100, 100, 150, 220 },
|
||||
};
|
||||
static s16 sPauseZRCursorColorTimer = 20;
|
||||
static s16 sPauseZRCursorColorIndex = 0;
|
||||
static s16 sPauseZRCursorRed;
|
||||
static s16 sPauseZRCursorGreen;
|
||||
static s16 sPauseZRCursorBlue;
|
||||
static s16 sPauseZRCursorAlpha;
|
||||
// @recomp Moved non-const function-local statics to externs so they still get reset on overlay load.
|
||||
PauseContext* pauseCtx = &play->pauseCtx;
|
||||
s16 stepR;
|
||||
s16 stepG;
|
||||
@ -242,11 +234,6 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) {
|
||||
s16 i;
|
||||
s16 j;
|
||||
|
||||
// @recomp Manual relocations, TODO remove when done automatically by the recompiler.
|
||||
s16* sPauseZRCursorColorTimerInits_reloc = KaleidoManager_GetRamAddr(&sPauseZRCursorColorTimerInits);
|
||||
TexturePtr* D_8082B998_reloc = KaleidoManager_GetRamAddr(&D_8082B998);
|
||||
TexturePtr* D_8082B9A8_reloc = KaleidoManager_GetRamAddr(&D_8082B9A8);
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
stepR =
|
||||
@ -288,7 +275,7 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) {
|
||||
sPauseZRCursorGreen = sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][1];
|
||||
sPauseZRCursorBlue = sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][2];
|
||||
sPauseZRCursorAlpha = sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][3];
|
||||
sPauseZRCursorColorTimer = sPauseZRCursorColorTimerInits_reloc[0];
|
||||
sPauseZRCursorColorTimer = sPauseZRCursorColorTimerInits[0];
|
||||
sPauseZRCursorColorIndex ^= 1;
|
||||
}
|
||||
|
||||
@ -331,42 +318,42 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) {
|
||||
pauseCtx->infoPanelVtx[5].v.ob[0] = pauseCtx->infoPanelVtx[7].v.ob[0] = pauseCtx->infoPanelVtx[4].v.ob[0] + 72;
|
||||
|
||||
if ((pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE)) {
|
||||
pauseCtx->infoPanelVtx[8].v.ob[0] = pauseCtx->infoPanelVtx[10].v.ob[0] = kaleido_s16(&sPauseCursorLeftX);
|
||||
pauseCtx->infoPanelVtx[8].v.ob[0] = pauseCtx->infoPanelVtx[10].v.ob[0] = sPauseCursorLeftX;
|
||||
|
||||
pauseCtx->infoPanelVtx[9].v.ob[0] = pauseCtx->infoPanelVtx[11].v.ob[0] = pauseCtx->infoPanelVtx[8].v.ob[0] + 24;
|
||||
|
||||
pauseCtx->infoPanelVtx[8].v.ob[1] = pauseCtx->infoPanelVtx[9].v.ob[1] = kaleido_s16(&D_8082B920);
|
||||
pauseCtx->infoPanelVtx[8].v.ob[1] = pauseCtx->infoPanelVtx[9].v.ob[1] = D_8082B920;
|
||||
|
||||
pauseCtx->infoPanelVtx[10].v.ob[1] = pauseCtx->infoPanelVtx[11].v.ob[1] =
|
||||
pauseCtx->infoPanelVtx[8].v.ob[1] - 32;
|
||||
} else {
|
||||
pauseCtx->infoPanelVtx[8].v.ob[0] = pauseCtx->infoPanelVtx[10].v.ob[0] = kaleido_s16(&sPauseCursorLeftX) + 3;
|
||||
pauseCtx->infoPanelVtx[8].v.ob[0] = pauseCtx->infoPanelVtx[10].v.ob[0] = sPauseCursorLeftX + 3;
|
||||
|
||||
pauseCtx->infoPanelVtx[9].v.ob[0] = pauseCtx->infoPanelVtx[11].v.ob[0] = pauseCtx->infoPanelVtx[8].v.ob[0] + 18;
|
||||
|
||||
pauseCtx->infoPanelVtx[8].v.ob[1] = pauseCtx->infoPanelVtx[9].v.ob[1] = kaleido_s16(&D_8082B920) - 3;
|
||||
pauseCtx->infoPanelVtx[8].v.ob[1] = pauseCtx->infoPanelVtx[9].v.ob[1] = D_8082B920 - 3;
|
||||
|
||||
pauseCtx->infoPanelVtx[10].v.ob[1] = pauseCtx->infoPanelVtx[11].v.ob[1] =
|
||||
pauseCtx->infoPanelVtx[8].v.ob[1] - 26;
|
||||
}
|
||||
|
||||
if ((pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE)) {
|
||||
pauseCtx->infoPanelVtx[12].v.ob[0] = pauseCtx->infoPanelVtx[14].v.ob[0] = kaleido_s16(&sPauseCursorRightX);
|
||||
pauseCtx->infoPanelVtx[12].v.ob[0] = pauseCtx->infoPanelVtx[14].v.ob[0] = sPauseCursorRightX;
|
||||
|
||||
pauseCtx->infoPanelVtx[13].v.ob[0] = pauseCtx->infoPanelVtx[15].v.ob[0] =
|
||||
pauseCtx->infoPanelVtx[12].v.ob[0] + 24;
|
||||
|
||||
pauseCtx->infoPanelVtx[12].v.ob[1] = pauseCtx->infoPanelVtx[13].v.ob[1] = kaleido_s16(&D_8082B920);
|
||||
pauseCtx->infoPanelVtx[12].v.ob[1] = pauseCtx->infoPanelVtx[13].v.ob[1] = D_8082B920;
|
||||
|
||||
pauseCtx->infoPanelVtx[14].v.ob[1] = pauseCtx->infoPanelVtx[15].v.ob[1] =
|
||||
pauseCtx->infoPanelVtx[12].v.ob[1] - 32;
|
||||
} else {
|
||||
pauseCtx->infoPanelVtx[12].v.ob[0] = pauseCtx->infoPanelVtx[14].v.ob[0] = kaleido_s16(&sPauseCursorRightX) + 3;
|
||||
pauseCtx->infoPanelVtx[12].v.ob[0] = pauseCtx->infoPanelVtx[14].v.ob[0] = sPauseCursorRightX + 3;
|
||||
|
||||
pauseCtx->infoPanelVtx[13].v.ob[0] = pauseCtx->infoPanelVtx[15].v.ob[0] =
|
||||
pauseCtx->infoPanelVtx[12].v.ob[0] + 18;
|
||||
|
||||
pauseCtx->infoPanelVtx[12].v.ob[1] = pauseCtx->infoPanelVtx[13].v.ob[1] = kaleido_s16(&D_8082B920) - 3;
|
||||
pauseCtx->infoPanelVtx[12].v.ob[1] = pauseCtx->infoPanelVtx[13].v.ob[1] = D_8082B920 - 3;
|
||||
|
||||
pauseCtx->infoPanelVtx[14].v.ob[1] = pauseCtx->infoPanelVtx[15].v.ob[1] =
|
||||
pauseCtx->infoPanelVtx[12].v.ob[1] - 26;
|
||||
@ -512,10 +499,10 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) {
|
||||
|
||||
if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) {
|
||||
POLY_OPA_DISP =
|
||||
Gfx_DrawTexQuad4b(POLY_OPA_DISP, D_8082B998_reloc[pauseCtx->pageIndex], G_IM_FMT_IA, 128, 16, 0);
|
||||
Gfx_DrawTexQuad4b(POLY_OPA_DISP, D_8082B998[pauseCtx->pageIndex], G_IM_FMT_IA, 128, 16, 0);
|
||||
} else {
|
||||
POLY_OPA_DISP =
|
||||
Gfx_DrawTexQuad4b(POLY_OPA_DISP, D_8082B9A8_reloc[pauseCtx->pageIndex], G_IM_FMT_IA, 128, 16, 0);
|
||||
Gfx_DrawTexQuad4b(POLY_OPA_DISP, D_8082B9A8[pauseCtx->pageIndex], G_IM_FMT_IA, 128, 16, 0);
|
||||
}
|
||||
}
|
||||
} else if ((!pauseCtx->pageIndex || (pauseCtx->pageIndex == PAUSE_MASK)) &&
|
||||
@ -541,7 +528,7 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255);
|
||||
|
||||
POLY_OPA_DISP = Gfx_DrawTexQuad4b(POLY_OPA_DISP, gPauseToEquipENGTex, G_IM_FMT_IA, 64, 16, 4);
|
||||
} else if ((pauseCtx->pageIndex == PAUSE_MAP) && kaleido_s16(&sInDungeonScene)) {
|
||||
} else if ((pauseCtx->pageIndex == PAUSE_MAP) && sInDungeonScene) {
|
||||
// No code in this case
|
||||
} else if ((pauseCtx->pageIndex == PAUSE_QUEST) &&
|
||||
(pauseCtx->cursorSlot[PAUSE_QUEST] == QUEST_BOMBERS_NOTEBOOK)) {
|
||||
@ -600,7 +587,7 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) {
|
||||
}
|
||||
|
||||
// @recomp Patched to draw always all 4 pages and tag their matrices.
|
||||
void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {
|
||||
RECOMP_PATCH void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {
|
||||
static s16 sCursorColorTimer = 10;
|
||||
static s16 sCursorColorTargetIndex = 0;
|
||||
PauseContext* pauseCtx = &play->pauseCtx;
|
||||
@ -608,87 +595,75 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {
|
||||
s16 stepG;
|
||||
s16 stepB;
|
||||
|
||||
// @recomp Manual relocation, TODO remove when recompiler handles it automatically.
|
||||
TexturePtr* sItemPageBgTextures_reloc = KaleidoManager_GetRamAddr(&sItemPageBgTextures);
|
||||
TexturePtr* sMapPageBgTextures_reloc = KaleidoManager_GetRamAddr(&sMapPageBgTextures);
|
||||
TexturePtr* sQuestPageBgTextures_reloc = KaleidoManager_GetRamAddr(&sQuestPageBgTextures);
|
||||
TexturePtr* sMaskPageBgTextures_reloc = KaleidoManager_GetRamAddr(&sMaskPageBgTextures);
|
||||
s16* sCursorPrimR_reloc = KaleidoManager_GetRamAddr(&sCursorPrimR);
|
||||
s16* sCursorPrimG_reloc = KaleidoManager_GetRamAddr(&sCursorPrimG);
|
||||
s16* sCursorPrimB_reloc = KaleidoManager_GetRamAddr(&sCursorPrimB);
|
||||
s16* sCursorEnvR_reloc = KaleidoManager_GetRamAddr(&sCursorEnvR);
|
||||
s16* sCursorEnvG_reloc = KaleidoManager_GetRamAddr(&sCursorEnvG);
|
||||
s16* sCursorEnvB_reloc = KaleidoManager_GetRamAddr(&sCursorEnvB);
|
||||
|
||||
OPEN_DISPS(gfxCtx);
|
||||
|
||||
if (!IS_PAUSE_STATE_GAMEOVER) {
|
||||
if (pauseCtx->state != PAUSE_STATE_SAVEPROMPT) {
|
||||
|
||||
stepR =
|
||||
ABS_ALT(*sCursorPrimR_reloc - sCursorPrimColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][0]) /
|
||||
ABS_ALT(sCursorPrimR - sCursorPrimColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][0]) /
|
||||
sCursorColorTimer;
|
||||
stepG =
|
||||
ABS_ALT(*sCursorPrimG_reloc - sCursorPrimColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][1]) /
|
||||
ABS_ALT(sCursorPrimG - sCursorPrimColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][1]) /
|
||||
sCursorColorTimer;
|
||||
stepB =
|
||||
ABS_ALT(*sCursorPrimB_reloc - sCursorPrimColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][2]) /
|
||||
ABS_ALT(sCursorPrimB - sCursorPrimColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][2]) /
|
||||
sCursorColorTimer;
|
||||
|
||||
if (*sCursorPrimR_reloc >= sCursorPrimColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][0]) {
|
||||
*sCursorPrimR_reloc -= stepR;
|
||||
if (sCursorPrimR >= sCursorPrimColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][0]) {
|
||||
sCursorPrimR -= stepR;
|
||||
} else {
|
||||
*sCursorPrimR_reloc += stepR;
|
||||
sCursorPrimR += stepR;
|
||||
}
|
||||
|
||||
if (*sCursorPrimG_reloc >= sCursorPrimColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][1]) {
|
||||
*sCursorPrimG_reloc -= stepG;
|
||||
if (sCursorPrimG >= sCursorPrimColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][1]) {
|
||||
sCursorPrimG -= stepG;
|
||||
} else {
|
||||
*sCursorPrimG_reloc += stepG;
|
||||
sCursorPrimG += stepG;
|
||||
}
|
||||
|
||||
if (*sCursorPrimB_reloc >= sCursorPrimColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][2]) {
|
||||
*sCursorPrimB_reloc -= stepB;
|
||||
if (sCursorPrimB >= sCursorPrimColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][2]) {
|
||||
sCursorPrimB -= stepB;
|
||||
} else {
|
||||
*sCursorPrimB_reloc += stepB;
|
||||
sCursorPrimB += stepB;
|
||||
}
|
||||
|
||||
stepR =
|
||||
ABS_ALT(*sCursorEnvR_reloc - sCursorEnvColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][0]) /
|
||||
ABS_ALT(sCursorEnvR - sCursorEnvColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][0]) /
|
||||
sCursorColorTimer;
|
||||
stepG =
|
||||
ABS_ALT(*sCursorEnvG_reloc - sCursorEnvColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][1]) /
|
||||
ABS_ALT(sCursorEnvG - sCursorEnvColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][1]) /
|
||||
sCursorColorTimer;
|
||||
stepB =
|
||||
ABS_ALT(*sCursorEnvB_reloc - sCursorEnvColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][2]) /
|
||||
ABS_ALT(sCursorEnvB - sCursorEnvColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][2]) /
|
||||
sCursorColorTimer;
|
||||
|
||||
if (*sCursorEnvR_reloc >= sCursorEnvColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][0]) {
|
||||
*sCursorEnvR_reloc -= stepR;
|
||||
if (sCursorEnvR >= sCursorEnvColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][0]) {
|
||||
sCursorEnvR -= stepR;
|
||||
} else {
|
||||
*sCursorEnvR_reloc += stepR;
|
||||
sCursorEnvR += stepR;
|
||||
}
|
||||
|
||||
if (*sCursorEnvG_reloc >= sCursorEnvColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][1]) {
|
||||
*sCursorEnvG_reloc -= stepG;
|
||||
if (sCursorEnvG >= sCursorEnvColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][1]) {
|
||||
sCursorEnvG -= stepG;
|
||||
} else {
|
||||
*sCursorEnvG_reloc += stepG;
|
||||
sCursorEnvG += stepG;
|
||||
}
|
||||
|
||||
if (*sCursorEnvB_reloc >= sCursorEnvColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][2]) {
|
||||
*sCursorEnvB_reloc -= stepB;
|
||||
if (sCursorEnvB >= sCursorEnvColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][2]) {
|
||||
sCursorEnvB -= stepB;
|
||||
} else {
|
||||
*sCursorEnvB_reloc += stepB;
|
||||
sCursorEnvB += stepB;
|
||||
}
|
||||
|
||||
sCursorColorTimer--;
|
||||
if (sCursorColorTimer == 0) {
|
||||
*sCursorPrimR_reloc = sCursorPrimColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][0];
|
||||
*sCursorPrimG_reloc = sCursorPrimColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][1];
|
||||
*sCursorPrimB_reloc = sCursorPrimColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][2];
|
||||
*sCursorEnvR_reloc = sCursorEnvColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][0];
|
||||
*sCursorEnvG_reloc = sCursorEnvColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][1];
|
||||
*sCursorEnvB_reloc = sCursorEnvColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][2];
|
||||
sCursorPrimR = sCursorPrimColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][0];
|
||||
sCursorPrimG = sCursorPrimColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][1];
|
||||
sCursorPrimB = sCursorPrimColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][2];
|
||||
sCursorEnvR = sCursorEnvColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][0];
|
||||
sCursorEnvG = sCursorEnvColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][1];
|
||||
sCursorEnvB = sCursorEnvColorTarget[pauseCtx->cursorColorSet + sCursorColorTargetIndex][2];
|
||||
sCursorColorTargetIndex ^= 1;
|
||||
sCursorColorTimer = 10;
|
||||
}
|
||||
@ -704,14 +679,13 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 180, 180, 120, 255);
|
||||
|
||||
Matrix_RotateYF(0.0f, MTXMODE_NEW);
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
Matrix_Translate(0.0f, kaleido_f32(&sPauseMenuVerticalOffset) / 100.0f, -93.0f, MTXMODE_APPLY);
|
||||
Matrix_Translate(0.0f, sPauseMenuVerticalOffset / 100.0f, -93.0f, MTXMODE_APPLY);
|
||||
Matrix_Scale(0.78f, 0.78f, 0.78f, MTXMODE_APPLY);
|
||||
Matrix_RotateXFApply(-pauseCtx->itemPageRoll / 100.0f);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->itemPageVtx, sItemPageBgTextures_reloc);
|
||||
POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->itemPageVtx, sItemPageBgTextures);
|
||||
|
||||
KaleidoScope_DrawItemSelect(play);
|
||||
}
|
||||
@ -726,16 +700,15 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 180, 180, 120, 255);
|
||||
|
||||
Matrix_RotateYF(-1.57f, MTXMODE_NEW);
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
Matrix_Translate(0.0f, kaleido_f32(&sPauseMenuVerticalOffset) / 100.0f, -93.0f, MTXMODE_APPLY);
|
||||
Matrix_Translate(0.0f, sPauseMenuVerticalOffset / 100.0f, -93.0f, MTXMODE_APPLY);
|
||||
Matrix_Scale(0.78f, 0.78f, 0.78f, MTXMODE_APPLY);
|
||||
Matrix_RotateXFApply(-pauseCtx->mapPageRoll / 100.0f);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->mapPageVtx, sMapPageBgTextures_reloc);
|
||||
POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->mapPageVtx, sMapPageBgTextures);
|
||||
|
||||
if (kaleido_s16(&sInDungeonScene)) {
|
||||
if (sInDungeonScene) {
|
||||
KaleidoScope_DrawDungeonMap(play);
|
||||
Gfx_SetupDL42_Opa(gfxCtx);
|
||||
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
|
||||
@ -757,14 +730,13 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 180, 180, 120, 255);
|
||||
|
||||
Matrix_RotateYF(-3.14f, MTXMODE_NEW);
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
Matrix_Translate(0.0f, kaleido_f32(&sPauseMenuVerticalOffset) / 100.0f, -93.0f, MTXMODE_APPLY);
|
||||
Matrix_Translate(0.0f, sPauseMenuVerticalOffset / 100.0f, -93.0f, MTXMODE_APPLY);
|
||||
Matrix_Scale(0.78f, 0.78f, 0.78f, MTXMODE_APPLY);
|
||||
Matrix_RotateXFApply(-pauseCtx->questPageRoll / 100.0f);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->questPageVtx, sQuestPageBgTextures_reloc);
|
||||
POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->questPageVtx, sQuestPageBgTextures);
|
||||
|
||||
KaleidoScope_DrawQuestStatus(play);
|
||||
}
|
||||
@ -781,14 +753,13 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 180, 180, 120, 255);
|
||||
|
||||
Matrix_RotateYF(1.57f, MTXMODE_NEW);
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
Matrix_Translate(0.0f, kaleido_f32(&sPauseMenuVerticalOffset) / 100.0f, -93.0f, MTXMODE_APPLY);
|
||||
Matrix_Translate(0.0f, sPauseMenuVerticalOffset / 100.0f, -93.0f, MTXMODE_APPLY);
|
||||
Matrix_Scale(0.78f, 0.78f, 0.78f, MTXMODE_APPLY);
|
||||
Matrix_RotateXFApply(-pauseCtx->maskPageRoll / 100.0f);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->maskPageVtx, sMaskPageBgTextures_reloc);
|
||||
POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->maskPageVtx, sMaskPageBgTextures);
|
||||
|
||||
KaleidoScope_DrawMaskSelect(play);
|
||||
}
|
||||
@ -804,15 +775,14 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 180, 180, 120, 255);
|
||||
|
||||
Matrix_RotateYF(0.0f, MTXMODE_NEW);
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
Matrix_Translate(0.0f, kaleido_f32(&sPauseMenuVerticalOffset) / 100.0f, -93.0f, MTXMODE_APPLY);
|
||||
Matrix_Translate(0.0f, sPauseMenuVerticalOffset / 100.0f, -93.0f, MTXMODE_APPLY);
|
||||
Matrix_Scale(0.78f, 0.78f, 0.78f, MTXMODE_APPLY);
|
||||
Matrix_RotateXFApply(-pauseCtx->itemPageRoll / 100.0f);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
POLY_OPA_DISP =
|
||||
KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->itemPageVtx, sItemPageBgTextures_reloc);
|
||||
KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->itemPageVtx, sItemPageBgTextures);
|
||||
|
||||
KaleidoScope_DrawItemSelect(play);
|
||||
}
|
||||
@ -827,16 +797,15 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 180, 180, 120, 255);
|
||||
|
||||
Matrix_RotateYF(-1.57f, MTXMODE_NEW);
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
Matrix_Translate(0.0f, kaleido_f32(&sPauseMenuVerticalOffset) / 100.0f, -93.0f, MTXMODE_APPLY);
|
||||
Matrix_Translate(0.0f, sPauseMenuVerticalOffset / 100.0f, -93.0f, MTXMODE_APPLY);
|
||||
Matrix_Scale(0.78f, 0.78f, 0.78f, MTXMODE_APPLY);
|
||||
Matrix_RotateXFApply(-pauseCtx->mapPageRoll / 100.0f);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->mapPageVtx, sMapPageBgTextures_reloc);
|
||||
POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->mapPageVtx, sMapPageBgTextures);
|
||||
|
||||
if (kaleido_s16(&sInDungeonScene)) {
|
||||
if (sInDungeonScene) {
|
||||
KaleidoScope_DrawDungeonMap(play);
|
||||
Gfx_SetupDL42_Opa(gfxCtx);
|
||||
|
||||
@ -878,15 +847,14 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {
|
||||
gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_BILERP);
|
||||
|
||||
Matrix_RotateYF(-3.14f, MTXMODE_NEW);
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
Matrix_Translate(0.0f, kaleido_f32(&sPauseMenuVerticalOffset) / 100.0f, -93.0f, MTXMODE_APPLY);
|
||||
Matrix_Translate(0.0f, sPauseMenuVerticalOffset / 100.0f, -93.0f, MTXMODE_APPLY);
|
||||
Matrix_Scale(0.78f, 0.78f, 0.78f, MTXMODE_APPLY);
|
||||
Matrix_RotateXFApply(-pauseCtx->questPageRoll / 100.0f);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
POLY_OPA_DISP =
|
||||
KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->questPageVtx, sQuestPageBgTextures_reloc);
|
||||
KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->questPageVtx, sQuestPageBgTextures);
|
||||
|
||||
KaleidoScope_DrawQuestStatus(play);
|
||||
break;
|
||||
@ -900,15 +868,14 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 180, 180, 120, 255);
|
||||
|
||||
Matrix_RotateYF(1.57f, MTXMODE_NEW);
|
||||
// @recomp Manual relocation, TODO remove when automated.
|
||||
Matrix_Translate(0.0f, kaleido_f32(&sPauseMenuVerticalOffset) / 100.0f, -93.0f, MTXMODE_APPLY);
|
||||
Matrix_Translate(0.0f, sPauseMenuVerticalOffset / 100.0f, -93.0f, MTXMODE_APPLY);
|
||||
Matrix_Scale(0.78f, 0.78f, 0.78f, MTXMODE_APPLY);
|
||||
Matrix_RotateXFApply(-pauseCtx->maskPageRoll / 100.0f);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
POLY_OPA_DISP =
|
||||
KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->maskPageVtx, sMaskPageBgTextures_reloc);
|
||||
KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->maskPageVtx, sMaskPageBgTextures);
|
||||
|
||||
KaleidoScope_DrawMaskSelect(play);
|
||||
break;
|
||||
|
0
shadercache/.gitkeep
Normal file
0
shadercache/.gitkeep
Normal file
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user