mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-29 23:27:25 -04:00
Merge branch 'main' into 26-03-28-movie-player
This commit is contained in:
@@ -134,12 +134,13 @@ void J3DLoadCPCmd(u8 addr, u32 val) {
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
static void J3DLoadArrayBasePtr(GXAttr attr, void* data, u32 size) {
|
||||
static void J3DLoadArrayBasePtr(GXAttr attr, void* data, u32 size, bool le) {
|
||||
u32 idx = (attr == GX_VA_NBT) ? 1 : (attr - GX_VA_POS);
|
||||
GXCmd1u8(GX_LOAD_AURORA);
|
||||
GXCmd1u16(GX_LOAD_AURORA_ARRAYBASE | idx);
|
||||
GXCmd1u64((u64)data);
|
||||
GXCmd1u64((u64)size);
|
||||
GXCmd1u32(size);
|
||||
GXCmd1u8(le ? 1 : 0);
|
||||
}
|
||||
#else
|
||||
static void J3DLoadArrayBasePtr(GXAttr attr, void* data) {
|
||||
@@ -152,15 +153,15 @@ void J3DShape::loadVtxArray() const {
|
||||
#if TARGET_PC
|
||||
// TODO: these can very easily overcount if the data isn't in F32 format
|
||||
if (j3dSys.getVtxPos() != mVertexData->getVtxPosArray()) {
|
||||
J3DLoadArrayBasePtr(GX_VA_POS, j3dSys.getVtxPos(), j3dSys.mVtxPosNum * sizeof(Vec));
|
||||
J3DLoadArrayBasePtr(GX_VA_POS, j3dSys.getVtxPos(), j3dSys.mVtxPosNum * sizeof(Vec), true);
|
||||
}
|
||||
|
||||
if (!mHasNBT && j3dSys.getVtxNrm() != mVertexData->getVtxNrmArray()) {
|
||||
J3DLoadArrayBasePtr(GX_VA_NRM, j3dSys.getVtxNrm(), j3dSys.mVtxNrmNum * sizeof(Vec));
|
||||
J3DLoadArrayBasePtr(GX_VA_NRM, j3dSys.getVtxNrm(), j3dSys.mVtxNrmNum * sizeof(Vec), true);
|
||||
}
|
||||
|
||||
if (j3dSys.getVtxCol() != mVertexData->getVtxColorArray(0)) {
|
||||
J3DLoadArrayBasePtr(GX_VA_CLR0, j3dSys.getVtxCol(), j3dSys.mVtxColNum * sizeof(GXColor));
|
||||
J3DLoadArrayBasePtr(GX_VA_CLR0, j3dSys.getVtxCol(), j3dSys.mVtxColNum * sizeof(GXColor), true);
|
||||
}
|
||||
#else
|
||||
J3DLoadArrayBasePtr(GX_VA_POS, j3dSys.getVtxPos());
|
||||
@@ -257,9 +258,9 @@ void J3DShape::makeVtxArrayCmd() {
|
||||
for (u32 i = 0; i < 12; i++) {
|
||||
GXAttr attr = GXAttr(i + GX_VA_POS);
|
||||
if (array[i] != nullptr)
|
||||
GDSetArraySized(attr, array[i], mVertexData->getVtxArrByteSize(attr), mVertexData->getVtxArrStride(attr));
|
||||
GDSetArraySized(attr, array[i], mVertexData->getVtxArrByteSize(attr), mVertexData->getVtxArrStride(attr), true);
|
||||
else
|
||||
GDSetArraySized(attr, nullptr, 0, mVertexData->getVtxArrStride(attr));
|
||||
GDSetArraySized(attr, nullptr, 0, mVertexData->getVtxArrStride(attr), true);
|
||||
}
|
||||
#else
|
||||
for (u32 i = 0; i < 12; i++) {
|
||||
|
||||
@@ -276,7 +276,7 @@ bool isTexNoReg(void* pDL) {
|
||||
}
|
||||
|
||||
u16 getTexNoReg(void* pDL) {
|
||||
u32 var_r31 = *(u32*)((u8*)pDL + 1);
|
||||
u32 var_r31 = *(BE(u32)*)((u8*)pDL + 1);
|
||||
return var_r31 & 0xFFFFFF;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,29 +6,29 @@
|
||||
#include "JSystem/JGeometry.h"
|
||||
|
||||
JAWWindow::JAWWindow(const char* param_1, int param_2, int param_3) :
|
||||
field_0x38('WIN1', JGeometry::TBox2<f32>(0.0f, 0.0f, param_2, param_3), "frame_lu.bti"),
|
||||
field_0x180('TITL', JGeometry::TBox2<f32>(10.0f, 10.0f, 640.0f, 170.0f), (const ResFONT*)JUTResFONT_Ascfont_fix16, param_1, -1, HBIND_LEFT, VBIND_TOP),
|
||||
field_0x2b0(this),
|
||||
field_0x3d8(JUtility::TColor(0, 0, 0, 255)),
|
||||
field_0x3dc(JUtility::TColor(0, 0, 0, 255)),
|
||||
field_0x3e0(JUtility::TColor(0, 0, 0, 255)),
|
||||
field_0x3e4(JUtility::TColor(0, 0, 0, 255)) {
|
||||
m_drawWindow('WIN1', JGeometry::TBox2<f32>(0.0f, 0.0f, param_2, param_3), "frame_lu.bti"),
|
||||
m_titleText('TITL', JGeometry::TBox2<f32>(10.0f, 10.0f, 640.0f, 170.0f), (const ResFONT*)JUTResFONT_Ascfont_fix16, param_1, -1, HBIND_LEFT, VBIND_TOP),
|
||||
m_windowText(this),
|
||||
m_windowColor0(JUtility::TColor(0, 0, 0, 255)),
|
||||
m_windowColor1(JUtility::TColor(0, 0, 0, 255)),
|
||||
m_windowColor2(JUtility::TColor(0, 0, 0, 255)),
|
||||
m_windowColor3(JUtility::TColor(0, 0, 0, 255)) {
|
||||
field_0x3e8 = 0;
|
||||
field_0x3ec = 0;
|
||||
field_0x38.setContentsColor(field_0x3d8, field_0x3e0, field_0x3dc, field_0x3e4);
|
||||
field_0x180.setCharColor(JUtility::TColor(0, 255, 0, 255));
|
||||
field_0x180.setGradColor(JUtility::TColor(255, 255, 255, 255));
|
||||
field_0x38.appendChild(&field_0x180);
|
||||
field_0x38.appendChild(&field_0x2b0);
|
||||
m_isInit = FALSE;
|
||||
m_drawWindow.setContentsColor(m_windowColor0, m_windowColor2, m_windowColor1, m_windowColor3);
|
||||
m_titleText.setCharColor(JUtility::TColor(0, 255, 0, 255));
|
||||
m_titleText.setGradColor(JUtility::TColor(255, 255, 255, 255));
|
||||
m_drawWindow.appendChild(&m_titleText);
|
||||
m_drawWindow.appendChild(&m_windowText);
|
||||
}
|
||||
|
||||
JAWWindow::~JAWWindow() {}
|
||||
|
||||
BOOL JAWWindow::initIf() {
|
||||
if (field_0x3ec) {
|
||||
if (m_isInit) {
|
||||
return TRUE;
|
||||
} else {
|
||||
field_0x3ec = TRUE;
|
||||
m_isInit = TRUE;
|
||||
return onInit();
|
||||
}
|
||||
}
|
||||
@@ -36,30 +36,30 @@ BOOL JAWWindow::initIf() {
|
||||
BOOL JAWWindow::onInit() { return TRUE; }
|
||||
|
||||
void JAWWindow::setTitleColor(const JUtility::TColor& param_1, const JUtility::TColor& param_2) {
|
||||
field_0x180.setCharColor(param_1);
|
||||
field_0x180.setGradColor(param_2);
|
||||
m_titleText.setCharColor(param_1);
|
||||
m_titleText.setGradColor(param_2);
|
||||
}
|
||||
|
||||
void JAWWindow::setWindowColor(const JUtility::TColor& param_1, const JUtility::TColor& param_2, const JUtility::TColor& param_3, const JUtility::TColor& param_4) {
|
||||
field_0x3d8 = param_1;
|
||||
field_0x3dc = param_2;
|
||||
field_0x3e0 = param_3;
|
||||
field_0x3e4 = param_4;
|
||||
field_0x38.setContentsColor(field_0x3d8, field_0x3e0, field_0x3dc, field_0x3e4);
|
||||
m_windowColor0 = param_1;
|
||||
m_windowColor1 = param_2;
|
||||
m_windowColor2 = param_3;
|
||||
m_windowColor3 = param_4;
|
||||
m_drawWindow.setContentsColor(m_windowColor0, m_windowColor2, m_windowColor1, m_windowColor3);
|
||||
}
|
||||
|
||||
void JAWWindow::onDraw(JAWGraphContext*) {}
|
||||
|
||||
void JAWWindow::move(f32 param_1, f32 param_2) {
|
||||
field_0x38.move(param_1, param_2);
|
||||
m_drawWindow.move(param_1, param_2);
|
||||
}
|
||||
|
||||
void JAWWindow::addPosition(f32 param_1, f32 param_2) {
|
||||
field_0x38.add(param_1, param_2);
|
||||
m_drawWindow.add(param_1, param_2);
|
||||
}
|
||||
|
||||
void JAWWindow::addSize(f32 width, f32 height) {
|
||||
JGeometry::TBox2<f32> bounds = field_0x38.getBounds();
|
||||
JGeometry::TBox2<f32> bounds = m_drawWindow.getBounds();
|
||||
f32 newWidth = width + bounds.getWidth();
|
||||
f32 newHeight = height + bounds.getHeight();
|
||||
if (newWidth < 36.0f) {
|
||||
@@ -72,7 +72,7 @@ void JAWWindow::addSize(f32 width, f32 height) {
|
||||
} else if (newHeight > 480.0f) {
|
||||
newHeight = 480.0f;
|
||||
}
|
||||
field_0x38.resize(newWidth, newHeight);
|
||||
m_drawWindow.resize(newWidth, newHeight);
|
||||
}
|
||||
|
||||
JUtility::TColor JAWWindow::convJudaColor(u16 param_1) {
|
||||
@@ -189,7 +189,7 @@ void JAWWindow::padProc(const JUTGamePad& pad) {
|
||||
JAWWindow::TWindowText::TWindowText(JAWWindow* window) :
|
||||
J2DPane('TEXT', JGeometry::TBox2<f32>(10.0f, 30.0f, 650.0f, 510.0f)),
|
||||
m_pParent(window),
|
||||
field_0x11c(0, 0) {
|
||||
m_point(0, 0) {
|
||||
}
|
||||
|
||||
JAWWindow::TWindowText::~TWindowText() {}
|
||||
@@ -201,15 +201,15 @@ void JAWWindow::TWindowText::drawSelf(f32 param_1, f32 param_2) {
|
||||
}
|
||||
|
||||
void JAWWindow::TWindowText::drawSelf(f32, f32, Mtx* param_3) {
|
||||
field_0xfc.reset();
|
||||
MTXTrans(*param_3, -field_0x11c.x, -field_0x11c.y, 0.0f);
|
||||
m_graf.reset();
|
||||
MTXTrans(*param_3, -m_point.x, -m_point.y, 0.0f);
|
||||
Mtx stack_48;
|
||||
MTXConcat(*param_3, mGlobalMtx, stack_48);
|
||||
GXLoadPosMtxImm(stack_48, 0);
|
||||
field_0xfc.setParentAlpha(mColorAlpha);
|
||||
m_graf.setParentAlpha(mColorAlpha);
|
||||
JUT_ASSERT(209, m_pParent != NULL);
|
||||
m_pParent->setMatrix(stack_48);
|
||||
m_pParent->onDraw(&field_0xfc);
|
||||
m_pParent->onDraw(&m_graf);
|
||||
}
|
||||
|
||||
static void dummy(J2DPane* pane, J2DWindow* window) {
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include <vi.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "JSystem/JKernel/JKRExpHeap.h"
|
||||
|
||||
static int JKRDecompressFromDVD(JKRDvdFile*, void*, u32, u32, u32, u32, u32*);
|
||||
static int decompSZS_subroutine(u8*, u8*);
|
||||
static u8* firstSrcData();
|
||||
@@ -240,6 +242,8 @@ static OSMutex decompMutex;
|
||||
|
||||
u32 JKRDvdRipper::sSZSBufferSize = 0x00000400;
|
||||
|
||||
JKRHeap* JKRDvdRipper::sHeap = NULL;
|
||||
|
||||
static u8* szpBuf;
|
||||
|
||||
static u8* szpEnd;
|
||||
@@ -282,12 +286,20 @@ static int JKRDecompressFromDVD(JKRDvdFile* dvdFile, void* dst, u32 fileSize, u3
|
||||
OSLockMutex(&decompMutex);
|
||||
u32 result = 0;
|
||||
u32 szsBufferSize = JKRDvdRipper::getSZSBufferSize();
|
||||
#if TARGET_PC
|
||||
szpBuf = (u8 *)JKRAllocFromHeap(JKRDvdRipper::getHeap(), szsBufferSize, -0x20);
|
||||
#else
|
||||
szpBuf = (u8 *)JKRAllocFromSysHeap(szsBufferSize, -0x20);
|
||||
#endif
|
||||
JUT_ASSERT(909, szpBuf != NULL);
|
||||
|
||||
szpEnd = szpBuf + szsBufferSize;
|
||||
if (inFileOffset != 0) {
|
||||
#if TARGET_PC
|
||||
refBuf = (u8 *)JKRAllocFromHeap(JKRDvdRipper::getHeap(), 0x1120, -4);
|
||||
#else
|
||||
refBuf = (u8 *)JKRAllocFromSysHeap(0x1120, -4);
|
||||
#endif
|
||||
JUT_ASSERT(918, refBuf != NULL);
|
||||
refEnd = refBuf + 0x1120;
|
||||
refCurrent = refBuf;
|
||||
|
||||
@@ -214,9 +214,33 @@ void* JKRExpHeap::do_alloc(u32 size, int alignment) {
|
||||
#endif
|
||||
|
||||
#if TARGET_PC
|
||||
JUT_ASSERT_MSG_F(__LINE__, ptr != nullptr,
|
||||
"Failed to alloc memory! (%s) (0x%X bytes).\n Heap size: %u\n Used size: %u",
|
||||
this->getName(), size, getSize(), getTotalUsedSize());
|
||||
if (!ptr) {
|
||||
// Allocation failed.
|
||||
OSReport_Error(
|
||||
"Failed to alloc memory! (%s) (0x%X bytes).\n Heap size: 0x%X\n Used size: 0x%X\n",
|
||||
this->getName(), size, getSize(), getTotalUsedSize());
|
||||
OSReport_Error("Free block list as follows:\n");
|
||||
OSReport_Error("Start | End | Size \n");
|
||||
|
||||
int i = 0;
|
||||
for (const CMemBlock* block = mHeadFreeList; block; block = block->mNext) {
|
||||
if (block->mMagic) {
|
||||
// Allocated, ignore.
|
||||
continue;
|
||||
}
|
||||
if (i++ > 10) {
|
||||
OSReport_Error("<more>\n");
|
||||
break;
|
||||
}
|
||||
|
||||
auto blockStart = (uintptr_t)block - (uintptr_t)mStart;
|
||||
auto blockEnd = (uintptr_t)block + block->size - (uintptr_t)mStart;
|
||||
auto blockSize = block->size;
|
||||
OSReport_Error("%08X | %08X | %08X\n", (u32) blockStart, (u32) blockEnd, (u32) blockSize);
|
||||
}
|
||||
|
||||
CRASH("Aborting due to allocation failure!");
|
||||
}
|
||||
#else
|
||||
if (ptr == NULL) {
|
||||
JUTWarningConsole_f(":::cannot alloc memory (0x%x byte).\n", size);
|
||||
@@ -472,7 +496,7 @@ void JKRExpHeap::do_freeAll() {
|
||||
JKRHeap::callAllDisposer();
|
||||
mHeadFreeList = (CMemBlock*)mStart;
|
||||
mTailFreeList = mHeadFreeList;
|
||||
mHeadFreeList->initiate(NULL, NULL, mSize - 0x10, 0, 0);
|
||||
mHeadFreeList->initiate(NULL, NULL, mSize - sizeof(CMemBlock), 0, 0);
|
||||
mHeadUsedList = NULL;
|
||||
mTailUsedList = NULL;
|
||||
#if DEBUG
|
||||
|
||||
@@ -77,8 +77,6 @@ void JMAFastVECNormalize(__REGISTER const Vec* src, __REGISTER Vec* dst) {
|
||||
dst->y = src->y * length;
|
||||
dst->z = src->z * length;
|
||||
#endif // clang-format on
|
||||
|
||||
OSPanic(__FILE__, __LINE__, "UNIMPLEMENTED");
|
||||
}
|
||||
|
||||
void JMAVECScaleAdd(__REGISTER const Vec* vec1, __REGISTER const Vec* vec2, __REGISTER Vec* dst,
|
||||
|
||||
@@ -932,8 +932,8 @@ void JPAResource::setPTev() {
|
||||
int center_offset = pEsp != NULL ? (pEsp->getScaleCenterX() + 3 * pEsp->getScaleCenterY()) * 0xC : 0x30;
|
||||
int pos_offset = center_offset + base_plane_type * 0x6C;
|
||||
int crd_offset = (pBsp->getTilingS() + 2 * pBsp->getTilingT()) * 8;
|
||||
GXSETARRAY(GX_VA_POS, jpa_pos + pos_offset, ARRAY_SIZEU(jpa_pos) - pos_offset, 3);
|
||||
GXSETARRAY(GX_VA_TEX0, jpa_crd + crd_offset, ARRAY_SIZEU(jpa_crd) - crd_offset, 2);
|
||||
GXSETARRAY(GX_VA_POS, jpa_pos + pos_offset, ARRAY_SIZEU(jpa_pos) - pos_offset, 3, true);
|
||||
GXSETARRAY(GX_VA_TEX0, jpa_crd + crd_offset, ARRAY_SIZEU(jpa_crd) - crd_offset, 2, true);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
|
||||
|
||||
if (pEts != NULL) {
|
||||
@@ -978,8 +978,8 @@ void JPAResource::setCTev(JPAEmitterWorkData* work) {
|
||||
int base_plane_type = (pCsp->getType() == 3 || pCsp->getType() == 7) ?
|
||||
pCsp->getBasePlaneType() : 0;
|
||||
int pos_offset = 0x30 + base_plane_type * 0x6C;
|
||||
GXSETARRAY(GX_VA_POS, jpa_pos + pos_offset, ARRAY_SIZEU(jpa_pos) - pos_offset, 3);
|
||||
GXSETARRAY(GX_VA_TEX0, jpa_crd, ARRAY_SIZEU(jpa_crd), 2);
|
||||
GXSETARRAY(GX_VA_POS, jpa_pos + pos_offset, ARRAY_SIZEU(jpa_pos) - pos_offset, 3, true);
|
||||
GXSETARRAY(GX_VA_TEX0, jpa_crd, ARRAY_SIZEU(jpa_crd), 2, true);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP1, GX_COLOR_NULL);
|
||||
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, 0x3C);
|
||||
GXSetTevDirect(GX_TEVSTAGE0);
|
||||
|
||||
@@ -225,7 +225,9 @@ void JStudio_JAudio2::TAdaptor_sound::adaptor_do_PARENT_NODE(JStudio::data::TEOp
|
||||
case JStudio::data::UNK_0x18:
|
||||
if (field_0x13c != NULL) {
|
||||
JUT_ASSERT(431, pContent!=NULL);
|
||||
#if DUSK_SUSPICIOUS_ASSERTS
|
||||
JUT_ASSERT(432, uSize==0);
|
||||
#endif
|
||||
field_0x140 = field_0x13c->JSGFindNodeID((char*)pContent);
|
||||
if (field_0x140 == -1) {
|
||||
return;
|
||||
|
||||
@@ -535,6 +535,14 @@ void JUTGamePad::CRumble::stopPatternedRumble(s16 port) {
|
||||
}
|
||||
|
||||
void JUTGamePad::CRumble::stopPatternedRumbleAtThePeriod() {
|
||||
#if TARGET_PC
|
||||
if (mFrameCount == 0) {
|
||||
// Does not trap on hardware
|
||||
// PowerPC spec says result is "undefined". Let's just write zero.
|
||||
mLength = 0;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
u32 r31 = mFrame % mFrameCount;
|
||||
mLength = (mFrame + mFrameCount - 1) % mFrameCount;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user