Resolved conflicts with develop

This commit is contained in:
earthcrafterman 2022-04-30 13:45:36 -04:00
commit 2ab98569f3
30 changed files with 529 additions and 951 deletions

99
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,99 @@
pipeline {
environment {
MSBUILD='C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Msbuild\\Current\\Bin\\msbuild.exe'
CONFIG='Release'
OTRPLATFORM='x64'
PLATFORM='x86'
ZIP='C:\\Program Files\\7-Zip\\7z.exe'
PYTHON='C:\\Users\\jenkins\\AppData\\Local\\Programs\\Python\\Python310\\python.exe'
TOOLSET='v142'
EMAILTO=''
}
agent {
label 'SoH-Builders'
}
options {
timestamps()
timeout(time: 15, unit: 'MINUTES')
skipDefaultCheckout(true)
}
stages {
stage ('Checkout') {
steps {
checkout([
$class: 'GitSCM',
branches: scm.branches,
doGenerateSubmoduleConfigurations: scm.doGenerateSubmoduleConfigurations,
extensions: scm.extensions,
userRemoteConfigs: scm.userRemoteConfigs
])
}
}
stage ('Build OTRExporter') {
steps {
bat """
"${env.MSBUILD}" ".\\OTRExporter\\OTRExporter.sln" -t:restore,build -p:Configuration=${env.CONFIG};Platform=${env.OTRPLATFORM};PlatformToolset=${env.TOOLSET};RestorePackagesConfig=true /nodeReuse:false
"""
}
}
stage ('Extract assets') {
steps {
bat """
xcopy "..\\..\\ZELOOTD.z64" "OTRExporter\\"
cd "OTRExporter"
"${env.PYTHON}" ".\\extract_assets.py"
cd "${env.WORKSPACE}"
"""
}
}
stage ('Build SoH') {
steps {
bat """
"${env.MSBUILD}" ".\\soh\\soh.sln" -t:build -p:Configuration=${env.CONFIG};Platform=${env.PLATFORM};PlatformToolset=${env.TOOLSET} /nodeReuse:false
"""
}
}
stage ('Archive artifacts') {
steps {
bat """
"${env.ZIP}" a "soh.zip" ".\\soh\\Release\\soh.exe"
"""
archiveArtifacts allowEmptyArchive: false,
artifacts: 'soh.zip',
caseSensitive: true,
defaultExcludes: true,
fingerprint: false,
onlyIfSuccessful: true
}
}
}
post {
always {
step([$class: 'Mailer',
notifyEveryUnstableBuild: true,
recipients: "${env.EMAILTO}",
sendToIndividuals: false])
step([$class: 'WsCleanup']) // Clean workspace
}
}
}

View File

@ -12,6 +12,7 @@ REGISTER_ZFILENODE(Text, ZText);
ZText::ZText(ZFile* nParent) : ZResource(nParent)
{
RegisterRequiredAttribute("CodeOffset");
RegisterOptionalAttribute("LangOffset", "0");
}
void ZText::ParseRawData()
@ -20,6 +21,16 @@ void ZText::ParseRawData()
const auto& rawData = parent->GetRawData();
uint32_t currentPtr = StringHelper::StrToL(registeredAttributes.at("CodeOffset").value, 16);
uint32_t langPtr = currentPtr;
bool isPalLang = false;
if (StringHelper::StrToL(registeredAttributes.at("LangOffset").value, 16) != 0)
{
langPtr = StringHelper::StrToL(registeredAttributes.at("LangOffset").value, 16);
if (langPtr != currentPtr)
isPalLang = true;
}
std::vector<uint8_t> codeData;
@ -34,8 +45,18 @@ void ZText::ParseRawData()
msgEntry.id = BitConverter::ToInt16BE(codeData, currentPtr + 0);
msgEntry.textboxType = (codeData[currentPtr + 2] & 0xF0) >> 4;
msgEntry.textboxYPos = (codeData[currentPtr + 2] & 0x0F);
msgEntry.segmentId = (codeData[currentPtr + 4]);
msgEntry.msgOffset = BitConverter::ToInt32BE(codeData, currentPtr + 4) & 0x00FFFFFF;
if (isPalLang)
{
msgEntry.segmentId = (codeData[langPtr + 0]);
msgEntry.msgOffset = BitConverter::ToInt32BE(codeData, langPtr + 0) & 0x00FFFFFF;
}
else
{
msgEntry.segmentId = (codeData[langPtr + 4]);
msgEntry.msgOffset = BitConverter::ToInt32BE(codeData, langPtr + 4) & 0x00FFFFFF;
}
uint32_t msgPtr = msgEntry.msgOffset;
unsigned char c = rawData[msgPtr];
@ -82,6 +103,11 @@ void ZText::ParseRawData()
break;
currentPtr += 8;
if (isPalLang)
langPtr += 4;
else
langPtr += 8;
}
int bp2 = 0;

View File

@ -14,6 +14,7 @@
#include "../../soh/include/z64audio.h"
#include <string>
#include "SohHooks.h"
#include "../../soh/soh/Enhancements/debugconsole.h"
#include "Window.h"
@ -34,14 +35,13 @@ namespace Game {
void UpdateAudio() {
Audio_SetGameVolume(SEQ_BGM_MAIN, Settings.audio.music_main);
Audio_SetGameVolume(SEQ_BGM_SUB, Settings.audio.music_sub);
Audio_SetGameVolume(SEQ_FANFARE, Settings.audio.fanfare);
Audio_SetGameVolume(SEQ_SFX, Settings.audio.sfx);
Audio_SetGameVolume(SEQ_BGM_MAIN, CVar_GetFloat("gMainMusicVolume", 1));
Audio_SetGameVolume(SEQ_BGM_SUB, CVar_GetFloat("gSubMusicVolume", 1));
Audio_SetGameVolume(SEQ_FANFARE, CVar_GetFloat("gSFXMusicVolume", 1));
Audio_SetGameVolume(SEQ_SFX, CVar_GetFloat("gFanfareVolume", 1));
}
void LoadSettings() {
const std::shared_ptr<ConfigFile> pConf = GlobalCtx2::GetInstance()->GetConfig();
ConfigFile& Conf = *pConf;
@ -50,199 +50,6 @@ namespace Game {
Settings.debug.menu_bar = stob(Conf[ConfSection]["menu_bar"]);
Settings.debug.soh = stob(Conf[ConfSection]["soh_debug"]);
Settings.debug.n64mode = stob(Conf[ConfSection]["n64_mode"]);
// Enhancements
Settings.enhancements.skip_text = stob(Conf[EnhancementSection]["skip_text"]);
CVar_SetS32("gSkipText", Settings.enhancements.skip_text);
Settings.enhancements.text_speed = Ship::stoi(Conf[EnhancementSection]["text_speed"]);
CVar_SetS32("gTextSpeed", Settings.enhancements.text_speed);
Settings.enhancements.mweep_speed = Ship::stoi(Conf[EnhancementSection]["mweep_speed"]);
CVar_SetS32("gMweepSpeed", Settings.enhancements.mweep_speed);
Settings.enhancements.disable_lod = stob(Conf[EnhancementSection]["disable_lod"]);
CVar_SetS32("gDisableLOD", Settings.enhancements.disable_lod);
Settings.enhancements.animated_pause_menu = stob(Conf[EnhancementSection]["animated_pause_menu"]);
CVar_SetS32("gPauseLiveLink", Settings.enhancements.animated_pause_menu);
Settings.enhancements.dynamic_wallet_icon = stob(Conf[EnhancementSection]["dynamic_wallet_icon"]);
CVar_SetS32("gDynamicWalletIcon", Settings.enhancements.dynamic_wallet_icon);
Settings.enhancements.minimal_ui = stob(Conf[EnhancementSection]["minimal_ui"]);
CVar_SetS32("gMinimalUI", Settings.enhancements.minimal_ui);
Settings.enhancements.visualagony = stob(Conf[EnhancementSection]["visualagony"]);
CVar_SetS32("gVisualAgony", Settings.enhancements.visualagony);
Settings.enhancements.mm_bunny_hood = stob(Conf[EnhancementSection]["mm_bunny_hood"]);
CVar_SetS32("gMMBunnyHood", Settings.enhancements.mm_bunny_hood);
Settings.enhancements.uniform_lr = stob(Conf[EnhancementSection]["uniform_lr"]);
//CVar_SetS32("gUniformLR", Settings.enhancements.uniform_lr);
CVar_SetS32("gUniformLR", 1);
Settings.enhancements.newdrops = stob(Conf[EnhancementSection]["newdrops"]);
CVar_SetS32("gNewDrops", Settings.enhancements.newdrops);
// Audio
Settings.audio.master = Ship::stof(Conf[AudioSection]["master"]);
CVar_SetFloat("gGameMasterVolume", Settings.audio.master);
Settings.audio.music_main = Ship::stof(Conf[AudioSection]["music_main"]);
CVar_SetFloat("gMainMusicVolume", Settings.audio.music_main);
Settings.audio.music_sub = Ship::stof(Conf[AudioSection]["music_sub"]);
CVar_SetFloat("gSubMusicVolume", Settings.audio.music_sub);
Settings.audio.sfx = Ship::stof(Conf[AudioSection]["sfx"]);
CVar_SetFloat("gSFXMusicVolume", Settings.audio.sfx);
Settings.audio.fanfare = Ship::stof(Conf[AudioSection]["fanfare"]);
CVar_SetFloat("gFanfareVolume", Settings.audio.fanfare);
// Controllers
Settings.controller.rumble_enabled = Ship::stof(Conf[ControllerSection]["rumble_enabled"]);
CVar_SetS32("gRumbleEnabled", Settings.controller.rumble_enabled);
Settings.controller.input_scale = Ship::stof(Conf[ControllerSection]["input_scale"]);
CVar_SetFloat("gInputScale", Settings.controller.input_scale);
Settings.controller.input_enabled = stob(Conf[ControllerSection]["input_enabled"]);
CVar_SetS32("gInputEnabled", Settings.controller.input_enabled);
//Tunics
Settings.cosmetic.tunic_kokiri_red = (Conf[CosmeticsSection]["tunic_kokiri_red"] != "") ? Ship::stoi(Conf[CosmeticsSection]["tunic_kokiri_red"]) : Settings.cosmetic.tunic_kokiri_red;
CVar_SetS32("gTunic_Kokiri_Red", Settings.cosmetic.tunic_kokiri_red);
Settings.cosmetic.tunic_kokiri_green = (Conf[CosmeticsSection]["tunic_kokiri_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["tunic_kokiri_green"]) : Settings.cosmetic.tunic_kokiri_green;
CVar_SetS32("gTunic_Kokiri_Green", Settings.cosmetic.tunic_kokiri_green);
Settings.cosmetic.tunic_kokiri_blue = (Conf[CosmeticsSection]["tunic_kokiri_blue"] != "") ? Ship::stoi(Conf[CosmeticsSection]["tunic_kokiri_blue"]) : Settings.cosmetic.tunic_kokiri_blue;
CVar_SetS32("gTunic_Kokiri_Blue", Settings.cosmetic.tunic_kokiri_blue);
Settings.cosmetic.tunic_goron_red = (Conf[CosmeticsSection]["tunic_goron_red"] != "") ? Ship::stoi(Conf[CosmeticsSection]["tunic_goron_red"]) : Settings.cosmetic.tunic_goron_red;
CVar_SetS32("gTunic_Goron_Red", Settings.cosmetic.tunic_goron_red);
Settings.cosmetic.tunic_goron_green = (Conf[CosmeticsSection]["tunic_goron_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["tunic_goron_green"]) : Settings.cosmetic.tunic_goron_green;
CVar_SetS32("gTunic_Goron_Green", Settings.cosmetic.tunic_goron_green);
Settings.cosmetic.tunic_goron_blue = (Conf[CosmeticsSection]["tunic_goron_blue"] != "") ? Ship::stoi(Conf[CosmeticsSection]["tunic_goron_blue"]) : Settings.cosmetic.tunic_goron_blue;
CVar_SetS32("gTunic_Goron_Blue", Settings.cosmetic.tunic_goron_blue);
Settings.cosmetic.tunic_zora_red = (Conf[CosmeticsSection]["tunic_zora_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["tunic_zora_red"]) : Settings.cosmetic.tunic_zora_red;
CVar_SetS32("gTunic_Zora_Red", Settings.cosmetic.tunic_zora_red);
Settings.cosmetic.tunic_zora_green = (Conf[CosmeticsSection]["tunic_zora_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["tunic_zora_green"]) : Settings.cosmetic.tunic_zora_green;
CVar_SetS32("gTunic_Zora_Green", Settings.cosmetic.tunic_zora_green);
Settings.cosmetic.tunic_zora_blue = (Conf[CosmeticsSection]["tunic_zora_blue"] != "" ) ? Ship::stoi(Conf[CosmeticsSection]["tunic_zora_blue"]) : Settings.cosmetic.tunic_zora_blue;
CVar_SetS32("gTunic_Zora_Blue", Settings.cosmetic.tunic_zora_blue);
//Navi
Settings.cosmetic.navi_idle_inner_red = (Conf[CosmeticsSection]["navi_idle_inner_red"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_idle_inner_red"]) : Settings.cosmetic.navi_idle_inner_red;
CVar_SetS32("gNavi_Idle_Inner_Red", Settings.cosmetic.navi_idle_inner_red);
Settings.cosmetic.navi_idle_inner_green = (Conf[CosmeticsSection]["navi_idle_inner_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_idle_inner_green"]) : Settings.cosmetic.navi_idle_inner_green;
CVar_SetS32("gNavi_Idle_Inner_Green", Settings.cosmetic.navi_idle_inner_green);
Settings.cosmetic.navi_idle_inner_blue = (Conf[CosmeticsSection]["navi_idle_inner_blue"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_idle_inner_blue"]) : Settings.cosmetic.navi_idle_inner_blue;
CVar_SetS32("gNavi_Idle_Inner_Blue", Settings.cosmetic.navi_idle_inner_blue);
Settings.cosmetic.navi_idle_outer_red = (Conf[CosmeticsSection]["navi_idle_outer_red"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_idle_outer_red"]) : Settings.cosmetic.navi_idle_outer_red;
CVar_SetS32("gNavi_Idle_Outer_Red", Settings.cosmetic.navi_idle_outer_red);
Settings.cosmetic.navi_idle_outer_green = (Conf[CosmeticsSection]["navi_idle_outer_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_idle_outer_green"]) : Settings.cosmetic.navi_idle_outer_green;
CVar_SetS32("gNavi_Idle_Outer_Green", Settings.cosmetic.navi_idle_outer_green);
Settings.cosmetic.navi_idle_outer_blue = (Conf[CosmeticsSection]["navi_idle_outer_blue"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_idle_outer_blue"]) : Settings.cosmetic.navi_idle_outer_blue;
CVar_SetS32("gNavi_Idle_Outer_Blue", Settings.cosmetic.navi_idle_outer_blue);
Settings.cosmetic.navi_npc_inner_red = (Conf[CosmeticsSection]["navi_npc_inner_red"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_npc_inner_red"]) : Settings.cosmetic.navi_npc_inner_red;
CVar_SetS32("gNavi_NPC_Inner_Red", Settings.cosmetic.navi_npc_inner_red);
Settings.cosmetic.navi_npc_inner_green = (Conf[CosmeticsSection]["navi_npc_inner_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_npc_inner_green"]) : Settings.cosmetic.navi_npc_inner_green;
CVar_SetS32("gNavi_NPC_Inner_Green", Settings.cosmetic.navi_npc_inner_green);
Settings.cosmetic.navi_npc_inner_blue = (Conf[CosmeticsSection]["navi_npc_inner_blue"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_npc_inner_blue"]) : Settings.cosmetic.navi_npc_inner_blue;
CVar_SetS32("gNavi_NPC_Inner_Blue", Settings.cosmetic.navi_npc_inner_blue);
Settings.cosmetic.navi_npc_outer_red = (Conf[CosmeticsSection]["navi_npc_outer_red"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_npc_outer_red"]) : Settings.cosmetic.navi_npc_outer_red;
CVar_SetS32("gNavi_NPC_Outer_Red", Settings.cosmetic.navi_npc_outer_red);
Settings.cosmetic.navi_npc_outer_green = (Conf[CosmeticsSection]["navi_npc_outer_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_npc_outer_green"]) : Settings.cosmetic.navi_npc_outer_green;
CVar_SetS32("gNavi_NPC_Outer_Green", Settings.cosmetic.navi_npc_outer_green);
Settings.cosmetic.navi_npc_outer_blue = (Conf[CosmeticsSection]["navi_npc_outer_blue"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_npc_outer_blue"]) : Settings.cosmetic.navi_npc_outer_blue;
CVar_SetS32("gNavi_NPC_Outer_Blue", Settings.cosmetic.navi_npc_outer_blue);
Settings.cosmetic.navi_enemy_inner_red = (Conf[CosmeticsSection]["navi_enemy_inner_red"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_enemy_inner_red"]) : Settings.cosmetic.navi_enemy_inner_red;
CVar_SetS32("gNavi_Enemy_Inner_Red", Settings.cosmetic.navi_enemy_inner_red);
Settings.cosmetic.navi_enemy_inner_green = (Conf[CosmeticsSection]["navi_enemy_inner_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_enemy_inner_green"]) : Settings.cosmetic.navi_enemy_inner_green;
CVar_SetS32("gNavi_Enemy_Inner_Green", Settings.cosmetic.navi_enemy_inner_green);
Settings.cosmetic.navi_enemy_inner_blue = (Conf[CosmeticsSection]["navi_enemy_inner_blue"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_enemy_inner_blue"]) : Settings.cosmetic.navi_enemy_inner_blue;
CVar_SetS32("gNavi_Enemy_Inner_Blue", Settings.cosmetic.navi_enemy_inner_blue);
Settings.cosmetic.navi_enemy_outer_red = (Conf[CosmeticsSection]["navi_enemy_outer_red"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_enemy_outer_red"]) : Settings.cosmetic.navi_enemy_outer_red;
CVar_SetS32("gNavi_Enemy_Outer_Red", Settings.cosmetic.navi_enemy_outer_red);
Settings.cosmetic.navi_enemy_outer_green = (Conf[CosmeticsSection]["navi_enemy_outer_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_enemy_outer_green"]) : Settings.cosmetic.navi_enemy_outer_green;
CVar_SetS32("gNavi_Enemy_Outer_Green", Settings.cosmetic.navi_enemy_outer_green);
Settings.cosmetic.navi_enemy_outer_blue = (Conf[CosmeticsSection]["navi_enemy_outer_blue"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_enemy_outer_blue"]) : Settings.cosmetic.navi_enemy_outer_blue;
CVar_SetS32("gNavi_Enemy_Outer_Blue", Settings.cosmetic.navi_enemy_outer_blue);
Settings.cosmetic.navi_prop_inner_red = (Conf[CosmeticsSection]["navi_prop_inner_red"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_prop_inner_red"]) : Settings.cosmetic.navi_prop_inner_red;
CVar_SetS32("gNavi_Prop_Inner_Red", Settings.cosmetic.navi_prop_inner_red);
Settings.cosmetic.navi_prop_inner_green = (Conf[CosmeticsSection]["navi_prop_inner_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_prop_inner_green"]) : Settings.cosmetic.navi_prop_inner_green;
CVar_SetS32("gNavi_Prop_Inner_Green", Settings.cosmetic.navi_prop_inner_green);
Settings.cosmetic.navi_prop_inner_blue = (Conf[CosmeticsSection]["navi_prop_inner_blue"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_prop_inner_blue"]) : Settings.cosmetic.navi_prop_inner_blue;
CVar_SetS32("gNavi_Prop_Inner_Blue", Settings.cosmetic.navi_prop_inner_blue);
Settings.cosmetic.navi_prop_outer_red = (Conf[CosmeticsSection]["navi_prop_outer_red"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_prop_outer_red"]) : Settings.cosmetic.navi_prop_outer_red;
CVar_SetS32("gNavi_Prop_Outer_Red", Settings.cosmetic.navi_prop_outer_red);
Settings.cosmetic.navi_prop_outer_green = (Conf[CosmeticsSection]["navi_prop_outer_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_prop_outer_green"]) : Settings.cosmetic.navi_prop_outer_green;
CVar_SetS32("gNavi_Prop_Outer_Green", Settings.cosmetic.navi_prop_outer_green);
Settings.cosmetic.navi_prop_outer_blue = (Conf[CosmeticsSection]["navi_prop_outer_blue"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_prop_outer_blue"]) : Settings.cosmetic.navi_prop_outer_blue;
CVar_SetS32("gNavi_Prop_Outer_Blue", Settings.cosmetic.navi_prop_outer_blue);
CVar_SetS32("gInputEnabled", Settings.controller.input_enabled);
Settings.controller.dpad_pause_name = stob(Conf[ControllerSection]["dpad_pause_name"]);
CVar_SetS32("gDpadPauseName", Settings.controller.dpad_pause_name);
Settings.controller.dpad_ocarina_text = stob(Conf[ControllerSection]["dpad_ocarina_text"]);
CVar_SetS32("gDpadOcarinaText", Settings.controller.dpad_ocarina_text);
Settings.controller.dpad_shop = stob(Conf[ControllerSection]["dpad_shop"]);
CVar_SetS32("gDpadShop", Settings.controller.dpad_shop);
// Cheats
Settings.cheats.debug_mode = stob(Conf[CheatSection]["debug_mode"]);
CVar_SetS32("gDebugEnabled", Settings.cheats.debug_mode);
Settings.cheats.infinite_money = stob(Conf[CheatSection]["infinite_money"]);
CVar_SetS32("gInfiniteMoney", Settings.cheats.infinite_money);
Settings.cheats.infinite_health = stob(Conf[CheatSection]["infinite_health"]);
CVar_SetS32("gInfiniteHealth", Settings.cheats.infinite_health);
Settings.cheats.infinite_ammo = stob(Conf[CheatSection]["infinite_ammo"]);
CVar_SetS32("gInfiniteAmmo", Settings.cheats.infinite_ammo);
Settings.cheats.infinite_magic = stob(Conf[CheatSection]["infinite_magic"]);
CVar_SetS32("gInfiniteMagic", Settings.cheats.infinite_magic);
Settings.cheats.infinite_nayru = stob(Conf[CheatSection]["infinite_nayru"]);
CVar_SetS32("gInfiniteNayru", Settings.cheats.infinite_nayru);
Settings.cheats.no_clip = stob(Conf[CheatSection]["no_clip"]);
CVar_SetS32("gNoClip", Settings.cheats.no_clip);
Settings.cheats.climb_everything = stob(Conf[CheatSection]["climb_everything"]);
CVar_SetS32("gClimbEverything", Settings.cheats.climb_everything);
Settings.cheats.moon_jump_on_l = stob(Conf[CheatSection]["moon_jump_on_l"]);
CVar_SetS32("gMoonJumpOnL", Settings.cheats.moon_jump_on_l);
Settings.cheats.super_tunic = stob(Conf[CheatSection]["super_tunic"]);
CVar_SetS32("gSuperTunic", Settings.cheats.super_tunic);
Settings.cheats.ez_isg = stob(Conf[CheatSection]["ez_isg"]);
CVar_SetS32("gEzISG", Settings.cheats.ez_isg);
Settings.cheats.no_restrict_item = stob(Conf[CheatSection]["no_restrict_item"]);
CVar_SetS32("gNoRestrictItems", Settings.cheats.no_restrict_item);
Settings.cheats.freeze_time = stob(Conf[CheatSection]["freeze_time"]);
CVar_SetS32("gFreezeTime", Settings.cheats.freeze_time);
// Per-Controller
LoadPadSettings();
UpdateAudio();
}
@ -253,10 +60,6 @@ namespace Game {
for (const auto& [i, controllers] : Ship::Window::Controllers) {
for (const auto& controller : controllers) {
if (auto padConfSection = controller->GetPadConfSection()) {
Settings.controller.extra[i].gyro_sensitivity = Ship::stof(Conf[*padConfSection]["gyro_sensitivity"]);
Settings.controller.extra[i].rumble_strength = Ship::stof(Conf[*padConfSection]["rumble_strength"]);
Settings.controller.extra[i].gyro_drift_x = Ship::stof(Conf[*padConfSection]["gyro_drift_x"], 0.0f);
Settings.controller.extra[i].gyro_drift_y = Ship::stof(Conf[*padConfSection]["gyro_drift_y"], 0.0f);
}
}
}
@ -270,103 +73,9 @@ namespace Game {
Conf[ConfSection]["console"] = std::to_string(SohImGui::console->opened);
Conf[ConfSection]["menu_bar"] = std::to_string(Settings.debug.menu_bar);
Conf[ConfSection]["soh_debug"] = std::to_string(Settings.debug.soh);
Conf[ConfSection]["n64_mode"] = std::to_string(Settings.debug.n64mode);
// Audio
Conf[AudioSection]["master"] = std::to_string(Settings.audio.master);
Conf[AudioSection]["music_main"] = std::to_string(Settings.audio.music_main);
Conf[AudioSection]["music_sub"] = std::to_string(Settings.audio.music_sub);
Conf[AudioSection]["sfx"] = std::to_string(Settings.audio.sfx);
Conf[AudioSection]["fanfare"] = std::to_string(Settings.audio.fanfare);
// Enhancements
Conf[EnhancementSection]["skip_text"] = std::to_string(Settings.enhancements.skip_text);
Conf[EnhancementSection]["text_speed"] = std::to_string(Settings.enhancements.text_speed);
Conf[EnhancementSection]["mweep_speed"] = std::to_string(Settings.enhancements.mweep_speed);
Conf[EnhancementSection]["disable_lod"] = std::to_string(Settings.enhancements.disable_lod);
Conf[EnhancementSection]["animated_pause_menu"] = std::to_string(Settings.enhancements.animated_pause_menu);
Conf[EnhancementSection]["dynamic_wallet_icon"] = std::to_string(Settings.enhancements.dynamic_wallet_icon);
Conf[EnhancementSection]["minimal_ui"] = std::to_string(Settings.enhancements.minimal_ui);
Conf[EnhancementSection]["newdrops"] = std::to_string(Settings.enhancements.newdrops);
Conf[EnhancementSection]["visualagony"] = std::to_string(Settings.enhancements.visualagony);
Conf[EnhancementSection]["mm_bunny_hood"] = std::to_string(Settings.enhancements.mm_bunny_hood);
Conf[EnhancementSection]["uniform_lr"] = std::to_string(Settings.enhancements.uniform_lr);
// Controllers
Conf[ControllerSection]["rumble_enabled"] = std::to_string(Settings.controller.rumble_enabled);
Conf[ControllerSection]["input_scale"] = std::to_string(Settings.controller.input_scale);
Conf[ControllerSection]["input_enabled"] = std::to_string(Settings.controller.input_enabled);
Conf[ControllerSection]["dpad_pause_name"] = std::to_string(Settings.controller.dpad_pause_name);
Conf[ControllerSection]["dpad_ocarina_text"] = std::to_string(Settings.controller.dpad_ocarina_text);
Conf[ControllerSection]["dpad_shop"] = std::to_string(Settings.controller.dpad_shop);
// Cosmetics
Conf[CosmeticsSection]["tunic_kokiri_red"] = std::to_string(Settings.cosmetic.tunic_kokiri_red);
Conf[CosmeticsSection]["tunic_kokiri_green"] = std::to_string(Settings.cosmetic.tunic_kokiri_green);
Conf[CosmeticsSection]["tunic_kokiri_blue"] = std::to_string(Settings.cosmetic.tunic_kokiri_blue);
Conf[CosmeticsSection]["tunic_goron_red"] = std::to_string(Settings.cosmetic.tunic_goron_red);
Conf[CosmeticsSection]["tunic_goron_green"] = std::to_string(Settings.cosmetic.tunic_goron_green);
Conf[CosmeticsSection]["tunic_goron_blue"] = std::to_string(Settings.cosmetic.tunic_goron_blue);
Conf[CosmeticsSection]["tunic_zora_red"] = std::to_string(Settings.cosmetic.tunic_zora_red);
Conf[CosmeticsSection]["tunic_zora_green"] = std::to_string(Settings.cosmetic.tunic_zora_green);
Conf[CosmeticsSection]["tunic_zora_blue"] = std::to_string(Settings.cosmetic.tunic_zora_blue);
Conf[CosmeticsSection]["navi_idle_inner_red"] = std::to_string(Settings.cosmetic.navi_idle_inner_red);
Conf[CosmeticsSection]["navi_idle_inner_green"] = std::to_string(Settings.cosmetic.navi_idle_inner_green);
Conf[CosmeticsSection]["navi_idle_inner_blue"] = std::to_string(Settings.cosmetic.navi_idle_inner_blue);
Conf[CosmeticsSection]["navi_idle_outer_red"] = std::to_string(Settings.cosmetic.navi_idle_outer_red);
Conf[CosmeticsSection]["navi_idle_outer_green"] = std::to_string(Settings.cosmetic.navi_idle_outer_green);
Conf[CosmeticsSection]["navi_idle_outer_blue"] = std::to_string(Settings.cosmetic.navi_idle_outer_blue);
Conf[CosmeticsSection]["navi_npc_inner_red"] = std::to_string(Settings.cosmetic.navi_npc_inner_red);
Conf[CosmeticsSection]["navi_npc_inner_green"] = std::to_string(Settings.cosmetic.navi_npc_inner_green);
Conf[CosmeticsSection]["navi_npc_inner_blue"] = std::to_string(Settings.cosmetic.navi_npc_inner_blue);
Conf[CosmeticsSection]["navi_npc_outer_red"] = std::to_string(Settings.cosmetic.navi_npc_outer_red);
Conf[CosmeticsSection]["navi_npc_outer_green"] = std::to_string(Settings.cosmetic.navi_npc_outer_green);
Conf[CosmeticsSection]["navi_npc_outer_blue"] = std::to_string(Settings.cosmetic.navi_npc_outer_blue);
Conf[CosmeticsSection]["navi_enemy_inner_red"] = std::to_string(Settings.cosmetic.navi_enemy_inner_red);
Conf[CosmeticsSection]["navi_enemy_inner_green"] = std::to_string(Settings.cosmetic.navi_enemy_inner_green);
Conf[CosmeticsSection]["navi_enemy_inner_blue"] = std::to_string(Settings.cosmetic.navi_enemy_inner_blue);
Conf[CosmeticsSection]["navi_enemy_outer_red"] = std::to_string(Settings.cosmetic.navi_enemy_outer_red);
Conf[CosmeticsSection]["navi_enemy_outer_green"] = std::to_string(Settings.cosmetic.navi_enemy_outer_green);
Conf[CosmeticsSection]["navi_enemy_outer_blue"] = std::to_string(Settings.cosmetic.navi_enemy_outer_blue);
Conf[CosmeticsSection]["navi_prop_inner_red"] = std::to_string(Settings.cosmetic.navi_prop_inner_red);
Conf[CosmeticsSection]["navi_prop_inner_green"] = std::to_string(Settings.cosmetic.navi_prop_inner_green);
Conf[CosmeticsSection]["navi_prop_inner_blue"] = std::to_string(Settings.cosmetic.navi_prop_inner_blue);
Conf[CosmeticsSection]["navi_prop_outer_red"] = std::to_string(Settings.cosmetic.navi_prop_outer_red);
Conf[CosmeticsSection]["navi_prop_outer_green"] = std::to_string(Settings.cosmetic.navi_prop_outer_green);
Conf[CosmeticsSection]["navi_prop_outer_blue"] = std::to_string(Settings.cosmetic.navi_prop_outer_blue);
// Cheats
Conf[CheatSection]["debug_mode"] = std::to_string(Settings.cheats.debug_mode);
Conf[CheatSection]["infinite_money"] = std::to_string(Settings.cheats.infinite_money);
Conf[CheatSection]["infinite_health"] = std::to_string(Settings.cheats.infinite_health);
Conf[CheatSection]["infinite_ammo"] = std::to_string(Settings.cheats.infinite_ammo);
Conf[CheatSection]["infinite_magic"] = std::to_string(Settings.cheats.infinite_magic);
Conf[CheatSection]["no_clip"] = std::to_string(Settings.cheats.no_clip);
Conf[CheatSection]["climb_everything"] = std::to_string(Settings.cheats.climb_everything);
Conf[CheatSection]["moon_jump_on_l"] = std::to_string(Settings.cheats.moon_jump_on_l);
Conf[CheatSection]["super_tunic"] = std::to_string(Settings.cheats.super_tunic);
// Per-Controller
for (const auto& [i, controllers] : Ship::Window::Controllers) {
for (const auto& controller : controllers) {
if (auto padConfSection = controller->GetPadConfSection()) {
Conf[*padConfSection]["gyro_sensitivity"] = std::to_string(Settings.controller.extra[i].gyro_sensitivity);
Conf[*padConfSection]["rumble_strength"] = std::to_string(Settings.controller.extra[i].rumble_strength);
Conf[*padConfSection]["gyro_drift_x"] = std::to_string(Settings.controller.extra[i].gyro_drift_x);
Conf[*padConfSection]["gyro_drift_y"] = std::to_string(Settings.controller.extra[i].gyro_drift_y);
}
}
}
Conf.Save();
DebugConsole_SaveCVars();
}
void InitSettings() {

View File

@ -4,109 +4,10 @@ struct SoHConfigType {
// Debug
struct {
bool soh = false;
bool n64mode = false;
bool menu_bar = false;
bool soh_sink = true;
} debug;
// Audio
struct {
float master = 1.0f;
float music_main = 1.0f;
float fanfare = 1.0f;
float sfx = 1.0f;
float music_sub = 1.0f;
} audio;
// Enhancements
struct {
int text_speed = 1;
int mweep_speed = 1;
bool skip_text = false;
bool disable_lod = false;
bool animated_pause_menu = false;
bool dynamic_wallet_icon = false;
bool minimal_ui = false;
bool newdrops = false;
bool visualagony = false;
bool mm_bunny_hood = false;
bool uniform_lr = true;
} enhancements;
// Controller
struct {
struct {
float gyro_sensitivity = 1.0f;
float rumble_strength = 1.0f;
float gyro_drift_x = 0.0f;
float gyro_drift_y = 0.0f;
} extra[4];
bool rumble_enabled = true;
float input_scale = 1.0f;
bool input_enabled = false;
bool dpad_pause_name = false;
bool dpad_ocarina_text = false;
bool dpad_shop = false;
} controller;
struct {
int tunic_kokiri_red = 30;
int tunic_kokiri_green = 105;
int tunic_kokiri_blue = 27;
int tunic_goron_red = 100;
int tunic_goron_green = 20;
int tunic_goron_blue = 0;
int tunic_zora_red = 0;
int tunic_zora_green = 60;
int tunic_zora_blue = 100;
int navi_idle_inner_red = 255;
int navi_idle_inner_green = 255;
int navi_idle_inner_blue = 255;
int navi_idle_outer_red = 0;
int navi_idle_outer_green = 0;
int navi_idle_outer_blue = 255;
int navi_enemy_inner_red = 255;
int navi_enemy_inner_green = 255;
int navi_enemy_inner_blue = 0;
int navi_enemy_outer_red = 200;
int navi_enemy_outer_green = 155;
int navi_enemy_outer_blue = 0;
int navi_npc_inner_red = 150;
int navi_npc_inner_green = 150;
int navi_npc_inner_blue = 255;
int navi_npc_outer_red = 150;
int navi_npc_outer_green = 150;
int navi_npc_outer_blue = 255;
int navi_prop_inner_red = 0;
int navi_prop_inner_green = 250;
int navi_prop_inner_blue = 0;
int navi_prop_outer_red = 0;
int navi_prop_outer_green = 250;
int navi_prop_outer_blue = 0;
} cosmetic;
// Cheats
struct {
bool debug_mode = false;
bool infinite_money = false;
bool infinite_health = false;
bool infinite_ammo = false;
bool infinite_magic = false;
bool infinite_nayru = false;
bool no_clip = false;
bool climb_everything = false;
bool moon_jump_on_l = false;
bool super_tunic = false;
bool ez_isg = false;
bool no_restrict_item = false;
bool freeze_time = false;
} cheats;
// Graphics
struct {
bool show = false;

View File

@ -610,6 +610,7 @@ static void gfx_opengl_init(void) {
glGenBuffers(1, &opengl_vbo);
glBindBuffer(GL_ARRAY_BUFFER, opengl_vbo);
glEnable(GL_DEPTH_CLAMP);
glDepthFunc(GL_LEQUAL);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

View File

@ -5,6 +5,8 @@
#include "spdlog/spdlog.h"
#include "stox.h"
#include "Window.h"
#include "Cvar.h"
#include <Utils/StringHelper.h>
extern "C" uint8_t __osMaxControllers;
@ -188,15 +190,15 @@ namespace Ship {
if (SDL_GameControllerHasSensor(Cont, SDL_SENSOR_GYRO))
{
size_t contNumber = GetControllerNumber();
float& gyro_drift_x = Game::Settings.controller.extra[contNumber].gyro_drift_x;
float& gyro_drift_y = Game::Settings.controller.extra[contNumber].gyro_drift_y;
const float gyro_sensitivity = Game::Settings.controller.extra[contNumber].gyro_sensitivity;
float gyroData[3];
SDL_GameControllerGetSensorData(Cont, SDL_SENSOR_GYRO, gyroData, 3);
const char* contName = SDL_GameControllerName(Cont);
const int isSpecialController = !strcmp("PS5 Controller", contName);
float gyro_drift_x = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroDriftX", contNumber).c_str(), 0.0f);
float gyro_drift_y = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroDriftY", contNumber).c_str(), 0.0f);
const float gyro_sensitivity = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroSensitivity").c_str(), 1.0f);
if (gyro_drift_x == 0) {
gyro_drift_x = gyroData[0];
@ -211,6 +213,9 @@ namespace Ship {
}
}
CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftX", contNumber).c_str(), gyro_drift_x);
CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftY", contNumber).c_str(), gyro_drift_y);
if (isSpecialController == 1) {
wGyroX = gyroData[0] - gyro_drift_x;
wGyroY = -gyroData[2] - gyro_drift_y;
@ -344,7 +349,7 @@ namespace Ship {
{
if (SDL_GameControllerHasRumble(Cont)) {
if (controller->rumble > 0) {
float rumble_strength = Game::Settings.controller.extra[GetControllerNumber()].rumble_strength;
float rumble_strength = CVar_GetFloat(StringHelper::Sprintf("gCont%i_RumbleStrength", GetControllerNumber()).c_str(), 1.0f);
SDL_GameControllerRumble(Cont, 0xFFFF * rumble_strength, 0xFFFF * rumble_strength, 0);
} else {
SDL_GameControllerRumble(Cont, 0, 0, 0);
@ -412,11 +417,6 @@ namespace Ship {
std::shared_ptr<ConfigFile> pConf = GlobalCtx2::GetInstance()->GetConfig();
ConfigFile& Conf = *pConf.get();
Conf[ConfSection]["gyro_sensitivity"] = std::to_string(1.0f);
Conf[ConfSection]["rumble_strength"] = std::to_string(1.0f);
Conf[ConfSection]["gyro_drift_x"] = std::to_string(0.0f);
Conf[ConfSection]["gyro_drift_y"] = std::to_string(0.0f);
Conf.Save();
}

View File

@ -84,49 +84,51 @@ namespace SohImGui {
ImGui_ImplWin32_Init(impl.dx11.window);
break;
}
kokiri_col[0] = std::clamp((float) CVar_GetS32("gTunic_Kokiri_Red", 30)/255, 0.0f, 1.0f);
kokiri_col[1] = std::clamp((float)CVar_GetS32("gTunic_Kokiri_Green", 105) / 255, 0.0f, 1.0f);
kokiri_col[2] = std::clamp((float)CVar_GetS32("gTunic_Kokiri_Blue", 27) / 255, 0.0f, 1.0f);
goron_col[0] = std::clamp((float)CVar_GetS32("gTunic_Goron_Red", 100) / 255, 0.0f, 1.0f);
goron_col[1] = std::clamp((float)CVar_GetS32("gTunic_Goron_Green", 20) / 255, 0.0f, 1.0f);
goron_col[2] = std::clamp((float)CVar_GetS32("gTunic_Goron_Blue", 0) / 255, 0.0f, 1.0f);
zora_col[0] = std::clamp((float)CVar_GetS32("gTunic_Zora_Red", 0) / 255, 0.0f, 1.0f);
zora_col[1] = std::clamp((float)CVar_GetS32("gTunic_Zora_Green", 60) / 255, 0.0f, 1.0f);
zora_col[2] = std::clamp((float)CVar_GetS32("gTunic_Zora_Blue", 100) / 255, 0.0f, 1.0f);
// OTRTODO: This gameplay specific stuff should not be in libultraship. This needs to be moved to soh and use sTunicColors
kokiri_col[0] = 30 / 255.0f;
kokiri_col[1] = 105 / 255.0f;
kokiri_col[2] = 27 / 255.0f;
navi_idle_i_col[0] = std::clamp((float)CVar_GetS32("gNavi_Idle_Inner_Red", 0) / 255, 0.0f, 1.0f);
navi_idle_i_col[1] = std::clamp((float)CVar_GetS32("gNavi_Idle_Inner_Green", 0) / 255, 0.0f, 1.0f);
navi_idle_i_col[2] = std::clamp((float)CVar_GetS32("gNavi_Idle_Inner_Blue", 0) / 255, 0.0f, 1.0f);
goron_col[0] = 100 / 255.0f;
goron_col[1] = 20 / 255.0f;
goron_col[2] = 0;
zora_col[0] = 0;
zora_col[1] = 60 / 255.0f;
zora_col[2] = 100 / 255.0f;
navi_idle_o_col[0] = std::clamp((float)CVar_GetS32("gNavi_Idle_Outer_Red", 0) / 255, 0.0f, 1.0f);
navi_idle_o_col[1] = std::clamp((float)CVar_GetS32("gNavi_Idle_Outer_Green", 0) / 255, 0.0f, 1.0f);
navi_idle_o_col[2] = std::clamp((float)CVar_GetS32("gNavi_Idle_Outer_Blue", 0) / 255, 0.0f, 1.0f);
navi_idle_i_col[0] = 0;
navi_idle_i_col[1] = 0;
navi_idle_i_col[2] = 0;
navi_npc_i_col[0] = std::clamp((float)CVar_GetS32("gNavi_NPC_Inner_Red", 0) / 255, 0.0f, 1.0f);
navi_npc_i_col[1] = std::clamp((float)CVar_GetS32("gNavi_NPC_Inner_Green", 0) / 255, 0.0f, 1.0f);
navi_npc_i_col[2] = std::clamp((float)CVar_GetS32("gNavi_NPC_Inner_Blue", 0) / 255, 0.0f, 1.0f);
navi_idle_o_col[0] = 0;
navi_idle_o_col[1] = 0;
navi_idle_o_col[2] = 0;
navi_npc_o_col[0] = std::clamp((float)CVar_GetS32("gNavi_NPC_Outer_Red", 0) / 255, 0.0f, 1.0f);
navi_npc_o_col[1] = std::clamp((float)CVar_GetS32("gNavi_NPC_Outer_Green", 0) / 255, 0.0f, 1.0f);
navi_npc_o_col[2] = std::clamp((float)CVar_GetS32("gNavi_NPC_Outer_Blue", 0) / 255, 0.0f, 1.0f);
navi_npc_i_col[0] = 0;
navi_npc_i_col[1] = 0;
navi_npc_i_col[2] = 0;
navi_enemy_i_col[0] = std::clamp((float)CVar_GetS32("gNavi_Enemy_Inner_Red", 0) / 255, 0.0f, 1.0f);
navi_enemy_i_col[1] = std::clamp((float)CVar_GetS32("gNavi_Enemy_Inner_Green", 0) / 255, 0.0f, 1.0f);
navi_enemy_i_col[2] = std::clamp((float)CVar_GetS32("gNavi_Enemy_Inner_Blue", 0) / 255, 0.0f, 1.0f);
navi_npc_o_col[0] = 0;
navi_npc_o_col[1] = 0;
navi_npc_o_col[2] = 0;
navi_enemy_o_col[0] = std::clamp((float)CVar_GetS32("gNavi_Enemy_Outer_Red", 0) / 255, 0.0f, 1.0f);
navi_enemy_o_col[1] = std::clamp((float)CVar_GetS32("gNavi_Enemy_Outer_Green", 0) / 255, 0.0f, 1.0f);
navi_enemy_o_col[2] = std::clamp((float)CVar_GetS32("gNavi_Enemy_Outer_Blue", 0) / 255, 0.0f, 1.0f);
navi_enemy_i_col[0] = 0;
navi_enemy_i_col[1] = 0;
navi_enemy_i_col[2] = 0;
navi_prop_i_col[0] = std::clamp((float)CVar_GetS32("gNavi_Prop_Inner_Red", 0) / 255, 0.0f, 1.0f);
navi_prop_i_col[1] = std::clamp((float)CVar_GetS32("gNavi_Prop_Inner_Green", 0) / 255, 0.0f, 1.0f);
navi_prop_i_col[2] = std::clamp((float)CVar_GetS32("gNavi_Prop_Inner_Blue", 0) / 255, 0.0f, 1.0f);
navi_enemy_o_col[0] = 0;
navi_enemy_o_col[1] = 0;
navi_enemy_o_col[2] = 0;
navi_prop_o_col[0] = std::clamp((float)CVar_GetS32("gNavi_Prop_Outer_Red", 0) / 255, 0.0f, 1.0f);
navi_prop_o_col[1] = std::clamp((float)CVar_GetS32("gNavi_Prop_Outer_Green", 0) / 255, 0.0f, 1.0f);
navi_prop_o_col[2] = std::clamp((float)CVar_GetS32("gNavi_Prop_Outer_Blue", 0) / 255, 0.0f, 1.0f);
navi_prop_i_col[0] = 0;
navi_prop_i_col[1] = 0;
navi_prop_i_col[2] = 0;
navi_prop_o_col[0] = 0;
navi_prop_o_col[1] = 0;
navi_prop_o_col[2] = 0;
}
void ImGuiBackendInit() {
@ -324,16 +326,107 @@ namespace SohImGui {
#define BindButton(btn, status) ImGui::Image(GetTextureByID(DefaultAssets[btn]->textureId), ImVec2(16.0f * scale, 16.0f * scale), ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, (status) ? 255 : 0));
void BindAudioSlider(const char* name, const char* key, float* value, SeqPlayers playerId) {
ImGui::Text(name, static_cast<int>(100 * *(value)));
if (ImGui::SliderFloat((std::string("##") + key).c_str(), value, 0.0f, 1.0f, "")) {
const float volume = floorf(*(value) * 100) / 100;
void BindAudioSlider(const char* name, const char* key, float defaultValue, SeqPlayers playerId)
{
float value = CVar_GetFloat(key, defaultValue);
ImGui::Text(name, static_cast<int>(100 * value));
if (ImGui::SliderFloat((std::string("##") + key).c_str(), &value, 0.0f, 1.0f, "")) {
const float volume = floorf(value * 100) / 100;
CVar_SetFloat(key, volume);
needs_save = true;
Game::SetSeqPlayerVolume(playerId, volume);
}
}
void EnhancementCheckbox(std::string text, std::string cvarName)
{
bool val = (bool)CVar_GetS32(cvarName.c_str(), 0);
if (ImGui::Checkbox(text.c_str(), &val)) {
CVar_SetS32(cvarName.c_str(), val);
needs_save = true;
}
}
void EnhancementSliderInt(std::string text, std::string id, std::string cvarName, int min, int max, std::string format)
{
int val = CVar_GetS32(cvarName.c_str(), 0);
ImGui::Text(text.c_str(), val);
if (ImGui::SliderInt(id.c_str(), &val, min, max, format.c_str()))
{
CVar_SetS32(cvarName.c_str(), val);
needs_save = true;
}
if (val < min)
{
val = min;
CVar_SetS32(cvarName.c_str(), val);
needs_save = true;
}
if (val > max)
{
val = max;
CVar_SetS32(cvarName.c_str(), val);
needs_save = true;
}
}
void EnhancementSliderFloat(std::string text, std::string id, std::string cvarName, float min, float max, std::string format, float defaultValue, bool isPercentage)
{
float val = CVar_GetFloat(cvarName.c_str(), defaultValue);
if (!isPercentage)
ImGui::Text(text.c_str(), val);
else
ImGui::Text(text.c_str(), static_cast<int>(100 * val));
if (ImGui::SliderFloat(id.c_str(), &val, min, max, format.c_str()))
{
CVar_SetFloat(cvarName.c_str(), val);
needs_save = true;
}
if (val < min)
{
val = min;
CVar_SetFloat(cvarName.c_str(), val);
needs_save = true;
}
if (val > max)
{
val = max;
CVar_SetFloat(cvarName.c_str(), val);
needs_save = true;
}
}
void EnhancementColor3(std::string text, std::string cvarName, float defaultColors[3])
{
int r = CVar_GetS32((cvarName + "_Red").c_str(), (defaultColors[0] * 255.0f));
int g = CVar_GetS32((cvarName + "_Green").c_str(), (defaultColors[1] * 255.0f));
int b = CVar_GetS32((cvarName + "_Blue").c_str(), (defaultColors[2] * 255.0f));
float colors[3];
colors[0] = r / 255.0f;
colors[1] = g / 255.0f;
colors[2] = b / 255.0f;
{
if (ImGui::ColorEdit3(text.c_str(), colors))
{
CVar_SetS32((cvarName + "_Red").c_str(), (int)(colors[0] * 255));
CVar_SetS32((cvarName + "_Green").c_str(), (int)(colors[1] * 255));
CVar_SetS32((cvarName + "_Blue").c_str(), (int)(colors[2] * 255));
needs_save = true;
}
}
}
void DrawMainMenuAndCalculateGameSize() {
console->Update();
ImGuiBackendNewFrame();
@ -389,363 +482,150 @@ namespace SohImGui {
ImGui::Separator();
if (ImGui::BeginMenu("Audio")) {
const float volume = Game::Settings.audio.master;
ImGui::Text("Master Volume: %d %%", static_cast<int>(100 * volume));
if (ImGui::SliderFloat("##Master_Vol", &Game::Settings.audio.master, 0.0f, 1.0f, "")) {
CVar_SetFloat("gGameMasterVolume", volume);
needs_save = true;
}
EnhancementSliderFloat("Master Volume: %d %%", "##Master_Vol", "gGameMasterVolume", 0.0f, 1.0f, "", 1.0f, true);
BindAudioSlider("Main Music Volume: %d %%", "gMainMusicVolume", &Game::Settings.audio.music_main, SEQ_BGM_MAIN);
BindAudioSlider("Sub Music Volume: %d %%", "gSubMusicVolume", &Game::Settings.audio.music_sub, SEQ_BGM_SUB);
BindAudioSlider("Sound Effects Volume: %d %%", "gSFXMusicVolume", &Game::Settings.audio.sfx, SEQ_SFX);
BindAudioSlider("Fanfare Volume: %d %%", "gFanfareVolume", &Game::Settings.audio.fanfare, SEQ_FANFARE);
BindAudioSlider("Main Music Volume: %d %%", "gMainMusicVolume", 1.0f, SEQ_BGM_MAIN);
BindAudioSlider("Sub Music Volume: %d %%", "gSubMusicVolume", 1.0f, SEQ_BGM_SUB);
BindAudioSlider("Sound Effects Volume: %d %%", "gSFXMusicVolume", 1.0f, SEQ_SFX);
BindAudioSlider("Fanfare Volume: %d %%", "gFanfareVolume", 1.0f, SEQ_FANFARE);
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Controller")) {
for (const auto& [i, controllers] : Ship::Window::Controllers) {
if (ImGui::BeginMenu("Controller"))
{
for (const auto& [i, controllers] : Ship::Window::Controllers)
{
bool hasPad = std::find_if(controllers.begin(), controllers.end(), [](const auto& c) {
return c->HasPadConf() && c->Connected();
}) != controllers.end();
}) != controllers.end();
if (!hasPad) continue;
if (!hasPad) continue;
auto menuLabel = "Controller " + std::to_string(i + 1);
if (ImGui::BeginMenu(menuLabel.c_str())) {
ImGui::Text("Gyro Sensitivity: %d %%", static_cast<int>(100 * Game::Settings.controller.extra[i].gyro_sensitivity));
if (ImGui::SliderFloat("##GYROSCOPE", &Game::Settings.controller.extra[i].gyro_sensitivity, 0.0f, 1.0f, "")) {
needs_save = true;
auto menuLabel = "Controller " + std::to_string(i + 1);
if (ImGui::BeginMenu(menuLabel.c_str()))
{
EnhancementSliderFloat("Gyro Sensitivity: %d %%", "##GYROSCOPE", StringHelper::Sprintf("gCont%i_GyroSensitivity", i), 0.0f, 1.0f, "", 1.0f, true);
if (ImGui::Button("Recalibrate Gyro"))
{
CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftX").c_str(), 0);
CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftY").c_str(), 0);
needs_save = true;
}
ImGui::Separator();
EnhancementSliderFloat("Rumble Strength: %d %%", "##RUMBLE", StringHelper::Sprintf("gCont%i_RumbleStrength", i), 0.0f, 1.0f, "", 1.0f, true);
ImGui::EndMenu();
}
if (ImGui::Button("Recalibrate Gyro")) {
Game::Settings.controller.extra[i].gyro_drift_x = 0;
Game::Settings.controller.extra[i].gyro_drift_y = 0;
needs_save = true;
}
ImGui::Separator();
ImGui::Text("Rumble Strength: %d %%", static_cast<int>(100 * Game::Settings.controller.extra[i].rumble_strength));
if (ImGui::SliderFloat("##RUMBLE", &Game::Settings.controller.extra[i].rumble_strength, 0.0f, 1.0f, "")) {
needs_save = true;
}
ImGui::EndMenu();
}
}
EnhancementCheckbox("Show Inputs", "gInputEnabled");
EnhancementCheckbox("Rumble Enabled", "gRumbleEnabled");
EnhancementSliderFloat("Input Scale: %.1f", "##Input", "gInputScale", 1.0f, 3.0f, "", 1.0f, false);
ImGui::Separator();
if (ImGui::Checkbox("Rumble Enabled", &Game::Settings.controller.rumble_enabled)) {
CVar_SetS32("gRumbleEnabled", Game::Settings.controller.rumble_enabled);
needs_save = true;
}
if (ImGui::Checkbox("Show Inputs", &Game::Settings.controller.input_enabled)) {
needs_save = true;
}
ImGui::Text("Input Scale: %.1f", Game::Settings.controller.input_scale);
if (ImGui::SliderFloat("##Input", &Game::Settings.controller.input_scale, 1.0f, 3.0f, "")) {
needs_save = true;
}
ImGui::Separator();
if (ImGui::Checkbox("Dpad Support on Pause and File Select", &Game::Settings.controller.dpad_pause_name)) {
CVar_SetS32("gDpadPauseName", Game::Settings.controller.dpad_pause_name);
needs_save = true;
}
if (ImGui::Checkbox("DPad Support in Ocarina and Text Choice", &Game::Settings.controller.dpad_ocarina_text)) {
CVar_SetS32("gDpadOcarinaText", Game::Settings.controller.dpad_ocarina_text);
needs_save = true;
}
if (ImGui::Checkbox("DPad Support for Browsing Shop Items", &Game::Settings.controller.dpad_shop)) {
CVar_SetS32("gDpadShop", Game::Settings.controller.dpad_shop);
needs_save = true;
}
EnhancementCheckbox("Dpad Support on Pause and File Select", "gDpadPauseName");
EnhancementCheckbox("DPad Support in Ocarina and Text Choice", "gDpadOcarinaText");
EnhancementCheckbox("DPad Support for Browsing Shop Items", "gDpadShop");
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Enhancements")) {
if (ImGui::BeginMenu("Enhancements"))
{
ImGui::Text("Gameplay");
ImGui::Separator();
ImGui::Text("Text Speed: %dx", Game::Settings.enhancements.text_speed);
if (ImGui::SliderInt("##TEXTSPEED", &Game::Settings.enhancements.text_speed, 1, 5, "")) {
CVar_SetS32("gTextSpeed", Game::Settings.enhancements.text_speed);
needs_save = true;
}
EnhancementSliderInt("Text Speed: %dx", "##TEXTSPEED", "gTextSpeed", 1, 5, "");
EnhancementSliderInt("King Zora Speed: %dx", "##WEEPSPEED", "gMweepSpeed", 1, 5, "");
ImGui::Text("King Zora Speed: %dx", Game::Settings.enhancements.mweep_speed);
if (ImGui::SliderInt("##MWEEPSPEED", &Game::Settings.enhancements.mweep_speed, 1, 5, "")) {
CVar_SetS32("gMweepSpeed", Game::Settings.enhancements.mweep_speed);
needs_save = true;
}
if (ImGui::Checkbox("Skip Text", &Game::Settings.enhancements.skip_text)) {
CVar_SetS32("gSkipText", Game::Settings.enhancements.skip_text);
needs_save = true;
}
if (ImGui::Checkbox("Minimal UI", &Game::Settings.enhancements.minimal_ui)) {
CVar_SetS32("gMinimalUI", Game::Settings.enhancements.minimal_ui);
needs_save = true;
}
if (ImGui::Checkbox("MM Bunny Hood", &Game::Settings.enhancements.mm_bunny_hood)) {
CVar_SetS32("gMMBunnyHood", Game::Settings.enhancements.mm_bunny_hood);
needs_save = true;
}
/*if (ImGui::Checkbox("Fix L&R Pause menu", &Game::Settings.enhancements.uniform_lr)) {
CVar_SetS32("gUniformLR", Game::Settings.enhancements.uniform_lr);
needs_save = true;
}*/
if (ImGui::Checkbox("Visual Stone of Agony", &Game::Settings.enhancements.visualagony)) {
CVar_SetS32("gVisualAgony", Game::Settings.enhancements.visualagony);
needs_save = true;
}
EnhancementCheckbox("Skip Text", "gSkipText");
EnhancementCheckbox("Minimal UI", "gMinimalUI");
EnhancementCheckbox("MM Bunny Hood", "gMMBunnyHood");
EnhancementCheckbox("Visual Stone of Agony", "gVisualAgony");
ImGui::Text("Graphics");
ImGui::Separator();
HOOK(ImGui::Checkbox("N64 Mode", &Game::Settings.debug.n64mode));
EnhancementCheckbox("N64 Mode", "gN64Mode");
if (ImGui::Checkbox("Animated Link in Pause Menu", &Game::Settings.enhancements.animated_pause_menu)) {
CVar_SetS32("gPauseLiveLink", Game::Settings.enhancements.animated_pause_menu);
needs_save = true;
}
if (ImGui::Checkbox("Disable LOD", &Game::Settings.enhancements.disable_lod)) {
CVar_SetS32("gDisableLOD", Game::Settings.enhancements.disable_lod);
needs_save = true;
}
if (ImGui::Checkbox("Enable 3D Dropped items", &Game::Settings.enhancements.newdrops)) {
CVar_SetS32("gNewDrops", Game::Settings.enhancements.newdrops);
needs_save = true;
}
if (ImGui::Checkbox("Dynamic Wallet Icon", &Game::Settings.enhancements.dynamic_wallet_icon)) {
CVar_SetS32("gDynamicWalletIcon", Game::Settings.enhancements.dynamic_wallet_icon);
needs_save = true;
}
EnhancementCheckbox("Animated Link in Pause Menu", "gPauseLiveLink");
EnhancementCheckbox("Disable LOD", "gDisableLOD");
EnhancementCheckbox("Enable 3D Dropped items", "gNewDrops");
EnhancementCheckbox("Dynamic Wallet Icon", "gDynamicWalletIcon");
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Developer Tools")) {
if (ImGui::BeginMenu("Developer Tools"))
{
HOOK(ImGui::MenuItem("Stats", nullptr, &Game::Settings.debug.soh));
HOOK(ImGui::MenuItem("Console", nullptr, &console->opened));
ImGui::Text("Debug");
ImGui::Separator();
if (ImGui::Checkbox("Debug Mode", &Game::Settings.cheats.debug_mode)) {
CVar_SetS32("gDebugEnabled", Game::Settings.cheats.debug_mode);
needs_save = true;
}
EnhancementCheckbox("Debug Mode", "gDebugEnabled");
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Graphics")) {
if (ImGui::BeginMenu("Graphics"))
{
HOOK(ImGui::MenuItem("Anti-aliasing", nullptr, &Game::Settings.graphics.show));
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Cheats")) {
if (ImGui::BeginMenu("Cheats"))
{
if (ImGui::BeginMenu("Infinite...")) {
if (ImGui::Checkbox("Money", &Game::Settings.cheats.infinite_money)) {
CVar_SetS32("gInfiniteMoney", Game::Settings.cheats.infinite_money);
needs_save = true;
}
EnhancementCheckbox("Money", "gInfiniteMoney");
EnhancementCheckbox("Health", "gInfiniteHealth");
EnhancementCheckbox("Ammo", "gInfiniteAmmo");
EnhancementCheckbox("Magic", "gInfiniteMagic");
EnhancementCheckbox("Nayru's Love", "gInfiniteNayru");
if (ImGui::Checkbox("Health", &Game::Settings.cheats.infinite_health)) {
CVar_SetS32("gInfiniteHealth", Game::Settings.cheats.infinite_health);
needs_save = true;
}
if (ImGui::Checkbox("Ammo", &Game::Settings.cheats.infinite_ammo)) {
CVar_SetS32("gInfiniteAmmo", Game::Settings.cheats.infinite_ammo);
needs_save = true;
}
if (ImGui::Checkbox("Magic", &Game::Settings.cheats.infinite_magic)) {
CVar_SetS32("gInfiniteMagic", Game::Settings.cheats.infinite_magic);
needs_save = true;
}
if (ImGui::Checkbox("Nayru's Love", &Game::Settings.cheats.infinite_nayru)) {
CVar_SetS32("gInfiniteNayru", Game::Settings.cheats.infinite_nayru);
needs_save = true;
}
ImGui::EndMenu();
}
if (ImGui::Checkbox("No Clip", &Game::Settings.cheats.no_clip)) {
CVar_SetS32("gNoClip", Game::Settings.cheats.no_clip);
needs_save = true;
}
if (ImGui::Checkbox("Climb Everything", &Game::Settings.cheats.climb_everything)) {
CVar_SetS32("gClimbEverything", Game::Settings.cheats.climb_everything);
needs_save = true;
}
if (ImGui::Checkbox("Moon Jump on L", &Game::Settings.cheats.moon_jump_on_l)) {
CVar_SetS32("gMoonJumpOnL", Game::Settings.cheats.moon_jump_on_l);
needs_save = true;
}
if (ImGui::Checkbox("Super Tunic", &Game::Settings.cheats.super_tunic)) {
CVar_SetS32("gSuperTunic", Game::Settings.cheats.super_tunic);
needs_save = true;
}
}
if (ImGui::BeginMenu("Cosmetics")) {
ImGui::Text("Tunics");
ImGui::Separator();
if (ImGui::ColorEdit3("Kokiri Tunic", kokiri_col)) {
Game::Settings.cosmetic.tunic_kokiri_red = (int)(kokiri_col[0] * 255);
Game::Settings.cosmetic.tunic_kokiri_green = (int)(kokiri_col[1] * 255);
Game::Settings.cosmetic.tunic_kokiri_blue = (int)(kokiri_col[2] * 255);
CVar_SetS32("gTunic_Kokiri_Red", Game::Settings.cosmetic.tunic_kokiri_red);
CVar_SetS32("gTunic_Kokiri_Green", Game::Settings.cosmetic.tunic_kokiri_green);
CVar_SetS32("gTunic_Kokiri_Blue", Game::Settings.cosmetic.tunic_kokiri_blue);
needs_save = true;
}
if (ImGui::ColorEdit3("Goron Tunic", goron_col)) {
Game::Settings.cosmetic.tunic_goron_red = (int)(goron_col[0] * 255);
Game::Settings.cosmetic.tunic_goron_green = (int)(goron_col[1] * 255);
Game::Settings.cosmetic.tunic_goron_blue = (int)(goron_col[2] * 255);
CVar_SetS32("gTunic_Goron_Red", Game::Settings.cosmetic.tunic_goron_red);
CVar_SetS32("gTunic_Goron_Green", Game::Settings.cosmetic.tunic_goron_green);
CVar_SetS32("gTunic_Goron_Blue", Game::Settings.cosmetic.tunic_goron_blue);
needs_save = true;
}
if (ImGui::ColorEdit3("Zora Tunic", zora_col)) {
Game::Settings.cosmetic.tunic_zora_red = (int)(zora_col[0] * 255);
Game::Settings.cosmetic.tunic_zora_green = (int)(zora_col[1] * 255);
Game::Settings.cosmetic.tunic_zora_blue = (int)(zora_col[2] * 255);
CVar_SetS32("gTunic_Zora_Red", Game::Settings.cosmetic.tunic_zora_red);
CVar_SetS32("gTunic_Zora_Green", Game::Settings.cosmetic.tunic_zora_green);
CVar_SetS32("gTunic_Zora_Blue", Game::Settings.cosmetic.tunic_zora_blue);
needs_save = true;
}
ImGui::Text("Navi");
ImGui::Separator();
if (ImGui::ColorEdit3("Navi Idle Inner", navi_idle_i_col)) {
Game::Settings.cosmetic.navi_idle_inner_red = (int)(navi_idle_i_col[0] * 255);
Game::Settings.cosmetic.navi_idle_inner_green = (int)(navi_idle_i_col[1] * 255);
Game::Settings.cosmetic.navi_idle_inner_blue = (int)(navi_idle_i_col[2] * 255);
CVar_SetS32("gNavi_Idle_Inner_Red", Game::Settings.cosmetic.navi_idle_inner_red);
CVar_SetS32("gNavi_Idle_Inner_Green", Game::Settings.cosmetic.navi_idle_inner_green);
CVar_SetS32("gNavi_Idle_Inner_Blue", Game::Settings.cosmetic.navi_idle_inner_blue);
needs_save = true;
}
if (ImGui::ColorEdit3("Navi Idle Outer", navi_idle_o_col)) {
Game::Settings.cosmetic.navi_idle_outer_red = (int)(navi_idle_o_col[0] * 255);
Game::Settings.cosmetic.navi_idle_outer_green = (int)(navi_idle_o_col[1] * 255);
Game::Settings.cosmetic.navi_idle_outer_blue = (int)(navi_idle_o_col[2] * 255);
CVar_SetS32("gNavi_Idle_Outer_Red", Game::Settings.cosmetic.navi_idle_outer_red);
CVar_SetS32("gNavi_Idle_Outer_Green", Game::Settings.cosmetic.navi_idle_outer_green);
CVar_SetS32("gNavi_Idle_Outer_Blue", Game::Settings.cosmetic.navi_idle_outer_blue);
needs_save = true;
}
if (ImGui::ColorEdit3("Navi NPC Inner", navi_npc_i_col)) {
Game::Settings.cosmetic.navi_npc_inner_red = (int)(navi_npc_i_col[0] * 255);
Game::Settings.cosmetic.navi_npc_inner_green = (int)(navi_npc_i_col[1] * 255);
Game::Settings.cosmetic.navi_npc_inner_blue = (int)(navi_npc_i_col[2] * 255);
CVar_SetS32("gNavi_NPC_Inner_Red", Game::Settings.cosmetic.navi_npc_inner_red);
CVar_SetS32("gNavi_NPC_Inner_Green", Game::Settings.cosmetic.navi_npc_inner_green);
CVar_SetS32("gNavi_NPC_Inner_Blue", Game::Settings.cosmetic.navi_npc_inner_blue);
needs_save = true;
}
if (ImGui::ColorEdit3("Navi NPC Outer", navi_npc_o_col)) {
Game::Settings.cosmetic.navi_npc_outer_red = (int)(navi_npc_o_col[0] * 255);
Game::Settings.cosmetic.navi_npc_outer_green = (int)(navi_npc_o_col[1] * 255);
Game::Settings.cosmetic.navi_npc_outer_blue = (int)(navi_npc_o_col[2] * 255);
CVar_SetS32("gNavi_NPC_Outer_Red", Game::Settings.cosmetic.navi_npc_outer_red);
CVar_SetS32("gNavi_NPC_Outer_Green", Game::Settings.cosmetic.navi_npc_outer_green);
CVar_SetS32("gNavi_NPC_Outer_Blue", Game::Settings.cosmetic.navi_npc_outer_blue);
needs_save = true;
}
if (ImGui::ColorEdit3("Navi Enemy Inner", navi_enemy_i_col)) {
Game::Settings.cosmetic.navi_enemy_inner_red = (int)(navi_enemy_i_col[0] * 255);
Game::Settings.cosmetic.navi_enemy_inner_green = (int)(navi_enemy_i_col[1] * 255);
Game::Settings.cosmetic.navi_enemy_inner_blue = (int)(navi_enemy_i_col[2] * 255);
CVar_SetS32("gNavi_Enemy_Inner_Red", Game::Settings.cosmetic.navi_enemy_inner_red);
CVar_SetS32("gNavi_Enemy_Inner_Green", Game::Settings.cosmetic.navi_enemy_inner_green);
CVar_SetS32("gNavi_Enemy_Inner_Blue", Game::Settings.cosmetic.navi_enemy_inner_blue);
needs_save = true;
}
if (ImGui::ColorEdit3("Navi Enemy Outer", navi_enemy_o_col)) {
Game::Settings.cosmetic.navi_enemy_outer_red = (int)(navi_enemy_o_col[0] * 255);
Game::Settings.cosmetic.navi_enemy_outer_green = (int)(navi_enemy_o_col[1] * 255);
Game::Settings.cosmetic.navi_enemy_outer_blue = (int)(navi_enemy_o_col[2] * 255);
CVar_SetS32("gNavi_Enemy_Outer_Red", Game::Settings.cosmetic.navi_enemy_outer_red);
CVar_SetS32("gNavi_Enemy_Outer_Green", Game::Settings.cosmetic.navi_enemy_outer_green);
CVar_SetS32("gNavi_Enemy_Outer_Blue", Game::Settings.cosmetic.navi_enemy_outer_blue);
needs_save = true;
}
if (ImGui::ColorEdit3("Navi Prop Inner", navi_prop_i_col)) {
Game::Settings.cosmetic.navi_prop_inner_red = (int)(navi_prop_i_col[0] * 255);
Game::Settings.cosmetic.navi_prop_inner_green = (int)(navi_prop_i_col[1] * 255);
Game::Settings.cosmetic.navi_prop_inner_blue = (int)(navi_prop_i_col[2] * 255);
CVar_SetS32("gNavi_Prop_Inner_Red", Game::Settings.cosmetic.navi_prop_inner_red);
CVar_SetS32("gNavi_Prop_Inner_Green", Game::Settings.cosmetic.navi_prop_inner_green);
CVar_SetS32("gNavi_Prop_Inner_Blue", Game::Settings.cosmetic.navi_prop_inner_blue);
needs_save = true;
}
if (ImGui::ColorEdit3("Navi Prop Outer", navi_prop_o_col)) {
Game::Settings.cosmetic.navi_prop_outer_red = (int)(navi_prop_o_col[0] * 255);
Game::Settings.cosmetic.navi_prop_outer_green = (int)(navi_prop_o_col[1] * 255);
Game::Settings.cosmetic.navi_prop_outer_blue = (int)(navi_prop_o_col[2] * 255);
CVar_SetS32("gNavi_Prop_Outer_Red", Game::Settings.cosmetic.navi_prop_outer_red);
CVar_SetS32("gNavi_Prop_Outer_Green", Game::Settings.cosmetic.navi_prop_outer_green);
CVar_SetS32("gNavi_Prop_Outer_Blue", Game::Settings.cosmetic.navi_prop_outer_blue);
needs_save = true;
}
EnhancementCheckbox("No Clip", "gNoClip");
EnhancementCheckbox("Climb Everything", "gClimbEverything");
EnhancementCheckbox("Moon Jump on L", "gMoonJumpOnL");
EnhancementCheckbox("Super Tunic", "gSuperTunic");
EnhancementCheckbox("Easy ISG", "gEzISG");
EnhancementCheckbox("Unrestricted Items", "gNoRestrictItems");
EnhancementCheckbox("Freeze Time", "gFreezeTime");
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Cosmetics"))
{
ImGui::Text("Tunics");
ImGui::Separator();
if (ImGui::BeginMenu("Developer Tools")) {
HOOK(ImGui::MenuItem("Stats", nullptr, &Game::Settings.debug.soh));
HOOK(ImGui::MenuItem("Console", nullptr, &console->opened));
if (ImGui::Checkbox("Easy ISG", &Game::Settings.cheats.ez_isg)) {
CVar_SetS32("gEzISG", Game::Settings.cheats.ez_isg);
needs_save = true;
}
EnhancementColor3("Kokiri Tunic", "gTunic_Kokiri", kokiri_col);
EnhancementColor3("Goron Tunic", "gTunic_Goron", goron_col);
EnhancementColor3("Zora Tunic", "gTunic_Zora", zora_col);
if (ImGui::Checkbox("Unrestricted Items", &Game::Settings.cheats.no_restrict_item)) {
CVar_SetS32("gNoRestrictItems", Game::Settings.cheats.no_restrict_item);
needs_save = true;
}
ImGui::Text("Navi");
ImGui::Separator();
if (ImGui::Checkbox("Freeze Time", &Game::Settings.cheats.freeze_time)) {
CVar_SetS32("gFreezeTime", Game::Settings.cheats.freeze_time);
needs_save = true;
}
EnhancementColor3("Navi Idle Inner", "gNavi_Idle_Inner", navi_idle_i_col);
EnhancementColor3("Navi Idle Outer", "gNavi_Idle_Outer", navi_idle_o_col);
EnhancementColor3("Navi NPC Inner", "gNavi_NPC_Inner", navi_npc_i_col);
EnhancementColor3("Navi NPC Outer", "gNavi_NPC_Outer", navi_npc_o_col);
EnhancementColor3("Navi Enemy Inner", "gNavi_Enemy_Inner", navi_enemy_i_col);
EnhancementColor3("Navi Enemy Outer", "gNavi_Enemy_Outer", navi_enemy_o_col);
EnhancementColor3("Navi Prop Inner", "gNavi_Prop_Inner", navi_prop_i_col);
EnhancementColor3("Navi Prop Outer", "gNavi_Prop_Outer", navi_prop_o_col);
ImGui::EndMenu();
}
@ -815,7 +695,9 @@ namespace SohImGui {
gfx_current_game_window_viewport.y = main_pos.y;
gfx_current_game_window_viewport.width = size.x;
gfx_current_game_window_viewport.height = size.y;
if (Game::Settings.debug.n64mode) {
if (CVar_GetS32("gN64Mode", 0))
{
gfx_current_dimensions.width = 320;
gfx_current_dimensions.height = 240;
const int sw = size.y * 320 / 240;
@ -830,7 +712,7 @@ namespace SohImGui {
ImVec2 main_pos = ImGui::GetWindowPos();
ImVec2 size = ImGui::GetContentRegionAvail();
ImVec2 pos = ImVec2(0, 0);
if (Game::Settings.debug.n64mode) {
if (CVar_GetS32("gN64Mode", 0)) {
const int sw = size.y * 320 / 240;
pos = ImVec2(size.x / 2 - sw / 2, 0);
size = ImVec2(sw, size.y);
@ -845,10 +727,10 @@ namespace SohImGui {
ImGui::End();
const float scale = Game::Settings.controller.input_scale;
const float scale = CVar_GetFloat("gInputScale", 1.0f);
ImVec2 BtnPos = ImVec2(160 * scale, 85 * scale);
if (Game::Settings.controller.input_enabled) {
if (CVar_GetS32("gInputEnabled", 0)) {
ImGui::SetNextWindowSize(BtnPos);
ImGui::SetNextWindowPos(ImVec2(main_pos.x + size.x - BtnPos.x - 20, main_pos.y + size.y - BtnPos.y - 20));

View File

@ -60,7 +60,13 @@ namespace SohImGui {
extern Console* console;
void Init(WindowImpl window_impl);
void Update(EventImpl event);
void EnhancementCheckbox(std::string text, std::string cvarName);
void EnhancementSliderInt(std::string text, std::string id, std::string cvarName, int min, int max, std::string format);
void EnhancementSliderFloat(std::string text, std::string id, std::string cvarName, float min, float max, std::string format, float defaultValue);
void DrawMainMenuAndCalculateGameSize(void);
void DrawFramebufferAndGameInput(void);
void Render(void);
void CancelFrame(void);

View File

@ -275,8 +275,11 @@ namespace Ship {
WmApi->set_keyboard_callbacks(Window::KeyDown, Window::KeyUp, Window::AllKeysUp);
}
void Window::RunCommands(Gfx* Commands) {
void Window::StartFrame() {
gfx_start_frame();
}
void Window::RunCommands(Gfx* Commands) {
gfx_run(Commands);
gfx_end_frame();
}

View File

@ -18,6 +18,7 @@ namespace Ship {
~Window();
void MainLoop(void (*MainFunction)(void));
void Init();
void StartFrame();
void RunCommands(Gfx* Commands);
void SetFrameDivisor(int divisor);
void GetPixelDepthPrepare(float x, float y);

View File

@ -0,0 +1,14 @@
<Root>
<File Name="nes_message_data_static">
<Text Name="nes_message_data_static" CodeOffset="0x12E4E0"/>
</File>
<File Name="ger_message_data_static">
<Text Name="ger_message_data_static" CodeOffset="0x12E4E0" LangOffset="0x132708"/>
</File>
<File Name="fra_message_data_static">
<Text Name="fra_message_data_static" CodeOffset="0x12E4E0" LangOffset="0x134818"/>
</File>
<File Name="staff_message_data_static">
<Text Name="staff_message_data_static" CodeOffset="0x136928"/>
</File>
</Root>

View File

@ -1,5 +0,0 @@
<Root>
<File Name="nes_message_data_static">
<Text Name="nes_message_data_static" CodeOffset="0x12E4E0"/>
</File>
</Root>

View File

@ -1,5 +0,0 @@
<Root>
<File Name="staff_message_data_static">
<Text Name="staff_message_data_static" CodeOffset="0x136928"/>
</File>
</Root>

View File

@ -0,0 +1,14 @@
<Root>
<File Name="nes_message_data_static">
<Text Name="nes_message_data_static" CodeOffset="0xF6910"/>
</File>
<File Name="ger_message_data_static">
<Text Name="ger_message_data_static" CodeOffset="0xF6910" LangOffset="0xFAB38"/>
</File>
<File Name="fra_message_data_static">
<Text Name="fra_message_data_static" CodeOffset="0xF6910" LangOffset="0xFCC48"/>
</File>
<File Name="staff_message_data_static">
<Text Name="staff_message_data_static" CodeOffset="0xFED58"/>
</File>
</Root>

View File

@ -1,5 +0,0 @@
<Root>
<File Name="nes_message_data_static">
<Text Name="nes_message_data_static" CodeOffset="0xF6910"/>
</File>
</Root>

View File

@ -1,5 +0,0 @@
<Root>
<File Name="staff_message_data_static">
<Text Name="staff_message_data_static" CodeOffset="0xFED58"/>
</File>
</Root>

View File

@ -126,12 +126,12 @@
extern GraphicsContext* __gfxCtx;
#define WORK_DISP __gfxCtx->work.p
#define POLY_OPA_DISP __gfxCtx->polyOpa.p
#define POLY_XLU_DISP __gfxCtx->polyXlu.p
#define TITLE_CARD_DISP __gfxCtx->titlecard.p
#define POLY_KAL_DISP __gfxCtx->polyKal.p
#define OVERLAY_DISP __gfxCtx->overlay.p
#define WORK_DISP __gfxCtx->work.p
#define POLY_OPA_DISP __gfxCtx->polyOpa.p
#define POLY_XLU_DISP __gfxCtx->polyXlu.p
#define WORLD_OVERLAY_DISP __gfxCtx->worldOverlay.p
#define POLY_KAL_DISP __gfxCtx->polyKal.p
#define OVERLAY_DISP __gfxCtx->overlay.p
// __gfxCtx shouldn't be used directly.
// Use the DISP macros defined above when writing to display buffers.

View File

@ -83,7 +83,7 @@ typedef struct {
/* 0x00000 */ u16 headMagic; // GFXPOOL_HEAD_MAGIC
/* 0x00008 */ Gfx polyOpaBuffer[0x2FC0];
/* 0x0BF08 */ Gfx polyXluBuffer[0x1000];
/* 0xXXXXX */ Gfx titlecardBuffer[0x1000];
/* 0xXXXXX */ Gfx worldOverlayBuffer[0x1000];
/* 0x0BF08 */ Gfx polyKalBuffer[0x1000];
/* 0x0FF08 */ Gfx overlayBuffer[0x800];
/* 0x11F08 */ Gfx workBuffer[0x100];
@ -131,7 +131,7 @@ typedef struct OSScTask {
typedef struct GraphicsContext {
/* 0x0000 */ Gfx* polyOpaBuffer; // Pointer to "Zelda 0"
/* 0x0004 */ Gfx* polyXluBuffer; // Pointer to "Zelda 1"
/* 0xXXX */ Gfx* titlecardBuffer; // Pointer to "Paris"
/* 0xXXX */ Gfx* worldOverlayBuffer; // Pointer to "Paris"
/* 0xXXX */ Gfx* polyKalBuffer; // Pointer to "Rome"
/* 0x0008 */ char unk_008[0x08]; // Unused, could this be pointers to "Zelda 2" / "Zelda 3"
/* 0x0010 */ Gfx* overlayBuffer; // Pointer to "Zelda 4"
@ -151,7 +151,7 @@ typedef struct GraphicsContext {
/* 0x02A8 */ TwoHeadGfxArena overlay; // "Zelda 4"
/* 0x02B8 */ TwoHeadGfxArena polyOpa; // "Zelda 0"
/* 0x02C8 */ TwoHeadGfxArena polyXlu; // "Zelda 1"
/* 0x0XXX */ TwoHeadGfxArena titlecard; // When in Paris...
/* 0x0XXX */ TwoHeadGfxArena worldOverlay; // When in Paris...
/* 0x0XXX */ TwoHeadGfxArena polyKal; // When in Rome...
/* 0x02D8 */ u32 gfxPoolIdx;
/* 0x02DC */ u16* curFrameBuffer;

View File

@ -327,9 +327,6 @@ static int CheckVarType(const std::string& input)
return result;
}
void DebugConsole_LoadCVars();
void DebugConsole_SaveCVars();
static bool SetCVarHandler(const std::vector<std::string>& args) {
if (args.size() < 3)
return CMD_FAILED;

View File

@ -1,3 +1,5 @@
#pragma once
void DebugConsole_Init(void);
void DebugConsole_Init(void);
void DebugConsole_LoadCVars();
void DebugConsole_SaveCVars();

View File

@ -5,6 +5,7 @@
extern "C" {
void InitOTR();
void Graph_ProcessFrame(void (*run_one_game_iter)(void));
void Graph_StartFrame();
void Graph_ProcessGfxCommands(Gfx* commands);
void OTRLogString(const char* src);
void OTRGfxPrint(const char* str, void* printer, void (*printImpl)(void*, char));

View File

@ -26,6 +26,7 @@
#include "../soh/Enhancements/debugger/debugger.h"
#include "Utils/BitConverter.h"
#include "variables.h"
#include <Utils/StringHelper.h>
OTRGlobals* OTRGlobals::Instance;
@ -91,6 +92,10 @@ extern "C" void Graph_ProcessFrame(void (*run_one_game_iter)(void)) {
OTRGlobals::Instance->context->GetWindow()->MainLoop(run_one_game_iter);
}
extern "C" void Graph_StartFrame() {
OTRGlobals::Instance->context->GetWindow()->StartFrame();
}
// C->C++ Bridge
extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
OTRGlobals::Instance->context->GetWindow()->SetFrameDivisor(R_UPDATE_RATE);
@ -888,8 +893,11 @@ extern "C" void AudioPlayer_Play(const uint8_t* buf, uint32_t len) {
}
extern "C" int Controller_ShouldRumble(size_t i) {
for (const auto& controller : Ship::Window::Controllers.at(i)) {
if (controller->CanRumble() && Game::Settings.controller.extra[i].rumble_strength > 0.001f) {
for (const auto& controller : Ship::Window::Controllers.at(i))
{
float rumble_strength = CVar_GetFloat(StringHelper::Sprintf("gCont%i_RumbleStrength", i).c_str(), 1.0f);
if (controller->CanRumble() && rumble_strength > 0.001f) {
return 1;
}
}

View File

@ -21,6 +21,7 @@ private:
#ifndef __cplusplus
void InitOTR();
void Graph_ProcessFrame(void (*run_one_game_iter)(void));
void Graph_StartFrame();
void Graph_ProcessGfxCommands(Gfx* commands);
void OTRLogString(const char* src);
void OTRGfxPrint(const char* str, void* printer, void (*printImpl)(void*, char));

View File

@ -8,27 +8,37 @@
#include <Text.h>
extern "C" MessageTableEntry* sNesMessageEntryTablePtr;
extern "C" MessageTableEntry* sGerMessageEntryTablePtr;
extern "C" MessageTableEntry* sFraMessageEntryTablePtr;
extern "C" MessageTableEntry* sStaffMessageEntryTablePtr;
//extern "C" MessageTableEntry* _message_0xFFFC_nes;
//extern "C" MessageTableEntry* _message_0xFFFC_nes;
MessageTableEntry* OTRMessage_LoadTable(const char* filePath, bool isNES) {
auto file = std::static_pointer_cast<Ship::Text>(OTRGlobals::Instance->context->GetResourceManager()->LoadResource(filePath));
if (file == nullptr)
return nullptr;
MessageTableEntry* table = (MessageTableEntry*)malloc(sizeof(MessageTableEntry) * file->messages.size());
for (int i = 0; i < file->messages.size(); i++) {
table[i].textId = file->messages[i].id;
table[i].typePos = (file->messages[i].textboxType << 4) | file->messages[i].textboxYPos;
table[i].segment = file->messages[i].msg.c_str();
table[i].msgSize = file->messages[i].msg.size();
if (isNES && file->messages[i].id == 0xFFFC)
_message_0xFFFC_nes = (char*)file->messages[i].msg.c_str();
}
return table;
}
extern "C" void OTRMessage_Init()
{
auto file = std::static_pointer_cast<Ship::Text>(OTRGlobals::Instance->context->GetResourceManager()->LoadResource("text/nes_message_data_static/nes_message_data_static"));
sNesMessageEntryTablePtr = (MessageTableEntry*)malloc(sizeof(MessageTableEntry) * file->messages.size());
for (int i = 0; i < file->messages.size(); i++)
{
sNesMessageEntryTablePtr[i].textId = file->messages[i].id;
sNesMessageEntryTablePtr[i].typePos = (file->messages[i].textboxType << 4) | file->messages[i].textboxYPos;
sNesMessageEntryTablePtr[i].segment = file->messages[i].msg.c_str();
sNesMessageEntryTablePtr[i].msgSize = file->messages[i].msg.size();
if (file->messages[i].id == 0xFFFC)
{
_message_0xFFFC_nes = (char*)file->messages[i].msg.c_str();
}
}
sNesMessageEntryTablePtr = OTRMessage_LoadTable("text/nes_message_data_static/nes_message_data_static", true);
sGerMessageEntryTablePtr = OTRMessage_LoadTable("text/ger_message_data_static/ger_message_data_static", false);
sFraMessageEntryTablePtr = OTRMessage_LoadTable("text/fra_message_data_static/fra_message_data_static", false);
auto file2 = std::static_pointer_cast<Ship::Text>(OTRGlobals::Instance->context->GetResourceManager()->LoadResource("text/staff_message_data_static/staff_message_data_static"));

View File

@ -95,14 +95,14 @@ void Graph_InitTHGA(GraphicsContext* gfxCtx) {
pool->tailMagic = GFXPOOL_TAIL_MAGIC;
THGA_Ct(&gfxCtx->polyOpa, pool->polyOpaBuffer, sizeof(pool->polyOpaBuffer));
THGA_Ct(&gfxCtx->polyXlu, pool->polyXluBuffer, sizeof(pool->polyXluBuffer));
THGA_Ct(&gfxCtx->titlecard, pool->titlecardBuffer, sizeof(pool->titlecardBuffer));
THGA_Ct(&gfxCtx->worldOverlay, pool->worldOverlayBuffer, sizeof(pool->worldOverlayBuffer));
THGA_Ct(&gfxCtx->polyKal, pool->polyKalBuffer, sizeof(pool->polyKalBuffer));
THGA_Ct(&gfxCtx->overlay, pool->overlayBuffer, sizeof(pool->overlayBuffer));
THGA_Ct(&gfxCtx->work, pool->workBuffer, sizeof(pool->workBuffer));
gfxCtx->polyOpaBuffer = pool->polyOpaBuffer;
gfxCtx->polyXluBuffer = pool->polyXluBuffer;
gfxCtx->titlecardBuffer = pool->titlecardBuffer;
gfxCtx->worldOverlayBuffer = pool->worldOverlayBuffer;
gfxCtx->polyKalBuffer = pool->polyKalBuffer;
gfxCtx->overlayBuffer = pool->overlayBuffer;
gfxCtx->workBuffer = pool->workBuffer;
@ -276,7 +276,6 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
gDPNoOpString(WORK_DISP++, "WORK_DISP 開始", 0);
gDPNoOpString(POLY_OPA_DISP++, "POLY_OPA_DISP 開始", 0);
gDPNoOpString(POLY_XLU_DISP++, "POLY_XLU_DISP 開始", 0);
gDPNoOpString(TITLE_CARD_DISP++, "TITLE_CARD_DISP 開始", 0);//unsure if needed
gDPNoOpString(OVERLAY_DISP++, "OVERLAY_DISP 開始", 0);
CLOSE_DISPS(gfxCtx, "../graph.c", 975);
@ -289,7 +288,6 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
gDPNoOpString(WORK_DISP++, "WORK_DISP 終了", 0);
gDPNoOpString(POLY_OPA_DISP++, "POLY_OPA_DISP 終了", 0);
gDPNoOpString(POLY_XLU_DISP++, "POLY_XLU_DISP 終了", 0);
gDPNoOpString(TITLE_CARD_DISP++, "TITLE_CARD_DISP 終了", 0);
gDPNoOpString(OVERLAY_DISP++, "OVERLAY_DISP 終了", 0);
CLOSE_DISPS(gfxCtx, "../graph.c", 996);
@ -298,8 +296,8 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
gSPBranchList(WORK_DISP++, gfxCtx->polyOpaBuffer);
gSPBranchList(POLY_OPA_DISP++, gfxCtx->polyXluBuffer);
gSPBranchList(POLY_XLU_DISP++, gfxCtx->titlecardBuffer);
gSPBranchList(TITLE_CARD_DISP++, gfxCtx->polyKalBuffer);
gSPBranchList(POLY_XLU_DISP++, gfxCtx->worldOverlayBuffer);
gSPBranchList(WORLD_OVERLAY_DISP++, gfxCtx->polyKalBuffer);
gSPBranchList(POLY_KAL_DISP++, gfxCtx->overlayBuffer);
gDPPipeSync(OVERLAY_DISP++);
gDPFullSync(OVERLAY_DISP++);
@ -474,6 +472,7 @@ static void RunFrame()
uint64_t ticksA, ticksB;
ticksA = GetPerfCounter();
Graph_StartFrame();
PadMgr_ThreadEntry(&gPadMgr);

View File

@ -1022,31 +1022,30 @@ void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) {
height = (width * height > 0x1000) ? 0x1000 / width : height;
titleSecondY = titleY + (height * 4);
//TITLE_CARD_DISP Goes over POLY_XLU_DISP but under POLY_KAL_DISP
TITLE_CARD_DISP = func_80093808(TITLE_CARD_DISP);
// WORLD_OVERLAY_DISP Goes over POLY_XLU_DISP but under POLY_KAL_DISP
WORLD_OVERLAY_DISP = func_80093808(WORLD_OVERLAY_DISP);
gDPSetPrimColor(TITLE_CARD_DISP++, 0, 0, (u8)titleCtx->intensity, (u8)titleCtx->intensity, (u8)titleCtx->intensity,
gDPSetPrimColor(WORLD_OVERLAY_DISP++, 0, 0, (u8)titleCtx->intensity, (u8)titleCtx->intensity, (u8)titleCtx->intensity,
(u8)titleCtx->alpha);
gDPLoadTextureBlock(TITLE_CARD_DISP++, (uintptr_t)titleCtx->texture, G_IM_FMT_IA,
gDPLoadTextureBlock(WORLD_OVERLAY_DISP++, (uintptr_t)titleCtx->texture, G_IM_FMT_IA,
G_IM_SIZ_8b,
width, height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSPTextureRectangle(TITLE_CARD_DISP++, titleX, titleY, ((doubleWidth * 2) + titleX) - 4, titleY + (height * 4) - 1,
gSPTextureRectangle(WORLD_OVERLAY_DISP++, titleX, titleY, ((doubleWidth * 2) + titleX) - 4, titleY + (height * 4) - 1,
G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
height = titleCtx->height - height;
// If texture is bigger than 0x1000, display the rest
if (height > 0) {
gDPLoadTextureBlock(TITLE_CARD_DISP++, (uintptr_t)titleCtx->texture + 0x1000,
gDPLoadTextureBlock(WORLD_OVERLAY_DISP++, (uintptr_t)titleCtx->texture + 0x1000,
G_IM_FMT_IA,
G_IM_SIZ_8b, width, height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSPTextureRectangle(TITLE_CARD_DISP++, titleX, titleSecondY, ((doubleWidth * 2) + titleX) - 4,
gSPTextureRectangle(WORLD_OVERLAY_DISP++, titleX, titleSecondY, ((doubleWidth * 2) + titleX) - 4,
titleSecondY + (height * 4) - 1, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
}

View File

@ -33,47 +33,12 @@ s16 sMessageHasSetSfx = false;
u16 sOcarinaSongBitFlags = 0; // ocarina bit flags
MessageTableEntry* sNesMessageEntryTablePtr;
MessageTableEntry* sGerMessageEntryTablePtr;
MessageTableEntry* sFraMessageEntryTablePtr;
MessageTableEntry* sStaffMessageEntryTablePtr;
char* _message_0xFFFC_nes;
//MessageTableEntry sNesMessageEntryTable[] = {
//#define DEFINE_MESSAGE(textId, type, yPos, nesMessage, gerMessage, fraMessage) \
// { textId, (_SHIFTL(type, 4, 8) | _SHIFTL(yPos, 0, 8)), _message_##textId##_nes },
//#define DEFINE_MESSAGE_FFFC
//#include "text/message_data.h"
//#undef DEFINE_MESSAGE_FFFC
//#undef DEFINE_MESSAGE
// { 0xFFFF, 0, NULL },
//};
//
//const char* sGerMessageEntryTable[] = {
//#define DEFINE_MESSAGE(textId, type, yPos, nesMessage, gerMessage, fraMessage) _message_##textId##_ger,
//#include "text/message_data.h"
//#undef DEFINE_MESSAGE
// NULL,
//};
//
//const char* sFraMessageEntryTable[] = {
//#define DEFINE_MESSAGE(textId, type, yPos, nesMessage, gerMessage, fraMessage) _message_##textId##_fra,
//#include "text/message_data.h"
//#undef DEFINE_MESSAGE
// NULL,
//};
//
//MessageTableEntry sStaffMessageEntryTable[] = {
//#define DEFINE_MESSAGE(textId, type, yPos, staffMessage) \
// { textId, (_SHIFTL(type, 4, 8) | _SHIFTL(yPos, 0, 8)), _message_##textId##_staff },
//#include "text/message_data_staff.h"
//#undef DEFINE_MESSAGE
// { 0xFFFF, 0, NULL },
//};
//MessageTableEntry* sNesMessageEntryTablePtr = sNesMessageEntryTable;
//const char** sGerMessageEntryTablePtr = sGerMessageEntryTable;
//const char** sFraMessageEntryTablePtr = sFraMessageEntryTable;
//MessageTableEntry* sStaffMessageEntryTablePtr = sStaffMessageEntryTable;
s16 sTextboxBackgroundForePrimColors[][3] = {
{ 255, 255, 255 }, { 50, 20, 0 }, { 255, 60, 0 }, { 255, 255, 255 },
{ 255, 255, 255 }, { 255, 255, 255 }, { 255, 255, 255 }, { 255, 255, 255 },
@ -235,8 +200,6 @@ void Message_DrawTextChar(GlobalContext* globalCtx, void* textureImage, Gfx** p)
s16 x = msgCtx->textPosX;
s16 y = msgCtx->textPosY;
//gSPInvalidateTexCache(gfx++, 0);
//gSPInvalidateTexCache(gfx++, msgCtx->textboxSegment);
gSPInvalidateTexCache(gfx++, textureImage);
gDPPipeSync(gfx++);
@ -310,69 +273,46 @@ void Message_FindMessage(GlobalContext* globalCtx, u16 textId) {
Font* font;
const char* seg;
if (gSaveContext.language == LANGUAGE_ENG) {
seg = messageTableEntry->segment;
if (gSaveContext.language == LANGUAGE_GER)
messageTableEntry = sGerMessageEntryTablePtr;
else if (gSaveContext.language == LANGUAGE_FRA)
messageTableEntry = sFraMessageEntryTablePtr;
while (messageTableEntry->textId != 0xFFFF) {
font = &globalCtx->msgCtx.font;
// If PAL languages are not present in the OTR file, default to English
if (messageTableEntry == NULL)
messageTableEntry = sNesMessageEntryTablePtr;
if (messageTableEntry->textId == textId) {
foundSeg = messageTableEntry->segment;
font->charTexBuf[0] = messageTableEntry->typePos;
//messageTableEntry++;
nextSeg = messageTableEntry->segment;
font->msgOffset = messageTableEntry->segment;
font->msgLength = messageTableEntry->msgSize;
// "Message found!!!"
osSyncPrintf(" メッセージが,見つかった!!! = %x "
"(data=%x) (data0=%x) (data1=%x) (data2=%x) (data3=%x)\n",
textId, font->msgOffset, font->msgLength, foundSeg, seg, nextSeg);
return;
}
messageTableEntry++;
}
} else {
//languageSegmentTable = (gSaveContext.language == LANGUAGE_GER) ? sGerMessageEntryTablePtr : sFraMessageEntryTablePtr; // OTRTODO
seg = messageTableEntry->segment;
while (messageTableEntry->textId != 0xFFFF) {
font = &globalCtx->msgCtx.font;
if (messageTableEntry->textId == textId) {
foundSeg = *languageSegmentTable;
font->charTexBuf[0] = messageTableEntry->typePos;
languageSegmentTable++;
nextSeg = *languageSegmentTable;
font->msgOffset = foundSeg - seg;
font->msgLength = nextSeg - foundSeg;
// "Message found!!!"
osSyncPrintf(" メッセージが,見つかった!!! = %x "
"(data=%x) (data0=%x) (data1=%x) (data2=%x) (data3=%x)\n",
textId, font->msgOffset, font->msgLength, foundSeg, seg, nextSeg);
return;
}
messageTableEntry++;
languageSegmentTable++;
seg = messageTableEntry->segment;
while (messageTableEntry->textId != 0xFFFF) {
font = &globalCtx->msgCtx.font;
if (messageTableEntry->textId == textId) {
foundSeg = messageTableEntry->segment;
font->charTexBuf[0] = messageTableEntry->typePos;
nextSeg = messageTableEntry->segment;
font->msgOffset = messageTableEntry->segment;
font->msgLength = messageTableEntry->msgSize;
// "Message found!!!"
osSyncPrintf(" メッセージが,見つかった!!! = %x "
"(data=%x) (data0=%x) (data1=%x) (data2=%x) (data3=%x)\n",
textId, font->msgOffset, font->msgLength, foundSeg, seg, nextSeg);
return;
}
messageTableEntry++;
}
// "Message not found!!!"
osSyncPrintf(" メッセージが,見つからなかった!!! = %x\n", textId);
font = &globalCtx->msgCtx.font;
messageTableEntry = sNesMessageEntryTablePtr;
if (gSaveContext.language == LANGUAGE_ENG) {
foundSeg = messageTableEntry->segment;
font->charTexBuf[0] = messageTableEntry->typePos;
messageTableEntry++;
nextSeg = messageTableEntry->segment;
} else {
//languageSegmentTable = (gSaveContext.language == LANGUAGE_GER) ? sGerMessageEntryTablePtr : sFraMessageEntryTablePtr; // OTRTODO
foundSeg = *languageSegmentTable;
font->charTexBuf[0] = messageTableEntry->typePos;
languageSegmentTable++;
nextSeg = *languageSegmentTable;
}
foundSeg = messageTableEntry->segment;
font->charTexBuf[0] = messageTableEntry->typePos;
messageTableEntry++;
nextSeg = messageTableEntry->segment;
font->msgOffset = foundSeg - seg;
font->msgLength = nextSeg - foundSeg;
}
@ -391,7 +331,6 @@ void Message_FindCreditsMessage(GlobalContext* globalCtx, u16 textId) {
if (messageTableEntry->textId == textId) {
foundSeg = messageTableEntry->segment;
font->charTexBuf[0] = messageTableEntry->typePos;
//messageTableEntry++;
nextSeg = messageTableEntry->segment;
font->msgOffset = messageTableEntry->segment;
font->msgLength = messageTableEntry->msgSize;
@ -951,7 +890,7 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) {
}
}
i = j - 1;
msgCtx->textDrawPos = i + CVar_GetS32("gTextSpeed", 1);
msgCtx->textDrawPos = i + 1;
if (character) {}
}
@ -1145,7 +1084,7 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) {
}
}
if (msgCtx->textDelayTimer == 0) {
msgCtx->textDrawPos = i + 1;
msgCtx->textDrawPos = i + CVar_GetS32("gTextSpeed", 1);
msgCtx->textDelayTimer = msgCtx->textDelay;
} else {
msgCtx->textDelayTimer--;
@ -1640,26 +1579,10 @@ void Message_OpenText(GlobalContext* globalCtx, u16 textId) {
//DmaMgr_SendRequest1(font->msgBuf, (uintptr_t)(_staff_message_data_staticSegmentRomStart + 4 + font->msgOffset),
//font->msgLength, "../z_message_PAL.c", 1954);
} else {
if (gSaveContext.language == LANGUAGE_ENG)
{
Message_FindMessage(globalCtx, textId);
msgCtx->msgLength = font->msgLength;
char* src = (uintptr_t)font->msgOffset;
memcpy(font->msgBuf, src, font->msgLength);
} else if (gSaveContext.language == LANGUAGE_GER) {
// OTRTODO
//Message_FindMessage(globalCtx, textId);
//msgCtx->msgLength = font->msgLength;
//DmaMgr_SendRequest1(font->msgBuf, (uintptr_t)(_ger_message_data_staticSegmentRomStart + font->msgOffset),
//font->msgLength, "../z_message_PAL.c", 1978);
} else
{
// OTRTODO
//Message_FindMessage(globalCtx, textId);
//msgCtx->msgLength = font->msgLength;
//DmaMgr_SendRequest1(font->msgBuf, (uintptr_t)(_fra_message_data_staticSegmentRomStart + font->msgOffset),
//font->msgLength, "../z_message_PAL.c", 1990);
}
Message_FindMessage(globalCtx, textId);
msgCtx->msgLength = font->msgLength;
char* src = (uintptr_t)font->msgOffset;
memcpy(font->msgBuf, src, font->msgLength);
}
msgCtx->textBoxProperties = font->charTexBuf[0];

View File

@ -744,24 +744,24 @@ void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable,
gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[eyeIndex]));
#endif
if (tunic == PLAYER_TUNIC_KOKIRI) {
Color_RGB8 sTemp = { CVar_GetS32("gTunic_Kokiri_Red", &sTunicColors[PLAYER_TUNIC_KOKIRI].r),
CVar_GetS32("gTunic_Kokiri_Green", &sTunicColors[PLAYER_TUNIC_KOKIRI].g),
CVar_GetS32("gTunic_Kokiri_Blue", &sTunicColors[PLAYER_TUNIC_KOKIRI].b) };
Color_RGB8 sTemp = { CVar_GetS32("gTunic_Kokiri_Red", sTunicColors[PLAYER_TUNIC_KOKIRI].r),
CVar_GetS32("gTunic_Kokiri_Green", sTunicColors[PLAYER_TUNIC_KOKIRI].g),
CVar_GetS32("gTunic_Kokiri_Blue", sTunicColors[PLAYER_TUNIC_KOKIRI].b) };
color = &sTemp;
} else if (tunic == PLAYER_TUNIC_GORON) {
Color_RGB8 sTemp = { CVar_GetS32("gTunic_Goron_Red", &sTunicColors[PLAYER_TUNIC_GORON].r),
CVar_GetS32("gTunic_Goron_Green", &sTunicColors[PLAYER_TUNIC_GORON].g),
CVar_GetS32("gTunic_Goron_Blue", &sTunicColors[PLAYER_TUNIC_GORON].b) };
Color_RGB8 sTemp = { CVar_GetS32("gTunic_Goron_Red", sTunicColors[PLAYER_TUNIC_GORON].r),
CVar_GetS32("gTunic_Goron_Green", sTunicColors[PLAYER_TUNIC_GORON].g),
CVar_GetS32("gTunic_Goron_Blue", sTunicColors[PLAYER_TUNIC_GORON].b) };
color = &sTemp;
} else if (tunic == PLAYER_TUNIC_ZORA) {
Color_RGB8 sTemp = { CVar_GetS32("gTunic_Zora_Red", &sTunicColors[PLAYER_TUNIC_ZORA].r),
CVar_GetS32("gTunic_Zora_Green", &sTunicColors[PLAYER_TUNIC_ZORA].g),
CVar_GetS32("gTunic_Zora_Blue", &sTunicColors[PLAYER_TUNIC_ZORA].b) };
Color_RGB8 sTemp = { CVar_GetS32("gTunic_Zora_Red", sTunicColors[PLAYER_TUNIC_ZORA].r),
CVar_GetS32("gTunic_Zora_Green", sTunicColors[PLAYER_TUNIC_ZORA].g),
CVar_GetS32("gTunic_Zora_Blue", sTunicColors[PLAYER_TUNIC_ZORA].b) };
color = &sTemp;
} else {
Color_RGB8 sTemp = { CVar_GetS32("gTunic_Kokiri_Red", &sTunicColors[PLAYER_TUNIC_KOKIRI].r),
CVar_GetS32("gTunic_Kokiri_Green", &sTunicColors[PLAYER_TUNIC_KOKIRI].g),
CVar_GetS32("gTunic_Kokiri_Blue", &sTunicColors[PLAYER_TUNIC_KOKIRI].b) };
Color_RGB8 sTemp = { CVar_GetS32("gTunic_Kokiri_Red", sTunicColors[PLAYER_TUNIC_KOKIRI].r),
CVar_GetS32("gTunic_Kokiri_Green", sTunicColors[PLAYER_TUNIC_KOKIRI].g),
CVar_GetS32("gTunic_Kokiri_Blue", sTunicColors[PLAYER_TUNIC_KOKIRI].b) };
color = &sTemp;
}
gDPSetEnvColor(POLY_OPA_DISP++, color->r, color->g, color->b, 0);
@ -1215,7 +1215,7 @@ void Player_DrawHookshotReticle(GlobalContext* globalCtx, Player* this, f32 arg2
if (BgCheck_AnyLineTest3(&globalCtx->colCtx, &sp8C, &sp80, &sp74, &sp9C, 1, 1, 1, 1, &bgId)) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2572);
OVERLAY_DISP = Gfx_CallSetupDL(OVERLAY_DISP, 0x07);
WORLD_OVERLAY_DISP = Gfx_CallSetupDL(WORLD_OVERLAY_DISP, 0x07);
SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &sp74, &sp68, &sp64);
@ -1224,10 +1224,10 @@ void Player_DrawHookshotReticle(GlobalContext* globalCtx, Player* this, f32 arg2
Matrix_Translate(sp74.x, sp74.y, sp74.z, MTXMODE_NEW);
Matrix_Scale(sp60, sp60, sp60, MTXMODE_APPLY);
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2587),
gSPMatrix(WORLD_OVERLAY_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2587),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPSegment(OVERLAY_DISP++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment);
gSPDisplayList(OVERLAY_DISP++, gLinkAdultHookshotReticleDL);
gSPSegment(WORLD_OVERLAY_DISP++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment);
gSPDisplayList(WORLD_OVERLAY_DISP++, gLinkAdultHookshotReticleDL);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2592);
}

View File

@ -166,6 +166,10 @@ void BgSpot06Objects_Init(Actor* thisx, GlobalContext* globalCtx) {
}
} else {
this->lakeHyliaWaterLevel = 0.0f;
WaterBox* water_boxes = globalCtx->colCtx.colHeader->waterBoxes;
water_boxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].ySurface = WATER_LEVEL_RIVER_RAISED;
water_boxes[LHWB_MAIN_1].ySurface = WATER_LEVEL_RAISED;
water_boxes[LHWB_MAIN_2].ySurface = WATER_LEVEL_RAISED;
this->actionFunc = BgSpot06Objects_DoNothing;
}
break;

View File

@ -1619,9 +1619,9 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 180, 210, 255, 255);
}
}
gSPDisplayList(POLY_KAL_DISP++, gLButtonIconDL);
if (CVar_GetS32("gUniformLR", 0) == 0) { //Restore the misplace gDPSetPrimColor
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 180, 210, 255, 255);
}
@ -3990,8 +3990,6 @@ void KaleidoScope_Update(GlobalContext* globalCtx)
R_UPDATE_RATE = 3;
R_PAUSE_MENU_MODE = 0;
ResourceMgr_DirtyDirectory("textures/icon_item_24_static*");
ResourceMgr_DirtyDirectory("textures/icon_item_static*");
CVar_SetS32("gPauseTriforce", 0);
func_800981B8(&globalCtx->objectCtx);