From d6e4d0b58deff9c20519060493e285c13a5f1887 Mon Sep 17 00:00:00 2001 From: Lurs <2795933+Lurs@users.noreply.github.com> Date: Tue, 11 Aug 2026 23:20:08 +0200 Subject: [PATCH] Take item scales from TP HD, fix file select. Skip main2d.arc and Field0.arc from HD for now to get full map and GC buttons at the the upper right working --- include/d/d_item_data.h | 6 +++++- src/d/d_file_select.cpp | 27 ++++++++++++++++++++++- src/d/d_item_data.cpp | 39 ++++++++++++++++++++++++++++++++++ src/dusk/tphd/HdAssetLayer.cpp | 29 +++---------------------- 4 files changed, 73 insertions(+), 28 deletions(-) diff --git a/include/d/d_item_data.h b/include/d/d_item_data.h index 42bb01c1d1..aa01b76291 100644 --- a/include/d/d_item_data.h +++ b/include/d/d_item_data.h @@ -58,7 +58,11 @@ struct dItem_data { static s16 getTexture(u8 index) { return item_resource[index].mTexture; } - static u8 getTexScale (u8 index) { return item_resource[index].mTexScale; } +#if TARGET_PC + static u8 getTexScale(u8 index); +#else + static u8 getTexScale(u8 index) { return item_resource[index].mTexScale; } +#endif static const char* getFieldArc(u8 index) { return field_item_res[index].mFieldArc; } diff --git a/src/d/d_file_select.cpp b/src/d/d_file_select.cpp index fd9c1dc480..6fd33682e2 100644 --- a/src/d/d_file_select.cpp +++ b/src/d/d_file_select.cpp @@ -24,6 +24,10 @@ #include #include "dusk/version.hpp" +#if DUSK_TPHD +#include "dusk/settings.h" +#include "dusk/tphd/HdAssetLayer.hpp" +#endif #if TARGET_PC #include "dusk/menu_pointer.h" @@ -5904,7 +5908,14 @@ void dFile_select3D_c::_move() { cXyz stack_20; Vec stack_8 = mPaneMgr->getGlobalVtxCenter(false, 0); - toItem3Dpos(oREG_F(0) + (stack_8.x + field_0x03b8.x), oREG_F(1) + (stack_8.y + field_0x03b8.y), oREG_F(2) + 720.0f, &stack_20); + f32 itemY = stack_8.y + field_0x03b8.y; +#if DUSK_TPHD + if (dusk::tphd_active()) { + itemY += 87.0f; + } +#endif + toItem3Dpos(oREG_F(0) + (stack_8.x + field_0x03b8.x), oREG_F(1) + itemY, + oREG_F(2) + 720.0f, &stack_20); field_0x03a4.set(stack_20); field_0x03b0.set(0, 0, 0); animePlay(); @@ -5951,6 +5962,10 @@ void dFile_select3D_c::setJ3D(char const* param_0, char const* param_1, char con JUT_ASSERT(5285, bmdRes != NULL); void* bmdWork = make_work_copy(bmdRes); +#if DUSK_TPHD + dusk::tphd::register_copied_hd_resource( + archive->mEntryNum, param_0, bmdWork, archive->getResSize(bmdRes)); +#endif modelData = J3DModelLoaderDataBase::load(bmdWork, 0x51020010); JUT_ASSERT(5290, modelData != NULL); @@ -6059,6 +6074,11 @@ void dFile_select3D_c::createMaskModel() { field_0x03b8.x = m_kamen_offset_x[mMaskIdx]; field_0x03b8.y = m_kamen_offset_y[mMaskIdx]; field_0x03b8.z = m_kamen_scale[mMaskIdx]; +#if DUSK_TPHD + if (dusk::tphd_active() && mMaskIdx != 0) { + field_0x03b8.x = -25.0f; + } +#endif field_0x03a4.set(0.0f, 0.0f, 0.0f); field_0x03b0.set(0, 0, 0); mpModel = NULL; @@ -6102,6 +6122,11 @@ void dFile_select3D_c::createMirrorModel() { field_0x03b8.x = m_mirror_offset_x[mMirrorIdx]; field_0x03b8.y = m_mirror_offset_y[mMirrorIdx]; field_0x03b8.z = m_mirror_scale[mMirrorIdx]; +#if DUSK_TPHD + if (dusk::tphd_active() && mMirrorIdx != 0) { + field_0x03b8.x = -25.0f; + } +#endif field_0x03a4.set(0.0f, 0.0f, 0.0f); field_0x03b0.set(0, 0, 0); mpModel = NULL; diff --git a/src/d/d_item_data.cpp b/src/d/d_item_data.cpp index 806347999f..0dba491a9d 100644 --- a/src/d/d_item_data.cpp +++ b/src/d/d_item_data.cpp @@ -2,6 +2,45 @@ #include "d/d_item_data.h" +#if TARGET_PC && DUSK_TPHD +#include "dusk/settings.h" + +namespace { + +constexpr u8 kTphdItemTexScale[] = { + 0x2C, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x2C, 0x2C, 0x26, 0x26, 0x26, 0x26, 0x2C, 0x2C, + 0x2C, 0x2C, 0x26, 0x64, 0x64, 0x64, 0x26, 0x26, 0x26, 0x26, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, + 0x26, 0x1F, 0x1F, 0x25, 0x26, 0x1F, 0x26, 0x1F, 0x29, 0x29, 0x29, 0x29, 0x26, 0x3E, 0x20, 0x20, + 0x20, 0x26, 0x2C, 0x1F, 0x26, 0x26, 0x26, 0x1F, 0x1F, 0x1F, 0x1F, 0x64, 0x64, 0x1F, 0x26, 0x29, + 0x29, 0x1E, 0x35, 0x26, 0x26, 0x26, 0x22, 0x2D, 0x2B, 0x29, 0x28, 0x29, 0x22, 0x64, 0x64, 0x1F, + 0x1F, 0x1F, 0x64, 0x2C, 0x26, 0x26, 0x26, 0x64, 0x28, 0x26, 0x26, 0x28, 0x28, 0x28, 0x28, 0x28, + 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x2B, 0x2B, + 0x26, 0x26, 0x2C, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, + 0x26, 0x26, 0x32, 0x32, 0x32, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, + 0x3E, 0x3E, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x32, 0x32, 0x32, 0x2B, 0x19, 0x19, 0x19, + 0x2C, 0x26, 0x26, 0x26, 0x26, 0x2C, 0x2C, 0x2C, 0x32, 0x32, 0x32, 0x32, 0x28, 0x1E, 0x1E, 0x1E, + 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, 0x1E, 0x28, 0x2D, 0x2D, 0x2D, 0x2D, 0x21, 0x28, 0x3C, 0x3C, + 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, + 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x3C, 0x23, 0x26, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, + 0x26, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, 0x26, 0x26, 0x26, 0x26, 0x1F, 0x1B, 0x26, 0x19, + 0x19, 0x19, 0x19, 0x26, 0x26, 0x26, 0x26, 0x26, 0x2B, 0x35, 0x35, 0x35, 0x26, 0x2C, 0x26, +}; +static_assert(sizeof(kTphdItemTexScale) == 0xFF); + +} // namespace +#endif + +#if TARGET_PC +u8 dItem_data::getTexScale(u8 index) { +#if TARGET_PC && DUSK_TPHD + if (dusk::tphd_active() && index < sizeof(kTphdItemTexScale)) { + return kTphdItemTexScale[index]; + } +#endif + return item_resource[index].mTexScale; +} +#endif + DUSK_GAME_DATA dItem_itemResource dItem_data::item_resource[] = { {"F_gD_rupy", 0x0004,-0x0001,-0x0001, 0x0007,-0x0001, 0x0, -0x1, 0x002D, 0x64, 0x0000}, {"F_gD_rupy", 0x0004,-0x0001,-0x0001, 0x0007,-0x0001, 0x0, -0x1, 0x002D, 0x3C, 0x0000}, diff --git a/src/dusk/tphd/HdAssetLayer.cpp b/src/dusk/tphd/HdAssetLayer.cpp index c9e5fe2a11..091a77125e 100644 --- a/src/dusk/tphd/HdAssetLayer.cpp +++ b/src/dusk/tphd/HdAssetLayer.cpp @@ -707,14 +707,10 @@ void register_hd_textures_for_arc(std::span arcBytes, const std::vector