Merge branch 'tphd' into depth-bias-poc-hack

This commit is contained in:
MelonSpeedruns
2026-05-25 14:43:25 -04:00
171 changed files with 3520 additions and 1066 deletions
@@ -8,6 +8,8 @@
#include <cstring>
#include <types.h>
#include "dusk/string.hpp"
J2DMaterialFactory::J2DMaterialFactory(J2DMaterialBlock const& param_0) {
mMaterialNum = param_0.field_0x8;
mpMaterialInitData = JSUConvertOffsetToPtr<J2DMaterialInitData>(&param_0, param_0.field_0xc);
@@ -92,7 +94,7 @@ J2DMaterial* J2DMaterialFactory::create(J2DMaterial* param_0, int index, u32 par
}
if (local_380 == NULL && J2DScreen::getDataManage() != NULL) {
char acStack_230[257];
strcpy(acStack_230, param_3->getName(texNo));
SAFE_STRCPY(acStack_230, param_3->getName(texNo));
local_380 = J2DScreen::getDataManage()->get(acStack_230);
}
}
@@ -111,7 +113,7 @@ J2DMaterial* J2DMaterialFactory::create(J2DMaterial* param_0, int index, u32 par
}
if (local_388 == NULL && J2DScreen::getDataManage() != NULL) {
char acStack_334[257];
strcpy(acStack_334, param_4->getName(param_0->getTevBlock()->getFontNo()));
SAFE_STRCPY(acStack_334, param_4->getName(param_0->getTevBlock()->getFontNo()));
local_388 = J2DScreen::getDataManage()->get(acStack_334);
}
}
+6 -2
View File
@@ -309,8 +309,12 @@ void J2DTextBox::draw(f32 posX, f32 posY, f32 param_2, J2DTextBoxHBinding hBind)
}
}
char* J2DTextBox::getStringPtr() const {
TEXT_SPAN J2DTextBox::getStringPtr() const {
#if TARGET_PC
return { mStringPtr, mStringLength };
#else
return mStringPtr;
#endif
}
s32 J2DTextBox::setString(char const* string, ...) {
@@ -330,7 +334,7 @@ s32 J2DTextBox::setString(char const* string, ...) {
if (mStringPtr) {
mStringLength = len + 1;
strcpy(mStringPtr, string);
SAFE_STRCPY_BOUNDED(mStringPtr, mStringLength, string);
}
va_end(args);
+3 -1
View File
@@ -2,6 +2,8 @@
#include <JSystem/JUtility/JUTAssert.h>
#include <cstring>
#include "dusk/string.hpp"
u32 JAHVirtualNode::smVirNodeNum;
void JAHVirtualNode::virtualMessage(JAHControl& control) {
@@ -77,7 +79,7 @@ void JAHVirtualNode::setVirNodeName(const char* name) {
// clang-format off
JUT_ASSERT(141, size<32);
// clang-format on
strcpy(mName, name);
SAFE_STRCPY(mName, name);
}
JAHVirtualNode::JAHVirtualNode(const char* name) : mTree(this) {
+3 -1
View File
@@ -4,7 +4,9 @@
#include "JSystem/JAHostIO/JAHioMessage.h"
#include "JSystem/JAHostIO/JAHioMgr.h"
#include "JSystem/JAHostIO/JAHioNode.h"
#include "JSystem/JHostIO/JORServer.h"
#include "dusk/string.hpp"
JAHioNode* JAHioNode::smCurrentNode;
@@ -32,7 +34,7 @@ void JAHioNode::updateNode() {
void JAHioNode::setNodeName(const char* name) {
int size = strlen(name) + 1;
JUT_ASSERT(51, size < 32);
strcpy(mName, name);
SAFE_STRCPY(mName, name);
}
void JAHioNode::genMessage(JORMContext* mctx) {
@@ -9,6 +9,8 @@
#include <os.h>
#include <stdint.h>
#include "dusk/string.hpp"
JASHeap* JASWaveArcLoader::sAramHeap;
JASHeap* JASWaveArcLoader::getRootHeap() {
@@ -22,7 +24,7 @@ char JASWaveArcLoader::sCurrentDir[DIR_MAX] = "/AudioRes/Waves/";
void JASWaveArcLoader::setCurrentDir(char const* dir) {
JUT_ASSERT(40, std::strlen(dir) < DIR_MAX - 1);
strcpy(sCurrentDir, dir);
SAFE_STRCPY(sCurrentDir, dir);
u32 len = strlen(sCurrentDir);
if (sCurrentDir[len - 1] != '/') {
JUT_ASSERT(45, len + 1 < DIR_MAX);
@@ -170,8 +172,8 @@ void JASWaveArc::setFileName(char const* fileName) {
length = length + strlen(fileName);
char* path = JKR_NEW_ARRAY_ARGS(char, length + 1, JASKernel::getSystemHeap(), -4);
JUT_ASSERT(322, path);
strcpy(path, currentDir);
strcat(path, fileName);
SAFE_STRCPY_BOUNDED(path, length + 1, currentDir);
SAFE_STRCAT_BOUNDED(path, length + 1, fileName);
path[length] = '\0';
int entryNum = DVDConvertPathToEntrynum(path);
JKR_DELETE_ARRAY(path);
@@ -8,6 +8,7 @@
#include <cctype>
#include <cstring>
#include "dusk/string.hpp"
#include "global.h"
JKRFileCache* JKRFileCache::mount(const char* path, JKRHeap* heap, const char* param_3) {
+3 -2
View File
@@ -4,10 +4,11 @@
#define MSL_USE_INLINES 1 // needed to inline tolower call. not inlined elsewhere in the repo
#include <cstring>
#include <cctype>
#include <cstring>
#include <string>
#include "JSystem/JKernel/JKRHeap.h"
#include "dusk/string.hpp"
#include "global.h"
JKRFileLoader* JKRFileLoader::sCurrentVolume;
@@ -104,7 +105,7 @@ const char* JKRFileLoader::fetchVolumeName(char* buffer, s32 bufferSize, const c
static char rootPath[2] = "/";
if (strcmp(path, "/") == 0) {
strcpy(buffer, rootPath);
SAFE_STRCPY_BOUNDED(buffer, bufferSize, rootPath);
return rootPath;
}
+3 -1
View File
@@ -7,6 +7,8 @@
#include "global.h"
#include <stdint.h>
#include "dusk/string.hpp"
#if TARGET_PC
#include "dusk/os.h"
#endif
@@ -274,7 +276,7 @@ void JKRThreadSwitch::draw(JKRThreadName_* thread_name_list, JUTConsole* console
if (!thread_print_name) {
char buffer[16];
sprintf(buffer, "%d", loadInfo->getId());
SAFE_SPRINTF(buffer, "%d", loadInfo->getId());
thread_print_name = buffer;
}
@@ -76,6 +76,7 @@ void JPARegistAlpha(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
}
void JPARegistPrmAlpha(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
ZoneScoped;
JPABaseEmitter* emtr = work->mpEmtr;
GXColor prm = ptcl->mPrmClr;
prm.r = COLOR_MULTI(prm.r, emtr->mGlobalPrmClr.r);
@@ -87,6 +88,7 @@ void JPARegistPrmAlpha(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
}
void JPARegistPrmAlphaEnv(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
ZoneScoped;
JPABaseEmitter* emtr = work->mpEmtr;
GXColor prm = ptcl->mPrmClr;
GXColor env = ptcl->mEnvClr;
@@ -225,6 +227,7 @@ void JPAGenTexCrdMtxPrj(JPAEmitterWorkData* param_0) {
}
void JPAGenCalcTexCrdMtxAnm(JPAEmitterWorkData* work) {
ZoneScoped;
JPABaseShape* shape = work->mpRes->getBsp();
f32 dVar16 = work->mpEmtr->mTick;
f32 dVar15 = 0.5f * (1.0f + shape->getTilingS());
@@ -256,6 +259,7 @@ void JPAGenCalcTexCrdMtxAnm(JPAEmitterWorkData* work) {
}
void JPALoadCalcTexCrdMtxAnm(JPAEmitterWorkData* work, JPABaseParticle* param_1) {
ZoneScoped;
JPABaseShape* shape = work->mpRes->getBsp();
f32 dVar16 = param_1->mAge;
f32 dVar15 = 0.5f * (1.0f + shape->getTilingS());
@@ -286,14 +290,17 @@ void JPALoadCalcTexCrdMtxAnm(JPAEmitterWorkData* work, JPABaseParticle* param_1)
}
void JPALoadTex(JPAEmitterWorkData* work) {
ZoneScoped;
work->mpResMgr->load(work->mpRes->getTexIdx(work->mpRes->getBsp()->getTexIdx()), GX_TEXMAP0);
}
void JPALoadTexAnm(JPAEmitterWorkData* work) {
ZoneScoped;
work->mpResMgr->load(work->mpRes->getTexIdx(work->mpEmtr->mTexAnmIdx), GX_TEXMAP0);
}
void JPALoadTexAnm(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
ZoneScoped;
work->mpResMgr->load(work->mpRes->getTexIdx(ptcl->mTexAnmIdx), GX_TEXMAP0);
}
@@ -446,6 +453,7 @@ void JPADrawBillboard(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
return;
}
ZoneScoped;
JGeometry::TVec3<f32> pos;
#if TARGET_PC
Mtx ptclPosMtx;
@@ -475,6 +483,7 @@ void JPADrawRotBillboard(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
return;
}
ZoneScoped;
if (work->mpRes->getUsrIdx() == 0x89d7) {
int a = 0;
}
@@ -518,6 +527,7 @@ void JPADrawYBillboard(JPAEmitterWorkData* work, JPABaseParticle* param_1) {
return;
}
ZoneScoped;
JGeometry::TVec3<f32> local_48;
MTXMultVec(work->mPosCamMtx, &param_1->mPosition, &local_48);
Mtx local_38;
@@ -542,6 +552,7 @@ void JPADrawRotYBillboard(JPAEmitterWorkData* work, JPABaseParticle* param_1) {
return;
}
ZoneScoped;
JGeometry::TVec3<f32> local_48;
MTXMultVec(work->mPosCamMtx, &param_1->mPosition, &local_48);
f32 sinRot = JMASSin(param_1->mRotateAngle);
@@ -1268,6 +1279,8 @@ void JPADrawStripeX(JPAEmitterWorkData* param_0) {
}
void JPADrawEmitterCallBackB(JPAEmitterWorkData* work) {
ZoneScoped;
JPABaseEmitter* emtr = work->mpEmtr;
if (emtr->mpEmtrCallBack == NULL) {
return;
@@ -1282,6 +1295,7 @@ void JPADrawParticleCallBack(JPAEmitterWorkData* work, JPABaseParticle* ptcl) {
return;
}
ZoneScoped;
emtr->mpPtclCallBack->draw(emtr, ptcl);
}
@@ -6,6 +6,8 @@
#include <gx.h>
void JPALoadExTex(JPAEmitterWorkData* work) {
ZoneScoped;
JPAExTexShape* ets = work->mpRes->getEts();
GXTexCoordID secTexCoordID = GX_TEXCOORD1;
+6 -5
View File
@@ -1,13 +1,14 @@
#include "JSystem/JSystem.h" // IWYU pragma: keep
#include "JSystem/JUtility/JUTConsole.h"
#include <cstdio>
#include <vi.h>
#include "JSystem/J2DGraph/J2DOrthoGraph.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "JSystem/JUtility/JUTConsole.h"
#include "JSystem/JUtility/JUTDirectPrint.h"
#include "JSystem/JUtility/JUTVideo.h"
#include <vi.h>
#include <cstdio>
#include "dusk/string.hpp"
#include "global.h"
JUTConsoleManager* JUTConsoleManager::sManager;
@@ -204,10 +205,10 @@ void JUTConsole::doDraw(JUTConsole::EConsoleType consoleType) const {
mFont->drawString_scale((int)f31, sp94, mFontSizeX, mFontSizeY, spA8, TRUE);
f31 += mFontSizeX * 13.0f;
if (sp88) {
sprintf(spB8, "ALL");
SAFE_SPRINTF(spB8, "ALL");
} else {
f32 f29 = sp8C / (f32)(sp90 - mHeight);
sprintf(spB8, "%3d%%(%dL)", (int)(100.0 * f29), sp90);
SAFE_SPRINTF(spB8, "%3d%%(%dL)", (int)(100.0 * f29), sp90);
}
mFont->drawString_scale(f31, sp94, mFontSizeX, mFontSizeY, spB8, TRUE);
}
+4 -2
View File
@@ -9,6 +9,8 @@
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include "dusk/string.hpp"
#ifdef __REVOLUTION_SDK__
#include <revolution.h>
#else
@@ -845,8 +847,8 @@ bool JUTException::queryMapAddress(char* mapPath, u32 address, s32 section_id, u
bool begin_with_newline) {
if (mapPath) {
char buffer[80];
strcpy(buffer, mapPath);
strcat(buffer, ".map");
SAFE_STRCPY(buffer, mapPath);
SAFE_STRCAT(buffer, ".map");
if (queryMapAddress_single(buffer, address, section_id, out_addr, out_size, out_line,
line_length, print, begin_with_newline) == true)
{