mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-16 15:20:11 -05:00
Merge branch 'develop' into zelda64
This commit is contained in:
commit
1435b5d314
221
Jenkinsfile
vendored
221
Jenkinsfile
vendored
@ -7,117 +7,120 @@ pipeline {
|
||||
}
|
||||
|
||||
stages {
|
||||
stage ('Build Windows') {
|
||||
options {
|
||||
timeout(time: 20)
|
||||
}
|
||||
environment {
|
||||
MSBUILD='C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Msbuild\\Current\\Bin\\msbuild.exe'
|
||||
CONFIG='Release'
|
||||
OTRPLATFORM='x64'
|
||||
PLATFORM='x64'
|
||||
ZIP='C:\\Program Files\\7-Zip\\7z.exe'
|
||||
PYTHON='C:\\Users\\jenkins\\AppData\\Local\\Programs\\Python\\Python310\\python.exe'
|
||||
CMAKE='C:\\Program Files\\CMake\\bin\\cmake.exe'
|
||||
TOOLSET='v142'
|
||||
}
|
||||
agent {
|
||||
label "SoH-Builders"
|
||||
}
|
||||
steps {
|
||||
checkout([
|
||||
$class: 'GitSCM',
|
||||
branches: scm.branches,
|
||||
doGenerateSubmoduleConfigurations: scm.doGenerateSubmoduleConfigurations,
|
||||
extensions: scm.extensions,
|
||||
userRemoteConfigs: scm.userRemoteConfigs
|
||||
])
|
||||
|
||||
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
||||
bat """
|
||||
|
||||
"${env.MSBUILD}" ".\\OTRExporter\\OTRExporter.sln" -t:build -p:Configuration=${env.CONFIG};Platform=${env.OTRPLATFORM};PlatformToolset=${env.TOOLSET};RestorePackagesConfig=true /restore /nodeReuse:false /m
|
||||
|
||||
xcopy "..\\..\\ZELOOTD.z64" "OTRExporter\\"
|
||||
|
||||
cd "OTRExporter"
|
||||
"${env.PYTHON}" ".\\extract_assets.py"
|
||||
cd "..\\"
|
||||
|
||||
"${env.MSBUILD}" ".\\soh\\soh.sln" -t:build -p:Configuration=${env.CONFIG};Platform=${env.PLATFORM};PlatformToolset=${env.TOOLSET} /nodeReuse:false /m
|
||||
|
||||
cd OTRGui
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
"${env.CMAKE}" ..
|
||||
"${env.CMAKE}" --build . --config Release
|
||||
|
||||
cd "..\\..\\"
|
||||
|
||||
move "soh\\x64\\Release\\soh.exe" ".\\"
|
||||
move "OTRGui\\build\\assets" ".\\"
|
||||
move ".\\OTRExporter\\x64\\Release\\ZAPD.exe" ".\\assets\\extractor\\"
|
||||
move ".\\OTRGui\\build\\Release\\OTRGui.exe" ".\\"
|
||||
rename README.md readme.txt
|
||||
|
||||
"${env.ZIP}" a soh.7z soh.exe OTRGui.exe assets readme.txt
|
||||
|
||||
"""
|
||||
archiveArtifacts artifacts: 'soh.7z', followSymlinks: false, onlyIfSuccessful: true
|
||||
stage('Build SoH') {
|
||||
parallel {
|
||||
stage ('Build Windows') {
|
||||
options {
|
||||
timeout(time: 20)
|
||||
}
|
||||
environment {
|
||||
MSBUILD='C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Msbuild\\Current\\Bin\\msbuild.exe'
|
||||
CONFIG='Release'
|
||||
OTRPLATFORM='x64'
|
||||
PLATFORM='x64'
|
||||
ZIP='C:\\Program Files\\7-Zip\\7z.exe'
|
||||
PYTHON='C:\\Users\\jenkins\\AppData\\Local\\Programs\\Python\\Python310\\python.exe'
|
||||
CMAKE='C:\\Program Files\\CMake\\bin\\cmake.exe'
|
||||
TOOLSET='v142'
|
||||
}
|
||||
agent {
|
||||
label "SoH-Builders"
|
||||
}
|
||||
steps {
|
||||
checkout([
|
||||
$class: 'GitSCM',
|
||||
branches: scm.branches,
|
||||
doGenerateSubmoduleConfigurations: scm.doGenerateSubmoduleConfigurations,
|
||||
extensions: scm.extensions,
|
||||
userRemoteConfigs: scm.userRemoteConfigs
|
||||
])
|
||||
|
||||
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
||||
bat """
|
||||
|
||||
"${env.MSBUILD}" ".\\OTRExporter\\OTRExporter.sln" -t:build -p:Configuration=${env.CONFIG};Platform=${env.OTRPLATFORM};PlatformToolset=${env.TOOLSET};RestorePackagesConfig=true /restore /nodeReuse:false /m
|
||||
|
||||
xcopy "..\\..\\ZELOOTD.z64" "OTRExporter\\"
|
||||
|
||||
cd "OTRExporter"
|
||||
"${env.PYTHON}" ".\\extract_assets.py"
|
||||
cd "..\\"
|
||||
|
||||
"${env.MSBUILD}" ".\\soh\\soh.sln" -t:build -p:Configuration=${env.CONFIG};Platform=${env.PLATFORM};PlatformToolset=${env.TOOLSET} /nodeReuse:false /m
|
||||
|
||||
cd OTRGui
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
"${env.CMAKE}" ..
|
||||
"${env.CMAKE}" --build . --config Release
|
||||
|
||||
cd "..\\..\\"
|
||||
|
||||
move "soh\\Release\\soh.exe" ".\\"
|
||||
move "OTRGui\\build\\assets" ".\\"
|
||||
move ".\\OTRExporter\\x64\\Release\\ZAPD.exe" ".\\assets\\extractor\\"
|
||||
move ".\\OTRGui\\build\\Release\\OTRGui.exe" ".\\"
|
||||
rename README.md readme.txt
|
||||
|
||||
"${env.ZIP}" a soh.7z soh.exe OTRGui.exe assets readme.txt
|
||||
|
||||
"""
|
||||
archiveArtifacts artifacts: 'soh.7z', followSymlinks: false, onlyIfSuccessful: true
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
step([$class: 'WsCleanup']) // Clean workspace
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
step([$class: 'WsCleanup']) // Clean workspace
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ('Build Linux') {
|
||||
options {
|
||||
timeout(time: 20)
|
||||
}
|
||||
agent {
|
||||
label "SoH-Linux-Builders"
|
||||
}
|
||||
steps {
|
||||
checkout([
|
||||
$class: 'GitSCM',
|
||||
branches: scm.branches,
|
||||
doGenerateSubmoduleConfigurations: scm.doGenerateSubmoduleConfigurations,
|
||||
extensions: scm.extensions,
|
||||
userRemoteConfigs: scm.userRemoteConfigs
|
||||
])
|
||||
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
||||
sh '''
|
||||
|
||||
cp ../../ZELOOTD.z64 OTRExporter/baserom_non_mq.z64
|
||||
docker build . -t soh
|
||||
docker run --name sohcont -dit --rm -v $(pwd):/soh soh /bin/bash
|
||||
cp ../../buildsoh.bash soh
|
||||
docker exec sohcont soh/buildsoh.bash
|
||||
|
||||
mkdir build
|
||||
mv soh/soh.elf build/
|
||||
mv OTRGui/build/OTRGui build/
|
||||
mv OTRGui/build/assets build/
|
||||
mv ZAPDTR/ZAPD.out build/assets/extractor/
|
||||
mv README.md build/readme.txt
|
||||
cd build
|
||||
|
||||
7z a soh-linux.7z soh.elf OTRGui assets readme.txt
|
||||
mv soh-linux.7z ../
|
||||
|
||||
'''
|
||||
}
|
||||
sh 'sudo docker container stop sohcont'
|
||||
archiveArtifacts artifacts: 'soh-linux.7z', followSymlinks: false, onlyIfSuccessful: true
|
||||
}
|
||||
post {
|
||||
always {
|
||||
step([$class: 'WsCleanup']) // Clean workspace
|
||||
stage ('Build Linux') {
|
||||
options {
|
||||
timeout(time: 20)
|
||||
}
|
||||
agent {
|
||||
label "SoH-Linux-Builders"
|
||||
}
|
||||
steps {
|
||||
checkout([
|
||||
$class: 'GitSCM',
|
||||
branches: scm.branches,
|
||||
doGenerateSubmoduleConfigurations: scm.doGenerateSubmoduleConfigurations,
|
||||
extensions: scm.extensions,
|
||||
userRemoteConfigs: scm.userRemoteConfigs
|
||||
])
|
||||
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
||||
sh '''
|
||||
|
||||
cp ../../ZELOOTD.z64 OTRExporter/baserom_non_mq.z64
|
||||
docker build . -t soh
|
||||
docker run --name sohcont -dit --rm -v $(pwd):/soh soh /bin/bash
|
||||
cp ../../buildsoh.bash soh
|
||||
docker exec sohcont soh/buildsoh.bash
|
||||
|
||||
mkdir build
|
||||
mv soh/soh.elf build/
|
||||
mv OTRGui/build/OTRGui build/
|
||||
mv OTRGui/build/assets build/
|
||||
mv ZAPDTR/ZAPD.out build/assets/extractor/
|
||||
mv README.md build/readme.txt
|
||||
cd build
|
||||
7z a soh-linux.7z soh.elf OTRGui assets readme.txt
|
||||
mv soh-linux.7z ../
|
||||
|
||||
'''
|
||||
}
|
||||
sh 'sudo docker container stop sohcont'
|
||||
archiveArtifacts artifacts: 'soh-linux.7z', followSymlinks: false, onlyIfSuccessful: true
|
||||
}
|
||||
post {
|
||||
always {
|
||||
step([$class: 'WsCleanup']) // Clean workspace
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -59,6 +59,8 @@ namespace Ship {
|
||||
(*this)["ARCHIVE"]["Main Archive"] = "oot.otr";
|
||||
(*this)["ARCHIVE"]["Patches Directory"] = "";
|
||||
|
||||
(*this)["SAVE"]["Save Filename"] = "oot_save.sav";
|
||||
|
||||
(*this)["CONTROLLERS"]["CONTROLLER 1"] = "Auto";
|
||||
(*this)["CONTROLLERS"]["CONTROLLER 2"] = "Unplugged";
|
||||
(*this)["CONTROLLERS"]["CONTROLLER 3"] = "Unplugged";
|
||||
|
@ -86,4 +86,25 @@ namespace Ship {
|
||||
std::cout << "Log initialization failed: " << ex.what() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void GlobalCtx2::WriteSaveFile(std::filesystem::path savePath, uintptr_t addr, void* dramAddr, size_t size) {
|
||||
std::ofstream saveFile = std::ofstream(savePath, std::fstream::in | std::fstream::out | std::fstream::binary);
|
||||
saveFile.seekp(addr);
|
||||
saveFile.write((char*)dramAddr, size);
|
||||
saveFile.close();
|
||||
}
|
||||
|
||||
void GlobalCtx2::ReadSaveFile(std::filesystem::path savePath, uintptr_t addr, void* dramAddr, size_t size) {
|
||||
std::ifstream saveFile = std::ifstream(savePath, std::fstream::in | std::fstream::out | std::fstream::binary);
|
||||
|
||||
// If the file doesn't exist, initialize DRAM
|
||||
if (saveFile.good()) {
|
||||
saveFile.seekg(addr);
|
||||
saveFile.read((char*)dramAddr, size);
|
||||
} else {
|
||||
memset(dramAddr, 0, size);
|
||||
}
|
||||
|
||||
saveFile.close();
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <filesystem>
|
||||
#include <memory>
|
||||
#include "spdlog/spdlog.h"
|
||||
#include "ConfigFile.h"
|
||||
@ -23,6 +24,9 @@ namespace Ship {
|
||||
std::shared_ptr<spdlog::logger> GetLogger() { return Logger; }
|
||||
std::shared_ptr<ConfigFile> GetConfig() { return Config; }
|
||||
|
||||
void WriteSaveFile(std::filesystem::path savePath, uintptr_t addr, void* dramAddr, size_t size);
|
||||
void ReadSaveFile(std::filesystem::path savePath, uintptr_t addr, void* dramAddr, size_t size);
|
||||
|
||||
GlobalCtx2(const std::string& Name);
|
||||
~GlobalCtx2();
|
||||
|
||||
|
@ -76,6 +76,8 @@ namespace SohImGui {
|
||||
ImVec4 minimap_colors;
|
||||
ImVec4 rupee_colors;
|
||||
ImVec4 smolekey_colors;
|
||||
ImVec4 fileselect_colors;
|
||||
ImVec4 fileselect_text_colors;
|
||||
ImVec4 kokiri_col;
|
||||
ImVec4 goron_col;
|
||||
ImVec4 zora_col;
|
||||
@ -89,12 +91,13 @@ namespace SohImGui {
|
||||
ImVec4 navi_prop_o_col;
|
||||
|
||||
const char* RainbowColorCvarList[] = {
|
||||
//This is the list of possible CVars that has rainbow effect.
|
||||
"gTunic_Kokiri_","gTunic_Goron_","gTunic_Zora_",
|
||||
"gCCHeartsPrim","gDDCCHeartsPrim",
|
||||
"gCCABtnPrim","gCCBBtnPrim","gCCCBtnPrim","gCCStartBtnPrim",
|
||||
"gCCMagicBorderPrim","gCCMagicPrim","gCCMagicUsePrim",
|
||||
"gCCMinimapPrim","gCCRupeePrim","gCCKeysPrim"
|
||||
//This is the list of possible CVars that has rainbow effect.
|
||||
"gTunic_Kokiri_","gTunic_Goron_","gTunic_Zora_",
|
||||
"gCCHeartsPrim","gDDCCHeartsPrim",
|
||||
"gCCABtnPrim","gCCBBtnPrim","gCCCBtnPrim","gCCStartBtnPrim",
|
||||
"gCCMagicBorderPrim","gCCMagicPrim","gCCMagicUsePrim",
|
||||
"gCCMinimapPrim","gCCRupeePrim","gCCKeysPrim",
|
||||
"gCCFileChoosePrim", "gCCFileChooseTextPrim"
|
||||
};
|
||||
|
||||
const char* filters[3] = {
|
||||
@ -106,8 +109,8 @@ namespace SohImGui {
|
||||
std::map<std::string, std::vector<std::string>> windowCategories;
|
||||
std::map<std::string, CustomWindow> customWindows;
|
||||
|
||||
int ClampFloatToInt(float value, int min, int max){
|
||||
return fmin(fmax(value,min),max);
|
||||
int ClampFloatToInt(float value, int min, int max) {
|
||||
return fmin(fmax(value, min), max);
|
||||
}
|
||||
|
||||
void Tooltip(const char* text) {
|
||||
@ -269,8 +272,8 @@ namespace SohImGui {
|
||||
std::string Cvar_RBM = cvarName;
|
||||
Cvar_RBM += "RBM";
|
||||
std::string RBM_HUE = cvarName;
|
||||
RBM_HUE+="Hue";
|
||||
f32 Canon = 10.f*s;
|
||||
RBM_HUE += "Hue";
|
||||
f32 Canon = 10.f * s;
|
||||
ImVec4 NewColor;
|
||||
const f32 deltaTime = 1.0f / ImGui::GetIO().Framerate;
|
||||
f32 hue = CVar_GetFloat(RBM_HUE.c_str(), 0.0f);
|
||||
@ -284,18 +287,18 @@ namespace SohImGui {
|
||||
u8 b = (current_hue / 60.0f + (1 - i)) * 255;
|
||||
|
||||
switch (i) {
|
||||
case 1: NewColor.x = 255; NewColor.y = b; NewColor.z = 0; break;
|
||||
case 2: NewColor.x = a; NewColor.y = 255; NewColor.z = 0; break;
|
||||
case 3: NewColor.x = 0; NewColor.y = 255; NewColor.z = b; break;
|
||||
case 4: NewColor.x = 0; NewColor.y = a; NewColor.z = 255; break;
|
||||
case 5: NewColor.x = b; NewColor.y = 0; NewColor.z = 255; break;
|
||||
case 6: NewColor.x = 255; NewColor.y = 0; NewColor.z = a; break;
|
||||
case 1: NewColor.x = 255; NewColor.y = b; NewColor.z = 0; break;
|
||||
case 2: NewColor.x = a; NewColor.y = 255; NewColor.z = 0; break;
|
||||
case 3: NewColor.x = 0; NewColor.y = 255; NewColor.z = b; break;
|
||||
case 4: NewColor.x = 0; NewColor.y = a; NewColor.z = 255; break;
|
||||
case 5: NewColor.x = b; NewColor.y = 0; NewColor.z = 255; break;
|
||||
case 6: NewColor.x = 255; NewColor.y = 0; NewColor.z = a; break;
|
||||
}
|
||||
|
||||
if(CVar_GetS32(Cvar_RBM.c_str(), 0) != 0) {
|
||||
CVar_SetS32(Cvar_Red.c_str(), ClampFloatToInt(NewColor.x,0,255));
|
||||
CVar_SetS32(Cvar_Green.c_str(), ClampFloatToInt(NewColor.y,0,255));
|
||||
CVar_SetS32(Cvar_Blue.c_str(), ClampFloatToInt(NewColor.z,0,255));
|
||||
if (CVar_GetS32(Cvar_RBM.c_str(), 0) != 0) {
|
||||
CVar_SetS32(Cvar_Red.c_str(), ClampFloatToInt(NewColor.x, 0, 255));
|
||||
CVar_SetS32(Cvar_Green.c_str(), ClampFloatToInt(NewColor.y, 0, 255));
|
||||
CVar_SetS32(Cvar_Blue.c_str(), ClampFloatToInt(NewColor.z, 0, 255));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -310,11 +313,11 @@ namespace SohImGui {
|
||||
std::string Cvar_Alpha = cvarname;
|
||||
Cvar_Alpha += "A";
|
||||
|
||||
ColorArray.x = (float)CVar_GetS32(Cvar_Red.c_str(), default_colors.x)/255;
|
||||
ColorArray.y = (float)CVar_GetS32(Cvar_Green.c_str(), default_colors.y)/255;
|
||||
ColorArray.z = (float)CVar_GetS32(Cvar_Blue.c_str(), default_colors.z)/255;
|
||||
ColorArray.x = (float)CVar_GetS32(Cvar_Red.c_str(), default_colors.x) / 255;
|
||||
ColorArray.y = (float)CVar_GetS32(Cvar_Green.c_str(), default_colors.y) / 255;
|
||||
ColorArray.z = (float)CVar_GetS32(Cvar_Blue.c_str(), default_colors.z) / 255;
|
||||
if (has_alpha) {
|
||||
ColorArray.w = (float)CVar_GetS32(Cvar_Alpha.c_str(), default_colors.w)/255;
|
||||
ColorArray.w = (float)CVar_GetS32(Cvar_Alpha.c_str(), default_colors.w) / 255;
|
||||
}
|
||||
}
|
||||
|
||||
@ -397,7 +400,7 @@ namespace SohImGui {
|
||||
LoadTexture("C-Right", "assets/ship_of_harkinian/buttons/CRight.png");
|
||||
LoadTexture("C-Up", "assets/ship_of_harkinian/buttons/CUp.png");
|
||||
LoadTexture("C-Down", "assets/ship_of_harkinian/buttons/CDown.png");
|
||||
});
|
||||
});
|
||||
|
||||
for (const auto& [i, controllers] : Ship::Window::Controllers)
|
||||
{
|
||||
@ -408,7 +411,7 @@ namespace SohImGui {
|
||||
|
||||
ModInternal::RegisterHook<ModInternal::ControllerRead>([](OSContPad* cont_pad) {
|
||||
pads = cont_pad;
|
||||
});
|
||||
});
|
||||
Game::InitSettings();
|
||||
}
|
||||
|
||||
@ -584,17 +587,17 @@ namespace SohImGui {
|
||||
MakeInvisible += cvarName;
|
||||
MakeInvisible += "Random";
|
||||
std::string FullName = "Random";
|
||||
FullName+=MakeInvisible;
|
||||
FullName += MakeInvisible;
|
||||
if (ImGui::Button(FullName.c_str())) {
|
||||
s16 RND_R = rand() % (255 - 0);
|
||||
s16 RND_G = rand() % (255 - 0);
|
||||
s16 RND_B = rand() % (255 - 0);
|
||||
colors->x = (float)RND_R/255;
|
||||
colors->y = (float)RND_G/255;
|
||||
colors->z = (float)RND_B/255;
|
||||
CVar_SetS32(Cvar_Red.c_str(), ClampFloatToInt(colors->x*255,0,255));
|
||||
CVar_SetS32(Cvar_Green.c_str(), ClampFloatToInt(colors->y*255,0,255));
|
||||
CVar_SetS32(Cvar_Blue.c_str(), ClampFloatToInt(colors->z*255,0,255));
|
||||
colors->x = (float)RND_R / 255;
|
||||
colors->y = (float)RND_G / 255;
|
||||
colors->z = (float)RND_B / 255;
|
||||
CVar_SetS32(Cvar_Red.c_str(), ClampFloatToInt(colors->x * 255, 0, 255));
|
||||
CVar_SetS32(Cvar_Green.c_str(), ClampFloatToInt(colors->y * 255, 0, 255));
|
||||
CVar_SetS32(Cvar_Blue.c_str(), ClampFloatToInt(colors->z * 255, 0, 255));
|
||||
CVar_SetS32(Cvar_RBM.c_str(), 0); //On click disable rainbow mode.
|
||||
needs_save = true;
|
||||
}
|
||||
@ -629,14 +632,14 @@ namespace SohImGui {
|
||||
MakeInvisible += cvarName;
|
||||
MakeInvisible += "Reset";
|
||||
if (ImGui::Button(MakeInvisible.c_str())) {
|
||||
colors->x = defaultcolors.x/255;
|
||||
colors->y = defaultcolors.y/255;
|
||||
colors->z = defaultcolors.z/255;
|
||||
if (has_alpha) { colors->w = defaultcolors.w/255;};
|
||||
CVar_SetS32(Cvar_Red.c_str(), ClampFloatToInt(colors->x*255,0,255));
|
||||
CVar_SetS32(Cvar_Green.c_str(), ClampFloatToInt(colors->y*255,0,255));
|
||||
CVar_SetS32(Cvar_Blue.c_str(), ClampFloatToInt(colors->z*255,0,255));
|
||||
if (has_alpha) { CVar_SetS32(Cvar_Alpha.c_str(), ClampFloatToInt(colors->w*255,0,255)); };
|
||||
colors->x = defaultcolors.x / 255;
|
||||
colors->y = defaultcolors.y / 255;
|
||||
colors->z = defaultcolors.z / 255;
|
||||
if (has_alpha) { colors->w = defaultcolors.w / 255; };
|
||||
CVar_SetS32(Cvar_Red.c_str(), ClampFloatToInt(colors->x * 255, 0, 255));
|
||||
CVar_SetS32(Cvar_Green.c_str(), ClampFloatToInt(colors->y * 255, 0, 255));
|
||||
CVar_SetS32(Cvar_Blue.c_str(), ClampFloatToInt(colors->z * 255, 0, 255));
|
||||
if (has_alpha) { CVar_SetS32(Cvar_Alpha.c_str(), ClampFloatToInt(colors->w * 255, 0, 255)); };
|
||||
CVar_SetS32(Cvar_RBM.c_str(), 0); //On click disable rainbow mode.
|
||||
needs_save = true;
|
||||
}
|
||||
@ -658,36 +661,45 @@ namespace SohImGui {
|
||||
LoadPickersColors(ColorRGBA, cvarName, default_colors, has_alpha);
|
||||
ImGuiColorEditFlags flags = ImGuiColorEditFlags_None;
|
||||
|
||||
if (!TitleSameLine){
|
||||
if (!TitleSameLine) {
|
||||
ImGui::Text("%s", text);
|
||||
flags = ImGuiColorEditFlags_NoLabel;
|
||||
}
|
||||
if (!has_alpha) {
|
||||
if (ImGui::ColorEdit3(text, (float *)&ColorRGBA, flags)) {
|
||||
CVar_SetS32(Cvar_Red.c_str(), ClampFloatToInt(ColorRGBA.x*255,0,255));
|
||||
CVar_SetS32(Cvar_Green.c_str(), ClampFloatToInt(ColorRGBA.y*255,0,255));
|
||||
CVar_SetS32(Cvar_Blue.c_str(), ClampFloatToInt(ColorRGBA.z*255,0,255));
|
||||
if (ImGui::ColorEdit3(text, (float*)&ColorRGBA, flags)) {
|
||||
CVar_SetS32(Cvar_Red.c_str(), ClampFloatToInt(ColorRGBA.x * 255, 0, 255));
|
||||
CVar_SetS32(Cvar_Green.c_str(), ClampFloatToInt(ColorRGBA.y * 255, 0, 255));
|
||||
CVar_SetS32(Cvar_Blue.c_str(), ClampFloatToInt(ColorRGBA.z * 255, 0, 255));
|
||||
needs_save = true;
|
||||
}
|
||||
} else {
|
||||
if (ImGui::ColorEdit4(text, (float *)&ColorRGBA, flags)) {
|
||||
CVar_SetS32(Cvar_Red.c_str(), ClampFloatToInt(ColorRGBA.x*255,0,255));
|
||||
CVar_SetS32(Cvar_Green.c_str(), ClampFloatToInt(ColorRGBA.y*255,0,255));
|
||||
CVar_SetS32(Cvar_Blue.c_str(), ClampFloatToInt(ColorRGBA.z*255,0,255));
|
||||
CVar_SetS32(Cvar_Alpha.c_str(), ClampFloatToInt(ColorRGBA.w*255,0,255));
|
||||
}
|
||||
else {
|
||||
if (ImGui::ColorEdit4(text, (float*)&ColorRGBA, flags)) {
|
||||
CVar_SetS32(Cvar_Red.c_str(), ClampFloatToInt(ColorRGBA.x * 255, 0, 255));
|
||||
CVar_SetS32(Cvar_Green.c_str(), ClampFloatToInt(ColorRGBA.y * 255, 0, 255));
|
||||
CVar_SetS32(Cvar_Blue.c_str(), ClampFloatToInt(ColorRGBA.z * 255, 0, 255));
|
||||
CVar_SetS32(Cvar_Alpha.c_str(), ClampFloatToInt(ColorRGBA.w * 255, 0, 255));
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
}
|
||||
ImGui::SameLine();
|
||||
//ImGui::SameLine(); // Removing that one to gain some width spacing on the HUD editor
|
||||
ImGui::NewLine();
|
||||
ImGui::PushItemWidth(-FLT_MIN);
|
||||
ResetColor(cvarName, &ColorRGBA, default_colors, has_alpha);
|
||||
ImGui::SameLine();
|
||||
RandomizeColor(cvarName, &ColorRGBA);
|
||||
if (allow_rainbow) {
|
||||
//Not all draw support rainbow, like Navi.
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::GetWindowSize().x > 560) {
|
||||
ImGui::SameLine();
|
||||
}
|
||||
else {
|
||||
ImGui::NewLine();
|
||||
}
|
||||
RainbowColor(cvarName, &ColorRGBA);
|
||||
}
|
||||
ImGui::PopItemWidth();
|
||||
}
|
||||
|
||||
void DrawMainMenuAndCalculateGameSize(void) {
|
||||
@ -839,9 +851,9 @@ namespace SohImGui {
|
||||
}
|
||||
|
||||
Tooltip("When Interpolation FPS setting is at least this threshold,\n"
|
||||
"add one frame of input lag (e.g. 16.6 ms for 60 FPS) in order to avoid jitter.\n"
|
||||
"This setting allows the CPU to work on one frame while GPU works on the previous frame.\n"
|
||||
"This setting should be used when your computer is too slow to do CPU + GPU work in time.");
|
||||
"add one frame of input lag (e.g. 16.6 ms for 60 FPS) in order to avoid jitter.\n"
|
||||
"This setting allows the CPU to work on one frame while GPU works on the previous frame.\n"
|
||||
"This setting should be used when your computer is too slow to do CPU + GPU work in time.");
|
||||
}
|
||||
|
||||
EXPERIMENTAL();
|
||||
@ -867,6 +879,12 @@ namespace SohImGui {
|
||||
EnhancementSliderInt("Text Speed: %dx", "##TEXTSPEED", "gTextSpeed", 1, 5, "");
|
||||
EnhancementSliderInt("King Zora Speed: %dx", "##WEEPSPEED", "gMweepSpeed", 1, 5, "");
|
||||
EnhancementSliderInt("Vine/Ladder Climb speed +%d", "##CLIMBSPEED", "gClimbSpeed", 0, 12, "");
|
||||
EnhancementSliderInt("Damage Multiplier %dx", "##DAMAGEMUL", "gDamageMul", 1, 4, "");
|
||||
Tooltip("Modifies all sources of damage not affected by other sliders");
|
||||
EnhancementSliderInt("Fall Damage Multiplier %dx", "##FALLDAMAGEMUL", "gFallDamageMul", 1, 4, "");
|
||||
Tooltip("Modifies all fall damage");
|
||||
EnhancementSliderInt("Void Damage Multiplier %dx", "##VOIDDAMAGEMUL", "gVoidDamageMul", 1, 4, "");
|
||||
Tooltip("Modifies all void out damage");
|
||||
|
||||
EnhancementCheckbox("Skip Text", "gSkipText");
|
||||
Tooltip("Holding down B skips text");
|
||||
@ -889,11 +907,16 @@ namespace SohImGui {
|
||||
Tooltip("Disables the voice audio when Navi calls you");
|
||||
EnhancementCheckbox("Fast Chests", "gFastChests");
|
||||
Tooltip("Kick open every chest");
|
||||
EnhancementCheckbox("Fast Drops", "gFastDrops");
|
||||
Tooltip("Skip first-time pickup messages for consumable items");
|
||||
EnhancementCheckbox("Better Owl", "gBetterOwl");
|
||||
Tooltip("The default response to Kaepora Gaebora is always that you understood what he said");
|
||||
EnhancementCheckbox("Link's Cow in Both Time Periods", "gCowOfTime");
|
||||
Tooltip("Allows the Lon Lon Ranch obstacle course reward to be shared across time periods");
|
||||
EnhancementCheckbox("Enable visible guard vision", "gGuardVision");
|
||||
EnhancementCheckbox("Enable passage of time on file select", "gTimeFlowFileSelect");
|
||||
EnhancementCheckbox("Allow the cursor to be on any slot", "gPauseAnyCursor");
|
||||
Tooltip("Allows the cursor on the pause menu to be over any slot. Similar to Rando and Spaceworld 97");
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
@ -968,6 +991,8 @@ namespace SohImGui {
|
||||
Tooltip("Prevents the Forest Stage Deku Nut upgrade from becoming unobtainable after receiving the Poacher's Saw");
|
||||
EnhancementCheckbox("Fix Navi text HUD position", "gNaviTextFix");
|
||||
Tooltip("Correctly centers the Navi text prompt on the HUD's C-Up button");
|
||||
EnhancementCheckbox("Fix Anubis fireballs", "gAnubisFix");
|
||||
Tooltip("Make Anubis fireballs do fire damage when reflected back at them with the Mirror Shield");
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
@ -1032,7 +1057,7 @@ namespace SohImGui {
|
||||
CVar_SetS32("gDisableKokiriDrawDistance", 0);
|
||||
} else if (CVar_GetS32("gDisableDrawDistance", 0) == 1) {
|
||||
EnhancementCheckbox("Kokiri Draw Distance", "gDisableKokiriDrawDistance");
|
||||
Tooltip("Kokiris are mystical being that appear from a certain distance\nEnable this will remove their draw distance\nNeeds to reload the map to take effect");
|
||||
Tooltip("Kokiris are mystical being that appear from a certain distance\nEnable this will remove their draw distance");
|
||||
}
|
||||
|
||||
ImGui::EndMenu();
|
||||
@ -1052,7 +1077,7 @@ namespace SohImGui {
|
||||
EnhancementCheckbox("Interface editor", "gColorsEditor");
|
||||
Tooltip("Edit the colors used for your own interface");
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (ImGui::BeginMenu("Cheats"))
|
||||
@ -1097,7 +1122,7 @@ namespace SohImGui {
|
||||
Tooltip("Enables Debug Mode, allowing you to select maps with L + R + Z, noclip with L + D-pad Right,\nand open the debug menu with L on the pause screen");
|
||||
EnhancementCheckbox("Fast File Select", "gSkipLogoTitle");
|
||||
Tooltip("Directly load the game to selected slot bellow\nUse slot number 4 to load directly in Zelda Map Select\n(Do not require debug menu but you will be unable to save there)\n(you can also load Zelda map select with Debug mod + slot 0).\nWith Slot : 0 you can go directly in File Select menu\nAttention, Loading an empty save will result in crash");
|
||||
if (CVar_GetS32("gSkipLogoTitle",0)) {
|
||||
if (CVar_GetS32("gSkipLogoTitle", 0)) {
|
||||
EnhancementSliderInt("Loading %d", "##SaveFileID", "gSaveFileID", 0, 4, "");
|
||||
}
|
||||
ImGui::Separator();
|
||||
@ -1146,35 +1171,35 @@ namespace SohImGui {
|
||||
if (ImGui::BeginTabItem("Navi")) {
|
||||
EnhancementCheckbox("Custom colors for Navi", "gUseNaviCol");
|
||||
Tooltip("Enable/Disable custom Navi's colors. \nIf disabled you will have original colors for Navi.\nColors are refreshed when Navi goes back in your pockets.");
|
||||
EnhancementColor("Navi Idle Inner", "gNavi_Idle_Inner_", navi_idle_i_col, ImVec4(255,255,255,255), false);
|
||||
EnhancementColor("Navi Idle Inner", "gNavi_Idle_Inner_", navi_idle_i_col, ImVec4(255, 255, 255, 255), false);
|
||||
Tooltip("Inner color for Navi (idle flying around)");
|
||||
EnhancementColor("Navi Idle Outer", "gNavi_Idle_Outer_", navi_idle_o_col, ImVec4(0,0,255,255), false);
|
||||
EnhancementColor("Navi Idle Outer", "gNavi_Idle_Outer_", navi_idle_o_col, ImVec4(0, 0, 255, 255), false);
|
||||
Tooltip("Outer color for Navi (idle flying around)");
|
||||
ImGui::Separator();
|
||||
EnhancementColor("Navi NPC Inner", "gNavi_NPC_Inner_", navi_npc_i_col, ImVec4(150,150,255,255), false);
|
||||
EnhancementColor("Navi NPC Inner", "gNavi_NPC_Inner_", navi_npc_i_col, ImVec4(150, 150, 255, 255), false);
|
||||
Tooltip("Inner color for Navi (when Navi fly around NPCs)");
|
||||
EnhancementColor("Navi NPC Outer", "gNavi_NPC_Outer_", navi_npc_o_col, ImVec4(150,150,255,255), false);
|
||||
EnhancementColor("Navi NPC Outer", "gNavi_NPC_Outer_", navi_npc_o_col, ImVec4(150, 150, 255, 255), false);
|
||||
Tooltip("Outer color for Navi (when Navi fly around NPCs)");
|
||||
ImGui::Separator();
|
||||
EnhancementColor("Navi Enemy Inner", "gNavi_Enemy_Inner_", navi_enemy_i_col, ImVec4(255,255,0,255), false);
|
||||
EnhancementColor("Navi Enemy Inner", "gNavi_Enemy_Inner_", navi_enemy_i_col, ImVec4(255, 255, 0, 255), false);
|
||||
Tooltip("Inner color for Navi (when Navi fly around Enemies or Bosses)");
|
||||
EnhancementColor("Navi Enemy Outer", "gNavi_Enemy_Outer_", navi_enemy_o_col, ImVec4(220,155,0,255), false);
|
||||
EnhancementColor("Navi Enemy Outer", "gNavi_Enemy_Outer_", navi_enemy_o_col, ImVec4(220, 155, 0, 255), false);
|
||||
Tooltip("Outer color for Navi (when Navi fly around Enemies or Bosses)");
|
||||
ImGui::Separator();
|
||||
EnhancementColor("Navi Prop Inner", "gNavi_Prop_Inner_", navi_prop_i_col, ImVec4(0,255,0,255), false);
|
||||
EnhancementColor("Navi Prop Inner", "gNavi_Prop_Inner_", navi_prop_i_col, ImVec4(0, 255, 0, 255), false);
|
||||
Tooltip("Inner color for Navi (when Navi fly around props (signs etc))");
|
||||
EnhancementColor("Navi Prop Outer", "gNavi_Prop_Outer_", navi_prop_o_col, ImVec4(0,255,0,255), false);
|
||||
EnhancementColor("Navi Prop Outer", "gNavi_Prop_Outer_", navi_prop_o_col, ImVec4(0, 255, 0, 255), false);
|
||||
Tooltip("Outer color for Navi (when Navi fly around props (signs etc))");
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
if (ImGui::BeginTabItem("Tunics")) {
|
||||
EnhancementCheckbox("Custom colors on tunics", "gUseTunicsCol");
|
||||
Tooltip("Enable/Disable custom Link's tunics colors. \nIf disabled you will have original colors for Link's tunics.");
|
||||
EnhancementColor("Kokiri Tunic", "gTunic_Kokiri_", kokiri_col, ImVec4(30,105,27,255));
|
||||
EnhancementColor("Kokiri Tunic", "gTunic_Kokiri_", kokiri_col, ImVec4(30, 105, 27, 255));
|
||||
ImGui::Separator();
|
||||
EnhancementColor("Goron Tunic", "gTunic_Goron_", goron_col, ImVec4(100,20,0,255));
|
||||
EnhancementColor("Goron Tunic", "gTunic_Goron_", goron_col, ImVec4(100, 20, 0, 255));
|
||||
ImGui::Separator();
|
||||
EnhancementColor("Zora Tunic", "gTunic_Zora_", zora_col, ImVec4(0,60,100,255));
|
||||
EnhancementColor("Zora Tunic", "gTunic_Zora_", zora_col, ImVec4(0, 60, 100, 255));
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
ImGui::EndTabBar();
|
||||
@ -1189,40 +1214,81 @@ namespace SohImGui {
|
||||
ImGui::SetNextWindowSize(ImVec2(215, 627), ImGuiCond_FirstUseEver);
|
||||
ImGui::Begin("Interface Editor", nullptr, ImGuiWindowFlags_NoFocusOnAppearing);
|
||||
if (ImGui::BeginTabBar("Interface Editor", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) {
|
||||
if (ImGui::BeginTabItem("Hearts")) {
|
||||
EnhancementColor("Hearts inner", "gCCHeartsPrim", hearts_colors, ImVec4(255,70,50,255));
|
||||
Tooltip("Hearts inner color (red in original)\nAffect both Normal Hearts and the ones in Double Defense");
|
||||
EnhancementColor("Hearts double def", "gDDCCHeartsPrim", hearts_dd_colors, ImVec4(255,255,255,255));
|
||||
Tooltip("Hearts outline color (white in original)\nAffect Double Defense outline only.");
|
||||
ImGui::EndTabItem();
|
||||
if (ImGui::BeginTabItem("HUD")) {
|
||||
if (ImGui::BeginTable("tableInterfaceEditor", 3, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) {
|
||||
ImGui::TableSetupColumn("Hearts", ImGuiTableColumnFlags_WidthStretch, 200.0f);
|
||||
ImGui::TableSetupColumn("Magic Bar", ImGuiTableColumnFlags_WidthStretch, 200.0f);
|
||||
ImGui::TableSetupColumn("Buttons", ImGuiTableColumnFlags_WidthStretch, 200.0f);
|
||||
ImGui::TableHeadersRow();
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
// COLUMN 1.1 - HEARTS
|
||||
ImGui::PushItemWidth(-FLT_MIN);
|
||||
EnhancementColor("Hearts inner", "gCCHeartsPrim", hearts_colors, ImVec4(255, 70, 50, 255));
|
||||
Tooltip("Hearts inner color (red in original)\nAffect both Normal Hearts and the ones in Double Defense");
|
||||
ImGui::Separator();
|
||||
EnhancementColor("Hearts double def", "gDDCCHeartsPrim", hearts_dd_colors, ImVec4(255, 255, 255, 255));
|
||||
Tooltip("Hearts outline color (white in original)\nAffect Double Defense outline only.");
|
||||
ImGui::PopItemWidth();
|
||||
ImGui::Separator();
|
||||
if (ImGui::BeginTable("tableMisc", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) {
|
||||
ImGui::TableSetupColumn("Misc", ImGuiTableColumnFlags_WidthStretch, 600.0f);
|
||||
ImGui::TableHeadersRow();
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
// COLUMN 1.2 - MISC
|
||||
ImGui::PushItemWidth(-FLT_MIN);
|
||||
EnhancementColor("Minimap color", "gCCMinimapPrim", minimap_colors, ImVec4(0, 255, 255, 255));
|
||||
Tooltip("Affect the Dungeon and Overworld minimaps.");
|
||||
ImGui::Separator();
|
||||
EnhancementColor("Rupee icon color", "gCCRupeePrim", rupee_colors, ImVec4(120, 120, 120, 255));
|
||||
Tooltip("Affect the Rupee icon on interface\nGreen by default.");
|
||||
ImGui::Separator();
|
||||
EnhancementColor("Small Keys icon color", "gCCKeysPrim", smolekey_colors, ImVec4(200, 230, 255, 255));
|
||||
Tooltip("Affect the Small keys icon on interface\nGray by default.");
|
||||
ImGui::PopItemWidth();
|
||||
ImGui::EndTable();
|
||||
}
|
||||
ImGui::TableNextColumn();
|
||||
// COLUMN 2 - MAGIC BAR
|
||||
ImGui::PushItemWidth(-FLT_MIN);
|
||||
EnhancementColor("Magic bar borders", "gCCMagicBorderPrim", magic_border_colors, ImVec4(255, 255, 255, 255));
|
||||
Tooltip("Affect the border of the magic bar when being used\nWhite flash in original game.");
|
||||
ImGui::Separator();
|
||||
EnhancementColor("Magic bar main color", "gCCMagicPrim", magic_remaining_colors, ImVec4(0, 200, 0, 255));
|
||||
Tooltip("Affect the magic bar color\nGreen in original game.");
|
||||
ImGui::Separator();
|
||||
EnhancementColor("Magic bar being used", "gCCMagicUsePrim", magic_use_colors, ImVec4(250, 250, 0, 255));
|
||||
Tooltip("Affect the magic bar when being used\nYellow in original game.");
|
||||
ImGui::Separator();
|
||||
ImGui::PopItemWidth();
|
||||
ImGui::TableNextColumn();
|
||||
// COLUMN 3 - BUTTON
|
||||
ImGui::PushItemWidth(-FLT_MIN);
|
||||
EnhancementColor("A Buttons", "gCCABtnPrim", a_btn_colors, ImVec4(90, 90, 255, 255));
|
||||
Tooltip("A Buttons colors (Green in original GameCube)\nAffect A buttons colors on interface, in shops, messages boxes, ocarina notes and inventory cursors.");
|
||||
ImGui::Separator();
|
||||
EnhancementColor("B Buttons", "gCCBBtnPrim", b_btn_colors, ImVec4(0, 150, 0, 255));
|
||||
Tooltip("B Button colors (Red in original GameCube)\nAffect B button colors on interface");
|
||||
ImGui::Separator();
|
||||
EnhancementColor("C Buttons", "gCCCBtnPrim", c_btn_colors, ImVec4(255, 160, 0, 255));
|
||||
Tooltip("C Buttons colors (Yellowish / Oranges in originals)\nAffect C buttons colors on interface, in inventory and ocarina notes");
|
||||
ImGui::Separator();
|
||||
EnhancementColor("Start Buttons", "gCCStartBtnPrim", start_btn_colors, ImVec4(120, 120, 120, 255));
|
||||
Tooltip("Start Button colors (gray in GameCube)\nAffect Start button colors in inventory");
|
||||
ImGui::Separator();
|
||||
ImGui::PopItemWidth();
|
||||
ImGui::EndTable();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
if (ImGui::BeginTabItem("Buttons")) {
|
||||
EnhancementColor("A Buttons", "gCCABtnPrim", a_btn_colors, ImVec4(90,90,255,255));
|
||||
Tooltip("A Buttons colors (Green in original GameCube)\nAffect A buttons colors on interface, in shops, messages boxes, ocarina notes and inventory cursors.");
|
||||
EnhancementColor("B Buttons", "gCCBBtnPrim", b_btn_colors, ImVec4(0,150,0,255));
|
||||
Tooltip("B Button colors (Red in original GameCube)\nAffect B button colors on interface");
|
||||
EnhancementColor("C Buttons", "gCCCBtnPrim", c_btn_colors, ImVec4(255,160,0,255));
|
||||
Tooltip("C Buttons colors (Yellowish / Oranges in originals)\nAffect C buttons colors on interface, in inventory and ocarina notes");
|
||||
EnhancementColor("Start Buttons", "gCCStartBtnPrim", start_btn_colors, ImVec4(120,120,120,255));
|
||||
Tooltip("Start Button colors (gray in GameCube)\nAffect Start button colors in inventory");
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
if (ImGui::BeginTabItem("Magic Bar")) {
|
||||
EnhancementColor("Magic bar borders", "gCCMagicBorderPrim", magic_border_colors, ImVec4(255,255,255,255));
|
||||
Tooltip("Affect the border of the magic bar when being used\nWhite flash in original game.");
|
||||
EnhancementColor("Magic bar main color", "gCCMagicPrim", magic_remaining_colors, ImVec4(0,200,0,255));
|
||||
Tooltip("Affect the magic bar color\nGreen in original game.");
|
||||
EnhancementColor("Magic bar being used", "gCCMagicUsePrim", magic_use_colors, ImVec4(250,250,0,255));
|
||||
Tooltip("Affect the magic bar when being used\nYellow in original game.");
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
if (ImGui::BeginTabItem("Misc")) {
|
||||
EnhancementColor("Minimap color", "gCCMinimapPrim", minimap_colors, ImVec4(0,255,255,255));
|
||||
Tooltip("Affect the Dungeon and Overworld minimaps.");
|
||||
EnhancementColor("Rupee icon color", "gCCRupeePrim", rupee_colors, ImVec4(120,120,120,255));
|
||||
Tooltip("Affect the Rupee icon on interface\nGreen by default.");
|
||||
EnhancementColor("Small Keys icon color", "gCCKeysPrim", smolekey_colors, ImVec4(200,230,255,255));
|
||||
Tooltip("Affect the Small keys icon on interface\nGray by default.");
|
||||
|
||||
if (ImGui::BeginTabItem("File Choose")) {
|
||||
EnhancementColor("File Choose color", "gCCFileChoosePrim", fileselect_colors, ImVec4(100, 150, 255, 255));
|
||||
Tooltip("Affect the File Select.");
|
||||
ImGui::Separator();
|
||||
EnhancementColor("Bottom text color", "gCCFileChooseTextPrim", fileselect_text_colors, ImVec4(0, 100, 255, 255));
|
||||
Tooltip("Affect the File Select.");
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
ImGui::EndTabBar();
|
||||
|
@ -1322,18 +1322,9 @@ void SkinMatrix_SetTranslateRotateZYX(MtxF* dest, s16 rotX, s16 rotY, s16 rotZ,
|
||||
f32 translateZ);
|
||||
Mtx* SkinMatrix_MtxFToNewMtx(GraphicsContext* gfxCtx, MtxF* src);
|
||||
void SkinMatrix_SetRotateAxis(MtxF* mf, s16 angle, f32 axisX, f32 axisY, f32 axisZ);
|
||||
void Sram_InitNewSave(void);
|
||||
void Sram_InitDebugSave(void);
|
||||
void Sram_OpenSave(SramContext* sramCtx);
|
||||
void Sram_WriteSave(SramContext* sramCtx);
|
||||
void Sram_VerifyAndLoadAllSaves(FileChooseContext* fileChoose, SramContext* sramCtx);
|
||||
void Sram_InitSave(FileChooseContext* fileChoose, SramContext* sramCtx);
|
||||
void Sram_EraseSave(FileChooseContext* fileChoose, SramContext* sramCtx);
|
||||
void Sram_CopySave(FileChooseContext* fileChoose, SramContext* sramCtx);
|
||||
void Sram_WriteSramHeader(SramContext* sramCtx);
|
||||
void Sram_InitSram(GameState* gameState, SramContext* sramCtx);
|
||||
void Sram_Alloc(GameState* gameState, SramContext* sramCtx);
|
||||
void Sram_Init(GlobalContext* globalCtx, SramContext* sramCtx);
|
||||
void Sram_OpenSave();
|
||||
void Sram_InitSave(FileChooseContext* fileChoose);
|
||||
void Sram_InitSram(GameState* gameState);
|
||||
void SsSram_ReadWrite(uintptr_t addr, void* dramAddr, size_t size, s32 direction);
|
||||
void func_800A9F30(PadMgr*, s32);
|
||||
void func_800A9F6C(f32, u8, u8, u8);
|
||||
|
@ -1075,10 +1075,6 @@ typedef struct {
|
||||
/* 0x01 */ u8 room;
|
||||
} EntranceEntry;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8* readBuff;
|
||||
} SramContext; // size = 0x4
|
||||
|
||||
#define SRAM_SIZE 0x8000
|
||||
#define SRAM_HEADER_SIZE 0x10
|
||||
|
||||
@ -1123,7 +1119,6 @@ typedef struct {
|
||||
/* 0x0000 */ GameState state;
|
||||
/* 0x00A4 */ u8* staticSegment;
|
||||
/* 0x00A8 */ View view;
|
||||
/* 0x01D0 */ SramContext sramCtx;
|
||||
/* 0x01D4 */ u16 unk_1D4; // not used in mq dbg (some sort of timer that doesn't seem to affect anything)
|
||||
/* 0x01D6 */ s16 coverAlpha;
|
||||
/* 0x01D8 */ s16 addAlpha; // not used in mq dbg
|
||||
@ -1209,7 +1204,6 @@ typedef struct GlobalContext {
|
||||
/* 0x01C24 */ ActorContext actorCtx;
|
||||
/* 0x01D64 */ CutsceneContext csCtx; // "demo_play"
|
||||
/* 0x01DB4 */ SoundSource soundSources[16];
|
||||
/* 0x01F74 */ SramContext sramCtx;
|
||||
/* 0x01F78 */ SkyboxContext skyboxCtx;
|
||||
/* 0x020D8 */ MessageContext msgCtx; // "message"
|
||||
/* 0x104F0 */ InterfaceContext interfaceCtx; // "parameter"
|
||||
@ -1283,7 +1277,6 @@ typedef struct {
|
||||
/* 0x000AC */ u8* parameterSegment;
|
||||
/* 0x000B0 */ char unk_B0[0x8];
|
||||
/* 0x000B8 */ View view;
|
||||
/* 0x001E0 */ SramContext sramCtx;
|
||||
/* 0x001E4 */ char unk_1E4[0x4];
|
||||
/* 0x001E8 */ SkyboxContext skyboxCtx;
|
||||
/* 0x00348 */ MessageContext msgCtx;
|
||||
@ -1294,13 +1287,6 @@ typedef struct {
|
||||
/* 0x1C9EC */ Vtx* keyboardVtx;
|
||||
/* 0x1C9F0 */ Vtx* nameEntryVtx;
|
||||
/* 0x1C9F4 */ u8 n64ddFlag;
|
||||
/* 0x1C9F6 */ u16 deaths[3];
|
||||
/* 0x1C9FC */ u8 fileNames[3][8];
|
||||
/* 0x1CA14 */ u16 healthCapacities[3];
|
||||
/* 0x1CA1C */ u32 questItems[3];
|
||||
/* 0x1CA28 */ s16 n64ddFlags[3];
|
||||
/* 0x1CA2E */ s8 defense[3];
|
||||
/* 0x1CA32 */ u16 health[3];
|
||||
/* 0x1CA38 */ s16 buttonIndex;
|
||||
/* 0x1CA3A */ s16 confirmButtonIndex; // 0: yes, 1: quit
|
||||
/* 0x1CA3C */ s16 menuMode;
|
||||
|
@ -68,7 +68,6 @@ typedef struct {
|
||||
/* 0x0010 */ s32 nightFlag;
|
||||
/* 0x0014 */ s32 totalDays;
|
||||
/* 0x0018 */ s32 bgsDayCount; // increments with totalDays, can be cleared with `Environment_ClearBgsDayCount`
|
||||
/* 0x001C */ char newf[6]; // string "ZELDAZ". start of `info` substruct, originally called "information"
|
||||
/* 0x0022 */ u16 deaths;
|
||||
/* 0x0024 */ char playerName[8];
|
||||
/* 0x002C */ s16 n64ddFlag;
|
||||
@ -80,7 +79,6 @@ typedef struct {
|
||||
/* 0x0036 */ u16 swordHealth;
|
||||
/* 0x0038 */ u16 naviTimer;
|
||||
/* 0x003A */ u8 magicAcquired;
|
||||
/* 0x003B */ char unk_3B[0x01];
|
||||
/* 0x003C */ u8 doubleMagic;
|
||||
/* 0x003D */ u8 doubleDefense;
|
||||
/* 0x003E */ u8 bgsFlag;
|
||||
@ -88,30 +86,23 @@ typedef struct {
|
||||
/* 0x0040 */ ItemEquips childEquips;
|
||||
/* 0x004A */ ItemEquips adultEquips;
|
||||
/* 0x0054 */ u32 unk_54; // this may be incorrect, currently used for alignement
|
||||
/* 0x0058 */ char unk_58[0x0E];
|
||||
/* 0x0066 */ s16 savedSceneNum;
|
||||
/* 0x0068 */ ItemEquips equips;
|
||||
/* 0x0074 */ Inventory inventory;
|
||||
/* 0x00D4 */ SavedSceneFlags sceneFlags[124];
|
||||
/* 0x0E64 */ FaroresWindData fw;
|
||||
/* 0x0E8C */ char unk_E8C[0x10];
|
||||
/* 0x0E9C */ s32 gsFlags[6];
|
||||
/* 0x0EB4 */ char unk_EB4[0x4];
|
||||
/* 0x0EB8 */ s32 highScores[7];
|
||||
/* 0x0ED4 */ u16 eventChkInf[14]; // "event_chk_inf"
|
||||
/* 0x0EF0 */ u16 itemGetInf[4]; // "item_get_inf"
|
||||
/* 0x0EF8 */ u16 infTable[30]; // "inf_table"
|
||||
/* 0x0F34 */ char unk_F34[0x04];
|
||||
/* 0x0F38 */ u32 worldMapAreaData; // "area_arrival"
|
||||
/* 0x0F3C */ char unk_F3C[0x4];
|
||||
/* 0x0F40 */ u8 scarecrowCustomSongSet;
|
||||
/* 0x0F41 */ u8 scarecrowCustomSong[0x360];
|
||||
/* 0x12A1 */ char unk_12A1[0x24];
|
||||
/* 0x12C5 */ u8 scarecrowSpawnSongSet;
|
||||
/* 0x12C6 */ u8 scarecrowSpawnSong[0x80];
|
||||
/* 0x1346 */ char unk_1346[0x02];
|
||||
/* 0x1348 */ HorseData horseData;
|
||||
/* 0x1352 */ u16 checksum; // "check_sum"
|
||||
/* 0x1354 */ s32 fileNum; // "file_no"
|
||||
/* 0x1358 */ char unk_1358[0x0004];
|
||||
/* 0x135C */ s32 gameMode;
|
||||
@ -120,13 +111,11 @@ typedef struct {
|
||||
/* 0x1368 */ RespawnData respawn[3]; // "restart_data"
|
||||
/* 0x13BC */ f32 entranceSpeed;
|
||||
/* 0x13C0 */ u16 entranceSound;
|
||||
/* 0x13C2 */ char unk_13C2[0x0001];
|
||||
/* 0x13C3 */ u8 unk_13C3;
|
||||
/* 0x13C4 */ s16 dogParams;
|
||||
/* 0x13C6 */ u8 textTriggerFlags;
|
||||
/* 0x13C7 */ u8 showTitleCard;
|
||||
/* 0x13C8 */ s16 nayrusLoveTimer;
|
||||
/* 0x13CA */ char unk_13CA[0x0002];
|
||||
/* 0x13CC */ s16 rupeeAccumulator;
|
||||
/* 0x13CE */ s16 timer1State;
|
||||
/* 0x13D0 */ s16 timer1Value;
|
||||
@ -134,7 +123,6 @@ typedef struct {
|
||||
/* 0x13D4 */ s16 timer2Value;
|
||||
/* 0x13D6 */ s16 timerX[2];
|
||||
/* 0x13DA */ s16 timerY[2];
|
||||
/* 0x13DE */ char unk_13DE[0x0002];
|
||||
/* 0x13E0 */ u8 seqId;
|
||||
/* 0x13E1 */ u8 natureAmbienceId;
|
||||
/* 0x13E2 */ u8 buttonStatus[5];
|
||||
@ -152,14 +140,11 @@ typedef struct {
|
||||
/* 0x1402 */ u16 mapIndex; // intended for maps/minimaps but commonly used as the dungeon index
|
||||
/* 0x1404 */ u16 minigameState;
|
||||
/* 0x1406 */ u16 minigameScore; // "yabusame_total"
|
||||
/* 0x1408 */ char unk_1408[0x0001];
|
||||
/* 0x1409 */ u8 language; // NTSC 0: Japanese; 1: English | PAL 0: English; 1: German; 2: French
|
||||
/* 0x140A */ u8 audioSetting;
|
||||
/* 0x140B */ char unk_140B[0x0001];
|
||||
/* 0x140C */ u8 zTargetSetting; // 0: Switch; 1: Hold
|
||||
/* 0x140E */ u16 forcedSeqId; // immediately start playing the sequence if set
|
||||
/* 0x1410 */ u8 unk_1410; // transition related
|
||||
/* 0x1411 */ char unk_1411[0x0001];
|
||||
/* 0x1412 */ u16 nextCutsceneIndex;
|
||||
/* 0x1414 */ u8 cutsceneTrigger;
|
||||
/* 0x1415 */ u8 chamberCutsceneNum;
|
||||
@ -169,7 +154,6 @@ typedef struct {
|
||||
/* 0x141A */ u16 skyboxTime;
|
||||
/* 0x141C */ u8 dogIsLost;
|
||||
/* 0x141D */ u8 nextTransition;
|
||||
/* 0x141E */ char unk_141E[0x0002];
|
||||
/* 0x1420 */ s16 worldMapArea;
|
||||
/* 0x1422 */ s16 sunsSongState; // controls the effects of suns song
|
||||
/* 0x1424 */ s16 healthAccumulator;
|
||||
|
@ -192,6 +192,7 @@
|
||||
<ClCompile Include="soh\GbiWrap.cpp" />
|
||||
<ClCompile Include="soh\gu_pc.c" />
|
||||
<ClCompile Include="soh\OTRGlobals.cpp" />
|
||||
<ClCompile Include="soh\SaveManager.cpp" />
|
||||
<ClCompile Include="soh\stubs.c" />
|
||||
<ClCompile Include="soh\util.cpp" />
|
||||
<ClCompile Include="soh\z_message_OTR.cpp" />
|
||||
@ -941,8 +942,10 @@
|
||||
<ClInclude Include="soh\Enhancements\debugger\debugSaveEditor.h" />
|
||||
<ClInclude Include="soh\Enhancements\debugger\ImGuiHelpers.h" />
|
||||
<ClInclude Include="soh\gameconsole.h" />
|
||||
<ClInclude Include="soh\Lib\nlohmann\json.hpp" />
|
||||
<ClInclude Include="soh\OTRAudio.h" />
|
||||
<ClInclude Include="soh\OTRGlobals.h" />
|
||||
<ClInclude Include="soh\SaveManager.h" />
|
||||
<ClInclude Include="soh\util.h" />
|
||||
<ClInclude Include="src\overlays\actors\ovl_Arms_Hook\z_arms_hook.h" />
|
||||
<ClInclude Include="src\overlays\actors\ovl_Arrow_Fire\z_arrow_fire.h" />
|
||||
|
@ -85,6 +85,9 @@
|
||||
<Filter Include="Source Files\soh\Lib">
|
||||
<UniqueIdentifier>{dbcf07c4-80b1-4c88-ac54-2bbdd8f53ee4}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\soh\Lib\nlohmann">
|
||||
<UniqueIdentifier>{9c880c8e-492b-48f6-b230-1fd269ea74b1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\boot\assert.c">
|
||||
@ -2202,6 +2205,9 @@
|
||||
<ClCompile Include="soh\Enhancements\savestates.cpp">
|
||||
<Filter>Source Files\soh\Enhancements</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="soh\SaveManager.cpp">
|
||||
<Filter>Source Files\soh</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\overlays\actors\ovl_kaleido_scope\z_kaleido_scope.h">
|
||||
@ -3770,6 +3776,12 @@
|
||||
<ClInclude Include="soh\OTRAudio.h">
|
||||
<Filter>Source Files\soh</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="soh\Lib\nlohmann\json.hpp">
|
||||
<Filter>Source Files\soh\Lib\nlohmann</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="soh\SaveManager.h">
|
||||
<Filter>Source Files\soh</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="SHIPOFHARKINIAN.ico" />
|
||||
|
@ -39,6 +39,7 @@ void BootCommands_Init()
|
||||
CVar_RegisterS32("gHudColors", 1); //0 = N64 / 1 = NGC / 2 = Custom
|
||||
CVar_RegisterS32("gUseNaviCol", 0);
|
||||
CVar_RegisterS32("gUseTunicsCol", 0);
|
||||
CVar_RegisterS32("gGuardVision", 0);
|
||||
CVar_RegisterS32("gTimeFlowFileSelect", 0);
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <bit>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <Cvar.h>
|
||||
|
||||
extern "C" {
|
||||
#include <z64.h>
|
||||
@ -483,7 +484,7 @@ std::map<u16, const char*> actorDescriptions = {
|
||||
};
|
||||
|
||||
const std::string GetActorDescription(u16 id) {
|
||||
return actorDescriptions[id];
|
||||
return actorDescriptions[id] != NULL ? actorDescriptions[id] : "???";
|
||||
}
|
||||
|
||||
template <typename T> void DrawGroupWithBorder(T&& drawFunc) {
|
||||
@ -530,6 +531,7 @@ void PopulateActorDropdown(int i, std::vector<Actor*>& data) {
|
||||
|
||||
void DrawActorViewer(bool& open) {
|
||||
if (!open) {
|
||||
CVar_SetS32("gActorViewerEnabled", 0);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -559,7 +561,6 @@ void DrawActorViewer(bool& open) {
|
||||
display = empty;
|
||||
fetch = nullptr;
|
||||
dispOverlay = nullptr;
|
||||
newActor = { 0, 0, { 0, 0, 0 }, { 0, 0, 0 } };
|
||||
actor = category = 0;
|
||||
filler = "Please Select";
|
||||
list.clear();
|
||||
@ -696,6 +697,7 @@ void DrawActorViewer(bool& open) {
|
||||
if (ImGui::TreeNode("New...")) {
|
||||
ImGui::PushItemWidth(ImGui::GetFontSize() * 10);
|
||||
|
||||
ImGui::Text(GetActorDescription(newActor.id).c_str());
|
||||
ImGui::InputScalar("ID", ImGuiDataType_S16, &newActor.id, &one);
|
||||
ImGui::InputScalar("params", ImGuiDataType_S16, &newActor.params, &one);
|
||||
|
||||
@ -728,19 +730,32 @@ void DrawActorViewer(bool& open) {
|
||||
}
|
||||
|
||||
if (ImGui::Button("Spawn")) {
|
||||
Actor_Spawn(&gGlobalCtx->actorCtx, gGlobalCtx, newActor.id, newActor.pos.x, newActor.pos.y,
|
||||
newActor.pos.z, newActor.rot.x, newActor.rot.y, newActor.rot.z, newActor.params);
|
||||
if (newActor.id >= 0 && newActor.id < ACTOR_ID_MAX && gActorOverlayTable[newActor.id].initInfo != NULL) {
|
||||
Actor_Spawn(&gGlobalCtx->actorCtx, gGlobalCtx, newActor.id, newActor.pos.x, newActor.pos.y,
|
||||
newActor.pos.z, newActor.rot.x, newActor.rot.y, newActor.rot.z, newActor.params);
|
||||
} else {
|
||||
func_80078884(NA_SE_SY_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::Button("Spawn as Child")) {
|
||||
Actor* parent = &display;
|
||||
if (parent != NULL) {
|
||||
Actor_SpawnAsChild(&gGlobalCtx->actorCtx, parent, gGlobalCtx, newActor.id, newActor.pos.x,
|
||||
newActor.pos.y, newActor.pos.z, newActor.rot.x, newActor.rot.y, newActor.rot.z,
|
||||
newActor.params);
|
||||
if (newActor.id >= 0 && newActor.id < ACTOR_ID_MAX &&
|
||||
gActorOverlayTable[newActor.id].initInfo != NULL) {
|
||||
Actor_SpawnAsChild(&gGlobalCtx->actorCtx, parent, gGlobalCtx, newActor.id, newActor.pos.x,
|
||||
newActor.pos.y, newActor.pos.z, newActor.rot.x, newActor.rot.y,
|
||||
newActor.rot.z, newActor.params);
|
||||
} else {
|
||||
func_80078884(NA_SE_SY_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::Button("Reset")) {
|
||||
newActor = { 0, 0, { 0, 0, 0 }, { 0, 0, 0 } };
|
||||
}
|
||||
|
||||
ImGui::TreePop();
|
||||
}
|
||||
} else {
|
||||
@ -748,7 +763,6 @@ void DrawActorViewer(bool& open) {
|
||||
if (needs_reset) {
|
||||
fetch = nullptr;
|
||||
dispOverlay = nullptr;
|
||||
newActor = { 0, 0, { 0, 0, 0 }, { 0, 0, 0 } };
|
||||
actor = category = 0;
|
||||
filler = "Please Select";
|
||||
list.clear();
|
||||
|
@ -264,6 +264,9 @@ typedef struct SaveStateInfo {
|
||||
uint8_t sKankyoIsSpawned_copy;
|
||||
int16_t sTrailingFairies_copy;
|
||||
|
||||
// z_en_heishi1
|
||||
uint32_t sHeishi1PlayerIsCaughtCopy;
|
||||
|
||||
|
||||
//Misc static data
|
||||
// z_map_exp
|
||||
@ -616,6 +619,8 @@ void SaveState::SaveOverlayStaticData(void) {
|
||||
info->D_80B5A4BC_copy = D_80B5A4BC;
|
||||
info->sKankyoIsSpawned_copy = sKankyoIsSpawned;
|
||||
info->sTrailingFairies_copy = sTrailingFairies;
|
||||
|
||||
info->sHeishi1PlayerIsCaughtCopy = sHeishi1PlayerIsCaught;
|
||||
|
||||
}
|
||||
|
||||
@ -686,6 +691,8 @@ void SaveState::LoadOverlayStaticData(void) {
|
||||
D_80B5A4BC = info->D_80B5A4BC_copy;
|
||||
sKankyoIsSpawned = info->sKankyoIsSpawned_copy;
|
||||
sTrailingFairies = info->sTrailingFairies_copy;
|
||||
|
||||
sHeishi1PlayerIsCaught = info->sHeishi1PlayerIsCaughtCopy;
|
||||
}
|
||||
|
||||
void SaveState::SaveMiscCodeData(void) {
|
||||
|
@ -200,6 +200,9 @@ extern "C" s16 sPlayerInitialPosX;
|
||||
extern "C" s16 sPlayerInitialPosZ;
|
||||
extern "C" s16 sPlayerInitialDirection;
|
||||
|
||||
// z_en_heishi1
|
||||
extern "C" s32 sHeishi1PlayerIsCaught;
|
||||
|
||||
// code_800EC960
|
||||
// Related to ocarina
|
||||
extern "C" u8 sOcarinaInpEnabled;
|
||||
|
21
soh/soh/Lib/nlohmann/LICENSE.MIT
Normal file
21
soh/soh/Lib/nlohmann/LICENSE.MIT
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2013-2022 Niels Lohmann
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
22091
soh/soh/Lib/nlohmann/json.hpp
Normal file
22091
soh/soh/Lib/nlohmann/json.hpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,7 @@
|
||||
#include "OTRGlobals.h"
|
||||
#include "OTRAudio.h"
|
||||
#include <iostream>
|
||||
#include <filesystem>
|
||||
#include <locale>
|
||||
#include <codecvt>
|
||||
#include "GlobalCtx2.h"
|
||||
@ -43,12 +44,14 @@
|
||||
#include <Audio.h>
|
||||
|
||||
OTRGlobals* OTRGlobals::Instance;
|
||||
SaveManager* SaveManager::Instance;
|
||||
|
||||
OTRGlobals::OTRGlobals() {
|
||||
|
||||
context = Ship::GlobalCtx2::CreateInstance("Ship of Harkinian");
|
||||
gSaveStateMgr = std::make_shared<SaveStateMgr>();
|
||||
context->GetWindow()->Init();
|
||||
CheckSaveFile(SRAM_SIZE);
|
||||
}
|
||||
|
||||
OTRGlobals::~OTRGlobals() {
|
||||
@ -93,6 +96,7 @@ extern "C" void OTRExtScanner() {
|
||||
|
||||
extern "C" void InitOTR() {
|
||||
OTRGlobals::Instance = new OTRGlobals();
|
||||
SaveManager::Instance = new SaveManager();
|
||||
auto t = OTRGlobals::Instance->context->GetResourceManager()->LoadFile("version");
|
||||
|
||||
if (!t->bHasLoadError)
|
||||
@ -889,6 +893,7 @@ extern "C" AnimationHeaderCommon* ResourceMgr_LoadAnimByName(const char* path) {
|
||||
for (size_t i = 0; i < res->rotationValues.size(); i++)
|
||||
animNormal->frameData[i] = res->rotationValues[i];
|
||||
|
||||
|
||||
animNormal->jointIndices = (JointIndex*)malloc(res->rotationIndices.size() * sizeof(Vec3s));
|
||||
|
||||
for (size_t i = 0; i < res->rotationIndices.size(); i++) {
|
||||
@ -1133,6 +1138,71 @@ extern "C" s32* ResourceMgr_LoadCSByName(const char* path)
|
||||
return (s32*)res->commands.data();
|
||||
}
|
||||
|
||||
std::filesystem::path GetSaveFile(Ship::ConfigFile& Conf) {
|
||||
std::string fileName = Conf.get("SAVE").get("Save Filename");
|
||||
|
||||
if (fileName.empty()) {
|
||||
Conf["SAVE"]["Save Filename"] = "oot_save.sav";
|
||||
Conf.Save();
|
||||
}
|
||||
std::filesystem::path saveFile = std::filesystem::absolute(fileName);
|
||||
|
||||
if (!std::filesystem::exists(saveFile.parent_path())) {
|
||||
std::filesystem::create_directories(saveFile.parent_path());
|
||||
}
|
||||
|
||||
return saveFile;
|
||||
}
|
||||
|
||||
std::filesystem::path GetSaveFile() {
|
||||
std::shared_ptr<Ship::ConfigFile> pConf = OTRGlobals::Instance->context->GetConfig();
|
||||
Ship::ConfigFile& Conf = *pConf.get();
|
||||
|
||||
return GetSaveFile(Conf);
|
||||
}
|
||||
|
||||
void OTRGlobals::CheckSaveFile(size_t sramSize) {
|
||||
std::shared_ptr<Ship::ConfigFile> pConf = context->GetConfig();
|
||||
Ship::ConfigFile& Conf = *pConf.get();
|
||||
|
||||
std::filesystem::path savePath = GetSaveFile(Conf);
|
||||
std::fstream saveFile(savePath, std::fstream::in | std::fstream::out | std::fstream::binary);
|
||||
if (saveFile.fail()) {
|
||||
saveFile.open(savePath, std::fstream::in | std::fstream::out | std::fstream::binary | std::fstream::app);
|
||||
for (int i = 0; i < sramSize; ++i) {
|
||||
saveFile.write("\0", 1);
|
||||
}
|
||||
}
|
||||
saveFile.close();
|
||||
}
|
||||
|
||||
extern "C" void Ctx_ReadSaveFile(uintptr_t addr, void* dramAddr, size_t size) {
|
||||
OTRGlobals::Instance->context->ReadSaveFile(GetSaveFile(), addr, dramAddr, size);
|
||||
}
|
||||
|
||||
extern "C" void Ctx_WriteSaveFile(uintptr_t addr, void* dramAddr, size_t size) {
|
||||
OTRGlobals::Instance->context->WriteSaveFile(GetSaveFile(), addr, dramAddr, size);
|
||||
}
|
||||
|
||||
/* Remember to free after use of value */
|
||||
extern "C" char* Config_getValue(char* category, char* key) {
|
||||
std::shared_ptr<Ship::ConfigFile> pConf = OTRGlobals::Instance->context->GetConfig();
|
||||
Ship::ConfigFile& Conf = *pConf.get();
|
||||
|
||||
std::string data = Conf.get(std::string(category)).get(std::string(key));
|
||||
char* retval = (char*)malloc(data.length()+1);
|
||||
strcpy(retval, data.c_str());
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
extern "C" bool Config_setValue(char* category, char* key, char* value) {
|
||||
std::shared_ptr<Ship::ConfigFile> pConf = OTRGlobals::Instance->context->GetConfig();
|
||||
Ship::ConfigFile& Conf = *pConf.get();
|
||||
Conf[std::string(category)][std::string(key)] = std::string(value);
|
||||
return Conf.Save();
|
||||
}
|
||||
|
||||
std::wstring StringToU16(const std::string& s) {
|
||||
std::vector<unsigned long> result;
|
||||
size_t i = 0;
|
||||
|
@ -4,6 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "GlobalCtx2.h"
|
||||
#include "SaveManager.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "Enhancements/savestates.h"
|
||||
@ -19,7 +20,7 @@ public:
|
||||
~OTRGlobals();
|
||||
|
||||
private:
|
||||
|
||||
void CheckSaveFile(size_t sramSize);
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -49,11 +50,17 @@ Gfx* ResourceMgr_LoadGfxByName(const char* path);
|
||||
Gfx* ResourceMgr_PatchGfxByName(const char* path, int size);
|
||||
char* ResourceMgr_LoadArrayByNameAsVec3s(const char* path);
|
||||
Vtx* ResourceMgr_LoadVtxByCRC(uint64_t crc);
|
||||
|
||||
Vtx* ResourceMgr_LoadVtxByName(const char* path);
|
||||
SoundFont* ResourceMgr_LoadAudioSoundFont(const char* path);
|
||||
SequenceData ResourceMgr_LoadSeqByName(const char* path);
|
||||
SoundFontSample* ResourceMgr_LoadAudioSample(const char* path);
|
||||
CollisionHeader* ResourceMgr_LoadColByName(const char* path);
|
||||
void Ctx_ReadSaveFile(uintptr_t addr, void* dramAddr, size_t size);
|
||||
void Ctx_WriteSaveFile(uintptr_t addr, void* dramAddr, size_t size);
|
||||
char* Config_getValue(char* category, char* key);
|
||||
bool Config_setValue(char* category, char* key, char* value);
|
||||
|
||||
uint64_t GetPerfCounter();
|
||||
struct SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path);
|
||||
s32* ResourceMgr_LoadCSByName(const char* path);
|
||||
|
1217
soh/soh/SaveManager.cpp
Normal file
1217
soh/soh/SaveManager.cpp
Normal file
File diff suppressed because it is too large
Load Diff
149
soh/soh/SaveManager.h
Normal file
149
soh/soh/SaveManager.h
Normal file
@ -0,0 +1,149 @@
|
||||
#pragma once
|
||||
|
||||
#include <ultra64/gbi.h>
|
||||
|
||||
typedef struct {
|
||||
u8 valid;
|
||||
u16 deaths;
|
||||
char playerName[8];
|
||||
u16 healthCapacity;
|
||||
u32 questItems;
|
||||
s8 defense;
|
||||
u16 health;
|
||||
u8 n64ddFlag;
|
||||
} SaveFileMetaInfo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include <filesystem>
|
||||
|
||||
#include "Lib/nlohmann/json.hpp"
|
||||
|
||||
class SaveManager {
|
||||
public:
|
||||
static SaveManager* Instance;
|
||||
|
||||
using InitFunc = void(*)(bool isDebug);
|
||||
using LoadFunc = void(*)();
|
||||
using SaveFunc = void(*)();
|
||||
using PostFunc = void(*)(int version);
|
||||
|
||||
SaveManager();
|
||||
|
||||
void Init();
|
||||
void InitFile(bool isDebug);
|
||||
void SaveFile(int fileNum);
|
||||
void SaveGlobal();
|
||||
void LoadFile(int fileNum);
|
||||
|
||||
// Adds a function that is called when we are intializing a save, including when we are loading a save.
|
||||
void AddInitFunction(InitFunc func);
|
||||
|
||||
// Adds a function to handling loading a section
|
||||
void AddLoadFunction(const std::string& name, int version, LoadFunc func);
|
||||
|
||||
// Adds a function that is called when saving. This should only be called once for each function, the version is filled in automatically.
|
||||
void AddSaveFunction(const std::string& name, int version, SaveFunc func);
|
||||
|
||||
// Adds a function to be called after loading is complete. This is to handle any cleanup required from loading old versions.
|
||||
void AddPostFunction(const std::string& name, PostFunc func);
|
||||
|
||||
void CopyZeldaFile(int from, int to);
|
||||
void DeleteZeldaFile(int fileNum);
|
||||
|
||||
// Use a name of "" to save to an array. You must be in a SaveArray callback.
|
||||
template<typename T>
|
||||
void SaveData(const std::string& name, const T& data) {
|
||||
if (name == "") {
|
||||
assert((*currentJsonContext).is_array());
|
||||
(*currentJsonContext).push_back(data);
|
||||
} else {
|
||||
(*currentJsonContext)[name.c_str()] = data;
|
||||
}
|
||||
}
|
||||
|
||||
// In the SaveArrayFunc func, the name must be "" to save to the array.
|
||||
using SaveArrayFunc = std::function<void(size_t)>;
|
||||
void SaveArray(const std::string& name, const size_t size, SaveArrayFunc func);
|
||||
|
||||
using SaveStructFunc = std::function<void()>;
|
||||
void SaveStruct(const std::string& name, SaveStructFunc func);
|
||||
|
||||
// Use a name of "" to load from an array. You must be in a LoadArray callback.
|
||||
template<typename T> void LoadData(const std::string& name, T& data, const T& defaultValue = T{}) {
|
||||
if (name == "") {
|
||||
if (currentJsonArrayContext == currentJsonContext->end()) {
|
||||
// This array member is past the data in the json file. Therefore, default construct it
|
||||
data = defaultValue;
|
||||
} else {
|
||||
currentJsonArrayContext.value().get_to(data);
|
||||
}
|
||||
} else if (!currentJsonContext->contains(name.c_str())) {
|
||||
data = defaultValue;
|
||||
} else {
|
||||
(*currentJsonContext)[name.c_str()].get_to(data);
|
||||
}
|
||||
}
|
||||
|
||||
// In the LoadArrayFunc func, the name must be "" to load from the array.
|
||||
using LoadArrayFunc = std::function<void(size_t)>;
|
||||
void LoadArray(const std::string& name, const size_t size, LoadArrayFunc func);
|
||||
|
||||
using LoadStructFunc = std::function<void()>;
|
||||
void LoadStruct(const std::string& name, LoadStructFunc func);
|
||||
|
||||
static const int MaxFiles = 3;
|
||||
std::array<SaveFileMetaInfo, MaxFiles> fileMetaInfo;
|
||||
|
||||
private:
|
||||
std::filesystem::path GetFileName(int fileNum);
|
||||
|
||||
void ConvertFromUnversioned();
|
||||
void CreateDefaultGlobal();
|
||||
|
||||
void InitMeta(int slotNum);
|
||||
static void InitFileImpl(bool isDebug);
|
||||
static void InitFileNormal();
|
||||
static void InitFileDebug();
|
||||
|
||||
static void LoadBaseVersion1();
|
||||
static void SaveBase();
|
||||
|
||||
std::vector<InitFunc> initFuncs;
|
||||
|
||||
using SectionLoadHandler = std::map<int, LoadFunc>;
|
||||
std::map<std::string, SectionLoadHandler> sectionLoadHandlers;
|
||||
|
||||
using SectionSaveHandler = std::pair<int, SaveFunc>;
|
||||
std::map<std::string, SectionSaveHandler> sectionSaveHandlers;
|
||||
|
||||
std::map<std::string, PostFunc> postHandlers;
|
||||
|
||||
nlohmann::json* currentJsonContext = nullptr;
|
||||
nlohmann::json::iterator currentJsonArrayContext;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
// TODO feature parity to the C++ interface. We need Save_AddInitFunction and Save_AddPostFunction at least
|
||||
|
||||
typedef void (*Save_LoadFunc)(void);
|
||||
typedef void (*Save_SaveFunc)(void);
|
||||
|
||||
void Save_Init(void);
|
||||
void Save_InitFile(int isDebug);
|
||||
void Save_SaveFile(void);
|
||||
void Save_SaveGlobal(void);
|
||||
void Save_LoadGlobal(void);
|
||||
void Save_AddLoadFunction(char* name, int version, Save_LoadFunc func);
|
||||
void Save_AddSaveFunction(char* name, int version, Save_SaveFunc func);
|
||||
SaveFileMetaInfo* Save_GetSaveMetaInfo(int fileNum);
|
||||
void Save_CopyFile(int from, int to);
|
||||
void Save_DeleteFile(int fileNum);
|
||||
|
||||
#endif
|
@ -7532,7 +7532,7 @@ Vec3s Camera_Update(Camera* camera) {
|
||||
BINANG_TO_DEGF(camera->camDir.x), camera->camDir.y, BINANG_TO_DEGF(camera->camDir.y));
|
||||
}
|
||||
|
||||
if (camera->timer != -1 && CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_DRIGHT)) {
|
||||
if (camera->timer != -1 && CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_DRIGHT) && CVar_GetS32("gDebugCamera", 0)) {
|
||||
camera->timer = 0;
|
||||
}
|
||||
|
||||
|
@ -2,13 +2,9 @@
|
||||
#include <string.h>
|
||||
|
||||
SaveContext gSaveContext;
|
||||
u32 D_8015FA88;
|
||||
u32 D_8015FA8C;
|
||||
|
||||
void SaveContext_Init(void) {
|
||||
memset(&gSaveContext, 0, sizeof(gSaveContext));
|
||||
D_8015FA88 = 0;
|
||||
D_8015FA8C = 0;
|
||||
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
|
||||
gSaveContext.natureAmbienceId = NATURE_ID_DISABLED;
|
||||
gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX;
|
||||
|
@ -240,7 +240,6 @@ void Gameplay_Init(GameState* thisx) {
|
||||
globalCtx->cameraPtrs[MAIN_CAM]->uid = 0;
|
||||
globalCtx->activeCamera = MAIN_CAM;
|
||||
func_8005AC48(&globalCtx->mainCamera, 0xFF);
|
||||
Sram_Init(globalCtx, &globalCtx->sramCtx);
|
||||
func_80112098(globalCtx);
|
||||
Message_Init(globalCtx);
|
||||
GameOver_Init(globalCtx);
|
||||
|
@ -3,242 +3,14 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
// these are the main substructs of save context.
|
||||
// we are going to hold off on splitting save context until later on,
|
||||
// so these temporary structs will live here for now.
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ char newf[6]; // string "ZELDAZ"
|
||||
/* 0x06 */ s16 deaths;
|
||||
/* 0x08 */ char playerName[8];
|
||||
/* 0x10 */ s16 n64ddFlag;
|
||||
/* 0x12 */ s16 healthCapacity; // "max_life"
|
||||
/* 0x14 */ s16 health; // "now_life"
|
||||
/* 0x16 */ s8 magicLevel;
|
||||
/* 0x17 */ s8 magic;
|
||||
/* 0x18 */ s16 rupees;
|
||||
/* 0x1A */ u16 swordHealth;
|
||||
/* 0x1C */ u16 naviTimer;
|
||||
/* 0x1E */ u8 magicAcquired;
|
||||
/* 0x1F */ u8 unk_1F;
|
||||
/* 0x20 */ u8 doubleMagic;
|
||||
/* 0x21 */ u8 doubleDefense;
|
||||
/* 0x22 */ u8 bgsFlag;
|
||||
/* 0x23 */ u8 ocarinaGameRoundNum;
|
||||
/* 0x24 */ ItemEquips childEquips;
|
||||
/* 0x2E */ ItemEquips adultEquips;
|
||||
/* 0x38 */ u32 unk_38; // this may be incorrect, currently used for alignement
|
||||
/* 0x3C */ char unk_3C[0x0E];
|
||||
/* 0x4A */ s16 savedSceneNum;
|
||||
} SavePlayerData; // size = 0x4C
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ SavePlayerData playerData; // "S_Private" substruct name
|
||||
/* 0x004C */ ItemEquips equips;
|
||||
/* 0x0058 */ Inventory inventory;
|
||||
/* 0x00B8 */ SavedSceneFlags sceneFlags[124];
|
||||
/* 0x0E48 */ FaroresWindData fw;
|
||||
/* 0x0E70 */ char unk_E70[0x10];
|
||||
/* 0x0E80 */ s32 gsFlags[6];
|
||||
/* 0x0E98 */ char unk_E98[0x10];
|
||||
/* 0x0EA8 */ s32 horseRaceRecord;
|
||||
/* 0x0EAC */ char unk_EAC[0x0C];
|
||||
/* 0x0EB8 */ u16 eventChkInf[14]; // "event_chk_inf"
|
||||
/* 0x0ED4 */ u16 itemGetInf[4]; // "item_get_inf"
|
||||
/* 0x0EDC */ u16 infTable[30]; // "inf_table"
|
||||
/* 0x0F18 */ char unk_F18[0x04];
|
||||
/* 0x0F1C */ u32 worldMapAreaData; // "area_arrival"
|
||||
/* 0x0F20 */ char unk_F20[0x4];
|
||||
/* 0x0F24 */ u8 scarecrowCustomSongSet;
|
||||
/* 0x0F25 */ u8 scarecrowCustomSong[0x360];
|
||||
/* 0x1285 */ char unk_1285[0x24];
|
||||
/* 0x12A9 */ u8 scarecrowSpawnSongSet;
|
||||
/* 0x12AA */ u8 scarecrowSpawnSong[0x80];
|
||||
/* 0x132A */ char unk_132A[0x02];
|
||||
/* 0x132C */ HorseData horseData;
|
||||
/* 0x1336 */ u16 checksum; // "check_sum"
|
||||
} SaveInfo; // size = 0x1338
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s32 entranceIndex;
|
||||
/* 0x04 */ s32 linkAge; // 0: Adult; 1: Child
|
||||
/* 0x08 */ s32 cutsceneIndex;
|
||||
/* 0x0C */ u16 dayTime; // "zelda_time"
|
||||
/* 0x10 */ s32 nightFlag;
|
||||
/* 0x14 */ s32 totalDays;
|
||||
/* 0x18 */ s32 unk_18; // increments with totalDays, gets reset by goron for bgs and one other use
|
||||
/* 0x1C */ SaveInfo info; // "information"
|
||||
} Save; // size = 0x1354
|
||||
|
||||
#define SAVE_PLAYER_DATA (*((SavePlayerData*)&gSaveContext.newf))
|
||||
#define SAVE_INFO (*((SaveInfo*)&gSaveContext.newf))
|
||||
|
||||
#define SLOT_SIZE (sizeof(SaveContext) + 0x28)
|
||||
#define CHECKSUM_SIZE (sizeof(Save) / 2)
|
||||
|
||||
#define DEATHS OFFSETOF(SaveContext, deaths)
|
||||
#define NAME OFFSETOF(SaveContext, playerName)
|
||||
#define N64DD OFFSETOF(SaveContext, n64ddFlag)
|
||||
#define HEALTH_CAP OFFSETOF(SaveContext, healthCapacity)
|
||||
#define QUEST OFFSETOF(SaveContext, inventory.questItems)
|
||||
#define DEFENSE OFFSETOF(SaveContext, inventory.defenseHearts)
|
||||
#define HEALTH OFFSETOF(SaveContext, health)
|
||||
|
||||
#define SLOT_OFFSET(index) (SRAM_HEADER_SIZE + 0x10 + (index * SLOT_SIZE))
|
||||
|
||||
u16 gSramSlotOffsets[] = {
|
||||
SLOT_OFFSET(0),
|
||||
SLOT_OFFSET(1),
|
||||
SLOT_OFFSET(2),
|
||||
// the latter three saves are backup saves for the former saves
|
||||
SLOT_OFFSET(3),
|
||||
SLOT_OFFSET(4),
|
||||
SLOT_OFFSET(5),
|
||||
};
|
||||
|
||||
static u8 sZeldaMagic[] = { '\0', '\0', '\0', '\x98', '\x09', '\x10', '\x21', 'Z', 'E', 'L', 'D', 'A' };
|
||||
|
||||
static SavePlayerData sNewSavePlayerData = {
|
||||
{ '\0', '\0', '\0', '\0', '\0', '\0' }, // newf
|
||||
0, // deaths
|
||||
{ 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E }, // playerName
|
||||
0, // n64ddFlag
|
||||
0x30, // healthCapacity
|
||||
0x30, // defense
|
||||
0, // magicLevel
|
||||
0x30, // magic
|
||||
0, // rupees
|
||||
0, // swordHealth
|
||||
0, // naviTimer
|
||||
0, // magicAcquired
|
||||
0, // unk_1F
|
||||
0, // doubleMagic
|
||||
0, // doubleDefense
|
||||
0, // bgsFlag
|
||||
0, // ocarinaGameRoundNum
|
||||
{
|
||||
{ ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE }, // buttonItems
|
||||
{ SLOT_NONE, SLOT_NONE, SLOT_NONE }, // cButtonSlots
|
||||
0, // equipment
|
||||
}, // childEquips
|
||||
{
|
||||
{ ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE }, // buttonItems
|
||||
{ SLOT_NONE, SLOT_NONE, SLOT_NONE }, // cButtonSlots
|
||||
0, // equipment
|
||||
}, // adultEquips
|
||||
0, // unk_38
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // unk_3C
|
||||
0x34, // savedSceneNum
|
||||
};
|
||||
|
||||
static ItemEquips sNewSaveEquips = {
|
||||
{ ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE }, // buttonItems
|
||||
{ SLOT_NONE, SLOT_NONE, SLOT_NONE }, // cButtonSlots
|
||||
0x1100, // equipment
|
||||
};
|
||||
|
||||
static Inventory sNewSaveInventory = {
|
||||
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, // items
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // ammo
|
||||
0x1100, // equipment
|
||||
0, // upgrades
|
||||
0, // questItems
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // dungeonItems
|
||||
{
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
}, // dungeonKeys
|
||||
0, // defenseHearts
|
||||
0, // gsTokens
|
||||
};
|
||||
|
||||
static u16 sNewSaveChecksum = 0;
|
||||
|
||||
/**
|
||||
* Initialize new save.
|
||||
* This save has an empty inventory with 3 hearts and single magic.
|
||||
*/
|
||||
void Sram_InitNewSave(void) {
|
||||
SaveContext* temp = &gSaveContext;
|
||||
|
||||
memset(&SAVE_INFO, 0, sizeof(SaveInfo));
|
||||
gSaveContext.totalDays = 0;
|
||||
gSaveContext.bgsDayCount = 0;
|
||||
|
||||
SAVE_PLAYER_DATA = sNewSavePlayerData;
|
||||
gSaveContext.equips = sNewSaveEquips;
|
||||
gSaveContext.inventory = sNewSaveInventory;
|
||||
|
||||
temp->checksum = sNewSaveChecksum;
|
||||
gSaveContext.horseData.scene = SCENE_SPOT00;
|
||||
gSaveContext.horseData.pos.x = -1840;
|
||||
gSaveContext.horseData.pos.y = 72;
|
||||
gSaveContext.horseData.pos.z = 5497;
|
||||
gSaveContext.horseData.angle = -0x6AD9;
|
||||
gSaveContext.magicLevel = 0;
|
||||
gSaveContext.infTable[29] = 1;
|
||||
gSaveContext.sceneFlags[5].swch = 0x40000000;
|
||||
Save_InitFile(false);
|
||||
}
|
||||
|
||||
static SavePlayerData sDebugSavePlayerData = {
|
||||
{ 'Z', 'E', 'L', 'D', 'A', 'Z' }, // newf
|
||||
0, // deaths
|
||||
{ 0x15, 0x12, 0x17, 0x14, 0x3E, 0x3E, 0x3E, 0x3E }, // playerName ( "LINK" )
|
||||
0, // n64ddFlag
|
||||
0xE0, // healthCapacity
|
||||
0xE0, // health
|
||||
0, // magicLevel
|
||||
0x30, // magic
|
||||
150, // rupees
|
||||
8, // swordHealth
|
||||
0, // naviTimer
|
||||
1, // magicAcquired
|
||||
0, // unk_1F
|
||||
0, // doubleMagic
|
||||
0, // doubleDefense
|
||||
0, // bgsFlag
|
||||
0, // ocarinaGameRoundNum
|
||||
{
|
||||
{ ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE }, // buttonItems
|
||||
{ SLOT_NONE, SLOT_NONE, SLOT_NONE }, // cButtonSlots
|
||||
0, // equipment
|
||||
}, // childEquips
|
||||
{
|
||||
{ ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE }, // buttonItems
|
||||
{ SLOT_NONE, SLOT_NONE, SLOT_NONE }, // cButtonSlots
|
||||
0, // equipment
|
||||
}, // adultEquips
|
||||
0, // unk_38
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // unk_3C
|
||||
0x51, // savedSceneNum
|
||||
};
|
||||
|
||||
static ItemEquips sDebugSaveEquips = {
|
||||
{ ITEM_SWORD_MASTER, ITEM_BOW, ITEM_BOMB, ITEM_OCARINA_FAIRY }, // buttonItems
|
||||
{ SLOT_BOW, SLOT_BOMB, SLOT_OCARINA }, // cButtonSlots
|
||||
0x1122, // equipment
|
||||
};
|
||||
|
||||
static Inventory sDebugSaveInventory = {
|
||||
{
|
||||
ITEM_STICK, ITEM_NUT, ITEM_BOMB, ITEM_BOW, ITEM_ARROW_FIRE, ITEM_DINS_FIRE,
|
||||
ITEM_SLINGSHOT, ITEM_OCARINA_FAIRY, ITEM_BOMBCHU, ITEM_HOOKSHOT, ITEM_ARROW_ICE, ITEM_FARORES_WIND,
|
||||
ITEM_BOOMERANG, ITEM_LENS, ITEM_BEAN, ITEM_HAMMER, ITEM_ARROW_LIGHT, ITEM_NAYRUS_LOVE,
|
||||
ITEM_BOTTLE, ITEM_POTION_RED, ITEM_POTION_GREEN, ITEM_POTION_BLUE, ITEM_POCKET_EGG, ITEM_WEIRD_EGG,
|
||||
}, // items
|
||||
{ 50, 50, 10, 30, 1, 1, 30, 1, 50, 1, 1, 1, 1, 1, 1, 1 }, // ammo
|
||||
0x7777, // equipment
|
||||
0x125249, // upgrades
|
||||
0x1E3FFFF, // questItems
|
||||
{ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // dungeonItems
|
||||
{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 }, // dungeonKeys
|
||||
0, // defenseHearts
|
||||
0, // gsTokens
|
||||
};
|
||||
|
||||
static u16 sDebugSaveChecksum = 0;
|
||||
|
||||
/**
|
||||
* Initialize debug save. This is also used on the Title Screen
|
||||
* This save has a mostly full inventory with 10 hearts and single magic.
|
||||
@ -249,40 +21,7 @@ static u16 sDebugSaveChecksum = 0;
|
||||
* and set water level in Water Temple to lowest level.
|
||||
*/
|
||||
void Sram_InitDebugSave(void) {
|
||||
SaveContext* temp = &gSaveContext;
|
||||
|
||||
memset(&SAVE_INFO, 0, sizeof(SaveInfo));
|
||||
gSaveContext.totalDays = 0;
|
||||
gSaveContext.bgsDayCount = 0;
|
||||
|
||||
SAVE_PLAYER_DATA = sDebugSavePlayerData;
|
||||
gSaveContext.equips = sDebugSaveEquips;
|
||||
gSaveContext.inventory = sDebugSaveInventory;
|
||||
|
||||
temp->checksum = sDebugSaveChecksum;
|
||||
gSaveContext.horseData.scene = SCENE_SPOT00;
|
||||
gSaveContext.horseData.pos.x = -1840;
|
||||
gSaveContext.horseData.pos.y = 72;
|
||||
gSaveContext.horseData.pos.z = 5497;
|
||||
gSaveContext.horseData.angle = -0x6AD9;
|
||||
gSaveContext.infTable[0] |= 0x5009;
|
||||
gSaveContext.eventChkInf[0] |= 0x123F;
|
||||
gSaveContext.eventChkInf[8] |= 1;
|
||||
gSaveContext.eventChkInf[12] |= 0x10;
|
||||
|
||||
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
|
||||
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KOKIRI;
|
||||
Inventory_ChangeEquipment(EQUIP_SWORD, 1);
|
||||
if (gSaveContext.fileNum == 0xFF) {
|
||||
gSaveContext.equips.buttonItems[1] = ITEM_SLINGSHOT;
|
||||
gSaveContext.equips.cButtonSlots[0] = SLOT_SLINGSHOT;
|
||||
Inventory_ChangeEquipment(EQUIP_SHIELD, 1);
|
||||
}
|
||||
}
|
||||
|
||||
gSaveContext.entranceIndex = 0xCD;
|
||||
gSaveContext.magicLevel = 0;
|
||||
gSaveContext.sceneFlags[5].swch = 0x40000000;
|
||||
Save_InitFile(true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -295,7 +34,7 @@ void Sram_InitDebugSave(void) {
|
||||
* - Give and equip master sword if player is adult and doesnt have kokiri sword (bug?)
|
||||
* - Revert any trade items that spoil
|
||||
*/
|
||||
void Sram_OpenSave(SramContext* sramCtx) {
|
||||
void Sram_OpenSave() {
|
||||
static s16 dungeonEntrances[] = {
|
||||
0x0000, 0x0004, 0x0028, 0x0169, 0x0165, 0x0010, 0x0082, 0x0037,
|
||||
0x0098, 0x0088, 0x041B, 0x0008, 0x0486, 0x0467, 0x0179, 0x056C,
|
||||
@ -304,15 +43,7 @@ void Sram_OpenSave(SramContext* sramCtx) {
|
||||
u16 j;
|
||||
u8* ptr;
|
||||
|
||||
osSyncPrintf("個人File作成\n"); // "Create personal file"
|
||||
i = gSramSlotOffsets[gSaveContext.fileNum];
|
||||
osSyncPrintf("ぽいんと=%x(%d)\n", i, gSaveContext.fileNum); // "Point="
|
||||
|
||||
memcpy(&gSaveContext, sramCtx->readBuff + i, sizeof(Save));
|
||||
|
||||
osSyncPrintf(VT_FGCOL(YELLOW));
|
||||
osSyncPrintf("SCENE_DATA_ID = %d SceneNo = %d\n", gSaveContext.savedSceneNum,
|
||||
((void)0, gSaveContext.entranceIndex));
|
||||
Save_LoadFile();
|
||||
|
||||
switch (gSaveContext.savedSceneNum) {
|
||||
case SCENE_YDAN:
|
||||
@ -446,232 +177,7 @@ void Sram_OpenSave(SramContext* sramCtx) {
|
||||
gSaveContext.magicLevel = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the contents of the Save Context to a main and backup slot in SRAM.
|
||||
* Note: The whole Save Context is written even though only the `save` substruct is read back later
|
||||
*/
|
||||
void Sram_WriteSave(SramContext* sramCtx) {
|
||||
u16 offset;
|
||||
u16 checksum;
|
||||
u16 j;
|
||||
u16* ptr;
|
||||
|
||||
gSaveContext.checksum = 0;
|
||||
|
||||
ptr = (u16*)&gSaveContext;
|
||||
checksum = 0;
|
||||
j = 0;
|
||||
|
||||
for (offset = 0; offset < CHECKSUM_SIZE; offset++) {
|
||||
if (++j == 0x20) {
|
||||
j = 0;
|
||||
}
|
||||
checksum += *ptr++;
|
||||
}
|
||||
|
||||
gSaveContext.checksum = checksum;
|
||||
|
||||
ptr = (u16*)&gSaveContext;
|
||||
checksum = 0;
|
||||
|
||||
for (offset = 0; offset < CHECKSUM_SIZE; offset++) {
|
||||
if (++j == 0x20) {
|
||||
j = 0;
|
||||
}
|
||||
checksum += *ptr++;
|
||||
}
|
||||
|
||||
offset = gSramSlotOffsets[gSaveContext.fileNum];
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE, OS_WRITE);
|
||||
|
||||
ptr = (u16*)&gSaveContext;
|
||||
checksum = 0;
|
||||
|
||||
for (offset = 0; offset < CHECKSUM_SIZE; offset++) {
|
||||
if (++j == 0x20) {
|
||||
j = 0;
|
||||
}
|
||||
checksum += *ptr++;
|
||||
}
|
||||
|
||||
offset = gSramSlotOffsets[gSaveContext.fileNum + 3];
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE, OS_WRITE);
|
||||
}
|
||||
|
||||
/**
|
||||
* For all 3 slots, verify that the checksum is correct. If corrupted, attempt to load a backup save.
|
||||
* If backup is also corrupted, default to a new save (or debug save for slot 0 on debug rom).
|
||||
*
|
||||
* After verifying all 3 saves, pass relevant data to File Select to be displayed.
|
||||
*/
|
||||
void Sram_VerifyAndLoadAllSaves(FileChooseContext* fileChooseCtx, SramContext* sramCtx) {
|
||||
u16 i;
|
||||
u16 newChecksum;
|
||||
u16 slotNum;
|
||||
u16 offset;
|
||||
u16 j;
|
||||
u16 oldChecksum;
|
||||
u16* ptr;
|
||||
u16 dayTime;
|
||||
|
||||
osSyncPrintf("SRAM START─LOAD\n");
|
||||
memset(sramCtx->readBuff,0, SRAM_SIZE);
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ);
|
||||
|
||||
dayTime = ((void)0, gSaveContext.dayTime);
|
||||
|
||||
for (slotNum = 0; slotNum < 3; slotNum++) {
|
||||
offset = gSramSlotOffsets[slotNum];
|
||||
osSyncPrintf("ぽいんと=%x(%d) SAVE_MAX=%d\n", offset, gSaveContext.fileNum, sizeof(Save));
|
||||
memcpy(&gSaveContext, sramCtx->readBuff + offset, sizeof(Save));
|
||||
|
||||
oldChecksum = gSaveContext.checksum;
|
||||
gSaveContext.checksum = 0;
|
||||
ptr = (u16*)&gSaveContext;
|
||||
osSyncPrintf("\n============= S(%d) =============\n", slotNum);
|
||||
|
||||
for (i = newChecksum = j = 0; i < CHECKSUM_SIZE; i++, offset += 2) {
|
||||
newChecksum += *ptr++;
|
||||
}
|
||||
|
||||
// "SAVE checksum calculation"
|
||||
osSyncPrintf("\nSAVEチェックサム計算 j=%x mmm=%x ", newChecksum, oldChecksum);
|
||||
|
||||
if (newChecksum != oldChecksum) {
|
||||
// checksum didnt match, try backup save
|
||||
osSyncPrintf("ERROR!!! = %x(%d)\n", gSramSlotOffsets[slotNum], slotNum);
|
||||
offset = gSramSlotOffsets[slotNum + 3];
|
||||
memcpy(&gSaveContext, sramCtx->readBuff + offset, sizeof(Save));
|
||||
|
||||
oldChecksum = gSaveContext.checksum;
|
||||
gSaveContext.checksum = 0;
|
||||
ptr = (u16*)&gSaveContext;
|
||||
osSyncPrintf("================= BACK─UP ========================\n");
|
||||
|
||||
for (i = newChecksum = j = 0; i < CHECKSUM_SIZE; i++, offset += 2) {
|
||||
newChecksum += *ptr++;
|
||||
}
|
||||
// "(B) SAVE checksum calculation"
|
||||
osSyncPrintf("\n(B)SAVEチェックサム計算 j=%x mmm=%x ", newChecksum, oldChecksum);
|
||||
|
||||
if (newChecksum != oldChecksum) {
|
||||
// backup save didnt work, make new save
|
||||
osSyncPrintf("ERROR!!! = %x(%d+3)\n", gSramSlotOffsets[slotNum + 3], slotNum);
|
||||
memset(&gSaveContext.entranceIndex, 0, sizeof(s32));
|
||||
memset(&gSaveContext.linkAge, 0, sizeof(s32));
|
||||
memset(&gSaveContext.cutsceneIndex, 0, sizeof(s32));
|
||||
// note that gSaveContext.dayTime is not actually the sizeof(s32)
|
||||
memset(&gSaveContext.dayTime, 0, sizeof(s32));
|
||||
memset(&gSaveContext.nightFlag, 0, sizeof(s32));
|
||||
memset(&gSaveContext.totalDays, 0, sizeof(s32));
|
||||
memset(&gSaveContext.bgsDayCount, 0, sizeof(s32));
|
||||
|
||||
if (!slotNum && CVar_GetS32("gDebugEnabled", 0)) {
|
||||
Sram_InitDebugSave();
|
||||
gSaveContext.newf[0] = 'Z';
|
||||
gSaveContext.newf[1] = 'E';
|
||||
gSaveContext.newf[2] = 'L';
|
||||
gSaveContext.newf[3] = 'D';
|
||||
gSaveContext.newf[4] = 'A';
|
||||
gSaveContext.newf[5] = 'Z';
|
||||
osSyncPrintf("newf=%x,%x,%x,%x,%x,%x\n", gSaveContext.newf[0], gSaveContext.newf[1],
|
||||
gSaveContext.newf[2], gSaveContext.newf[3], gSaveContext.newf[4],
|
||||
gSaveContext.newf[5]);
|
||||
} else {
|
||||
Sram_InitNewSave();
|
||||
}
|
||||
|
||||
ptr = (u16*)&gSaveContext;
|
||||
osSyncPrintf("\n--------------------------------------------------------------\n");
|
||||
|
||||
for (i = newChecksum = j = 0; i < CHECKSUM_SIZE; i++) {
|
||||
osSyncPrintf("%x ", *ptr);
|
||||
if (++j == 0x20) {
|
||||
osSyncPrintf("\n");
|
||||
j = 0;
|
||||
}
|
||||
newChecksum += *ptr++;
|
||||
}
|
||||
|
||||
gSaveContext.checksum = newChecksum;
|
||||
osSyncPrintf("\nCheck_Sum=%x(%x)\n", gSaveContext.checksum, newChecksum);
|
||||
|
||||
i = gSramSlotOffsets[slotNum + 3];
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + i, &gSaveContext, SLOT_SIZE, OS_WRITE);
|
||||
|
||||
osSyncPrintf("????#%x,%x,%x,%x,%x,%x\n", gSaveContext.newf[0], gSaveContext.newf[1],
|
||||
gSaveContext.newf[2], gSaveContext.newf[3], gSaveContext.newf[4], gSaveContext.newf[5]);
|
||||
osSyncPrintf("\nぽいんと=%x(%d+3) check_sum=%x(%x)\n", i, slotNum, gSaveContext.checksum,
|
||||
newChecksum);
|
||||
}
|
||||
|
||||
i = gSramSlotOffsets[slotNum];
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + i, &gSaveContext, SLOT_SIZE, OS_WRITE);
|
||||
|
||||
osSyncPrintf("ぽいんと=%x(%d) check_sum=%x(%x)\n", i, slotNum, gSaveContext.checksum, newChecksum);
|
||||
} else {
|
||||
osSyncPrintf("\nSAVEデータ OK!!!!\n"); // "SAVE data OK! ! ! !"
|
||||
}
|
||||
}
|
||||
|
||||
memset(sramCtx->readBuff,0, SRAM_SIZE);
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ);
|
||||
gSaveContext.dayTime = dayTime;
|
||||
|
||||
osSyncPrintf("SAVECT=%x, NAME=%x, LIFE=%x, ITEM=%x, 64DD=%x, HEART=%x\n", DEATHS, NAME, HEALTH_CAP, QUEST, N64DD,
|
||||
DEFENSE);
|
||||
|
||||
memcpy(&fileChooseCtx->deaths[0], sramCtx->readBuff + SLOT_OFFSET(0) + DEATHS, sizeof(fileChooseCtx->deaths[0]));
|
||||
memcpy(&fileChooseCtx->deaths[1], sramCtx->readBuff + SLOT_OFFSET(1) + DEATHS, sizeof(fileChooseCtx->deaths[0]));
|
||||
memcpy(&fileChooseCtx->deaths[2], sramCtx->readBuff + SLOT_OFFSET(2) + DEATHS, sizeof(fileChooseCtx->deaths[0]));
|
||||
|
||||
memcpy(&fileChooseCtx->fileNames[0], sramCtx->readBuff + SLOT_OFFSET(0) + NAME,
|
||||
sizeof(fileChooseCtx->fileNames[0]));
|
||||
memcpy(&fileChooseCtx->fileNames[1], sramCtx->readBuff + SLOT_OFFSET(1) + NAME,
|
||||
sizeof(fileChooseCtx->fileNames[0]));
|
||||
memcpy(&fileChooseCtx->fileNames[2], sramCtx->readBuff + SLOT_OFFSET(2) + NAME,
|
||||
sizeof(fileChooseCtx->fileNames[0]));
|
||||
|
||||
memcpy(&fileChooseCtx->healthCapacities[0], sramCtx->readBuff + SLOT_OFFSET(0) + HEALTH_CAP,
|
||||
sizeof(fileChooseCtx->healthCapacities[0]));
|
||||
memcpy(&fileChooseCtx->healthCapacities[1], sramCtx->readBuff + SLOT_OFFSET(1) + HEALTH_CAP,
|
||||
sizeof(fileChooseCtx->healthCapacities[0]));
|
||||
memcpy(&fileChooseCtx->healthCapacities[2], sramCtx->readBuff + SLOT_OFFSET(2) + HEALTH_CAP,
|
||||
sizeof(fileChooseCtx->healthCapacities[0]));
|
||||
|
||||
memcpy(&fileChooseCtx->questItems[0], sramCtx->readBuff + SLOT_OFFSET(0) + QUEST,
|
||||
sizeof(fileChooseCtx->questItems[0]));
|
||||
memcpy(&fileChooseCtx->questItems[1], sramCtx->readBuff + SLOT_OFFSET(1) + QUEST,
|
||||
sizeof(fileChooseCtx->questItems[0]));
|
||||
memcpy(&fileChooseCtx->questItems[2], sramCtx->readBuff + SLOT_OFFSET(2) + QUEST,
|
||||
sizeof(fileChooseCtx->questItems[0]));
|
||||
|
||||
memcpy(&fileChooseCtx->n64ddFlags[0], sramCtx->readBuff + SLOT_OFFSET(0) + N64DD,
|
||||
sizeof(fileChooseCtx->n64ddFlags[0]));
|
||||
memcpy(&fileChooseCtx->n64ddFlags[1], sramCtx->readBuff + SLOT_OFFSET(1) + N64DD,
|
||||
sizeof(fileChooseCtx->n64ddFlags[0]));
|
||||
memcpy(&fileChooseCtx->n64ddFlags[2], sramCtx->readBuff + SLOT_OFFSET(2) + N64DD,
|
||||
sizeof(fileChooseCtx->n64ddFlags[0]));
|
||||
|
||||
memcpy(&fileChooseCtx->defense[0], sramCtx->readBuff + SLOT_OFFSET(0) + DEFENSE,
|
||||
sizeof(fileChooseCtx->defense[0]));
|
||||
memcpy(&fileChooseCtx->defense[1], sramCtx->readBuff + SLOT_OFFSET(1) + DEFENSE,
|
||||
sizeof(fileChooseCtx->defense[0]));
|
||||
memcpy(&fileChooseCtx->defense[2], sramCtx->readBuff + SLOT_OFFSET(2) + DEFENSE,
|
||||
sizeof(fileChooseCtx->defense[0]));
|
||||
|
||||
memcpy(&fileChooseCtx->health[0], sramCtx->readBuff + SLOT_OFFSET(0) + HEALTH, sizeof(fileChooseCtx->health[0]));
|
||||
memcpy(&fileChooseCtx->health[1], sramCtx->readBuff + SLOT_OFFSET(1) + HEALTH, sizeof(fileChooseCtx->health[0]));
|
||||
memcpy(&fileChooseCtx->health[2], sramCtx->readBuff + SLOT_OFFSET(2) + HEALTH, sizeof(fileChooseCtx->health[0]));
|
||||
|
||||
osSyncPrintf("f_64dd=%d, %d, %d\n", fileChooseCtx->n64ddFlags[0], fileChooseCtx->n64ddFlags[1],
|
||||
fileChooseCtx->n64ddFlags[2]);
|
||||
osSyncPrintf("heart_status=%d, %d, %d\n", fileChooseCtx->defense[0], fileChooseCtx->defense[1],
|
||||
fileChooseCtx->defense[2]);
|
||||
osSyncPrintf("now_life=%d, %d, %d\n", fileChooseCtx->health[0], fileChooseCtx->health[1], fileChooseCtx->health[2]);
|
||||
}
|
||||
|
||||
void Sram_InitSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) {
|
||||
void Sram_InitSave(FileChooseContext* fileChooseCtx) {
|
||||
u16 offset;
|
||||
u16 j;
|
||||
u16* ptr;
|
||||
@ -693,189 +199,14 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) {
|
||||
}
|
||||
|
||||
for (offset = 0; offset < 8; offset++) {
|
||||
gSaveContext.playerName[offset] = fileChooseCtx->fileNames[fileChooseCtx->buttonIndex][offset];
|
||||
gSaveContext.playerName[offset] = Save_GetSaveMetaInfo(fileChooseCtx->buttonIndex)->playerName[offset];
|
||||
}
|
||||
|
||||
gSaveContext.newf[0] = 'Z';
|
||||
gSaveContext.newf[1] = 'E';
|
||||
gSaveContext.newf[2] = 'L';
|
||||
gSaveContext.newf[3] = 'D';
|
||||
gSaveContext.newf[4] = 'A';
|
||||
gSaveContext.newf[5] = 'Z';
|
||||
|
||||
gSaveContext.n64ddFlag = fileChooseCtx->n64ddFlag;
|
||||
osSyncPrintf("64DDフラグ=%d\n", fileChooseCtx->n64ddFlag);
|
||||
osSyncPrintf("newf=%x,%x,%x,%x,%x,%x\n", gSaveContext.newf[0], gSaveContext.newf[1], gSaveContext.newf[2],
|
||||
gSaveContext.newf[3], gSaveContext.newf[4], gSaveContext.newf[5]);
|
||||
osSyncPrintf("\n$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");
|
||||
|
||||
ptr = (u16*)&gSaveContext;
|
||||
j = 0;
|
||||
checksum = 0;
|
||||
|
||||
for (offset = 0; offset < CHECKSUM_SIZE; offset++) {
|
||||
osSyncPrintf("%x ", *ptr);
|
||||
checksum += *ptr++;
|
||||
if (++j == 0x20) {
|
||||
osSyncPrintf("\n");
|
||||
j = 0;
|
||||
}
|
||||
}
|
||||
|
||||
gSaveContext.checksum = checksum;
|
||||
osSyncPrintf("\nチェックサム=%x\n", gSaveContext.checksum); // "Checksum = %x"
|
||||
|
||||
offset = gSramSlotOffsets[gSaveContext.fileNum];
|
||||
osSyncPrintf("I=%x no=%d\n", offset, gSaveContext.fileNum);
|
||||
memcpy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
|
||||
|
||||
offset = gSramSlotOffsets[gSaveContext.fileNum + 3];
|
||||
osSyncPrintf("I=%x no=%d\n", offset, gSaveContext.fileNum + 3);
|
||||
memcpy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
|
||||
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_WRITE);
|
||||
|
||||
osSyncPrintf("SAVE終了\n"); // "SAVE end"
|
||||
osSyncPrintf("z_common_data.file_no = %d\n", gSaveContext.fileNum);
|
||||
osSyncPrintf("SAVECT=%x, NAME=%x, LIFE=%x, ITEM=%x, SAVE_64DD=%x\n", DEATHS, NAME, HEALTH_CAP, QUEST, N64DD);
|
||||
|
||||
j = gSramSlotOffsets[gSaveContext.fileNum];
|
||||
|
||||
memcpy(&fileChooseCtx->deaths[gSaveContext.fileNum], sramCtx->readBuff + j + DEATHS,
|
||||
sizeof(fileChooseCtx->deaths[0]));
|
||||
memcpy(&fileChooseCtx->fileNames[gSaveContext.fileNum], sramCtx->readBuff + j + NAME,
|
||||
sizeof(fileChooseCtx->fileNames[0]));
|
||||
memcpy(&fileChooseCtx->healthCapacities[gSaveContext.fileNum], sramCtx->readBuff + j + HEALTH_CAP,
|
||||
sizeof(fileChooseCtx->healthCapacities[0]));
|
||||
memcpy(&fileChooseCtx->questItems[gSaveContext.fileNum], sramCtx->readBuff + j + QUEST,
|
||||
sizeof(fileChooseCtx->questItems[0]));
|
||||
memcpy(&fileChooseCtx->n64ddFlags[gSaveContext.fileNum], sramCtx->readBuff + j + N64DD,
|
||||
sizeof(fileChooseCtx->n64ddFlags[0]));
|
||||
memcpy(&fileChooseCtx->defense[gSaveContext.fileNum], sramCtx->readBuff + j + DEFENSE,
|
||||
sizeof(fileChooseCtx->defense[0]));
|
||||
memcpy(&fileChooseCtx->health[gSaveContext.fileNum], sramCtx->readBuff + j + HEALTH,
|
||||
sizeof(fileChooseCtx->health[0]));
|
||||
|
||||
osSyncPrintf("f_64dd[%d]=%d\n", gSaveContext.fileNum, fileChooseCtx->n64ddFlags[gSaveContext.fileNum]);
|
||||
osSyncPrintf("heart_status[%d]=%d\n", gSaveContext.fileNum, fileChooseCtx->defense[gSaveContext.fileNum]);
|
||||
osSyncPrintf("now_life[%d]=%d\n", gSaveContext.fileNum, fileChooseCtx->health[gSaveContext.fileNum]);
|
||||
Save_SaveFile();
|
||||
}
|
||||
|
||||
void Sram_EraseSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) {
|
||||
s32 offset;
|
||||
void Sram_InitSram(GameState* gameState) {
|
||||
Save_Init();
|
||||
|
||||
Sram_InitNewSave();
|
||||
|
||||
offset = gSramSlotOffsets[fileChooseCtx->selectedFileIndex];
|
||||
memcpy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE, OS_WRITE);
|
||||
|
||||
memcpy(&fileChooseCtx->n64ddFlags[fileChooseCtx->selectedFileIndex], sramCtx->readBuff + offset + N64DD,
|
||||
sizeof(fileChooseCtx->n64ddFlags[0]));
|
||||
|
||||
offset = gSramSlotOffsets[fileChooseCtx->selectedFileIndex + 3];
|
||||
memcpy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE, OS_WRITE);
|
||||
|
||||
osSyncPrintf("CLEAR終了\n");
|
||||
}
|
||||
|
||||
void Sram_CopySave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) {
|
||||
s32 offset;
|
||||
|
||||
osSyncPrintf("READ=%d(%x) COPY=%d(%x)\n", fileChooseCtx->selectedFileIndex,
|
||||
gSramSlotOffsets[fileChooseCtx->selectedFileIndex], fileChooseCtx->copyDestFileIndex,
|
||||
gSramSlotOffsets[fileChooseCtx->copyDestFileIndex]);
|
||||
|
||||
offset = gSramSlotOffsets[fileChooseCtx->selectedFileIndex];
|
||||
memcpy(&gSaveContext, sramCtx->readBuff + offset, sizeof(Save));
|
||||
|
||||
offset = gSramSlotOffsets[fileChooseCtx->copyDestFileIndex];
|
||||
memcpy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
|
||||
|
||||
offset = gSramSlotOffsets[fileChooseCtx->copyDestFileIndex + 3];
|
||||
memcpy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
|
||||
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_WRITE);
|
||||
|
||||
offset = gSramSlotOffsets[fileChooseCtx->copyDestFileIndex];
|
||||
|
||||
memcpy(&fileChooseCtx->deaths[fileChooseCtx->copyDestFileIndex], sramCtx->readBuff + offset + DEATHS,
|
||||
sizeof(fileChooseCtx->deaths[0]));
|
||||
memcpy(&fileChooseCtx->fileNames[fileChooseCtx->copyDestFileIndex], sramCtx->readBuff + offset + NAME,
|
||||
sizeof(fileChooseCtx->fileNames[0]));
|
||||
memcpy(&fileChooseCtx->healthCapacities[fileChooseCtx->copyDestFileIndex], sramCtx->readBuff + offset + HEALTH_CAP,
|
||||
sizeof(fileChooseCtx->healthCapacities[0]));
|
||||
memcpy(&fileChooseCtx->questItems[fileChooseCtx->copyDestFileIndex], sramCtx->readBuff + offset + QUEST,
|
||||
sizeof(fileChooseCtx->questItems[0]));
|
||||
memcpy(&fileChooseCtx->n64ddFlags[fileChooseCtx->copyDestFileIndex], sramCtx->readBuff + offset + N64DD,
|
||||
sizeof(fileChooseCtx->n64ddFlags[0]));
|
||||
memcpy(&fileChooseCtx->defense[fileChooseCtx->copyDestFileIndex], sramCtx->readBuff + offset + DEFENSE,
|
||||
sizeof(fileChooseCtx->defense[0]));
|
||||
memcpy(&fileChooseCtx->health[fileChooseCtx->copyDestFileIndex], (sramCtx->readBuff + offset) + HEALTH,
|
||||
sizeof(fileChooseCtx->health[0]));
|
||||
|
||||
osSyncPrintf("f_64dd[%d]=%d\n", gSaveContext.fileNum, fileChooseCtx->n64ddFlags[gSaveContext.fileNum]);
|
||||
osSyncPrintf("heart_status[%d]=%d\n", gSaveContext.fileNum, fileChooseCtx->defense[gSaveContext.fileNum]);
|
||||
osSyncPrintf("COPY終了\n"); // "Copy end"
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the first 16 bytes of the read buffer to the SRAM header
|
||||
*/
|
||||
void Sram_WriteSramHeader(SramContext* sramCtx) {
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_HEADER_SIZE, OS_WRITE);
|
||||
}
|
||||
|
||||
void Sram_InitSram(GameState* gameState, SramContext* sramCtx) {
|
||||
u16 i;
|
||||
|
||||
osSyncPrintf("sram_initialize( Game *game, Sram *sram )\n");
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNTU(sZeldaMagic) - 3; i++) {
|
||||
if (sZeldaMagic[i + SRAM_HEADER_MAGIC] != sramCtx->readBuff[i + SRAM_HEADER_MAGIC]) {
|
||||
osSyncPrintf("SRAM破壊!!!!!!\n"); // "SRAM destruction! ! ! ! ! !"
|
||||
gSaveContext.language = CVar_GetS32("gLanguages", 0);
|
||||
memcpy(sramCtx->readBuff, sZeldaMagic, sizeof(sZeldaMagic));
|
||||
sramCtx->readBuff[SRAM_HEADER_LANGUAGE] = gSaveContext.language;
|
||||
Sram_WriteSramHeader(sramCtx);
|
||||
}
|
||||
}
|
||||
|
||||
gSaveContext.audioSetting = sramCtx->readBuff[SRAM_HEADER_SOUND] & 3;
|
||||
gSaveContext.zTargetSetting = sramCtx->readBuff[SRAM_HEADER_ZTARGET] & 1;
|
||||
gSaveContext.language = CVar_GetS32("gLanguages", 0);
|
||||
|
||||
if (gSaveContext.language >= LANGUAGE_MAX) {
|
||||
gSaveContext.language = LANGUAGE_ENG;
|
||||
sramCtx->readBuff[SRAM_HEADER_LANGUAGE] = gSaveContext.language;
|
||||
Sram_WriteSramHeader(sramCtx);
|
||||
}
|
||||
|
||||
if (CHECK_BTN_ANY(gameState->input[2].cur.button, BTN_DRIGHT)) {
|
||||
memset(sramCtx->readBuff, 0,SRAM_SIZE);
|
||||
for (i = 0; i < CHECKSUM_SIZE; i++) {
|
||||
sramCtx->readBuff[i] = i;
|
||||
}
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_WRITE);
|
||||
osSyncPrintf("SRAM破壊!!!!!!\n"); // "SRAM destruction! ! ! ! ! !"
|
||||
}
|
||||
|
||||
// "GOOD! GOOD! Size = %d + %d = %d"
|
||||
osSyncPrintf("GOOD!GOOD! サイズ=%d + %d = %d\n", sizeof(SaveInfo), 4, sizeof(SaveInfo) + 4);
|
||||
osSyncPrintf(VT_FGCOL(BLUE));
|
||||
osSyncPrintf("Na_SetSoundOutputMode = %d\n", gSaveContext.audioSetting);
|
||||
osSyncPrintf("Na_SetSoundOutputMode = %d\n", gSaveContext.audioSetting);
|
||||
osSyncPrintf("Na_SetSoundOutputMode = %d\n", gSaveContext.audioSetting);
|
||||
osSyncPrintf(VT_RST);
|
||||
func_800F6700(gSaveContext.audioSetting);
|
||||
}
|
||||
|
||||
void Sram_Alloc(GameState* gameState, SramContext* sramCtx) {
|
||||
sramCtx->readBuff = GameState_Alloc(gameState, SRAM_SIZE, "../z_sram.c", 1294);
|
||||
ASSERT(sramCtx->readBuff != NULL, "sram->read_buff != NULL", "../z_sram.c", 1295);
|
||||
}
|
||||
|
||||
void Sram_Init(GlobalContext* globalCtx, SramContext* sramCtx) {
|
||||
}
|
||||
|
@ -58,38 +58,13 @@ void SsSram_Dma(void* dramAddr, size_t size, s32 direction) {
|
||||
|
||||
void SsSram_ReadWrite(uintptr_t addr, void* dramAddr, size_t size, s32 direction) {
|
||||
osSyncPrintf("ssSRAMReadWrite:%08x %08x %08x %d\n", addr, (uintptr_t)dramAddr, size, direction);
|
||||
//Check to see if the file exists
|
||||
FILE* saveFile;
|
||||
saveFile = fopen("oot_save.sav", "rb");
|
||||
|
||||
if (saveFile == NULL) {
|
||||
|
||||
saveFile = fopen("oot_save.sav", "wb");
|
||||
fseek(saveFile, 0, SEEK_SET);
|
||||
assert(saveFile != NULL); // OTRTODO LOG
|
||||
uint8_t zero = 0;
|
||||
|
||||
for (uint32_t i = 0; i < SRAM_SIZE; i++) {
|
||||
fwrite(&zero, 1, 1, saveFile);
|
||||
}
|
||||
fclose(saveFile);
|
||||
} else {
|
||||
fclose(saveFile);
|
||||
}
|
||||
|
||||
switch (direction) {
|
||||
case OS_WRITE: {
|
||||
saveFile = fopen("oot_save.sav", "r+b");
|
||||
rewind(saveFile);
|
||||
fseek(saveFile, addr, SEEK_SET);
|
||||
fwrite(dramAddr, size, 1, saveFile);
|
||||
fclose(saveFile);
|
||||
Ctx_WriteSaveFile(addr, dramAddr, size);
|
||||
} break;
|
||||
case OS_READ: {
|
||||
saveFile = fopen("oot_save.sav", "rb+");
|
||||
rewind(saveFile);
|
||||
fseek(saveFile, addr, SEEK_SET);
|
||||
fread(dramAddr, size, 1, saveFile);
|
||||
fclose(saveFile);
|
||||
Ctx_ReadSaveFile(addr, dramAddr, size);
|
||||
} break;
|
||||
}
|
||||
//SsSram_Init(addr, DEVICE_TYPE_SRAM, PI_DOMAIN2, 5, 0xD, 2, 0xC, 0);
|
||||
|
@ -114,7 +114,7 @@ void func_809B27D8(EnAnubiceFire* this, GlobalContext* globalCtx) {
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_IT_SHIELD_REFLECT_SW);
|
||||
this->cylinder.base.atFlags &= 0xFFE9;
|
||||
this->cylinder.base.atFlags |= 8;
|
||||
this->cylinder.info.toucher.dmgFlags = 2;
|
||||
this->cylinder.info.toucher.dmgFlags = CVar_GetS32("gAnubisFix", 0) ? 0x800 : 2;
|
||||
this->unk_15A = 30;
|
||||
this->actor.params = 1;
|
||||
this->actor.velocity.x *= -1.0f;
|
||||
|
@ -452,7 +452,7 @@ s32 EnGirlA_CanBuy_DekuNuts(GlobalContext* globalCtx, EnGirlA* this) {
|
||||
if (gSaveContext.rupees < this->basePrice) {
|
||||
return CANBUY_RESULT_NEED_RUPEES;
|
||||
}
|
||||
if (Item_CheckObtainability(ITEM_NUT) == ITEM_NONE) {
|
||||
if ((Item_CheckObtainability(ITEM_NUT) == ITEM_NONE) && !CVar_GetS32("gFastDrops", 0)) {
|
||||
return CANBUY_RESULT_SUCCESS_FANFARE;
|
||||
}
|
||||
return CANBUY_RESULT_SUCCESS;
|
||||
@ -465,7 +465,7 @@ s32 EnGirlA_CanBuy_DekuSticks(GlobalContext* globalCtx, EnGirlA* this) {
|
||||
if (gSaveContext.rupees < this->basePrice) {
|
||||
return CANBUY_RESULT_NEED_RUPEES;
|
||||
}
|
||||
if (Item_CheckObtainability(ITEM_STICK) == ITEM_NONE) {
|
||||
if ((Item_CheckObtainability(ITEM_STICK) == ITEM_NONE) && !CVar_GetS32("gFastDrops", 0)) {
|
||||
return CANBUY_RESULT_SUCCESS_FANFARE;
|
||||
}
|
||||
return CANBUY_RESULT_SUCCESS;
|
||||
@ -652,7 +652,7 @@ s32 EnGirlA_CanBuy_DekuSeeds(GlobalContext* globalCtx, EnGirlA* this) {
|
||||
if (gSaveContext.rupees < this->basePrice) {
|
||||
return CANBUY_RESULT_NEED_RUPEES;
|
||||
}
|
||||
if (Item_CheckObtainability(ITEM_SEEDS) == ITEM_NONE) {
|
||||
if ((Item_CheckObtainability(ITEM_SEEDS) == ITEM_NONE) && !CVar_GetS32("gFastDrops", 0)) {
|
||||
return CANBUY_RESULT_SUCCESS_FANFARE;
|
||||
}
|
||||
return CANBUY_RESULT_SUCCESS;
|
||||
|
@ -29,7 +29,7 @@ void EnHeishi1_TurnTowardLink(EnHeishi1* this, GlobalContext* globalCtx);
|
||||
void EnHeishi1_Kick(EnHeishi1* this, GlobalContext* globalCtx);
|
||||
void EnHeishi1_WaitNight(EnHeishi1* this, GlobalContext* globalCtx);
|
||||
|
||||
static s32 sPlayerIsCaught = false;
|
||||
s32 sHeishi1PlayerIsCaught = false;
|
||||
|
||||
const ActorInit En_Heishi1_InitVars = {
|
||||
0,
|
||||
@ -154,7 +154,7 @@ void EnHeishi1_Walk(EnHeishi1* this, GlobalContext* globalCtx) {
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EV_KNIGHT_WALK);
|
||||
}
|
||||
|
||||
if (!sPlayerIsCaught) {
|
||||
if (!sHeishi1PlayerIsCaught) {
|
||||
path = &globalCtx->setupPathList[this->path];
|
||||
pointPos = SEGMENTED_TO_VIRTUAL(path->points);
|
||||
pointPos += this->waypoint;
|
||||
@ -259,7 +259,7 @@ void EnHeishi1_Wait(EnHeishi1* this, GlobalContext* globalCtx) {
|
||||
s32 i;
|
||||
|
||||
SkelAnime_Update(&this->skelAnime);
|
||||
if (!sPlayerIsCaught) {
|
||||
if (!sHeishi1PlayerIsCaught) {
|
||||
switch (this->headBehaviorDecided) {
|
||||
case false:
|
||||
this->headDirection++;
|
||||
@ -352,7 +352,7 @@ void EnHeishi1_Kick(EnHeishi1* this, GlobalContext* globalCtx) {
|
||||
globalCtx->nextEntranceIndex = 0x4FA;
|
||||
globalCtx->sceneLoadFlag = 0x14;
|
||||
this->loadStarted = true;
|
||||
sPlayerIsCaught = false;
|
||||
sHeishi1PlayerIsCaught = false;
|
||||
globalCtx->fadeTransition = 0x2E;
|
||||
gSaveContext.nextTransition = 0x2E;
|
||||
}
|
||||
@ -413,7 +413,7 @@ void EnHeishi1_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
if (this->type != 5) {
|
||||
path = this->path * 2;
|
||||
if ((sCamDataIdxs[path] == activeCam->camDataIdx) || (sCamDataIdxs[path + 1] == activeCam->camDataIdx)) {
|
||||
if (!sPlayerIsCaught) {
|
||||
if (!sHeishi1PlayerIsCaught) {
|
||||
if ((this->actionFunc == EnHeishi1_Walk) || (this->actionFunc == EnHeishi1_Wait)) {
|
||||
Vec3f searchBallVel;
|
||||
Vec3f searchBallAccel = { 0.0f, 0.0f, 0.0f };
|
||||
@ -459,7 +459,7 @@ void EnHeishi1_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
// "Discovered!"
|
||||
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発見! ☆☆☆☆☆ \n" VT_RST);
|
||||
func_8002DF54(globalCtx, &this->actor, 1);
|
||||
sPlayerIsCaught = true;
|
||||
sHeishi1PlayerIsCaught = true;
|
||||
this->actionFunc = EnHeishi1_SetupMoveToLink;
|
||||
}
|
||||
}
|
||||
|
@ -1053,7 +1053,7 @@ void func_80A98CD8(EnKo* this) {
|
||||
this->actor.targetMode = info->targetMode;
|
||||
this->lookDist = info->lookDist;
|
||||
this->lookDist += this->collider.dim.radius;
|
||||
this->appearDist = CVar_GetS32("gDisableKokiriDrawDistance", 0) != 0 ? 32767 : info->appearDist;
|
||||
this->appearDist = info->appearDist;
|
||||
}
|
||||
|
||||
// Used to fetch actor animation?
|
||||
@ -1080,7 +1080,15 @@ void func_80A98DB4(EnKo* this, GlobalContext* globalCtx) {
|
||||
dist = this->actor.xzDistToPlayer;
|
||||
}
|
||||
|
||||
Math_SmoothStepToF(&this->modelAlpha, (this->appearDist < dist) ? 0.0f : 255.0f, 0.3f, 40.0f, 1.0f);
|
||||
if (CVar_GetS32("gDisableKokiriDrawDistance", 0) != 0) {
|
||||
this->appearDist = 32767.0f;
|
||||
Math_SmoothStepToF(&this->modelAlpha, (this->appearDist < dist) ? 0.0f : 255.0f, 0.3f, 40.0f, 1.0f);
|
||||
f32 test = this->appearDist;
|
||||
} else {
|
||||
this->appearDist = 180.0f;
|
||||
Math_SmoothStepToF(&this->modelAlpha, (this->appearDist < dist) ? 0.0f : 255.0f, 0.3f, 40.0f, 1.0f);
|
||||
}
|
||||
|
||||
if (this->modelAlpha < 10.0f) {
|
||||
this->actor.flags &= ~ACTOR_FLAG_0;
|
||||
} else {
|
||||
|
@ -613,10 +613,18 @@ void func_80AAB5A4(EnMd* this, GlobalContext* globalCtx) {
|
||||
f32 temp;
|
||||
|
||||
if (globalCtx->sceneNum != SCENE_KOKIRI_HOME4) {
|
||||
temp = (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && !(gSaveContext.eventChkInf[1] & 0x1000) &&
|
||||
(globalCtx->sceneNum == SCENE_SPOT04))
|
||||
? 100.0f
|
||||
: 400.0f;
|
||||
if (CVar_GetS32("gDisableKokiriDrawDistance", 0) != 0) {
|
||||
temp = (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && !(gSaveContext.eventChkInf[1] & 0x1000) &&
|
||||
(globalCtx->sceneNum == SCENE_SPOT04))
|
||||
? 100.0f
|
||||
: 32767.0f;
|
||||
} else {
|
||||
temp = (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && !(gSaveContext.eventChkInf[1] & 0x1000) &&
|
||||
(globalCtx->sceneNum == SCENE_SPOT04))
|
||||
? 100.0f
|
||||
: 400.0f;
|
||||
}
|
||||
|
||||
this->alpha = func_80034DD4(&this->actor, globalCtx, this->alpha, temp);
|
||||
this->actor.shape.shadowAlpha = this->alpha;
|
||||
} else {
|
||||
|
@ -727,7 +727,12 @@ void EnSa_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
if (this->actionFunc != func_80AF68E4) {
|
||||
this->alpha = func_80034DD4(&this->actor, globalCtx, this->alpha, 400.0f);
|
||||
if (CVar_GetS32("gDisableKokiriDrawDistance", 0) != 0) {
|
||||
this->alpha = func_80034DD4(&this->actor, globalCtx, this->alpha, 32767);
|
||||
}
|
||||
else {
|
||||
this->alpha = func_80034DD4(&this->actor, globalCtx, this->alpha, 400.0f);
|
||||
}
|
||||
} else {
|
||||
this->alpha = 255;
|
||||
}
|
||||
|
@ -351,6 +351,7 @@ s32 func_80852F38(GlobalContext* globalCtx, Player* this);
|
||||
s32 func_80852FFC(GlobalContext* globalCtx, Actor* actor, s32 csMode);
|
||||
void func_80853080(Player* this, GlobalContext* globalCtx);
|
||||
s32 Player_InflictDamage(GlobalContext* globalCtx, s32 damage);
|
||||
s32 Player_InflictDamageModified(GlobalContext* globalCtx, s32 damage, u8 modified);
|
||||
void func_80853148(GlobalContext* globalCtx, Actor* actor);
|
||||
|
||||
// .bss part 1
|
||||
@ -3516,12 +3517,22 @@ void func_80837AFC(Player* this, s32 timer) {
|
||||
this->unk_88F = 0;
|
||||
}
|
||||
|
||||
s32 func_80837B18(GlobalContext* globalCtx, Player* this, s32 damage) {
|
||||
s32 func_80837B18_modified(GlobalContext* globalCtx, Player* this, s32 damage, u8 modified) {
|
||||
if ((this->invincibilityTimer != 0) || (this->actor.category != ACTORCAT_PLAYER)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return Health_ChangeBy(globalCtx, damage);
|
||||
s32 modifiedDamage = damage;
|
||||
if (modified)
|
||||
{
|
||||
modifiedDamage *= CVar_GetS32("gDamageMul", 1);
|
||||
}
|
||||
|
||||
return Health_ChangeBy(globalCtx, modifiedDamage);
|
||||
}
|
||||
|
||||
s32 func_80837B18(GlobalContext* globalCtx, Player* this, s32 damage) {
|
||||
return func_80837B18_modified(globalCtx, this, damage, true);
|
||||
}
|
||||
|
||||
void func_80837B60(Player* this) {
|
||||
@ -3747,7 +3758,7 @@ s32 func_808382DC(Player* this, GlobalContext* globalCtx) {
|
||||
|
||||
if (this->unk_A86 != 0) {
|
||||
if (!Player_InBlockingCsMode(globalCtx, this)) {
|
||||
Player_InflictDamage(globalCtx, -16);
|
||||
Player_InflictDamageModified(globalCtx, -16 * CVar_GetS32("gVoidDamageMul", 1), false);
|
||||
this->unk_A86 = 0;
|
||||
}
|
||||
}
|
||||
@ -6157,7 +6168,12 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) {
|
||||
|
||||
iREG(67) = false;
|
||||
|
||||
if ((Item_CheckObtainability(giEntry->itemId) == ITEM_NONE) || (globalCtx->sceneNum == SCENE_BOWLING)) {
|
||||
s32 drop = giEntry->objectId;
|
||||
|
||||
if ((globalCtx->sceneNum == SCENE_BOWLING) || !(CVar_GetS32("gFastDrops", 0) &&
|
||||
((drop == OBJECT_GI_BOMB_1) || (drop == OBJECT_GI_NUTS) || (drop == OBJECT_GI_STICK) ||
|
||||
(drop == OBJECT_GI_SEED) || (drop == OBJECT_GI_MAGICPOT) || (drop == OBJECT_GI_ARROW))) &&
|
||||
(Item_CheckObtainability(giEntry->itemId) == ITEM_NONE)) {
|
||||
func_808323B4(globalCtx, this);
|
||||
func_8083AE40(this, giEntry->objectId);
|
||||
|
||||
@ -8279,7 +8295,7 @@ s32 func_80843E64(GlobalContext* globalCtx, Player* this) {
|
||||
|
||||
impactInfo = &D_80854600[impactIndex];
|
||||
|
||||
if (Player_InflictDamage(globalCtx, impactInfo->damage)) {
|
||||
if (Player_InflictDamageModified(globalCtx, impactInfo->damage * CVar_GetS32("gFallDamageMul", 1), false)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -14829,9 +14845,13 @@ void func_80853080(Player* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
s32 Player_InflictDamage(GlobalContext* globalCtx, s32 damage) {
|
||||
return Player_InflictDamageModified(globalCtx, damage, true);
|
||||
}
|
||||
|
||||
s32 Player_InflictDamageModified(GlobalContext* globalCtx, s32 damage, u8 modified) {
|
||||
Player* this = GET_PLAYER(globalCtx);
|
||||
|
||||
if (!Player_InBlockingCsMode(globalCtx, this) && !func_80837B18(globalCtx, this, damage)) {
|
||||
if (!Player_InBlockingCsMode(globalCtx, this) && !func_80837B18_modified(globalCtx, this, damage, modified)) {
|
||||
this->stateFlags2 &= ~PLAYER_STATE2_7;
|
||||
return 1;
|
||||
}
|
||||
|
@ -5,11 +5,14 @@
|
||||
*/
|
||||
|
||||
#include "z_eff_ss_solder_srch_ball.h"
|
||||
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||
#include <math.h>
|
||||
|
||||
#define rUnused regs[1]
|
||||
|
||||
u32 EffectSsSolderSrchBall_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx);
|
||||
void EffectSsSolderSrchBall_Update(GlobalContext* globalCtx, u32 index, EffectSs* this);
|
||||
void EffectSsSolderSrchBall_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this);
|
||||
|
||||
EffectSsInit Effect_Ss_Solder_Srch_Ball_InitVars = {
|
||||
EFFECT_SS_SOLDER_SRCH_BALL,
|
||||
@ -23,6 +26,7 @@ u32 EffectSsSolderSrchBall_Init(GlobalContext* globalCtx, u32 index, EffectSs* t
|
||||
this->velocity = initParams->velocity;
|
||||
this->accel = initParams->accel;
|
||||
this->update = EffectSsSolderSrchBall_Update;
|
||||
this->draw = EffectSsSolderSrchBall_Draw;
|
||||
this->life = 100;
|
||||
this->rUnused = initParams->unused;
|
||||
this->actor = initParams->linkDetected; // actor field was incorrectly used as a pointer to something else
|
||||
@ -53,3 +57,198 @@ void EffectSsSolderSrchBall_Update(GlobalContext* globalCtx, u32 index, EffectSs
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void vtxn_f2l(Vtx* r, Vec3f* v) {
|
||||
r->n.ob[0] = floorf(0.5f + v->x * 128.f);
|
||||
r->n.ob[1] = floorf(0.5f + v->y * 128.f);
|
||||
r->n.ob[2] = floorf(0.5f + v->z * 128.f);
|
||||
r->n.flag = 0;
|
||||
r->n.tc[0] = 0;
|
||||
r->n.tc[1] = 0;
|
||||
r->n.n[0] = v->x * 127.f;
|
||||
r->n.n[1] = v->y * 127.f;
|
||||
r->n.n[2] = v->z * 127.f;
|
||||
r->n.a = 0xFF;
|
||||
}
|
||||
|
||||
static void ico_sph_subdivide_edge(Vec3f* r, Vec3f* a, Vec3f* b) {
|
||||
Math_Vec3f_Sum(a, b, r);
|
||||
Math_Vec3f_Scale(r, (1.0f / Math3D_Vec3fMagnitude(r)));
|
||||
}
|
||||
|
||||
static void draw_ico_sphere(Gfx** p_gfx_p, f32 x, f32 y, f32 z, f32 radius, GraphicsContext* gfxCtx) {
|
||||
static Gfx* p_sph_gfx = NULL;
|
||||
static Vtx sph_vtx[42];
|
||||
static Gfx sph_gfx[45];
|
||||
Gfx* sph_gfx_p;
|
||||
s32 i;
|
||||
|
||||
if (!p_sph_gfx) {
|
||||
Vec3f vtx[42];
|
||||
s32 r0_n = 1, r0_m = r0_n / 5, r0_i = 0 + 0;
|
||||
s32 r1_n = 5, r1_m = r1_n / 5, r1_i = r0_i + r0_n;
|
||||
s32 r2_n = 10, r2_m = r2_n / 5, r2_i = r1_i + r1_n;
|
||||
s32 r3_n = 10, r3_m = r3_n / 5, r3_i = r2_i + r2_n;
|
||||
s32 r4_n = 10, r4_m = r4_n / 5, r4_i = r3_i + r3_n;
|
||||
s32 r5_n = 5, r5_m = r5_n / 5, r5_i = r4_i + r4_n;
|
||||
s32 r6_n = 1, r6_m = r6_n / 5, r6_i = r5_i + r5_n;
|
||||
|
||||
vtx[r0_i + (0 * r0_m + 0) % r0_n].x = 0.0f;
|
||||
vtx[r0_i + (0 * r0_m + 0) % r0_n].y = 1.0f;
|
||||
vtx[r0_i + (0 * r0_m + 0) % r0_n].z = 0.0f;
|
||||
|
||||
vtx[r6_i + (0 * r6_m + 0) % r6_n].x = 0.0f;
|
||||
vtx[r6_i + (0 * r6_m + 0) % r6_n].y = -1.0f;
|
||||
vtx[r6_i + (0 * r6_m + 0) % r6_n].z = 0.0f;
|
||||
|
||||
for (i = 0; i < 5; ++i) {
|
||||
f32 a_xz = 2.f * M_PI / 10.f;
|
||||
f32 a_y = atanf(1.0f / 2.0f);
|
||||
|
||||
vtx[r2_i + (i * r2_m + 0) % r2_n].x = cosf(a_xz * (i * r2_m + 0)) * cosf(a_y * 1.f);
|
||||
vtx[r2_i + (i * r2_m + 0) % r2_n].y = sinf(a_y * 1.f);
|
||||
vtx[r2_i + (i * r2_m + 0) % r2_n].z = -sinf(a_xz * (i * r2_m + 0)) * cosf(a_y * 1.f);
|
||||
|
||||
vtx[r4_i + (i * r4_m + 0) % r4_n].x = cosf(a_xz * (i * r4_m + 1)) * cosf(a_y * -1.f);
|
||||
vtx[r4_i + (i * r4_m + 0) % r4_n].y = sinf(a_y * -1.f);
|
||||
vtx[r4_i + (i * r4_m + 0) % r4_n].z = -sinf(a_xz * (i * r4_m + 1)) * cosf(a_y * -1.f);
|
||||
}
|
||||
for (i = 0; i < 5; ++i) {
|
||||
ico_sph_subdivide_edge(&vtx[r1_i + (i * r1_m + 0) % r1_n], &vtx[r0_i + (i * r0_m + 0) % r0_n],
|
||||
&vtx[r2_i + (i * r2_m + 0) % r2_n]);
|
||||
ico_sph_subdivide_edge(&vtx[r2_i + (i * r2_m + 1) % r2_n], &vtx[r2_i + (i * r2_m + 0) % r2_n],
|
||||
&vtx[r2_i + (i * r2_m + 2) % r2_n]);
|
||||
ico_sph_subdivide_edge(&vtx[r3_i + (i * r3_m + 0) % r3_n], &vtx[r2_i + (i * r2_m + 0) % r2_n],
|
||||
&vtx[r4_i + (i * r4_m + 0) % r4_n]);
|
||||
ico_sph_subdivide_edge(&vtx[r3_i + (i * r3_m + 1) % r3_n], &vtx[r4_i + (i * r4_m + 0) % r4_n],
|
||||
&vtx[r2_i + (i * r2_m + 2) % r2_n]);
|
||||
ico_sph_subdivide_edge(&vtx[r4_i + (i * r4_m + 1) % r4_n], &vtx[r4_i + (i * r4_m + 0) % r4_n],
|
||||
&vtx[r4_i + (i * r4_m + 2) % r4_n]);
|
||||
ico_sph_subdivide_edge(&vtx[r5_i + (i * r5_m + 0) % r5_n], &vtx[r4_i + (i * r4_m + 0) % r4_n],
|
||||
&vtx[r6_i + (i * r6_m + 0) % r6_n]);
|
||||
}
|
||||
|
||||
for (i = 0; i < 42; ++i)
|
||||
vtxn_f2l(&sph_vtx[i], &vtx[i]);
|
||||
|
||||
p_sph_gfx = sph_gfx;
|
||||
sph_gfx_p = p_sph_gfx;
|
||||
|
||||
gSPSetGeometryMode(sph_gfx_p++, G_CULL_BACK | G_SHADING_SMOOTH);
|
||||
|
||||
gSPVertex(sph_gfx_p++, &sph_vtx[r0_i], r0_n + r1_n + r2_n + r3_n, r0_i - r0_i);
|
||||
r3_i -= r0_i;
|
||||
r2_i -= r0_i;
|
||||
r1_i -= r0_i;
|
||||
r0_i -= r0_i;
|
||||
for (i = 0; i < 5; ++i) {
|
||||
s32 v[24];
|
||||
v[0] = r0_i + (i * r0_m + 0) % r0_n;
|
||||
v[1] = r1_i + (i * r1_m + 0) % r1_n;
|
||||
v[2] = r1_i + (i * r1_m + 1) % r1_n;
|
||||
v[3] = r1_i + (i * r1_m + 0) % r1_n;
|
||||
v[4] = r2_i + (i * r2_m + 0) % r2_n;
|
||||
v[5] = r2_i + (i * r2_m + 1) % r2_n;
|
||||
v[6] = r1_i + (i * r1_m + 0) % r1_n;
|
||||
v[7] = r2_i + (i * r2_m + 1) % r2_n;
|
||||
v[8] = r1_i + (i * r1_m + 1) % r1_n;
|
||||
v[9] = r1_i + (i * r1_m + 1) % r1_n;
|
||||
v[10] = r2_i + (i * r2_m + 1) % r2_n;
|
||||
v[11] = r2_i + (i * r2_m + 2) % r2_n;
|
||||
v[12] = r2_i + (i * r2_m + 0) % r2_n;
|
||||
v[13] = r3_i + (i * r3_m + 0) % r3_n;
|
||||
v[14] = r2_i + (i * r2_m + 1) % r2_n;
|
||||
v[15] = r2_i + (i * r2_m + 1) % r2_n;
|
||||
v[16] = r3_i + (i * r3_m + 0) % r3_n;
|
||||
v[17] = r3_i + (i * r3_m + 1) % r3_n;
|
||||
v[18] = r2_i + (i * r2_m + 1) % r2_n;
|
||||
v[19] = r3_i + (i * r3_m + 1) % r3_n;
|
||||
v[20] = r2_i + (i * r2_m + 2) % r2_n;
|
||||
v[21] = r2_i + (i * r2_m + 2) % r2_n;
|
||||
v[22] = r3_i + (i * r3_m + 1) % r3_n;
|
||||
v[23] = r3_i + (i * r3_m + 2) % r3_n;
|
||||
gSP2Triangles(sph_gfx_p++, v[0], v[1], v[2], 0, v[3], v[4], v[5], 0);
|
||||
gSP2Triangles(sph_gfx_p++, v[6], v[7], v[8], 0, v[9], v[10], v[11], 0);
|
||||
gSP2Triangles(sph_gfx_p++, v[12], v[13], v[14], 0, v[15], v[16], v[17], 0);
|
||||
gSP2Triangles(sph_gfx_p++, v[18], v[19], v[20], 0, v[21], v[22], v[23], 0);
|
||||
}
|
||||
|
||||
gSPVertex(sph_gfx_p++, &sph_vtx[r4_i], r4_n + r5_n + r6_n, r4_i - r4_i);
|
||||
r6_i -= r4_i;
|
||||
r5_i -= r4_i;
|
||||
r4_i -= r4_i;
|
||||
for (i = 0; i < 5; ++i) {
|
||||
s32 v[24];
|
||||
v[0] = r3_i + (i * r3_m + 1) % r3_n;
|
||||
v[1] = r4_i + (i * r4_m + 0) % r4_n;
|
||||
v[2] = r4_i + (i * r4_m + 1) % r4_n;
|
||||
v[3] = r3_i + (i * r3_m + 1) % r3_n;
|
||||
v[4] = r4_i + (i * r4_m + 1) % r4_n;
|
||||
v[5] = r3_i + (i * r3_m + 2) % r3_n;
|
||||
v[6] = r3_i + (i * r3_m + 2) % r3_n;
|
||||
v[7] = r4_i + (i * r4_m + 1) % r4_n;
|
||||
v[8] = r4_i + (i * r4_m + 2) % r4_n;
|
||||
v[9] = r3_i + (i * r3_m + 2) % r3_n;
|
||||
v[10] = r4_i + (i * r4_m + 2) % r4_n;
|
||||
v[11] = r3_i + (i * r3_m + 3) % r3_n;
|
||||
v[12] = r4_i + (i * r4_m + 0) % r4_n;
|
||||
v[13] = r5_i + (i * r5_m + 0) % r5_n;
|
||||
v[14] = r4_i + (i * r4_m + 1) % r4_n;
|
||||
v[15] = r4_i + (i * r4_m + 1) % r4_n;
|
||||
v[16] = r5_i + (i * r5_m + 0) % r5_n;
|
||||
v[17] = r5_i + (i * r5_m + 1) % r5_n;
|
||||
v[18] = r4_i + (i * r4_m + 1) % r4_n;
|
||||
v[19] = r5_i + (i * r5_m + 1) % r5_n;
|
||||
v[20] = r4_i + (i * r4_m + 2) % r4_n;
|
||||
v[21] = r5_i + (i * r5_m + 0) % r5_n;
|
||||
v[22] = r6_i + (i * r6_m + 0) % r6_n;
|
||||
v[23] = r5_i + (i * r5_m + 1) % r5_n;
|
||||
gSP2Triangles(sph_gfx_p++, v[0], v[1], v[2], 0, v[3], v[4], v[5], 0);
|
||||
gSP2Triangles(sph_gfx_p++, v[6], v[7], v[8], 0, v[9], v[10], v[11], 0);
|
||||
gSP2Triangles(sph_gfx_p++, v[12], v[13], v[14], 0, v[15], v[16], v[17], 0);
|
||||
gSP2Triangles(sph_gfx_p++, v[18], v[19], v[20], 0, v[21], v[22], v[23], 0);
|
||||
}
|
||||
|
||||
gSPClearGeometryMode(sph_gfx_p++, G_CULL_BACK | G_SHADING_SMOOTH);
|
||||
gSPEndDisplayList(sph_gfx_p++);
|
||||
}
|
||||
Matrix_Push();
|
||||
Matrix_Translate(x, y, z, MTXMODE_NEW);
|
||||
Matrix_Scale(radius / 128.0f, radius / 128.0f, radius / 128.0f, MTXMODE_APPLY);
|
||||
gSPMatrix((*p_gfx_p)++, Matrix_NewMtx(gfxCtx, __FILE__, __LINE__), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_PUSH);
|
||||
gSPDisplayList((*p_gfx_p)++, p_sph_gfx);
|
||||
gSPPopMatrix((*p_gfx_p)++, G_MTX_MODELVIEW);
|
||||
Matrix_Pop();
|
||||
}
|
||||
|
||||
void EffectSsSolderSrchBall_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) {
|
||||
if (CVar_GetS32("gGuardVision", 0) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
|
||||
u32 rm;
|
||||
u32 blc1;
|
||||
u32 blc2;
|
||||
s16* seenLink = this->actor;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, __FILE__, __LINE__);
|
||||
rm = Z_CMP | IM_RD | CVG_DST_FULL | FORCE_BL | ZMODE_XLU;
|
||||
blc1 = GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA);
|
||||
blc2 = GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA);
|
||||
|
||||
gSPLoadGeometryMode(POLY_XLU_DISP++, G_ZBUFFER | G_SHADE | G_LIGHTING);
|
||||
gSPTexture(POLY_XLU_DISP++, 0, 0, 0, G_TX_RENDERTILE, G_OFF);
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
gDPSetCycleType(POLY_XLU_DISP++, G_CYC_1CYCLE);
|
||||
gDPSetRenderMode(POLY_XLU_DISP++, rm | blc1, rm | blc2);
|
||||
gDPSetCombineLERP(POLY_XLU_DISP++, PRIMITIVE, 0, SHADE, 0, 0, 0, 0, ENVIRONMENT, PRIMITIVE, 0, SHADE, 0, 0, 0,
|
||||
0, ENVIRONMENT);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255);
|
||||
if (*seenLink) {
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 0, 0, 255);
|
||||
}
|
||||
draw_ico_sphere(&POLY_XLU_DISP, this->pos.x, this->pos.y, this->pos.z, 30.0f, gfxCtx);
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, __FILE__, __LINE__);
|
||||
}
|
@ -5,17 +5,6 @@
|
||||
#include "global.h"
|
||||
#include "vt.h"
|
||||
|
||||
|
||||
#define GET_NEWF(sramCtx, slotNum, index) (sramCtx->readBuff[gSramSlotOffsets[slotNum] + OFFSETOF(SaveContext, newf[index])])
|
||||
|
||||
#define SLOT_OCCUPIED(sramCtx, slotNum) \
|
||||
((GET_NEWF(sramCtx, slotNum, 0) == 'Z') || \
|
||||
(GET_NEWF(sramCtx, slotNum, 1) == 'E') || \
|
||||
(GET_NEWF(sramCtx, slotNum, 2) == 'L') || \
|
||||
(GET_NEWF(sramCtx, slotNum, 3) == 'D') || \
|
||||
(GET_NEWF(sramCtx, slotNum, 4) == 'A') || \
|
||||
(GET_NEWF(sramCtx, slotNum, 5) == 'Z'))
|
||||
|
||||
// Init mode: Initial setup as the file select is starting up, fades and slides in various menu elements
|
||||
// Config mode: Handles the bulk of the file select, various configuration tasks like picking a file, copy/erase, and the options menu
|
||||
// Select mode: Displays the selected file with various details about it, and allows the player to confirm and open it
|
||||
|
@ -64,9 +64,6 @@ void FileChoose_InitModeUpdate(GameState* thisx) {
|
||||
this->menuMode = FS_MENU_MODE_CONFIG;
|
||||
this->configMode = CM_FADE_IN_START;
|
||||
this->nextTitleLabel = FS_TITLE_OPEN_FILE;
|
||||
osSyncPrintf("Sram Start─Load 》》》》》 ");
|
||||
Sram_VerifyAndLoadAllSaves(this, &this->sramCtx);
|
||||
osSyncPrintf("終了!!!\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,7 +77,6 @@ void FileChoose_InitModeDraw(GameState* thisx) {
|
||||
*/
|
||||
void FileChoose_FadeInMenuElements(GameState* thisx) {
|
||||
FileChooseContext* this = (FileChooseContext*)thisx;
|
||||
SramContext* sramCtx = &this->sramCtx;
|
||||
s16 i;
|
||||
|
||||
this->titleAlpha[0] += VREG(1);
|
||||
@ -89,7 +85,7 @@ void FileChoose_FadeInMenuElements(GameState* thisx) {
|
||||
for (i = 0; i < 3; i++) {
|
||||
this->fileButtonAlpha[i] = this->windowAlpha;
|
||||
|
||||
if (SLOT_OCCUPIED(sramCtx, i)) {
|
||||
if (Save_GetSaveMetaInfo(i)->valid) {
|
||||
this->nameBoxAlpha[i] = this->nameAlpha[i] = this->windowAlpha;
|
||||
this->connectorAlpha[i] += VREG(1);
|
||||
if (this->connectorAlpha[i] >= 255) {
|
||||
@ -176,18 +172,12 @@ void FileChoose_FinishFadeIn(GameState* thisx) {
|
||||
void FileChoose_UpdateMainMenu(GameState* thisx) {
|
||||
static u8 emptyName[] = { 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E };
|
||||
FileChooseContext* this = (FileChooseContext*)thisx;
|
||||
SramContext* sramCtx = &this->sramCtx;
|
||||
Input* input = &this->state.input[0];
|
||||
bool dpad = CVar_GetS32("gDpadPauseName", 0);
|
||||
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_START) || CHECK_BTN_ALL(input->press.button, BTN_A)) {
|
||||
if (this->buttonIndex <= FS_BTN_MAIN_FILE_3) {
|
||||
osSyncPrintf("REGCK_ALL[%x]=%x,%x,%x,%x,%x,%x\n", this->buttonIndex,
|
||||
GET_NEWF(sramCtx, this->buttonIndex, 0), GET_NEWF(sramCtx, this->buttonIndex, 1),
|
||||
GET_NEWF(sramCtx, this->buttonIndex, 2), GET_NEWF(sramCtx, this->buttonIndex, 3),
|
||||
GET_NEWF(sramCtx, this->buttonIndex, 4), GET_NEWF(sramCtx, this->buttonIndex, 5));
|
||||
|
||||
if (!SLOT_OCCUPIED(sramCtx, this->buttonIndex)) {
|
||||
if (!Save_GetSaveMetaInfo(this->buttonIndex)->valid) {
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
this->configMode = CM_ROTATE_TO_NAME_ENTRY;
|
||||
this->kbdButton = FS_KBD_BTN_NONE;
|
||||
@ -199,16 +189,14 @@ void FileChoose_UpdateMainMenu(GameState* thisx) {
|
||||
this->newFileNameCharCount = 0;
|
||||
this->nameEntryBoxPosX = 120;
|
||||
this->nameEntryBoxAlpha = 0;
|
||||
memcpy(&this->fileNames[this->buttonIndex][0], &emptyName, 8);
|
||||
} else if (this->n64ddFlags[this->buttonIndex] == this->n64ddFlag) {
|
||||
memcpy(Save_GetSaveMetaInfo(this->buttonIndex)->playerName, &emptyName, 8);
|
||||
} else {
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
this->actionTimer = 8;
|
||||
this->selectMode = SM_FADE_MAIN_TO_SELECT;
|
||||
this->selectedFileIndex = this->buttonIndex;
|
||||
this->menuMode = FS_MENU_MODE_SELECT;
|
||||
this->nextTitleLabel = FS_TITLE_OPEN_FILE;
|
||||
} else if (!this->n64ddFlags[this->buttonIndex]) {
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
}
|
||||
} else {
|
||||
if (this->warningLabel == FS_WARNING_NONE) {
|
||||
@ -254,11 +242,12 @@ void FileChoose_UpdateMainMenu(GameState* thisx) {
|
||||
}
|
||||
|
||||
if (this->buttonIndex == FS_BTN_MAIN_COPY) {
|
||||
if (!SLOT_OCCUPIED(sramCtx, 0) && !SLOT_OCCUPIED(sramCtx, 1) && !SLOT_OCCUPIED(sramCtx, 2)) {
|
||||
if (!Save_GetSaveMetaInfo(0)->valid && !Save_GetSaveMetaInfo(1)->valid && !Save_GetSaveMetaInfo(2)->valid) {
|
||||
this->warningButtonIndex = this->buttonIndex;
|
||||
this->warningLabel = FS_WARNING_NO_FILE_COPY;
|
||||
this->emptyFileTextAlpha = 255;
|
||||
} else if (SLOT_OCCUPIED(sramCtx, 0) && SLOT_OCCUPIED(sramCtx, 1) && SLOT_OCCUPIED(sramCtx, 2)) {
|
||||
} else if (Save_GetSaveMetaInfo(0)->valid && Save_GetSaveMetaInfo(1)->valid &&
|
||||
Save_GetSaveMetaInfo(2)->valid) {
|
||||
this->warningButtonIndex = this->buttonIndex;
|
||||
this->warningLabel = FS_WARNING_NO_EMPTY_FILES;
|
||||
this->emptyFileTextAlpha = 255;
|
||||
@ -266,7 +255,7 @@ void FileChoose_UpdateMainMenu(GameState* thisx) {
|
||||
this->warningLabel = FS_WARNING_NONE;
|
||||
}
|
||||
} else if (this->buttonIndex == FS_BTN_MAIN_ERASE) {
|
||||
if (!SLOT_OCCUPIED(sramCtx, 0) && !SLOT_OCCUPIED(sramCtx, 1) && !SLOT_OCCUPIED(sramCtx, 2)) {
|
||||
if (!Save_GetSaveMetaInfo(0)->valid && !Save_GetSaveMetaInfo(1)->valid && !Save_GetSaveMetaInfo(2)->valid) {
|
||||
this->warningButtonIndex = this->buttonIndex;
|
||||
this->warningLabel = FS_WARNING_NO_FILE_ERASE;
|
||||
this->emptyFileTextAlpha = 255;
|
||||
@ -379,48 +368,6 @@ void FileChoose_PulsateCursor(GameState* thisx) {
|
||||
static s16 cursorAlphaTargets[] = { 70, 200 };
|
||||
FileChooseContext* this = (FileChooseContext*)thisx;
|
||||
s16 alphaStep;
|
||||
SramContext* sramCtx = &this->sramCtx;
|
||||
Input* debugInput = &this->state.input[2];
|
||||
|
||||
if (CHECK_BTN_ALL(debugInput->press.button, BTN_DLEFT)) {
|
||||
sramCtx->readBuff[SRAM_HEADER_LANGUAGE] = gSaveContext.language = LANGUAGE_ENG;
|
||||
*((u8*)0x80000002) = LANGUAGE_ENG;
|
||||
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, 3, OS_WRITE);
|
||||
osSyncPrintf("1:read_buff[]=%x, %x, %x, %x\n", sramCtx->readBuff[SRAM_HEADER_SOUND],
|
||||
sramCtx->readBuff[SRAM_HEADER_ZTARGET], sramCtx->readBuff[SRAM_HEADER_LANGUAGE],
|
||||
sramCtx->readBuff[SRAM_HEADER_MAGIC]);
|
||||
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ);
|
||||
osSyncPrintf("read_buff[]=%x, %x, %x, %x\n", sramCtx->readBuff[SRAM_HEADER_SOUND],
|
||||
sramCtx->readBuff[SRAM_HEADER_ZTARGET], sramCtx->readBuff[SRAM_HEADER_LANGUAGE],
|
||||
sramCtx->readBuff[SRAM_HEADER_MAGIC]);
|
||||
} else if (CHECK_BTN_ALL(debugInput->press.button, BTN_DUP)) {
|
||||
sramCtx->readBuff[SRAM_HEADER_LANGUAGE] = gSaveContext.language = LANGUAGE_GER;
|
||||
*((u8*)0x80000002) = LANGUAGE_GER;
|
||||
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, 3, OS_WRITE);
|
||||
osSyncPrintf("1:read_buff[]=%x, %x, %x, %x\n", sramCtx->readBuff[SRAM_HEADER_SOUND],
|
||||
sramCtx->readBuff[SRAM_HEADER_ZTARGET], sramCtx->readBuff[SRAM_HEADER_LANGUAGE],
|
||||
sramCtx->readBuff[SRAM_HEADER_MAGIC]);
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ);
|
||||
osSyncPrintf("read_buff[]=%x, %x, %x, %x\n", sramCtx->readBuff[SRAM_HEADER_SOUND],
|
||||
sramCtx->readBuff[SRAM_HEADER_ZTARGET], sramCtx->readBuff[SRAM_HEADER_LANGUAGE],
|
||||
sramCtx->readBuff[SRAM_HEADER_MAGIC]);
|
||||
} else if (CHECK_BTN_ALL(debugInput->press.button, BTN_DRIGHT)) {
|
||||
sramCtx->readBuff[SRAM_HEADER_LANGUAGE] = gSaveContext.language = LANGUAGE_FRA;
|
||||
*((u8*)0x80000002) = LANGUAGE_FRA;
|
||||
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, 3, OS_WRITE);
|
||||
osSyncPrintf("1:read_buff[]=%x, %x, %x, %x\n", sramCtx->readBuff[SRAM_HEADER_SOUND],
|
||||
sramCtx->readBuff[SRAM_HEADER_ZTARGET], sramCtx->readBuff[SRAM_HEADER_LANGUAGE],
|
||||
sramCtx->readBuff[SRAM_HEADER_MAGIC]);
|
||||
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ);
|
||||
osSyncPrintf("read_buff[]=%x, %x, %x, %x\n", sramCtx->readBuff[SRAM_HEADER_SOUND],
|
||||
sramCtx->readBuff[SRAM_HEADER_ZTARGET], sramCtx->readBuff[SRAM_HEADER_LANGUAGE],
|
||||
sramCtx->readBuff[SRAM_HEADER_MAGIC]);
|
||||
}
|
||||
|
||||
alphaStep = ABS(this->highlightColor[3] - cursorAlphaTargets[this->highlightPulseDir]) / XREG(35);
|
||||
|
||||
@ -510,7 +457,6 @@ void FileChoose_SetWindowContentVtx(GameState* thisx) {
|
||||
s16 phi_a1;
|
||||
s16 phi_ra;
|
||||
s16 temp_t1;
|
||||
SramContext* sramCtx = &this->sramCtx;
|
||||
|
||||
this->windowContentVtx = Graph_Alloc(this->state.gfxCtx, 0x288 * sizeof(Vtx));
|
||||
|
||||
@ -648,7 +594,7 @@ void FileChoose_SetWindowContentVtx(GameState* thisx) {
|
||||
phi_ra = 0x2C;
|
||||
|
||||
for (phi_t5 = 0; phi_t5 < 3; phi_t5++, phi_ra -= WREG(38)) {
|
||||
if (SLOT_OCCUPIED(sramCtx, phi_t5)) {
|
||||
if (Save_GetSaveMetaInfo(phi_t5)->valid) {
|
||||
phi_t0 = this->windowPosX - WREG(39);
|
||||
|
||||
if ((this->configMode == 0xF) && (phi_t5 == this->copyDestFileIndex)) {
|
||||
@ -822,8 +768,9 @@ void FileChoose_DrawFileInfo(GameState* thisx, s16 fileIndex, s16 isActive) {
|
||||
sNamePrimColors[isActive][2], this->nameAlpha[fileIndex]);
|
||||
|
||||
for (i = 0, vtxOffset = 0; vtxOffset < 0x20; i++, vtxOffset += 4) {
|
||||
FileChoose_DrawCharacter(this->state.gfxCtx,
|
||||
sp54->fontBuf + this->fileNames[fileIndex][i] * FONT_CHAR_TEX_SIZE, vtxOffset);
|
||||
FileChoose_DrawCharacter(
|
||||
this->state.gfxCtx, sp54->fontBuf + Save_GetSaveMetaInfo(fileIndex)->playerName[i] * FONT_CHAR_TEX_SIZE,
|
||||
vtxOffset);
|
||||
}
|
||||
}
|
||||
|
||||
@ -834,7 +781,8 @@ void FileChoose_DrawFileInfo(GameState* thisx, s16 fileIndex, s16 isActive) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0x00, 0x00, 255, 255, 255, this->fileInfoAlpha[fileIndex]);
|
||||
gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[D_8081284C[fileIndex]] + 0x24, 12, 0);
|
||||
|
||||
FileChoose_SplitNumber(this->deaths[fileIndex], &deathCountSplit[0], &deathCountSplit[1], &deathCountSplit[2]);
|
||||
FileChoose_SplitNumber(Save_GetSaveMetaInfo(fileIndex)->deaths, &deathCountSplit[0], &deathCountSplit[1],
|
||||
&deathCountSplit[2]);
|
||||
|
||||
// draw death count
|
||||
for (i = 0, vtxOffset = 0; i < 3; i++, vtxOffset += 4) {
|
||||
@ -844,7 +792,7 @@ void FileChoose_DrawFileInfo(GameState* thisx, s16 fileIndex, s16 isActive) {
|
||||
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
|
||||
heartType = (this->defense[fileIndex] == 0) ? 0 : 1;
|
||||
heartType = (Save_GetSaveMetaInfo(fileIndex)->defense == 0) ? 0 : 1;
|
||||
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
|
||||
@ -854,7 +802,7 @@ void FileChoose_DrawFileInfo(GameState* thisx, s16 fileIndex, s16 isActive) {
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, sHeartEnvColors[heartType][0], sHeartEnvColors[heartType][1],
|
||||
sHeartEnvColors[heartType][2], 255);
|
||||
|
||||
i = this->healthCapacities[fileIndex] / 0x10;
|
||||
i = Save_GetSaveMetaInfo(fileIndex)->healthCapacity / 0x10;
|
||||
|
||||
// draw hearts
|
||||
for (vtxOffset = 0, j = 0; j < i; j++, vtxOffset += 4) {
|
||||
@ -867,7 +815,7 @@ void FileChoose_DrawFileInfo(GameState* thisx, s16 fileIndex, s16 isActive) {
|
||||
|
||||
// draw quest items
|
||||
for (vtxOffset = 0, j = 0; j < 9; j++, vtxOffset += 4) {
|
||||
if (this->questItems[fileIndex] & gBitFlags[sQuestItemFlags[j]]) {
|
||||
if (Save_GetSaveMetaInfo(fileIndex)->questItems & gBitFlags[sQuestItemFlags[j]]) {
|
||||
gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[D_8081284C[fileIndex] + vtxOffset] + 0x80, 4, 0);
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0x00, 0x00, sQuestItemRed[j], sQuestItemGreen[j], sQuestItemBlue[j],
|
||||
@ -976,8 +924,14 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
|
||||
// draw file info box (large box when a file is selected)
|
||||
for (fileIndex = 0; fileIndex < 3; fileIndex++, temp += 20) {
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
|
||||
if (CVar_GetS32("gHudColors", 1) == 2) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150),
|
||||
CVar_GetS32("gCCFileChoosePrimB", 255), this->fileInfoAlpha[fileIndex]);
|
||||
} else {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
|
||||
this->fileInfoAlpha[fileIndex]);
|
||||
}
|
||||
gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[temp], 20, 0);
|
||||
|
||||
for (quadVtxIndex = 0, i = 0; i < 5; i++, quadVtxIndex += 4) {
|
||||
@ -992,27 +946,46 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
|
||||
// draw file button
|
||||
gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[temp], 20, 0);
|
||||
|
||||
isActive = ((this->n64ddFlag == this->n64ddFlags[i]) || (this->nameBoxAlpha[i] == 0)) ? 0 : 1;
|
||||
isActive = ((this->n64ddFlag == Save_GetSaveMetaInfo(i)->n64ddFlag) || (this->nameBoxAlpha[i] == 0)) ? 0 : 1;
|
||||
|
||||
if (CVar_GetS32("gHudColors", 1) == 2) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150),
|
||||
CVar_GetS32("gCCFileChoosePrimB", 255), this->fileButtonAlpha[i]);
|
||||
} else {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], sWindowContentColors[isActive][1],
|
||||
sWindowContentColors[isActive][2], this->fileButtonAlpha[i]);
|
||||
}
|
||||
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], sWindowContentColors[isActive][1],
|
||||
sWindowContentColors[isActive][2], this->fileButtonAlpha[i]);
|
||||
gDPLoadTextureBlock(POLY_OPA_DISP++, sFileButtonTextures[gSaveContext.language][i], G_IM_FMT_IA, G_IM_SIZ_16b,
|
||||
64, 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);
|
||||
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
|
||||
|
||||
// draw file name box
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], sWindowContentColors[isActive][1],
|
||||
sWindowContentColors[isActive][2], this->nameBoxAlpha[i]);
|
||||
if (CVar_GetS32("gHudColors", 1) == 2) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150),
|
||||
CVar_GetS32("gCCFileChoosePrimB", 255), this->nameBoxAlpha[i]);
|
||||
} else {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], sWindowContentColors[isActive][1],
|
||||
sWindowContentColors[isActive][2], this->nameBoxAlpha[i]);
|
||||
}
|
||||
|
||||
gDPLoadTextureBlock(POLY_OPA_DISP++, gFileSelNameBoxTex, G_IM_FMT_IA, G_IM_SIZ_16b, 108, 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);
|
||||
gSP1Quadrangle(POLY_OPA_DISP++, 4, 6, 7, 5, 0);
|
||||
|
||||
// draw disk label for 64DD
|
||||
if (this->n64ddFlags[i]) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], sWindowContentColors[isActive][1],
|
||||
sWindowContentColors[isActive][2], this->nameAlpha[i]);
|
||||
if (Save_GetSaveMetaInfo(i)->n64ddFlag) {
|
||||
if (CVar_GetS32("gHudColors", 1) == 2) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 0),
|
||||
CVar_GetS32("gCCFileChoosePrimG", 200), CVar_GetS32("gCCFileChoosePrimB", 255),
|
||||
this->nameAlpha[i]);
|
||||
} else {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0],
|
||||
sWindowContentColors[isActive][1], sWindowContentColors[isActive][2],
|
||||
this->nameAlpha[i]);
|
||||
}
|
||||
gDPLoadTextureBlock(POLY_OPA_DISP++, gFileSelDISKButtonTex, G_IM_FMT_IA, G_IM_SIZ_16b, 44, 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);
|
||||
@ -1020,21 +993,27 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
|
||||
}
|
||||
|
||||
// draw connectors
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], sWindowContentColors[isActive][1],
|
||||
sWindowContentColors[isActive][2], this->connectorAlpha[i]);
|
||||
if (CVar_GetS32("gHudColors", 1) == 2) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100),
|
||||
CVar_GetS32("gCCFileChoosePrimG", 150), CVar_GetS32("gCCFileChoosePrimB", 255),
|
||||
this->connectorAlpha[i]);
|
||||
} else {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], sWindowContentColors[isActive][1],
|
||||
sWindowContentColors[isActive][2], this->connectorAlpha[i]);
|
||||
}
|
||||
gDPLoadTextureBlock(POLY_OPA_DISP++, gFileSelConnectorTex, 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);
|
||||
gSP1Quadrangle(POLY_OPA_DISP++, 12, 14, 15, 13, 0);
|
||||
|
||||
if (this->n64ddFlags[i]) {
|
||||
if (Save_GetSaveMetaInfo(i)->n64ddFlag) {
|
||||
gSP1Quadrangle(POLY_OPA_DISP++, 16, 18, 19, 17, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// draw file info
|
||||
for (fileIndex = 0; fileIndex < 3; fileIndex++) {
|
||||
isActive = ((this->n64ddFlag == this->n64ddFlags[fileIndex]) || (this->nameBoxAlpha[fileIndex] == 0)) ? 0 : 1;
|
||||
isActive = ((this->n64ddFlag == Save_GetSaveMetaInfo(fileIndex)->n64ddFlag) || (this->nameBoxAlpha[fileIndex] == 0)) ? 0 : 1;
|
||||
FileChoose_DrawFileInfo(&this->state, fileIndex, isActive);
|
||||
}
|
||||
|
||||
@ -1047,8 +1026,14 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
|
||||
// draw primary action buttons (copy/erase)
|
||||
for (quadVtxIndex = 0, i = 0; i < 2; i++, quadVtxIndex += 4) {
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
|
||||
this->actionButtonAlpha[i]);
|
||||
|
||||
if (CVar_GetS32("gHudColors", 1) == 2) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150),
|
||||
CVar_GetS32("gCCFileChoosePrimB", 255), this->actionButtonAlpha[i]);
|
||||
} else {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
|
||||
this->actionButtonAlpha[i]);
|
||||
}
|
||||
gDPLoadTextureBlock(POLY_OPA_DISP++, sActionButtonTextures[gSaveContext.language][i], G_IM_FMT_IA, G_IM_SIZ_16b,
|
||||
64, 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);
|
||||
@ -1061,8 +1046,13 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
|
||||
for (quadVtxIndex = 0, i = 0; i < 2; i++, quadVtxIndex += 4) {
|
||||
temp = this->confirmButtonTexIndices[i];
|
||||
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
|
||||
this->confirmButtonAlpha[i]);
|
||||
if (CVar_GetS32("gHudColors", 1) == 2) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150),
|
||||
CVar_GetS32("gCCFileChoosePrimB", 255), this->confirmButtonAlpha[i]);
|
||||
} else {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
|
||||
this->confirmButtonAlpha[i]);
|
||||
}
|
||||
gDPLoadTextureBlock(POLY_OPA_DISP++, sActionButtonTextures[gSaveContext.language][temp], G_IM_FMT_IA,
|
||||
G_IM_SIZ_16b, 64, 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);
|
||||
@ -1071,8 +1061,14 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
|
||||
|
||||
// draw options button
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
|
||||
this->optionButtonAlpha);
|
||||
|
||||
if (CVar_GetS32("gHudColors", 1) == 2) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150),
|
||||
CVar_GetS32("gCCFileChoosePrimB", 255), this->optionButtonAlpha);
|
||||
} else {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
|
||||
this->optionButtonAlpha);
|
||||
}
|
||||
gDPLoadTextureBlock(POLY_OPA_DISP++, sOptionsButtonTextures[gSaveContext.language], G_IM_FMT_IA, G_IM_SIZ_16b, 64,
|
||||
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);
|
||||
@ -1087,8 +1083,15 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
gDPSetCombineLERP(POLY_OPA_DISP++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0, PRIMITIVE, 0, TEXEL0, 0,
|
||||
PRIMITIVE, 0);
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->highlightColor[0], this->highlightColor[1],
|
||||
this->highlightColor[2], this->highlightColor[3]);
|
||||
|
||||
if (CVar_GetS32("gHudColors", 1) == 2) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 155),
|
||||
CVar_GetS32("gCCFileChoosePrimG", 255), CVar_GetS32("gCCFileChoosePrimB", 255),
|
||||
this->highlightColor[3]);
|
||||
} else {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->highlightColor[0], this->highlightColor[1],
|
||||
this->highlightColor[2], this->highlightColor[3]);
|
||||
}
|
||||
gDPLoadTextureBlock(POLY_OPA_DISP++, gFileSelBigButtonHighlightTex, G_IM_FMT_I, G_IM_SIZ_8b, 72, 24, 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);
|
||||
@ -1143,8 +1146,14 @@ void FileChoose_ConfigModeDraw(GameState* thisx) {
|
||||
if ((this->configMode != CM_NAME_ENTRY) && (this->configMode != CM_START_NAME_ENTRY)) {
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
|
||||
this->windowAlpha);
|
||||
|
||||
if (CVar_GetS32("gHudColors", 1) == 2) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150),
|
||||
CVar_GetS32("gCCFileChoosePrimB", 255), this->windowAlpha);
|
||||
} else {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
|
||||
this->windowAlpha);
|
||||
}
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
|
||||
|
||||
Matrix_Translate(0.0f, 0.0f, -93.6f, MTXMODE_NEW);
|
||||
@ -1175,8 +1184,14 @@ void FileChoose_ConfigModeDraw(GameState* thisx) {
|
||||
if ((this->configMode >= CM_ROTATE_TO_NAME_ENTRY) && (this->configMode <= CM_NAME_ENTRY_TO_MAIN)) {
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
|
||||
this->windowAlpha);
|
||||
|
||||
if (CVar_GetS32("gHudColors", 1) == 2) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150),
|
||||
CVar_GetS32("gCCFileChoosePrimB", 255), this->windowAlpha);
|
||||
} else {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
|
||||
this->windowAlpha);
|
||||
}
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
|
||||
|
||||
Matrix_Translate(0.0f, 0.0f, -93.6f, MTXMODE_NEW);
|
||||
@ -1203,8 +1218,14 @@ void FileChoose_ConfigModeDraw(GameState* thisx) {
|
||||
if ((this->configMode >= CM_MAIN_TO_OPTIONS) && (this->configMode <= CM_OPTIONS_TO_MAIN)) {
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
|
||||
this->windowAlpha);
|
||||
|
||||
if (CVar_GetS32("gHudColors", 1) == 2) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150),
|
||||
CVar_GetS32("gCCFileChoosePrimB", 255), this->windowAlpha);
|
||||
} else {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
|
||||
this->windowAlpha);
|
||||
}
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
|
||||
|
||||
Matrix_Translate(0.0f, 0.0f, -93.6f, MTXMODE_NEW);
|
||||
@ -1242,7 +1263,6 @@ void FileChoose_ConfigModeDraw(GameState* thisx) {
|
||||
*/
|
||||
void FileChoose_FadeMainToSelect(GameState* thisx) {
|
||||
FileChooseContext* this = (FileChooseContext*)thisx;
|
||||
SramContext* sramCtx = &this->sramCtx;
|
||||
s16 i;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
@ -1251,7 +1271,7 @@ void FileChoose_FadeMainToSelect(GameState* thisx) {
|
||||
this->actionButtonAlpha[FS_BTN_ACTION_COPY] = this->actionButtonAlpha[FS_BTN_ACTION_ERASE] =
|
||||
this->optionButtonAlpha = this->fileButtonAlpha[i];
|
||||
|
||||
if (SLOT_OCCUPIED(sramCtx, i)) {
|
||||
if (Save_GetSaveMetaInfo(i)->valid) {
|
||||
this->nameAlpha[i] = this->nameBoxAlpha[i] = this->fileButtonAlpha[i];
|
||||
this->connectorAlpha[i] -= 31;
|
||||
}
|
||||
@ -1372,7 +1392,6 @@ void FileChoose_FadeOutFileInfo(GameState* thisx) {
|
||||
*/
|
||||
void FileChoose_MoveSelectedFileToSlot(GameState* thisx) {
|
||||
FileChooseContext* this = (FileChooseContext*)thisx;
|
||||
SramContext* sramCtx = &this->sramCtx;
|
||||
s16 yStep;
|
||||
s16 i;
|
||||
|
||||
@ -1394,7 +1413,7 @@ void FileChoose_MoveSelectedFileToSlot(GameState* thisx) {
|
||||
this->actionButtonAlpha[FS_BTN_ACTION_COPY] = this->actionButtonAlpha[FS_BTN_ACTION_ERASE] =
|
||||
this->optionButtonAlpha = this->fileButtonAlpha[i];
|
||||
|
||||
if (SLOT_OCCUPIED(sramCtx, i)) {
|
||||
if (Save_GetSaveMetaInfo(i)->valid) {
|
||||
this->nameBoxAlpha[i] = this->nameAlpha[i] = this->fileButtonAlpha[i];
|
||||
this->connectorAlpha[i] += 31;
|
||||
}
|
||||
@ -1445,14 +1464,14 @@ void FileChoose_LoadGame(GameState* thisx) {
|
||||
if (this->buttonIndex == FS_BTN_SELECT_FILE_1 && CVar_GetS32("gDebugEnabled", 0)) {
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
gSaveContext.fileNum = this->buttonIndex;
|
||||
Sram_OpenSave(&this->sramCtx);
|
||||
Sram_OpenSave();
|
||||
gSaveContext.gameMode = 0;
|
||||
SET_NEXT_GAMESTATE(&this->state, Select_Init, SelectContext);
|
||||
this->state.running = false;
|
||||
} else {
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
gSaveContext.fileNum = this->buttonIndex;
|
||||
Sram_OpenSave(&this->sramCtx);
|
||||
Sram_OpenSave();
|
||||
gSaveContext.gameMode = 0;
|
||||
SET_NEXT_GAMESTATE(&this->state, Gameplay_Init, GlobalContext);
|
||||
this->state.running = false;
|
||||
@ -1555,8 +1574,14 @@ void FileChoose_SelectModeDraw(GameState* thisx) {
|
||||
FileChoose_SetWindowContentVtx(&this->state);
|
||||
|
||||
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
|
||||
this->windowAlpha);
|
||||
|
||||
if (CVar_GetS32("gHudColors", 1) == 2) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150),
|
||||
CVar_GetS32("gCCFileChoosePrimB", 255), this->windowAlpha);
|
||||
} else {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
|
||||
this->windowAlpha);
|
||||
}
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
|
||||
|
||||
Matrix_Translate(0.0f, 0.0f, -93.6f, MTXMODE_NEW);
|
||||
@ -1619,6 +1644,52 @@ void FileChoose_Main(GameState* thisx) {
|
||||
this->stickRelX = input->rel.stick_x;
|
||||
this->stickRelY = input->rel.stick_y;
|
||||
|
||||
if (CVar_GetS32("gDpadHoldChange", 1) && CVar_GetS32("gDpadPauseName", 0)) {
|
||||
if (CHECK_BTN_ALL(input->cur.button, BTN_DLEFT)) {
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT)) {
|
||||
this->inputTimerX = 10;
|
||||
this->stickXDir = -1;
|
||||
} else if (--(this->inputTimerX) < 0) {
|
||||
this->inputTimerX = XREG(6);
|
||||
input->press.button |= BTN_DLEFT;
|
||||
}
|
||||
} else if (CHECK_BTN_ALL(input->rel.button, BTN_DLEFT)) {
|
||||
this->stickXDir = 0;
|
||||
} else if (CHECK_BTN_ALL(input->cur.button, BTN_DRIGHT)) {
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_DRIGHT)) {
|
||||
this->inputTimerX = 10;
|
||||
this->stickXDir = 1;
|
||||
} else if (--(this->inputTimerX) < 0) {
|
||||
this->inputTimerX = XREG(6);
|
||||
input->press.button |= BTN_DRIGHT;
|
||||
}
|
||||
} else if (CHECK_BTN_ALL(input->rel.button, BTN_DRIGHT)) {
|
||||
this->stickXDir = 0;
|
||||
}
|
||||
|
||||
if (CHECK_BTN_ALL(input->cur.button, BTN_DDOWN)) {
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) {
|
||||
this->inputTimerY = 10;
|
||||
this->stickYDir = -1;
|
||||
} else if (--(this->inputTimerY) < 0) {
|
||||
this->inputTimerY = XREG(6);
|
||||
input->press.button |= BTN_DDOWN;
|
||||
}
|
||||
} else if (CHECK_BTN_ALL(input->rel.button, BTN_DDOWN)) {
|
||||
this->stickYDir = 0;
|
||||
} else if (CHECK_BTN_ALL(input->cur.button, BTN_DUP)) {
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_DUP)) {
|
||||
this->inputTimerY = 10;
|
||||
this->stickYDir = -1;
|
||||
} else if (--(this->inputTimerY) < 0) {
|
||||
this->inputTimerY = XREG(6);
|
||||
input->press.button |= BTN_DUP;
|
||||
}
|
||||
} else if (CHECK_BTN_ALL(input->rel.button, BTN_DUP)) {
|
||||
this->stickYDir = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (this->stickRelX < -30) {
|
||||
if (this->stickXDir == -1) {
|
||||
this->inputTimerX--;
|
||||
@ -1649,7 +1720,7 @@ void FileChoose_Main(GameState* thisx) {
|
||||
|
||||
if (this->stickRelY < -30) {
|
||||
if (this->stickYDir == -1) {
|
||||
this->inputTimerY -= 1;
|
||||
this->inputTimerY--;
|
||||
if (this->inputTimerY < 0) {
|
||||
this->inputTimerY = 2;
|
||||
} else {
|
||||
@ -1661,7 +1732,7 @@ void FileChoose_Main(GameState* thisx) {
|
||||
}
|
||||
} else if (this->stickRelY > 30) {
|
||||
if (this->stickYDir == 1) {
|
||||
this->inputTimerY -= 1;
|
||||
this->inputTimerY--;
|
||||
if (this->inputTimerY < 0) {
|
||||
this->inputTimerY = 2;
|
||||
} else {
|
||||
@ -1689,7 +1760,14 @@ void FileChoose_Main(GameState* thisx) {
|
||||
|
||||
gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
|
||||
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 100, 255, 255, this->controlsAlpha);
|
||||
|
||||
if (CVar_GetS32("gHudColors", 1) == 2) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChooseTextPrimR", 0),
|
||||
CVar_GetS32("gCCFileChooseTextPrimG", 100), CVar_GetS32("gCCFileChooseTextPrimB", 255),
|
||||
this->controlsAlpha);
|
||||
} else {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 100, 255, 255, this->controlsAlpha);
|
||||
}
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
|
||||
gDPLoadTextureBlock(POLY_OPA_DISP++, controlsTextures[gSaveContext.language], G_IM_FMT_IA, G_IM_SIZ_8b, 144, 16,
|
||||
0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
|
||||
@ -1708,9 +1786,6 @@ void FileChoose_Main(GameState* thisx) {
|
||||
void FileChoose_InitContext(GameState* thisx) {
|
||||
FileChooseContext* this = (FileChooseContext*)thisx;
|
||||
EnvironmentContext* envCtx = &this->envCtx;
|
||||
SramContext* sramCtx = &this->sramCtx;
|
||||
|
||||
Sram_Alloc(&this->state, sramCtx);
|
||||
|
||||
ZREG(7) = 32;
|
||||
ZREG(8) = 22;
|
||||
@ -1863,17 +1938,6 @@ void FileChoose_InitContext(GameState* thisx) {
|
||||
|
||||
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
|
||||
gSaveContext.buttonStatus[3] = gSaveContext.buttonStatus[4] = BTN_ENABLED;
|
||||
|
||||
this->n64ddFlags[0] = this->n64ddFlags[1] = this->n64ddFlags[2] = this->defense[0] = this->defense[1] =
|
||||
this->defense[2] = 0;
|
||||
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ);
|
||||
|
||||
gSaveContext.language = sramCtx->readBuff[SRAM_HEADER_LANGUAGE];
|
||||
|
||||
if (gSaveContext.language >= LANGUAGE_MAX) {
|
||||
sramCtx->readBuff[SRAM_HEADER_LANGUAGE] = gSaveContext.language = LANGUAGE_ENG;
|
||||
}
|
||||
}
|
||||
|
||||
void FileChoose_Destroy(GameState* thisx) {
|
||||
|
@ -60,7 +60,6 @@ void FileChoose_SetupCopySource(GameState* thisx) {
|
||||
*/
|
||||
void FileChoose_SelectCopySource(GameState* thisx) {
|
||||
FileChooseContext* this = (FileChooseContext*)thisx;
|
||||
SramContext* sramCtx = &this->sramCtx;
|
||||
Input* input = &this->state.input[0];
|
||||
bool dpad = CVar_GetS32("gDpadPauseName", 0);
|
||||
|
||||
@ -73,7 +72,7 @@ void FileChoose_SelectCopySource(GameState* thisx) {
|
||||
this->warningLabel = FS_WARNING_NONE;
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CLOSE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
} else if (CHECK_BTN_ANY(input->press.button, BTN_A | BTN_START)) {
|
||||
if (SLOT_OCCUPIED(sramCtx, this->buttonIndex)) {
|
||||
if (Save_GetSaveMetaInfo(this->buttonIndex)->valid) {
|
||||
this->actionTimer = 8;
|
||||
this->selectedFileIndex = this->buttonIndex;
|
||||
this->configMode = CM_SETUP_COPY_DEST_1;
|
||||
@ -102,7 +101,7 @@ void FileChoose_SelectCopySource(GameState* thisx) {
|
||||
}
|
||||
|
||||
if (this->buttonIndex != FS_BTN_COPY_QUIT) {
|
||||
if (!SLOT_OCCUPIED(sramCtx, this->buttonIndex)) {
|
||||
if (!Save_GetSaveMetaInfo(this->buttonIndex)->valid) {
|
||||
this->warningLabel = FS_WARNING_FILE_EMPTY;
|
||||
this->warningButtonIndex = this->buttonIndex;
|
||||
this->emptyFileTextAlpha = 255;
|
||||
@ -173,7 +172,6 @@ void FileChoose_SetupCopyDest2(GameState* thisx) {
|
||||
*/
|
||||
void FileChoose_SelectCopyDest(GameState* thisx) {
|
||||
FileChooseContext* this = (FileChooseContext*)thisx;
|
||||
SramContext* sramCtx = &this->sramCtx;
|
||||
Input* input = &this->state.input[0];
|
||||
bool dpad = CVar_GetS32("gDpadPauseName", 0);
|
||||
|
||||
@ -185,7 +183,7 @@ void FileChoose_SelectCopyDest(GameState* thisx) {
|
||||
this->configMode = CM_EXIT_TO_COPY_SOURCE_1;
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CLOSE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
} else if (CHECK_BTN_ANY(input->press.button, BTN_A | BTN_START)) {
|
||||
if (!SLOT_OCCUPIED(sramCtx, this->buttonIndex)) {
|
||||
if (!Save_GetSaveMetaInfo(this->buttonIndex)->valid) {
|
||||
this->copyDestFileIndex = this->buttonIndex;
|
||||
this->nextTitleLabel = FS_TITLE_COPY_CONFIRM;
|
||||
this->actionTimer = 8;
|
||||
@ -227,7 +225,7 @@ void FileChoose_SelectCopyDest(GameState* thisx) {
|
||||
}
|
||||
|
||||
if (this->buttonIndex != FS_BTN_COPY_QUIT) {
|
||||
if (SLOT_OCCUPIED(sramCtx, this->buttonIndex)) {
|
||||
if (Save_GetSaveMetaInfo(this->buttonIndex)->valid) {
|
||||
this->warningLabel = FS_WARNING_FILE_IN_USE;
|
||||
this->warningButtonIndex = this->buttonIndex;
|
||||
this->emptyFileTextAlpha = 255;
|
||||
@ -264,7 +262,6 @@ void FileChoose_ExitToCopySource1(GameState* thisx) {
|
||||
*/
|
||||
void FileChoose_ExitToCopySource2(GameState* thisx) {
|
||||
FileChooseContext* this = (FileChooseContext*)thisx;
|
||||
SramContext* sramCtx = &this->sramCtx;
|
||||
s16 i;
|
||||
s16 yStep;
|
||||
|
||||
@ -298,7 +295,6 @@ void FileChoose_ExitToCopySource2(GameState* thisx) {
|
||||
void FileChoose_SetupCopyConfirm1(GameState* thisx) {
|
||||
static s16 D_808124A4[] = { -56, -40, -24, 0 };
|
||||
FileChooseContext* this = (FileChooseContext*)thisx;
|
||||
SramContext* sramCtx = &this->sramCtx;
|
||||
s16 i;
|
||||
s16 yStep;
|
||||
|
||||
@ -309,7 +305,7 @@ void FileChoose_SetupCopyConfirm1(GameState* thisx) {
|
||||
if ((i != this->copyDestFileIndex) && (i != this->selectedFileIndex)) {
|
||||
this->fileButtonAlpha[i] -= 25;
|
||||
|
||||
if (SLOT_OCCUPIED(sramCtx, i)) {
|
||||
if (Save_GetSaveMetaInfo(i)->valid) {
|
||||
this->connectorAlpha[i] -= 31;
|
||||
this->nameBoxAlpha[i] = this->nameAlpha[i] = this->fileButtonAlpha[i];
|
||||
}
|
||||
@ -359,7 +355,6 @@ void FileChoose_SetupCopyConfirm2(GameState* thisx) {
|
||||
*/
|
||||
void FileChoose_CopyConfirm(GameState* thisx) {
|
||||
FileChooseContext* this = (FileChooseContext*)thisx;
|
||||
SramContext* sramCtx = &this->sramCtx;
|
||||
Input* input = &this->state.input[0];
|
||||
u16 dayTime;
|
||||
bool dpad = CVar_GetS32("gDpadPauseName", 0);
|
||||
@ -372,7 +367,7 @@ void FileChoose_CopyConfirm(GameState* thisx) {
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CLOSE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
} else if (CHECK_BTN_ANY(input->press.button, BTN_A | BTN_START)) {
|
||||
dayTime = gSaveContext.dayTime;
|
||||
Sram_CopySave(this, sramCtx);
|
||||
Save_CopyFile(this->selectedFileIndex, this->copyDestFileIndex);
|
||||
gSaveContext.dayTime = dayTime;
|
||||
this->fileInfoAlpha[this->copyDestFileIndex] = this->nameAlpha[this->copyDestFileIndex] = 0;
|
||||
this->nextTitleLabel = FS_TITLE_COPY_COMPLETE;
|
||||
@ -392,7 +387,6 @@ void FileChoose_CopyConfirm(GameState* thisx) {
|
||||
*/
|
||||
void FileChoose_ReturnToCopyDest(GameState* thisx) {
|
||||
FileChooseContext* this = (FileChooseContext*)thisx;
|
||||
SramContext* sramCtx = &this->sramCtx;
|
||||
s16 i;
|
||||
s16 yStep;
|
||||
|
||||
@ -404,7 +398,7 @@ void FileChoose_ReturnToCopyDest(GameState* thisx) {
|
||||
if ((i != this->copyDestFileIndex) && (i != this->selectedFileIndex)) {
|
||||
this->fileButtonAlpha[i] += 25;
|
||||
|
||||
if (SLOT_OCCUPIED(sramCtx, i)) {
|
||||
if (Save_GetSaveMetaInfo(i)->valid) {
|
||||
this->nameBoxAlpha[i] = this->nameAlpha[i] = this->fileButtonAlpha[i];
|
||||
this->connectorAlpha[i] += 31;
|
||||
}
|
||||
@ -535,7 +529,6 @@ void FileChoose_CopyAnim4(GameState* thisx) {
|
||||
*/
|
||||
void FileChoose_CopyAnim5(GameState* thisx) {
|
||||
FileChooseContext* this = (FileChooseContext*)thisx;
|
||||
SramContext* sramCtx = &this->sramCtx;
|
||||
s16 i;
|
||||
s16 yStep;
|
||||
|
||||
@ -553,7 +546,7 @@ void FileChoose_CopyAnim5(GameState* thisx) {
|
||||
if (i != this->buttonIndex) {
|
||||
this->fileButtonAlpha[i] += 25;
|
||||
|
||||
if (SLOT_OCCUPIED(sramCtx, i)) {
|
||||
if (Save_GetSaveMetaInfo(i)->valid) {
|
||||
this->nameBoxAlpha[i] = this->nameAlpha[i] = this->fileButtonAlpha[i];
|
||||
this->connectorAlpha[i] += 31;
|
||||
}
|
||||
@ -572,7 +565,7 @@ void FileChoose_CopyAnim5(GameState* thisx) {
|
||||
this->fileButtonAlpha[i] = 200;
|
||||
this->nameBoxAlpha[i] = this->nameAlpha[i] = this->connectorAlpha[i];
|
||||
|
||||
if (SLOT_OCCUPIED(sramCtx, i)) {
|
||||
if (Save_GetSaveMetaInfo(i)->valid) {
|
||||
this->connectorAlpha[i] = 255;
|
||||
this->nameBoxAlpha[i] = this->nameAlpha[i] = this->fileButtonAlpha[i];
|
||||
}
|
||||
@ -681,7 +674,6 @@ void FileChoose_SetupEraseSelect(GameState* thisx) {
|
||||
*/
|
||||
void FileChoose_EraseSelect(GameState* thisx) {
|
||||
FileChooseContext* this = (FileChooseContext*)thisx;
|
||||
SramContext* sramCtx = &this->sramCtx;
|
||||
Input* input = &this->state.input[0];
|
||||
bool dpad = CVar_GetS32("gDpadPauseName", 0);
|
||||
|
||||
@ -694,7 +686,7 @@ void FileChoose_EraseSelect(GameState* thisx) {
|
||||
this->warningLabel = FS_WARNING_NONE;
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CLOSE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
} else if (CHECK_BTN_ANY(input->press.button, BTN_A | BTN_START)) {
|
||||
if (SLOT_OCCUPIED(sramCtx, this->buttonIndex)) {
|
||||
if (Save_GetSaveMetaInfo(this->buttonIndex)->valid) {
|
||||
this->actionTimer = 8;
|
||||
this->selectedFileIndex = this->buttonIndex;
|
||||
this->configMode = CM_SETUP_ERASE_CONFIRM_1;
|
||||
@ -721,7 +713,7 @@ void FileChoose_EraseSelect(GameState* thisx) {
|
||||
}
|
||||
|
||||
if (this->buttonIndex != FS_BTN_ERASE_QUIT) {
|
||||
if (!SLOT_OCCUPIED(sramCtx, this->buttonIndex)) {
|
||||
if (!Save_GetSaveMetaInfo(this->buttonIndex)->valid) {
|
||||
this->warningLabel = FS_WARNING_FILE_EMPTY;
|
||||
this->warningButtonIndex = this->buttonIndex;
|
||||
this->emptyFileTextAlpha = 255;
|
||||
@ -741,7 +733,6 @@ void FileChoose_EraseSelect(GameState* thisx) {
|
||||
void FileChoose_SetupEraseConfirm1(GameState* thisx) {
|
||||
static s16 D_808124AC[] = { 0, 16, 32 };
|
||||
FileChooseContext* this = (FileChooseContext*)thisx;
|
||||
SramContext* sramCtx = &this->sramCtx;
|
||||
s16 i;
|
||||
s16 yStep;
|
||||
|
||||
@ -749,7 +740,7 @@ void FileChoose_SetupEraseConfirm1(GameState* thisx) {
|
||||
if (i != this->buttonIndex) {
|
||||
this->fileButtonAlpha[i] -= 25;
|
||||
|
||||
if (SLOT_OCCUPIED(sramCtx, i)) {
|
||||
if (Save_GetSaveMetaInfo(i)->valid) {
|
||||
this->connectorAlpha[i] -= 31;
|
||||
this->nameBoxAlpha[i] = this->nameAlpha[i] = this->fileButtonAlpha[i];
|
||||
}
|
||||
@ -775,7 +766,7 @@ void FileChoose_SetupEraseConfirm1(GameState* thisx) {
|
||||
if (i != this->buttonIndex) {
|
||||
this->fileButtonAlpha[i] = 0;
|
||||
|
||||
if (SLOT_OCCUPIED(sramCtx, i)) {
|
||||
if (Save_GetSaveMetaInfo(i)->valid) {
|
||||
this->connectorAlpha[i] = 0;
|
||||
this->nameBoxAlpha[i] = this->nameAlpha[i] = this->fileButtonAlpha[i] = 0;
|
||||
}
|
||||
@ -831,7 +822,7 @@ void FileChoose_EraseConfirm(GameState* thisx) {
|
||||
this->actionTimer = 8;
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CLOSE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
} else if (CHECK_BTN_ANY(input->press.button, BTN_A | BTN_START)) {
|
||||
this->n64ddFlags[this->selectedFileIndex] = this->connectorAlpha[this->selectedFileIndex] = 0;
|
||||
Save_GetSaveMetaInfo(this->selectedFileIndex)->n64ddFlag = this->connectorAlpha[this->selectedFileIndex] = 0;
|
||||
Audio_PlaySoundGeneral(NA_SE_EV_DIAMOND_SWITCH, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
this->actionTimer = 8;
|
||||
this->configMode = CM_ERASE_ANIM_1;
|
||||
@ -869,7 +860,6 @@ void FileChoose_ExitToEraseSelect1(GameState* thisx) {
|
||||
*/
|
||||
void FileChoose_ExitToEraseSelect2(GameState* thisx) {
|
||||
FileChooseContext* this = (FileChooseContext*)thisx;
|
||||
SramContext* sramCtx = &this->sramCtx;
|
||||
s16 i;
|
||||
s16 yStep;
|
||||
|
||||
@ -885,7 +875,7 @@ void FileChoose_ExitToEraseSelect2(GameState* thisx) {
|
||||
if (i != this->buttonIndex) {
|
||||
this->fileButtonAlpha[i] += 25;
|
||||
|
||||
if (SLOT_OCCUPIED(sramCtx, i)) {
|
||||
if (Save_GetSaveMetaInfo(i)->valid) {
|
||||
this->nameBoxAlpha[i] = this->nameAlpha[i] = this->fileButtonAlpha[i];
|
||||
this->connectorAlpha[i] += 31;
|
||||
}
|
||||
@ -915,7 +905,6 @@ void FileChoose_ExitToEraseSelect2(GameState* thisx) {
|
||||
void FileChoose_EraseAnim1(GameState* thisx) {
|
||||
static s16 D_80813800;
|
||||
FileChooseContext* this = (FileChooseContext*)thisx;
|
||||
SramContext* sramCtx = &this->sramCtx;
|
||||
|
||||
if (sEraseDelayTimer == 0) {
|
||||
if (this->actionTimer == 8) {
|
||||
@ -935,7 +924,7 @@ void FileChoose_EraseAnim1(GameState* thisx) {
|
||||
D_80813800 += 2;
|
||||
|
||||
if (this->actionTimer == 0) {
|
||||
Sram_EraseSave(this, sramCtx);
|
||||
Save_DeleteFile(this->selectedFileIndex);
|
||||
this->titleLabel = this->nextTitleLabel;
|
||||
this->titleAlpha[0] = 255;
|
||||
this->titleAlpha[1] = this->connectorAlpha[this->selectedFileIndex] = 0;
|
||||
@ -981,7 +970,6 @@ void FileChoose_EraseAnim2(GameState* thisx) {
|
||||
*/
|
||||
void FileChoose_EraseAnim3(GameState* thisx) {
|
||||
FileChooseContext* this = (FileChooseContext*)thisx;
|
||||
SramContext* sramCtx = &this->sramCtx;
|
||||
s16 i;
|
||||
s16 yStep;
|
||||
|
||||
@ -998,7 +986,7 @@ void FileChoose_EraseAnim3(GameState* thisx) {
|
||||
for (i = 0; i < 3; i++) {
|
||||
this->fileButtonAlpha[i] += 25;
|
||||
|
||||
if (SLOT_OCCUPIED(sramCtx, i)) {
|
||||
if (Save_GetSaveMetaInfo(i)->valid) {
|
||||
this->nameBoxAlpha[i] = this->nameAlpha[i] = this->fileButtonAlpha[i];
|
||||
this->connectorAlpha[i] += 31;
|
||||
}
|
||||
|
@ -113,6 +113,7 @@ void FileChoose_SetNameEntryVtx(GameState* thisx) {
|
||||
s16 phi_t1;
|
||||
u8 temp;
|
||||
s16 phi_v0;
|
||||
char* filename = Save_GetSaveMetaInfo(this->buttonIndex)->playerName;
|
||||
|
||||
if (1) {}
|
||||
if (1) {}
|
||||
@ -133,7 +134,14 @@ void FileChoose_SetNameEntryVtx(GameState* thisx) {
|
||||
|
||||
phi_s0 = 0x10;
|
||||
for (phi_t1 = 0; phi_t1 < 2; phi_t1++, phi_s0 += 4) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2], 255);
|
||||
|
||||
if (CVar_GetS32("gHudColors", 1) == 2) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150),
|
||||
CVar_GetS32("gCCFileChoosePrimB", 255), 255);
|
||||
} else {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
|
||||
255);
|
||||
}
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
|
||||
gDPLoadTextureBlock(POLY_OPA_DISP++, sBackspaceEndTextures[gSaveContext.language][phi_t1], G_IM_FMT_IA,
|
||||
G_IM_SIZ_16b, sBackspaceEndWidths[phi_t1], 16, 0, G_TX_NOMIRROR | G_TX_WRAP,
|
||||
@ -145,7 +153,7 @@ void FileChoose_SetNameEntryVtx(GameState* thisx) {
|
||||
|
||||
for (phi_s0 = 0, phi_t1 = 0; phi_t1 < 44; phi_t1 += 4, phi_s0++) {
|
||||
if ((phi_s0 > 0) && (phi_s0 < 9)) {
|
||||
temp = this->fileNames[this->buttonIndex][phi_s0 - 1];
|
||||
temp = filename[phi_s0 - 1];
|
||||
|
||||
this->nameEntryVtx[phi_t1].v.ob[0] = this->nameEntryVtx[phi_t1 + 2].v.ob[0] =
|
||||
D_808125EC[phi_s0] + this->nameEntryBoxPosX + D_808124C0[temp];
|
||||
@ -195,8 +203,15 @@ void FileChoose_SetNameEntryVtx(GameState* thisx) {
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE,
|
||||
ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
|
||||
this->nameEntryBoxAlpha);
|
||||
|
||||
if (CVar_GetS32("gHudColors", 1) == 2) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100),
|
||||
CVar_GetS32("gCCFileChoosePrimG", 150), CVar_GetS32("gCCFileChoosePrimB", 255),
|
||||
this->nameEntryBoxAlpha);
|
||||
} else {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
|
||||
this->nameEntryBoxAlpha);
|
||||
}
|
||||
gSPVertex(POLY_OPA_DISP++, this->nameEntryVtx, 4, 0);
|
||||
gDPLoadTextureBlock(POLY_OPA_DISP++, gFileSelNameBoxTex, G_IM_FMT_IA, G_IM_SIZ_16b, 108, 16, 0,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
|
||||
@ -209,8 +224,7 @@ void FileChoose_SetNameEntryVtx(GameState* thisx) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, this->nameEntryBoxAlpha);
|
||||
|
||||
for (phi_v0 = 0, phi_s0 = 0; phi_s0 < 0x20; phi_s0 += 4, phi_v0++) {
|
||||
FileChoose_DrawCharacter(this->state.gfxCtx,
|
||||
font->fontBuf + this->fileNames[this->buttonIndex][phi_v0] * FONT_CHAR_TEX_SIZE,
|
||||
FileChoose_DrawCharacter(this->state.gfxCtx, font->fontBuf + filename[phi_v0] * FONT_CHAR_TEX_SIZE,
|
||||
phi_s0);
|
||||
}
|
||||
|
||||
@ -267,6 +281,7 @@ void FileChoose_DrawNameEntry(GameState* thisx) {
|
||||
s16 tmp;
|
||||
u16 dayTime;
|
||||
s16 validName;
|
||||
char* filename = Save_GetSaveMetaInfo(this->buttonIndex)->playerName;
|
||||
|
||||
OPEN_DISPS(this->state.gfxCtx, "../z_file_nameset_PAL.c", 368);
|
||||
|
||||
@ -318,8 +333,15 @@ void FileChoose_DrawNameEntry(GameState* thisx) {
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
gDPSetCombineLERP(POLY_OPA_DISP++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0, PRIMITIVE, 0, TEXEL0, 0,
|
||||
PRIMITIVE, 0);
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->highlightColor[0], this->highlightColor[1], this->highlightColor[2],
|
||||
this->highlightColor[3]);
|
||||
|
||||
if (CVar_GetS32("gHudColors", 1) == 2) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100),
|
||||
CVar_GetS32("gCCFileChoosePrimG", 150), CVar_GetS32("gCCFileChoosePrimB", 255),
|
||||
this->highlightColor[3]);
|
||||
} else {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->highlightColor[0], this->highlightColor[1],
|
||||
this->highlightColor[2], this->highlightColor[3]);
|
||||
}
|
||||
gDPLoadTextureBlock(POLY_OPA_DISP++, gFileSelCharHighlightTex, G_IM_FMT_I, G_IM_SIZ_8b, 24, 24, 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);
|
||||
@ -354,12 +376,12 @@ void FileChoose_DrawNameEntry(GameState* thisx) {
|
||||
this->kbdY = 5;
|
||||
this->kbdX = 4;
|
||||
} else if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
|
||||
if ((this->newFileNameCharCount == 7) && (this->fileNames[this->buttonIndex][7] != 0x3E)) {
|
||||
if ((this->newFileNameCharCount == 7) && (filename[7] != 0x3E)) {
|
||||
for (i = this->newFileNameCharCount; i < 7; i++) {
|
||||
this->fileNames[this->buttonIndex][i] = this->fileNames[this->buttonIndex][i + 1];
|
||||
filename[i] = filename[i + 1];
|
||||
}
|
||||
|
||||
this->fileNames[this->buttonIndex][i] = 0x3E;
|
||||
filename[i] = 0x3E;
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_S, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
} else {
|
||||
this->newFileNameCharCount--;
|
||||
@ -369,10 +391,10 @@ void FileChoose_DrawNameEntry(GameState* thisx) {
|
||||
this->configMode = CM_NAME_ENTRY_TO_MAIN;
|
||||
} else {
|
||||
for (i = this->newFileNameCharCount; i < 7; i++) {
|
||||
this->fileNames[this->buttonIndex][i] = this->fileNames[this->buttonIndex][i + 1];
|
||||
filename[i] = filename[i + 1];
|
||||
}
|
||||
|
||||
this->fileNames[this->buttonIndex][i] = 0x3E;
|
||||
filename[i] = 0x3E;
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_S, &D_801333D4, 4, &D_801333E0, &D_801333E0,
|
||||
&D_801333E8);
|
||||
}
|
||||
@ -390,7 +412,7 @@ void FileChoose_DrawNameEntry(GameState* thisx) {
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_A)) {
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_S, &D_801333D4, 4, &D_801333E0, &D_801333E0,
|
||||
&D_801333E8);
|
||||
this->fileNames[this->buttonIndex][this->newFileNameCharCount] = D_808123F0[this->charIndex];
|
||||
filename[this->newFileNameCharCount] = D_808123F0[this->charIndex];
|
||||
this->newFileNameCharCount++;
|
||||
|
||||
if (this->newFileNameCharCount > 7) {
|
||||
@ -399,12 +421,12 @@ void FileChoose_DrawNameEntry(GameState* thisx) {
|
||||
}
|
||||
} else if (CHECK_BTN_ALL(input->press.button, BTN_A) && (this->charPage != this->kbdButton)) {
|
||||
if (this->kbdButton == FS_KBD_BTN_BACKSPACE) {
|
||||
if ((this->newFileNameCharCount == 7) && (this->fileNames[this->buttonIndex][7] != 0x3E)) {
|
||||
if ((this->newFileNameCharCount == 7) && (filename[7] != 0x3E)) {
|
||||
for (i = this->newFileNameCharCount; i < 7; i++) {
|
||||
this->fileNames[this->buttonIndex][i] = this->fileNames[this->buttonIndex][i + 1];
|
||||
filename[i] = filename[i + 1];
|
||||
}
|
||||
|
||||
this->fileNames[this->buttonIndex][i] = 0x3E;
|
||||
filename[i] = 0x3E;
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_S, &D_801333D4, 4, &D_801333E0, &D_801333E0,
|
||||
&D_801333E8);
|
||||
} else {
|
||||
@ -415,10 +437,10 @@ void FileChoose_DrawNameEntry(GameState* thisx) {
|
||||
}
|
||||
|
||||
for (i = this->newFileNameCharCount; i < 7; i++) {
|
||||
this->fileNames[this->buttonIndex][i] = this->fileNames[this->buttonIndex][i + 1];
|
||||
filename[i] = filename[i + 1];
|
||||
}
|
||||
|
||||
this->fileNames[this->buttonIndex][i] = 0x3E;
|
||||
filename[i] = 0x3E;
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_S, &D_801333D4, 4, &D_801333E0, &D_801333E0,
|
||||
&D_801333E8);
|
||||
}
|
||||
@ -426,7 +448,7 @@ void FileChoose_DrawNameEntry(GameState* thisx) {
|
||||
validName = false;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (this->fileNames[this->buttonIndex][i] != 0x3E) {
|
||||
if (filename[i] != 0x3E) {
|
||||
validName = true;
|
||||
break;
|
||||
}
|
||||
@ -437,7 +459,7 @@ void FileChoose_DrawNameEntry(GameState* thisx) {
|
||||
&D_801333E8);
|
||||
gSaveContext.fileNum = this->buttonIndex;
|
||||
dayTime = ((void)0, gSaveContext.dayTime);
|
||||
Sram_InitSave(this, &this->sramCtx);
|
||||
Sram_InitSave(this);
|
||||
gSaveContext.dayTime = dayTime;
|
||||
this->configMode = CM_NAME_ENTRY_TO_MAIN;
|
||||
this->nameBoxAlpha[this->buttonIndex] = this->nameAlpha[this->buttonIndex] = 200;
|
||||
@ -655,20 +677,15 @@ static u8 sSelectedSetting;
|
||||
*/
|
||||
void FileChoose_UpdateOptionsMenu(GameState* thisx) {
|
||||
FileChooseContext* this = (FileChooseContext*)thisx;
|
||||
SramContext* sramCtx = &this->sramCtx;
|
||||
Input* input = &this->state.input[0];
|
||||
bool dpad = CVar_GetS32("gDpadPauseName", 0);
|
||||
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
this->configMode = CM_OPTIONS_TO_MAIN;
|
||||
sramCtx->readBuff[0] = gSaveContext.audioSetting;
|
||||
sramCtx->readBuff[1] = gSaveContext.zTargetSetting;
|
||||
osSyncPrintf("SAVE");
|
||||
Sram_WriteSramHeader(sramCtx);
|
||||
Save_SaveGlobal();
|
||||
osSyncPrintf(VT_FGCOL(YELLOW));
|
||||
osSyncPrintf("sram->read_buff[2] = J_N = %x\n", sramCtx->readBuff[2]);
|
||||
osSyncPrintf("sram->read_buff[2] = J_N = %x\n", &sramCtx->readBuff[2]);
|
||||
osSyncPrintf("Na_SetSoundOutputMode = %d\n", gSaveContext.audioSetting);
|
||||
osSyncPrintf("Na_SetSoundOutputMode = %d\n", gSaveContext.audioSetting);
|
||||
osSyncPrintf("Na_SetSoundOutputMode = %d\n", gSaveContext.audioSetting);
|
||||
|
@ -224,7 +224,7 @@ void Title_Main(GameState* thisx) {
|
||||
|
||||
if (CVar_GetS32("gSkipLogoTitle",0)!=0) {
|
||||
gSaveContext.language = CVar_GetS32("gLanguages", 0);
|
||||
Sram_InitSram(&this->state, &this->sramCtx);
|
||||
Sram_InitSram(&this->state);
|
||||
s16 selectedfile = CVar_GetS32("gSaveFileID", 0);
|
||||
if (selectedfile == 4) {
|
||||
selectedfile = 0xFF;
|
||||
@ -242,13 +242,13 @@ void Title_Main(GameState* thisx) {
|
||||
}
|
||||
if (selectedfile == 0xFF) {
|
||||
gSaveContext.fileNum = selectedfile;
|
||||
Sram_OpenSave(&this->sramCtx);
|
||||
Sram_OpenSave();
|
||||
gSaveContext.gameMode = 0;
|
||||
this->state.running = false;
|
||||
SET_NEXT_GAMESTATE(&this->state, Select_Init, SelectContext);
|
||||
} else {
|
||||
gSaveContext.fileNum = selectedfile;
|
||||
Sram_OpenSave(&this->sramCtx);
|
||||
Sram_OpenSave();
|
||||
gSaveContext.gameMode = 0;
|
||||
this->state.running = false;
|
||||
//return;
|
||||
@ -322,7 +322,7 @@ void Title_Main(GameState* thisx) {
|
||||
void Title_Destroy(GameState* thisx) {
|
||||
TitleContext* this = (TitleContext*)thisx;
|
||||
|
||||
Sram_InitSram(&this->state, &this->sramCtx);
|
||||
Sram_InitSram(&this->state);
|
||||
}
|
||||
|
||||
void Title_Init(GameState* thisx) {
|
||||
@ -346,7 +346,6 @@ void Title_Init(GameState* thisx) {
|
||||
this->state.destroy = Title_Destroy;
|
||||
this->exit = false;
|
||||
gSaveContext.fileNum = 0xFF;
|
||||
Sram_Alloc(&this->state, &this->sramCtx);
|
||||
this->ult = 0;
|
||||
this->unk_1D4 = 0x14;
|
||||
this->coverAlpha = 255;
|
||||
|
@ -163,7 +163,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) {
|
||||
s16 cursorPoint;
|
||||
s16 cursorX;
|
||||
s16 cursorY;
|
||||
volatile s16 oldCursorPoint;
|
||||
s16 oldCursorPoint;
|
||||
bool dpad = CVar_GetS32("gDpadPauseName", 0);
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_equipment.c", 219);
|
||||
@ -214,10 +214,8 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) {
|
||||
cursorMoveResult = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (gBitFlags[pauseCtx->cursorPoint[PAUSE_EQUIP] - 1] & gSaveContext.inventory.equipment) {
|
||||
cursorMoveResult = 2;
|
||||
}
|
||||
} else if ((gBitFlags[pauseCtx->cursorPoint[PAUSE_EQUIP] - 1] & gSaveContext.inventory.equipment) || CVar_GetS32("gPauseAnyCursor", 0)) {
|
||||
cursorMoveResult = 2;
|
||||
}
|
||||
} else {
|
||||
pauseCtx->cursorX[PAUSE_EQUIP] = cursorX;
|
||||
@ -250,10 +248,8 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) {
|
||||
if (CUR_UPG_VALUE(pauseCtx->cursorY[PAUSE_EQUIP]) != 0) {
|
||||
cursorMoveResult = 1;
|
||||
}
|
||||
} else {
|
||||
if (gBitFlags[pauseCtx->cursorPoint[PAUSE_EQUIP] - 1] & gSaveContext.inventory.equipment) {
|
||||
} else if ((gBitFlags[pauseCtx->cursorPoint[PAUSE_EQUIP] - 1] & gSaveContext.inventory.equipment) || CVar_GetS32("gPauseAnyCursor", 0)) {
|
||||
cursorMoveResult = 2;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pauseCtx->cursorX[PAUSE_EQUIP] = cursorX;
|
||||
@ -302,8 +298,8 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) {
|
||||
} else if (CUR_UPG_VALUE(pauseCtx->cursorY[PAUSE_EQUIP]) != 0) {
|
||||
cursorMoveResult = 1;
|
||||
}
|
||||
} else if (gBitFlags[pauseCtx->cursorPoint[PAUSE_EQUIP] - 1] &
|
||||
gSaveContext.inventory.equipment) {
|
||||
} else if ((gBitFlags[pauseCtx->cursorPoint[PAUSE_EQUIP] - 1] &
|
||||
gSaveContext.inventory.equipment) || CVar_GetS32("gPauseAnyCursor", 0)) {
|
||||
cursorMoveResult = 2;
|
||||
}
|
||||
} else {
|
||||
@ -320,8 +316,8 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) {
|
||||
if (CUR_UPG_VALUE(pauseCtx->cursorY[PAUSE_EQUIP]) != 0) {
|
||||
cursorMoveResult = 1;
|
||||
}
|
||||
} else if (gBitFlags[pauseCtx->cursorPoint[PAUSE_EQUIP] - 1] &
|
||||
gSaveContext.inventory.equipment) {
|
||||
} else if ((gBitFlags[pauseCtx->cursorPoint[PAUSE_EQUIP] - 1] &
|
||||
gSaveContext.inventory.equipment) || CVar_GetS32("gPauseAnyCursor", 0)) {
|
||||
cursorMoveResult = 2;
|
||||
}
|
||||
} else {
|
||||
@ -503,7 +499,11 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) {
|
||||
(gEquipAgeReqs[pauseCtx->cursorY[PAUSE_EQUIP]][pauseCtx->cursorX[PAUSE_EQUIP]] ==
|
||||
((void)0, gSaveContext.linkAge))) {
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_A)) {
|
||||
Inventory_ChangeEquipment(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP]);
|
||||
if (CHECK_OWNED_EQUIP(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP] - 1)) {
|
||||
Inventory_ChangeEquipment(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP]);
|
||||
} else {
|
||||
goto EQUIP_FAIL;
|
||||
}
|
||||
|
||||
if (pauseCtx->cursorY[PAUSE_EQUIP] == 0) {
|
||||
gSaveContext.infTable[29] = 0;
|
||||
@ -560,6 +560,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
EQUIP_FAIL:
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_A)) {
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
} else if ((CVar_GetS32("gAssignableTunicsAndBoots", 0) != 0) && (pauseCtx->cursorY[PAUSE_EQUIP] > 1)) {
|
||||
@ -635,7 +636,8 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) {
|
||||
KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gBiggoronSwordIconTex, 32, 32, point);
|
||||
} else if ((i == 0) && (k == 2) && (gBitFlags[bit + 1] & gSaveContext.inventory.equipment)) {
|
||||
KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gBrokenGiantsKnifeIconTex, 32, 32, point);
|
||||
} else if (gBitFlags[bit] & gSaveContext.inventory.equipment) {
|
||||
}
|
||||
if (gBitFlags[bit] & gSaveContext.inventory.equipment) {
|
||||
int itemId = ITEM_SWORD_KOKIRI + temp;
|
||||
bool not_acquired = (gItemAgeReqs[itemId] != 9) && (gItemAgeReqs[itemId] != gSaveContext.linkAge);
|
||||
if (not_acquired) {
|
||||
|
@ -137,8 +137,8 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) {
|
||||
if (pauseCtx->cursorX[PAUSE_ITEM] != 0) {
|
||||
pauseCtx->cursorX[PAUSE_ITEM] -= 1;
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM] -= 1;
|
||||
|
||||
if (gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != ITEM_NONE) {
|
||||
if ((gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != ITEM_NONE) ||
|
||||
CVar_GetS32("gPauseAnyCursor", 0)) {
|
||||
moveCursorResult = 1;
|
||||
}
|
||||
} else {
|
||||
@ -169,8 +169,8 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) {
|
||||
if (pauseCtx->cursorX[PAUSE_ITEM] < 5) {
|
||||
pauseCtx->cursorX[PAUSE_ITEM] += 1;
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM] += 1;
|
||||
|
||||
if (gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != ITEM_NONE) {
|
||||
if ((gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != ITEM_NONE) ||
|
||||
CVar_GetS32("gPauseAnyCursor", 0)) {
|
||||
moveCursorResult = 1;
|
||||
}
|
||||
} else {
|
||||
@ -291,8 +291,8 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) {
|
||||
if (pauseCtx->cursorY[PAUSE_ITEM] != 0) {
|
||||
pauseCtx->cursorY[PAUSE_ITEM] -= 1;
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM] -= 6;
|
||||
|
||||
if (gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != ITEM_NONE) {
|
||||
if ((gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != ITEM_NONE) ||
|
||||
CVar_GetS32("gPauseAnyCursor", 0)) {
|
||||
moveCursorResult = 1;
|
||||
}
|
||||
} else {
|
||||
@ -305,8 +305,8 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) {
|
||||
if (pauseCtx->cursorY[PAUSE_ITEM] < 3) {
|
||||
pauseCtx->cursorY[PAUSE_ITEM] += 1;
|
||||
pauseCtx->cursorPoint[PAUSE_ITEM] += 6;
|
||||
|
||||
if (gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != ITEM_NONE) {
|
||||
if ((gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != ITEM_NONE) ||
|
||||
CVar_GetS32("gPauseAnyCursor", 0)) {
|
||||
moveCursorResult = 1;
|
||||
}
|
||||
} else {
|
||||
@ -350,7 +350,7 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) {
|
||||
if (CHECK_BTN_ANY(input->press.button, BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT)) {
|
||||
if (((gSlotAgeReqs[cursorSlot] == 9) ||
|
||||
(gSlotAgeReqs[cursorSlot] == ((void)0, gSaveContext.linkAge))) &&
|
||||
(cursorItem != ITEM_SOLD_OUT)) {
|
||||
(cursorItem != ITEM_SOLD_OUT) && (cursorItem != ITEM_NONE)) {
|
||||
KaleidoScope_SetupItemEquip(globalCtx, cursorItem, cursorSlot,
|
||||
pauseCtx->itemVtx[index].v.ob[0] * 10,
|
||||
pauseCtx->itemVtx[index].v.ob[1] * 10);
|
||||
|
@ -954,7 +954,7 @@ void KaleidoScope_HandlePageToggles(PauseContext* pauseCtx, Input* input) {
|
||||
|
||||
bool dpad = CVar_GetS32("gDpadPauseName", 0);
|
||||
if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) {
|
||||
if ((pauseCtx->stickRelX < -30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DLEFT))) {
|
||||
if ((pauseCtx->stickRelX < -30) || (dpad && CHECK_BTN_ALL(input->cur.button, BTN_DLEFT))) {
|
||||
pauseCtx->pageSwitchTimer++;
|
||||
if ((pauseCtx->pageSwitchTimer >= 10) || (pauseCtx->pageSwitchTimer == 0)) {
|
||||
KaleidoScope_SwitchPage(pauseCtx, 0);
|
||||
@ -963,7 +963,7 @@ void KaleidoScope_HandlePageToggles(PauseContext* pauseCtx, Input* input) {
|
||||
pauseCtx->pageSwitchTimer = -1;
|
||||
}
|
||||
} else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT) {
|
||||
if ((pauseCtx->stickRelX > 30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DRIGHT))) {
|
||||
if ((pauseCtx->stickRelX > 30) || (dpad && CHECK_BTN_ALL(input->cur.button, BTN_DRIGHT))) {
|
||||
pauseCtx->pageSwitchTimer++;
|
||||
if ((pauseCtx->pageSwitchTimer >= 10) || (pauseCtx->pageSwitchTimer == 0)) {
|
||||
KaleidoScope_SwitchPage(pauseCtx, 2);
|
||||
@ -1122,6 +1122,7 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) {
|
||||
static s16 D_8082AD4C = 0;
|
||||
static s16 D_8082AD50 = 0;
|
||||
PauseContext* pauseCtx = &globalCtx->pauseCtx;
|
||||
Input* input = &globalCtx->state.input[0];
|
||||
s16 stepR;
|
||||
s16 stepG;
|
||||
s16 stepB;
|
||||
@ -1162,6 +1163,52 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
if (CVar_GetS32("gDpadHoldChange", 1) && CVar_GetS32("gDpadPauseName", 0)) {
|
||||
if (CHECK_BTN_ALL(input->cur.button, BTN_DLEFT)) {
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT)) {
|
||||
D_8082AD44 = XREG(8);
|
||||
D_8082AD4C = -1;
|
||||
} else if (--D_8082AD44 < 0) {
|
||||
D_8082AD44 = XREG(6);
|
||||
input->press.button |= BTN_DLEFT;
|
||||
}
|
||||
} else if (CHECK_BTN_ALL(input->rel.button, BTN_DLEFT)) {
|
||||
D_8082AD4C = 0;
|
||||
} else if (CHECK_BTN_ALL(input->cur.button, BTN_DRIGHT)) {
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_DRIGHT)) {
|
||||
D_8082AD44 = XREG(8);
|
||||
D_8082AD4C = 1;
|
||||
} else if (--D_8082AD44 < 0) {
|
||||
D_8082AD44 = XREG(6);
|
||||
input->press.button |= BTN_DRIGHT;
|
||||
}
|
||||
} else if (CHECK_BTN_ALL(input->rel.button, BTN_DRIGHT)) {
|
||||
D_8082AD4C = 0;
|
||||
}
|
||||
|
||||
if (CHECK_BTN_ALL(input->cur.button, BTN_DDOWN)) {
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) {
|
||||
D_8082AD48 = XREG(8);
|
||||
D_8082AD50 = -1;
|
||||
} else if (--D_8082AD48 < 0) {
|
||||
D_8082AD48 = XREG(6);
|
||||
input->press.button |= BTN_DDOWN;
|
||||
}
|
||||
} else if (CHECK_BTN_ALL(input->rel.button, BTN_DDOWN)) {
|
||||
D_8082AD50 = 0;
|
||||
} else if (CHECK_BTN_ALL(input->cur.button, BTN_DUP)) {
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_DUP)) {
|
||||
D_8082AD48 = XREG(8);
|
||||
D_8082AD50 = 1;
|
||||
} else if (--D_8082AD48 < 0) {
|
||||
D_8082AD48 = XREG(6);
|
||||
input->press.button |= BTN_DUP;
|
||||
}
|
||||
} else if (CHECK_BTN_ALL(input->rel.button, BTN_DUP)) {
|
||||
D_8082AD50 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (pauseCtx->stickRelX < -30) {
|
||||
if (D_8082AD4C == -1) {
|
||||
if (--D_8082AD44 < 0) {
|
||||
@ -1512,22 +1559,22 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) {
|
||||
{ 0, 255, 100, 255 },//Gamecube
|
||||
{ 0, 100, 255, 255 },//Original N64
|
||||
};
|
||||
static void* D_8082AD54[3] = {
|
||||
static const void* sToEquipTextures[3] = {
|
||||
gPauseToEquipENGTex,
|
||||
gPauseToEquipGERTex,
|
||||
gPauseToEquipFRATex,
|
||||
};
|
||||
static void* D_8082AD60[3] = {
|
||||
static const void* sToDecideTextures[3] = {
|
||||
gPauseToDecideENGTex,
|
||||
gPauseToDecideGERTex,
|
||||
gPauseToDecideFRATex,
|
||||
};
|
||||
static void* D_8082AD6C[3] = {
|
||||
static const void* sPlayMelodyTextures[3] = {
|
||||
gPauseToPlayMelodyENGTex,
|
||||
gPauseToPlayMelodyGERTex,
|
||||
gPauseToPlayMelodyFRATex,
|
||||
};
|
||||
static void* D_8082AD78[][3] = {
|
||||
static const void* D_8082AD78[][3] = {
|
||||
{ gPauseToEquipmentENGTex, gPauseToEquipmentGERTex, gPauseToEquipmentFRATex },
|
||||
{ gPauseToSelectItemENGTex, gPauseToSelectItemGERTex, gPauseToSelectItemFRATex },
|
||||
{ gPauseToMapENGTex, gPauseToMapGERTex, gPauseToMapFRATex },
|
||||
@ -1767,8 +1814,13 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) {
|
||||
} else {
|
||||
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 255, 255, 255, 255);
|
||||
}
|
||||
//TOOD CVAR
|
||||
if (((CHECK_OWNED_EQUIP(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP] - 1)) ||
|
||||
(pauseCtx->pageIndex != PAUSE_EQUIP) && (pauseCtx->cursorX[PAUSE_EQUIP] != 0)) && (pauseCtx->pageIndex != PAUSE_ITEM ||
|
||||
(gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != ITEM_NONE))) {
|
||||
POLY_KAL_DISP = KaleidoScope_QuadTextureIA4(POLY_KAL_DISP, pauseCtx->nameSegment, 128, 16, 0);
|
||||
}
|
||||
|
||||
POLY_KAL_DISP = KaleidoScope_QuadTextureIA4(POLY_KAL_DISP, pauseCtx->nameSegment, 128, 16, 0);
|
||||
}
|
||||
|
||||
if (pauseCtx->pageIndex == PAUSE_MAP && CVar_GetS32("gDebugEnabled", 0) != 0) {
|
||||
@ -1851,7 +1903,7 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) {
|
||||
gDPPipeSync(POLY_KAL_DISP++);
|
||||
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 255, 255, 255, 255);
|
||||
|
||||
POLY_KAL_DISP = KaleidoScope_QuadTextureIA8(POLY_KAL_DISP, D_8082AD60[gSaveContext.language],
|
||||
POLY_KAL_DISP = KaleidoScope_QuadTextureIA8(POLY_KAL_DISP, sToDecideTextures[gSaveContext.language],
|
||||
D_8082ADE0[gSaveContext.language], 16, 4);
|
||||
} else if (pauseCtx->cursorSpecialPos != 0) {
|
||||
if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0)) {
|
||||
@ -1899,15 +1951,16 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) {
|
||||
} else if (CVar_GetS32("gHudColors", 1) == 2) {
|
||||
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCBtnPrimB", R_C_BTN_COLOR(2)), 255);
|
||||
}
|
||||
//gSPDisplayList(POLY_KAL_DISP++, gCButtonIconsDL); //Same reason for every A button, to be able to recolor them.
|
||||
gDPLoadTextureBlock(POLY_KAL_DISP++, gCBtnSymbolsTex, G_IM_FMT_IA, G_IM_SIZ_8b, 48, 16, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 4, 4, G_TX_NOLOD, G_TX_NOLOD);
|
||||
gSP1Quadrangle(POLY_KAL_DISP++, 0, 2, 3, 1, 0);
|
||||
if (gSaveContext.inventory.items[pauseCtx->cursorSlot[PAUSE_ITEM]] != ITEM_NONE) {
|
||||
//gSPDisplayList(POLY_KAL_DISP++, gCButtonIconsDL); //Same reason for every A button, to be able to recolor them.
|
||||
gDPLoadTextureBlock(POLY_KAL_DISP++, gCBtnSymbolsTex, G_IM_FMT_IA, G_IM_SIZ_8b, 48, 16, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 4, 4, G_TX_NOLOD, G_TX_NOLOD);
|
||||
gSP1Quadrangle(POLY_KAL_DISP++, 0, 2, 3, 1, 0);
|
||||
|
||||
gDPPipeSync(POLY_KAL_DISP++);
|
||||
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 255, 255, 255, 255);
|
||||
|
||||
POLY_KAL_DISP = KaleidoScope_QuadTextureIA8(POLY_KAL_DISP, D_8082AD54[gSaveContext.language],
|
||||
D_8082ADD8[gSaveContext.language], 16, 4);
|
||||
gDPPipeSync(POLY_KAL_DISP++);
|
||||
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 255, 255, 255, 255);
|
||||
POLY_KAL_DISP = KaleidoScope_QuadTextureIA8(POLY_KAL_DISP, sToEquipTextures[gSaveContext.language],
|
||||
D_8082ADD8[gSaveContext.language], 16, 4);
|
||||
}
|
||||
} else if ((pauseCtx->pageIndex == PAUSE_MAP) && sInDungeonScene) {
|
||||
|
||||
} else if ((pauseCtx->pageIndex == PAUSE_QUEST) && (pauseCtx->cursorSlot[PAUSE_QUEST] >= 6) &&
|
||||
@ -1949,7 +2002,7 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) {
|
||||
gDPPipeSync(POLY_KAL_DISP++);
|
||||
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 255, 255, 255, 255);
|
||||
|
||||
POLY_KAL_DISP = KaleidoScope_QuadTextureIA8(POLY_KAL_DISP, D_8082AD6C[gSaveContext.language],
|
||||
POLY_KAL_DISP = KaleidoScope_QuadTextureIA8(POLY_KAL_DISP, sPlayMelodyTextures[gSaveContext.language],
|
||||
D_8082ADE8[gSaveContext.language], 16, 4);
|
||||
}
|
||||
} else if (pauseCtx->pageIndex == PAUSE_EQUIP) {
|
||||
@ -1970,6 +2023,10 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) {
|
||||
pauseCtx->infoPanelVtx[21].v.tc[0] = pauseCtx->infoPanelVtx[23].v.tc[0] =
|
||||
D_8082ADD8[gSaveContext.language] << 5;
|
||||
|
||||
if (!(CHECK_OWNED_EQUIP(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP] - 1)) && (pauseCtx->pageIndex == PAUSE_EQUIP) && (pauseCtx->cursorX[PAUSE_EQUIP] != 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
//gSPDisplayList(POLY_KAL_DISP++, gAButtonIconDL);
|
||||
if (CVar_GetS32("gHudColors", 1) == 0) {//To equip A button
|
||||
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, gABtnTexColour[1][0], gABtnTexColour[1][1], gABtnTexColour[1][2], gABtnTexColour[1][3]);
|
||||
@ -1984,7 +2041,7 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) {
|
||||
gDPPipeSync(POLY_KAL_DISP++);
|
||||
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 255, 255, 255, 255);
|
||||
|
||||
POLY_KAL_DISP = KaleidoScope_QuadTextureIA8(POLY_KAL_DISP, D_8082AD54[gSaveContext.language],
|
||||
POLY_KAL_DISP = KaleidoScope_QuadTextureIA8(POLY_KAL_DISP, sToEquipTextures[gSaveContext.language],
|
||||
D_8082ADD8[gSaveContext.language], 16, 4);
|
||||
}
|
||||
}
|
||||
@ -3732,7 +3789,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx)
|
||||
&D_801333E8);
|
||||
Gameplay_SaveSceneFlags(globalCtx);
|
||||
gSaveContext.savedSceneNum = globalCtx->sceneNum;
|
||||
Sram_WriteSave(&globalCtx->sramCtx);
|
||||
Save_SaveFile();
|
||||
pauseCtx->unk_1EC = 4;
|
||||
D_8082B25C = 3;
|
||||
}
|
||||
@ -3972,7 +4029,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx)
|
||||
pauseCtx->promptChoice = 0;
|
||||
Gameplay_SaveSceneFlags(globalCtx);
|
||||
gSaveContext.savedSceneNum = globalCtx->sceneNum;
|
||||
Sram_WriteSave(&globalCtx->sramCtx);
|
||||
Save_SaveFile();
|
||||
pauseCtx->state = 0xF;
|
||||
D_8082B25C = 3;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user