various crash fixes

This commit is contained in:
TakaRikka
2026-03-21 05:07:51 -07:00
parent 1e79756929
commit ef0f9ef7fd
4 changed files with 29 additions and 1 deletions
+9
View File
@@ -338,6 +338,10 @@ static s16 s_TargetAngle;
void daE_PM_c::SearchFarP() {
//! @bug best_distance is not initialized
f32 best_distance;
#if AVOID_UB
best_distance = 0.0f;
#endif
int best_index;
dPnt* pnt = dPath_GetPnt(mpPath, 0);
Vec pos;
@@ -2652,6 +2656,11 @@ void daE_PM_c::setGakkiBaseMtx() {
void daE_PM_c::setLampBaseMtx() {
cXyz vec1, vec2;
#if AVOID_UB
vec1.set(0, 0, 0);
vec2.set(0, 0, 0);
#endif
MTXCopy(mpMorf->getModel()->getAnmMtx(JNT_HAND_R), *calc_mtx);
cXyz vec3(0.0f, -30.0f, -5.0f);
//! @bug vec1 is not initialized in its first two uses, which are probably supposed to be vec3
+4
View File
@@ -510,6 +510,10 @@ dFlower_packet_c::dFlower_packet_c() {
}
m_deleteRoom = &dFlower_packet_c::deleteRoom;
#if AVOID_UB
m_playerSwordTop.set(0, 0, 0);
#endif
}
void dFlower_packet_c::draw() {
+6 -1
View File
@@ -2080,7 +2080,12 @@ void dComIfGp_createSubExpHeap2D() {
if (dComIfGp_getSubExpHeap2D(i) == NULL) {
JKRExpHeap* i_heap = JKRCreateExpHeap(size, dComIfGp_getExpHeap2D(), false);
JUT_ASSERT(3576, i_heap != NULL);
JKRHEAP_NAMEF(i_heap, "SubExpHeap2D %d", i);
#if TARGET_PC
if (i_heap != NULL) {
JKRHEAP_NAMEF(i_heap, "SubExpHeap2D %d", i);
}
#endif
dComIfGp_setSubExpHeap2D(i, i_heap);
}
}
+10
View File
@@ -514,6 +514,11 @@ void exceptionRestart() {
}
void myExceptionCallback(u16, OSContext*, u32, u32) {
#if TARGET_PC
printf("myExceptionCallback abort");
abort();
#endif
u32 btnHold;
u32 btnTrig;
@@ -971,8 +976,13 @@ int mDoMch_Create() {
sysConsole->setPosition(16, 42);
JUTException::setMapFile(MAP_FOLDER MAP_FILE);
#if TARGET_PC
JUTException::setPreUserCallback(nullptr);
JUTException::setPostUserCallback(nullptr);
#else
JUTException::setPreUserCallback(myExceptionCallback);
JUTException::setPostUserCallback(fault_callback_scroll);
#endif
cMl::init(mDoExt_getZeldaHeap());
cM_initRnd(100, 100, 100);