Fix d_a_ykgr retail regalloc and mostly match on debug (#2608)

* d_a_ykgr OK

* Fix sqrtf for shield

* Fix pch caps
This commit is contained in:
LagoLunatic 2025-08-27 04:40:48 -04:00 committed by GitHub
parent a945ef4fb8
commit 0579f4acef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 123 additions and 81 deletions

View File

@ -21794,9 +21794,9 @@ m_roomDzs__20dStage_roomControl_c = .sbss:0x80452D34; // type:object size:0x8 sc
m_res__22dMap_HIO_prm_res_dst_s = .sbss:0x80452D40; // type:object size:0x4 scope:global align:4 data:4byte
m_count__9daArrow_c = .sbss:0x80452D48; // type:object size:0x2 scope:global align:2
mSetTop__7daSus_c = .sbss:0x80452D4A; // type:object size:0x2 scope:global align:2 data:2byte
lbl_80452D4C = .sbss:0x80452D4C; // type:object size:0x1 data:byte
lbl_80452D4D = .sbss:0x80452D4D; // type:object size:0x1 data:byte
lbl_80452D4E = .sbss:0x80452D4E; // type:object size:0x1 data:byte
m_flag__8daYkgr_c = .sbss:0x80452D4C; // type:object size:0x1 data:byte
m_alpha_flag__8daYkgr_c = .sbss:0x80452D4D; // type:object size:0x1 data:byte
m_alpha__8daYkgr_c = .sbss:0x80452D4E; // type:object size:0x1 data:byte
m_aim_rate__8daYkgr_c = .sbss:0x80452D50; // type:object size:0x4 scope:global align:4
m_path__8daYkgr_c = .sbss:0x80452D54; // type:object size:0x4 scope:global align:4
m_emitter__8daYkgr_c = .sbss:0x80452D58; // type:object size:0x4 scope:global align:4 data:4byte
@ -21808,8 +21808,8 @@ m_grass__9daGrass_c = .sbss:0x80452D70; // type:object size:0x4 scope:global ali
m_flower__9daGrass_c = .sbss:0x80452D74; // type:object size:0x4 scope:global align:4 data:4byte
m_myObj__6daMP_c = .sbss:0x80452D78; // type:object size:0x4 scope:global align:4 data:4byte
mTagMagne__12daTagMagne_c = .sbss:0x80452D7C; // type:object size:0x4 scope:global align:4 data:4byte
lbl_80452D80 = .sbss:0x80452D80; // type:object size:0x1 data:byte
lbl_80452D81 = .sbss:0x80452D81; // type:object size:0x1 data:byte
mPlayerNo__11daTagMist_c = .sbss:0x80452D80; // type:object size:0x1 data:byte
mSaveFlag__12daObjCarry_c = .sbss:0x80452D81; // type:object size:0x1 data:byte
mSttsFlag__12daObjCarry_c = .sbss:0x80452D84; // type:object size:0x5 scope:global align:4
mRoomNo__12daObjCarry_c = .sbss:0x80452D8C; // type:object size:0x5 scope:global align:4
m_diffTime__11dLib_time_c = .sbss:0x80452D98; // type:object size:0x8 scope:global align:4 data:4byte

View File

@ -64323,9 +64323,9 @@ g_dComIfAc_gameInfo = .sbss:0x8074C5C0; // type:object size:0x8 scope:global has
g_dComIfGoat_gameInfo = .sbss:0x8074C5C8; // type:object size:0x4 scope:global data:4byte hash:0xB039AA75
m_count__9daArrow_c = .sbss:0x8074C5D0; // type:object size:0x2 scope:global hash:0xAFED360D dhash:0x0191FF94
mSetTop__7daSus_c = .sbss:0x8074C5D2; // type:object size:0x2 scope:global data:2byte hash:0x3886CAFA dhash:0xADB8E62D
lbl_8074C5D4 = .sbss:0x8074C5D4; // type:object size:0x1 data:byte hash:0x89C78ABD dhash:0x1116DE05
lbl_8074C5D5 = .sbss:0x8074C5D5; // type:object size:0x1 data:byte hash:0x5FA2AFF6 dhash:0x5338112E
lbl_8074C5D6 = .sbss:0x8074C5D6; // type:object size:0x1 data:byte hash:0xB5EF2685 dhash:0x3355973D
m_flag__8daYkgr_c = .sbss:0x8074C5D4; // type:object size:0x1 data:byte hash:0x89C78ABD dhash:0x1116DE05
m_alpha_flag__8daYkgr_c = .sbss:0x8074C5D5; // type:object size:0x1 data:byte hash:0x5FA2AFF6 dhash:0x5338112E
m_alpha__8daYkgr_c = .sbss:0x8074C5D6; // type:object size:0x1 data:byte hash:0xB5EF2685 dhash:0x3355973D
m_aim_rate__8daYkgr_c = .sbss:0x8074C5D8; // type:object size:0x4 scope:global hash:0xF2CCF169 dhash:0xBC891711
m_path__8daYkgr_c = .sbss:0x8074C5DC; // type:object size:0x4 scope:global hash:0x10A168FC dhash:0x111A6F24
m_emitter__8daYkgr_c = .sbss:0x8074C5E0; // type:object size:0x4 scope:global data:4byte hash:0x078BB187 dhash:0x7DAC84FF
@ -64337,8 +64337,8 @@ m_grass__9daGrass_c = .sbss:0x8074C5FC; // type:object size:0x4 scope:global dat
m_flower__9daGrass_c = .sbss:0x8074C600; // type:object size:0x4 scope:global data:4byte hash:0x24D76026 dhash:0x251474BF
m_myObj__6daMP_c = .sbss:0x8074C604; // type:object size:0x4 scope:global data:4byte hash:0x2BC7D0F6 dhash:0x6336B9A0
mTagMagne__12daTagMagne_c = .sbss:0x8074C608; // type:object size:0x4 scope:global data:4byte hash:0x413B5D52 dhash:0x0B5ED571
lbl_8074C60C = .sbss:0x8074C60C; // type:object size:0x1 data:byte hash:0x3A84AB81 dhash:0x97EA4041
lbl_8074C60D = .sbss:0x8074C60D; // type:object size:0x1 data:byte hash:0xA085CB0F dhash:0x5B969AEC
mPlayerNo__11daTagMist_c = .sbss:0x8074C60C; // type:object size:0x1 data:byte hash:0x3A84AB81 dhash:0x97EA4041
mSaveFlag__12daObjCarry_c = .sbss:0x8074C60D; // type:object size:0x1 data:byte hash:0xA085CB0F dhash:0x5B969AEC
mSttsFlag__12daObjCarry_c = .sbss:0x8074C610; // type:object size:0x5 scope:global hash:0x2C3B0182 dhash:0x70F95521
mRoomNo__12daObjCarry_c = .sbss:0x8074C618; // type:object size:0x5 scope:global hash:0x7A66BF30 dhash:0x986864D3
m_diffTime__11dLib_time_c = .sbss:0x8074C620; // type:object size:0x8 scope:global data:4byte hash:0xFC753EFA dhash:0x51401BBA

View File

@ -1640,7 +1640,7 @@ config.libs = [
ActorRel(MatchingFor("GZ2E01"), "d_a_tag_mstop"),
ActorRel(MatchingFor("GZ2E01"), "d_a_tag_spring"),
ActorRel(MatchingFor("GZ2E01"), "d_a_tag_statue_evt"),
ActorRel(NonMatching, "d_a_ykgr"),
ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_ykgr"),
ActorRel(MatchingFor("GZ2E01"), "d_a_L7demo_dr"),
ActorRel(MatchingFor("GZ2E01"), "d_a_L7low_dr"),
ActorRel(MatchingFor("GZ2E01"), "d_a_L7op_demo_dr"),

View File

@ -120,6 +120,7 @@ public:
u8 getResourceManagerID() const { return mResMgrID; }
u8 getGroupID() const { return mGroupID; }
u8 getDrawTimes() const { return mDrawTimes; }
f32 getRate() const { return mRate; }
void setRate(f32 rate) { mRate = rate; }
void setDirectionalSpeed(f32 i_speed) { mDirSpeed = i_speed; }
void setRandomDirectionSpeed(f32 i_speed) { mRndmDirSpeed = i_speed; }

View File

@ -8,23 +8,6 @@
#include "d/d_com_inf_game.h"
#include "d/d_particle.h"
struct daYkgr_HIO_c : public mDoHIO_entry_c {
daYkgr_HIO_c();
/* 805A8D98 */ virtual ~daYkgr_HIO_c();
void genMessage(JORMContext*);
/* 0x04 */ u8 field_0x4;
/* 0x08 */ s32 field_0x8;
/* 0x0C */ s32 field_0xc;
/* 0x10 */ f32 field_0x10;
/* 0x14 */ f32 field_0x14;
/* 0x18 */ f32 field_0x18;
/* 0x1C */ f32 field_0x1c;
/* 0x20 */ f32 field_0x20;
/* 0x24 */ f32 field_0x24;
};
struct dPa_YkgrPcallBack : public JPAParticleCallBack {
dPa_YkgrPcallBack();
/* 805A8E3C */ ~dPa_YkgrPcallBack() {}
@ -67,22 +50,10 @@ public:
}
}
void set_mtx() {
camera_class* iVar1 = dComIfGp_getCamera(0);
cXyz local_28;
current.pos = *fopCamM_GetEye_p(iVar1);
dKyr_get_vectle_calc(&iVar1->lookat.eye, &iVar1->lookat.center, &local_28);
current.angle.y = cM_atan2s(local_28.x, local_28.z);
current.angle.x = -cM_atan2s(
local_28.y, JMAFastSqrt((local_28.x * local_28.x + local_28.z * local_28.z)));
mDoMtx_stack_c::transS(current.pos.x, current.pos.y,
current.pos.z);
mDoMtx_stack_c::YrotM(current.angle.y);
mDoMtx_stack_c::XrotM(current.angle.x);
MTXCopy(mDoMtx_stack_c::get(), field_0x570);
}
inline void set_mtx();
int _create();
int _delete();
int _execute();
int _draw();

View File

@ -15,7 +15,7 @@
#include "d/d_com_inf_game.h" // IWYU pragma: export
#include "d/d_bg_w.h" // IWYU pragma: export
#include "m_Do/m_Do_graphic.h" // IWYU pragma: export
#include "JSystem/J2DGraph/J2DOrthograph.h" // IWYU pragma: export
#include "JSystem/J2DGraph/J2DOrthoGraph.h" // IWYU pragma: export
#include "JSystem/J2DGraph/J2DPane.h" // IWYU pragma: export
#include "JSystem/J2DGraph/J2DPictureEx.h" // IWYU pragma: export
#include "JSystem/J2DGraph/J2DScreen.h" // IWYU pragma: export

View File

@ -1,6 +1,7 @@
#ifndef MSL_MATH_H_
#define MSL_MATH_H_
#include "global.h"
#include "float.h"
#define NAN (*(float*) __float_nan)
@ -68,6 +69,11 @@ double sqrt(double);
double tan(double);
float tanf(float);
#if PLATFORM_SHIELD
inline float sqrtf(float mag) {
return sqrt(mag);
}
#else
inline float sqrtf(float mag) {
static const double _half = 0.5;
static const double _three = 3.0;
@ -85,6 +91,7 @@ inline float sqrtf(float mag) {
return mag;
}
}
#endif
inline float atan2f(float y, float x) {
return (float)atan2(y, x);

View File

@ -11,6 +11,38 @@
#include "JSystem/JKernel/JKRHeap.h"
#include "Z2AudioLib/Z2Instances.h"
struct daYkgr_HIO_c : public mDoHIO_entry_c {
daYkgr_HIO_c();
/* 805A8D98 */ virtual ~daYkgr_HIO_c() {}
void genMessage(JORMContext*);
/* 0x04 */ u8 field_0x4;
/* 0x08 */ s32 field_0x8;
/* 0x0C */ s32 field_0xc;
/* 0x10 */ f32 field_0x10;
/* 0x14 */ f32 field_0x14;
/* 0x18 */ f32 field_0x18;
/* 0x1C */ f32 field_0x1c;
/* 0x20 */ f32 field_0x20;
/* 0x24 */ f32 field_0x24;
};
#ifdef DEBUG
void daYkgr_HIO_c::genMessage(JORMContext* ctx) {
ctx->genLabel("竜の山陽炎HIO", 0, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 0x18);
ctx->genSlider("アルファ速度", &field_0xc, 0, 255, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 0x18);
ctx->genCheckBox("アルファチェック", &field_0x4, 0x01, 0, NULL, 0xFFFF, 0xFFFF, 512, 24);
ctx->genSlider("アルファ", &field_0x8, 0, 255, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 0x18);
ctx->genSlider("INDMTX PARAM", &field_0x10, -17.0f, 47.0f, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 0x18);
ctx->genSlider("min_param", &field_0x14, -17.0f, 47.0f, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 0x18);
ctx->genSlider("max_param", &field_0x18, -17.0f, 47.0f, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 0x18);
ctx->genSlider("default_rate", &field_0x1c, 0.0f, 1.0f, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 0x18);
ctx->genSlider("outside_range", &field_0x20, 0.0f, 10000.0f, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 0x18);
ctx->genSlider("inside_range", &field_0x24, 0.0f, 10000.0f, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 0x18);
}
#endif
inline daYkgr_HIO_c::daYkgr_HIO_c() {
field_0x4 = 0;
field_0x8 = 0xff;
@ -45,15 +77,11 @@ void dPa_YkgrPcallBack::setParam(f32 param_1) {
if (param_1 <= -17.0f || param_1 >= 47.0f) return; {
if (param_1 >= 0.0f) {
field_0x1c = param_1;
f32 fVar1 = (param_1 - field_0x1c) * 0.5f + 0.5f;
field_0x4[1][1] = fVar1;
field_0x4[0][0] = fVar1;
field_0x4[0][0] = field_0x4[1][1] = (param_1 - field_0x1c) * 0.5f + 0.5f;
} else {
f32 x = param_1 - 1.0f;
field_0x1c = x;
f32 fVar1 = (x - field_0x1c) * 0.5f + 1.0f;
field_0x4[1][1] = fVar1;
field_0x4[0][0] = fVar1;
param_1 = (param_1 - 1.0f);
field_0x1c = param_1;
field_0x4[0][0] = field_0x4[1][1] = (param_1 - field_0x1c) * 0.5f + 1.0f;
}
field_0x4[0][1] = 0.0f;
field_0x4[0][2] = 0.0f;
@ -69,7 +97,8 @@ static daYkgr_HIO_c l_HIO;
f32 daYkgr_c::getPosRate() {
if (m_path == NULL) {
return 0.0f;
}
}
f32 rate = 0.0f;
f32 dVar11 = FLT_MAX;
cXyz cStack_5c(dComIfGp_getPlayer(0)->current.pos);
dPnt* iVar9 = m_path->m_points;
@ -86,37 +115,36 @@ f32 daYkgr_c::getPosRate() {
} else if (dVar11 < l_HIO.field_0x24) {
dVar11 = l_HIO.field_0x24;
}
f32 y = (l_HIO.field_0x20);
y = (dVar11 - l_HIO.field_0x24) / (y -l_HIO.field_0x24);
return 1.0f - y;
rate = (dVar11 - l_HIO.field_0x24) / (l_HIO.field_0x20 -l_HIO.field_0x24);
rate = 1.0f - rate;
return rate;
}
/* 805A9138-805A9158 000088 0020+00 2/3 0/0 0/0 .bss YkgrCB */
static dPa_YkgrPcallBack YkgrCB;
/* 805A882C-805A8A48 00048C 021C+00 1/0 0/0 0/0 .text daYkgrCreate__FPv */
// NONMATCHING regalloc
inline int daYkgr_c::_create() {
dPath* path;
s32 uVar1 = fopAcM_GetParam(this) ;
uVar1 = (uVar1 >> 0x14) & 0xf;
int uVar1 = u8((fopAcM_GetParam(this) & 0x00F00000) >> 0x14);
fopAcM_SetupActor(this, daYkgr_c);
u32 uVar4 = (fopAcM_GetParam(this) >> 8) & 0xff;
u8 uVar4 = (fopAcM_GetParam(this) & 0x0000FF00) >> 8;
OS_REPORT("pathNo = %d\n", uVar4);
if (uVar4 != 0xff) {
path = dPath_GetRoomPath(uVar4, fopAcM_GetRoomNo(this));
m_path = dPath_GetRoomPath(uVar4, fopAcM_GetRoomNo(this));
} else {
path = NULL;
m_path = NULL;
}
m_path = path;
if (m_emitter == NULL) {
fopAc_ac_c* player = dComIfGp_getPlayer(0);
OS_REPORT("##\n##\n## particle set Ykgr\n##\n##\n");
this->current.pos = player->current.pos;
m_emitter = dComIfGp_particle_set(0x80e2, &this->current.pos, NULL, NULL);
if (m_emitter != NULL) {
m_emitter->setParticleCallBackPtr(&YkgrCB);
YkgrCB.setParam(-3.0f);
} else {
OS_REPORT("エミッターの生成に失敗しました!!\n");
return cPhs_ERROR_e;
}
fopAcM_setStageLayer(this);
@ -133,6 +161,9 @@ inline int daYkgr_c::_create() {
field_0x5a8 = 0.0f;
stop();
}
#ifdef DEBUG
l_HIO.entryHIO("竜の山陽炎");
#endif
} else {
if (uVar1 == 1) {
start();
@ -141,6 +172,9 @@ inline int daYkgr_c::_create() {
}
return cPhs_UNK3_e;
}
OS_REPORT(" alpha = %d\n", m_emitter->getGlobalAlpha());
OS_REPORT(" rate = %3.3f\n", m_emitter->getRate());
OS_REPORT("\n\nfopAcM_GetParam = %x\n\n\n", fopAcM_GetParam(this));
return cPhs_COMPLEATE_e;
}
@ -148,32 +182,41 @@ static int daYkgrCreate(void* i_this) {
return static_cast<daYkgr_c*>(i_this)->_create();
}
/* 805A8A48-805A8A50 0006A8 0008+00 1/0 0/0 0/0 .text daYkgrDelete__FPv */
static int daYkgrDelete(void* param_0) {
inline int daYkgr_c::_delete() {
#ifdef DEBUG
l_HIO.removeHIO();
#endif
return 1;
}
/* 805A8A48-805A8A50 0006A8 0008+00 1/0 0/0 0/0 .text daYkgrDelete__FPv */
static int daYkgrDelete(void* i_this) {
return static_cast<daYkgr_c*>(i_this)->_delete();
}
/* 805A8A50-805A8BBC 0006B0 016C+00 1/0 0/0 0/0 .text daYkgrExecute__FPv */
// NONMATCHING regalloc
inline int daYkgr_c::_execute() {
cLib_addCalc2(&field_0x5a4, m_aim_rate, 0.25f, 0.05f);
cLib_addCalc2(&m_aim_rate, l_HIO.field_0x1c, 0.25f, 0.05f);
cLib_addCalc2(&field_0x5a8, getPosRate(), 0.25f, 0.05f);
f32 fVar4 = field_0x5a8 * 0.5f + field_0x5a4 * 0.5f;
YkgrCB.setParam(fVar4 * l_HIO.field_0x18 + (1.0f - fVar4) * l_HIO.field_0x14);
f32 fVar4 = field_0x5a4 * 0.5f + field_0x5a8 * 0.5f;
f32 tmp = fVar4 * l_HIO.field_0x18 + (1.0f - fVar4) * l_HIO.field_0x14;
YkgrCB.setParam(tmp);
if (m_alpha_flag == 0) {
if (m_alpha != 0) {
if (m_alpha > 0) {
if (m_alpha > l_HIO.field_0xc) {
m_alpha = m_alpha - l_HIO.field_0xc;
} else {
m_alpha = 0;
}
}
} else if (m_alpha < 0xff) {
if (m_alpha < 0xff - l_HIO.field_0xc) {
m_alpha = m_alpha + l_HIO.field_0xc;
} else {
m_alpha = 0xff;
} else {
if (m_alpha < 0xff) {
if (m_alpha < 0xff - l_HIO.field_0xc) {
m_alpha = m_alpha + l_HIO.field_0xc;
} else {
m_alpha = 0xff;
}
}
}
return 1;
@ -183,11 +226,28 @@ static int daYkgrExecute(void* i_this) {
return static_cast<daYkgr_c*>(i_this)->_execute();
}
void daYkgr_c::set_mtx() {
camera_class* iVar1 = dComIfGp_getCamera(0);
cXyz local_28;
cXyz* r29 = fopCamM_GetEye_p(iVar1);
current.pos = *r29;
dKyr_get_vectle_calc(&iVar1->lookat.eye, &iVar1->lookat.center, &local_28);
current.angle.y = (s16)cM_atan2s(local_28.x, local_28.z);
current.angle.x = -cM_atan2s(
local_28.y, JMAFastSqrt((local_28.x * local_28.x + local_28.z * local_28.z)));
mDoMtx_stack_c::transS(current.pos.x, current.pos.y,
current.pos.z);
mDoMtx_stack_c::YrotM(current.angle.y);
mDoMtx_stack_c::XrotM(current.angle.x);
MTXCopy(mDoMtx_stack_c::get(), field_0x570);
}
/* 805A8BBC-805A8D90 00081C 01D4+00 1/0 0/0 0/0 .text daYkgrDraw__FPv */
inline int daYkgr_c::_draw() {
bool rv;
f32 alpha = 255.0f;
if (strcmp(dComIfGp_getStartStageName(), "D_MN04A") == 0) {
f32 alpha = dComIfGs_BossLife_public_Get() / 100.0f;
alpha = dComIfGs_BossLife_public_Get() / 100.0f;
m_alpha = alpha * 255.0f;
if (m_alpha == 0) {
m_alpha++;
@ -199,7 +259,15 @@ inline int daYkgr_c::_draw() {
set_mtx();
if (m_emitter != NULL) {
m_emitter->setGlobalRTMatrix(field_0x570);
m_emitter->setGlobalAlpha(m_alpha);
#ifdef DEBUG
if (l_HIO.field_0x4 != 0) {
m_emitter->setGlobalAlpha(l_HIO.field_0x8);
YkgrCB.setParam(l_HIO.field_0x10);
} else
#endif
{
m_emitter->setGlobalAlpha(m_alpha);
}
}
rv = true;
}
@ -215,11 +283,6 @@ static int daYkgrIsDelete(void* param_0) {
return 1;
}
/* 805A8D98-805A8DF4 0009F8 005C+00 2/1 0/0 0/0 .text __dt__12daYkgr_HIO_cFv */
daYkgr_HIO_c::~daYkgr_HIO_c() {
/* empty function */
}
/* 805A9020-805A9040 -00001 0020+00 1/0 0/0 0/0 .data daYkgrMethodTable */
static actor_method_class daYkgrMethodTable = {
daYkgrCreate,