Merge branch 'develop' into hud_color_mod

This commit is contained in:
Baoulettes 2022-04-27 03:52:44 +02:00 committed by GitHub
commit 04b1ea7c0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
49 changed files with 1098 additions and 1835 deletions

22
BUILDING.md Normal file
View File

@ -0,0 +1,22 @@
# Building Ship of Harkinian
1. Install [Python](https://www.python.org/ftp/python/3.10.2/python-3.10.2-amd64.exe)
2. Install [Visual Studio 2022 Community Edition](https://visualstudio.microsoft.com/vs/community/)
2b. In the Visual Studio Installer, install `MSVC v142 - VS 2019 C++`.
4. Clone the Ship of Harkinian repository.
5. Place one or more [compatible](#compatible-roms) roms in the `OTRExporter` directory with namings of your choice.
6. Run `OTRExporter/OTRExporter.sln`.
7. Switch the solution to `Release x64`.
8. Build the solution.
9. Launching `OTRExporter/extract_assets.py` will generate an `oot.otr` archive file in `OTRExporter/oot.otr`.
10. Run `soh/soh.sln`
11. Switch the solution to `Release x86`.
12. Build the solution.
13. Copy the `OTRExporter/oot.otr` archive file to `soh/Release`.
14. Launch `soh.exe`.
## Compatible Roms
```
OOT_PAL_GC checksum 0x09465AC3
OOT_PAL_GC_DBG1 checksum 0x871E1C92 (debug non-master quest)
```

View File

@ -689,7 +689,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
uint32_t fmt = (__ & 0xE0) >> 5;
uint32_t siz = (__ & 0x18) >> 3;
Gfx value = gsDPSetTextureImage(fmt, siz, www - 1, (seg & 0x0FFFFFFF) + 0xF0000000);
Gfx value = gsDPSetTextureImage(fmt, siz, www + 1, (seg & 0x0FFFFFFF) + 0xF0000000);
word0 = value.words.w0;
word1 = value.words.w1;
@ -707,7 +707,7 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina
uint32_t fmt = (__ & 0xE0) >> 5;
uint32_t siz = (__ & 0x18) >> 3;
Gfx value = gsDPSetTextureImage(fmt, siz, www - 1, __);
Gfx value = gsDPSetTextureImage(fmt, siz, www + 1, __);
word0 = value.words.w0 & 0x00FFFFFF;
word0 += (G_SETTIMG_OTR << 24);
//word1 = value.words.w1;

View File

@ -132,13 +132,13 @@ def main():
else:
romToUse = roms[0]
match checkChecksum(romToUse).name:
match checkChecksum(romToUse):
case Checksums.OOT_PAL_GC:
xmlVer = "GC_NMQ_PAL_F"
case Checksums.OOT_PAL_GC_DBG1:
xmlVer = "GC_MQ_D"
case _: # default case
xmlVer = "GC_NMQ_D"
case _: # default case
xmlVer = "GC_MQ_D"
if (os.path.exists("Extract")):
shutil.rmtree("Extract")

View File

@ -51,26 +51,8 @@ Official Discord: https://discord.com/invite/BtBmd55HVH
## Building The Ship of Harkinian
1. Install [Python](https://www.python.org/ftp/python/3.10.2/python-3.10.2-amd64.exe)
2. Install [Visual Studio 2022 Community Edition](https://visualstudio.microsoft.com/vs/community/)
2b. In the Visual Studio Installer, install `MSVC v142 - VS 2019 C++`.
4. Clone the Ship of Harkinian repository.
5. Place one or more [compatible](#compatible-roms) roms in the `OTRExporter` directory with namings of your choice.
6. Run `OTRExporter/OTRExporter.sln`.
7. Switch the solution to `Release x64`.
8. Build the solution.
9. Launching `OTRExporter/extract_assets.py` will generate an `oot.otr` archive file in `OTRExporter/oot.otr`.
10. Run `soh/soh.sln`
11. Switch the solution to `Release x86`.
12. Build the solution.
13. Copy the `OTRExporter/oot.otr` archive file to `soh/Release`.
14. Launch `soh.exe`.
Refer to the [building instructions](https://github.com/HarbourMasters/Shipwright/BUILDING.md) to compile SoH.
## Compatible Roms
```
OOT_PAL_GC checksum 0x09465AC3
OOT_PAL_GC_DBG1 checksum 0x871E1C92 (debug non-master quest)
```
## Troubleshooting The Exporter
- Affirm that you have an `/assets` folder filled with XMLs in the same directory as OTRGui.exe
- Affirm that `zapd.exe` exists in the `/assets/extractor` folder

View File

@ -2,6 +2,7 @@
#include "spdlog/spdlog.h"
#include "GlobalCtx2.h"
#include "Window.h"
#include "GameSettings.h"
namespace Ship {
ConfigFile::ConfigFile(std::shared_ptr<GlobalCtx2> Context, const std::string& Path) : Context(Context), Path(Path), File(Path.c_str()) {
@ -149,6 +150,8 @@ namespace Ship {
(*this)["KEYBOARD CONTROLLER BINDING 4"][STR(BTN_STICKDOWN)] = std::to_string(0x01F);
(*this)["KEYBOARD CONTROLLER BINDING 4"][STR(BTN_STICKUP)] = std::to_string(0x011);
(*this)["ENHANCEMENT SETTINGS"]["TEXT_SPEED"] = "1";
(*this)["SDL CONTROLLER 1"]["GUID"] = "";
(*this)["SDL CONTROLLER 2"]["GUID"] = "";
(*this)["SDL CONTROLLER 3"]["GUID"] = "";

View File

@ -3,6 +3,7 @@
#include <memory>
#include <map>
#include <string>
#include <optional>
#include "stdint.h"
#include "UltraController.h"
#include "ControllerAttachment.h"
@ -19,12 +20,17 @@ namespace Ship {
void Read(OSContPad* pad);
virtual void ReadFromSource() = 0;
virtual void WriteToSource(ControllerCallback* controller) = 0;
virtual bool Connected() const = 0;
virtual bool CanRumble() const = 0;
bool isRumbling;
void SetButtonMapping(const std::string& szButtonName, int32_t dwScancode);
std::shared_ptr<ControllerAttachment> GetAttachment() { return Attachment; }
int32_t GetControllerNumber() { return dwControllerNumber; }
virtual bool HasPadConf() const = 0;
virtual std::optional<std::string> GetPadConfSection() = 0;
protected:
int32_t dwPressedButtons;
std::map<int32_t, int32_t> ButtonMapping;

View File

@ -15,6 +15,8 @@
#include <string>
#include "SohHooks.h"
#include "Window.h"
#define ABS(var) var < 0 ? -(var) : var
using namespace Ship;
@ -27,9 +29,11 @@ namespace Game {
const std::string AudioSection = AUDIO_SECTION;
const std::string ControllerSection = CONTROLLER_SECTION;
const std::string EnhancementSection = ENHANCEMENTS_SECTION;
const std::string CosmeticsSection = COSMETICS_SECTION;
const std::string CheatSection = CHEATS_SECTION;
const std::string HUDColorSection = HUDCOLOR_SECTION;
void UpdateAudio() {
Audio_SetGameVolume(SEQ_BGM_MAIN, Settings.audio.music_main);
Audio_SetGameVolume(SEQ_BGM_SUB, Settings.audio.music_sub);
@ -63,7 +67,7 @@ namespace Game {
CVar_SetS32("gPauseLiveLink", Settings.enhancements.animated_pause_menu);
Settings.enhancements.dynamic_wallet_icon = stob(Conf[EnhancementSection]["dynamic_wallet_icon"]);
CVar_SetS32(const_cast<char*>("gDynamicWalletIcon"), Settings.enhancements.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);
@ -73,7 +77,14 @@ namespace Game {
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);
@ -91,16 +102,91 @@ namespace Game {
CVar_SetFloat("gFanfareVolume", Settings.audio.fanfare);
// Controllers
Settings.controller.gyro_sensitivity = Ship::stof(Conf[ControllerSection]["gyro_sensitivity"]);
CVar_SetFloat("gGyroSensitivity", Settings.controller.gyro_sensitivity);
Settings.controller.rumble_strength = Ship::stof(Conf[ControllerSection]["rumble_strength"]);
CVar_SetFloat("gRumbleStrength", Settings.controller.rumble_strength);
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"]);
@ -152,6 +238,7 @@ namespace Game {
Settings.cheats.freeze_time = stob(Conf[CheatSection]["freeze_time"]);
CVar_SetS32("gFreezeTime", Settings.cheats.freeze_time);
<<<<<<< hud_color_mod
Settings.hudcolors.n64_colors = stob(Conf[HUDColorSection]["n64_colors"]);
CVar_SetS32("gN64Colors", Settings.hudcolors.n64_colors);
@ -237,10 +324,30 @@ namespace Game {
CVar_SetInt("gCCRupeePrimG", Settings.hudcolors.ccrupeeprimg);
Settings.hudcolors.ccrupeeprimb = (Conf[HUDColorSection]["cc_rupeeprimb"] != "") ? Ship::stoi(Conf[HUDColorSection]["cc_rupeeprimb"]) : Settings.hudcolors.ccrupeeprimb;
CVar_SetInt("gCCRupeePrimB", Settings.hudcolors.ccrupeeprimb);
=======
// Per-Controller
LoadPadSettings();
>>>>>>> develop
UpdateAudio();
}
void LoadPadSettings() {
const std::shared_ptr<ConfigFile> pConf = GlobalCtx2::GetInstance()->GetConfig();
ConfigFile& Conf = *pConf;
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);
}
}
}
}
void SaveSettings() {
const std::shared_ptr<ConfigFile> pConf = GlobalCtx2::GetInstance()->GetConfig();
ConfigFile& Conf = *pConf;
@ -265,19 +372,62 @@ namespace Game {
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]["gyro_sensitivity"] = std::to_string(Settings.controller.gyro_sensitivity);
Conf[ControllerSection]["rumble_strength"] = std::to_string(Settings.controller.rumble_strength);
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);
@ -289,6 +439,7 @@ namespace Game {
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);
<<<<<<< hud_color_mod
//HUD Color
Conf[HUDColorSection]["n64_colors"] = std::to_string(Settings.hudcolors.n64_colors);
Conf[HUDColorSection]["gc_colors"] = std::to_string(Settings.hudcolors.gc_colors);
@ -326,6 +477,19 @@ namespace Game {
Conf[HUDColorSection]["cc_rupeeprimr"] = std::to_string(Settings.hudcolors.ccrupeeprimr);
Conf[HUDColorSection]["cc_rupeeprimg"] = std::to_string(Settings.hudcolors.ccrupeeprimg);
Conf[HUDColorSection]["cc_rupeeprimb"] = std::to_string(Settings.hudcolors.ccrupeeprimb);
=======
// 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);
}
}
}
>>>>>>> develop
Conf.Save();
}

View File

@ -26,24 +26,69 @@ struct SoHConfigType {
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 {
float gyro_sensitivity = 1.0f;
float rumble_strength = 1.0f;
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;
float gyroDriftX = 0.0f;
float gyroDriftY = 0.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;
@ -130,6 +175,7 @@ enum SeqPlayers {
#define AUDIO_SECTION "AUDIO SETTINGS"
#define CONTROLLER_SECTION "CONTROLLER SECTION"
#define ENHANCEMENTS_SECTION "ENHANCEMENT SETTINGS"
#define COSMETICS_SECTION "COSMETIC SETTINGS"
#define CHEATS_SECTION "CHEATS SETTINGS"
#define HUDCOLOR_SECTION "HUD COLORS SETTINGS"
@ -137,6 +183,7 @@ namespace Game {
extern SoHConfigType Settings;
void InitSettings();
void LoadSettings();
void LoadPadSettings();
void SaveSettings();
void SetSeqPlayerVolume(SeqPlayers playerId, float volume);
}

View File

@ -53,4 +53,4 @@ namespace Ship {
std::string KeyboardController::GetBindingConfSection() {
return GetControllerType() + " CONTROLLER BINDING " + std::to_string(GetControllerNumber() + 1);
}
}
}

View File

@ -10,11 +10,16 @@ namespace Ship {
void ReadFromSource();
void WriteToSource(ControllerCallback* controller);
bool Connected() const { return true; }
bool CanRumble() const { return false; }
bool PressButton(int32_t dwScancode);
bool ReleaseButton(int32_t dwScancode);
void ReleaseAllButtons();
bool HasPadConf() const { return false; }
std::optional<std::string> GetPadConfSection() { return {}; }
protected:
std::string GetControllerType();
std::string GetConfSection();

View File

@ -170,6 +170,12 @@
#define G_TEXRECT_WIDE 0x37
#define G_FILLWIDERECT 0x38
/* GFX Effects */
// RDP Cmd
#define G_SETGRAYSCALE 0x39
#define G_SETINTENSITY 0x40
/*
* The following commands are the "generated" RDP commands; the user
* never sees them, the RSP microcode generates them.
@ -2821,6 +2827,14 @@ _DW({ \
_g->words.w1 = 0; \
}
#define gsSPGrayscale(pkt, state) \
{ \
Gfx *_g = (Gfx *)(pkt); \
\
_g->words.w0 = _SHIFTL(G_SETGRAYSCALE, 24, 8); \
_g->words.w1 = state; \
}
#ifdef F3DEX_GBI_2
/*
* One gSPGeometryMode(pkt,c,s) GBI is equal to these two GBIs.
@ -3161,6 +3175,8 @@ _DW({ \
(_SHIFTL(r, 24, 8) | _SHIFTL(g, 16, 8) | \
_SHIFTL(b, 8, 8) | _SHIFTL(a, 0, 8)))
#define gsDPSetGrayscaleColor(pkt, r, g, b, lerp) \
DPRGBColor(pkt, G_SETINTENSITY, r, g, b, lerp)
#define gDPSetEnvColor(pkt, r, g, b, a) \
DPRGBColor(pkt, G_SETENVCOLOR, r,g,b,a)
#define gsDPSetEnvColor(r, g, b, a) \
@ -3177,7 +3193,6 @@ _DW({ \
gDPSetColor(pkt, G_SETFILLCOLOR, (d))
#define gsDPSetFillColor(d) \
gsDPSetColor(G_SETFILLCOLOR, (d))
#define gDPSetPrimDepth(pkt, z, dz) \
gDPSetColor(pkt, G_SETPRIMDEPTH, \
_SHIFTL(z, 16, 16) | _SHIFTL(dz, 0, 16))

View File

@ -16,6 +16,7 @@ void gfx_cc_get_features(uint64_t shader_id0, uint32_t shader_id1, struct CCFeat
cc_features->opt_2cyc = (shader_id1 & SHADER_OPT_2CYC) != 0;
cc_features->opt_alpha_threshold = (shader_id1 & SHADER_OPT_ALPHA_THRESHOLD) != 0;
cc_features->opt_invisible = (shader_id1 & SHADER_OPT_INVISIBLE) != 0;
cc_features->opt_grayscale = (shader_id1 & SHADER_OPT_GRAYSCALE) != 0;
cc_features->clamp[0][0] = (shader_id1 & SHADER_OPT_TEXEL0_CLAMP_S);
cc_features->clamp[0][1] = (shader_id1 & SHADER_OPT_TEXEL0_CLAMP_T);

View File

@ -39,10 +39,11 @@ enum {
#define SHADER_OPT_2CYC (1 << 4)
#define SHADER_OPT_ALPHA_THRESHOLD (1 << 5)
#define SHADER_OPT_INVISIBLE (1 << 6)
#define SHADER_OPT_TEXEL0_CLAMP_S (1 << 7)
#define SHADER_OPT_TEXEL0_CLAMP_T (1 << 8)
#define SHADER_OPT_TEXEL1_CLAMP_S (1 << 9)
#define SHADER_OPT_TEXEL1_CLAMP_T (1 << 10)
#define SHADER_OPT_GRAYSCALE (1 << 7)
#define SHADER_OPT_TEXEL0_CLAMP_S (1 << 8)
#define SHADER_OPT_TEXEL0_CLAMP_T (1 << 9)
#define SHADER_OPT_TEXEL1_CLAMP_S (1 << 10)
#define SHADER_OPT_TEXEL1_CLAMP_T (1 << 11)
#define CC_SHADER_OPT_POS 56
struct CCFeatures {
@ -54,6 +55,7 @@ struct CCFeatures {
bool opt_2cyc;
bool opt_alpha_threshold;
bool opt_invisible;
bool opt_grayscale;
bool used_textures[2];
bool clamp[2][2];
int num_inputs;

View File

@ -88,13 +88,13 @@ struct ShaderProgramD3D11 {
static struct {
HMODULE d3d11_module;
PFN_D3D11_CREATE_DEVICE D3D11CreateDevice;
HMODULE d3dcompiler_module;
pD3DCompile D3DCompile;
D3D_FEATURE_LEVEL feature_level;
uint32_t msaa_num_quality_levels[D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT];
ComPtr<ID3D11Device> device;
ComPtr<IDXGISwapChain1> swap_chain;
ComPtr<ID3D11DeviceContext> context;
@ -448,6 +448,9 @@ static struct ShaderProgram *gfx_d3d11_create_and_load_new_shader(uint64_t shade
if (cc_features.opt_fog) {
ied[ied_index++] = { "FOG", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 };
}
if (cc_features.opt_grayscale) {
ied[ied_index++] = { "GRAYSCALE", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 };
}
for (unsigned int i = 0; i < cc_features.num_inputs; i++) {
DXGI_FORMAT format = cc_features.opt_alpha ? DXGI_FORMAT_R32G32B32A32_FLOAT : DXGI_FORMAT_R32G32B32_FLOAT;
ied[ied_index++] = { "INPUT", i, format, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 };

View File

@ -138,6 +138,10 @@ void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_f
append_line(buf, &len, " float4 fog : FOG;");
num_floats += 4;
}
if (cc_features.opt_grayscale) {
append_line(buf, &len, " float4 grayscale : GRAYSCALE;");
num_floats += 4;
}
for (int i = 0; i < cc_features.num_inputs; i++) {
len += sprintf(buf + len, " float%d input%d : INPUT%d;\r\n", cc_features.opt_alpha ? 4 : 3, i + 1, i);
num_floats += cc_features.opt_alpha ? 4 : 3;
@ -208,6 +212,9 @@ void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_f
if (cc_features.opt_fog) {
append_str(buf, &len, ", float4 fog : FOG");
}
if (cc_features.opt_grayscale) {
append_str(buf, &len, ", float4 grayscale : GRAYSCALE");
}
for (int i = 0; i < cc_features.num_inputs; i++) {
len += sprintf(buf + len, ", float%d input%d : INPUT%d", cc_features.opt_alpha ? 4 : 3, i + 1, i);
}
@ -228,6 +235,9 @@ void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_f
if (cc_features.opt_fog) {
append_line(buf, &len, " result.fog = fog;");
}
if (cc_features.opt_grayscale) {
append_line(buf, &len, " result.grayscale = grayscale;");
}
for (int i = 0; i < cc_features.num_inputs; i++) {
len += sprintf(buf + len, " result.input%d = input%d;\r\n", i + 1, i + 1);
}
@ -298,6 +308,12 @@ void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_f
}
}
if (cc_features.opt_grayscale) {
append_line(buf, &len, "float intensity = (texel.r + texel.g + texel.b) / 3.0;");
append_line(buf, &len, "float3 new_texel = input.grayscale.rgb * intensity;");
append_line(buf, &len, "texel.rgb = lerp(texel.rgb, new_texel, input.grayscale.a);");
}
if (cc_features.opt_alpha && cc_features.opt_noise) {
append_line(buf, &len, " float2 coords = screenSpace.xy * noise_scale;");
append_line(buf, &len, " texel.a *= round(saturate(random(float3(floor(coords), noise_frame)) + texel.a - 0.5));");

View File

@ -238,6 +238,13 @@ static struct ShaderProgram* gfx_opengl_create_and_load_new_shader(uint64_t shad
append_line(vs_buf, &vs_len, "varying vec4 vFog;");
num_floats += 4;
}
if (cc_features.opt_grayscale) {
append_line(vs_buf, &vs_len, "attribute vec4 aGrayscaleColor;");
append_line(vs_buf, &vs_len, "varying vec4 vGrayscaleColor;");
num_floats += 4;
}
for (int i = 0; i < cc_features.num_inputs; i++) {
vs_len += sprintf(vs_buf + vs_len, "attribute vec%d aInput%d;\n", cc_features.opt_alpha ? 4 : 3, i + 1);
vs_len += sprintf(vs_buf + vs_len, "varying vec%d vInput%d;\n", cc_features.opt_alpha ? 4 : 3, i + 1);
@ -257,6 +264,9 @@ static struct ShaderProgram* gfx_opengl_create_and_load_new_shader(uint64_t shad
if (cc_features.opt_fog) {
append_line(vs_buf, &vs_len, "vFog = aFog;");
}
if (cc_features.opt_grayscale) {
append_line(vs_buf, &vs_len, "vGrayscaleColor = aGrayscaleColor;");
}
for (int i = 0; i < cc_features.num_inputs; i++) {
vs_len += sprintf(vs_buf + vs_len, "vInput%d = aInput%d;\n", i + 1, i + 1);
}
@ -279,6 +289,9 @@ static struct ShaderProgram* gfx_opengl_create_and_load_new_shader(uint64_t shad
if (cc_features.opt_fog) {
append_line(fs_buf, &fs_len, "varying vec4 vFog;");
}
if (cc_features.opt_grayscale) {
append_line(fs_buf, &fs_len, "varying vec4 vGrayscaleColor;");
}
for (int i = 0; i < cc_features.num_inputs; i++) {
fs_len += sprintf(fs_buf + fs_len, "varying vec%d vInput%d;\n", cc_features.opt_alpha ? 4 : 3, i + 1);
}
@ -355,6 +368,12 @@ static struct ShaderProgram* gfx_opengl_create_and_load_new_shader(uint64_t shad
append_line(fs_buf, &fs_len, "texel.a *= floor(clamp(random(vec3(floor(gl_FragCoord.xy * noise_scale), float(frame_count))) + texel.a, 0.0, 1.0));");
}
if (cc_features.opt_grayscale) {
append_line(fs_buf, &fs_len, "float intensity = (texel.r + texel.g + texel.b) / 3.0;");
append_line(fs_buf, &fs_len, "vec3 new_texel = vGrayscaleColor.rgb * intensity;");
append_line(fs_buf, &fs_len, "texel.rgb = mix(texel.rgb, new_texel, vGrayscaleColor.a);");
}
if (cc_features.opt_alpha) {
if (cc_features.opt_alpha_threshold) {
append_line(fs_buf, &fs_len, "if (texel.a < 8.0 / 256.0) discard;");
@ -446,6 +465,12 @@ static struct ShaderProgram* gfx_opengl_create_and_load_new_shader(uint64_t shad
++cnt;
}
if (cc_features.opt_grayscale) {
prg->attrib_locations[cnt] = glGetAttribLocation(shader_program, "aGrayscaleColor");
prg->attrib_sizes[cnt] = 4;
++cnt;
}
for (int i = 0; i < cc_features.num_inputs; i++) {
char name[16];
sprintf(name, "aInput%d", i + 1);

View File

@ -155,9 +155,10 @@ static struct RDP {
uint32_t other_mode_l, other_mode_h;
uint64_t combine_mode;
bool grayscale;
uint8_t prim_lod_fraction;
struct RGBA env_color, prim_color, fog_color, fill_color;
struct RGBA env_color, prim_color, fog_color, fill_color, grayscale_color;
struct XYWidthHeight viewport, scissor;
bool viewport_or_scissor_changed;
void *z_buf_address;
@ -825,22 +826,6 @@ static void import_texture(int i, int tile) {
uint8_t siz = rdp.texture_tile[tile].siz;
uint32_t tmem_index = rdp.texture_tile[tile].tmem_index;
// OTRTODO: Move it to a function to be faster
// ModInternal::bindHook(LOOKUP_TEXTURE);
// ModInternal::initBindHook(8,
// HOOK_PARAMETER("gfx_api", gfx_get_current_rendering_api()),
// HOOK_PARAMETER("path", rdp.loaded_texture[tmem_index].otr_path),
// HOOK_PARAMETER("node", &rendering_state.textures[i]),
// HOOK_PARAMETER("fmt", &fmt),
// HOOK_PARAMETER("siz", &siz),
// HOOK_PARAMETER("tile", &i),
// HOOK_PARAMETER("palette", &rdp.texture_tile[tile].palette),
// HOOK_PARAMETER("addr", const_cast<uint8_t*>(rdp.loaded_texture[tmem_index].addr))
// );
//
// if (ModInternal::callBindHook(0))
// return;
if (gfx_texture_cache_lookup(i, tile))
{
return;
@ -1220,7 +1205,6 @@ static void gfx_sp_tri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t vtx3_idx, bo
uint64_t cc_id = rdp.combine_mode;
//bool use_alpha = (rdp.other_mode_l & (3 << 18)) == G_BL_1MA || (rdp.other_mode_l & (3 << 16)) == G_BL_1MA;
bool use_alpha = (rdp.other_mode_l & (3 << 20)) == (G_BL_CLR_MEM << 20) && (rdp.other_mode_l & (3 << 16)) == (G_BL_1MA << 16);
bool use_fog = (rdp.other_mode_l >> 30) == G_BL_CLR_FOG;
bool texture_edge = (rdp.other_mode_l & CVG_X_ALPHA) == CVG_X_ALPHA;
@ -1228,6 +1212,7 @@ static void gfx_sp_tri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t vtx3_idx, bo
bool use_2cyc = (rdp.other_mode_h & (3U << G_MDSFT_CYCLETYPE)) == G_CYC_2CYCLE;
bool alpha_threshold = (rdp.other_mode_l & (3U << G_MDSFT_ALPHACOMPARE)) == G_AC_THRESHOLD;
bool invisible = (rdp.other_mode_l & (3 << 24)) == (G_BL_0 << 24) && (rdp.other_mode_l & (3 << 20)) == (G_BL_CLR_MEM << 20);
bool use_grayscale = rdp.grayscale;
if (texture_edge) {
use_alpha = true;
@ -1240,12 +1225,13 @@ static void gfx_sp_tri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t vtx3_idx, bo
if (use_2cyc) cc_id |= (uint64_t)SHADER_OPT_2CYC << CC_SHADER_OPT_POS;
if (alpha_threshold) cc_id |= (uint64_t)SHADER_OPT_ALPHA_THRESHOLD << CC_SHADER_OPT_POS;
if (invisible) cc_id |= (uint64_t)SHADER_OPT_INVISIBLE << CC_SHADER_OPT_POS;
if (use_grayscale) cc_id |= (uint64_t)SHADER_OPT_GRAYSCALE << CC_SHADER_OPT_POS;
if (!use_alpha) {
cc_id &= ~((0xfff << 16) | ((uint64_t)0xfff << 44));
}
struct ColorCombiner* comb = gfx_lookup_or_create_color_combiner(cc_id);
ColorCombiner* comb = gfx_lookup_or_create_color_combiner(cc_id);
uint32_t tm = 0;
uint32_t tex_width[2], tex_height[2], tex_width2[2], tex_height2[2];
@ -1407,6 +1393,13 @@ static void gfx_sp_tri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t vtx3_idx, bo
buf_vbo[buf_vbo_len++] = v_arr[i]->color.a / 255.0f; // fog factor (not alpha)
}
if (use_grayscale) {
buf_vbo[buf_vbo_len++] = rdp.grayscale_color.r / 255.0f;
buf_vbo[buf_vbo_len++] = rdp.grayscale_color.g / 255.0f;
buf_vbo[buf_vbo_len++] = rdp.grayscale_color.b / 255.0f;
buf_vbo[buf_vbo_len++] = rdp.grayscale_color.a / 255.0f; // lerp interpolation factor (not alpha)
}
for (int j = 0; j < num_inputs; j++) {
struct RGBA* color = 0;
struct RGBA tmp;
@ -1807,6 +1800,13 @@ static inline uint32_t alpha_comb(uint32_t a, uint32_t b, uint32_t c, uint32_t d
return (a & 7) | ((b & 7) << 3) | ((c & 7) << 6) | ((d & 7) << 9);
}
static void gfx_dp_set_grayscale_color(uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
rdp.grayscale_color.r = r;
rdp.grayscale_color.g = g;
rdp.grayscale_color.b = b;
rdp.grayscale_color.a = a;
}
static void gfx_dp_set_env_color(uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
rdp.env_color.r = r;
rdp.env_color.g = g;
@ -2411,8 +2411,6 @@ static void gfx_run_dl(Gfx* cmd) {
cmd++;
uint64_t hash = ((uint64_t)cmd->words.w0 << 32) + (uint64_t)cmd->words.w1;
ResourceMgr_GetNameByCRC(hash, fileName);
#if _DEBUG && 0
char* tex = ResourceMgr_LoadTexByCRC(hash);
ResourceMgr_GetNameByCRC(hash, fileName);
@ -2453,8 +2451,8 @@ static void gfx_run_dl(Gfx* cmd) {
gfx_dp_set_texture_image(fmt, size, width, tex, fileName);
cmd++;
}
break;
}
case G_SETFB:
{
gfx_flush();
@ -2462,8 +2460,8 @@ static void gfx_run_dl(Gfx* cmd) {
active_fb = framebuffers.find(cmd->words.w1);
gfx_rapi->start_draw_to_framebuffer(active_fb->first, (float)active_fb->second.applied_height / active_fb->second.orig_height);
gfx_rapi->clear_framebuffer();
}
break;
}
case G_RESETFB:
{
gfx_flush();
@ -2471,7 +2469,6 @@ static void gfx_run_dl(Gfx* cmd) {
gfx_rapi->start_draw_to_framebuffer(game_renders_to_framebuffer ? game_framebuffer : 0, (float)gfx_current_dimensions.height / SCREEN_HEIGHT);
break;
}
break;
case G_SETTIMG_FB:
{
gfx_flush();
@ -2481,8 +2478,13 @@ static void gfx_run_dl(Gfx* cmd) {
//if (texPtr != NULL)
//gfx_dp_set_texture_image(C0(21, 3), C0(19, 2), C0(0, 10), texPtr);
break;
}
case G_SETGRAYSCALE:
{
rdp.grayscale = cmd->words.w1;
break;
}
break;
case G_LOADBLOCK:
gfx_dp_load_block(C1(24, 3), C0(12, 12), C0(0, 12), C1(12, 12), C1(0, 12));
break;
@ -2510,6 +2512,9 @@ static void gfx_run_dl(Gfx* cmd) {
case G_SETFILLCOLOR:
gfx_dp_set_fill_color(cmd->words.w1);
break;
case G_SETINTENSITY:
gfx_dp_set_grayscale_color(C1(24, 8), C1(16, 8), C1(8, 8), C1(0, 8));
break;
case G_SETCOMBINE:
gfx_dp_set_combine_mode(
color_comb(C0(20, 4), C1(28, 4), C0(15, 5), C1(15, 3)),

View File

@ -74,15 +74,21 @@ namespace Ship {
Cont = NewCont;
std::string BindingConfSection = GetBindingConfSection();
std::shared_ptr<ConfigFile> pBindingConf = GlobalCtx2::GetInstance()->GetConfig();
ConfigFile& BindingConf = *pBindingConf.get();
std::string PadConfSection = *GetPadConfSection();
std::shared_ptr<ConfigFile> config = GlobalCtx2::GetInstance()->GetConfig();
if (!BindingConf.has(BindingConfSection)) {
if (!config->has(BindingConfSection)) {
CreateDefaultBinding();
}
if (!config->has(PadConfSection)) {
CreateDefaultPadConf();
}
LoadBinding();
LoadAxisThresholds();
// Update per-controller settings in ImGui menu after opening controller.
Game::LoadPadSettings();
break;
}
@ -93,6 +99,9 @@ namespace Ship {
}
bool SDLController::Close() {
if (SDL_GameControllerHasRumble(Cont)) {
SDL_GameControllerRumble(Cont, 0, 0, 0);
}
if (Cont != nullptr) {
SDL_GameControllerClose(Cont);
}
@ -178,37 +187,41 @@ 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);
const float gyroSensitivity = Game::Settings.controller.gyro_sensitivity;
if (Game::Settings.controller.gyroDriftX == 0) {
Game::Settings.controller.gyroDriftX = gyroData[0];
if (gyro_drift_x == 0) {
gyro_drift_x = gyroData[0];
}
if (Game::Settings.controller.gyroDriftY == 0) {
if (gyro_drift_y == 0) {
if (isSpecialController == 1) {
Game::Settings.controller.gyroDriftY = gyroData[2];
gyro_drift_y = gyroData[2];
}
else {
Game::Settings.controller.gyroDriftY = gyroData[1];
gyro_drift_y = gyroData[1];
}
}
if (isSpecialController == 1) {
wGyroX = gyroData[0] - Game::Settings.controller.gyroDriftX;
wGyroY = -gyroData[2] - Game::Settings.controller.gyroDriftY;
wGyroX = gyroData[0] - gyro_drift_x;
wGyroY = -gyroData[2] - gyro_drift_y;
}
else {
wGyroX = gyroData[0] - Game::Settings.controller.gyroDriftX;
wGyroY = gyroData[1] - Game::Settings.controller.gyroDriftY;
wGyroX = gyroData[0] - gyro_drift_x;
wGyroY = gyroData[1] - gyro_drift_y;
}
wGyroX *= gyroSensitivity;
wGyroY *= gyroSensitivity;
wGyroX *= gyro_sensitivity;
wGyroY *= gyro_sensitivity;
}
for (int32_t i = SDL_CONTROLLER_BUTTON_A; i < SDL_CONTROLLER_BUTTON_MAX; i++) {
@ -331,7 +344,10 @@ namespace Ship {
{
if (SDL_GameControllerHasRumble(Cont)) {
if (controller->rumble > 0) {
SDL_GameControllerRumble(Cont, 0xFFFF * Game::Settings.controller.rumble_strength, 0xFFFF * Game::Settings.controller.rumble_strength, 1);
float rumble_strength = Game::Settings.controller.extra[GetControllerNumber()].rumble_strength;
SDL_GameControllerRumble(Cont, 0xFFFF * rumble_strength, 0xFFFF * rumble_strength, 0);
} else {
SDL_GameControllerRumble(Cont, 0, 0, 0);
}
}
@ -391,6 +407,19 @@ namespace Ship {
Conf.Save();
}
void SDLController::CreateDefaultPadConf() {
std::string ConfSection = *GetPadConfSection();
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();
}
void SDLController::SetButtonMapping(const std::string& szButtonName, int32_t dwScancode) {
if (guid.compare(INVALID_SDL_CONTROLLER_GUID)) {
return;
@ -410,4 +439,8 @@ namespace Ship {
std::string SDLController::GetBindingConfSection() {
return GetControllerType() + " CONTROLLER BINDING " + guid;
}
std::optional<std::string> SDLController::GetPadConfSection() {
return GetControllerType() + " CONTROLLER PAD " + guid;
}
}

View File

@ -12,15 +12,21 @@ namespace Ship {
void ReadFromSource();
void WriteToSource(ControllerCallback* controller);
bool Connected() const { return Cont != nullptr; }
bool CanRumble() const { return SDL_GameControllerHasRumble(Cont); }
std::string GetGuid() { return guid; };
bool HasPadConf() const { return true; }
std::optional<std::string> GetPadConfSection();
protected:
std::string GetControllerType();
void SetButtonMapping(const std::string& szButtonName, int32_t dwScancode);
std::string GetConfSection();
std::string GetBindingConfSection();
void CreateDefaultBinding();
void CreateDefaultPadConf();
static bool IsGuidInUse(const std::string& guid);
private:

View File

@ -3,6 +3,9 @@
#include <iostream>
#include <map>
#include <utility>
#include <string>
#include <algorithm>
#include <vector>
#include "Archive.h"
#include "Environment.h"
@ -53,6 +56,21 @@ namespace SohImGui {
Console* console = new Console;
bool p_open = false;
bool needs_save = false;
float kokiri_col[3] = { 0.118f, 0.41f, 0.106f };
float goron_col[3] = { 0.392f, 0.078f, 0.0f };
float zora_col[3] = { 0.0f, 0.235f, 0.392f };
float navi_idle_i_col[3] = { 0.0f, 0.0f, 0.0f };
float navi_idle_o_col[3] = { 0.0f, 0.0f, 0.0f };
float navi_npc_i_col[3] = { 0.0f, 0.0f, 0.0f };
float navi_npc_o_col[3] = { 0.0f, 0.0f, 0.0f };
float navi_enemy_i_col[3] = { 0.0f, 0.0f, 0.0f };
float navi_enemy_o_col[3] = { 0.0f, 0.0f, 0.0f };
float navi_prop_i_col[3] = { 0.0f, 0.0f, 0.0f };
float navi_prop_o_col[3] = { 0.0f, 0.0f, 0.0f };
std::map<std::string, std::vector<std::string>> windowCategories;
std::map<std::string, CustomWindow> customWindows;
@ -79,6 +97,49 @@ 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);
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);
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_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_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_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_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_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_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);
}
void ImGuiBackendInit() {
@ -358,20 +419,41 @@ namespace SohImGui {
}
if (ImGui::BeginMenu("Controller")) {
ImGui::Text("Gyro Sensitivity: %d %%", static_cast<int>(100 * Game::Settings.controller.gyro_sensitivity));
if (ImGui::SliderFloat("##GYROSCOPE", &Game::Settings.controller.gyro_sensitivity, 0.0f, 1.0f, "")) {
needs_save = true;
}
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();
if (ImGui::Button("Recalibrate Gyro")) {
Game::Settings.controller.gyroDriftX = 0;
Game::Settings.controller.gyroDriftY = 0;
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;
}
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();
}
}
ImGui::Separator();
ImGui::Text("Rumble Strength: %d %%", static_cast<int>(100 * Game::Settings.controller.rumble_strength));
if (ImGui::SliderFloat("##RUMBLE", &Game::Settings.controller.rumble_strength, 0.0f, 1.0f, "")) {
if (ImGui::Checkbox("Rumble Enabled", &Game::Settings.controller.rumble_enabled)) {
CVar_SetS32("gRumbleEnabled", Game::Settings.controller.rumble_enabled);
needs_save = true;
}
@ -409,8 +491,8 @@ namespace SohImGui {
ImGui::Text("Gameplay");
ImGui::Separator();
ImGui::Text("Text Speed", Game::Settings.enhancements.text_speed);
if (ImGui::SliderInt("##TEXTSPEED", &Game::Settings.enhancements.text_speed, 1, 5)) {
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;
}
@ -429,6 +511,16 @@ namespace SohImGui {
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;
}
ImGui::Text("Graphics");
ImGui::Separator();
@ -445,8 +537,14 @@ namespace SohImGui {
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(const_cast<char*>("gDynamicWalletIcon"), Game::Settings.enhancements.dynamic_wallet_icon);
CVar_SetS32("gDynamicWalletIcon", Game::Settings.enhancements.dynamic_wallet_icon);
needs_save = true;
}
@ -713,8 +811,7 @@ namespace SohImGui {
CVar_SetS32("gInfiniteNayru", Game::Settings.cheats.infinite_nayru);
needs_save = true;
}
ImGui::EndMenu();
ImGui::EndMenu();
}
if (ImGui::Checkbox("No Clip", &Game::Settings.cheats.no_clip)) {
@ -736,7 +833,127 @@ namespace SohImGui {
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;
}
ImGui::EndMenu();
}
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;

View File

@ -1,8 +0,0 @@
const char gBuildVersion[] = "DECKARD ALFA (1.0.0)";
const char gBuildTeam[] = "github.com/harbourmasters";
#ifdef __TIMESTAMP__
const char gBuildDate[] = __TIMESTAMP__;
#else
const char gBuildDate[] = __DATE__ " " __TIME__;
#endif
const char gBuildMakeOption[] = "";

File diff suppressed because it is too large Load Diff

View File

@ -129,6 +129,7 @@ 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

View File

@ -99,6 +99,7 @@ extern "C"
extern u32 gGsFlagsMasks[4];
extern u32 gGsFlagsShifts[4];
extern void* gItemIcons[0x82];
extern u8 gItemAgeReqs[];
extern u8 gItemSlots[56];
extern void (*gSceneCmdHandlers[26])(GlobalContext*, SceneCmd*);
extern s16 gLinkObjectIds[2];

View File

@ -83,6 +83,7 @@ typedef struct {
/* 0x00000 */ u16 headMagic; // GFXPOOL_HEAD_MAGIC
/* 0x00008 */ Gfx polyOpaBuffer[0x2FC0];
/* 0x0BF08 */ Gfx polyXluBuffer[0x1000];
/* 0xXXXXX */ Gfx titlecardBuffer[0x1000];
/* 0x0BF08 */ Gfx polyKalBuffer[0x1000];
/* 0x0FF08 */ Gfx overlayBuffer[0x800];
/* 0x11F08 */ Gfx workBuffer[0x100];
@ -130,6 +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* 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"
@ -149,6 +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 polyKal; // When in Rome...
/* 0x02D8 */ u32 gfxPoolIdx;
/* 0x02DC */ u16* curFrameBuffer;

View File

@ -112,9 +112,6 @@
<GenerateMapFile>true</GenerateMapFile>
<MapExports>true</MapExports>
</Link>
<PreBuildEvent>
<Command>copy /b $(ProjectDir)src\boot\build.c +,,</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
@ -1407,4 +1404,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -25,6 +25,9 @@ void BootCommands_Init()
CVar_RegisterS32("gDebugEnabled", 0);
CVar_RegisterS32("gPauseLiveLink", 0);
CVar_RegisterS32("gMinimalUI", 0);
CVar_RegisterS32("gRumbleEnabled", 0);
CVar_RegisterS32("gUniformLR", 1);
CVar_RegisterS32("gNewDrops", 0);
CVar_RegisterS32("gVisualAgony", 0);
CVar_RegisterS32("gN64Colors", 1);
CVar_RegisterS32("gGameCubeColors", 0);

View File

@ -337,11 +337,11 @@ static bool SetCVarHandler(const std::vector<std::string>& args) {
int vType = CheckVarType(args[2]);
if (vType == VARTYPE_STRING)
CVar_SetString((char*)args[1].c_str(), (char*)args[2].c_str());
CVar_SetString(args[1].c_str(), (char*)args[2].c_str());
else if (vType == VARTYPE_FLOAT)
CVar_SetFloat((char*)args[1].c_str(), std::stof(args[2]));
CVar_SetFloat(args[1].c_str(), std::stof(args[2]));
else
CVar_SetS32((char*)args[1].c_str(), std::stoi(args[2]));
CVar_SetS32(args[1].c_str(), std::stoi(args[2]));
DebugConsole_SaveCVars();
@ -354,7 +354,7 @@ static bool GetCVarHandler(const std::vector<std::string>& args) {
if (args.size() < 2)
return CMD_FAILED;
CVar* cvar = CVar_GetVar((char*) args[1].c_str());
CVar* cvar = CVar_GetVar(args[1].c_str());
if (cvar != nullptr)
{
@ -446,4 +446,4 @@ void DebugConsole_SaveCVars()
}
File::WriteAllText("cvars.cfg", output);
}
}

View File

@ -3,6 +3,7 @@
#include <locale>
#include <codecvt>
#include "GlobalCtx2.h"
#include "GameSettings.h"
#include "ResourceMgr.h"
#include "DisplayList.h"
#include "PlayerAnimation.h"
@ -885,3 +886,13 @@ extern "C" void AudioPlayer_Play(const uint8_t* buf, uint32_t len) {
OTRGlobals::Instance->context->GetWindow()->GetAudioPlayer()->Play(buf, 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) {
return 1;
}
}
return 0;
}

View File

@ -64,4 +64,5 @@ int AudioPlayer_Buffered(void);
int AudioPlayer_GetDesiredBuffered(void);
void AudioPlayer_Play(const uint8_t* buf, uint32_t len);
void AudioMgr_CreateNextAudioBuffer(s16* samples, u32 num_samples);
int Controller_ShouldRumble(size_t i);
#endif

View File

@ -102,7 +102,7 @@ void osCreateViManager(OSPri pri)
s32 osMotorInit(OSMesgQueue* ctrlrqueue, OSPfs* pfs, s32 channel)
{
return 0;
}
u32 osAiGetLength(void)
@ -2099,4 +2099,4 @@ u8 gSequenceFontTable[0x1C0] = {
0x01, 0x12, 0x01, 0x24, 0x01, 0x18, 0x01, 0x19, 0x01, 0x13, 0x01, 0x20, 0x01, 0x1B, 0x01, 0x1C, 0x01, 0x1D, 0x01,
0x03, 0x01, 0x1F, 0x01, 0x20, 0x01, 0x20, 0x01, 0x09, 0x01, 0x21, 0x01, 0x22, 0x01, 0x21, 0x01, 0x09, 0x01, 0x20,
0x01, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
};

View File

@ -1,8 +1,4 @@
const char gBuildVersion[] = "DECKARD ALFA (1.0.0)";
const char gBuildTeam[] = "github.com/harbourmasters";
#ifdef __TIMESTAMP__
const char gBuildDate[] = __TIMESTAMP__;
#else
const char gBuildDate[] = __DATE__ " " __TIME__;
#endif
const char gBuildMakeOption[] = "";

View File

@ -95,12 +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->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->polyKalBuffer = pool->polyKalBuffer;
gfxCtx->overlayBuffer = pool->overlayBuffer;
gfxCtx->workBuffer = pool->workBuffer;
@ -274,6 +276,7 @@ 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);
@ -286,6 +289,7 @@ 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);
@ -294,7 +298,8 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
gSPBranchList(WORK_DISP++, gfxCtx->polyOpaBuffer);
gSPBranchList(POLY_OPA_DISP++, gfxCtx->polyXluBuffer);
gSPBranchList(POLY_XLU_DISP++, gfxCtx->polyKalBuffer);
gSPBranchList(POLY_XLU_DISP++, gfxCtx->titlecardBuffer);
gSPBranchList(TITLE_CARD_DISP++, gfxCtx->polyKalBuffer);
gSPBranchList(POLY_KAL_DISP++, gfxCtx->overlayBuffer);
gDPPipeSync(OVERLAY_DISP++);
gDPFullSync(OVERLAY_DISP++);

View File

@ -269,7 +269,7 @@ void PadMgr_ProcessInputs(PadMgr* padMgr) {
input->press.stick_y += (s8)(input->cur.stick_y - input->prev.stick_y);
}
controllerCallback.rumble = padMgr->rumbleEnable[0] > 0 ? 1 : 0;
controllerCallback.rumble = CVar_GetS32("gRumbleEnabled", 0) && (padMgr->rumbleEnable[0] > 0);
if (HealthMeter_IsCritical()) {
controllerCallback.ledColor = 0;
@ -303,6 +303,11 @@ void PadMgr_HandleRetraceMsg(PadMgr* padMgr) {
}
osRecvMesg(queue, NULL, OS_MESG_BLOCK);
osContGetReadData(padMgr->pads);
for (i = 0; i < __osMaxControllers; i++) {
padMgr->padStatus[i].status = CVar_GetS32("gRumbleEnabled", 0) && Controller_ShouldRumble(i);
}
if (padMgr->preNMIShutdown) {
memset(padMgr->pads, 0, sizeof(padMgr->pads));
}

View File

@ -334,6 +334,38 @@ void func_8002BE98(TargetContext* targetCtx, s32 actorCategory, GlobalContext* g
void func_8002BF60(TargetContext* targetCtx, Actor* actor, s32 actorCategory, GlobalContext* globalCtx) {
NaviColor* naviColor = &sNaviColorList[actorCategory];
if (actorCategory == ACTORCAT_PLAYER) {
naviColor->inner.r = CVar_GetS32("gNavi_Idle_Inner_Red", naviColor->inner.r);
naviColor->inner.g = CVar_GetS32("gNavi_Idle_Inner_Green", naviColor->inner.g);
naviColor->inner.b = CVar_GetS32("gNavi_Idle_Inner_Blue", naviColor->inner.b);
naviColor->outer.r = CVar_GetS32("gNavi_Idle_Outer_Red", naviColor->outer.r);
naviColor->outer.g = CVar_GetS32("gNavi_Idle_Outer_Green", naviColor->outer.g);
naviColor->outer.b = CVar_GetS32("gNavi_Idle_Outer_Blue", naviColor->outer.b);
}
if (actorCategory == ACTORCAT_NPC) {
naviColor->inner.r = CVar_GetS32("gNavi_NPC_Inner_Red", naviColor->inner.r);
naviColor->inner.g = CVar_GetS32("gNavi_NPC_Inner_Green", naviColor->inner.g);
naviColor->inner.b = CVar_GetS32("gNavi_NPC_Inner_Blue", naviColor->inner.b);
naviColor->outer.r = CVar_GetS32("gNavi_NPC_Outer_Red", naviColor->outer.r);
naviColor->outer.g = CVar_GetS32("gNavi_NPC_Outer_Green", naviColor->outer.g);
naviColor->outer.b = CVar_GetS32("gNavi_NPC_Outer_Blue", naviColor->outer.b);
}
if (actorCategory == ACTORCAT_BOSS || actorCategory == ACTORCAT_ENEMY) {
naviColor->inner.r = CVar_GetS32("gNavi_Enemy_Inner_Red", naviColor->inner.r);
naviColor->inner.g = CVar_GetS32("gNavi_Enemy_Inner_Green", naviColor->inner.g);
naviColor->inner.b = CVar_GetS32("gNavi_Enemy_Inner_Blue", naviColor->inner.b);
naviColor->outer.r = CVar_GetS32("gNavi_Enemy_Outer_Red", naviColor->outer.r);
naviColor->outer.g = CVar_GetS32("gNavi_Enemy_Outer_Green", naviColor->outer.g);
naviColor->outer.b = CVar_GetS32("gNavi_Enemy_Outer_Blue", naviColor->outer.b);
}
if (actorCategory == ACTORCAT_PROP) {
naviColor->inner.r = CVar_GetS32("gNavi_Prop_Inner_Red", naviColor->inner.r);
naviColor->inner.g = CVar_GetS32("gNavi_Prop_Inner_Green", naviColor->inner.g);
naviColor->inner.b = CVar_GetS32("gNavi_Prop_Inner_Blue", naviColor->inner.b);
naviColor->outer.r = CVar_GetS32("gNavi_Prop_Outer_Red", naviColor->outer.r);
naviColor->outer.g = CVar_GetS32("gNavi_Prop_Outer_Green", naviColor->outer.g);
naviColor->outer.b = CVar_GetS32("gNavi_Prop_Outer_Blue", naviColor->outer.b);
}
targetCtx->naviRefPos.x = actor->focus.pos.x;
targetCtx->naviRefPos.y = actor->focus.pos.y + (actor->targetArrowOffset * actor->scale.y);
targetCtx->naviRefPos.z = actor->focus.pos.z;
@ -977,7 +1009,6 @@ void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) {
s32 doubleWidth;
s32 titleY;
s32 titleSecondY;
s32 textureLanguageOffset;
if (titleCtx->alpha != 0) {
width = titleCtx->width;
@ -988,33 +1019,34 @@ void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 2824);
textureLanguageOffset = width * height * gSaveContext.language;
height = (width * height > 0x1000) ? 0x1000 / width : height;
titleSecondY = titleY + (height * 4);
OVERLAY_DISP = func_80093808(OVERLAY_DISP);
//TITLE_CARD_DISP Goes over POLY_XLU_DISP but under POLY_KAL_DISP
TITLE_CARD_DISP = func_80093808(TITLE_CARD_DISP);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, (u8)titleCtx->intensity, (u8)titleCtx->intensity, (u8)titleCtx->intensity,
gDPSetPrimColor(TITLE_CARD_DISP++, 0, 0, (u8)titleCtx->intensity, (u8)titleCtx->intensity, (u8)titleCtx->intensity,
(u8)titleCtx->alpha);
gDPLoadTextureBlock(OVERLAY_DISP++, (uintptr_t)titleCtx->texture + textureLanguageOffset, G_IM_FMT_IA,
gDPLoadTextureBlock(TITLE_CARD_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(OVERLAY_DISP++, titleX, titleY, ((doubleWidth * 2) + titleX) - 4, titleY + (height * 4) - 1,
gSPTextureRectangle(TITLE_CARD_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(OVERLAY_DISP++, (uintptr_t)titleCtx->texture + textureLanguageOffset + 0x1000,
gDPLoadTextureBlock(TITLE_CARD_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(OVERLAY_DISP++, titleX, titleSecondY, ((doubleWidth * 2) + titleX) - 4,
gSPTextureRectangle(TITLE_CARD_DISP++, titleX, titleSecondY, ((doubleWidth * 2) + titleX) - 4,
titleSecondY + (height * 4) - 1, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
}

View File

@ -56,7 +56,8 @@ void func_801109B0(GlobalContext* globalCtx) {
doActionOffset = 0x5700;
}
memcpy(interfaceCtx->doActionSegment, ResourceMgr_LoadTexByName(gAttackDoActionENGTex), 0x300);
memcpy(interfaceCtx->doActionSegment, ResourceMgr_LoadTexByName(gAttackDoActionENGTex), 0x180);
memcpy(interfaceCtx->doActionSegment + 0x180, ResourceMgr_LoadTexByName(gCheckDoActionENGTex), 0x180);
//DmaMgr_SendRequest1(interfaceCtx->doActionSegment, (uintptr_t)_do_action_staticSegmentRomStart + doActionOffset, 0x300,
//"../z_construct.c", 174);

View File

@ -5,6 +5,9 @@
#define FLAGS 0
//Used to force variable to be used in different function, feel free to correct me if you have a better way
static s16 DroppedItemRot = 0;
void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx);
void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx);
@ -355,11 +358,34 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
switch (this->actor.params) {
case ITEM00_RUPEE_GREEN:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.3f);
this->scale = 0.3f;
yOffset = 50.0f;
shadowScale = 0.3f;
this->actor.world.rot.x = 0x4000;
break;
}
case ITEM00_RUPEE_BLUE:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.3f);
this->scale = 0.3f;
yOffset = 50.0f;
shadowScale = 0.3f;
this->actor.world.rot.x = 0x4000;
}
case ITEM00_RUPEE_RED:
Actor_SetScale(&this->actor, 0.015f);
this->scale = 0.015f;
yOffset = 750.0f;
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.3f);
this->scale = 0.3f;
yOffset = 50.0f;
shadowScale = 0.3f;
this->actor.world.rot.x = 0x4000;
} else {
Actor_SetScale(&this->actor, 0.015f);
this->scale = 0.015f;
yOffset = 750.0f;
}
break;
case ITEM00_SMALL_KEY:
this->unk_158 = 0;
@ -374,10 +400,18 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
this->scale = 0.02f;
break;
case ITEM00_HEART:
this->actor.home.rot.z = Rand_CenteredFloat(65535.0f);
yOffset = 430.0f;
Actor_SetScale(&this->actor, 0.02f);
this->scale = 0.02f;
if (CVar_GetS32("gNewDrops", 0) !=0) {
this->actor.home.rot.z = Rand_CenteredFloat(65535.0f);
yOffset = 25.0f;
Actor_SetScale(&this->actor, 0.3f);
this->scale = 0.3f;
shadowScale = 0.5f;
} else {
this->actor.home.rot.z = Rand_CenteredFloat(65535.0f);
yOffset = 430.0f;
Actor_SetScale(&this->actor, 0.02f);
this->scale = 0.02f;
}
break;
case ITEM00_HEART_CONTAINER:
yOffset = 430.0f;
@ -386,42 +420,154 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
this->scale = 0.02f;
break;
case ITEM00_ARROWS_SINGLE:
yOffset = 400.0f;
Actor_SetScale(&this->actor, 0.02f);
this->scale = 0.02f;
break;
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
} else {
yOffset = 400.0f;
Actor_SetScale(&this->actor, 0.02f);
this->scale = 0.02f;
}
break;
case ITEM00_ARROWS_SMALL:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
break;
}
case ITEM00_ARROWS_MEDIUM:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
break;
}
case ITEM00_ARROWS_LARGE:
Actor_SetScale(&this->actor, 0.035f);
this->scale = 0.035f;
yOffset = 250.0f;
break;
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
} else {
Actor_SetScale(&this->actor, 0.035f);
this->scale = 0.035f;
yOffset = 250.0f;
}
break;
case ITEM00_BOMBS_A:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
break;
}
case ITEM00_BOMBS_B:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
break;
}
case ITEM00_NUTS:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
break;
}
case ITEM00_STICK:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
break;
}
case ITEM00_MAGIC_SMALL:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
break;
}
case ITEM00_SEEDS:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
break;
}
case ITEM00_BOMBS_SPECIAL:
Actor_SetScale(&this->actor, 0.03f);
this->scale = 0.03f;
yOffset = 320.0f;
break;
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
} else {
Actor_SetScale(&this->actor, 0.03f);
this->scale = 0.03f;
yOffset = 320.0f;
}
break;
case ITEM00_MAGIC_LARGE:
Actor_SetScale(&this->actor, 0.045 - 1e-10);
this->scale = 0.045 - 1e-10;
yOffset = 320.0f;
break;
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
} else {
Actor_SetScale(&this->actor, 0.045 - 1e-10);
this->scale = 0.045 - 1e-10;
yOffset = 320.0f;
}
break;
case ITEM00_RUPEE_ORANGE:
Actor_SetScale(&this->actor, 0.045 - 1e-10);
this->scale = 0.045 - 1e-10;
yOffset = 750.0f;
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.45f);
this->scale = 0.45f;
yOffset = 50.0f;
shadowScale = 0.3f;
this->actor.world.rot.x = 0x4000;
} else {
Actor_SetScale(&this->actor, 0.045 - 1e-10);
this->scale = 0.045 - 1e-10;
yOffset = 750.0f;
}
break;
case ITEM00_RUPEE_PURPLE:
Actor_SetScale(&this->actor, 0.03f);
this->scale = 0.03f;
yOffset = 750.0f;
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.4f);
this->scale = 0.4f;
yOffset = 50.0f;
shadowScale = 0.3f;
this->actor.world.rot.x = 0x4000;
} else {
Actor_SetScale(&this->actor, 0.03f);
this->scale = 0.03f;
yOffset = 750.0f;
}
break;
case ITEM00_FLEXIBLE:
yOffset = 500.0f;
@ -558,6 +704,19 @@ void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx) {
if (CVar_GetS32("gNewDrops", 0) !=0) { //set the rotation system on selected model only :)
if ((this->actor.params == ITEM_RUPEE_GOLD) || (this->actor.params == ITEM_RUPEE_PURPLE) ||
(this->actor.params == ITEM00_ARROWS_SINGLE) || (this->actor.params == ITEM00_ARROWS_SMALL) ||
(this->actor.params == ITEM00_ARROWS_MEDIUM) || (this->actor.params == ITEM00_ARROWS_LARGE) ||
(this->actor.params == ITEM00_BOMBS_A) || (this->actor.params == ITEM00_BOMBS_B) ||
(this->actor.params == ITEM00_NUTS) || (this->actor.params == ITEM00_STICK) ||
(this->actor.params == ITEM00_MAGIC_SMALL) || (this->actor.params == ITEM00_SEEDS) ||
(this->actor.params == ITEM00_MAGIC_LARGE) || (this->actor.params == ITEM00_HEART) || (this->actor.params == ITEM00_BOMBS_SPECIAL)) {
this->actor.shape.rot.y = DroppedItemRot;
}
}
if ((this->actor.params <= ITEM00_RUPEE_RED) || ((this->actor.params == ITEM00_HEART) && (this->unk_15A < 0)) ||
(this->actor.params == ITEM00_HEART_PIECE)) {
this->actor.shape.rot.y += 960;
@ -731,6 +890,10 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
EnItem00* this = (EnItem00*)thisx;
s32 pad;
if (CVar_GetS32("gNewDrops", 0) !=0) { //Update 3D Model rotation on frame update :)
DroppedItemRot += 100;
}
if (this->unk_15A > 0) {
this->unk_15A--;
}
@ -934,15 +1097,35 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnItem00* this = (EnItem00*)thisx;
f32 mtxScale;
if (!(this->unk_156 & this->unk_158)) {
switch (this->actor.params) {
case ITEM00_RUPEE_GREEN:
if (CVar_GetS32("gNewDrops", 0) !=0) {
GetItem_Draw(globalCtx, GID_RUPEE_GREEN);
break;
}
case ITEM00_RUPEE_BLUE:
if (CVar_GetS32("gNewDrops", 0) !=0) {
GetItem_Draw(globalCtx, GID_RUPEE_BLUE);
break;
}
case ITEM00_RUPEE_RED:
if (CVar_GetS32("gNewDrops", 0) !=0) {
GetItem_Draw(globalCtx, GID_RUPEE_RED);
break;
}
case ITEM00_RUPEE_ORANGE:
if (CVar_GetS32("gNewDrops", 0) !=0) {
GetItem_Draw(globalCtx, GID_RUPEE_GOLD);
break;
}
case ITEM00_RUPEE_PURPLE:
EnItem00_DrawRupee(this, globalCtx);
if (CVar_GetS32("gNewDrops", 0) !=0) {
GetItem_Draw(globalCtx, GID_RUPEE_PURPLE);
} else {
EnItem00_DrawRupee(this, globalCtx);
}
break;
case ITEM00_HEART_PIECE:
EnItem00_DrawHeartPiece(this, globalCtx);
@ -951,34 +1134,85 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnItem00_DrawHeartContainer(this, globalCtx);
break;
case ITEM00_HEART:
if (this->unk_15A < 0) {
if (this->unk_15A == -1) {
s8 bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_HEART);
if (Object_IsLoaded(&globalCtx->objectCtx, bankIndex)) {
this->actor.objBankIndex = bankIndex;
Actor_SetObjectDependency(globalCtx, &this->actor);
this->unk_15A = -2;
}
} else {
mtxScale = 16.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
GetItem_Draw(globalCtx, GID_HEART);
}
break;
if (CVar_GetS32("gNewDrops", 0) !=0) {
GetItem_Draw(globalCtx, GID_HEART);
mtxScale = 16.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
break;
} else {
if (this->unk_15A < 0) {
if (this->unk_15A == -1) {
s8 bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_HEART);
if (Object_IsLoaded(&globalCtx->objectCtx, bankIndex)) {
this->actor.objBankIndex = bankIndex;
Actor_SetObjectDependency(globalCtx, &this->actor);
this->unk_15A = -2;
}
} else {
mtxScale = 16.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
GetItem_Draw(globalCtx, GID_HEART);
}
break;
}
}
case ITEM00_BOMBS_A:
if (CVar_GetS32("gNewDrops", 0) !=0) {
GetItem_Draw(globalCtx, GID_BOMB);
break;
}
case ITEM00_BOMBS_B:
if (CVar_GetS32("gNewDrops", 0) !=0) {
GetItem_Draw(globalCtx, GID_BOMB);
break;
}
case ITEM00_BOMBS_SPECIAL:
case ITEM00_ARROWS_SINGLE:
if (CVar_GetS32("gNewDrops", 0) !=0) {
GetItem_Draw(globalCtx, GID_ARROWS_SMALL);
break;
}
case ITEM00_ARROWS_SMALL:
if (CVar_GetS32("gNewDrops", 0) !=0) {
GetItem_Draw(globalCtx, GID_ARROWS_SMALL);
break;
}
case ITEM00_ARROWS_MEDIUM:
if (CVar_GetS32("gNewDrops", 0) !=0) {
GetItem_Draw(globalCtx, GID_ARROWS_MEDIUM);
break;
}
case ITEM00_ARROWS_LARGE:
if (CVar_GetS32("gNewDrops", 0) !=0) {
GetItem_Draw(globalCtx, GID_ARROWS_LARGE);
break;
}
case ITEM00_NUTS:
if (CVar_GetS32("gNewDrops", 0) !=0) {
GetItem_Draw(globalCtx, GID_NUTS);
break;
}
case ITEM00_STICK:
if (CVar_GetS32("gNewDrops", 0) !=0) {
GetItem_Draw(globalCtx, GID_STICK);
break;
}
case ITEM00_MAGIC_LARGE:
if (CVar_GetS32("gNewDrops", 0) !=0) {
GetItem_Draw(globalCtx, GID_MAGIC_LARGE);
break;
}
case ITEM00_MAGIC_SMALL:
if (CVar_GetS32("gNewDrops", 0) !=0) {
GetItem_Draw(globalCtx, GID_MAGIC_SMALL);
break;
}
case ITEM00_SEEDS:
if (CVar_GetS32("gNewDrops", 0) !=0) {
GetItem_Draw(globalCtx, GID_SEEDS);
break;
}
case ITEM00_SMALL_KEY:
EnItem00_DrawCollectible(this, globalCtx);
break;

View File

@ -56,8 +56,6 @@ void TransitionCircle_Start(void* thisx) {
break;
}
this->texture = ResourceMgr_LoadTexByName(this->texture);
if (this->speed == 0) {
this->step = 0x14;
} else {

View File

@ -662,11 +662,17 @@ void Minimap_Draw(GlobalContext* globalCtx) {
TEXEL0, 0, PRIMITIVE, 0);
if (CHECK_DUNGEON_ITEM(DUNGEON_MAP, mapIndex)) {
<<<<<<< hud_color_mod
if (CVar_GetS32("gCustomColors", 0) != 0) { //Dungeon minimap
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetInt("gCCMinimapPrimR", 255), CVar_GetInt("gCCMinimapPrimG", 255), CVar_GetInt("gCCMinimapPrimB", 255), interfaceCtx->magicAlpha);
} else {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 100, 255, 255, interfaceCtx->minimapAlpha);
}
=======
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 100, 255, 255, interfaceCtx->minimapAlpha);
gSPInvalidateTexCache(OVERLAY_DISP++, interfaceCtx->mapSegment);
>>>>>>> develop
gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->mapSegment, G_IM_FMT_I, 96, 85, 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);

View File

@ -391,7 +391,7 @@ void Message_FindCreditsMessage(GlobalContext* globalCtx, u16 textId) {
if (messageTableEntry->textId == textId) {
foundSeg = messageTableEntry->segment;
font->charTexBuf[0] = messageTableEntry->typePos;
messageTableEntry++;
//messageTableEntry++;
nextSeg = messageTableEntry->segment;
font->msgOffset = messageTableEntry->segment;
font->msgLength = messageTableEntry->msgSize;
@ -1138,6 +1138,7 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) {
*gfxP = gfx;
return;
case MESSAGE_OCARINA:
msgCtx->textDrawPos = i + 1;
if (i + 1 == msgCtx->textDrawPos) {
Message_HandleOcarina(globalCtx);
*gfxP = gfx;
@ -1186,7 +1187,7 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) {
}
}
if (msgCtx->textDelayTimer == 0) {
msgCtx->textDrawPos = i + CVar_GetS32("gTextSpeed", 1);
msgCtx->textDrawPos = i + 1;
msgCtx->textDelayTimer = msgCtx->textDelay;
} else {
msgCtx->textDelayTimer--;

View File

@ -1119,6 +1119,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
gfxP = Graph_GfxPlusOne(sp1CC);
gSPDisplayList(OVERLAY_DISP++, gfxP);
gsSPGrayscale(gfxP++, false);
if ((globalCtx->transitionMode == 3) || (globalCtx->transitionMode == 11) ||
(globalCtx->transitionCtx.transitionType >= 56)) {
@ -1136,8 +1137,8 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
TransitionFade_Draw(&globalCtx->transitionFade, &gfxP);
if (D_801614B0.a > 0) {
D_80161498.primColor.rgba = D_801614B0.rgba;
VisMono_Draw(&D_80161498, &gfxP);
gsDPSetGrayscaleColor(gfxP++, D_801614B0.r, D_801614B0.g, D_801614B0.b, D_801614B0.a);
gsSPGrayscale(gfxP++, true);
}
gSPEndDisplayList(gfxP++);
@ -1171,7 +1172,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
//goto Gameplay_Draw_DrawOverlayElements;
}
//else
//else
{
s32 sp80;
@ -1472,7 +1473,7 @@ void Gameplay_InitEnvironment(GlobalContext* globalCtx, s16 skyboxId) {
Environment_Init(globalCtx, &globalCtx->envCtx, 0);
}
void Gameplay_InitScene(GlobalContext* globalCtx, s32 spawn)
void Gameplay_InitScene(GlobalContext* globalCtx, s32 spawn)
{
globalCtx->curSpawn = spawn;
globalCtx->linkActorEntry = NULL;

View File

@ -743,8 +743,27 @@ void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable,
#else
gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[eyeIndex]));
#endif
color = &sTunicColors[tunic];
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 = &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 = &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 = &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 = &sTemp;
}
gDPSetEnvColor(POLY_OPA_DISP++, color->r, color->g, color->b, 0);
sDListsLodOffset = lod * 2;

View File

@ -298,13 +298,13 @@ void EnPart_Draw(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x09, func_80ACEAC0(globalCtx->state.gfxCtx, 225, 205, 115, 25, 20, 0));
gSPSegment(POLY_OPA_DISP++, 0x0A, func_80ACEAC0(globalCtx->state.gfxCtx, 225, 205, 115, 25, 20, 0));
} else if ((thisx->params == 9) && (this->displayList == ResourceMgr_LoadGfxByName(object_tite_DL_002FF0))) {
gSPSegment(POLY_OPA_DISP++, 0x08, ResourceMgr_LoadTexByName(SEGMENTED_TO_VIRTUAL(object_tite_Tex_001300)));
gSPSegment(POLY_OPA_DISP++, 0x09, ResourceMgr_LoadTexByName(SEGMENTED_TO_VIRTUAL(object_tite_Tex_001700)));
gSPSegment(POLY_OPA_DISP++, 0x0A, ResourceMgr_LoadTexByName(SEGMENTED_TO_VIRTUAL(object_tite_Tex_001900)));
gSPSegment(POLY_OPA_DISP++, 0x08, object_tite_Tex_001300);
gSPSegment(POLY_OPA_DISP++, 0x09, object_tite_Tex_001700);
gSPSegment(POLY_OPA_DISP++, 0x0A, object_tite_Tex_001900);
} else if ((thisx->params == 10) && (this->displayList == ResourceMgr_LoadGfxByName(object_tite_DL_002FF0))) {
gSPSegment(POLY_OPA_DISP++, 0x08, ResourceMgr_LoadTexByName(SEGMENTED_TO_VIRTUAL(object_tite_Tex_001B00)));
gSPSegment(POLY_OPA_DISP++, 0x09, ResourceMgr_LoadTexByName(SEGMENTED_TO_VIRTUAL(object_tite_Tex_001F00)));
gSPSegment(POLY_OPA_DISP++, 0x0A, ResourceMgr_LoadTexByName(SEGMENTED_TO_VIRTUAL(object_tite_Tex_002100)));
gSPSegment(POLY_OPA_DISP++, 0x08, object_tite_Tex_001B00);
gSPSegment(POLY_OPA_DISP++, 0x09, object_tite_Tex_001F00);
gSPSegment(POLY_OPA_DISP++, 0x0A, object_tite_Tex_002100);
}
if (this->displayList != NULL) {

View File

@ -84,6 +84,8 @@ void EndTitle_DrawFull(Actor* thisx, GlobalContext* globalCtx) {
}
OVERLAY_DISP = func_80093F34(OVERLAY_DISP);
if (D_801614B0.a > 0)
gsSPGrayscale(OVERLAY_DISP++, false);
gDPSetTextureLUT(OVERLAY_DISP++, G_TT_NONE);
gDPSetEnvColor(OVERLAY_DISP++, 255, 120, 30, 0);
gDPSetRenderMode(OVERLAY_DISP++, G_RM_PASS, G_RM_XLU_SURF2);
@ -108,7 +110,8 @@ void EndTitle_DrawFull(Actor* thisx, GlobalContext* globalCtx) {
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 0, 0, 0, 0);
gSPTextureRectangle(OVERLAY_DISP++, 104 << 2, 177 << 2, 216 << 2, 192 << 2, G_TX_RENDERTILE, 0, 0, 1 << 10,
1 << 10);
if (D_801614B0.a > 0)
gsSPGrayscale(OVERLAY_DISP++, true);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_end_title.c", 515);
}

View File

@ -45,11 +45,8 @@ void FileChoose_SetView(FileChooseContext* this, f32 eyeX, f32 eyeY, f32 eyeZ) {
func_800AAA50(&this->view, 0x7F);
}
Gfx* FileChoose_QuadTextureIA8(Gfx* gfx, void* texture, s16 width, s16 height, s16 point)
Gfx* FileChoose_QuadTextureIA8(Gfx* gfx, void* texture, s16 width, s16 height, s16 point)
{
if (ResourceMgr_OTRSigCheck(texture))
texture = ResourceMgr_LoadTexByName(texture);
gDPLoadTextureBlock(gfx++, 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);
@ -1500,13 +1497,13 @@ void FileChoose_LoadGame(GameState* thisx) {
gSaveContext.naviTimer = 0;
// SWORDLESS LINK IS BACK BABY
if (CVar_GetS32("gSwordlessLink", 0) != 0)
if (CVar_GetS32("gSwordlessLink", 0) != 0)
{
if ((gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KOKIRI) &&
(gSaveContext.equips.buttonItems[0] != ITEM_SWORD_MASTER) &&
(gSaveContext.equips.buttonItems[0] != ITEM_SWORD_BGS) &&
(gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KNIFE)) {
gSaveContext.equips.buttonItems[0] = ITEM_NONE;
swordEquipMask = _byteswap_ushort(gEquipMasks[EQUIP_SWORD]) & gSaveContext.equips.equipment;
gSaveContext.equips.equipment &= gEquipNegMasks[EQUIP_SWORD];

View File

@ -199,7 +199,7 @@ void Title_Draw(TitleContext* this) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 170, 255, 255, 255);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 255, 128);
gDPLoadMultiBlock(POLY_OPA_DISP++, ResourceMgr_LoadTexByName(nintendo_rogo_static_Tex_001800), 0x100, 1, G_IM_FMT_I, G_IM_SIZ_8b, 32, 32, 0,
gDPLoadMultiBlock(POLY_OPA_DISP++, nintendo_rogo_static_Tex_001800, 0x100, 1, G_IM_FMT_I, G_IM_SIZ_8b, 32, 32, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 5, 5, 2, 11);
for (idx = 0, y = 94; idx < 16; idx++, y += 2)
@ -271,6 +271,8 @@ void Title_Init(GameState* thisx) {
//ResourceMgr_CacheDirectory("nintendo_rogo_static*");
// Disable vismono
D_801614B0.a = 0;
R_UPDATE_RATE = 1;
Matrix_Init(&this->state);
View_Init(&this->view, this->state.gfxCtx);

View File

@ -64,7 +64,7 @@ void KaleidoScope_DrawEquipmentImage(GlobalContext* globalCtx, void* source, u32
gDPLoadSync(POLY_KAL_DISP++);
gDPLoadTile(POLY_KAL_DISP++, G_TX_LOADTILE, 0, 0, (width - 1) << 2, (textureHeight - 1) << 2);
gDPSetTextureImageFB(POLY_KAL_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, fbTest);
gSP1Quadrangle(POLY_KAL_DISP++, 0, 2, 3, 1, 0);
@ -575,7 +575,14 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) {
} 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) {
KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[ITEM_SWORD_KOKIRI + temp], 32, 32, point);
int itemId = ITEM_SWORD_KOKIRI + temp;
bool not_acquired = (gItemAgeReqs[itemId] != 9) && (gItemAgeReqs[itemId] != gSaveContext.linkAge);
if (not_acquired) {
gsDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255);
gsSPGrayscale(POLY_KAL_DISP++, true);
}
KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[itemId], 32, 32, point);
gsSPGrayscale(POLY_KAL_DISP++, false);
}
}
}

View File

@ -467,8 +467,15 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) {
}
gSPVertex(POLY_KAL_DISP++, &pauseCtx->itemVtx[j + 0], 4, 0);
KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[gSaveContext.inventory.items[i]], 32,
int itemId = gSaveContext.inventory.items[i];
bool not_acquired = (gItemAgeReqs[itemId] != 9) && (gItemAgeReqs[itemId] != gSaveContext.linkAge);
if (not_acquired) {
gsDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255);
gsSPGrayscale(POLY_KAL_DISP++, true);
}
KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[itemId], 32,
32, 0);
gsSPGrayscale(POLY_KAL_DISP++, false);
}
}

View File

@ -1658,14 +1658,24 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) {
if ((pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) && (pauseCtx->unk_1E4 == 0)) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, D_808321A0, D_808321A2, D_808321A4, D_808321A6);
} else {
if (CVar_GetS32("gUniformLR", 0) != 0) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 180, 210, 255, 255);
}
}
gSPDisplayList(POLY_KAL_DISP++, gLButtonIconDL);
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 180, 210, 255, 220);
if (CVar_GetS32("gUniformLR", 0) == 0) { //Restore the misplace gDPSetPrimColor
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 180, 210, 255, 255);
}
if ((pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT) && (pauseCtx->unk_1E4 == 0)) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, D_808321A0, D_808321A2, D_808321A4, D_808321A6);
} else {
if (CVar_GetS32("gUniformLR", 0) != 0) {
gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 180, 210, 255, 255);
}
}
gSPDisplayList(POLY_KAL_DISP++, gRButtonIconDL);
@ -3157,14 +3167,6 @@ void KaleidoScope_Update(GlobalContext* globalCtx)
gSegments[8] = VIRTUAL_TO_PHYSICAL(pauseCtx->iconItemSegment);
for (i = 0; i < ARRAY_COUNTU(gItemAgeReqs); i++) {
if ((gItemAgeReqs[i] != 9) && (gItemAgeReqs[i] != ((void)0, gSaveContext.linkAge)))
{
gSPInvalidateTexCache(globalCtx->state.gfxCtx->polyKal.p++, ResourceMgr_LoadTexByName(gItemIcons[i]));
KaleidoScope_GrayOutTextureRGBA32(SEGMENTED_TO_VIRTUAL(gItemIcons[i]), 0x400);
}
}
pauseCtx->iconItem24Segment = (void*)(((uintptr_t)pauseCtx->iconItemSegment + size0 + 0xF) & ~0xF);
#if 1
@ -3253,15 +3255,9 @@ void KaleidoScope_Update(GlobalContext* globalCtx)
if (gSaveContext.language == LANGUAGE_ENG) {
memcpy(pauseCtx->nameSegment + 0x400, ResourceMgr_LoadTexByName(mapNameTextures[36 + gSaveContext.worldMapArea]), 0xA00);
} else if (gSaveContext.language == LANGUAGE_GER) {
DmaMgr_SendRequest1(pauseCtx->nameSegment + 0x400,
(uintptr_t)_map_name_staticSegmentRomStart +
(((void)0, gSaveContext.worldMapArea) * 0xA00) + 0x16C00,
0xA00, "../z_kaleido_scope_PAL.c", 3780);
memcpy(pauseCtx->nameSegment + 0x400, ResourceMgr_LoadTexByName(mapNameTextures[59 + gSaveContext.worldMapArea]), 0xA00);
} else {
DmaMgr_SendRequest1(pauseCtx->nameSegment + 0x400,
(uintptr_t)_map_name_staticSegmentRomStart +
(((void)0, gSaveContext.worldMapArea) * 0xA00) + 0x24800,
0xA00, "../z_kaleido_scope_PAL.c", 3784);
memcpy(pauseCtx->nameSegment + 0x400, ResourceMgr_LoadTexByName(mapNameTextures[81 + gSaveContext.worldMapArea]), 0xA00);
}
}
// OTRTODO - player on pause