mirror of
https://github.com/zeldaret/tp
synced 2026-07-11 15:28:38 -04:00
Fix optimization flag for Shield (#3004)
* Fix optimization flag for Shield * Minor debug work * Fix NULL asserts
This commit is contained in:
@@ -49,7 +49,7 @@ void J3DTexture::addResTIMG(u16 newNum, const ResTIMG* newRes) {
|
||||
if (newNum == 0)
|
||||
return;
|
||||
|
||||
J3D_ASSERT_NULLPTR(105, newRes != 0);
|
||||
J3D_ASSERT_NULLPTR(105, newRes != NULL);
|
||||
|
||||
u16 oldNum = mNum;
|
||||
ResTIMG* oldRes = mpRes;
|
||||
|
||||
@@ -207,7 +207,7 @@ void JAWWindow::TWindowText::drawSelf(f32, f32, Mtx* param_3) {
|
||||
MTXConcat(*param_3, mGlobalMtx, stack_48);
|
||||
GXLoadPosMtxImm(stack_48, 0);
|
||||
field_0xfc.setParentAlpha(mColorAlpha);
|
||||
JUT_ASSERT(209, m_pParent != 0);
|
||||
JUT_ASSERT(209, m_pParent != NULL);
|
||||
m_pParent->setMatrix(stack_48);
|
||||
m_pParent->onDraw(&field_0xfc);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ JASAramStream::JASAramStream() {
|
||||
}
|
||||
|
||||
void JASAramStream::init(u32 param_0, u32 param_1, StreamCallback i_callback, void* i_callbackData) {
|
||||
JUT_ASSERT(153, sReadBuffer != 0);
|
||||
JUT_ASSERT(153, sReadBuffer != NULL);
|
||||
field_0x148 = param_0;
|
||||
field_0x14c = param_1;
|
||||
field_0x0c8 = 0.0f;
|
||||
|
||||
@@ -95,7 +95,7 @@ JASBasicBank* JASBNKParser::Ver1::createBasicBank(void const* stream, JKRHeap* h
|
||||
switch (*data++) {
|
||||
case 'Inst': {
|
||||
JASBasicInst* instp = new (heap, 0) JASBasicInst();
|
||||
JUT_ASSERT(187, instp != 0);
|
||||
JUT_ASSERT(187, instp != NULL);
|
||||
u32 count = *data++;
|
||||
for (int j = 0; j < count; j++) {
|
||||
u32 index = *data++;
|
||||
@@ -127,7 +127,7 @@ JASBasicBank* JASBNKParser::Ver1::createBasicBank(void const* stream, JKRHeap* h
|
||||
|
||||
case 'Perc': {
|
||||
JASDrumSet* drump = new (heap, 0) JASDrumSet();
|
||||
JUT_ASSERT(264, drump != 0);
|
||||
JUT_ASSERT(264, drump != NULL);
|
||||
u32 pmap_count = data[1];
|
||||
JUT_ASSERT(268, pmap_count <= 128);
|
||||
u32 count = *data++;
|
||||
|
||||
@@ -49,8 +49,8 @@ bool JASBasicInst::getParam(int param_0, int param_1, JASInstParam* param_2) con
|
||||
|
||||
void JASBasicInst::setKeyRegionCount(u32 count, JKRHeap* param_1) {
|
||||
delete [] mKeymap;
|
||||
mKeymap = new (param_1, 0) TKeymap[count];
|
||||
JUT_ASSERT(114, mKeymap != 0);
|
||||
mKeymap = new (param_1, 0) TKeymap[count];
|
||||
JUT_ASSERT(114, mKeymap != NULL);
|
||||
mKeymapCount = count;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ bool JASPortCmd::addPortCmdOnce() {
|
||||
}
|
||||
|
||||
bool JASPortCmd::setPortCmd(Command func, JASPortArgs* args) {
|
||||
JUT_ASSERT(81, func != 0);
|
||||
JUT_ASSERT(81, func != NULL);
|
||||
if (getSupervisor()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ JASSimpleWaveBank::~JASSimpleWaveBank() {
|
||||
void JASSimpleWaveBank::setWaveTableSize(u32 size, JKRHeap* heap) {
|
||||
delete[] mWaveTable;
|
||||
mWaveTable = new (heap, 0) TWaveHandle[size];
|
||||
JUT_ASSERT(29, mWaveTable != 0);
|
||||
JUT_ASSERT(29, mWaveTable != NULL);
|
||||
mWaveTableSize = size;
|
||||
}
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ void JASTrack::stopSeq() {
|
||||
}
|
||||
|
||||
void JASTrack::start() {
|
||||
JUT_ASSERT(289, mParent != 0);
|
||||
JUT_ASSERT(289, mParent != NULL);
|
||||
JUT_ASSERT(290, mStatus == STATUS_FREE);
|
||||
mStatus = STATUS_RUN;
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ f64 TFunctionValue_composite::composite_raw(TVector_pointer<TFunctionValue*> con
|
||||
}
|
||||
TFunctionValue** p = (TFunctionValue**)param_1.begin();
|
||||
std::advance(p, index);
|
||||
JUT_ASSERT(0x247, p!=0);
|
||||
JUT_ASSERT(0x247, p!=NULL);
|
||||
TFunctionValue* piVar4 = *p;
|
||||
return piVar4->getValue(param_3);
|
||||
}
|
||||
@@ -348,7 +348,7 @@ f64 TFunctionValue_composite::composite_add(TVector_pointer<TFunctionValue*> con
|
||||
TContainerEnumerator_const_TVector<TFunctionValue*> aTStack_18(param_1);
|
||||
while (aTStack_18) {
|
||||
TFunctionValue* const* p = *aTStack_18;
|
||||
JUT_ASSERT(0x2a1, p!=0);
|
||||
JUT_ASSERT(0x2a1, p!=NULL);
|
||||
TFunctionValue* piVar3 = *p;
|
||||
dVar4 += piVar3->getValue(param_3);
|
||||
}
|
||||
@@ -368,7 +368,7 @@ f64 TFunctionValue_composite::composite_subtract(TVector_pointer<TFunctionValue*
|
||||
f64 dVar4 = pFront->getValue(param_3);
|
||||
while (aTStack_18) {
|
||||
TFunctionValue* const* p = *aTStack_18;
|
||||
JUT_ASSERT(0x2b5, p!=0);
|
||||
JUT_ASSERT(0x2b5, p!=NULL);
|
||||
TFunctionValue* piVar3 = *p;
|
||||
dVar4 -= piVar3->getValue(param_3);
|
||||
}
|
||||
@@ -383,7 +383,7 @@ f64 TFunctionValue_composite::composite_multiply(TVector_pointer<TFunctionValue*
|
||||
TContainerEnumerator_const_TVector<TFunctionValue*> aTStack_18(param_1);
|
||||
while (aTStack_18) {
|
||||
TFunctionValue* const* p = *aTStack_18;
|
||||
JUT_ASSERT(0x2c5, p!=0);
|
||||
JUT_ASSERT(0x2c5, p!=NULL);
|
||||
TFunctionValue* piVar3 = *p;
|
||||
dVar4 *= piVar3->getValue(param_3);
|
||||
}
|
||||
@@ -403,7 +403,7 @@ f64 TFunctionValue_composite::composite_divide(TVector_pointer<TFunctionValue*>
|
||||
TValue fData = pFront->getValue(param_3);
|
||||
while (aTStack_18) {
|
||||
TFunctionValue* const* p = *aTStack_18;
|
||||
JUT_ASSERT(0x2d9, p!=0);
|
||||
JUT_ASSERT(0x2d9, p!=NULL);
|
||||
TFunctionValue* piVar3 = *p;
|
||||
fData /= piVar3->getValue(param_3);
|
||||
JGADGET_ASSERTWARN(0x2db, fData!=TValue(0));
|
||||
|
||||
@@ -374,14 +374,14 @@ void TFactory::destroy(TObject* pObject) {
|
||||
}
|
||||
|
||||
TParse::TParse(TControl* pControl) : pControl_(pControl) {
|
||||
ASSERT(pControl_ != 0);
|
||||
ASSERT(pControl_ != NULL);
|
||||
}
|
||||
|
||||
TParse::~TParse() {}
|
||||
|
||||
bool TParse::parseHeader_next(void const** ppData_inout, u32* puBlock_out, u32 flags) {
|
||||
ASSERT(ppData_inout != 0);
|
||||
ASSERT(puBlock_out != 0);
|
||||
ASSERT(ppData_inout != NULL);
|
||||
ASSERT(puBlock_out != NULL);
|
||||
|
||||
const void* pData = *ppData_inout;
|
||||
ASSERT(pData != NULL);
|
||||
@@ -415,8 +415,8 @@ bool TParse::parseHeader_next(void const** ppData_inout, u32* puBlock_out, u32 f
|
||||
}
|
||||
|
||||
bool TParse::parseBlock_next(void const** ppData_inout, u32* puData_out, u32 flags) {
|
||||
ASSERT(ppData_inout != 0);
|
||||
ASSERT(puData_out != 0);
|
||||
ASSERT(ppData_inout != NULL);
|
||||
ASSERT(puData_out != NULL);
|
||||
|
||||
const void* pData = *ppData_inout;
|
||||
ASSERT(pData != NULL);
|
||||
@@ -425,7 +425,7 @@ bool TParse::parseBlock_next(void const** ppData_inout, u32* puData_out, u32 fla
|
||||
*puData_out = blk.get_size();
|
||||
|
||||
TControl* pControl = getControl();
|
||||
ASSERT(pControl != 0);
|
||||
ASSERT(pControl != NULL);
|
||||
|
||||
if (flags & 0x10) {
|
||||
if (pControl->getObject(blk.get_ID(), blk.get_IDSize()) != NULL)
|
||||
|
||||
@@ -943,7 +943,7 @@ bool daNpcAshB_c::demo(void* param_0) {
|
||||
s32 staff_id = evtmgr.getMyStaffId(l_myName, NULL, 0);
|
||||
if (staff_id != -1) {
|
||||
mStaffID = staff_id;
|
||||
JUT_ASSERT(1523, mEvtSeqList[mOrderEvtNo] != 0);
|
||||
JUT_ASSERT(1523, mEvtSeqList[mOrderEvtNo] != NULL);
|
||||
if ((this->*(mEvtSeqList[mOrderEvtNo]))(staff_id)) {
|
||||
evtmgr.cutEnd(staff_id);
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ int useHeapInit(fopAc_ac_c* i_this) {
|
||||
J3DModelData* modelData =
|
||||
static_cast<J3DModelData*>(dComIfG_getObjectRes("Obj_Bef", bef_bmd[a_this->mEffectType]));
|
||||
|
||||
JUT_ASSERT(339, modelData != 0);
|
||||
JUT_ASSERT(339, modelData != NULL);
|
||||
|
||||
a_this->mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084);
|
||||
|
||||
|
||||
@@ -349,11 +349,13 @@ static int daItemShield_Execute(daItemShield_c* i_this) {
|
||||
}
|
||||
|
||||
static int daItemShield_Delete(daItemShield_c* i_this) {
|
||||
fopAcM_RegisterDeleteID(i_this, "ObjSShield");
|
||||
return i_this->_delete();
|
||||
}
|
||||
|
||||
static int daItemShield_Create(fopAc_ac_c* i_this) {
|
||||
return static_cast<daItemShield_c*>(i_this)->create();
|
||||
fopAcM_RegisterCreateID(daItemShield_c, i_this, "ObjSShield");
|
||||
return a_this->create();
|
||||
}
|
||||
|
||||
static actor_method_class l_daItemShield_Method = {
|
||||
|
||||
@@ -59,17 +59,20 @@ static int daTagWatchGe_Delete(daTagWatchGe_c* i_this) {
|
||||
|
||||
int daTagWatchGe_c::create() {
|
||||
fopAcM_ct(this, daTagWatchGe_c);
|
||||
OS_REPORT("Tag_WatchGe PARAM %x\n", fopAcM_GetParam(this));
|
||||
mGroupNo = fopAcM_GetParam(this);
|
||||
|
||||
if (mGroupNo == 0xFF) {
|
||||
OS_REPORT("監視するグェーのグループが指定されてません!");
|
||||
return cPhs_ERROR_e;
|
||||
} else {
|
||||
field_0x568 = fopAcM_GetParam(this) >> 8;
|
||||
field_0x568 = (fopAcM_GetParam(this) >> 8) & 0xFF;
|
||||
|
||||
if (field_0x568 == 0xFF) {
|
||||
OS_REPORT("グェー監視タグのスイッチが指定されてません!");
|
||||
return cPhs_ERROR_e;
|
||||
}
|
||||
if (dComIfGs_isSwitch(field_0x568,fopAcM_GetRoomNo(this)) != 0) {
|
||||
if (dComIfGs_isSwitch(field_0x568, fopAcM_GetRoomNo(this)) != 0) {
|
||||
return cPhs_ERROR_e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,6 +117,7 @@ int daTitle_c::create() {
|
||||
field_0x5f9 = 0;
|
||||
|
||||
m2DHeap = JKRExpHeap::create(0x8000, mDoExt_getGameHeap(), false);
|
||||
JUT_ASSERT(345, m2DHeap != NULL);
|
||||
loadWait_init();
|
||||
g_daTitHIO.field_0x4 = -1;
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ bool dMpath_HIO_file_base_c::readBinaryFile(const char* param_1) {
|
||||
if (file.open(JORFile::EFlags_READ, r26, NULL, NULL, NULL)) {
|
||||
s32 r28 = file.getFileSize();
|
||||
char* buf = new char[r28];
|
||||
JUT_ASSERT(855, buf != 0);
|
||||
JUT_ASSERT(855, buf != NULL);
|
||||
file.readData(buf, r28);
|
||||
copyReadBufToData(buf, r28);
|
||||
OSReport("write read success!::%6d\n", r28);
|
||||
|
||||
@@ -189,7 +189,7 @@ dMenu_Fmap_c::dMenu_Fmap_c(JKRExpHeap* i_heap, STControl* i_stick, CSTControl* i
|
||||
}
|
||||
|
||||
mpTalkHeap = JKRCreateExpHeap(0x32000, mpHeap, false);
|
||||
JUT_ASSERT(359, mpTalkHeap != 0);
|
||||
JUT_ASSERT(359, mpTalkHeap != NULL);
|
||||
field_0x200 = 0;
|
||||
mIsWarpMap = false;
|
||||
|
||||
|
||||
+27
-2
@@ -831,17 +831,42 @@ u32 mDoExt_adjustSolidHeap(JKRSolidHeap* i_heap) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
u32 estimatedSize = i_heap->getHeapSize();
|
||||
s32 result = i_heap->adjustSize();
|
||||
if (result < 0) {
|
||||
// "adjustSize failure %08x\n"
|
||||
OSReport_Error("adjustSize失敗 %08x\n", i_heap);
|
||||
return -1;
|
||||
}
|
||||
u32 actualSize = i_heap->getHeapSize();
|
||||
|
||||
#if DEBUG
|
||||
if (lbl_8074C3B9[0]) {
|
||||
// "\x1B[33mSolid heap estimate: %08x actual: %08x\n\x1B[m"
|
||||
OS_REPORT("\x1B[33mソリッドヒープの見積もり %08x 実際 %08x\n\x1B[m", estimatedSize, actualSize);
|
||||
|
||||
if (estimatedSize > 0x400 && estimatedSize > (actualSize + 0x400)) {
|
||||
// "\x1B[33mThe estimate is %x bytes too large (%5.2f times). This could lead to degraded memory efficiency.\n\x1B[m"
|
||||
OS_REPORT("\x1B[33m見積もりが %x バイト大きい(%5.2f倍)です。メモリ効率悪化が懸念されます。\n\x1B[m", estimatedSize - actualSize, (f32)estimatedSize / (f32)actualSize);
|
||||
} else if (estimatedSize >= (actualSize + 0x20)) {
|
||||
// "\x1B[36mThe estimate is %x bytes too large. That's pretty good.\n\x1B[m"
|
||||
OS_REPORT("\x1B[36m見積もりが %x バイト大きいです。だいぶいい感じです。\n\x1B[m", estimatedSize - actualSize);
|
||||
} else {
|
||||
// "\x1B[32mThe estimate is spot on! Perfect.\n\x1B[m"
|
||||
OS_REPORT("\x1B[32m見積もりが、ジャストミート!完璧です。\n\x1B[m");
|
||||
}
|
||||
}
|
||||
|
||||
if (lbl_8074C3B9[0]) {
|
||||
OS_REPORT("JKRSolidHeap::adjustSize %08x (%08x bytes)\n", (u32)i_heap, result);
|
||||
}
|
||||
#endif
|
||||
|
||||
// this probably indicates that 0x80 is some constant, maybe from a sizeof(JKRSolidHeap)
|
||||
// with alignment?
|
||||
if (result >= (u32)0x80) {
|
||||
result -= 0x80;
|
||||
u32 r25 = 0x80;
|
||||
if (result >= r25) {
|
||||
return result - r25;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user