bump lus/support lus changes (#4701)

This commit is contained in:
briaguya 2024-12-16 21:12:45 -05:00 committed by GitHub
parent e1a53a77d4
commit 5d978c11c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 70 additions and 38 deletions

@ -1 +1 @@
Subproject commit c872b1ff18b793a97385ccf1c864c3fc04051cc7
Subproject commit 8f71672901987bc3dbf6256e64e228db36a686f5

@ -1 +1 @@
Subproject commit 60868949e62a4c4c863eb5daf883bae18387f372
Subproject commit bd307e8edc3ec4424c284484fce6233c2c618eae

View File

@ -46,6 +46,8 @@ namespace LUS
{
class IResource;
class Scene;
};
namespace Fast {
class DisplayList;
};
#include <memory>

View File

@ -170,7 +170,7 @@ void InputViewer::DrawElement() {
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0, 0, 0, 0));
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0.0f, 0.0f));
OSContPad* pads = Ship::Context::GetInstance()->GetControlDeck()->GetPads();
OSContPad* pads = std::dynamic_pointer_cast<LUS::ControlDeck>(Ship::Context::GetInstance()->GetControlDeck())->GetPads();
ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar |
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoBackground |

View File

@ -1304,7 +1304,7 @@ void SohInputEditorWindow::DrawButtonDeviceIcons(uint8_t portIndex, std::set<N64
}
}
void SohInputEditorWindow::DrawAnalogStickDeviceIcons(uint8_t portIndex, Ship::Stick stick) {
void SohInputEditorWindow::DrawAnalogStickDeviceIcons(uint8_t portIndex, Ship::StickIndex stickIndex) {
std::set<Ship::ShipDeviceIndex> allLusDeviceIndices;
allLusDeviceIndices.insert(Ship::ShipDeviceIndex::Keyboard);
for (auto [lusIndex, mapping] : Ship::Context::GetInstance()
@ -1317,7 +1317,7 @@ void SohInputEditorWindow::DrawAnalogStickDeviceIcons(uint8_t portIndex, Ship::S
std::vector<std::pair<Ship::ShipDeviceIndex, bool>> lusDeviceIndiciesWithMappings;
for (auto lusIndex : allLusDeviceIndices) {
auto controllerStick =
stick == Ship::Stick::LEFT_STICK
stickIndex == Ship::StickIndex::LEFT_STICK
? Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(portIndex)->GetLeftStick()
: Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(portIndex)->GetRightStick();
if (controllerStick->HasMappingsForShipDeviceIndex(lusIndex)) {

View File

@ -96,7 +96,7 @@ class SohInputEditorWindow : public Ship::GuiWindow {
std::set<N64ButtonMask> mModifierButtonsBitmasks;
std::set<N64ButtonMask> mCustomOcarinaButtonsBitmasks;
void DrawButtonDeviceIcons(uint8_t portIndex, std::set<N64ButtonMask> bitmasks);
void DrawAnalogStickDeviceIcons(uint8_t portIndex, Ship::Stick stick);
void DrawAnalogStickDeviceIcons(uint8_t portIndex, Ship::StickIndex stickIndex);
void DrawRumbleDeviceIcons(uint8_t portIndex);
void DrawGyroDeviceIcons(uint8_t portIndex);
void DrawLEDDeviceIcons(uint8_t portIndex);

View File

@ -120,9 +120,9 @@ void DLViewerWindow::DrawElement() {
}
try {
auto res = std::static_pointer_cast<LUS::DisplayList>(Ship::Context::GetInstance()->GetResourceManager()->LoadResource(activeDisplayList));
auto res = std::static_pointer_cast<Fast::DisplayList>(Ship::Context::GetInstance()->GetResourceManager()->LoadResource(activeDisplayList));
if (res->GetInitData()->Type != static_cast<uint32_t>(LUS::ResourceType::DisplayList)) {
if (res->GetInitData()->Type != static_cast<uint32_t>(Fast::ResourceType::DisplayList)) {
ImGui::Text("Resource type is not a Display List. Please choose another.");
return;
}

View File

@ -822,7 +822,7 @@ void CheckTrackerWindow::DrawElement() {
if (CVarGetInteger(CVAR_TRACKER_CHECK("DisplayType"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_COMBO_BUTTON) {
int comboButton1Mask = buttons[CVarGetInteger(CVAR_TRACKER_CHECK("ComboButton1"), TRACKER_COMBO_BUTTON_L)];
int comboButton2Mask = buttons[CVarGetInteger(CVAR_TRACKER_CHECK("ComboButton2"), TRACKER_COMBO_BUTTON_R)];
OSContPad* trackerButtonsPressed = Ship::Context::GetInstance()->GetControlDeck()->GetPads();
OSContPad* trackerButtonsPressed = std::dynamic_pointer_cast<LUS::ControlDeck>(Ship::Context::GetInstance()->GetControlDeck())->GetPads();
bool comboButtonsHeld = trackerButtonsPressed != nullptr &&
trackerButtonsPressed[0].button & comboButton1Mask &&
trackerButtonsPressed[0].button & comboButton2Mask;

View File

@ -1224,7 +1224,7 @@ void ItemTrackerWindow::DrawElement() {
int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12);
int comboButton1Mask = buttonMap[CVarGetInteger(CVAR_TRACKER_ITEM("ComboButton1"), TRACKER_COMBO_BUTTON_L)];
int comboButton2Mask = buttonMap[CVarGetInteger(CVAR_TRACKER_ITEM("ComboButton2"), TRACKER_COMBO_BUTTON_R)];
OSContPad* buttonsPressed = Ship::Context::GetInstance()->GetControlDeck()->GetPads();
OSContPad* buttonsPressed = std::dynamic_pointer_cast<LUS::ControlDeck>(Ship::Context::GetInstance()->GetControlDeck())->GetPads();
bool comboButtonsHeld = buttonsPressed != nullptr && buttonsPressed[0].button & comboButton1Mask && buttonsPressed[0].button & comboButton2Mask;
bool isPaused = CVarGetInteger(CVAR_TRACKER_ITEM("ShowOnlyPaused"), 0) == 0 || gPlayState != nullptr && gPlayState->pauseCtx.state > 0;

View File

@ -1,6 +1,6 @@
#include "savestates.h"
#include <GameVersions.h>
#include <soh/GameVersions.h>
#include <cstdio> // std::sprintf

28
soh/soh/GameVersions.h Normal file
View File

@ -0,0 +1,28 @@
#ifndef GAME_VERSION_H
#define GAME_VERSION_H
#pragma once
#define OOT_NTSC_US_10 0xEC7011B7
#define OOT_NTSC_US_11 0xD43DA81F
#define OOT_NTSC_US_12 0x693BA2AE
// #define OOT_NTSC_JP_10 ?
// #define OOT_NTSC_JP_11 ?
// #define OOT_NTSC_JP_12 ?
#define OOT_PAL_10 0xB044B569
#define OOT_PAL_11 0xB2055FBD
#define OOT_NTSC_JP_GC_CE 0xF7F52DB8
#define OOT_NTSC_JP_GC 0xF611F4BA
#define OOT_NTSC_US_GC 0xF3DD35BA
#define OOT_PAL_GC 0x09465AC3
#define OOT_NTSC_JP_MQ 0xF43B45BA
#define OOT_NTSC_US_MQ 0xF034001A
#define OOT_PAL_MQ 0x1D4136F3
#define OOT_PAL_GC_DBG1 0x871E1C92 // 03-21-2002 build
#define OOT_PAL_GC_DBG2 0x87121EFE // 03-13-2002 build
#define OOT_PAL_GC_MQ_DBG 0x917D18F6
#define OOT_IQUE_TW 0x3D81FB3E
#define OOT_IQUE_CN 0xB1E1E07B
#define UNKNOWN_GAME_VERSION 0xFFFFFFFF
#endif

View File

@ -11,7 +11,7 @@
#include <File.h>
#include <DisplayList.h>
#include <Window.h>
#include <GameVersions.h>
#include <soh/GameVersions.h>
#include "Enhancements/gameconsole.h"
#ifdef _WIN32
@ -327,7 +327,7 @@ OTRGlobals::OTRGlobals() {
prevAltAssets = CVarGetInteger(CVAR_ENHANCEMENT("AltAssets"), 0);
context->GetResourceManager()->SetAltAssetsEnabled(prevAltAssets);
context->InitControlDeck({
auto controlDeck = std::make_shared<LUS::ControlDeck>(std::vector<CONTROLLERBUTTONS_T>({
BTN_CUSTOM_MODIFIER1,
BTN_CUSTOM_MODIFIER2,
BTN_CUSTOM_OCARINA_NOTE_D4,
@ -338,14 +338,16 @@ OTRGlobals::OTRGlobals() {
BTN_CUSTOM_OCARINA_DISABLE_SONGS,
BTN_CUSTOM_OCARINA_PITCH_UP,
BTN_CUSTOM_OCARINA_PITCH_DOWN,
});
}));
context->InitControlDeck(controlDeck);
context->GetControlDeck()->SetSinglePlayerMappingMode(true);
context->InitCrashHandler();
context->InitConsole();
auto sohInputEditorWindow = std::make_shared<SohInputEditorWindow>(CVAR_WINDOW("ControllerConfiguration"), "Controller Configuration");
context->InitWindow({ sohInputEditorWindow });
auto sohFast3dWindow = std::make_shared<Fast::Fast3dWindow>(std::vector<std::shared_ptr<Ship::GuiWindow>>({sohInputEditorWindow}));
context->InitWindow(sohFast3dWindow);
auto overlay = context->GetInstance()->GetWindow()->GetGui()->GetGameOverlay();
overlay->LoadFont("Press Start 2P", 12.0f, "fonts/PressStart2P-Regular.ttf");
@ -357,14 +359,14 @@ OTRGlobals::OTRGlobals() {
SPDLOG_INFO("Starting Ship of Harkinian version {} (Branch: {} | Commit: {})", (char*)gBuildVersion, (char*)gGitBranch, (char*)gGitCommitHash);
auto loader = context->GetResourceManager()->GetResourceLoader();
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryTextureV0>(), RESOURCE_FORMAT_BINARY, "Texture", static_cast<uint32_t>(LUS::ResourceType::Texture), 0);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryTextureV1>(), RESOURCE_FORMAT_BINARY, "Texture", static_cast<uint32_t>(LUS::ResourceType::Texture), 1);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryVertexV0>(), RESOURCE_FORMAT_BINARY, "Vertex", static_cast<uint32_t>(LUS::ResourceType::Vertex), 0);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryXMLVertexV0>(), RESOURCE_FORMAT_XML, "Vertex", static_cast<uint32_t>(LUS::ResourceType::Vertex), 0);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryDisplayListV0>(), RESOURCE_FORMAT_BINARY, "DisplayList", static_cast<uint32_t>(LUS::ResourceType::DisplayList), 0);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryXMLDisplayListV0>(), RESOURCE_FORMAT_XML, "DisplayList", static_cast<uint32_t>(LUS::ResourceType::DisplayList), 0);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryMatrixV0>(), RESOURCE_FORMAT_BINARY, "Matrix", static_cast<uint32_t>(LUS::ResourceType::Matrix), 0);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryBlobV0>(), RESOURCE_FORMAT_BINARY, "Blob", static_cast<uint32_t>(LUS::ResourceType::Blob), 0);
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryBinaryTextureV0>(), RESOURCE_FORMAT_BINARY, "Texture", static_cast<uint32_t>(Fast::ResourceType::Texture), 0);
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryBinaryTextureV1>(), RESOURCE_FORMAT_BINARY, "Texture", static_cast<uint32_t>(Fast::ResourceType::Texture), 1);
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryBinaryVertexV0>(), RESOURCE_FORMAT_BINARY, "Vertex", static_cast<uint32_t>(Fast::ResourceType::Vertex), 0);
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryXMLVertexV0>(), RESOURCE_FORMAT_XML, "Vertex", static_cast<uint32_t>(Fast::ResourceType::Vertex), 0);
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryBinaryDisplayListV0>(), RESOURCE_FORMAT_BINARY, "DisplayList", static_cast<uint32_t>(Fast::ResourceType::DisplayList), 0);
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryXMLDisplayListV0>(), RESOURCE_FORMAT_XML, "DisplayList", static_cast<uint32_t>(Fast::ResourceType::DisplayList), 0);
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryBinaryMatrixV0>(), RESOURCE_FORMAT_BINARY, "Matrix", static_cast<uint32_t>(Fast::ResourceType::Matrix), 0);
loader->RegisterResourceFactory(std::make_shared<Ship::ResourceFactoryBinaryBlobV0>(), RESOURCE_FORMAT_BINARY, "Blob", static_cast<uint32_t>(Ship::ResourceType::Blob), 0);
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryArrayV0>(), RESOURCE_FORMAT_BINARY, "Array", static_cast<uint32_t>(SOH::ResourceType::SOH_Array), 0);
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryAnimationV0>(), RESOURCE_FORMAT_BINARY, "Animation", static_cast<uint32_t>(SOH::ResourceType::SOH_Animation), 0);
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryPlayerAnimationV0>(), RESOURCE_FORMAT_BINARY, "PlayerAnimation", static_cast<uint32_t>(SOH::ResourceType::SOH_PlayerAnimation), 0);

View File

@ -6,7 +6,7 @@
#include "Enhancements/enhancementTypes.h"
#include "Enhancements/randomizer/dungeon.h"
#include <libultraship/libultraship.h>
#include <GameVersions.h>
#include <soh/GameVersions.h>
#include "resource/type/SohResourceType.h"
#include "resource/type/Array.h"
#include "resource/type/Skeleton.h"
@ -205,7 +205,7 @@ extern "C" char* ResourceMgr_GetResourceDataByNameHandlingMQ(const char* path) {
}
extern "C" uint8_t ResourceMgr_TexIsRaw(const char* texPath) {
auto res = std::static_pointer_cast<LUS::Texture>(ResourceMgr_GetResourceByNameHandlingMQ(texPath));
auto res = std::static_pointer_cast<Fast::Texture>(ResourceMgr_GetResourceByNameHandlingMQ(texPath));
return res->Flags & TEX_FLAG_LOAD_AS_RAW;
}
@ -253,8 +253,8 @@ extern "C" char* ResourceMgr_LoadJPEG(char* data, size_t dataSize) {
extern "C" char* ResourceMgr_LoadTexOrDListByName(const char* filePath) {
auto res = ResourceMgr_GetResourceByNameHandlingMQ(filePath);
if (res->GetInitData()->Type == static_cast<uint32_t>(LUS::ResourceType::DisplayList)) {
return (char*)&((std::static_pointer_cast<LUS::DisplayList>(res))->Instructions[0]);
if (res->GetInitData()->Type == static_cast<uint32_t>(Fast::ResourceType::DisplayList)) {
return (char*)&((std::static_pointer_cast<Fast::DisplayList>(res))->Instructions[0]);
}
if (res->GetInitData()->Type == static_cast<uint32_t>(SOH::ResourceType::SOH_Array)) {
@ -267,8 +267,8 @@ extern "C" char* ResourceMgr_LoadTexOrDListByName(const char* filePath) {
extern "C" char* ResourceMgr_LoadIfDListByName(const char* filePath) {
auto res = ResourceMgr_GetResourceByNameHandlingMQ(filePath);
if (res->GetInitData()->Type == static_cast<uint32_t>(LUS::ResourceType::DisplayList)) {
return (char*)&((std::static_pointer_cast<LUS::DisplayList>(res))->Instructions[0]);
if (res->GetInitData()->Type == static_cast<uint32_t>(Fast::ResourceType::DisplayList)) {
return (char*)&((std::static_pointer_cast<Fast::DisplayList>(res))->Instructions[0]);
}
return nullptr;
@ -290,12 +290,12 @@ extern "C" Gfx* ResourceMgr_LoadGfxByName(const char* path) {
// OTRTODO: If Alt loading over original cache is fixed, this line can most likely be removed
ResourceMgr_UnloadOriginalWhenAltExists(path);
auto res = std::static_pointer_cast<LUS::DisplayList>(ResourceMgr_GetResourceByNameHandlingMQ(path));
auto res = std::static_pointer_cast<Fast::DisplayList>(ResourceMgr_GetResourceByNameHandlingMQ(path));
return (Gfx*)&res->Instructions[0];
}
extern "C" uint8_t ResourceMgr_FileIsCustomByName(const char* path) {
auto res = std::static_pointer_cast<LUS::DisplayList>(ResourceMgr_GetResourceByNameHandlingMQ(path));
auto res = std::static_pointer_cast<Fast::DisplayList>(ResourceMgr_GetResourceByNameHandlingMQ(path));
return res->GetInitData()->IsCustom;
}
@ -309,7 +309,7 @@ std::unordered_map<std::string, std::unordered_map<std::string, GfxPatch>> origi
// Attention! This is primarily for cosmetics & bug fixes. For things like mods and model replacement you should be using OTRs
// instead (When that is available). Index can be found using the commented out section below.
extern "C" void ResourceMgr_PatchGfxByName(const char* path, const char* patchName, int index, Gfx instruction) {
auto res = std::static_pointer_cast<LUS::DisplayList>(
auto res = std::static_pointer_cast<Fast::DisplayList>(
Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path));
// Leaving this here for people attempting to find the correct Dlist index to patch
@ -348,7 +348,7 @@ extern "C" void ResourceMgr_PatchGfxByName(const char* path, const char* patchNa
}
extern "C" void ResourceMgr_PatchGfxCopyCommandByName(const char* path, const char* patchName, int destinationIndex, int sourceIndex) {
auto res = std::static_pointer_cast<LUS::DisplayList>(
auto res = std::static_pointer_cast<Fast::DisplayList>(
Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path));
// Do not patch custom assets as they most likely do not have the same instructions as authentic assets
@ -371,7 +371,7 @@ extern "C" void ResourceMgr_PatchGfxCopyCommandByName(const char* path, const ch
extern "C" void ResourceMgr_UnpatchGfxByName(const char* path, const char* patchName) {
if (originalGfx.contains(path) && originalGfx[path].contains(patchName)) {
auto res = std::static_pointer_cast<LUS::DisplayList>(
auto res = std::static_pointer_cast<Fast::DisplayList>(
Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path));
Gfx* gfx = (Gfx*)&res->Instructions[originalGfx[path][patchName].index];

View File

@ -107,7 +107,7 @@ bool Scene_CommandSpecialFiles(PlayState* play, SOH::ISceneCommand* cmd) {
if (specialCmd->specialObjects.elfMessage != 0) {
auto res =
(LUS::Blob*)OTRPlay_LoadFile(play, sNaviMsgFiles[specialCmd->specialObjects.elfMessage - 1].fileName);
(Ship::Blob*)OTRPlay_LoadFile(play, sNaviMsgFiles[specialCmd->specialObjects.elfMessage - 1].fileName);
play->cUpElfMsgs = (ElfMessage*)res->Data.data();
}

View File

@ -6,7 +6,7 @@
#include "z_en_mag.h"
#include "objects/object_mag/object_mag.h"
#include <GameVersions.h>
#include <soh/GameVersions.h>
#include "soh/ResourceManagerHelpers.h"
#define FLAGS (ACTOR_FLAG_UPDATE_WHILE_CULLED | ACTOR_FLAG_DRAW_WHILE_CULLED)

View File

@ -11,7 +11,7 @@
#include <textures/parameter_static/parameter_static.h>
#include "textures/message_static/message_static.h"
#include "soh/frame_interpolation.h"
#include <GameVersions.h>
#include <soh/GameVersions.h>
#include "objects/object_mag/object_mag.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#include "soh_assets.h"

View File

@ -11,7 +11,7 @@
#include "textures/nintendo_rogo_static/nintendo_rogo_static.h"
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#include <soh/Enhancements/bootcommands.h>
#include <GameVersions.h>
#include <soh/GameVersions.h>
#include <soh/SaveManager.h>
#include "soh/ResourceManagerHelpers.h"
#include <string.h>