mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-03 08:23:08 -04:00
Merge branch 'main' into 26-03-28-movie-player
This commit is contained in:
@@ -150,13 +150,13 @@ struct J3DSys {
|
||||
void setModelDrawMtx(Mtx* pMtxArr) {
|
||||
J3D_ASSERT_NULLPTR(230, pMtxArr);
|
||||
mModelDrawMtx = pMtxArr;
|
||||
GXSETARRAY(GX_POS_MTX_ARRAY, mModelDrawMtx, sizeof(*mModelDrawMtx), sizeof(*mModelDrawMtx));
|
||||
GXSETARRAY(GX_POS_MTX_ARRAY, mModelDrawMtx, 10 * sizeof(Mtx), sizeof(*mModelDrawMtx), true);
|
||||
}
|
||||
|
||||
void setModelNrmMtx(Mtx33* pMtxArr) {
|
||||
J3D_ASSERT_NULLPTR(241, pMtxArr);
|
||||
mModelNrmMtx = pMtxArr;
|
||||
GXSETARRAY(GX_NRM_MTX_ARRAY, mModelNrmMtx, sizeof(*mModelNrmMtx), sizeof(*mModelNrmMtx));
|
||||
GXSETARRAY(GX_NRM_MTX_ARRAY, mModelNrmMtx, 10 * sizeof(Mtx33), sizeof(*mModelNrmMtx), true);
|
||||
}
|
||||
|
||||
void* getVtxPos() { return mVtxPos; }
|
||||
|
||||
@@ -24,6 +24,15 @@ public:
|
||||
void setGXforPrint();
|
||||
void setGXforDraw();
|
||||
|
||||
void color(const JUtility::TColor& color0, const JUtility::TColor& color1) {
|
||||
color(color0, color1, color0, color1);
|
||||
}
|
||||
|
||||
void lineWidth(u8 width) {
|
||||
field_0x16 = width;
|
||||
GXSetLineWidth(field_0x16, GX_TO_ZERO);
|
||||
}
|
||||
|
||||
/* 0x00 */ J2DPrint* field_0x0;
|
||||
/* 0x04 */ JUtility::TColor field_0x4;
|
||||
/* 0x08 */ JUtility::TColor field_0x8;
|
||||
|
||||
@@ -16,8 +16,8 @@ public:
|
||||
y = i_y;
|
||||
}
|
||||
|
||||
/* 0x00*/ int x;
|
||||
/* 0x04*/ int y;
|
||||
/* 0x00 */ int x;
|
||||
/* 0x04 */ int y;
|
||||
};
|
||||
|
||||
class JAWWindow {
|
||||
@@ -29,9 +29,9 @@ public:
|
||||
virtual void drawSelf(f32, f32);
|
||||
virtual void drawSelf(f32, f32, Mtx*);
|
||||
|
||||
/* 0x0FC */ JAWGraphContext field_0xfc;
|
||||
/* 0x0FC */ JAWGraphContext m_graf;
|
||||
/* 0x118 */ JAWWindow* m_pParent;
|
||||
/* 0x11C */ JUTPoint field_0x11c;
|
||||
/* 0x11C */ JUTPoint m_point;
|
||||
};
|
||||
|
||||
class TJ2DWindowDraw : public J2DWindow {
|
||||
@@ -94,21 +94,29 @@ public:
|
||||
static JUtility::TColor convJudaColor(u16);
|
||||
void padProc(const JUTGamePad&);
|
||||
|
||||
void setWindowColor(const JUtility::TColor& color) {
|
||||
setWindowColor(color, color, color, color);
|
||||
}
|
||||
|
||||
void setWindowColor(u8 r, u8 g, u8 b, u8 a) {
|
||||
setWindowColor(JUtility::TColor(r, g, b, a));
|
||||
}
|
||||
|
||||
/* 0x004 */ Mtx mMatrix;
|
||||
/* 0x034 */ u8 field_0x34[0x38 - 0x34];
|
||||
/* 0x038 */ TJ2DWindowDraw field_0x38;
|
||||
/* 0x180 */ J2DTextBox field_0x180;
|
||||
/* 0x2B0 */ TWindowText field_0x2b0;
|
||||
/* 0x3D8 */ JUtility::TColor field_0x3d8;
|
||||
/* 0x3DC */ JUtility::TColor field_0x3dc;
|
||||
/* 0x3E0 */ JUtility::TColor field_0x3e0;
|
||||
/* 0x3E4 */ JUtility::TColor field_0x3e4;
|
||||
/* 0x038 */ TJ2DWindowDraw m_drawWindow;
|
||||
/* 0x180 */ J2DTextBox m_titleText;
|
||||
/* 0x2B0 */ TWindowText m_windowText;
|
||||
/* 0x3D8 */ JUtility::TColor m_windowColor0;
|
||||
/* 0x3DC */ JUtility::TColor m_windowColor1;
|
||||
/* 0x3E0 */ JUtility::TColor m_windowColor2;
|
||||
/* 0x3E4 */ JUtility::TColor m_windowColor3;
|
||||
/* 0x3E8 */ int field_0x3e8;
|
||||
/* 0x3EC */ u8 field_0x3ec;
|
||||
/* 0x3EC */ u8 m_isInit;
|
||||
|
||||
void setMatrix(Mtx mtx) { MTXCopy(mtx, mMatrix); }
|
||||
void setAlpha(u8 alpha) { field_0x38.setAlpha(alpha); }
|
||||
void draw(int x, int y, const J2DGrafContext* p_grafCtx) { field_0x38.drawPane(x, y, p_grafCtx); }
|
||||
void setAlpha(u8 alpha) { m_drawWindow.setAlpha(alpha); }
|
||||
void draw(int x, int y, const J2DGrafContext* p_grafCtx) { m_drawWindow.drawPane(x, y, p_grafCtx); }
|
||||
};
|
||||
|
||||
#endif /* JAWWINDOW_H */
|
||||
|
||||
@@ -50,6 +50,12 @@ public:
|
||||
|
||||
JAISoundID(const JAISoundID& other) { id_.composite_ = other.id_.composite_; };
|
||||
|
||||
JAISoundID(unsigned int sectionID, unsigned int groupID, unsigned int waveID) {
|
||||
id_.info.type.parts.sectionID = sectionID;
|
||||
id_.info.type.parts.groupID = groupID;
|
||||
id_.info.waveID = waveID;
|
||||
}
|
||||
|
||||
JAISoundID() {}
|
||||
|
||||
bool isAnonymous() const { return id_.composite_ == -1; }
|
||||
@@ -323,6 +329,8 @@ public:
|
||||
status_.field_0x0.flags.paused = param_0;
|
||||
}
|
||||
|
||||
bool isPaused() const { return status_.field_0x0.flags.paused; }
|
||||
|
||||
void updateLifeTime(u32 lifeTime) {
|
||||
if (lifeTime > lifeTime_) {
|
||||
lifeTime_ = lifeTime;
|
||||
|
||||
@@ -33,6 +33,9 @@ public:
|
||||
bool isAllocated() const { return mBase; }
|
||||
u32 getSize() const { return mSize; }
|
||||
|
||||
JSUTree<JASHeap>* getFirstChild() { return mTree.getFirstChild(); }
|
||||
JSUTree<JASHeap>* getEndChild() { return mTree.getEndChild(); }
|
||||
|
||||
/* 0x00 */ JSUTree<JASHeap> mTree;
|
||||
/* 0x1C */ OSMutex mMutex;
|
||||
/* 0x34 */ JASDisposer* mDisposer;
|
||||
|
||||
@@ -54,6 +54,8 @@ struct JASWaveArc : JASDisposer {
|
||||
virtual void onEraseDone() {}
|
||||
|
||||
s32 getStatus() const { return mStatus; }
|
||||
u32 getFileSize() const { return mFileLength; }
|
||||
JASHeap* getHeap() { return &mHeap; }
|
||||
|
||||
struct loadToAramCallbackParams {
|
||||
// not official struct name
|
||||
|
||||
@@ -149,6 +149,8 @@ struct JAUSoundTable : public JASGlobalInstance<JAUSoundTable> {
|
||||
void init(void const*);
|
||||
u8 getTypeID(JAISoundID) const;
|
||||
JAUSoundTableItem* getData(JAISoundID) const;
|
||||
int getNumGroups_inSection(u8) const;
|
||||
int getNumItems_inGroup(u8, u8) const;
|
||||
|
||||
JAUSoundTableItem* getItem(JAUSoundTableGroup* group, int index) const {
|
||||
u32 offset = group->getItemOffset(index);
|
||||
|
||||
@@ -36,6 +36,9 @@ public:
|
||||
static JSUList<JKRDMCommand> sDvdAsyncList;
|
||||
static u32 sSZSBufferSize;
|
||||
static bool errorRetry;
|
||||
#if TARGET_PC
|
||||
static JKRHeap* sHeap;
|
||||
#endif
|
||||
|
||||
enum EAllocDirection {
|
||||
UNKNOWN_EALLOC_DIRECTION = 0,
|
||||
@@ -54,6 +57,12 @@ public:
|
||||
|
||||
static bool isErrorRetry(void) { return errorRetry; }
|
||||
inline static u32 getSZSBufferSize() { return sSZSBufferSize; }
|
||||
|
||||
#if TARGET_PC
|
||||
static inline JKRHeap* getHeap() { return sHeap; }
|
||||
static inline void setHeap(JKRHeap* i_heap) { sHeap = i_heap; }
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
// void JKRDecompressFromDVD(JKRDvdFile*, void*, u32, u32, u32, u32, u32*);
|
||||
|
||||
@@ -121,6 +121,13 @@ public:
|
||||
|
||||
static s32 getUsedSize_(JKRExpHeap* heap) { return heap->mSize - heap->getTotalFreeSize(); }
|
||||
static void* getState_(TState* state) { return getState_buf_(state); }
|
||||
|
||||
#if TARGET_PC
|
||||
[[nodiscard]] CMemBlock* getFreeHead() { return mHeadFreeList; }
|
||||
[[nodiscard]] const CMemBlock* getFreeHead() const { return mHeadFreeList; }
|
||||
[[nodiscard]] CMemBlock* getUsedHead() { return mHeadUsedList; }
|
||||
[[nodiscard]] const CMemBlock* getUsedHead() const { return mHeadUsedList; }
|
||||
#endif
|
||||
};
|
||||
|
||||
inline JKRExpHeap* JKRCreateExpHeap(u32 size, JKRHeap* parent, bool errorFlag) {
|
||||
|
||||
@@ -230,6 +230,8 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
operator int() { return (int)mTree; }
|
||||
|
||||
T* getObject() const { return this->mTree->getObject(); }
|
||||
|
||||
bool operator==(const JSUTree<T>* other) const { return this->mTree == other; }
|
||||
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
}
|
||||
|
||||
void stopMotorWave() { mRumble.stopPatternedRumbleAtThePeriod(); }
|
||||
void stopMotor() { mRumble.stopMotor(mPortNum, false); }
|
||||
void stopMotor() { mRumble.stopMotor(mPortNum); }
|
||||
void stopMotorHard() { CRumble::stopMotorHard(mPortNum); }
|
||||
|
||||
static s8 getPortStatus(EPadPort port) {
|
||||
@@ -233,7 +233,7 @@ public:
|
||||
/* 0x10 */ u8* field_0x10;
|
||||
}; // Size: 0x14
|
||||
|
||||
void startMotorWave(void* data, CRumble::ERumble rumble, u32 length) {
|
||||
void startMotorWave(u8* data, CRumble::ERumble rumble, u32 length) {
|
||||
mRumble.startPatternedRumble(data, rumble, length);
|
||||
}
|
||||
|
||||
|
||||
@@ -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