mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-30 15:43:19 -04:00
Merge remote-tracking branch 'origin/main' into android-building
This commit is contained in:
@@ -1418,7 +1418,7 @@ bool J2DTevBlock8::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette*
|
||||
} else {
|
||||
texture->storeTIMG(p_timg, p_tlut);
|
||||
}
|
||||
bool local_38[4];
|
||||
bool local_38[8];
|
||||
for (u8 i = 0; i < 8; i++) {
|
||||
local_38[i] = (mUndeleteFlag & 1 << i) != 0;
|
||||
}
|
||||
|
||||
@@ -511,6 +511,7 @@ void J2DPicture::drawSelf(f32 param_0, f32 param_1) {
|
||||
}
|
||||
|
||||
void J2DPicture::drawSelf(f32 param_0, f32 param_1, Mtx* param_2) {
|
||||
GX_AND_TRACY_SCOPED("J2DPicture::drawSelf")
|
||||
if (mTexture[0] != NULL && mTextureNum != 0) {
|
||||
drawFullSet(mGlobalBounds.i.x + param_0, mGlobalBounds.i.y + param_1,
|
||||
getWidth(), getHeight(), param_2);
|
||||
@@ -527,6 +528,7 @@ void J2DPicture::drawFullSet(f32 param_0, f32 param_1, f32 param_2, f32 param_3,
|
||||
|
||||
void J2DPicture::draw(f32 x, f32 y, f32 width, f32 height, bool mirrorX, bool mirrorY,
|
||||
bool rotate90) {
|
||||
GX_AND_TRACY_SCOPED("J2DPicture::draw")
|
||||
if (isVisible() && mTextureNum != 0 && mTexture[0] != NULL) {
|
||||
f32 x2 = x + width;
|
||||
f32 y2 = y + height;
|
||||
|
||||
@@ -78,8 +78,21 @@ bool J2DPictureEx::prepareTexture(u8 param_0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
bool checkAlphaCull(const J2DPictureEx* pic) {
|
||||
return pic->mColorAlpha == 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void J2DPictureEx::drawSelf(f32 param_0, f32 param_1, f32 (*param_2)[3][4]) {
|
||||
GX_AND_TRACY_SCOPED("J2DPictureEx::drawSelf")
|
||||
if (mMaterial != NULL) {
|
||||
#if TARGET_PC
|
||||
if (checkAlphaCull(this)) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
mMaterial->setGX();
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
|
||||
@@ -278,6 +278,8 @@ J2DPane* J2DScreen::searchUserInfo(u64 tag) {
|
||||
}
|
||||
|
||||
void J2DScreen::drawSelf(f32 param_0, f32 param_1, Mtx* param_2) {
|
||||
GX_AND_TRACY_SCOPED("J2DScreen::drawSelf")
|
||||
|
||||
JUtility::TColor color(mColor);
|
||||
u8 alpha = (color.a * mAlpha) / 255;
|
||||
|
||||
|
||||
@@ -391,6 +391,8 @@ void J2DTextBox::drawSelf(f32 param_0, f32 param_1) {
|
||||
}
|
||||
|
||||
void J2DTextBox::drawSelf(f32 param_0, f32 param_1, Mtx* p_mtx) {
|
||||
GX_AND_TRACY_SCOPED("J2DTextBox::drawSelf")
|
||||
|
||||
Mtx m;
|
||||
|
||||
J2DPrint print(mFont, mCharSpacing, mLineSpacing, mCharColor, mGradientColor, mBlackColor,
|
||||
|
||||
@@ -93,6 +93,7 @@ J2DTextBoxEx::~J2DTextBoxEx() {
|
||||
}
|
||||
|
||||
void J2DTextBoxEx::drawSelf(f32 param_0, f32 param_1, Mtx* p_mtx) {
|
||||
GX_AND_TRACY_SCOPED("J2DTextBoxEx::drawSelf")
|
||||
Mtx m;
|
||||
|
||||
JUTFont* font = NULL;
|
||||
|
||||
@@ -410,6 +410,8 @@ void J2DWindow::drawSelf(f32 param_0, f32 param_1) {
|
||||
}
|
||||
|
||||
void J2DWindow::drawSelf(f32 param_0, f32 param_1, Mtx* param_2) {
|
||||
GX_AND_TRACY_SCOPED("J2DWindow::drawSelf")
|
||||
|
||||
JGeometry::TBox2<f32> stack_50(mBounds);
|
||||
stack_50.addPos(JGeometry::TVec2<f32>(param_0, param_1));
|
||||
if (stack_50.getWidth() >= field_0x140 && stack_50.getHeight() >= field_0x142) {
|
||||
|
||||
@@ -122,6 +122,7 @@ J2DWindowEx::~J2DWindowEx() {
|
||||
}
|
||||
|
||||
void J2DWindowEx::drawSelf(f32 param_0, f32 param_1, f32 (*param_2)[3][4]) {
|
||||
GX_AND_TRACY_SCOPED("J2DWindowEx::drawSelf")
|
||||
JGeometry::TBox2<f32> aTStack_50(mBounds);
|
||||
Mtx auStack_40;
|
||||
aTStack_50.addPos(JGeometry::TVec2<f32>(param_0, param_1));
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "JSystem/J3DGraphBase/J3DShapeMtx.h"
|
||||
#include "JSystem/J3DGraphBase/J3DSys.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "dusk/frame_interpolation.h"
|
||||
|
||||
#define J3D_ASSERTMSG(LINE, COND, MSG) JUT_ASSERT_MSG(LINE, (COND) != 0, MSG)
|
||||
#define J3D_WARN1(LINE, MSG, ARG1) JUT_WARN(LINE, MSG, ARG1)
|
||||
@@ -448,6 +449,16 @@ void J3DModel::calc() {
|
||||
if (mCalcCallBack != NULL) {
|
||||
mCalcCallBack(this, 0);
|
||||
}
|
||||
|
||||
#ifdef TARGET_PC
|
||||
for (u16 i = 0; i < mModelData->getJointNum(); ++i) {
|
||||
dusk::frame_interp::record_final_mtx_raw(reinterpret_cast<const Mtx*>(getAnmMtx(i)), getAnmMtx(i));
|
||||
}
|
||||
|
||||
for (u16 i = 0; i < mModelData->getWEvlpMtxNum(); ++i) {
|
||||
dusk::frame_interp::record_final_mtx_raw(reinterpret_cast<const Mtx*>(getWeightAnmMtx(i)), getWeightAnmMtx(i));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void J3DModel::entry() {
|
||||
@@ -484,11 +495,17 @@ void J3DModel::viewCalc() {
|
||||
if (getMtxCalcMode() == 2) {
|
||||
J3DCalcViewBaseMtx(j3dSys.getViewMtx(), mBaseScale, mBaseTransformMtx,
|
||||
(MtxP)&mInternalView);
|
||||
#ifdef TARGET_PC
|
||||
dusk::frame_interp::record_final_mtx_raw(&mInternalView, mInternalView);
|
||||
#endif
|
||||
}
|
||||
} else if (isCpuSkinningOn()) {
|
||||
if (getMtxCalcMode() == 2) {
|
||||
J3DCalcViewBaseMtx(j3dSys.getViewMtx(), mBaseScale, mBaseTransformMtx,
|
||||
(MtxP)&mInternalView);
|
||||
#ifdef TARGET_PC
|
||||
dusk::frame_interp::record_final_mtx_raw(&mInternalView, mInternalView);
|
||||
#endif
|
||||
}
|
||||
} else if (checkFlag(J3DMdlFlag_SkinPosCpu)) {
|
||||
mMtxBuffer->calcDrawMtx(getMtxCalcMode(), mBaseScale, mBaseTransformMtx);
|
||||
@@ -509,6 +526,12 @@ void J3DModel::viewCalc() {
|
||||
DCStoreRange(getNrmMtxPtr(), mModelData->getDrawMtxNum() * sizeof(Mtx33));
|
||||
}
|
||||
|
||||
#ifdef TARGET_PC
|
||||
for (u16 i = 0; i < mModelData->getDrawMtxNum(); ++i) {
|
||||
dusk::frame_interp::record_final_mtx_raw(&getDrawMtxPtr()[i], getDrawMtxPtr()[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
prepareShapePackets();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,20 @@
|
||||
#include "JSystem/J3DGraphBase/J3DMatBlock.h"
|
||||
#include "JSystem/J3DGraphBase/J3DSys.h"
|
||||
#include "JSystem/J3DGraphBase/J3DTexture.h"
|
||||
#include "dusk/frame_interpolation.h"
|
||||
|
||||
u16 J3DShapeMtx::sMtxLoadCache[10];
|
||||
|
||||
#ifdef TARGET_PC
|
||||
static void J3DFrameInterpConcat(MtxP lhs, MtxP rhs, Mtx out) {
|
||||
if (!dusk::frame_interp::lookup_concat_replacement(lhs, rhs, out)) {
|
||||
MTXConcat(lhs, rhs, out);
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define J3DFrameInterpConcat MTXConcat
|
||||
#endif
|
||||
|
||||
void J3DShapeMtx::resetMtxLoadCache() {
|
||||
sMtxLoadCache[0] =
|
||||
sMtxLoadCache[1] =
|
||||
@@ -290,7 +301,7 @@ void J3DDifferedTexMtx::loadExecute(f32 const (*param_0)[4]) {
|
||||
|
||||
void J3DShapeMtxConcatView::loadMtxConcatView_PNGP(int slot, u16 drw) const {
|
||||
Mtx m;
|
||||
MTXConcat(*j3dSys.getShapePacket()->getBaseMtxPtr(), j3dSys.getModelDrawMtx(drw), m);
|
||||
J3DFrameInterpConcat(*j3dSys.getShapePacket()->getBaseMtxPtr(), j3dSys.getModelDrawMtx(drw), m);
|
||||
J3DDifferedTexMtx::load(m);
|
||||
J3DFifoLoadPosMtxImm(m, slot * 3);
|
||||
loadNrmMtx(slot, drw, m);
|
||||
@@ -298,7 +309,7 @@ void J3DShapeMtxConcatView::loadMtxConcatView_PNGP(int slot, u16 drw) const {
|
||||
|
||||
void J3DShapeMtxConcatView::loadMtxConcatView_PCPU(int slot, u16 drw) const {
|
||||
Mtx m;
|
||||
MTXConcat(*j3dSys.getShapePacket()->getBaseMtxPtr(), j3dSys.getModelDrawMtx(drw), m);
|
||||
J3DFrameInterpConcat(*j3dSys.getShapePacket()->getBaseMtxPtr(), j3dSys.getModelDrawMtx(drw), m);
|
||||
J3DDifferedTexMtx::load(m);
|
||||
J3DFifoLoadPosMtxImm(*j3dSys.getShapePacket()->getBaseMtxPtr(), slot * 3);
|
||||
loadNrmMtx(slot, drw, m);
|
||||
@@ -306,7 +317,7 @@ void J3DShapeMtxConcatView::loadMtxConcatView_PCPU(int slot, u16 drw) const {
|
||||
|
||||
void J3DShapeMtxConcatView::loadMtxConcatView_NCPU(int slot, u16 drw) const {
|
||||
Mtx m;
|
||||
MTXConcat(*j3dSys.getShapePacket()->getBaseMtxPtr(), j3dSys.getModelDrawMtx(drw), m);
|
||||
J3DFrameInterpConcat(*j3dSys.getShapePacket()->getBaseMtxPtr(), j3dSys.getModelDrawMtx(drw), m);
|
||||
J3DDifferedTexMtx::load(m);
|
||||
J3DFifoLoadPosMtxImm(m, slot * 3);
|
||||
J3DFifoLoadNrmMtxImm(*j3dSys.getShapePacket()->getBaseMtxPtr(), slot * 3);
|
||||
@@ -318,7 +329,7 @@ void J3DShapeMtxConcatView::loadMtxConcatView_NCPU(int slot, u16 drw) const {
|
||||
void J3DShapeMtxConcatView::loadMtxConcatView_PNCPU(int slot, u16 drw) const {
|
||||
if (J3DDifferedTexMtx::sTexGenBlock != NULL) {
|
||||
Mtx m;
|
||||
MTXConcat(*j3dSys.getShapePacket()->getBaseMtxPtr(), j3dSys.getModelDrawMtx(drw), m);
|
||||
J3DFrameInterpConcat(*j3dSys.getShapePacket()->getBaseMtxPtr(), j3dSys.getModelDrawMtx(drw), m);
|
||||
J3DDifferedTexMtx::loadExecute(m);
|
||||
}
|
||||
|
||||
@@ -331,7 +342,7 @@ void J3DShapeMtxConcatView::loadMtxConcatView_PNCPU(int slot, u16 drw) const {
|
||||
|
||||
void J3DShapeMtxConcatView::loadMtxConcatView_PNGP_LOD(int slot, u16 drw) const {
|
||||
Mtx m;
|
||||
MTXConcat(*j3dSys.getShapePacket()->getBaseMtxPtr(), j3dSys.getModelDrawMtx(drw), m);
|
||||
J3DFrameInterpConcat(*j3dSys.getShapePacket()->getBaseMtxPtr(), j3dSys.getModelDrawMtx(drw), m);
|
||||
Mtx copy;
|
||||
j3dSys.getModel()->getModelData()->getInvJointMtx(drw).to_host(copy);
|
||||
MTXConcat(m, copy, m);
|
||||
@@ -490,9 +501,11 @@ void J3DShapeMtxBBoardConcatView::load() const {
|
||||
u16 draw_mtx_index = j3dSys.getModel()->getModelData()->getDrawMtxIndex(mUseMtxIndex);
|
||||
|
||||
if (j3dSys.getModel()->getModelData()->getDrawMtxFlag(mUseMtxIndex) == 0) {
|
||||
MTXConcat(j3dSys.getViewMtx(), j3dSys.getModel()->getMtxBuffer()->getUserAnmMtx(draw_mtx_index), mtx);
|
||||
J3DFrameInterpConcat(j3dSys.getViewMtx(),
|
||||
j3dSys.getModel()->getMtxBuffer()->getUserAnmMtx(draw_mtx_index), mtx);
|
||||
} else {
|
||||
MTXConcat(j3dSys.getViewMtx(), j3dSys.getModel()->getWeightAnmMtx(draw_mtx_index), mtx);
|
||||
J3DFrameInterpConcat(j3dSys.getViewMtx(),
|
||||
j3dSys.getModel()->getWeightAnmMtx(draw_mtx_index), mtx);
|
||||
}
|
||||
|
||||
J3DCalcBBoardMtx(mtx);
|
||||
@@ -521,9 +534,11 @@ void J3DShapeMtxYBBoardConcatView::load() const {
|
||||
u16 draw_mtx_index = j3dSys.getModel()->getModelData()->getDrawMtxIndex(mUseMtxIndex);
|
||||
|
||||
if (j3dSys.getModel()->getModelData()->getDrawMtxFlag(mUseMtxIndex) == 0) {
|
||||
MTXConcat(j3dSys.getViewMtx(), j3dSys.getModel()->getMtxBuffer()->getUserAnmMtx(draw_mtx_index), mtx1);
|
||||
J3DFrameInterpConcat(j3dSys.getViewMtx(),
|
||||
j3dSys.getModel()->getMtxBuffer()->getUserAnmMtx(draw_mtx_index), mtx1);
|
||||
} else {
|
||||
MTXConcat(j3dSys.getViewMtx(), j3dSys.getModel()->getWeightAnmMtx(draw_mtx_index), mtx1);
|
||||
J3DFrameInterpConcat(j3dSys.getViewMtx(),
|
||||
j3dSys.getModel()->getWeightAnmMtx(draw_mtx_index), mtx1);
|
||||
}
|
||||
|
||||
J3DCalcYBBoardMtx(mtx1);
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "JSystem/JMath/JMath.h"
|
||||
#include "JSystem/JSupport/JSupport.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "dusk/logging.h"
|
||||
|
||||
J3DMaterialFactory::J3DMaterialFactory(J3DMaterialBlock const& i_block) {
|
||||
mMaterialNum = i_block.mMaterialNum;
|
||||
@@ -656,7 +657,13 @@ J3DIndTexOrder J3DMaterialFactory::newIndTexOrder(int i_idx, int i_no) const {
|
||||
J3DIndTexMtx J3DMaterialFactory::newIndTexMtx(int i_idx, int i_no) const {
|
||||
J3DIndTexMtx dflt;
|
||||
if (mpIndInitData[i_idx].mEnabled == true) {
|
||||
#if TARGET_LITTLE_ENDIAN
|
||||
J3DIndTexMtxInfo indTexMtxInfo = mpIndInitData[i_idx].mIndTexMtxInfo[i_no];
|
||||
be_swap(indTexMtxInfo.field_0x0);
|
||||
return indTexMtxInfo;
|
||||
#else
|
||||
return J3DIndTexMtx(mpIndInitData[i_idx].mIndTexMtxInfo[i_no]);
|
||||
#endif
|
||||
} else {
|
||||
return dflt;
|
||||
}
|
||||
@@ -684,7 +691,19 @@ J3DFog J3DMaterialFactory::newFog(int i_idx) const {
|
||||
J3DFog fog;
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mFogIdx != 0xffff) {
|
||||
#if TARGET_LITTLE_ENDIAN
|
||||
J3DFogInfo fogInfo = mpFogInfo[mtl_init_data->mFogIdx];
|
||||
be_swap(fogInfo.mCenter);
|
||||
be_swap(fogInfo.mStartZ);
|
||||
be_swap(fogInfo.mEndZ);
|
||||
be_swap(fogInfo.mNearZ);
|
||||
be_swap(fogInfo.mFarZ);
|
||||
for (int i = 0; i < 10; i++)
|
||||
be_swap(fogInfo.mFogAdjTable.r[i]);
|
||||
fog.setFogInfo(fogInfo);
|
||||
#else
|
||||
fog.setFogInfo(mpFogInfo[mtl_init_data->mFogIdx]);
|
||||
#endif
|
||||
}
|
||||
return fog;
|
||||
}
|
||||
|
||||
@@ -1,26 +1,30 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include <dolphin/gx.h>
|
||||
#include <dolphin/vi.h>
|
||||
#include <gx.h>
|
||||
#include <stdint.h>
|
||||
#include <vi.h>
|
||||
#include "SDL3/SDL_timer.h"
|
||||
#include "JSystem/J2DGraph/J2DOrthoGraph.h"
|
||||
#include "JSystem/JFramework/JFWDisplay.h"
|
||||
#include "JSystem/J2DGraph/J2DOrthoGraph.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/JUtility/JUTConsole.h"
|
||||
#include "JSystem/JUtility/JUTDbPrint.h"
|
||||
#include "JSystem/JUtility/JUTProcBar.h"
|
||||
#include "aurora/aurora.h"
|
||||
#include <gx.h>
|
||||
#include <vi.h>
|
||||
#include "global.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef TARGET_PC
|
||||
#include "dusk/dusk.h"
|
||||
#include "dusk/gx_helper.h"
|
||||
#include "dusk/logging.h"
|
||||
#include "dusk/settings.h"
|
||||
#include "global.h"
|
||||
#include "dusk/time.h"
|
||||
|
||||
#include "SDL3/SDL_timer.h"
|
||||
#include "tracy/Tracy.hpp"
|
||||
|
||||
#include <chrono>
|
||||
#endif
|
||||
|
||||
void JFWDisplay::ctor_subroutine(bool enableAlpha) {
|
||||
mEnableAlpha = enableAlpha;
|
||||
mClamp = GX_CLAMP_TOP | GX_CLAMP_BOTTOM;
|
||||
@@ -201,6 +205,14 @@ void JFWDisplay::preGX() {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TARGET_PC
|
||||
static s32 s_faderSimSteps = -1;
|
||||
|
||||
void JFWDisplay::setFaderSimSteps(u32 steps) {
|
||||
s_faderSimSteps = static_cast<s32>(steps);
|
||||
}
|
||||
#endif
|
||||
|
||||
void JFWDisplay::endGX() {
|
||||
s32 bufferNum = JUTXfb::getManager()->getBufferNum();
|
||||
u16 width = JUTVideo::getManager()->getFbWidth();
|
||||
@@ -211,7 +223,26 @@ void JFWDisplay::endGX() {
|
||||
|
||||
if (mFader != NULL) {
|
||||
ortho.setPort();
|
||||
#ifdef TARGET_PC
|
||||
if (dusk::getSettings().game.enableFrameInterpolation) {
|
||||
u32 advance_count = 1;
|
||||
if (s_faderSimSteps >= 0) {
|
||||
advance_count = static_cast<u32>(s_faderSimSteps);
|
||||
s_faderSimSteps = -1;
|
||||
}
|
||||
for (u32 i = 0; i < advance_count; i++) {
|
||||
mFader->control();
|
||||
}
|
||||
if (mFader->getStatus() != 1) {
|
||||
mFader->draw();
|
||||
}
|
||||
} else {
|
||||
mFader->control();
|
||||
mFader->draw();
|
||||
}
|
||||
#else
|
||||
mFader->control();
|
||||
#endif
|
||||
}
|
||||
ortho.setPort();
|
||||
JUTDbPrint::getManager()->flush();
|
||||
@@ -350,49 +381,63 @@ void JFWDisplay::waitBlanking(int param_0) {
|
||||
}
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
constexpr auto FRAME_PERIOD = std::chrono::duration_cast<std::chrono::nanoseconds>(
|
||||
std::chrono::duration<double>(1001.0 / 30000.0));
|
||||
constexpr auto RETRACE_PERIOD = FRAME_PERIOD / 2;
|
||||
|
||||
static void waitPrecise(Limiter& limiter, Uint64 targetNs) {
|
||||
const auto sleepTime = limiter.SleepTime(std::chrono::nanoseconds(targetNs));
|
||||
dusk::frameUsagePct =
|
||||
100.0f * (1.0f - static_cast<float>(sleepTime.count()) / static_cast<float>(targetNs));
|
||||
limiter.Sleep(std::chrono::nanoseconds(targetNs));
|
||||
}
|
||||
#endif
|
||||
|
||||
static void waitForTick(u32 p1, u16 p2) {
|
||||
ZoneScopedC(tracy::Color::DimGray);
|
||||
#if TARGET_PC
|
||||
#if TARGET_PC
|
||||
if (dusk::getSettings().game.enableFrameInterpolation) {
|
||||
return;
|
||||
}
|
||||
if (dusk::getTransientSettings().skipFrameRateLimit) {
|
||||
p1 = OS_TIMER_CLOCK / 120;
|
||||
}
|
||||
#endif
|
||||
ZoneScopedC(tracy::Color::DimGray);
|
||||
#endif
|
||||
|
||||
if (p1 != 0)
|
||||
{
|
||||
if (p1 != 0) {
|
||||
#if TARGET_PC
|
||||
static Limiter limiter;
|
||||
waitPrecise(limiter, static_cast<Uint64>(OSTicksToMicroseconds(p1)) * 1000ULL);
|
||||
#else
|
||||
static OSTime nextTick = OSGetTime();
|
||||
OSTime time = OSGetTime();
|
||||
OSTime waitTime = (nextTick > time) ? (nextTick - time) : 0;
|
||||
while (time < nextTick) {
|
||||
JFWDisplay::getManager()->threadSleep((nextTick - time));
|
||||
time = OSGetTime();
|
||||
}
|
||||
dusk::frameUsagePct = 100.0f * (1.0f - (float)waitTime / (float)p1);
|
||||
nextTick = time + p1;
|
||||
#endif
|
||||
} else {
|
||||
static u32 nextCount = VIGetRetraceCount();
|
||||
u32 uVar1 = (p2 == 0) ? 1 : p2;
|
||||
#if TARGET_PC
|
||||
static Limiter limiter;
|
||||
waitPrecise(limiter, static_cast<Uint64>((RETRACE_PERIOD * uVar1).count()));
|
||||
#else
|
||||
static u32 nextCount = VIGetRetraceCount();
|
||||
OSMessage msg;
|
||||
do {
|
||||
if (!OSReceiveMessage(JUTVideo::getManager()->getMessageQueue(), &msg,
|
||||
OS_MESSAGE_BLOCK))
|
||||
{
|
||||
OS_MESSAGE_BLOCK)) {
|
||||
msg = 0;
|
||||
}
|
||||
} while (((intptr_t)msg - (intptr_t)nextCount) < 0);
|
||||
dusk::frameUsagePct = 100.0f;
|
||||
nextCount = (intptr_t)msg + uVar1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
JSUList<JFWAlarm> JFWAlarm::sList(false);
|
||||
|
||||
#if TARGET_PC
|
||||
void JFWDisplay::threadSleep(s64 time) {
|
||||
SDL_DelayNS(OSTicksToMicroseconds(time) * 1'000);
|
||||
}
|
||||
#else
|
||||
|
||||
static void JFWThreadAlarmHandler(OSAlarm* p_alarm, OSContext* p_ctx) {
|
||||
JFWAlarm* alarm = static_cast<JFWAlarm*>(p_alarm);
|
||||
alarm->removeLink();
|
||||
@@ -410,7 +455,6 @@ void JFWDisplay::threadSleep(s64 time) {
|
||||
OSSuspendThread(alarm.getThread());
|
||||
OSRestoreInterrupts(status);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void dummy() {
|
||||
JUTXfb::getManager()->setDisplayingXfbIndex(0);
|
||||
@@ -450,7 +494,7 @@ void JFWDisplay::clearEfb(GXColor color) {
|
||||
|
||||
void JFWDisplay::clearEfb(int param_0, int param_1, int param_2, int param_3, GXColor color) {
|
||||
STUB_RET();
|
||||
|
||||
|
||||
u16 width;
|
||||
u16 height;
|
||||
Mtx44 mtx;
|
||||
|
||||
@@ -19,24 +19,24 @@ JUTFader::JUTFader(int x, int y, int width, int height, JUtility::TColor pColor)
|
||||
|
||||
void JUTFader::control() {
|
||||
if (0 <= mEStatus && mEStatus-- == 0) {
|
||||
mStatus = field_0x24;
|
||||
}
|
||||
mStatus = field_0x24;
|
||||
}
|
||||
|
||||
if (mStatus == 1) {
|
||||
return;
|
||||
}
|
||||
if (mStatus == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (mStatus) {
|
||||
switch (mStatus) {
|
||||
case 0:
|
||||
mColor.a = 0xFF;
|
||||
break;
|
||||
case 2:
|
||||
#if AVOID_UB
|
||||
#if AVOID_UB
|
||||
if (field_0x8 == 0) {
|
||||
mStatus = 1;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
mColor.a = 0xFF - ((++field_0xa * 0xFF) / field_0x8);
|
||||
|
||||
if (field_0xa >= field_0x8) {
|
||||
@@ -45,12 +45,12 @@ void JUTFader::control() {
|
||||
|
||||
break;
|
||||
case 3:
|
||||
#if AVOID_UB
|
||||
#if AVOID_UB
|
||||
if (field_0x8 == 0) {
|
||||
mStatus = 0;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
mColor.a = ((++field_0xa * 0xFF) / field_0x8);
|
||||
|
||||
if (field_0xa >= field_0x8) {
|
||||
@@ -58,8 +58,12 @@ void JUTFader::control() {
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
draw();
|
||||
}
|
||||
|
||||
#ifndef TARGET_PC
|
||||
// Frame interpolation: draw call moved to JFWDisplay
|
||||
draw();
|
||||
#endif
|
||||
}
|
||||
|
||||
void JUTFader::draw() {
|
||||
|
||||
@@ -435,10 +435,10 @@ void JUTResFont::loadImage(int code, GXTexMapID id){
|
||||
mHeight = cellRow * cellH;
|
||||
|
||||
#if TARGET_PC
|
||||
const auto found = mGlyphTextures->textures.find(code);
|
||||
const auto found = mGlyphTextures->textures.find(pageIdx);
|
||||
GXTexObj* texObj;
|
||||
if (found == mGlyphTextures->textures.end()) {
|
||||
texObj = &mGlyphTextures->textures[code];
|
||||
texObj = &mGlyphTextures->textures[pageIdx];
|
||||
void* pImg = &mpGlyphBlocks[i]->data[pageIdx * mpGlyphBlocks[i]->textureSize];
|
||||
GXInitTexObj(texObj, pImg, mpGlyphBlocks[i]->textureWidth,
|
||||
mpGlyphBlocks[i]->textureHeight, (GXTexFmt)(u16)mpGlyphBlocks[i]->textureFormat,
|
||||
|
||||
@@ -182,7 +182,9 @@ void JUTVideo::postRetraceProc(u32 retrace_count) {
|
||||
sManager->mPostCallback(retrace_count);
|
||||
}
|
||||
|
||||
#ifndef TARGET_PC // Not read by JFWDisplay waitForTick
|
||||
OSSendMessage(&sManager->mMessageQueue, (OSMessage)(uintptr_t)VIGetRetraceCount(), OS_MESSAGE_NOBLOCK);
|
||||
#endif
|
||||
}
|
||||
|
||||
void JUTVideo::setRenderMode(GXRenderModeObj const* pObj) {
|
||||
|
||||
Reference in New Issue
Block a user