mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-20 21:33:28 -04:00
Ongoing gameplay dev (#49)
* launch.json cwd * bodge to load gci for testing * stub card stat * gameplay bodges * viewport, ub fixes * add release with debug info cmake variant * be fixes, sound stub * viewport h * d_msg_flow BE * be fopAcM_createItemFromEnemyID * update launch configuration to use iso * more audio stubs * Attempt to set viewport and get messages for brightness check * skip opening scene again, fixed JMessage::TResourceContainer::TCResource::Do_destroy * add guards for viewport changes * moar endian swapping to get Link sitting in PROC_OPENING_SCENE and for dialogues * BE d_msg_class i_data * stub bgm start * fix div by 0 error (for now) * TEMP_BROKEN in d_menu_ring * REQUIRES_GX_LINES * properly stub renderingAmap::draw with REQUIRES_GX_LINES * better stubbing outside of stubs * fix event data getting swapped multiple times * evil draw vp fix * Stub log imgui This redirects all spammy logs to an imgui window that is cleared per frame. This fixes the serious performance dip of the logging, and makes the regular log readable. * Oops move those optimization changes I accidentally committed behind a flag DUSK_SELECTED_OPT * gx_line macro in map * fix audio stubbing * switch to CARD API aurora impl * remove kabufuda from link libs * refactor imgui stuff and add input viewer * merge stub log with refactor * accidentally committed a metaforce header shh * basic map loader * ImGuiConsole: Add missing <thread> include * you may now play as luigi (you may now load stages with bridges) * bloom fix * bloom leak fix * cloud shadow fix * add soft reset button to imgui menu * if it broke dont not fix it * i swear i committed this * BE swap indMtx in JPAResource::setPTev * wnark ct fix * frsqrte implementation from kinoko * Fix Clang compile error in JAISeq::prepare_getSeqData_ * Add endian conversions to dMsgFlow_c::getInitNodeIndex This fixes a freeze when Fado tries to stop you from leaving the starting area. * Add RAII GXTexObj wrapper; fix almost all leaks * Update aurora for indirect texturing * Update aurora for CARD fix * Fix Clang build * More d_msg_flow endian fixes Fixes softlock when trying to talk to Fado and possibly other NPCs. * no frame limiter * get pause menu working * proper frame limiting * particle pointer size fix * improve map loader a bit --------- Co-authored-by: Jasper St. Pierre <jstpierre@mecheye.net> Co-authored-by: TakaRikka <takarikka@outlook.com> Co-authored-by: CraftyBoss <talibabdulmaalik@gmail.com> Co-authored-by: Luke Street <luke@street.dev> Co-authored-by: Lurs <2795933+Lurs@users.noreply.github.com> Co-authored-by: PJB3005 <pieterjan.briers+git@gmail.com> Co-authored-by: tgsm <doodrabbit@hotmail.com> Co-authored-by: Max Roncace <me@caseif.net> Co-authored-by: Phillip Stephens <antidote.crk@gmail.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
#include "Z2AudioLib/Z2Calc.h"
|
||||
#include "Z2AudioLib/Z2AudioMgr.h"
|
||||
#include "os_report.h"
|
||||
#include "dusk/logging.h"
|
||||
#include "dusk/audio.h"
|
||||
|
||||
static void Z2_E_sw_modPitch(Z2SoundHandlePool*, u32);
|
||||
static void Z2_E_ms_modVol(Z2SoundHandlePool*, u32);
|
||||
@@ -139,10 +139,7 @@ void Z2Creature::setSoundStarter(Z2SoundStarter* soundStarter) {
|
||||
}
|
||||
|
||||
void Z2Creature::initAnime(void* animation, bool param_1, f32 startFrame, f32 param_3) {
|
||||
#if TARGET_PC
|
||||
STUB_LOG();
|
||||
return;
|
||||
#endif
|
||||
DUSK_AUDIO_SKIP();
|
||||
mSoundObjAnime.initAnime(animation, param_1, startFrame, param_3);
|
||||
}
|
||||
|
||||
@@ -182,6 +179,8 @@ Z2SoundHandlePool* Z2Creature::startCreatureSound(JAISoundID soundID, u32 mapinf
|
||||
}
|
||||
|
||||
Z2SoundHandlePool* Z2Creature::startCreatureSoundLevel(JAISoundID soundID, u32 mapinfo, s8 reverb) {
|
||||
DUSK_AUDIO_SKIP(NULL);
|
||||
|
||||
switch (soundID) {
|
||||
case Z2SE_FAIRY_S_LV:
|
||||
Z2GetAudioMgr()->seStartLevel(soundID, mpPos, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0);
|
||||
@@ -441,6 +440,8 @@ Z2SoundHandlePool* Z2CreatureEnemy::startCreatureSound(JAISoundID soundID, u32 m
|
||||
}
|
||||
|
||||
Z2SoundHandlePool* Z2CreatureEnemy::startCreatureSoundLevel(JAISoundID soundID, u32 mapinfo, s8 reverb) {
|
||||
DUSK_AUDIO_SKIP(NULL);
|
||||
|
||||
if (soundID == 0x7FFFF) {
|
||||
Vec pos;
|
||||
Z2GetAudience()->convertAbsToRel(*mpPos, &pos, 0);
|
||||
@@ -924,6 +925,8 @@ void Z2CreatureOI::framework(u32 mapinfo, s8 reverb) {
|
||||
}
|
||||
|
||||
Z2SoundHandlePool* Z2CreatureOI::startCreatureSoundLevel(JAISoundID soundID, u32 mapinfo, s8 reverb) {
|
||||
DUSK_AUDIO_SKIP(NULL);
|
||||
|
||||
if (soundID == Z2SE_EN_OI_MOVE) {
|
||||
Z2SoundHandlePool* handle1 = mSoundObjAnime.startLevelSound(soundID, mapinfo, reverb);
|
||||
Z2SoundHandlePool* handle2 = field_0xa4.startLevelSound(soundID, mapinfo, reverb);
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "JSystem/JAudio2/JAISeq.h"
|
||||
#include "os_report.h"
|
||||
|
||||
#include "dusk/audio.h"
|
||||
|
||||
static const char* sSpotName[] = {
|
||||
"F_SP00",
|
||||
"F_SP103",
|
||||
@@ -131,6 +133,8 @@ Z2SeqMgr::Z2SeqMgr() : JASGlobalInstance<Z2SeqMgr>(true) {
|
||||
}
|
||||
|
||||
void Z2SeqMgr::bgmStart(u32 bgmID, u32 fadeTime, s32 param_2) {
|
||||
DUSK_AUDIO_SKIP();
|
||||
|
||||
switch (bgmID) {
|
||||
case 0xFFFFFFFF:
|
||||
return;
|
||||
@@ -591,6 +595,8 @@ static void dummy1() {
|
||||
}
|
||||
|
||||
void Z2SeqMgr::bgmStreamPrepare(u32 bgmID) {
|
||||
DUSK_AUDIO_SKIP();
|
||||
|
||||
u32 bgmID2 = bgmID;
|
||||
if (mStreamBgmHandle) {
|
||||
bgmStreamStop(0);
|
||||
@@ -648,6 +654,8 @@ bool Z2SeqMgr::bgmStreamCheckReady() {
|
||||
}
|
||||
|
||||
void Z2SeqMgr::bgmStreamPlay() {
|
||||
DUSK_AUDIO_SKIP();
|
||||
|
||||
if (mStreamBgmHandle) {
|
||||
mStreamBgmHandle->unlockIfLocked();
|
||||
}
|
||||
|
||||
@@ -117,6 +117,8 @@ Z2SoundMgr::Z2SoundMgr() :
|
||||
}
|
||||
|
||||
bool Z2SoundMgr::startSound(JAISoundID soundID, JAISoundHandle* handle, const JGeometry::TVec3<f32>* posPtr) {
|
||||
DUSK_AUDIO_SKIP(true);
|
||||
|
||||
int soundType = Z2GetSoundInfo()->getSoundType(soundID);
|
||||
switch (soundType) {
|
||||
case 0: {
|
||||
@@ -180,8 +182,8 @@ bool Z2SoundMgr::startSound(JAISoundID soundID, JAISoundHandle* handle, const JG
|
||||
}
|
||||
return streamMgr_.startSound(soundID, handle, posPtr);
|
||||
default:
|
||||
char error[32];
|
||||
sprintf(error, "Unknown Sound-Type id :%08x\n", *(u32*)&soundID);
|
||||
char error[64];
|
||||
sprintf(error, "Unknown Sound-Type id :%08x\n", (u32)soundID);
|
||||
JUT_WARN(277, "%s", error);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "Z2AudioLib/Z2Audience.h"
|
||||
#include "JSystem/JAudio2/JAUSoundAnimator.h"
|
||||
|
||||
#include "dusk/audio.h"
|
||||
|
||||
#ifndef __MWERKS__
|
||||
#include <limits>
|
||||
#define FLT_MAX std::numeric_limits<float>::max()
|
||||
@@ -88,6 +90,8 @@ bool Z2SoundObjBase::stopOK(Z2SoundHandlePool& handlePool) {
|
||||
}
|
||||
|
||||
Z2SoundHandlePool* Z2SoundObjBase::startSound(JAISoundID soundID, u32 mapinfo, s8 reverb) {
|
||||
DUSK_AUDIO_SKIP(NULL);
|
||||
|
||||
if (!alive_) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -248,6 +252,8 @@ void Z2DopplerSoundObjBase::framework(u32 param_0, s8 reverb) {
|
||||
}
|
||||
|
||||
Z2SoundHandlePool* Z2DopplerSoundObjBase::startSound(JAISoundID soundID, u32 mapinfo, s8 reverb) {
|
||||
DUSK_AUDIO_SKIP(NULL);
|
||||
|
||||
JGeometry::TVec3<f32>* pos = pos_;
|
||||
pos_ = NULL;
|
||||
|
||||
@@ -263,6 +269,8 @@ Z2SoundHandlePool* Z2DopplerSoundObjBase::startSound(JAISoundID soundID, u32 map
|
||||
}
|
||||
|
||||
Z2SoundHandlePool* Z2DopplerSoundObjBase::startLevelSound(JAISoundID soundID, u32 mapinfo, s8 reverb) {
|
||||
DUSK_AUDIO_SKIP(NULL);
|
||||
|
||||
JGeometry::TVec3<f32>* pos = pos_;
|
||||
pos_ = NULL;
|
||||
|
||||
@@ -284,6 +292,8 @@ void Z2SoundObjSimple::init(Vec* posPtr, u8 handleNum) {
|
||||
}
|
||||
|
||||
Z2SoundHandlePool* Z2SoundObjSimple::startSound(JAISoundID soundID, u32 mapinfo, s8 reverb) {
|
||||
DUSK_AUDIO_SKIP(NULL);
|
||||
|
||||
Z2SoundHandlePool* handle = Z2SoundObjBase::startSound(soundID, mapinfo, reverb);
|
||||
|
||||
if (soundID == Z2SE_AL_UKI_POKOPOKO && handle != NULL && (*handle) != false) {
|
||||
@@ -297,6 +307,8 @@ Z2SoundHandlePool* Z2SoundObjSimple::startSound(JAISoundID soundID, u32 mapinfo,
|
||||
}
|
||||
|
||||
Z2SoundHandlePool* Z2SoundObjSimple::startLevelSound(JAISoundID soundID, u32 mapinfo, s8 reverb) {
|
||||
DUSK_AUDIO_SKIP(NULL);
|
||||
|
||||
Z2SoundHandlePool* handle = Z2SoundObjBase::startLevelSound(soundID, mapinfo, reverb);
|
||||
|
||||
if (handle != NULL && (*handle) != false) {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "d/actor/d_a_alink.h"
|
||||
#include "d/d_com_inf_game.h"
|
||||
#include "d/d_k_wmark.h"
|
||||
#include "dusk/gx_helper.h"
|
||||
|
||||
const EffParamProc daAlink_c::m_fEffParamProc[] = {
|
||||
&daAlink_c::setEffectFrontRollParam,
|
||||
@@ -2025,7 +2026,11 @@ void daAlink_blur_c::traceBlur(cXyz const* param_0, cXyz const* param_1, s16 par
|
||||
void daAlink_blur_c::draw() {
|
||||
j3dSys.reinitGX();
|
||||
|
||||
static GXTexObj texObj;
|
||||
#ifdef TARGET_PC
|
||||
TGXTexObj texObj;
|
||||
#else
|
||||
static TGXTexObj texObj;
|
||||
#endif
|
||||
static GXColor nColor0 = {0xFF, 0xFF, 0xFF, 0x14};
|
||||
|
||||
GXSetNumIndStages(0);
|
||||
|
||||
@@ -134,7 +134,7 @@ int daE_BG_c::draw() {
|
||||
cXyz offsetPos;
|
||||
offsetPos.set(current.pos.x, current.pos.y + 100.0f, current.pos.z);
|
||||
|
||||
GXTexObj* texObj = dDlst_shadowControl_c::getSimpleTex();
|
||||
TGXTexObj* texObj = dDlst_shadowControl_c::getSimpleTex();
|
||||
|
||||
mShadowKey = dComIfGd_setShadow(mShadowKey, 0x01, model, &offsetPos, 200.0f, 0.0f, current.pos.y,
|
||||
mObjAcch.GetGroundH(), mObjAcch.m_gnd, &tevStr, 0, 1.0f, texObj);
|
||||
|
||||
@@ -6581,6 +6581,12 @@ static int daE_RD_Execute(e_rd_class* i_this) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
MtxPush();
|
||||
s16 x, y;
|
||||
|
||||
#if AVOID_UB
|
||||
x = 0;
|
||||
y = 0;
|
||||
#endif
|
||||
|
||||
if (i == 0) {
|
||||
mae.set(38.0f, 0.0f, 0.0f);
|
||||
MtxPosition(&mae, &ato);
|
||||
|
||||
@@ -1048,7 +1048,7 @@ int daE_SB_c::Draw() {
|
||||
mpMorf->entryDL();
|
||||
cXyz my_vec;
|
||||
my_vec.set(current.pos.x, 100.0f + current.pos.y, current.pos.z);
|
||||
GXTexObj* tex_obj = dDlst_shadowControl_c::getSimpleTex();
|
||||
TGXTexObj* tex_obj = dDlst_shadowControl_c::getSimpleTex();
|
||||
mShadowKey = dComIfGd_setShadow(mShadowKey, 1, model, &my_vec, 1000.0f, 300.0f,
|
||||
current.pos.y, mAcch.GetGroundH(), mAcch.m_gnd,
|
||||
&tevStr, 0, 1.0f, tex_obj);
|
||||
|
||||
@@ -93,7 +93,7 @@ static int daE_SG_Draw(e_sg_class* i_this) {
|
||||
cXyz shadow_pos(i_this->current.pos.x, i_this->current.pos.y + 100.0f,
|
||||
i_this->current.pos.z);
|
||||
|
||||
GXTexObj* tex_obj = dDlst_shadowControl_c::getSimpleTex();
|
||||
TGXTexObj* tex_obj = dDlst_shadowControl_c::getSimpleTex();
|
||||
|
||||
i_this->mShadowKey =
|
||||
dComIfGd_setShadow(i_this->mShadowKey, 1, i_this->mpModel, &shadow_pos, 400.0f, 0.0f,
|
||||
|
||||
@@ -320,8 +320,8 @@ void daFmtMng_c::executeFight() {
|
||||
}
|
||||
}
|
||||
|
||||
static bool daFmtMng_Draw(daFmtMng_c* param_0) {
|
||||
return true;
|
||||
static BOOL daFmtMng_Draw(daFmtMng_c* param_0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int daFmtMng_Execute(daFmtMng_c* param_0) {
|
||||
|
||||
@@ -82,6 +82,10 @@ static int daKytag12_Execute_standard(kytag12_class* i_this) {
|
||||
f32 var_f29;
|
||||
f32 var_f28;
|
||||
|
||||
#if AVOID_UB
|
||||
var_f30 = 0;
|
||||
#endif
|
||||
|
||||
int var_r24 = 0;
|
||||
int var_r23 = 0;
|
||||
int var_r22 = 0;
|
||||
|
||||
@@ -298,7 +298,7 @@ void daMant_packet_c::draw() {
|
||||
GXTlutObj GStack_80;
|
||||
GXInitTlutObj(&GStack_80, lut, GX_TL_RGB5A3, 0x100);
|
||||
|
||||
GXTexObj GStack_74;
|
||||
TGXTexObj GStack_74;
|
||||
GXInitTexObjCI(&GStack_74, image, 0x80, 0x80, GX_TF_C8, GX_CLAMP, GX_CLAMP, 0, 0);
|
||||
GXInitTexObjLOD(&GStack_74, GX_LINEAR, GX_LINEAR, 0.0, 0.0, 0.0, 0, 0, GX_ANISO_1);
|
||||
|
||||
@@ -314,6 +314,9 @@ void daMant_packet_c::draw() {
|
||||
GXLoadNrmMtxImm(MStack_54, GX_PNMTX0);
|
||||
GXCallDisplayList(l_Egnd_mantDL, 0x3e0);
|
||||
|
||||
#ifdef TARGET_PC
|
||||
GStack_74.reset();
|
||||
#endif
|
||||
GXInitTexObjCI(&GStack_74, l_Egnd_mantTEX_U, 0x80, 0x80, GX_TF_C8, GX_CLAMP, GX_CLAMP, 0, 0);
|
||||
GXInitTexObjLOD(&GStack_74, GX_LINEAR, GX_LINEAR, 0.0, 0.0, 0.0, 0, 0, GX_ANISO_1);
|
||||
GXLoadTexObj(&GStack_74, GX_TEXMAP0);
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#include "f_op/f_op_overlap_mng.h"
|
||||
#include <cstring>
|
||||
|
||||
#include "dusk/gx_helper.h"
|
||||
|
||||
inline s32 daMP_NEXT_READ_SIZE(daMP_THPReadBuffer* readBuf) {
|
||||
return *(s32*)readBuf->ptr;
|
||||
}
|
||||
@@ -3155,9 +3157,9 @@ static void daMP_THPGXYuv2RgbSetup(const GXRenderModeObj* rmode) {
|
||||
static void daMP_THPGXYuv2RgbDraw(u8* y_data, u8* u_data, u8* v_data, s16 x,
|
||||
s16 y, s16 textureWidth, s16 textureHeight, s16 polygonWidth,
|
||||
s16 polygonHeight) {
|
||||
GXTexObj tobj0;
|
||||
GXTexObj tobj1;
|
||||
GXTexObj tobj2;
|
||||
TGXTexObj tobj0;
|
||||
TGXTexObj tobj1;
|
||||
TGXTexObj tobj2;
|
||||
|
||||
GXInitTexObj(&tobj0, y_data, textureWidth, textureHeight, GX_TF_I8, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
GXInitTexObjLOD(&tobj0, GX_NEAR, GX_NEAR, 0.0f, 0.0f, 0.0f, 0, 0, GX_ANISO_1);
|
||||
|
||||
@@ -7,20 +7,20 @@
|
||||
|
||||
#include "d/actor/d_a_npc_mk.h"
|
||||
|
||||
static bool daNpc_Mk_Create(void* param_0) {
|
||||
return true;
|
||||
static BOOL daNpc_Mk_Create(void* param_0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool daNpc_Mk_Delete(void* param_0) {
|
||||
return true;
|
||||
static BOOL daNpc_Mk_Delete(void* param_0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool daNpc_Mk_Execute(void* param_0) {
|
||||
return true;
|
||||
static BOOL daNpc_Mk_Execute(void* param_0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool daNpc_Mk_Draw(void* param_0) {
|
||||
return true;
|
||||
static BOOL daNpc_Mk_Draw(void* param_0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL daNpc_Mk_IsDelete(void* param_0) {
|
||||
|
||||
@@ -7,20 +7,20 @@
|
||||
|
||||
#include "d/actor/d_a_npc_p2.h"
|
||||
|
||||
static bool daNpc_P2Create(void* param_0) {
|
||||
return true;
|
||||
static BOOL daNpc_P2Create(void* param_0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool daNpc_P2Delete(void* param_0) {
|
||||
return true;
|
||||
static BOOL daNpc_P2Delete(void* param_0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool daNpc_P2Execute(void* param_0) {
|
||||
return true;
|
||||
static BOOL daNpc_P2Execute(void* param_0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool daNpc_P2Draw(void* param_0) {
|
||||
return true;
|
||||
static BOOL daNpc_P2Draw(void* param_0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL daNpc_P2IsDelete(void* param_0) {
|
||||
|
||||
@@ -16,12 +16,12 @@ static int daNpc_shopMaro_Delete(void* i_this) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static bool daNpc_shopMaro_Execute(void* i_this) {
|
||||
return false;
|
||||
static BOOL daNpc_shopMaro_Execute(void* i_this) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static bool daNpc_shopMaro_Draw(void* i_this) {
|
||||
return false;
|
||||
static BOOL daNpc_shopMaro_Draw(void* i_this) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL daNpc_shopMaro_IsDelete(void* i_this) {
|
||||
|
||||
@@ -485,8 +485,8 @@ static void daNpc_solA_Draw(void* param_0) {
|
||||
return static_cast<daNpc_solA_c*>(param_0)->Draw();
|
||||
}
|
||||
|
||||
static bool daNpc_solA_IsDelete(void* param_0) {
|
||||
return true;
|
||||
static BOOL daNpc_solA_IsDelete(void* param_0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static actor_method_class daNpc_solA_MethodTable = {
|
||||
|
||||
@@ -1338,7 +1338,7 @@ static int daObj_Brg_Execute(obj_brg_class* i_this) {
|
||||
|
||||
i_this->mpBgW->CopyBackVtx();
|
||||
|
||||
Vec* vtx_tbl = (Vec*)i_this->mpBgW->GetVtxTbl();
|
||||
BE(Vec)* vtx_tbl = (BE(Vec)*)i_this->mpBgW->GetVtxTbl();
|
||||
|
||||
int dbg_0x30;
|
||||
int temp;
|
||||
@@ -1622,7 +1622,7 @@ static int CallbackCreateHeap(fopAc_ac_c* i_this) {
|
||||
a_this->mpBgW->SetRideCallback(ride_call_back);
|
||||
a_this->mpBgW->CopyBackVtx();
|
||||
|
||||
Vec* vtx_tbl = (Vec*)a_this->mpBgW->GetVtxTbl();
|
||||
BE(Vec)* vtx_tbl = (BE(Vec)*)a_this->mpBgW->GetVtxTbl();
|
||||
for (int i = 0; i < a_this->mpBgW->GetVtxNum(); i++) {
|
||||
vtx_tbl[i] = i_this->current.pos;
|
||||
}
|
||||
|
||||
@@ -259,8 +259,8 @@ static int daObjFlag_Execute(daObjFlag_c* param_0) {
|
||||
return param_0->execute();
|
||||
}
|
||||
|
||||
static bool daObjFlag_IsDelete(daObjFlag_c* param_0) {
|
||||
return true;
|
||||
static BOOL daObjFlag_IsDelete(daObjFlag_c* param_0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int daObjFlag_Delete(daObjFlag_c* param_0) {
|
||||
|
||||
@@ -530,7 +530,7 @@ int daObj_KBacket_c::Draw() {
|
||||
} else {
|
||||
cM3dGPla plane;
|
||||
if (dComIfG_Bgsp().GetTriPla(mGndChk, &plane) != 0) {
|
||||
GXTexObj* p_Var4 = dDlst_shadowControl_c::getSimpleTex();
|
||||
TGXTexObj* p_Var4 = dDlst_shadowControl_c::getSimpleTex();
|
||||
dComIfGd_setSimpleShadow(¤t.pos, field_0xa00, 50.0f,
|
||||
&plane.mNormal, 0, 1.0f, p_Var4);
|
||||
}
|
||||
|
||||
@@ -980,7 +980,7 @@ int daObjStone_c::draw() {
|
||||
|
||||
if (!model) {
|
||||
f32 shadow_size = l_shadow_size[mStoneType];
|
||||
GXTexObj* pTex = dDlst_shadowControl_c::getSimpleTex();
|
||||
TGXTexObj* pTex = dDlst_shadowControl_c::getSimpleTex();
|
||||
cXyz pos = current.pos;
|
||||
|
||||
dComIfGd_setSimpleShadow(&pos, mChkObj.GetGroundH(), shadow_size, mChkObj.m_gnd, 0,
|
||||
|
||||
@@ -366,7 +366,7 @@ JKRHeap* daPy_anmHeap_c::setAnimeHeap() {
|
||||
#include "assets/l_sightDL__d_a_player.h"
|
||||
|
||||
void daPy_sightPacket_c::draw() {
|
||||
GXTexObj texObj;
|
||||
TGXTexObj texObj;
|
||||
|
||||
j3dSys.reinitGX();
|
||||
GXSetNumIndStages(0);
|
||||
|
||||
@@ -1017,6 +1017,10 @@ void dCamera_c::debugDrawInit() {
|
||||
}
|
||||
|
||||
bool dCamera_c::Run() {
|
||||
#if TARGET_PC
|
||||
ResetView();
|
||||
#endif
|
||||
|
||||
daAlink_c* link = daAlink_getAlinkActorClass();
|
||||
daMidna_c* midna = daPy_py_c::getMidnaActor();
|
||||
mMidnaRidingAndVisible = link->checkMidnaRide() && !midna->checkNoDraw();
|
||||
|
||||
@@ -1366,7 +1366,7 @@ s8 dComIfGp_getReverb(int i_roomNo) {
|
||||
}
|
||||
|
||||
int dComIfGd_setSimpleShadow(cXyz* i_pos, f32 param_1, f32 param_2, cBgS_PolyInfo& param_3,
|
||||
s16 i_angle, f32 param_5, GXTexObj* i_tex) {
|
||||
s16 i_angle, f32 param_5, TGXTexObj* i_tex) {
|
||||
if (param_3.ChkSetInfo() && -G_CM3D_F_INF != param_1) {
|
||||
cM3dGPla plane;
|
||||
dComIfG_Bgsp().GetTriPla(param_3, &plane);
|
||||
@@ -2256,7 +2256,7 @@ void dComIfGp_addSelectItemNum(int i_selItemIdx, s16 i_num) {
|
||||
|
||||
int dComIfGd_setShadow(u32 param_0, s8 param_1, J3DModel* param_2, cXyz* param_3, f32 param_4,
|
||||
f32 param_5, f32 param_6, f32 param_7, cBgS_PolyInfo& param_8,
|
||||
dKy_tevstr_c* param_9, s16 param_10, f32 param_11, GXTexObj* param_12) {
|
||||
dKy_tevstr_c* param_9, s16 param_10, f32 param_11, TGXTexObj* param_12) {
|
||||
if (param_7 <= -G_CM3D_F_INF) {
|
||||
return 0;
|
||||
} else {
|
||||
|
||||
+1
-2
@@ -22,7 +22,7 @@ void jstudio_tAdaptor_message::adaptor_do_MESSAGE(JStudio::data::TEOperationData
|
||||
case JStudio::data::UNK_0x19: {
|
||||
JUT_ASSERT(107, pContent!=NULL);
|
||||
JUT_ASSERT(108, uSize==4);
|
||||
u32 content = *(u32*)pContent;
|
||||
u32 content = *(BE(u32)*)pContent;
|
||||
dMsgObject_setDemoMessage(content);
|
||||
break;
|
||||
}
|
||||
@@ -215,7 +215,6 @@ int dDemo_actor_c::getDemoIDData(int* o_arg0, int* o_arg1, int* o_arg2, u16* o_r
|
||||
}
|
||||
|
||||
u32 var_r31 = *it;
|
||||
be_swap(var_r31);
|
||||
*o_arg0 = var_r31 >> 0x1E;
|
||||
*o_arg1 = (var_r31 >> 0x18) & 0xF;
|
||||
*o_arg2 = (var_r31 >> 0x10) & 0xF;
|
||||
|
||||
+18
-19
@@ -11,10 +11,11 @@
|
||||
#include "d/d_com_inf_game.h"
|
||||
#include "d/d_drawlist.h"
|
||||
#include "d/d_s_play.h"
|
||||
#include "dusk/gx_helper.h"
|
||||
#include "dusk/logging.h"
|
||||
#include "m_Do/m_Do_graphic.h"
|
||||
#include "m_Do/m_Do_lib.h"
|
||||
#include "m_Do/m_Do_mtx.h"
|
||||
#include "dusk/logging.h"
|
||||
|
||||
class dDlst_2Dm_c {
|
||||
public:
|
||||
@@ -28,12 +29,12 @@ public:
|
||||
/* 0x10 */ f32 field_0x10;
|
||||
/* 0x14 */ GXColor field_0x14;
|
||||
/* 0x18 */ GXColor field_0x18;
|
||||
/* 0x1C */ GXTexObj field_0x1c;
|
||||
/* 0x1C */ TGXTexObj field_0x1c;
|
||||
/* 0x3C */ GXTlutObj field_0x3c;
|
||||
/* 0x48 */ s16 field_0x48;
|
||||
/* 0x4A */ s16 field_0x4a;
|
||||
/* 0x4C */ u8 field_0x4c;
|
||||
/* 0x50 */ GXTexObj field_0x50;
|
||||
/* 0x50 */ TGXTexObj field_0x50;
|
||||
/* 0x70 */ GXTlutObj field_0x70;
|
||||
/* 0x7C */ s16 field_0x7c;
|
||||
/* 0x7E */ s16 field_0x7e;
|
||||
@@ -87,7 +88,7 @@ class dDlst_2DMt_tex_c {
|
||||
public:
|
||||
u8 check() { return field_0x0; }
|
||||
int getCI() { return mCI; }
|
||||
GXTexObj* getTexObj() { return &mTexObj; }
|
||||
TGXTexObj* getTexObj() { return &mTexObj; }
|
||||
GXTlutObj* getTlutObj() { return &mTlutObj; }
|
||||
GXColor* getColor() { return &mColor; }
|
||||
f32 getS() { return mS; }
|
||||
@@ -97,7 +98,7 @@ public:
|
||||
|
||||
/* 0x00 */ u8 field_0x0;
|
||||
/* 0x01 */ u8 mCI;
|
||||
/* 0x04 */ GXTexObj mTexObj;
|
||||
/* 0x04 */ TGXTexObj mTexObj;
|
||||
/* 0x24 */ GXTlutObj mTlutObj;
|
||||
/* 0x30 */ GXColor mColor;
|
||||
/* 0x34 */ f32 mS;
|
||||
@@ -266,7 +267,7 @@ void dDlst_2DT_c::draw() {
|
||||
u16 var3 = (field_0x1c + var11) / var5 * 32768.0f;
|
||||
u16 var4 = (field_0x20 + var12) / var6 * 32768.0f;
|
||||
|
||||
GXTexObj tex;
|
||||
TGXTexObj tex;
|
||||
GXInitTexObj(&tex, field_0x4, field_0xe, field_0x10, (GXTexFmt)field_0xc, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
GXInitTexObjLOD(&tex, GX_LINEAR, GX_LINEAR, 0.0, 0.0, 0.0, 0, 0, GX_ANISO_1);
|
||||
GXLoadTexObj(&tex, GX_TEXMAP0);
|
||||
@@ -311,9 +312,6 @@ void dDlst_2DT_c::draw() {
|
||||
GXEnd();
|
||||
GXSetClipMode(GX_CLIP_ENABLE);
|
||||
dComIfGp_getCurrentGrafPort()->setup2D();
|
||||
#if TARGET_PC
|
||||
GXDestroyTexObj(&tex);
|
||||
#endif
|
||||
}
|
||||
|
||||
void dDlst_2DT2_c::draw() {
|
||||
@@ -666,7 +664,7 @@ void dDlst_2DM_c::draw() {
|
||||
int r26 = field_0x34 * f3;
|
||||
s16 r25 = r27 + s16(field_0x1e * f4);
|
||||
s16 r24 = r26 + s16(field_0x20 * f3);
|
||||
GXTexObj tex[2];
|
||||
TGXTexObj tex[2];
|
||||
void** stack_1c = &field_0x18;
|
||||
GXInitTexObj(&tex[0], field_0x18, field_0x1e, field_0x20, GXTexFmt(field_0x1c), GX_CLAMP, GX_CLAMP, 0);
|
||||
GXInitTexObjLOD(&tex[0], GX_LINEAR, GX_LINEAR, 0.0, 0.0, 0.0, 0, 0, GX_ANISO_1);
|
||||
@@ -715,10 +713,6 @@ void dDlst_2DM_c::draw() {
|
||||
GXTexCoord2s16(r27, r24);
|
||||
GXEnd();
|
||||
dComIfGp_getCurrentGrafPort()->setup2D();
|
||||
#if TARGET_PC
|
||||
GXDestroyTexObj(&tex[0]);
|
||||
GXDestroyTexObj(&tex[1]);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -733,7 +727,7 @@ void dDlst_2Dm_c::draw() {
|
||||
int r26 = field_0x7e * f30;
|
||||
s16 r25 = r27 + s16(f31 * GXGetTexObjWidth(&field_0x1c));
|
||||
s16 r24 = r26 + s16(f30 * GXGetTexObjHeight(&field_0x1c));
|
||||
GXTexObj* stack_18 = &field_0x1c;
|
||||
TGXTexObj* stack_18 = &field_0x1c;
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBA4, 8);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX1, GX_CLR_RGBA, GX_RGBA4, 8);
|
||||
@@ -1347,7 +1341,7 @@ void dDlst_shadowSimple_c::draw() {
|
||||
}
|
||||
|
||||
void dDlst_shadowSimple_c::set(cXyz* param_0, f32 param_1, f32 param_2, cXyz* param_3,
|
||||
s16 param_4, f32 param_5, GXTexObj* param_6) {
|
||||
s16 param_4, f32 param_5, TGXTexObj* param_6) {
|
||||
if (param_5 < 0.0f) {
|
||||
mAlpha = param_5 * -255.0f;
|
||||
param_5 = 1.0f;
|
||||
@@ -1424,6 +1418,11 @@ void dDlst_shadowControl_c::reset() {
|
||||
mSimpleNum = 0;
|
||||
mRealNum = 0;
|
||||
field_0x4 = NULL;
|
||||
|
||||
#ifdef TARGET_PC
|
||||
field_0x15eb0[0].reset();
|
||||
field_0x15eb0[1].reset();
|
||||
#endif
|
||||
}
|
||||
|
||||
void dDlst_shadowControl_c::imageDraw(Mtx param_0) {
|
||||
@@ -1529,7 +1528,7 @@ void dDlst_shadowControl_c::draw(Mtx param_0) {
|
||||
for (int i2 = 0, i3 = 0; real != NULL; real = real->getZsortNext()) {
|
||||
if (real->isUse()) {
|
||||
if (i2 == 0) {
|
||||
GXTexObj* obj = &field_0x15eb0[i3];
|
||||
TGXTexObj* obj = &field_0x15eb0[i3];
|
||||
i3++;
|
||||
|
||||
GXLoadTexObj(obj, GX_TEXMAP0);
|
||||
@@ -1671,7 +1670,7 @@ bool dDlst_shadowControl_c::addReal(u32 i_key, J3DModel* param_1) {
|
||||
}
|
||||
|
||||
int dDlst_shadowControl_c::setSimple(cXyz* param_0, f32 param_1, f32 param_2, cXyz* param_3,
|
||||
s16 param_4, f32 param_5, GXTexObj* param_6) {
|
||||
s16 param_4, f32 param_5, TGXTexObj* param_6) {
|
||||
if (param_3 == NULL || mSimpleNum >= 128) {
|
||||
return 0;
|
||||
}
|
||||
@@ -1681,7 +1680,7 @@ int dDlst_shadowControl_c::setSimple(cXyz* param_0, f32 param_1, f32 param_2, cX
|
||||
return 1;
|
||||
}
|
||||
|
||||
GXTexObj dDlst_shadowControl_c::mSimpleTexObj;
|
||||
TGXTexObj dDlst_shadowControl_c::mSimpleTexObj;
|
||||
|
||||
void dDlst_shadowControl_c::setSimpleTex(ResTIMG const* i_timg) {
|
||||
mDoLib_setResTimgObj(i_timg, &mSimpleTexObj, 0, NULL);
|
||||
|
||||
@@ -251,6 +251,9 @@ static void drawCapture(u8 alpha) {
|
||||
GXSetAlphaUpdate(GX_FALSE);
|
||||
j3dSys.drawInit();
|
||||
|
||||
#ifdef TARGET_PC
|
||||
mDoGph_gInf_c::getFrameBufferTexObj()->reset();
|
||||
#endif
|
||||
GXInitTexObj(mDoGph_gInf_c::getFrameBufferTexObj(), mDoGph_gInf_c::getFrameBufferTex(), FB_WIDTH / 2, FB_HEIGHT / 2, (GXTexFmt)mDoGph_gInf_c::getFrameBufferTimg()->format, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
GXInitTexObjLOD(mDoGph_gInf_c::getFrameBufferTexObj(), GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE, GX_ANISO_1);
|
||||
GXLoadTexObj(mDoGph_gInf_c::getFrameBufferTexObj(), GX_TEXMAP0);
|
||||
|
||||
+16
-6
@@ -1537,6 +1537,12 @@ int dEvDtBase_c::init(char* i_data, int i_roomNo) {
|
||||
|
||||
setHeaderP((event_binary_data_header*)i_data);
|
||||
|
||||
#if TARGET_PC
|
||||
bool needSwap = mHeaderP->unk[0] == 0;
|
||||
JUT_ASSERT(1234, mHeaderP->unk[0] == 0 || mHeaderP->unk[0] == 1);
|
||||
mHeaderP->unk[0] = 1;
|
||||
#endif
|
||||
|
||||
if (getEventNum() > 0) {
|
||||
setEventP((dEvDtEvent_c*)(i_data + getEventTop()));
|
||||
}
|
||||
@@ -1556,9 +1562,11 @@ int dEvDtBase_c::init(char* i_data, int i_roomNo) {
|
||||
if (getFDataNum() > 0) {
|
||||
#if TARGET_PC
|
||||
auto data = (f32*)(i_data + getFDataTop());
|
||||
int num = getFDataNum();
|
||||
for (int i = 0; i < num; i++)
|
||||
be_swap(data[i]);
|
||||
if (needSwap) {
|
||||
int num = getFDataNum();
|
||||
for (int i = 0; i < num; i++)
|
||||
be_swap(data[i]);
|
||||
}
|
||||
setFDataP(data);
|
||||
#else
|
||||
setFDataP((f32*)(i_data + getFDataTop()));
|
||||
@@ -1569,9 +1577,11 @@ int dEvDtBase_c::init(char* i_data, int i_roomNo) {
|
||||
#if TARGET_PC
|
||||
// endian swap here
|
||||
auto data = (int*)(i_data + getIDataTop());
|
||||
int num = getIDataNum();
|
||||
for (int i = 0; i < num; i++)
|
||||
be_swap(data[i]);
|
||||
if (needSwap) {
|
||||
int num = getIDataNum();
|
||||
for (int i = 0; i < num; i++)
|
||||
be_swap(data[i]);
|
||||
}
|
||||
setIDataP(data);
|
||||
#else
|
||||
setIDataP((int*)(i_data + getIDataTop()));
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "JSystem/J2DGraph/J2DGrafContext.h"
|
||||
#include <cstring>
|
||||
|
||||
#include "dusk/gx_helper.h"
|
||||
|
||||
class dGov_HIO_c : public mDoHIO_entry_c {
|
||||
public:
|
||||
dGov_HIO_c();
|
||||
@@ -32,7 +34,7 @@ public:
|
||||
static dGov_HIO_c l_HIO;
|
||||
|
||||
void dDlst_Gameover_CAPTURE_c::draw() {
|
||||
GXTexObj tex_obj;
|
||||
TGXTexObj tex_obj;
|
||||
Mtx44 m;
|
||||
|
||||
GXSetTexCopySrc(0, 0, FB_WIDTH, FB_HEIGHT);
|
||||
|
||||
@@ -198,6 +198,9 @@ void dHomeButton_c::drawCapture(u8 param_0, void (*param_1)(J2DOrthoGraph&, void
|
||||
sp30.setPort();
|
||||
|
||||
dComIfGp_setCurrentGrafPort(&sp30);
|
||||
#ifdef TARGET_PC
|
||||
mDoGph_gInf_c::m_fullFrameBufferTexObj.reset();
|
||||
#endif
|
||||
mDoLib_setResTimgObj(mDoGph_gInf_c::m_fullFrameBufferTimg,
|
||||
&mDoGph_gInf_c::m_fullFrameBufferTexObj, 0, NULL);
|
||||
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ int dkWmark_c::m_nowID;
|
||||
int dkWmark_c::create() {
|
||||
static cXyz wolfFootScale(1.1f, 1.0f, 0.6f);
|
||||
|
||||
JKR_NEW_ARGS (this) dkWmark_c();
|
||||
new (this) dkWmark_c;
|
||||
|
||||
field_0x48a = this->parameters >> 0x10;
|
||||
this->parameters &= 0xFFFF;
|
||||
|
||||
+34
-15
@@ -71,7 +71,10 @@ void dKy_set_eyevect_calc2(camera_class* i_camera, Vec* o_out, f32 param_2, f32
|
||||
}
|
||||
}
|
||||
|
||||
static void dKyr_set_btitex_common(GXTexObj* i_obj, ResTIMG* i_img, GXTexMapID i_mapID) {
|
||||
static void dKyr_set_btitex_common(TGXTexObj* i_obj, ResTIMG* i_img, GXTexMapID i_mapID) {
|
||||
#ifdef TARGET_PC
|
||||
i_obj->reset();
|
||||
#endif
|
||||
GXInitTexObj(i_obj, (&i_img->format + i_img->imageOffset), i_img->width, i_img->height,
|
||||
(GXTexFmt)i_img->format, (GXTexWrapMode)i_img->wrapS, (GXTexWrapMode)i_img->wrapT,
|
||||
(GXBool)(i_img->mipmapCount > 1));
|
||||
@@ -84,7 +87,7 @@ static void dKyr_set_btitex_common(GXTexObj* i_obj, ResTIMG* i_img, GXTexMapID i
|
||||
GXLoadTexObj(i_obj, i_mapID);
|
||||
}
|
||||
|
||||
static void dKyr_set_btitex(GXTexObj* i_obj, ResTIMG* i_img) {
|
||||
static void dKyr_set_btitex(TGXTexObj* i_obj, ResTIMG* i_img) {
|
||||
dKyr_set_btitex_common(i_obj, i_img, GX_TEXMAP0);
|
||||
}
|
||||
|
||||
@@ -2116,7 +2119,7 @@ static void dKyr_draw_rev_moon(Mtx drawMtx, u8** tex) {
|
||||
return;
|
||||
}
|
||||
|
||||
GXTexObj texobj;
|
||||
TGXTexObj texobj;
|
||||
dKyr_set_btitex_common(&texobj, (ResTIMG*)tex[0], GX_TEXMAP0);
|
||||
dKyr_set_btitex_common(&texobj, (ResTIMG*)tex[1], GX_TEXMAP1);
|
||||
dKyr_set_btitex_common(&texobj, (ResTIMG*)tex[texidx + 2], GX_TEXMAP2);
|
||||
@@ -2464,7 +2467,7 @@ void dKyr_drawSun(Mtx drawMtx, cXyz* ppos, GXColor& unused, u8** tex) {
|
||||
return;
|
||||
}
|
||||
|
||||
GXTexObj texobj;
|
||||
TGXTexObj texobj;
|
||||
dKyr_set_btitex_common(&texobj, (ResTIMG*)tex[0], GX_TEXMAP0);
|
||||
dKyr_set_btitex_common(&texobj, (ResTIMG*)tex[1], GX_TEXMAP1);
|
||||
dKyr_set_btitex_common(&texobj, (ResTIMG*)tex[texidx + 2], GX_TEXMAP2);
|
||||
@@ -2724,7 +2727,7 @@ void dKyr_drawLenzflare(Mtx drawMtx, cXyz* ppos, GXColor& param_2, u8** tex) {
|
||||
|
||||
j3dSys.reinitGX();
|
||||
|
||||
GXTexObj texobj;
|
||||
TGXTexObj texobj;
|
||||
dKyr_set_btitex(&texobj, (ResTIMG*)tex[0]);
|
||||
GXSetNumChans(0);
|
||||
GXSetTevColor(GX_TEVREG0, color_reg0);
|
||||
@@ -3125,7 +3128,7 @@ void dKyr_drawRain(Mtx drawMtx, u8** tex) {
|
||||
return;
|
||||
}
|
||||
|
||||
GXTexObj texobj;
|
||||
TGXTexObj texobj;
|
||||
dKyr_set_btitex(&texobj, (ResTIMG*)tex[0]);
|
||||
GXSetNumChans(0);
|
||||
GXSetTevColor(GX_TEVREG0, color_reg0);
|
||||
@@ -3290,7 +3293,7 @@ void dKyr_drawSibuki(Mtx drawMtx, u8** tex) {
|
||||
color.b = 0xC8;
|
||||
color.a = rain_packet->mSibukiAlpha * alphaFade;
|
||||
|
||||
GXTexObj texobj;
|
||||
TGXTexObj texobj;
|
||||
dKyr_set_btitex(&texobj, (ResTIMG*)tex[1]);
|
||||
GXSetNumChans(0);
|
||||
GXSetTevColor(GX_TEVREG0, color);
|
||||
@@ -3378,7 +3381,7 @@ void dKyr_drawHousi(Mtx drawMtx, u8** tex) {
|
||||
Mtx camMtx;
|
||||
Mtx rotMtx;
|
||||
cXyz pos[4];
|
||||
GXTexObj spDC;
|
||||
TGXTexObj spDC;
|
||||
cXyz spD0;
|
||||
Vec spC4;
|
||||
Vec spB8;
|
||||
@@ -3795,7 +3798,7 @@ void dKyr_drawSnow(Mtx drawMtx, u8** tex) {
|
||||
}
|
||||
|
||||
if (tex[0] != NULL) {
|
||||
GXTexObj spA0;
|
||||
TGXTexObj spA0;
|
||||
dKyr_set_btitex(&spA0, (ResTIMG*)tex[0]);
|
||||
GXSetNumChans(0);
|
||||
GXSetTevColor(GX_TEVREG0, color_reg0);
|
||||
@@ -4334,7 +4337,7 @@ void drawCloudShadow(Mtx drawMtx, u8** tex) {
|
||||
|
||||
GXSetClipMode(GX_CLIP_DISABLE);
|
||||
|
||||
GXTexObj texobj, fb_texobj;
|
||||
TGXTexObj texobj, fb_texobj;
|
||||
if (g_env_light.mMoyaMode < 50) {
|
||||
dKy_ParticleColor_get_bg(&camera->view.lookat.eye, NULL, &sp48, &sp44, &sp40, &sp3C, 0.0f);
|
||||
f32 temp_f30 = 0.4f;
|
||||
@@ -4539,7 +4542,7 @@ void drawVrkumo(Mtx drawMtx, GXColor& color, u8** tex) {
|
||||
Mtx camMtx;
|
||||
Mtx rotMtx;
|
||||
|
||||
GXTexObj texobj;
|
||||
TGXTexObj texobj;
|
||||
cXyz proj;
|
||||
|
||||
f32 rot;
|
||||
@@ -5370,7 +5373,7 @@ void dKyr_odour_draw(Mtx drawMtx, u8** tex) {
|
||||
break;
|
||||
}
|
||||
|
||||
GXTexObj texobj, fb_texobj;
|
||||
TGXTexObj texobj, fb_texobj;
|
||||
dKyr_set_btitex_common(&texobj, (ResTIMG*)tex[0], GX_TEXMAP1);
|
||||
|
||||
ResTIMG* fb_timg = mDoGph_gInf_c::getFrameBufferTimg();
|
||||
@@ -5764,7 +5767,7 @@ void dKyr_mud_draw(Mtx drawMtx, u8** tex) {
|
||||
|
||||
if (g_env_light.camera_water_in_status == 0) {
|
||||
for (int i = 0; i < 1; i++) {
|
||||
GXTexObj texobj;
|
||||
TGXTexObj texobj;
|
||||
dKyr_set_btitex(&texobj, (ResTIMG*)tex[0]);
|
||||
|
||||
GXSetNumChans(0);
|
||||
@@ -5924,7 +5927,7 @@ static void dKyr_evil_draw2(Mtx drawMtx, u8** tex) {
|
||||
color_reg0.b = 0x87;
|
||||
color_reg0.a = 0xFF;
|
||||
|
||||
GXTexObj texobj;
|
||||
TGXTexObj texobj;
|
||||
dKyr_set_btitex(&texobj, (ResTIMG*)tex[1]);
|
||||
|
||||
rot += 0.7f;
|
||||
@@ -5980,11 +5983,19 @@ static void dKyr_evil_draw2(Mtx drawMtx, u8** tex) {
|
||||
|
||||
mDoLib_project(&sp7C, &proj);
|
||||
|
||||
#if TARGET_PC
|
||||
if (!(proj.x > -sp34.x) || !(proj.x < (dComIfGd_getViewport()->width + sp34.x)) ||
|
||||
!(proj.y > -sp34.y) || !(proj.y < (dComIfGd_getViewport()->height + sp34.z)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
#else
|
||||
if (!(proj.x > -sp34.x) || !(proj.x < (FB_WIDTH + sp34.x)) ||
|
||||
!(proj.y > -sp34.y) || !(proj.y < (458.0f + sp34.z)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
f32 sp40;
|
||||
@@ -6147,7 +6158,7 @@ void dKyr_evil_draw(Mtx drawMtx, u8** tex) {
|
||||
color_reg1.b = 10;
|
||||
color_reg1.a = 255;
|
||||
|
||||
GXTexObj texobj;
|
||||
TGXTexObj texobj;
|
||||
dKyr_set_btitex(&texobj, (ResTIMG*)tex[0]);
|
||||
|
||||
rot += 1.0f;
|
||||
@@ -6205,11 +6216,19 @@ void dKyr_evil_draw(Mtx drawMtx, u8** tex) {
|
||||
|
||||
mDoLib_project(&spA4, &proj);
|
||||
|
||||
#if TARGET_PC
|
||||
if (!(proj.x > -sp44.x) || !(proj.x < (dComIfGd_getViewport()->width + sp44.x)) ||
|
||||
!(proj.y > -sp44.y) || !(proj.y < (dComIfGd_getViewport()->height + sp44.z)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
#else
|
||||
if (!(proj.x > -sp44.x) || !(proj.x < (FB_WIDTH + sp44.x)) ||
|
||||
!(proj.y > -sp44.y) || !(proj.y < (458.0f + sp44.z)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
f32 sp5C;
|
||||
|
||||
@@ -341,6 +341,7 @@ inline u8 twoValueLineInterpolation(u8 param_0, u8 param_1, f32 param_2) {
|
||||
}
|
||||
|
||||
void renderingAmap_c::draw() {
|
||||
#if REQUIRES_GX_LINES
|
||||
f32 tmp = ((f32)(g_Counter.mCounter0 % dMap_HIO_prm_res_dst_s::m_res->field_0x1aa) /
|
||||
(f32)dMap_HIO_prm_res_dst_s::m_res->field_0x1aa);
|
||||
tmp = tmp;
|
||||
@@ -376,6 +377,7 @@ void renderingAmap_c::draw() {
|
||||
setAmapPaletteColor(0x2E, temp_r31, temp_r30, temp_r29, temp_r28);
|
||||
|
||||
renderingDAmap_c::draw();
|
||||
#endif
|
||||
}
|
||||
|
||||
int renderingAmap_c::getDispType() const {
|
||||
|
||||
@@ -20,7 +20,7 @@ void dMpath_n::dTexObjAggregate_c::create() {
|
||||
};
|
||||
|
||||
for (int lp1 = 0; lp1 < 7; lp1++) {
|
||||
mp_texObj[lp1] = JKR_NEW GXTexObj();
|
||||
mp_texObj[lp1] = JKR_NEW TGXTexObj();
|
||||
JUT_ASSERT(70, mp_texObj[lp1] != NULL);
|
||||
ResTIMG* image = (ResTIMG*)dComIfG_getObjectRes("Always", data[lp1]);
|
||||
JUT_ASSERT(72, image != NULL);
|
||||
@@ -346,11 +346,13 @@ void dRenderingMap_c::makeResTIMG(ResTIMG* p_image, u16 width, u16 height, u8* p
|
||||
void dRenderingMap_c::renderingMap() {
|
||||
preRenderingMap();
|
||||
if (isDrawPath()) {
|
||||
#if REQUIRES_GX_LINES
|
||||
preDrawPath();
|
||||
beforeDrawPath();
|
||||
drawPath();
|
||||
afterDrawPath();
|
||||
postDrawPath();
|
||||
#endif
|
||||
}
|
||||
postRenderingMap();
|
||||
}
|
||||
@@ -471,6 +473,7 @@ void dRenderingFDAmap_c::renderingDecoration(dDrawPath_c::line_class const* p_li
|
||||
GXSetTevColor(GX_TEVREG1, lineColor);
|
||||
|
||||
for (int i = 0; i < data_num; i++) {
|
||||
#if REQUIRES_GX_LINES
|
||||
#ifndef HYRULE_FIELD_SPEEDHACK
|
||||
if (i < data_num - 1) {
|
||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_C0);
|
||||
@@ -490,6 +493,7 @@ void dRenderingFDAmap_c::renderingDecoration(dDrawPath_c::line_class const* p_li
|
||||
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
||||
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_TEXA);
|
||||
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
||||
#endif
|
||||
#endif
|
||||
GXBegin(GX_POINTS, GX_VTXFMT0, 1);
|
||||
GXPosition1x16(data_p[0]);
|
||||
|
||||
@@ -2553,7 +2553,12 @@ u8 dMenu_Collect3D_c::getMaskMdlVisible() {
|
||||
f32 dMenu_Collect3D_c::mViewOffsetY = -100.0f;
|
||||
|
||||
void dMenu_Collect3D_c::setupItem3D(Mtx param_0) {
|
||||
#if TARGET_PC
|
||||
f32 scaleFactor = mDoGph_gInf_c::getWidth() / FB_WIDTH; // TODO: get display pixel density from aurora
|
||||
GXSetViewport(0.0f, mViewOffsetY * scaleFactor, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight(), 0.0f, 1.0f);
|
||||
#else
|
||||
GXSetViewport(0.0f, mViewOffsetY, FB_WIDTH, FB_HEIGHT, 0.0f, 1.0f);
|
||||
#endif
|
||||
mViewOffsetY = -100.0f;
|
||||
Mtx44 projection;
|
||||
C_MTXPerspective(projection, 45.0f, mDoGph_gInf_c::getAspect(), 1.0f, 100000.0f);
|
||||
|
||||
@@ -1262,8 +1262,10 @@ void dMenu_Ring_c::drawItem() {
|
||||
(g_ringHIO.mItemAlphaMin + fVar16 * (g_ringHIO.mItemAlphaMax - g_ringHIO.mItemAlphaMin));
|
||||
for (int i = 0; i < mItemsTotal; i++) {
|
||||
if (i != mCurrentSlot || (mStatus != STATUS_WAIT && mStatus != STATUS_EXPLAIN && mStatus != STATUS_EXPLAIN_FORCE)) {
|
||||
#if REQUIRES_GX_LINES
|
||||
J2DDrawFrame(mItemSlotPosX[i] - 24.0f + mCenterPosX, mItemSlotPosY[i] - 24.0f + mCenterPosY,
|
||||
48.0f, 48.0f, g_ringHIO.mItemFrame[g_ringHIO.UNSELECT_FRAME], 6);
|
||||
#endif
|
||||
f32 fVar17 = 1.0f;
|
||||
if (i != mCurrentSlot) {
|
||||
fVar17 = ringAlpha / 255.0f;
|
||||
@@ -1306,8 +1308,10 @@ void dMenu_Ring_c::drawItem() {
|
||||
void dMenu_Ring_c::drawItem2() {
|
||||
s32 idx = mCurrentSlot;
|
||||
if (mStatus == STATUS_WAIT || mStatus == STATUS_EXPLAIN || mStatus == STATUS_EXPLAIN_FORCE) {
|
||||
#if REQUIRES_GX_LINES
|
||||
J2DDrawFrame(mItemSlotPosX[idx] - 24.0f + mCenterPosX, mItemSlotPosY[idx] - 24.0f + mCenterPosY,
|
||||
48.0f, 48.0f, g_ringHIO.mItemFrame[g_ringHIO.SELECT_FRAME], 6);
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (mpItemTex[idx][i] != NULL) {
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
GXCopyTex(mDoGph_gInf_c::getFrameBufferTex(), GX_FALSE);
|
||||
GXPixModeSync();
|
||||
} else {
|
||||
GXTexObj tex;
|
||||
TGXTexObj tex;
|
||||
GXInitTexObj(&tex, mDoGph_gInf_c::getFrameBufferTex(), FB_WIDTH / 2, FB_HEIGHT / 2,
|
||||
(GXTexFmt)mDoGph_gInf_c::getFrameBufferTimg()->format, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
GXInitTexObjLOD(&tex, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE, GX_ANISO_1);
|
||||
|
||||
+3
-1
@@ -26,12 +26,14 @@
|
||||
|
||||
#include "dusk/memory.h"
|
||||
|
||||
#include "dusk/memory.h"
|
||||
|
||||
int dMeter2_c::_create() {
|
||||
stage_stag_info_class* stag_info = dComIfGp_getStageStagInfo();
|
||||
if (dStage_stagInfo_GetUpButton(stag_info) == 1) {
|
||||
mpHeap = fopMsgM_createExpHeap(HEAP_SIZE(0x5A400, 0xA0000), NULL);
|
||||
} else {
|
||||
mpHeap = fopMsgM_createExpHeap(HEAP_SIZE(0x60800, 0xA0000), NULL);
|
||||
mpHeap = fopMsgM_createExpHeap(HEAP_SIZE(0x60800, 0xC1000), NULL);
|
||||
}
|
||||
JKRHEAP_NAME(mpHeap, "dMeter2_c");
|
||||
|
||||
|
||||
+21
-21
@@ -1051,7 +1051,7 @@ bool jmessage_tMeasureProcessor::do_tag(u32 i_tag, void const* i_data, u32 i_siz
|
||||
case MSGTAG_COLOR:
|
||||
return true;
|
||||
case MSGTAG_SCALE: {
|
||||
u16 scale = *(u16*)i_data;
|
||||
u16 scale = *(BE(u16)*)i_data;
|
||||
pReference->setLineScale(mTotalLineCnt, scale);
|
||||
do_scale(scale / 100.0f);
|
||||
return true;
|
||||
@@ -1102,13 +1102,13 @@ bool jmessage_tMeasureProcessor::do_tag(u32 i_tag, void const* i_data, u32 i_siz
|
||||
}
|
||||
case MSGTAG_UNK_3:
|
||||
case MSGTAG_AUTOBOX:
|
||||
if (*(u16*)i_data != 0) {
|
||||
if (*(BE(u16)*)i_data != 0) {
|
||||
dMsgObject_c* objectPtr = pReference->mpObjectPtr; // fakematch, should be getObjectPtr
|
||||
objectPtr->onAutoMessageFlag();
|
||||
}
|
||||
return true;
|
||||
case MSGTAG_DEMOBOX:
|
||||
pReference->setDemoFrame(*(u32*)i_data);
|
||||
pReference->setDemoFrame(*(BE(u32)*)i_data);
|
||||
return true;
|
||||
case MSGTAG_PLAYER_NAME: {
|
||||
if (field_0x49 != 0) {
|
||||
@@ -1414,7 +1414,7 @@ bool jmessage_tMeasureProcessor::do_tag(u32 i_tag, void const* i_data, u32 i_siz
|
||||
dMsgUnit_setTag(1, (s32)dComIfGp_getMessageCountNumber(), buffer);
|
||||
break;
|
||||
case MSGTAG_FUNDRAISE_REMAIN: {
|
||||
s16 fund_raise_val = *(u32*)i_data;
|
||||
s16 fund_raise_val = *(BE(u32)*)i_data;
|
||||
dMsgObject_c* objectPtr = pReference->getObjectPtr();
|
||||
objectPtr->setFundRaisingValue(fund_raise_val);
|
||||
|
||||
@@ -1555,7 +1555,7 @@ bool jmessage_tMeasureProcessor::do_tag(u32 i_tag, void const* i_data, u32 i_siz
|
||||
do_space(i_tag);
|
||||
return true;
|
||||
case MSGTAG_WII_MSGID_OVERRIDE:
|
||||
pReference->setRevoMessageID(*(u32*)i_data);
|
||||
pReference->setRevoMessageID(*(BE(u32)*)i_data);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -2169,7 +2169,7 @@ bool jmessage_tSequenceProcessor::do_tag(u32 i_tag, void const* i_data, u32 i_si
|
||||
pReference->setNowColorType(*(u8*)i_data & 0xFF);
|
||||
return true;
|
||||
case MSGTAG_SCALE:
|
||||
pReference->setNowTagScale(*(u16*)i_data & 0xFFFF);
|
||||
pReference->setNowTagScale(*(BE(u16)*)i_data & 0xFFFF);
|
||||
return true;
|
||||
case MSGTAG_RUBY:
|
||||
case 0xFFFF02:
|
||||
@@ -2220,7 +2220,7 @@ bool jmessage_tSequenceProcessor::do_tag(u32 i_tag, void const* i_data, u32 i_si
|
||||
return true;
|
||||
case MSGTAG_UNK_3:
|
||||
case MSGTAG_AUTOBOX:
|
||||
pReference->setSendTimer(*(u16*)i_data);
|
||||
pReference->setSendTimer(*(BE(u16)*)i_data);
|
||||
if (pReference->getSendTimer() == 0) {
|
||||
pReference->setSendFlag(3);
|
||||
} else {
|
||||
@@ -2228,24 +2228,24 @@ bool jmessage_tSequenceProcessor::do_tag(u32 i_tag, void const* i_data, u32 i_si
|
||||
}
|
||||
return true;
|
||||
case MSGTAG_BOXATMOST:
|
||||
pReference->setSendTimer(*(u16*)i_data);
|
||||
pReference->setSendTimer(*(BE(u16)*)i_data);
|
||||
pReference->setSendFlag(2);
|
||||
return true;
|
||||
case MSGTAG_BOXATLEAST:
|
||||
dMeter2Info_setMsgKeyWaitTimer(*(u16*)i_data);
|
||||
pReference->setSendTimer(*(u16*)i_data);
|
||||
dMeter2Info_setMsgKeyWaitTimer(*(BE(u16)*)i_data);
|
||||
pReference->setSendTimer(*(BE(u16)*)i_data);
|
||||
pReference->setSendFlag(6);
|
||||
return true;
|
||||
case MSGTAG_DEMOBOX:
|
||||
pReference->setDemoFrame(*(u32*)i_data);
|
||||
pReference->setDemoFrame(*(BE(u32)*)i_data);
|
||||
pReference->setSendFlag(4);
|
||||
return true;
|
||||
case MSGTAG_UNK_6:
|
||||
field_0xa8 = *(u16*)i_data;
|
||||
field_0xa8 = *(BE(u16)*)i_data;
|
||||
field_0xa4 = field_0xa8;
|
||||
return true;
|
||||
case MSGTAG_PAUSE:
|
||||
field_0xa4 = *(u16*)i_data;
|
||||
field_0xa4 = *(BE(u16)*)i_data;
|
||||
mMouthCheck = 0;
|
||||
return true;
|
||||
case MSGTAG_SELECT_2WAY:
|
||||
@@ -2361,7 +2361,7 @@ bool jmessage_tSequenceProcessor::do_tag(u32 i_tag, void const* i_data, u32 i_si
|
||||
pReference->resetInputFigure();
|
||||
pReference->setSendFlag(5);
|
||||
|
||||
if (*(u32*)i_data == 1) {
|
||||
if (*(BE(u32)*)i_data == 1) {
|
||||
dComIfGs_onTmpBit(dSv_event_tmp_flag_c::tempBitLabels[80]);
|
||||
}
|
||||
return true;
|
||||
@@ -2903,7 +2903,7 @@ bool jmessage_tRenderingProcessor::do_tag(u32 i_tag, void const* i_data, u32 i_s
|
||||
do_color(*(u8*)i_data & 0xFF);
|
||||
return 1;
|
||||
case MSGTAG_SCALE:
|
||||
field_0x13c = *(u16*)i_data & 0xFFFF;
|
||||
field_0x13c = *(BE(u16)*)i_data & 0xFFFF;
|
||||
do_scale(field_0x13c / 100.0f);
|
||||
return 1;
|
||||
case MSGTAG_RUBY:
|
||||
@@ -2937,7 +2937,7 @@ bool jmessage_tRenderingProcessor::do_tag(u32 i_tag, void const* i_data, u32 i_s
|
||||
stack_pushCurrent(pReference->getObjectPtr()->getLetterName());
|
||||
return 1;
|
||||
case MSGTAG_LINE_DOWN:
|
||||
do_linedown(*(u16*)i_data);
|
||||
do_linedown(*(BE(u16)*)i_data);
|
||||
return 1;
|
||||
case MSGTAG_CURRENT_LETTER_PAGE:
|
||||
case MSGTAG_MAX_LETTER_PAGE:
|
||||
@@ -4178,7 +4178,7 @@ bool jmessage_string_tMeasureProcessor::do_tag(u32 i_tag, void const* i_data, u3
|
||||
dMsgUnit_setTag(1, (s32)dComIfGp_getMessageCountNumber(), buffer);
|
||||
break;
|
||||
case MSGTAG_FUNDRAISE_REMAIN: {
|
||||
s16 uVar9 = *(int*)i_data;
|
||||
s16 uVar9 = *(BE(int)*)i_data;
|
||||
dMsgObject_getMsgObjectClass()->setFundRaisingValue(uVar9);
|
||||
dMsgUnit_setTag(10, uVar9 - dMsgObject_getFundRaising(), buffer);
|
||||
break;
|
||||
@@ -4384,7 +4384,7 @@ bool jmessage_string_tSequenceProcessor::do_tag(u32 i_tag, void const* i_data, u
|
||||
case MSGTAG_GROUP(0):
|
||||
switch(i_tag) {
|
||||
case MSGTAG_BOXATLEAST:
|
||||
dMeter2Info_setMsgKeyWaitTimer(*(u16*)i_data);
|
||||
dMeter2Info_setMsgKeyWaitTimer(*(BE(u16)*)i_data);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -4537,7 +4537,7 @@ bool jmessage_string_tRenderingProcessor::do_tag(u32 i_tag, void const* i_data,
|
||||
do_color(*(u8*)i_data & 0xFF);
|
||||
break;
|
||||
case MSGTAG_SCALE:
|
||||
do_scale(*(u16*)i_data / 100.0f);
|
||||
do_scale(*(BE(u16)*)i_data / 100.0f);
|
||||
break;
|
||||
case MSGTAG_RUBY:
|
||||
case 0xFFFF02:
|
||||
@@ -4572,7 +4572,7 @@ bool jmessage_string_tRenderingProcessor::do_tag(u32 i_tag, void const* i_data,
|
||||
push_word(dMsgObject_getMsgObjectClass()->getLetterName());
|
||||
break;
|
||||
case MSGTAG_LINE_DOWN:
|
||||
do_linedown(*(u16*)i_data);
|
||||
do_linedown(*(BE(u16)*)i_data);
|
||||
break;
|
||||
case MSGTAG_CURRENT_LETTER_PAGE: {
|
||||
char buffer[4];
|
||||
@@ -4788,7 +4788,7 @@ bool jmessage_string_tRenderingProcessor::do_tag(u32 i_tag, void const* i_data,
|
||||
dMsgUnit_setTag(1, (s32)dComIfGp_getMessageCountNumber(), buffer);
|
||||
break;
|
||||
case MSGTAG_FUNDRAISE_REMAIN: {
|
||||
s16 uVar9 = *(int*)i_data;
|
||||
s16 uVar9 = *(BE(int)*)i_data;
|
||||
dMsgObject_getMsgObjectClass()->setFundRaisingValue(uVar9);
|
||||
dMsgUnit_setTag(10, uVar9 - dMsgObject_getFundRaising(), buffer);
|
||||
break;
|
||||
|
||||
+16
-16
@@ -49,8 +49,8 @@ void dMsgFlow_c::init(fopAc_ac_c* i_partner, int i_flowID, int param_2, fopAc_ac
|
||||
|
||||
labelInfoTBL = mLabelInfo_p + 0x10;
|
||||
mFlowNodeTBL = (mesg_flow*)(mFlow_p + 0x10);
|
||||
mFlowIdxTBL = (u16*)(mFlowNodeTBL + (*(u16*)(mFlow_p + 8)));
|
||||
field_0x18 = mFlowIdxTBL + *(u16*)(mFlow_p + 8);
|
||||
mFlowIdxTBL = (BE(u16)*)(mFlowNodeTBL + (*(BE(u16)*)(mFlow_p + 8)));
|
||||
field_0x18 = mFlowIdxTBL + *(BE(u16)*)(mFlow_p + 8);
|
||||
|
||||
mFlow = prevFlowID;
|
||||
|
||||
@@ -322,8 +322,8 @@ void dMsgFlow_c::setInitValueGroupChange(int i_msgNo, fopAc_ac_c** i_talkPartner
|
||||
labelInfoTBL = mLabelInfo_p + 0x10;
|
||||
|
||||
mFlowNodeTBL = (mesg_flow*)(mFlow_p + 0x10);
|
||||
mFlowIdxTBL = (u16*)(mFlowNodeTBL + *(u16*)(mFlow_p + 8));
|
||||
field_0x18 = mFlowIdxTBL + *(u16*)(mFlow_p + 8);
|
||||
mFlowIdxTBL = (BE(u16)*)(mFlowNodeTBL + *(BE(u16)*)(mFlow_p + 8));
|
||||
field_0x18 = mFlowIdxTBL + *(BE(u16)*)(mFlow_p + 8);
|
||||
mFlow = var_r28;
|
||||
setNodeIndex(getInitNodeIndex(mFlow), i_talkPartners);
|
||||
}
|
||||
@@ -337,7 +337,7 @@ u8* dMsgFlow_c::getMsgDataBlock(char const* block_tag) {
|
||||
aMsgRes_p = dMsgObject_getMsgDtPtr();
|
||||
JUT_ASSERT(742, NULL != aMsgRes_p);
|
||||
|
||||
u32 num = *(u32*)(aMsgRes_p + 0xC);
|
||||
u32 num = *(BE(u32)*)(aMsgRes_p + 0xC);
|
||||
aMsgRes_p += 0x20;
|
||||
|
||||
for (u32 i = 0; i < num; i++) {
|
||||
@@ -348,7 +348,7 @@ u8* dMsgFlow_c::getMsgDataBlock(char const* block_tag) {
|
||||
return aMsgRes_p;
|
||||
}
|
||||
|
||||
aMsgRes_p += *(int*)(block_p + 4);
|
||||
aMsgRes_p += *(BE(int)*)(block_p + 4);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -361,9 +361,9 @@ u16 dMsgFlow_c::getInitNodeIndex(u16 param_1) {
|
||||
JUT_ASSERT(777, NULL != mLabelInfo_p);
|
||||
var_r30 = mLabelInfo_p + 0x10;
|
||||
|
||||
for (int i = 0; i < *(u16*)(mLabelInfo_p + 8); i++) {
|
||||
if (*(u32*)var_r30 >> 16 == param_1) {
|
||||
var_r27 = *(u16*)(var_r30 + 4);
|
||||
for (int i = 0; i < *(BE(u16)*)(mLabelInfo_p + 8); i++) {
|
||||
if (*(BE(u32)*)var_r30 >> 16 == param_1) {
|
||||
var_r27 = *(BE(u16)*)(var_r30 + 4);
|
||||
}
|
||||
|
||||
var_r30 += 0x8;
|
||||
@@ -441,13 +441,13 @@ void dMsgFlow_c::setNodeIndex(u16 i_nodeIdx, fopAc_ac_c** i_talkPartners) {
|
||||
|
||||
int dMsgFlow_c::setSelectMsg(mesg_flow_node* i_flowNode_p, mesg_flow_node* param_2,
|
||||
fopAc_ac_c* i_speaker_p) {
|
||||
u16* inf_p = NULL;
|
||||
BE(u16)* inf_p = NULL;
|
||||
u16 temp_r25;
|
||||
u16 msg_no;
|
||||
|
||||
mesg_flow_node* var_r29 = NULL;
|
||||
|
||||
inf_p = (u16*)getMsgDataBlock("INF1");
|
||||
inf_p = (BE(u16)*)getMsgDataBlock("INF1");
|
||||
|
||||
var_r29 = param_2;
|
||||
temp_r25 = ((inf_p + (var_r29->msg_index) * 10))[10];
|
||||
@@ -491,13 +491,13 @@ int dMsgFlow_c::setSelectMsg(mesg_flow_node* i_flowNode_p, mesg_flow_node* param
|
||||
}
|
||||
|
||||
int dMsgFlow_c::setNormalMsg(mesg_flow_node* i_flowNode_p, fopAc_ac_c* i_speaker_p) {
|
||||
u16* inf_p = NULL;
|
||||
BE(u16)* inf_p = NULL;
|
||||
mesg_flow_node* var_r29 = NULL;
|
||||
u16 msg_no;
|
||||
|
||||
var_r29 = i_flowNode_p;
|
||||
inf_p = (u16*)getMsgDataBlock("INF1");
|
||||
msg_no = ((inf_p + (var_r29->msg_index) * 10))[10];
|
||||
inf_p = (BE(u16)*)getMsgDataBlock("INF1");
|
||||
msg_no = (inf_p + (var_r29->msg_index) * 10)[10];
|
||||
|
||||
// "Message Set"
|
||||
OS_REPORT("\x1B[44;37mメッセ−ジセット \x1B[m|:");
|
||||
@@ -727,8 +727,8 @@ int dMsgFlow_c::nodeProc(fopAc_ac_c* i_speaker_p, fopAc_ac_c** i_talkPartners) {
|
||||
}
|
||||
|
||||
int dMsgFlow_c::getParam(u16* prm0, u16* prm1, u8* params) {
|
||||
*prm0 = *(u16*)params;
|
||||
*prm1 = *(u16*)(params + 2);
|
||||
*prm0 = *(BE(u16)*)params;
|
||||
*prm1 = *(BE(u16)*)(params + 2);
|
||||
|
||||
return *(int*)params;
|
||||
}
|
||||
|
||||
@@ -12,8 +12,13 @@
|
||||
#include "m_Do/m_Do_graphic.h"
|
||||
|
||||
void dOvlpFd2_dlst_c::draw() {
|
||||
#if TARGET_PC
|
||||
GXSetViewport(0.0f, 0.0f, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight(), 0.0f, 1.0f);
|
||||
GXSetScissor(0, 0, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight());
|
||||
#else
|
||||
GXSetViewport(0.0f, 0.0f, FB_WIDTH, FB_HEIGHT, 0.0f, 1.0f);
|
||||
GXSetScissor(0, 0, FB_WIDTH, FB_HEIGHT);
|
||||
#endif
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGB, GX_RGBA4, 0);
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
@@ -49,6 +54,9 @@ void dOvlpFd2_dlst_c::draw() {
|
||||
C_MTXPerspective(m, 60.0f, mDoGph_gInf_c::getWidthF() / mDoGph_gInf_c::getHeightF(), 100.0f,
|
||||
100000.0f);
|
||||
GXSetProjection(m, GX_PERSPECTIVE);
|
||||
#ifdef TARGET_PC
|
||||
mDoGph_gInf_c::getFrameBufferTexObj()->reset();
|
||||
#endif
|
||||
GXInitTexObj(mDoGph_gInf_c::getFrameBufferTexObj(), mDoGph_gInf_c::getFrameBufferTex(), FB_WIDTH / 2,
|
||||
FB_HEIGHT / 2, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
GXInitTexObjLOD(mDoGph_gInf_c::getFrameBufferTexObj(), GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f,
|
||||
|
||||
@@ -20,8 +20,13 @@ void dDlst_snapShot_c::draw() {
|
||||
}
|
||||
|
||||
void dOvlpFd3_dlst_c::draw() {
|
||||
#if TARGET_PC
|
||||
GXSetViewport(0.0f, 0.0f, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight(), 0.0f, 1.0f);
|
||||
GXSetScissor(0, 0, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight());
|
||||
#else
|
||||
GXSetViewport(0.0f, 0.0f, FB_WIDTH, FB_HEIGHT, 0.0f, 1.0f);
|
||||
GXSetScissor(0, 0, FB_WIDTH, FB_HEIGHT);
|
||||
#endif
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGB, GX_RGBA4, 0);
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
@@ -57,6 +62,9 @@ void dOvlpFd3_dlst_c::draw() {
|
||||
C_MTXPerspective(m, 60.0f, mDoGph_gInf_c::getWidthF() / mDoGph_gInf_c::getHeightF(), 100.0f,
|
||||
100000.0f);
|
||||
GXSetProjection(m, GX_PERSPECTIVE);
|
||||
#ifdef TARGET_PC
|
||||
mDoGph_gInf_c::getFrameBufferTexObj()->reset();
|
||||
#endif
|
||||
GXInitTexObj(mDoGph_gInf_c::getFrameBufferTexObj(), mDoGph_gInf_c::getFrameBufferTex(), FB_WIDTH / 2,
|
||||
FB_HEIGHT / 2, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
GXInitTexObjLOD(mDoGph_gInf_c::getFrameBufferTexObj(), GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f,
|
||||
|
||||
@@ -357,7 +357,11 @@ Vec CPaneMgr::getGlobalVtx(J2DPane* p_pane, Mtx* param_1, u8 param_2, bool param
|
||||
MtxP mp = (MtxP)param_1;
|
||||
J2DPane* parent = p_pane->getParentPane();
|
||||
|
||||
#if TARGET_PC
|
||||
J2DOrthoGraph ortho(0.0f, 0.0f, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight(), -1.0f, 1.0f);
|
||||
#else
|
||||
J2DOrthoGraph ortho(0.0f, 0.0f, FB_WIDTH, FB_HEIGHT, -1.0f, 1.0f);
|
||||
#endif
|
||||
ortho.setOrtho(mDoGph_gInf_c::getMinXF(), mDoGph_gInf_c::getMinYF(), mDoGph_gInf_c::getWidthF(), mDoGph_gInf_c::getHeightF(), -1.0f, 1.0f);
|
||||
|
||||
if (parent != NULL) {
|
||||
|
||||
+1
-1
@@ -352,7 +352,7 @@ int dRes_info_c::loadResource() {
|
||||
JUT_ASSERT(769, resNameLen <= NAME_MAX);
|
||||
#endif
|
||||
|
||||
char arcName[9];
|
||||
char arcName[10];
|
||||
strncpy(arcName, name_p, resNameLen);
|
||||
arcName[resNameLen] = '\0';
|
||||
|
||||
|
||||
+17
-2
@@ -24,6 +24,7 @@
|
||||
#include "f_op/f_op_overlap_mng.h"
|
||||
#include "m_Do/m_Do_Reset.h"
|
||||
#include "m_Do/m_Do_graphic.h"
|
||||
#include "m_Do/m_Do_machine.h"
|
||||
#include "d/actor/d_a_suspend.h"
|
||||
#include "d/actor/d_a_ykgr.h"
|
||||
#include "JSystem/JHostIO/JORFile.h"
|
||||
@@ -38,6 +39,8 @@
|
||||
#include "JSystem/JKernel/JKRAram.h"
|
||||
#include "JSystem/JKernel/JKRAramArchive.h"
|
||||
|
||||
#include "dusk/memory.h"
|
||||
|
||||
#if DEBUG
|
||||
#include "d/d_s_menu.h"
|
||||
#include "d/d_debug_pad.h"
|
||||
@@ -1412,17 +1415,29 @@ static int phase_4(dScnPly_c* i_this) {
|
||||
dComIfGp_setPlayerPtr(i, NULL);
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
dComIfGp_setWindow(0, 0.0f, 0.0f, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight(), 0.0f,
|
||||
1.0f, 0, 2);
|
||||
#else
|
||||
dComIfGp_setWindow(0, 0.0f, 0.0f, FB_WIDTH, FB_HEIGHT, 0.0f, 1.0f, 0, 2);
|
||||
#endif
|
||||
dComIfGp_setCameraInfo(0, NULL, 0, 0, -1);
|
||||
dComIfGd_setWindow(NULL);
|
||||
dComIfGd_setViewport(NULL);
|
||||
dComIfGd_setView(NULL);
|
||||
|
||||
JKRExpHeap* heap = fopMsgM_createExpHeap(0xBB800, NULL);
|
||||
JKRExpHeap* heap = fopMsgM_createExpHeap(HEAP_SIZE(0xBB800, 0xF0000), NULL);
|
||||
#if TARGET_PC
|
||||
heap->setName("Scene2DHeap");
|
||||
#endif
|
||||
|
||||
JUT_ASSERT(2704, heap != NULL);
|
||||
dComIfGp_setExpHeap2D(heap);
|
||||
|
||||
JKRExpHeap* heap2 = fopMsgM_createExpHeap(0xA800, NULL);
|
||||
JKRExpHeap* heap2 = fopMsgM_createExpHeap(HEAP_SIZE(0xA800, 0x15000), NULL);
|
||||
#if TARGET_PC
|
||||
heap2->setName("SceneMsgHeap");
|
||||
#endif
|
||||
JUT_ASSERT(2709, heap2 != NULL);
|
||||
dComIfGp_setMsgExpHeap(heap2);
|
||||
|
||||
|
||||
@@ -1,142 +0,0 @@
|
||||
#include "dusk/imgui.h"
|
||||
#include "imgui/imgui.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <chrono>
|
||||
#include <imgui.h>
|
||||
#include <numeric>
|
||||
#include <thread>
|
||||
|
||||
#if _WIN32
|
||||
#include "Windows.h"
|
||||
#endif
|
||||
|
||||
static bool ImguiHidden = false;
|
||||
|
||||
void imgui_main(const AuroraInfo *info)
|
||||
{
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_F1)) {
|
||||
ImguiHidden = !ImguiHidden;
|
||||
}
|
||||
|
||||
if (ImguiHidden) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ImGui::BeginMainMenuBar()) {
|
||||
if (ImGui::BeginMenu(MenuView)) {
|
||||
ImGui::MenuItem("Hide UI", "F1", &ImguiHidden);
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
DuskImguiDebugOverlay(info);
|
||||
DuskImguiProcesses();
|
||||
DuskImguiHeaps();
|
||||
DuskCameraDebug();
|
||||
DuskDebugPad();
|
||||
|
||||
ImGui::EndMainMenuBar();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Limiter
|
||||
{
|
||||
using delta_clock = std::chrono::high_resolution_clock;
|
||||
using duration_t = std::chrono::nanoseconds;
|
||||
|
||||
public:
|
||||
void Reset()
|
||||
{
|
||||
m_oldTime = delta_clock::now();
|
||||
}
|
||||
|
||||
void Sleep(duration_t targetFrameTime)
|
||||
{
|
||||
if (targetFrameTime.count() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto start = delta_clock::now();
|
||||
duration_t adjustedSleepTime = SleepTime(targetFrameTime);
|
||||
if (adjustedSleepTime.count() > 0)
|
||||
{
|
||||
NanoSleep(adjustedSleepTime);
|
||||
duration_t overslept = TimeSince(start) - adjustedSleepTime;
|
||||
if (overslept < duration_t{targetFrameTime})
|
||||
{
|
||||
m_overheadTimes[m_overheadTimeIdx] = overslept;
|
||||
m_overheadTimeIdx = (m_overheadTimeIdx + 1) % m_overheadTimes.size();
|
||||
}
|
||||
}
|
||||
Reset();
|
||||
}
|
||||
|
||||
duration_t SleepTime(duration_t targetFrameTime)
|
||||
{
|
||||
const auto sleepTime = duration_t{targetFrameTime} - TimeSince(m_oldTime);
|
||||
m_overhead = std::accumulate(m_overheadTimes.begin(), m_overheadTimes.end(), duration_t{}) /
|
||||
m_overheadTimes.size();
|
||||
if (sleepTime > m_overhead)
|
||||
{
|
||||
return sleepTime - m_overhead;
|
||||
}
|
||||
return duration_t{0};
|
||||
}
|
||||
|
||||
private:
|
||||
delta_clock::time_point m_oldTime;
|
||||
std::array<duration_t, 4> m_overheadTimes{};
|
||||
size_t m_overheadTimeIdx = 0;
|
||||
duration_t m_overhead = duration_t{0};
|
||||
|
||||
duration_t TimeSince(delta_clock::time_point start)
|
||||
{
|
||||
return std::chrono::duration_cast<duration_t>(delta_clock::now() - start);
|
||||
}
|
||||
|
||||
#if _WIN32
|
||||
bool m_initialized;
|
||||
double m_countPerNs;
|
||||
|
||||
void NanoSleep(const duration_t duration)
|
||||
{
|
||||
if (!m_initialized)
|
||||
{
|
||||
LARGE_INTEGER freq;
|
||||
QueryPerformanceFrequency(&freq);
|
||||
m_countPerNs = static_cast<double>(freq.QuadPart) / 1000000000.0;
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
DWORD ms = std::chrono::duration_cast<std::chrono::milliseconds>(duration).count();
|
||||
auto tickCount =
|
||||
static_cast<LONGLONG>(static_cast<double>(duration.count()) * m_countPerNs);
|
||||
LARGE_INTEGER count;
|
||||
QueryPerformanceCounter(&count);
|
||||
if (ms > 10)
|
||||
{
|
||||
// Adjust for Sleep overhead
|
||||
::Sleep(ms - 10);
|
||||
}
|
||||
auto end = count.QuadPart + tickCount;
|
||||
do
|
||||
{
|
||||
QueryPerformanceCounter(&count);
|
||||
} while (count.QuadPart < end);
|
||||
}
|
||||
#else
|
||||
void NanoSleep(const duration_t duration)
|
||||
{
|
||||
std::this_thread::sleep_for(duration);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static Limiter g_frameLimiter;
|
||||
void frame_limiter()
|
||||
{
|
||||
g_frameLimiter.Sleep(
|
||||
std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::seconds{1}) / 60);
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
#include "f_op/f_op_camera_mng.h"
|
||||
#include "SSystem/SComponent/c_xyz.h"
|
||||
|
||||
#include "imgui.h"
|
||||
#include "ImGuiConsole.hpp"
|
||||
|
||||
namespace dusk {
|
||||
void ImGuiConsole::ShowCameraOverlay() {
|
||||
if (!CheckMenuViewToggle(ImGuiKey_F6, m_showCameraOverlay)) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* cam = (camera_process_class*)dCam_getCamera();
|
||||
|
||||
if (!m_showCameraOverlay || cam == nullptr)
|
||||
return;
|
||||
|
||||
auto* dCam = &cam->mCamera;
|
||||
|
||||
ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize |
|
||||
ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;
|
||||
if (m_cameraOverlayCorner != -1) {
|
||||
SetOverlayWindowLocation(m_cameraOverlayCorner);
|
||||
windowFlags |= ImGuiWindowFlags_NoMove;
|
||||
}
|
||||
|
||||
ImGui::SetNextWindowBgAlpha(0.65f);
|
||||
ImGui::SetNextWindowSizeConstraints(ImVec2(300, 0), ImVec2(FLT_MAX, FLT_MAX));
|
||||
|
||||
if (!ImGui::Begin("Camera Debug", nullptr, windowFlags)) {
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui::SeparatorText("Camera Transform Data");
|
||||
|
||||
cXyz center = dCam->mCenter;
|
||||
cXyz eye = dCam->mEye;
|
||||
|
||||
if (ImGui::InputFloat3("Camera Center", ¢er.x)) {
|
||||
dCam->Reset(center, eye);
|
||||
}
|
||||
if (ImGui::InputFloat3("Camera Eye", &eye.x)) {
|
||||
dCam->Reset(center, eye);
|
||||
}
|
||||
|
||||
ImGui::InputFloat("Camera FOV", &dCam->mFovy);
|
||||
|
||||
ImGui::SeparatorText("Free-look Data");
|
||||
|
||||
static float eyeYawDeg = 0.0f;
|
||||
static float moveSpeed = 10000.0f;
|
||||
static float rotSpeed = 5.0f;
|
||||
static cXyz freeLookPos = cXyz::Zero;
|
||||
|
||||
bool changed = false;
|
||||
|
||||
if (ImGui::IsKeyDown(ImGuiKey_LeftArrow)) {
|
||||
eyeYawDeg += rotSpeed;
|
||||
if (eyeYawDeg >= 360.0f)
|
||||
eyeYawDeg -= 360.0f;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
else if (ImGui::IsKeyDown(ImGuiKey_RightArrow)) {
|
||||
eyeYawDeg -= rotSpeed;
|
||||
if (eyeYawDeg < 0.0f)
|
||||
eyeYawDeg += 360.0f;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
cSAngle yawAngle = cSAngle(eyeYawDeg);
|
||||
cXyz frontDir = cXyz(yawAngle.Sin(), 0.0f, yawAngle.Cos());
|
||||
|
||||
if (ImGui::IsKeyDown(ImGuiKey_UpArrow)) {
|
||||
freeLookPos -= frontDir * moveSpeed * ImGui::GetIO().DeltaTime;
|
||||
changed = true;
|
||||
}
|
||||
else if (ImGui::IsKeyDown(ImGuiKey_DownArrow)) {
|
||||
freeLookPos += frontDir * moveSpeed * ImGui::GetIO().DeltaTime;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (ImGui::IsKeyDown(ImGuiKey_LeftShift)) {
|
||||
freeLookPos += cXyz::BaseY * moveSpeed * ImGui::GetIO().DeltaTime;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl)) {
|
||||
freeLookPos -= cXyz::BaseY * moveSpeed * ImGui::GetIO().DeltaTime;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
dCam->Reset(freeLookPos, freeLookPos + (frontDir * 100.0f));
|
||||
}
|
||||
|
||||
ImGui::InputFloat("Free-look Yaw", &eyeYawDeg);
|
||||
ImGui::InputFloat3("Free-look Position", &freeLookPos.x);
|
||||
ImGui::InputFloat("Free-look Move Speed", &moveSpeed);
|
||||
ImGui::InputFloat("Free-look Rotation Speed", &rotSpeed);
|
||||
|
||||
ShowCornerContextMenu(m_cameraOverlayCorner, 0);
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,322 @@
|
||||
#include <array>
|
||||
#include <numeric>
|
||||
#include <string_view>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
#include "fmt/format.h"
|
||||
#include "imgui.h"
|
||||
#include "aurora/gfx.h"
|
||||
|
||||
#include "ImGuiConsole.hpp"
|
||||
|
||||
#include "JSystem/JUtility/JUTGamePad.h"
|
||||
|
||||
#if _WIN32
|
||||
#include "Windows.h"
|
||||
#endif
|
||||
|
||||
using namespace std::string_literals;
|
||||
using namespace std::string_view_literals;
|
||||
|
||||
namespace dusk {
|
||||
void ImGuiStringViewText(std::string_view text) {
|
||||
// begin()/end() do not work on MSVC
|
||||
ImGui::TextUnformatted(text.data(), text.data() + text.size());
|
||||
}
|
||||
|
||||
std::string BytesToString(size_t bytes) {
|
||||
constexpr std::array suffixes{ "B"sv, "KB"sv, "MB"sv, "GB"sv, "TB"sv, "PB"sv, "EB"sv };
|
||||
uint32_t s = 0;
|
||||
auto count = static_cast<double>(bytes);
|
||||
while (count >= 1024.0 && s < 7) {
|
||||
s++;
|
||||
count /= 1024.0;
|
||||
}
|
||||
if (count - floor(count) == 0.0)
|
||||
{
|
||||
return fmt::format(FMT_STRING("{}{}"), static_cast<size_t>(count), suffixes[s]);
|
||||
}
|
||||
return fmt::format(FMT_STRING("{:.1f}{}"), count, suffixes[s]);
|
||||
}
|
||||
|
||||
void SetOverlayWindowLocation(int corner) {
|
||||
const ImGuiViewport* viewport = ImGui::GetMainViewport();
|
||||
ImVec2 workPos = viewport->WorkPos; // Use work area to avoid menu-bar/task-bar, if any!
|
||||
ImVec2 workSize = viewport->WorkSize;
|
||||
ImVec2 windowPos;
|
||||
ImVec2 windowPosPivot;
|
||||
constexpr float padding = 10.0f;
|
||||
windowPos.x = (corner & 1) != 0 ? (workPos.x + workSize.x - padding) : (workPos.x + padding);
|
||||
windowPos.y = (corner & 2) != 0 ? (workPos.y + workSize.y - padding) : (workPos.y + padding);
|
||||
windowPosPivot.x = (corner & 1) != 0 ? 1.0f : 0.0f;
|
||||
windowPosPivot.y = (corner & 2) != 0 ? 1.0f : 0.0f;
|
||||
ImGui::SetNextWindowPos(windowPos, ImGuiCond_Always, windowPosPivot);
|
||||
}
|
||||
|
||||
bool ShowCornerContextMenu(int& corner, int avoidCorner) {
|
||||
bool result = false;
|
||||
if (ImGui::BeginPopupContextWindow()) {
|
||||
if (ImGui::MenuItem("Custom", nullptr, corner == -1)) {
|
||||
corner = -1;
|
||||
result = true;
|
||||
}
|
||||
if (ImGui::MenuItem("Top-left", nullptr, corner == 0, avoidCorner != 0)) {
|
||||
corner = 0;
|
||||
result = true;
|
||||
}
|
||||
if (ImGui::MenuItem("Top-right", nullptr, corner == 1, avoidCorner != 1)) {
|
||||
corner = 1;
|
||||
result = true;
|
||||
}
|
||||
if (ImGui::MenuItem("Bottom-left", nullptr, corner == 2, avoidCorner != 2)) {
|
||||
corner = 2;
|
||||
result = true;
|
||||
}
|
||||
if (ImGui::MenuItem("Bottom-right", nullptr, corner == 3, avoidCorner != 3)) {
|
||||
corner = 3;
|
||||
result = true;
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ImGuiConsole g_imguiConsole;
|
||||
|
||||
ImGuiConsole::ImGuiConsole() {}
|
||||
|
||||
void ImGuiConsole::draw() {
|
||||
if (CheckMenuViewToggle(ImGuiKey_F1, m_isHidden)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ImGui::BeginMainMenuBar()) {
|
||||
if (ImGui::BeginMenu("View")) {
|
||||
ImGui::MenuItem("Hide UI", "F1", &m_isHidden);
|
||||
ImGui::MenuItem("Process Management", "F2", &m_showProcessManagement);
|
||||
ImGui::MenuItem("Debug Overlay", "F3", &m_showDebugOverlay);
|
||||
ImGui::MenuItem("Heaps", "F4", &m_showHeapOverlay);
|
||||
ImGui::MenuItem("Stub Log", "F5", &m_showStubLog);
|
||||
ImGui::MenuItem("Camera", "F6", &m_showCameraOverlay);
|
||||
ImGui::MenuItem("Input Viewer", nullptr, &m_showInputViewer);
|
||||
ImGui::MenuItem("Map Loader", nullptr, &m_showMapLoader);
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (ImGui::BeginMenu("Game")) {
|
||||
if (ImGui::Selectable("Reset")) {
|
||||
JUTGamePad::C3ButtonReset::sResetSwitchPushing = true;
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
ShowDebugOverlay();
|
||||
ShowCameraOverlay();
|
||||
ShowProcessManager();
|
||||
ShowHeapOverlay();
|
||||
ShowInputViewer();
|
||||
ShowStubLog();
|
||||
ShowMapLoader();
|
||||
|
||||
DuskDebugPad(); // temporary, remove later
|
||||
|
||||
ImGui::EndMainMenuBar();
|
||||
}
|
||||
}
|
||||
|
||||
void ImGuiConsole::ShowDebugOverlay() {
|
||||
if (!CheckMenuViewToggle(ImGuiKey_F3, m_showDebugOverlay)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoDecoration |
|
||||
ImGuiWindowFlags_AlwaysAutoResize |
|
||||
ImGuiWindowFlags_NoFocusOnAppearing |
|
||||
ImGuiWindowFlags_NoNav;
|
||||
if (m_debugOverlayCorner != -1) {
|
||||
SetOverlayWindowLocation(m_debugOverlayCorner);
|
||||
windowFlags |= ImGuiWindowFlags_NoMove;
|
||||
}
|
||||
|
||||
ImGui::SetNextWindowBgAlpha(0.65f);
|
||||
if (ImGui::Begin("Debug Overlay", nullptr, windowFlags)) {
|
||||
bool hasPrevious = false;
|
||||
if (hasPrevious) {
|
||||
ImGui::Separator();
|
||||
}
|
||||
hasPrevious = true;
|
||||
|
||||
ImGuiStringViewText(fmt::format(FMT_STRING("FPS: {:.2f}\n"), io.Framerate));
|
||||
|
||||
if (hasPrevious) {
|
||||
ImGui::Separator();
|
||||
}
|
||||
hasPrevious = true;
|
||||
|
||||
ImGuiStringViewText(fmt::format(FMT_STRING("Backend: {}\n"), backend_name(aurora_get_backend())));
|
||||
|
||||
if (hasPrevious) {
|
||||
ImGui::Separator();
|
||||
}
|
||||
hasPrevious = true;
|
||||
|
||||
AuroraStats const* stats = aurora_get_stats();
|
||||
|
||||
ImGuiStringViewText(
|
||||
fmt::format(FMT_STRING("Queued pipelines: {}\n"), stats->queuedPipelines));
|
||||
ImGuiStringViewText(
|
||||
fmt::format(FMT_STRING("Done pipelines: {}\n"), stats->createdPipelines));
|
||||
ImGuiStringViewText(
|
||||
fmt::format(FMT_STRING("Draw call count: {}\n"), stats->drawCallCount));
|
||||
ImGuiStringViewText(fmt::format(FMT_STRING("Merged draw calls: {}\n"),
|
||||
stats->mergedDrawCallCount));
|
||||
ImGuiStringViewText(fmt::format(FMT_STRING("Vertex size: {}\n"),
|
||||
BytesToString(stats->lastVertSize)));
|
||||
ImGuiStringViewText(fmt::format(FMT_STRING("Uniform size: {}\n"),
|
||||
BytesToString(stats->lastUniformSize)));
|
||||
ImGuiStringViewText(fmt::format(FMT_STRING("Index size: {}\n"),
|
||||
BytesToString(stats->lastIndexSize)));
|
||||
ImGuiStringViewText(fmt::format(FMT_STRING("Storage size: {}\n"),
|
||||
BytesToString(stats->lastStorageSize)));
|
||||
ImGuiStringViewText(fmt::format(
|
||||
FMT_STRING("Total: {}\n"),
|
||||
BytesToString(stats->lastVertSize + stats->lastUniformSize +
|
||||
stats->lastIndexSize + stats->lastStorageSize)));
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
bool ImGuiConsole::CheckMenuViewToggle(ImGuiKey key, bool& active) {
|
||||
if (ImGui::IsKeyPressed(key)) {
|
||||
active = !active;
|
||||
}
|
||||
|
||||
return active;
|
||||
}
|
||||
|
||||
std::string_view backend_name(AuroraBackend backend) {
|
||||
switch (backend) {
|
||||
default:
|
||||
return "Auto"sv;
|
||||
case BACKEND_D3D12:
|
||||
return "D3D12"sv;
|
||||
case BACKEND_D3D11:
|
||||
return "D3D11"sv;
|
||||
case BACKEND_METAL:
|
||||
return "Metal"sv;
|
||||
case BACKEND_VULKAN:
|
||||
return "Vulkan"sv;
|
||||
case BACKEND_OPENGL:
|
||||
return "OpenGL"sv;
|
||||
case BACKEND_OPENGLES:
|
||||
return "OpenGL ES"sv;
|
||||
case BACKEND_WEBGPU:
|
||||
return "WebGPU"sv;
|
||||
case BACKEND_NULL:
|
||||
return "Null"sv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Limiter
|
||||
{
|
||||
using delta_clock = std::chrono::high_resolution_clock;
|
||||
using duration_t = std::chrono::nanoseconds;
|
||||
|
||||
public:
|
||||
void Reset()
|
||||
{
|
||||
m_oldTime = delta_clock::now();
|
||||
}
|
||||
|
||||
void Sleep(duration_t targetFrameTime)
|
||||
{
|
||||
if (targetFrameTime.count() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto start = delta_clock::now();
|
||||
duration_t adjustedSleepTime = SleepTime(targetFrameTime);
|
||||
if (adjustedSleepTime.count() > 0)
|
||||
{
|
||||
NanoSleep(adjustedSleepTime);
|
||||
duration_t overslept = TimeSince(start) - adjustedSleepTime;
|
||||
if (overslept < duration_t{ targetFrameTime })
|
||||
{
|
||||
m_overheadTimes[m_overheadTimeIdx] = overslept;
|
||||
m_overheadTimeIdx = (m_overheadTimeIdx + 1) % m_overheadTimes.size();
|
||||
}
|
||||
}
|
||||
Reset();
|
||||
}
|
||||
|
||||
duration_t SleepTime(duration_t targetFrameTime)
|
||||
{
|
||||
const auto sleepTime = duration_t{ targetFrameTime } - TimeSince(m_oldTime);
|
||||
m_overhead = std::accumulate(m_overheadTimes.begin(), m_overheadTimes.end(), duration_t{}) /
|
||||
m_overheadTimes.size();
|
||||
if (sleepTime > m_overhead)
|
||||
{
|
||||
return sleepTime - m_overhead;
|
||||
}
|
||||
return duration_t{ 0 };
|
||||
}
|
||||
|
||||
private:
|
||||
delta_clock::time_point m_oldTime;
|
||||
std::array<duration_t, 4> m_overheadTimes{};
|
||||
size_t m_overheadTimeIdx = 0;
|
||||
duration_t m_overhead = duration_t{ 0 };
|
||||
|
||||
duration_t TimeSince(delta_clock::time_point start)
|
||||
{
|
||||
return std::chrono::duration_cast<duration_t>(delta_clock::now() - start);
|
||||
}
|
||||
|
||||
#if _WIN32
|
||||
bool m_initialized;
|
||||
double m_countPerNs;
|
||||
|
||||
void NanoSleep(const duration_t duration)
|
||||
{
|
||||
if (!m_initialized)
|
||||
{
|
||||
LARGE_INTEGER freq;
|
||||
QueryPerformanceFrequency(&freq);
|
||||
m_countPerNs = static_cast<double>(freq.QuadPart) / 1000000000.0;
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
DWORD ms = std::chrono::duration_cast<std::chrono::milliseconds>(duration).count();
|
||||
auto tickCount =
|
||||
static_cast<LONGLONG>(static_cast<double>(duration.count()) * m_countPerNs);
|
||||
LARGE_INTEGER count;
|
||||
QueryPerformanceCounter(&count);
|
||||
if (ms > 10)
|
||||
{
|
||||
// Adjust for Sleep overhead
|
||||
::Sleep(ms - 10);
|
||||
}
|
||||
auto end = count.QuadPart + tickCount;
|
||||
do
|
||||
{
|
||||
QueryPerformanceCounter(&count);
|
||||
} while (count.QuadPart < end);
|
||||
}
|
||||
#else
|
||||
void NanoSleep(const duration_t duration)
|
||||
{
|
||||
std::this_thread::sleep_for(duration);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static Limiter g_frameLimiter;
|
||||
void frame_limiter()
|
||||
{
|
||||
g_frameLimiter.Sleep(
|
||||
std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::seconds{ 1 }) / 60);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
#ifndef DUSK_IMGUI_HPP
|
||||
#define DUSK_IMGUI_HPP
|
||||
|
||||
#include <aurora/aurora.h>
|
||||
#include <string>
|
||||
|
||||
#include "imgui.h"
|
||||
|
||||
namespace dusk {
|
||||
class ImGuiConsole {
|
||||
public:
|
||||
ImGuiConsole();
|
||||
|
||||
void draw();
|
||||
|
||||
void ShowDebugOverlay();
|
||||
void ShowCameraOverlay();
|
||||
void ShowProcessManager();
|
||||
void ShowHeapOverlay();
|
||||
void ShowInputViewer();
|
||||
void ShowStubLog();
|
||||
void ShowMapLoader();
|
||||
|
||||
bool CheckMenuViewToggle(ImGuiKey key, bool& active);
|
||||
|
||||
private:
|
||||
bool m_isHidden = false;
|
||||
|
||||
bool m_showDebugOverlay = false;
|
||||
int m_debugOverlayCorner = 0; // top-left
|
||||
|
||||
bool m_showCameraOverlay = false;
|
||||
int m_cameraOverlayCorner = 3;
|
||||
|
||||
bool m_showProcessManagement = false;
|
||||
|
||||
bool m_showHeapOverlay = false;
|
||||
|
||||
bool m_showStubLog = false;
|
||||
|
||||
bool m_showInputViewer = false;
|
||||
int m_inputOverlayCorner = 3;
|
||||
std::string m_controllerName;
|
||||
|
||||
bool m_showMapLoader = false;
|
||||
struct {
|
||||
int mapIdx = -1;
|
||||
int regionIdx = -1;
|
||||
int roomNoIdx = 0;
|
||||
int roomNo = -1;
|
||||
int spawnId = 0;
|
||||
int layer = -1;
|
||||
bool showInternalNames = false;
|
||||
} m_mapLoaderInfo;
|
||||
};
|
||||
|
||||
extern ImGuiConsole g_imguiConsole;
|
||||
|
||||
std::string_view backend_name(AuroraBackend backend);
|
||||
std::string BytesToString(size_t bytes);
|
||||
void SetOverlayWindowLocation(int corner);
|
||||
bool ShowCornerContextMenu(int& corner, int avoidCorner);
|
||||
}
|
||||
|
||||
void DuskDebugPad();
|
||||
|
||||
#endif // DUSK_IMGUI_HPP
|
||||
@@ -0,0 +1,274 @@
|
||||
#include "m_Do/m_Do_controller_pad.h"
|
||||
|
||||
#include "imgui.h"
|
||||
#include <imgui_internal.h>
|
||||
#include "ImGuiConsole.hpp"
|
||||
|
||||
namespace dusk {
|
||||
void TextCenter(const std::string& text) {
|
||||
float font_size = ImGui::GetFontSize() * text.size() / 2;
|
||||
ImGui::SameLine(ImGui::GetWindowSize().x / 2 - font_size + (font_size / 2));
|
||||
|
||||
ImGui::TextUnformatted(text.c_str());
|
||||
}
|
||||
|
||||
static inline float GetScale() { return ImGui::GetCurrentContext()->CurrentDpiScale; }
|
||||
|
||||
void ImGuiConsole::ShowInputViewer() {
|
||||
if (!m_showInputViewer) {
|
||||
return;
|
||||
}
|
||||
|
||||
const char* controller_name = PADGetName(PAD_1);
|
||||
if (controller_name != nullptr) {
|
||||
m_controllerName = controller_name;
|
||||
}
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize |
|
||||
ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;
|
||||
if (m_inputOverlayCorner != -1) {
|
||||
SetOverlayWindowLocation(m_inputOverlayCorner);
|
||||
windowFlags |= ImGuiWindowFlags_NoMove;
|
||||
}
|
||||
|
||||
ImGui::SetNextWindowBgAlpha(0.65f);
|
||||
if (ImGui::Begin("Input Viewer", nullptr, windowFlags)) {
|
||||
float scale = GetScale();
|
||||
if (!m_controllerName.empty()) {
|
||||
TextCenter(m_controllerName);
|
||||
ImGui::Separator();
|
||||
}
|
||||
|
||||
ImDrawList* dl = ImGui::GetWindowDrawList();
|
||||
ImVec2 p = ImGui::GetCursorScreenPos();
|
||||
|
||||
// Left Stick vars
|
||||
float leftStickRadius = 30 * scale;
|
||||
p.x += 20 * scale;
|
||||
p.y += 20 * scale;
|
||||
ImVec2 leftStickCenter;
|
||||
leftStickCenter.x = p.x + 30 * scale;
|
||||
leftStickCenter.y = p.y + 45 * scale;
|
||||
|
||||
// Right Stick vars
|
||||
float rightStickRadius = 20 * scale;
|
||||
ImVec2 rightStickCenter;
|
||||
rightStickCenter.x = p.x + 160 * scale;
|
||||
rightStickCenter.y = p.y + 90 * scale;
|
||||
|
||||
// D-Pad vars
|
||||
float dpadRadius = 15 * scale;
|
||||
float dpadWidth = 8 * scale;
|
||||
ImVec2 dpadCenter;
|
||||
dpadCenter.x = p.x + 80 * scale;
|
||||
dpadCenter.y = p.y + 90 * scale;
|
||||
|
||||
// Start Button vars
|
||||
float startButtonRadius = 5 * scale;
|
||||
ImVec2 startButtonCenter;
|
||||
startButtonCenter.x = p.x + 120 * scale;
|
||||
startButtonCenter.y = p.y + 55 * scale;
|
||||
|
||||
// A Button vars
|
||||
float aButtonRadius = 16 * scale;
|
||||
ImVec2 aButtonCenter;
|
||||
aButtonCenter.x = p.x + 210 * scale;
|
||||
aButtonCenter.y = p.y + 48 * scale;
|
||||
|
||||
// B Button vars
|
||||
float bButtonRadius = 8 * scale;
|
||||
ImVec2 bButtonCenter;
|
||||
bButtonCenter.x = aButtonCenter.x + -24 * scale;
|
||||
bButtonCenter.y = aButtonCenter.y + 16 * scale;
|
||||
|
||||
// X Button vars
|
||||
ImVec2 xButtonRadius{ 7 * scale, 12 * scale};
|
||||
ImVec2 xButtonCenter;
|
||||
xButtonCenter.x = aButtonCenter.x + 24 * scale;
|
||||
xButtonCenter.y = aButtonCenter.y + -5 * scale;
|
||||
|
||||
// Y Button vars
|
||||
ImVec2 yButtonRadius{ 12 * scale, 7 * scale };
|
||||
ImVec2 yButtonCenter;
|
||||
yButtonCenter.x = aButtonCenter.x + -8 * scale;
|
||||
yButtonCenter.y = aButtonCenter.y + -24 * scale;
|
||||
|
||||
// Trigger vars
|
||||
float triggerWidth = leftStickRadius * 2;
|
||||
float triggerHeight = 8 * scale;
|
||||
ImVec2 lTrigCenter;
|
||||
lTrigCenter.x = leftStickCenter.x + 0 * scale;
|
||||
lTrigCenter.y = leftStickCenter.y + -60 * scale;
|
||||
ImVec2 rTrigCenter;
|
||||
rTrigCenter.x = aButtonCenter.x * scale;
|
||||
rTrigCenter.y = lTrigCenter.y * scale;
|
||||
|
||||
// Z Button vars
|
||||
ImVec2 zButtonRadius{ 10 * scale, 5 * scale };
|
||||
ImVec2 zButtonCenter;
|
||||
zButtonCenter.x = aButtonCenter.x + 18 * scale;
|
||||
zButtonCenter.y = aButtonCenter.y + -30 * scale;
|
||||
|
||||
const float zButtonHalfWidth = triggerWidth / 2;
|
||||
const float zButtonHalfHeight = 4 * scale;
|
||||
|
||||
constexpr ImU32 stickGray = IM_COL32(150, 150, 150, 255);
|
||||
constexpr ImU32 darkGray = IM_COL32(60, 60, 60, 255);
|
||||
constexpr ImU32 red = IM_COL32(230, 0, 0, 255);
|
||||
constexpr ImU32 yellow = IM_COL32(255, 219, 109, 255);
|
||||
constexpr ImU32 white = IM_COL32(255, 255, 255, 255);
|
||||
constexpr ImU32 green = IM_COL32(0, 225, 255, 255);
|
||||
constexpr ImU32 purple = IM_COL32(165, 75, 165, 255);
|
||||
|
||||
// Draw Left Stick
|
||||
{
|
||||
float x = mDoCPd_c::getStickX(PAD_1);
|
||||
float y = -mDoCPd_c::getStickY(PAD_1);
|
||||
dl->AddCircleFilled(leftStickCenter, leftStickRadius, stickGray, 8);
|
||||
|
||||
ImVec2 center;
|
||||
center.x = leftStickCenter.x + x * (leftStickRadius / 2);
|
||||
center.y = leftStickCenter.y + y * (leftStickRadius / 2);
|
||||
dl->AddCircleFilled(center, leftStickRadius / 2, white);
|
||||
}
|
||||
|
||||
// Draw Right Stick
|
||||
{
|
||||
float x = mDoCPd_c::getSubStickX(PAD_1);
|
||||
float y = -mDoCPd_c::getSubStickY(PAD_1);
|
||||
dl->AddCircleFilled(rightStickCenter, rightStickRadius, stickGray, 8);
|
||||
|
||||
ImVec2 center;
|
||||
center.x = rightStickCenter.x + x * (rightStickRadius / 2);
|
||||
center.y = rightStickCenter.y + y * (rightStickRadius / 2);
|
||||
dl->AddCircleFilled(center, leftStickRadius / 3, yellow);
|
||||
}
|
||||
|
||||
// Draw D-Pad
|
||||
{
|
||||
float halfWidth = dpadWidth / 2;
|
||||
{
|
||||
ImVec2 pmin;
|
||||
pmin.x = dpadCenter.x + -halfWidth;
|
||||
pmin.y = dpadCenter.y + -dpadRadius;
|
||||
ImVec2 pmax;
|
||||
pmax.x = dpadCenter.x + halfWidth;
|
||||
pmax.y = dpadCenter.y + dpadRadius;
|
||||
dl->AddRectFilled(pmin, pmax, stickGray);
|
||||
}
|
||||
{
|
||||
ImVec2 pmin;
|
||||
pmin.x = dpadCenter.x + -dpadRadius;
|
||||
pmin.y = dpadCenter.y + -halfWidth;
|
||||
ImVec2 pmax;
|
||||
pmax.x = dpadCenter.x + dpadRadius;
|
||||
pmax.y = dpadCenter.y + halfWidth;
|
||||
dl->AddRectFilled(pmin, pmax, stickGray);
|
||||
}
|
||||
|
||||
if (mDoCPd_c::getHoldUp(PAD_1)) {
|
||||
ImVec2 pmin;
|
||||
pmin.x = dpadCenter.x + -halfWidth;
|
||||
pmin.y = dpadCenter.y + -dpadRadius;
|
||||
ImVec2 pmax;
|
||||
pmax.x = dpadCenter.x + halfWidth;
|
||||
pmax.y = dpadCenter.y + -dpadRadius / 2;
|
||||
dl->AddRectFilled(pmin, pmax, white);
|
||||
}
|
||||
if (mDoCPd_c::getHoldDown(PAD_1)) {
|
||||
ImVec2 pmin;
|
||||
pmin.x = dpadCenter.x + -halfWidth;
|
||||
pmin.y = dpadCenter.y + dpadRadius;
|
||||
ImVec2 pmax;
|
||||
pmax.x = dpadCenter.x + halfWidth;
|
||||
pmax.y = dpadCenter.y + dpadRadius / 2;
|
||||
dl->AddRectFilled(pmin, pmax, white);
|
||||
}
|
||||
if (mDoCPd_c::getHoldLeft(PAD_1)) {
|
||||
ImVec2 pmin;
|
||||
pmin.x = dpadCenter.x + -dpadRadius;
|
||||
pmin.y = dpadCenter.y + -halfWidth;
|
||||
ImVec2 pmax;
|
||||
pmax.x = dpadCenter.x + -dpadRadius / 2;
|
||||
pmax.y = dpadCenter.y + halfWidth;
|
||||
dl->AddRectFilled(pmin, pmax, white);
|
||||
}
|
||||
if (mDoCPd_c::getHoldRight(PAD_1)) {
|
||||
ImVec2 pmin;
|
||||
pmin.x = dpadCenter.x + dpadRadius;
|
||||
pmin.y = dpadCenter.y + -halfWidth;
|
||||
ImVec2 pmax;
|
||||
pmax.x = dpadCenter.x + dpadRadius / 2;
|
||||
pmax.y = dpadCenter.y + halfWidth;
|
||||
dl->AddRectFilled(pmin, pmax, white);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw Buttons
|
||||
{
|
||||
// start
|
||||
dl->AddCircleFilled(startButtonCenter, startButtonRadius, mDoCPd_c::getHoldStart(PAD_1) ? white : stickGray);
|
||||
|
||||
// a
|
||||
dl->AddCircleFilled(aButtonCenter, aButtonRadius, mDoCPd_c::getHoldA(PAD_1) ? green : stickGray);
|
||||
|
||||
// b
|
||||
dl->AddCircleFilled(bButtonCenter, bButtonRadius, mDoCPd_c::getHoldB(PAD_1) ? red : stickGray);
|
||||
|
||||
// x
|
||||
dl->AddEllipseFilled(xButtonCenter, xButtonRadius, mDoCPd_c::getHoldX(PAD_1) ? white : stickGray, 25);
|
||||
|
||||
// y
|
||||
dl->AddEllipseFilled(yButtonCenter, yButtonRadius, mDoCPd_c::getHoldY(PAD_1) ? white : stickGray, 25);
|
||||
|
||||
// z
|
||||
dl->AddEllipseFilled(zButtonCenter, zButtonRadius, mDoCPd_c::getHoldZ(PAD_1) ? purple : stickGray, 35);
|
||||
}
|
||||
|
||||
// Draw Triggers
|
||||
{
|
||||
float halfTriggerWidth = triggerWidth / 2;
|
||||
ImVec2 lStart;
|
||||
lStart.x = lTrigCenter.x - halfTriggerWidth;
|
||||
lStart.y = lTrigCenter.y - 0;
|
||||
ImVec2 lEnd;
|
||||
lEnd.x = lTrigCenter.x + halfTriggerWidth;
|
||||
lEnd.y = lTrigCenter.y + triggerHeight;
|
||||
|
||||
float lValue = triggerWidth * std::min(1.f, mDoCPd_c::getAnalogL(PAD_1));
|
||||
ImVec2 p2;
|
||||
p2.x = lStart.x + lValue;
|
||||
p2.y = lStart.y + triggerHeight;
|
||||
dl->AddRectFilled(lStart, p2, mDoCPd_c::getHoldL(PAD_1) ? IM_COL32(0, 225, 0, 255) : white);
|
||||
p2.x = lStart.x + lValue;
|
||||
p2.y = lStart.y;
|
||||
dl->AddRectFilled(p2, lEnd, darkGray);
|
||||
|
||||
ImVec2 rStart;
|
||||
rStart.x = rTrigCenter.x - halfTriggerWidth;
|
||||
rStart.y = rTrigCenter.y - 0;
|
||||
ImVec2 rEnd;
|
||||
rEnd.x = rTrigCenter.x + halfTriggerWidth;
|
||||
rEnd.y = rTrigCenter.y + triggerHeight;
|
||||
|
||||
float rValue = triggerWidth * std::min(1.f, mDoCPd_c::getAnalogR(PAD_1));
|
||||
p2.x = rEnd.x - rValue;
|
||||
p2.y = rEnd.y - triggerHeight;
|
||||
dl->AddRectFilled(p2, rEnd, mDoCPd_c::getHoldR(PAD_1) ? IM_COL32(0, 225, 0, 255) : white);
|
||||
p2.x = rEnd.x - rValue;
|
||||
p2.y = rEnd.y;
|
||||
dl->AddRectFilled(rStart, p2, darkGray);
|
||||
}
|
||||
|
||||
ImVec2 size;
|
||||
size.x = 270 * scale;
|
||||
size.y = 130 * scale;
|
||||
ImGui::Dummy(size);
|
||||
|
||||
ShowCornerContextMenu(m_inputOverlayCorner, 0);
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
} // namespace dusk
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "m_Do/m_Do_controller_pad.h"
|
||||
|
||||
#include "imgui.h"
|
||||
#include "imgui.hpp"
|
||||
#include "ImGuiConsole.hpp"
|
||||
|
||||
void DuskDebugPad() {
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_K)) {
|
||||
@@ -0,0 +1,102 @@
|
||||
#include <array>
|
||||
|
||||
#include "JSystem/JFramework/JFWSystem.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "imgui.h"
|
||||
#include "ImGuiConsole.hpp"
|
||||
|
||||
namespace dusk {
|
||||
static void DrawTableCore();
|
||||
|
||||
void ImGuiConsole::ShowHeapOverlay() {
|
||||
if (!CheckMenuViewToggle(ImGuiKey_F4, m_showHeapOverlay)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ImGui::Begin("Heaps", &m_showHeapOverlay)) {
|
||||
if (ImGui::BeginTable(
|
||||
"heaps",
|
||||
5,
|
||||
ImGuiTableFlags_RowBg | ImGuiTableFlags_Resizable)) {
|
||||
|
||||
DrawTableCore();
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
static void DrawHeap(JKRHeap* heap, int depth = 0);
|
||||
|
||||
static void DrawTableCore() {
|
||||
ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted("Heap name");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted("Use%");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted("Available");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted("Total");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted("Type");
|
||||
|
||||
DrawHeap(reinterpret_cast<JKRHeap*>(JFWSystem::rootHeap));
|
||||
}
|
||||
|
||||
static std::array<char, 4> GetHeapType(JKRHeap* heap) {
|
||||
auto type = heap->getHeapType();
|
||||
|
||||
return {
|
||||
(char)(type >> 24 & 0xFF),
|
||||
(char)(type >> 16 & 0xFF),
|
||||
(char)(type >> 8 & 0xFF),
|
||||
(char)(type >> 0 & 0xFF),
|
||||
};
|
||||
}
|
||||
|
||||
static const char* GetHeapName(const JKRHeap* heap) {
|
||||
const auto name = heap->getName();
|
||||
if (strlen(name) == 0) {
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
static void DrawHeap(JKRHeap* heap, const int depth) {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
auto indentSize = depth * 16;
|
||||
if (indentSize != 0)
|
||||
ImGui::Indent(indentSize);
|
||||
ImGui::TextUnformatted(GetHeapName(heap));
|
||||
if (indentSize != 0)
|
||||
ImGui::Unindent(indentSize);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::ProgressBar(
|
||||
1 - (f32)heap->getFreeSize() / (f32)heap->getSize(),
|
||||
ImVec2(ImGui::GetContentRegionAvail().x, 0));
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
auto freeSizeString = BytesToString(heap->getFreeSize());
|
||||
ImGui::TextUnformatted(freeSizeString.c_str());
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
auto totalSizeString = BytesToString(heap->getSize());
|
||||
ImGui::TextUnformatted(totalSizeString.c_str());
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
auto typeString = GetHeapType(heap);
|
||||
ImGui::TextUnformatted(typeString.data(), typeString.data() + 4);
|
||||
|
||||
const JSUTree<JKRHeap>& tree = heap->getHeapTree();
|
||||
for (JSUTreeIterator iter(tree.getFirstChild()); iter != tree.getEndChild(); ++iter) {
|
||||
DrawHeap(*iter, depth + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
#include "d/d_com_inf_game.h"
|
||||
|
||||
#include "imgui.h"
|
||||
#include <imgui_internal.h>
|
||||
#include "ImGuiConsole.hpp"
|
||||
#include "dusk/map_loader_definitions.h"
|
||||
|
||||
namespace dusk {
|
||||
void ImGuiConsole::ShowMapLoader() {
|
||||
if (!m_showMapLoader) {
|
||||
return;
|
||||
}
|
||||
|
||||
ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize |
|
||||
ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;
|
||||
|
||||
ImGui::SetNextWindowBgAlpha(0.65f);
|
||||
ImGui::SetNextWindowSizeConstraints(ImVec2(300, 0), ImVec2(FLT_MAX, FLT_MAX));
|
||||
|
||||
if (!ImGui::Begin("Map Loader", nullptr, windowFlags)) {
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui::SeparatorText("Map Loader");
|
||||
|
||||
ImGui::Checkbox("Show Internal Names", &m_mapLoaderInfo.showInternalNames);
|
||||
|
||||
const char* previewRegion = "None";
|
||||
if (m_mapLoaderInfo.regionIdx != -1) {
|
||||
previewRegion = gameRegions[m_mapLoaderInfo.regionIdx].regionName;
|
||||
}
|
||||
|
||||
if (ImGui::BeginCombo("Select Region", previewRegion)) {
|
||||
int idx = 0;
|
||||
for (const auto& region : gameRegions) {
|
||||
if (ImGui::Selectable(region.regionName)) {
|
||||
m_mapLoaderInfo.regionIdx = idx;
|
||||
m_mapLoaderInfo.mapIdx = -1;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
if (m_mapLoaderInfo.regionIdx != -1) {
|
||||
const auto& region = gameRegions[m_mapLoaderInfo.regionIdx];
|
||||
|
||||
std::string previewMap = "None";
|
||||
if (m_mapLoaderInfo.mapIdx != -1) {
|
||||
const auto& map = region.maps[m_mapLoaderInfo.mapIdx];
|
||||
previewMap = m_mapLoaderInfo.showInternalNames ? fmt::format("{} ({})", map.mapName, map.mapFile) : map.mapName;
|
||||
}
|
||||
|
||||
if (ImGui::BeginCombo("Select Map", previewMap.data())) {
|
||||
for (int i = 0; i < region.numMaps; ++i) {
|
||||
const auto& map = region.maps[i];
|
||||
std::string label = m_mapLoaderInfo.showInternalNames ? fmt::format("{} ({})", map.mapName, map.mapFile) : map.mapName;
|
||||
if (ImGui::Selectable(label.data())) {
|
||||
m_mapLoaderInfo.mapIdx = i;
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
}else {
|
||||
ImGui::Text("No region selected.");
|
||||
}
|
||||
|
||||
if (m_mapLoaderInfo.regionIdx != -1 && m_mapLoaderInfo.mapIdx != -1) {
|
||||
const auto& region = gameRegions[m_mapLoaderInfo.regionIdx];
|
||||
const auto& map = region.maps[m_mapLoaderInfo.mapIdx];
|
||||
|
||||
if (map.numRooms > 0) {
|
||||
ImGui::Text("Selected Room: %d", map.mapRooms[m_mapLoaderInfo.roomNoIdx]);
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("-###RoomNoIdxDec")) {
|
||||
m_mapLoaderInfo.roomNoIdx--;
|
||||
if (m_mapLoaderInfo.roomNoIdx < 0) {
|
||||
m_mapLoaderInfo.roomNoIdx = 0;
|
||||
}
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("+###RoomNoIdxInc")) {
|
||||
m_mapLoaderInfo.roomNoIdx++;
|
||||
if (m_mapLoaderInfo.roomNoIdx >= map.numRooms) {
|
||||
m_mapLoaderInfo.roomNoIdx = map.numRooms - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::Button("Warp")) {
|
||||
dComIfGp_setNextStage(map.mapFile, 0, map.mapRooms[m_mapLoaderInfo.roomNoIdx], -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
} // namespace dusk
|
||||
@@ -0,0 +1,102 @@
|
||||
#define PROCS_DUMP_NAMES 1
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include "d/d_procname.h"
|
||||
#include "f_pc/f_pc_create_iter.h"
|
||||
#include "f_pc/f_pc_create_req.h"
|
||||
#include "f_pc/f_pc_layer.h"
|
||||
#include "f_pc/f_pc_layer_iter.h"
|
||||
#include "f_pc/f_pc_leaf.h"
|
||||
#include "f_pc/f_pc_node.h"
|
||||
#include "imgui.h"
|
||||
#include "ImGuiConsole.hpp"
|
||||
#include "imgui_internal.h"
|
||||
|
||||
namespace dusk {
|
||||
bool showTreeRecursive;
|
||||
|
||||
static int ShowProcess(void* p, void*) {
|
||||
auto proc = static_cast<base_process_class*>(p);
|
||||
|
||||
char buf[64];
|
||||
snprintf(buf, sizeof(buf), "%d", proc->id);
|
||||
|
||||
ImVec2 avail = ImGui::GetContentRegionAvail();
|
||||
|
||||
ImVec2 vec = { avail.x, 0 };
|
||||
if (ImGui::BeginChild(buf, vec, ImGuiChildFlags_Border | ImGuiChildFlags_AutoResizeY)) {
|
||||
ImGui::Text("[%d] %s", proc->id, GetProcName(proc->profname));
|
||||
ImGui::Text("init_state: %d, create_phase: %d", proc->state.init_state, proc->state.create_phase);
|
||||
|
||||
const char* ofTypeName = "unknown";
|
||||
if (proc->subtype == g_fpcNd_type) {
|
||||
ofTypeName = "Node";
|
||||
}
|
||||
else if (proc->subtype == g_fpcLf_type) {
|
||||
ofTypeName = "Leaf";
|
||||
}
|
||||
|
||||
ImGui::Text("OfType: %d (%s), layer: %d", proc->subtype, ofTypeName, proc->layer_tag.layer->layer_id);
|
||||
|
||||
if (proc->create_req != nullptr) {
|
||||
ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), "Pending create request");
|
||||
}
|
||||
|
||||
if (showTreeRecursive) {
|
||||
if (fpcBs_Is_JustOfType(g_fpcNd_type, proc->subtype)) {
|
||||
auto procNode = static_cast<process_node_class*>(p);
|
||||
|
||||
ImGui::Text("Owns layer %d", procNode->layer.layer_id);
|
||||
|
||||
fpcLyIt_OnlyHere(&procNode->layer, ShowProcess, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndChild();
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ShowCreateRequest(void* p, void*) {
|
||||
create_request* req = (create_request*)p;
|
||||
|
||||
if (req->process != nullptr) {
|
||||
ShowProcess(req->process, nullptr);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void ImGuiConsole::ShowProcessManager() {
|
||||
if (!CheckMenuViewToggle(ImGuiKey_F2, m_showProcessManagement)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ImGui::Begin("Processes")) {
|
||||
if (ImGui::BeginTabBar("Tabs")) {
|
||||
showTreeRecursive = true;
|
||||
if (ImGui::BeginTabItem("Tree")) {
|
||||
fpcLyIt_OnlyHere(fpcLy_RootLayer(), ShowProcess, nullptr);
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
showTreeRecursive = false;
|
||||
if (ImGui::BeginTabItem("All layers")) {
|
||||
fpcLyIt_All(ShowProcess, nullptr);
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabItem("Creation queue")) {
|
||||
fpcCtIt_Method(ShowCreateRequest, nullptr);
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
#include <vector>
|
||||
|
||||
#include "dusk/logging.h"
|
||||
#include "imgui.h"
|
||||
#include "ImGuiConsole.hpp"
|
||||
|
||||
namespace dusk {
|
||||
static ImGuiTextBuffer StubLogBuffer;
|
||||
static std::vector<int> LineOffsets;
|
||||
static bool StubLogPaused;
|
||||
|
||||
const char* LogLevelName(const AuroraLogLevel level) {
|
||||
switch (level) {
|
||||
case LOG_DEBUG:
|
||||
return "DEBUG";
|
||||
case LOG_INFO:
|
||||
return "INFO";
|
||||
case LOG_WARNING:
|
||||
return "WARNING";
|
||||
case LOG_ERROR:
|
||||
return "ERROR";
|
||||
case LOG_FATAL:
|
||||
return "FATAL";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
void SendToStubLog(AuroraLogLevel level, const char* module, const char* message) {
|
||||
if (StubLogPaused) {
|
||||
return;
|
||||
}
|
||||
|
||||
LineOffsets.push_back(StubLogBuffer.size());
|
||||
const auto levelName = LogLevelName(level);
|
||||
StubLogBuffer.appendf("[%s | %s] %s\n", levelName, module, message);
|
||||
}
|
||||
|
||||
static void ClearPastFrame();
|
||||
|
||||
void ImGuiConsole::ShowStubLog() {
|
||||
if (!CheckMenuViewToggle(ImGuiKey_F5, m_showStubLog)) {
|
||||
ClearPastFrame();
|
||||
return;
|
||||
}
|
||||
|
||||
if (ImGui::Begin("Stub log", &m_showStubLog)) {
|
||||
ImGui::Checkbox("Redirect stub log", &StubLogEnabled);
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("Pause", &StubLogPaused);
|
||||
|
||||
ImGui::Text("Line count (this frame): %llu", LineOffsets.size());
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::BeginChild("scrolling")) {
|
||||
ImGuiListClipper clipper;
|
||||
clipper.Begin(LineOffsets.size());
|
||||
while (clipper.Step()) {
|
||||
for (int idx = clipper.DisplayStart; idx < clipper.DisplayEnd; idx++) {
|
||||
const char* lineStart = StubLogBuffer.begin() + LineOffsets[idx];
|
||||
const char* lineEnd = idx == LineOffsets.size() - 1 ? StubLogBuffer.end() : StubLogBuffer.begin() + LineOffsets[idx + 1];
|
||||
ImGui::TextUnformatted(lineStart, lineEnd);
|
||||
}
|
||||
}
|
||||
|
||||
clipper.End();
|
||||
}
|
||||
|
||||
ImGui::EndChild();
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
ClearPastFrame();
|
||||
}
|
||||
|
||||
void ClearPastFrame() {
|
||||
if (StubLogPaused) {
|
||||
return;
|
||||
}
|
||||
StubLogBuffer.clear();
|
||||
LineOffsets.clear();
|
||||
}
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
#include "f_op/f_op_camera_mng.h"
|
||||
#include "SSystem/SComponent/c_xyz.h"
|
||||
|
||||
#include "imgui.h"
|
||||
#include "imgui.hpp"
|
||||
|
||||
static bool Active = false;
|
||||
static int m_cameraOverlayCorner = 3;
|
||||
|
||||
void DuskCameraDebug() {
|
||||
if (ImGui::BeginMenu(MenuView)) {
|
||||
ImGui::MenuItem("Camera", "F6", &Active);
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_F6)) {
|
||||
Active = !Active;
|
||||
}
|
||||
|
||||
auto* cam = (camera_process_class*)dCam_getCamera();
|
||||
|
||||
if (!Active || cam == nullptr)
|
||||
return;
|
||||
|
||||
auto* dCam = &cam->mCamera;
|
||||
|
||||
ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize |
|
||||
ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;
|
||||
if (m_cameraOverlayCorner != -1) {
|
||||
SetOverlayWindowLocation(m_cameraOverlayCorner);
|
||||
windowFlags |= ImGuiWindowFlags_NoMove;
|
||||
}
|
||||
|
||||
ImGui::SetNextWindowBgAlpha(0.65f);
|
||||
ImGui::SetNextWindowSizeConstraints(ImVec2(300, 0), ImVec2(FLT_MAX, FLT_MAX));
|
||||
|
||||
if (!ImGui::Begin("Camera Debug", nullptr, windowFlags)) {
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui::SeparatorText("Camera Transform Data");
|
||||
|
||||
cXyz center = dCam->mCenter;
|
||||
cXyz eye = dCam->mEye;
|
||||
|
||||
if (ImGui::InputFloat3("Camera Center", ¢er.x)) {
|
||||
dCam->Reset(center, eye);
|
||||
}
|
||||
if (ImGui::InputFloat3("Camera Eye", &eye.x)) {
|
||||
dCam->Reset(center, eye);
|
||||
}
|
||||
|
||||
ImGui::InputFloat("Camera FOV", &dCam->mFovy);
|
||||
|
||||
ImGui::SeparatorText("Free-look Data");
|
||||
|
||||
static float eyeYawDeg = 0.0f;
|
||||
static float moveSpeed = 10000.0f;
|
||||
static float rotSpeed = 5.0f;
|
||||
static cXyz freeLookPos = cXyz::Zero;
|
||||
|
||||
bool changed = false;
|
||||
|
||||
if (ImGui::IsKeyDown(ImGuiKey_LeftArrow)) {
|
||||
eyeYawDeg += rotSpeed;
|
||||
if (eyeYawDeg >= 360.0f)
|
||||
eyeYawDeg -= 360.0f;
|
||||
|
||||
changed = true;
|
||||
} else if (ImGui::IsKeyDown(ImGuiKey_RightArrow)) {
|
||||
eyeYawDeg -= rotSpeed;
|
||||
if (eyeYawDeg < 0.0f)
|
||||
eyeYawDeg += 360.0f;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
cSAngle yawAngle = cSAngle(eyeYawDeg);
|
||||
cXyz frontDir = cXyz(yawAngle.Sin(), 0.0f, yawAngle.Cos());
|
||||
|
||||
if (ImGui::IsKeyDown(ImGuiKey_UpArrow)) {
|
||||
freeLookPos -= frontDir * moveSpeed * ImGui::GetIO().DeltaTime;
|
||||
changed = true;
|
||||
} else if (ImGui::IsKeyDown(ImGuiKey_DownArrow)) {
|
||||
freeLookPos += frontDir * moveSpeed * ImGui::GetIO().DeltaTime;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (ImGui::IsKeyDown(ImGuiKey_LeftShift)) {
|
||||
freeLookPos += cXyz::BaseY * moveSpeed * ImGui::GetIO().DeltaTime;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl)) {
|
||||
freeLookPos -= cXyz::BaseY * moveSpeed * ImGui::GetIO().DeltaTime;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
dCam->Reset(freeLookPos, freeLookPos + (frontDir * 100.0f));
|
||||
}
|
||||
|
||||
ImGui::InputFloat("Free-look Yaw", &eyeYawDeg);
|
||||
ImGui::InputFloat3("Free-look Position", &freeLookPos.x);
|
||||
ImGui::InputFloat("Free-look Move Speed", &moveSpeed);
|
||||
ImGui::InputFloat("Free-look Rotation Speed", &rotSpeed);
|
||||
|
||||
ShowCornerContextMenu(m_cameraOverlayCorner, 0);
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
@@ -1,200 +0,0 @@
|
||||
#include <array>
|
||||
#include <numeric>
|
||||
#include <string_view>
|
||||
|
||||
#include "fmt/format.h"
|
||||
#include "imgui.h"
|
||||
#include "aurora/gfx.h"
|
||||
|
||||
#include "aurora/gfx.h"
|
||||
#include "imgui.hpp"
|
||||
|
||||
static bool m_frameRate = true;
|
||||
static bool m_pipelineInfo = true;
|
||||
static bool m_graphicsBackend = true;
|
||||
static int m_debugOverlayCorner = 0; // top-left
|
||||
|
||||
using namespace std::string_literals;
|
||||
using namespace std::string_view_literals;
|
||||
|
||||
void SetOverlayWindowLocation(int corner)
|
||||
{
|
||||
const ImGuiViewport *viewport = ImGui::GetMainViewport();
|
||||
ImVec2 workPos = viewport->WorkPos; // Use work area to avoid menu-bar/task-bar, if any!
|
||||
ImVec2 workSize = viewport->WorkSize;
|
||||
ImVec2 windowPos;
|
||||
ImVec2 windowPosPivot;
|
||||
constexpr float padding = 10.0f;
|
||||
windowPos.x = (corner & 1) != 0 ? (workPos.x + workSize.x - padding) : (workPos.x + padding);
|
||||
windowPos.y = (corner & 2) != 0 ? (workPos.y + workSize.y - padding) : (workPos.y + padding);
|
||||
windowPosPivot.x = (corner & 1) != 0 ? 1.0f : 0.0f;
|
||||
windowPosPivot.y = (corner & 2) != 0 ? 1.0f : 0.0f;
|
||||
ImGui::SetNextWindowPos(windowPos, ImGuiCond_Always, windowPosPivot);
|
||||
}
|
||||
|
||||
bool ShowCornerContextMenu(int& corner, int avoidCorner) {
|
||||
bool result = false;
|
||||
if (ImGui::BeginPopupContextWindow()) {
|
||||
if (ImGui::MenuItem("Custom", nullptr, corner == -1)) {
|
||||
corner = -1;
|
||||
result = true;
|
||||
}
|
||||
if (ImGui::MenuItem("Top-left", nullptr, corner == 0, avoidCorner != 0)) {
|
||||
corner = 0;
|
||||
result = true;
|
||||
}
|
||||
if (ImGui::MenuItem("Top-right", nullptr, corner == 1, avoidCorner != 1)) {
|
||||
corner = 1;
|
||||
result = true;
|
||||
}
|
||||
if (ImGui::MenuItem("Bottom-left", nullptr, corner == 2, avoidCorner != 2)) {
|
||||
corner = 2;
|
||||
result = true;
|
||||
}
|
||||
if (ImGui::MenuItem("Bottom-right", nullptr, corner == 3, avoidCorner != 3)) {
|
||||
corner = 3;
|
||||
result = true;
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static void ImGuiStringViewText(std::string_view text)
|
||||
{
|
||||
// begin()/end() do not work on MSVC
|
||||
ImGui::TextUnformatted(text.data(), text.data() + text.size());
|
||||
}
|
||||
|
||||
std::string BytesToString(size_t bytes)
|
||||
{
|
||||
constexpr std::array suffixes{"B"sv, "KB"sv, "MB"sv, "GB"sv, "TB"sv, "PB"sv, "EB"sv};
|
||||
uint32_t s = 0;
|
||||
auto count = static_cast<double>(bytes);
|
||||
while (count >= 1024.0 && s < 7)
|
||||
{
|
||||
s++;
|
||||
count /= 1024.0;
|
||||
}
|
||||
if (count - floor(count) == 0.0)
|
||||
{
|
||||
return fmt::format(FMT_STRING("{}{}"), static_cast<size_t>(count), suffixes[s]);
|
||||
}
|
||||
return fmt::format(FMT_STRING("{:.1f}{}"), count, suffixes[s]);
|
||||
}
|
||||
|
||||
static bool Active = false;
|
||||
|
||||
void DuskImguiDebugOverlay(const AuroraInfo *info) {
|
||||
if (ImGui::BeginMenu(MenuView)) {
|
||||
ImGui::MenuItem("Debug overlay", "F3", &Active);
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_F3)) {
|
||||
Active = !Active;
|
||||
}
|
||||
|
||||
if (!Active) {
|
||||
return;
|
||||
}
|
||||
|
||||
ImGuiIO &io = ImGui::GetIO();
|
||||
ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoDecoration |
|
||||
ImGuiWindowFlags_AlwaysAutoResize |
|
||||
ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;
|
||||
if (m_debugOverlayCorner != -1)
|
||||
{
|
||||
SetOverlayWindowLocation(m_debugOverlayCorner);
|
||||
windowFlags |= ImGuiWindowFlags_NoMove;
|
||||
}
|
||||
ImGui::SetNextWindowBgAlpha(0.65f);
|
||||
if (ImGui::Begin("Debug Overlay", nullptr, windowFlags))
|
||||
{
|
||||
bool hasPrevious = false;
|
||||
if (m_frameRate)
|
||||
{
|
||||
if (hasPrevious)
|
||||
{
|
||||
ImGui::Separator();
|
||||
}
|
||||
hasPrevious = true;
|
||||
|
||||
ImGuiStringViewText(fmt::format(FMT_STRING("FPS: {:.1f}\n"), io.Framerate));
|
||||
}
|
||||
if (m_graphicsBackend)
|
||||
{
|
||||
if (hasPrevious)
|
||||
{
|
||||
ImGui::Separator();
|
||||
}
|
||||
hasPrevious = true;
|
||||
|
||||
std::string_view backendString = "Unknown"sv;
|
||||
switch (info->backend)
|
||||
{
|
||||
case BACKEND_AUTO:
|
||||
backendString = "Auto"sv;
|
||||
break;
|
||||
case BACKEND_D3D11:
|
||||
backendString = "D3D11"sv;
|
||||
break;
|
||||
case BACKEND_D3D12:
|
||||
backendString = "D3D12"sv;
|
||||
break;
|
||||
case BACKEND_METAL:
|
||||
backendString = "Metal"sv;
|
||||
break;
|
||||
case BACKEND_VULKAN:
|
||||
backendString = "Vulkan"sv;
|
||||
break;
|
||||
case BACKEND_OPENGL:
|
||||
backendString = "OpenGL"sv;
|
||||
break;
|
||||
case BACKEND_OPENGLES:
|
||||
backendString = "OpenGL ES"sv;
|
||||
break;
|
||||
case BACKEND_WEBGPU:
|
||||
backendString = "WebGPU"sv;
|
||||
break;
|
||||
case BACKEND_NULL:
|
||||
backendString = "Null"sv;
|
||||
break;
|
||||
}
|
||||
ImGuiStringViewText(fmt::format(FMT_STRING("Backend: {}\n"), backendString));
|
||||
}
|
||||
if (m_pipelineInfo)
|
||||
{
|
||||
if (hasPrevious)
|
||||
{
|
||||
ImGui::Separator();
|
||||
}
|
||||
hasPrevious = true;
|
||||
|
||||
AuroraStats const* stats = aurora_get_stats();
|
||||
|
||||
ImGuiStringViewText(
|
||||
fmt::format(FMT_STRING("Queued pipelines: {}\n"), stats->queuedPipelines));
|
||||
ImGuiStringViewText(
|
||||
fmt::format(FMT_STRING("Done pipelines: {}\n"), stats->createdPipelines));
|
||||
ImGuiStringViewText(
|
||||
fmt::format(FMT_STRING("Draw call count: {}\n"), stats->drawCallCount));
|
||||
ImGuiStringViewText(fmt::format(FMT_STRING("Merged draw calls: {}\n"),
|
||||
stats->mergedDrawCallCount));
|
||||
ImGuiStringViewText(fmt::format(FMT_STRING("Vertex size: {}\n"),
|
||||
BytesToString(stats->lastVertSize)));
|
||||
ImGuiStringViewText(fmt::format(FMT_STRING("Uniform size: {}\n"),
|
||||
BytesToString(stats->lastUniformSize)));
|
||||
ImGuiStringViewText(fmt::format(FMT_STRING("Index size: {}\n"),
|
||||
BytesToString(stats->lastIndexSize)));
|
||||
ImGuiStringViewText(fmt::format(FMT_STRING("Storage size: {}\n"),
|
||||
BytesToString(stats->lastStorageSize)));
|
||||
ImGuiStringViewText(fmt::format(
|
||||
FMT_STRING("Total: {}\n"),
|
||||
BytesToString(stats->lastVertSize + stats->lastUniformSize +
|
||||
stats->lastIndexSize + stats->lastStorageSize)));
|
||||
}
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
#include <array>
|
||||
|
||||
#include "JSystem/JFramework/JFWSystem.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "imgui.h"
|
||||
#include "imgui.hpp"
|
||||
|
||||
static bool Active = false;
|
||||
|
||||
static void DrawTableCore();
|
||||
|
||||
void DuskImguiHeaps() {
|
||||
if (ImGui::BeginMenu(MenuView)) {
|
||||
ImGui::MenuItem("Heaps", "F4", &Active);
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_F4)) {
|
||||
Active = !Active;
|
||||
}
|
||||
|
||||
if (!Active) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ImGui::Begin("Heaps", &Active)) {
|
||||
if (ImGui::BeginTable(
|
||||
"heaps",
|
||||
5,
|
||||
ImGuiTableFlags_RowBg | ImGuiTableFlags_Resizable)) {
|
||||
|
||||
DrawTableCore();
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
static void DrawHeap(JKRHeap* heap, int depth = 0);
|
||||
|
||||
static void DrawTableCore() {
|
||||
ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted("Heap name");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted("Use%");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted("Available");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted("Total");
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted("Type");
|
||||
|
||||
DrawHeap(reinterpret_cast<JKRHeap*>(JFWSystem::rootHeap));
|
||||
}
|
||||
|
||||
static std::array<char, 4> GetHeapType(JKRHeap* heap) {
|
||||
auto type = heap->getHeapType();
|
||||
|
||||
return {
|
||||
(char)(type >> 24 & 0xFF),
|
||||
(char)(type >> 16 & 0xFF),
|
||||
(char)(type >> 8 & 0xFF),
|
||||
(char)(type >> 0 & 0xFF),
|
||||
};
|
||||
}
|
||||
|
||||
static const char* GetHeapName(const JKRHeap* heap) {
|
||||
const auto name = heap->getName();
|
||||
if (strlen(name) == 0) {
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
static void DrawHeap(JKRHeap* heap, const int depth) {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
auto indentSize = depth * 16;
|
||||
if (indentSize != 0)
|
||||
ImGui::Indent(indentSize);
|
||||
ImGui::TextUnformatted(GetHeapName(heap));
|
||||
if (indentSize != 0)
|
||||
ImGui::Unindent(indentSize);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::ProgressBar(
|
||||
1 - (f32)heap->getFreeSize() / (f32)heap->getSize(),
|
||||
ImVec2(ImGui::GetContentRegionAvail().x, 0));
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
auto freeSizeString = BytesToString(heap->getFreeSize());
|
||||
ImGui::TextUnformatted(freeSizeString.c_str());
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
auto totalSizeString = BytesToString(heap->getSize());
|
||||
ImGui::TextUnformatted(totalSizeString.c_str());
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
auto typeString = GetHeapType(heap);
|
||||
ImGui::TextUnformatted(typeString.data(), typeString.data() + 4);
|
||||
|
||||
const JSUTree<JKRHeap>& tree = heap->getHeapTree();
|
||||
for (JSUTreeIterator iter(tree.getFirstChild()); iter != tree.getEndChild(); ++iter) {
|
||||
DrawHeap(*iter, depth + 1);
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#ifndef DUSK_IMGUI_HPP
|
||||
#define DUSK_IMGUI_HPP
|
||||
|
||||
#include <aurora/aurora.h>
|
||||
#include <string>
|
||||
|
||||
inline const char* MenuView = "View";
|
||||
|
||||
void DuskImguiDebugOverlay(const AuroraInfo *info);
|
||||
void DuskImguiProcesses();
|
||||
void DuskImguiHeaps();
|
||||
void DuskCameraDebug();
|
||||
void DuskDebugPad();
|
||||
|
||||
void SetOverlayWindowLocation(int corner);
|
||||
bool ShowCornerContextMenu(int& corner, int avoidCorner);
|
||||
|
||||
std::string BytesToString(size_t bytes);
|
||||
|
||||
#endif // DUSK_IMGUI_HPP
|
||||
@@ -1,110 +0,0 @@
|
||||
#define PROCS_DUMP_NAMES 1
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include "d/d_procname.h"
|
||||
#include "f_pc/f_pc_create_iter.h"
|
||||
#include "f_pc/f_pc_create_req.h"
|
||||
#include "f_pc/f_pc_layer.h"
|
||||
#include "f_pc/f_pc_layer_iter.h"
|
||||
#include "f_pc/f_pc_leaf.h"
|
||||
#include "f_pc/f_pc_node.h"
|
||||
#include "imgui.h"
|
||||
#include "imgui.hpp"
|
||||
#include "imgui_internal.h"
|
||||
|
||||
bool showTreeRecursive;
|
||||
|
||||
static int ShowProcess(void* p, void*) {
|
||||
auto proc = static_cast<base_process_class*>(p);
|
||||
|
||||
char buf[64];
|
||||
snprintf(buf, sizeof(buf), "%d", proc->id);
|
||||
|
||||
ImVec2 avail = ImGui::GetContentRegionAvail();
|
||||
|
||||
ImVec2 vec = {avail.x, 0};
|
||||
if (ImGui::BeginChild(buf, vec, ImGuiChildFlags_Border | ImGuiChildFlags_AutoResizeY)) {
|
||||
ImGui::Text("[%d] %s", proc->id, GetProcName(proc->profname));
|
||||
ImGui::Text("init_state: %d, create_phase: %d", proc->state.init_state, proc->state.create_phase);
|
||||
|
||||
const char* ofTypeName = "unknown";
|
||||
if (proc->subtype == g_fpcNd_type) {
|
||||
ofTypeName = "Node";
|
||||
} else if (proc->subtype == g_fpcLf_type) {
|
||||
ofTypeName = "Leaf";
|
||||
}
|
||||
|
||||
ImGui::Text("OfType: %d (%s), layer: %d", proc->subtype, ofTypeName, proc->layer_tag.layer->layer_id);
|
||||
|
||||
if (proc->create_req != nullptr) {
|
||||
ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), "Pending create request");
|
||||
}
|
||||
|
||||
if (showTreeRecursive) {
|
||||
if (fpcBs_Is_JustOfType(g_fpcNd_type, proc->subtype)) {
|
||||
auto procNode = static_cast<process_node_class*>(p);
|
||||
|
||||
ImGui::Text("Owns layer %d", procNode->layer.layer_id);
|
||||
|
||||
fpcLyIt_OnlyHere(&procNode->layer, ShowProcess, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndChild();
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ShowCreateRequest(void* p, void*) {
|
||||
create_request* req = (create_request*)p;
|
||||
|
||||
if (req->process != nullptr) {
|
||||
ShowProcess(req->process, nullptr);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static bool Visible = false;
|
||||
|
||||
void DuskImguiProcesses() {
|
||||
if (ImGui::BeginMenu(MenuView)) {
|
||||
ImGui::MenuItem("Process management", "F2", &Visible);
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_F2)) {
|
||||
Visible = !Visible;
|
||||
}
|
||||
|
||||
if (!Visible) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ImGui::Begin("Processes")) {
|
||||
if (ImGui::BeginTabBar("Tabs")) {
|
||||
showTreeRecursive = true;
|
||||
if (ImGui::BeginTabItem("Tree")) {
|
||||
fpcLyIt_OnlyHere(fpcLy_RootLayer(), ShowProcess, nullptr);
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
showTreeRecursive = false;
|
||||
if (ImGui::BeginTabItem("All layers")) {
|
||||
fpcLyIt_All(ShowProcess, nullptr);
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabItem("Creation queue")) {
|
||||
fpcCtIt_Method(ShowCreateRequest, nullptr);
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
@@ -2,8 +2,41 @@
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
bool StubLogEnabled = true;
|
||||
|
||||
using namespace std::literals::string_view_literals;
|
||||
|
||||
// MSVC is broken and seemingly miscompiles std::string_view::npos without this.
|
||||
// I wish I was joking.
|
||||
constexpr size_t npos = std::string_view::npos;
|
||||
|
||||
static constexpr std::string_view StubFragments[] = {
|
||||
"is a stub"sv,
|
||||
"Unimplemented: BP register"sv,
|
||||
"Unhandled BP register"sv,
|
||||
"Unhandled XF register"sv,
|
||||
"but selective updates are not implemented"sv,
|
||||
};
|
||||
|
||||
static bool IsForStubLog(const char* message) {
|
||||
std::string_view msg_view(message);
|
||||
|
||||
for (auto& fragment : StubFragments) {
|
||||
if (msg_view.find(fragment) != ""sv.npos) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void aurora_log_callback(AuroraLogLevel level, const char* module, const char* message,
|
||||
unsigned int len) {
|
||||
if (StubLogEnabled && level != LOG_FATAL && IsForStubLog(message)) {
|
||||
dusk::SendToStubLog(level, module, message);
|
||||
return;
|
||||
}
|
||||
|
||||
const char* levelStr = "??";
|
||||
FILE* out = stdout;
|
||||
switch (level) {
|
||||
|
||||
@@ -262,171 +262,6 @@ void SoundRevID(int a, int b) {
|
||||
STUB_LOG();
|
||||
}
|
||||
|
||||
#pragma mark CARD
|
||||
|
||||
#include <dolphin/card.h>
|
||||
|
||||
extern "C" int CARDProbe(s32 chan) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDCancel(CARDFileInfo* fileInfo) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDCheck(s32 chan) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDCheckAsync(s32 chan, CARDCallback callback) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDClose(CARDFileInfo* fileInfo) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDCreate(s32 chan, const char* fileName, u32 size, CARDFileInfo* fileInfo) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDCreateAsync(s32 chan, const char* fileName, u32 size, CARDFileInfo* fileInfo,
|
||||
CARDCallback callback) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDDelete(s32 chan, const char* fileName) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDDeleteAsync(s32 chan, const char* fileName, CARDCallback callback) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDFastDeleteAsync(s32 chan, s32 fileNo, CARDCallback callback) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDFastOpen(s32 chan, s32 fileNo, CARDFileInfo* fileInfo) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDFormat(s32 chan) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDFreeBlocks(s32 chan, s32* byteNotUsed, s32* filesNotUsed) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDGetResultCode(s32 chan) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDGetStatus(s32 chan, s32 fileNo, CARDStat* stat) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDGetSectorSize(s32 chan, u32* size) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CARDInit() {
|
||||
STUB_LOG();
|
||||
}
|
||||
|
||||
s32 CARDMount(s32 chan, void* workArea, CARDCallback detachCallback) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDMountAsync(s32 chan, void* workArea, CARDCallback detachCallback,
|
||||
CARDCallback attachCallback) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDOpen(s32 chan, const char* fileName, CARDFileInfo* fileInfo) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDProbeEx(s32 chan, s32* memSize, s32* sectorSize) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDRead(CARDFileInfo* fileInfo, void* addr, s32 length, s32 offset) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDReadAsync(CARDFileInfo* fileInfo, void* addr, s32 length, s32 offset,
|
||||
CARDCallback callback) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDRename(s32 chan, const char* oldName, const char* newName) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDRenameAsync(s32 chan, const char* oldName, const char* newName, CARDCallback callback) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDSetStatusAsync(s32 chan, s32 fileNo, CARDStat* stat, CARDCallback callback) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDUnmount(s32 chan) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" s32 CARDWrite(CARDFileInfo* fileInfo, void* addr, s32 length, s32 offset) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDWriteAsync(CARDFileInfo* fileInfo, const void* addr, s32 length, s32 offset,
|
||||
CARDCallback callback) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDGetSerialNo(s32 chan, u64* serialNo) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDSetStatus(s32 chan, s32 fileNo, CARDStat* stat) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 __CARDFormatRegionAsync(int a, int b) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma mark DC
|
||||
|
||||
void DCFlushRange(void* addr, u32 nBytes) {
|
||||
@@ -1167,12 +1002,6 @@ void AIStopDMA(void) {
|
||||
#pragma mark GX
|
||||
#include <dolphin/gx.h>
|
||||
|
||||
// Moved-in GX helpers and helpers for metrics/project
|
||||
void __GXSetSUTexSize() {
|
||||
STUB_LOG();
|
||||
}
|
||||
// __GXSetVAT, __GXSetVCD, __GXUpdateBPMask: now provided by Aurora's GXManage.cpp (fifo branch)
|
||||
|
||||
void GXSetGPMetric(GXPerf0 perf0, GXPerf1 perf1) {
|
||||
STUB_LOG();
|
||||
}
|
||||
@@ -1218,12 +1047,6 @@ void GXDrawCylinder(u8 numEdges) {
|
||||
void GXWaitDrawDone(void) {
|
||||
STUB_LOG();
|
||||
}
|
||||
void GXSetTevIndTile(GXTevStageID tev_stage, GXIndTexStageID ind_stage, u16 tilesize_s,
|
||||
u16 tilesize_t, u16 tilespacing_s, u16 tilespacing_t, GXIndTexFormat format,
|
||||
GXIndTexMtxID matrix_sel, GXIndTexBiasSel bias_sel,
|
||||
GXIndTexAlphaSel alpha_sel) {
|
||||
// TODO
|
||||
}
|
||||
void GXResetWriteGatherPipe(void) {
|
||||
STUB_LOG();
|
||||
}
|
||||
@@ -1249,13 +1072,6 @@ u16 GXGetNumXfbLines(u16 efbHeight, f32 yScale) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GXGetScissor(u32* left, u32* top, u32* wd, u32* ht) {
|
||||
STUB_LOG();
|
||||
}
|
||||
u32 GXGetTexObjTlut(const GXTexObj* tex_obj) {
|
||||
STUB_LOG();
|
||||
return 0;
|
||||
}
|
||||
f32 GXGetYScaleFactor(u16 efbHeight, u16 xfbHeight) {
|
||||
STUB_LOG();
|
||||
return 0.0f;
|
||||
@@ -1292,13 +1108,6 @@ void GXSetMisc(GXMiscToken token, u32 val) {
|
||||
STUB_LOG();
|
||||
}
|
||||
|
||||
void GXSetProjectionv(const f32* ptr) {
|
||||
STUB_LOG();
|
||||
}
|
||||
void GXSetVtxAttrFmtv(GXVtxFmt vtxfmt, const GXVtxAttrFmtList* list) {
|
||||
STUB_LOG();
|
||||
}
|
||||
|
||||
#pragma mark KPAD
|
||||
// is this actually used?
|
||||
extern "C" void KPADDisableDPD(s32) {
|
||||
|
||||
@@ -1476,9 +1476,9 @@ fpc_ProcID fopAcM_createItemFromEnemyID(u8 i_enemyID, cXyz const* i_pos, int i_i
|
||||
f32* i_speedF, f32* i_speedY) {
|
||||
int itemNo;
|
||||
int tableNo = 0xFF;
|
||||
u32* data = (u32*)dEnemyItem_c::getItemData();
|
||||
uintptr_t* data = (uintptr_t*)dEnemyItem_c::getItemData();
|
||||
data++;
|
||||
int tableNum = (int) *data;
|
||||
BE(int) tableNum = (int) *data;
|
||||
data++;
|
||||
EnemyTable* table = (EnemyTable*)data;
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@ static s32 fopCam_Draw(camera_class* i_this) {
|
||||
|
||||
static int fopCam_Execute(camera_class* i_this) {
|
||||
int ret;
|
||||
#if AVOID_UB
|
||||
ret = 0;
|
||||
#endif
|
||||
#if DEBUG
|
||||
fapGm_HIO_c::startCpuTimer();
|
||||
#endif
|
||||
|
||||
@@ -18,6 +18,9 @@ BOOL fopKy_IsKankyo(void* i_this) {
|
||||
|
||||
static int fopKy_Draw(void* i_this) {
|
||||
int ret;
|
||||
#if AVOID_UB
|
||||
ret = 0;
|
||||
#endif
|
||||
|
||||
#if DEBUG
|
||||
fapGm_HIO_c::startCpuTimer();
|
||||
@@ -37,6 +40,9 @@ static int fopKy_Draw(void* i_this) {
|
||||
static int fopKy_Execute(void* i_this) {
|
||||
kankyo_class* a_this = (kankyo_class*)i_this;
|
||||
int ret;
|
||||
#if AVOID_UB
|
||||
ret = 0;
|
||||
#endif
|
||||
|
||||
#if DEBUG
|
||||
fapGm_HIO_c::startCpuTimer();
|
||||
|
||||
@@ -75,12 +75,17 @@ static OSThread MemCardThread;
|
||||
|
||||
void mDoMemCd_Ctrl_c::ThdInit() {
|
||||
#if !PLATFORM_SHIELD
|
||||
CARDInit();
|
||||
CARDInit(DUSK_GAME_NAME, DUSK_GAME_VERSION);
|
||||
#endif
|
||||
|
||||
mCopyToPos = 0;
|
||||
mProbeStat = 2;
|
||||
mCardState = CARD_STATE_NO_CARD_e;
|
||||
|
||||
#if TARGET_PC
|
||||
mCardState = CARD_STATE_READY_e;
|
||||
#endif
|
||||
|
||||
mCardCommand = COMM_NONE_e;
|
||||
mChannel = SLOT_A;
|
||||
|
||||
|
||||
@@ -1737,10 +1737,8 @@ void mDoExt_McaMorfSO::setAnm(J3DAnmTransform* i_anm, int i_attr, f32 i_morf, f3
|
||||
setLoopFrame(getFrame());
|
||||
setMorf(i_morf);
|
||||
|
||||
#if TARGET_PC
|
||||
STUB_LOG();
|
||||
return;
|
||||
#endif
|
||||
STUB_RET();
|
||||
|
||||
if (mpSound != NULL) {
|
||||
if (i_anm != NULL) {
|
||||
mpBas = static_cast<mDoExt_transAnmBas*>(i_anm)->getBas();
|
||||
|
||||
+80
-32
@@ -47,7 +47,7 @@
|
||||
#endif
|
||||
|
||||
#if TARGET_PC
|
||||
#include "dusk/imgui.h"
|
||||
#include "dusk/imgui/ImGuiConsole.hpp"
|
||||
#include "dusk/dusk.h"
|
||||
#endif
|
||||
|
||||
@@ -389,12 +389,12 @@ void mDoGph_gInf_c::onBlure() {
|
||||
}
|
||||
|
||||
#if PLATFORM_WII || PLATFORM_SHIELD
|
||||
GXTexObj mDoGph_gInf_c::m_fullFrameBufferTexObj;
|
||||
TGXTexObj mDoGph_gInf_c::m_fullFrameBufferTexObj;
|
||||
#endif
|
||||
|
||||
GXTexObj mDoGph_gInf_c::mFrameBufferTexObj;
|
||||
TGXTexObj mDoGph_gInf_c::mFrameBufferTexObj;
|
||||
|
||||
GXTexObj mDoGph_gInf_c::mZbufferTexObj;
|
||||
TGXTexObj mDoGph_gInf_c::mZbufferTexObj;
|
||||
|
||||
mDoGph_gInf_c::bloom_c mDoGph_gInf_c::m_bloom;
|
||||
|
||||
@@ -918,6 +918,10 @@ static void drawDepth2(view_class* param_0, view_port_class* param_1, int param_
|
||||
GXSetTexCopyDst(halfWidth, halfHeight,
|
||||
(GXTexFmt)mDoGph_gInf_c::getFrameBufferTimg()->format, GX_TRUE);
|
||||
GXCopyTex(frameBufferTex, GX_FALSE);
|
||||
#ifdef TARGET_PC
|
||||
mDoGph_gInf_c::getFrameBufferTexObj()->reset();
|
||||
mDoGph_gInf_c::getZbufferTexObj()->reset();
|
||||
#endif
|
||||
GXInitTexObj(mDoGph_gInf_c::getZbufferTexObj(), zBufferTex, halfWidth, halfHeight,
|
||||
GX_TF_IA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
GXInitTexObjLOD(mDoGph_gInf_c::getZbufferTexObj(), GX_NEAR, GX_NEAR, 0.0f, 0.0f, 0.0f,
|
||||
@@ -1131,14 +1135,18 @@ void mDoGph_gInf_c::bloom_c::remove() {
|
||||
}
|
||||
|
||||
void mDoGph_gInf_c::bloom_c::draw() {
|
||||
#if TARGET_PC // TODO: fix bloom
|
||||
bool enabled = false;
|
||||
#else
|
||||
bool enabled = mEnable && m_buffer != NULL;
|
||||
#endif
|
||||
if (mMonoColor.a != 0 || enabled) {
|
||||
GXSetViewport(0.0f, 0.0f, FB_WIDTH, FB_HEIGHT, 0.0f, 1.0f);
|
||||
GXSetScissor(0, 0, FB_WIDTH, FB_HEIGHT);
|
||||
#if TARGET_PC
|
||||
f32 width = mDoGph_gInf_c::getWidth();
|
||||
f32 height = mDoGph_gInf_c::getHeight();
|
||||
#else
|
||||
f32 width = FB_WIDTH;
|
||||
f32 height = FB_HEIGHT;
|
||||
#endif
|
||||
GXSetViewport(0.0f, 0.0f, width, height, 0.0f, 1.0f);
|
||||
GXSetScissor(0, 0, width, height);
|
||||
|
||||
GXLoadTexObj(getFrameBufferTexObj(), GX_TEXMAP0);
|
||||
GXSetNumChans(0);
|
||||
GXSetNumTexGens(1);
|
||||
@@ -1181,9 +1189,11 @@ void mDoGph_gInf_c::bloom_c::draw() {
|
||||
mDoGph_drawFilterQuad(4, 4);
|
||||
}
|
||||
if (enabled) {
|
||||
GXSetTexCopySrc(0, 0, FB_WIDTH / 2, FB_HEIGHT / 2);
|
||||
GXSetTexCopyDst(FB_WIDTH / 2, FB_HEIGHT / 2, GX_TF_RGBA8, 0);
|
||||
// Store off m_buffer to copy over again at the end.
|
||||
GXSetTexCopySrc(0, 0, width / 2, height / 2);
|
||||
GXSetTexCopyDst(width / 2, height / 2, GX_TF_RGBA8, 0);
|
||||
GXCopyTex(m_buffer, 0);
|
||||
|
||||
GXSetNumTevStages(3);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
|
||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_TEXC, GX_CC_TEXA, GX_CC_HALF, GX_CC_ZERO);
|
||||
@@ -1215,19 +1225,24 @@ void mDoGph_gInf_c::bloom_c::draw() {
|
||||
GXSetTevColor(GX_TEVREG1, tevColor1);
|
||||
GXPixModeSync();
|
||||
mDoGph_drawFilterQuad(2, 2);
|
||||
|
||||
GXSetTevSwapModeTable(GX_TEV_SWAP1, GX_CH_RED, GX_CH_RED, GX_CH_RED, GX_CH_ALPHA);
|
||||
GXSetTevSwapMode(GX_TEVSTAGE0, GX_TEV_SWAP0, GX_TEV_SWAP0);
|
||||
GXSetTevSwapMode(GX_TEVSTAGE1, GX_TEV_SWAP0, GX_TEV_SWAP0);
|
||||
|
||||
// Downsample and filter from 1/2 EFB into 1/4 zBufferTex (tmp_tex1).
|
||||
void* zBufferTex = getZbufferTex();
|
||||
GXSetTexCopySrc(0, 0, FB_WIDTH / 2, FB_HEIGHT / 2);
|
||||
GXSetTexCopyDst(FB_WIDTH / 4, FB_HEIGHT / 4, GX_TF_RGBA8, GX_TRUE);
|
||||
GXSetTexCopySrc(0, 0, width / 2, height / 2);
|
||||
GXSetTexCopyDst(width / 4, height / 4, GX_TF_RGBA8, GX_TRUE);
|
||||
GXCopyTex(zBufferTex, 0);
|
||||
GXTexObj auStack_c0;
|
||||
GXInitTexObj(&auStack_c0, zBufferTex, FB_WIDTH / 4, FB_HEIGHT / 4, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP,
|
||||
|
||||
TGXTexObj tmp_tex1;
|
||||
GXInitTexObj(&tmp_tex1, zBufferTex, width / 4, height / 4, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP,
|
||||
GX_FALSE);
|
||||
GXInitTexObjLOD(&auStack_c0, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE,
|
||||
GXInitTexObjLOD(&tmp_tex1, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE,
|
||||
GX_ANISO_1);
|
||||
GXLoadTexObj(&auStack_c0, GX_TEXMAP0);
|
||||
GXLoadTexObj(&tmp_tex1, GX_TEXMAP0);
|
||||
|
||||
GXSetNumTexGens(8);
|
||||
u32 iVar11 = 0x1e;
|
||||
int sVar10 = 0;
|
||||
@@ -1263,28 +1278,50 @@ void mDoGph_gInf_c::bloom_c::draw() {
|
||||
GX_TRUE, GX_TEVPREV);
|
||||
}
|
||||
GXPixModeSync();
|
||||
|
||||
// Blur filter from tmp_tex1 1/4 to EFB 1/4.
|
||||
mDoGph_drawFilterQuad(1, 1);
|
||||
GXSetTexCopySrc(0, 0, FB_WIDTH / 4, FB_HEIGHT / 4);
|
||||
GXSetTexCopyDst(FB_WIDTH / 8, FB_HEIGHT / 8, GX_TF_RGBA8, GX_TRUE);
|
||||
|
||||
GXSetTexCopySrc(0, 0, width / 4, height / 4);
|
||||
GXSetTexCopyDst(width / 8, height / 8, GX_TF_RGBA8, GX_TRUE);
|
||||
|
||||
// Downsample EFB 1/4 to zBufferTex 1/8 (tmp_tex2).
|
||||
GXCopyTex(zBufferTex, GX_FALSE);
|
||||
GXTexObj auStack_e0;
|
||||
GXInitTexObj(&auStack_e0, zBufferTex, FB_WIDTH / 8, FB_HEIGHT / 8, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP,
|
||||
|
||||
TGXTexObj tmp_tex2;
|
||||
GXInitTexObj(&tmp_tex2, zBufferTex, width / 8, height / 8, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP,
|
||||
GX_FALSE);
|
||||
GXInitTexObjLOD(&auStack_c0, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE,
|
||||
#if TARGET_PC
|
||||
// typo bug fix
|
||||
GXInitTexObjLOD(&tmp_tex2, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE,
|
||||
GX_ANISO_1);
|
||||
GXLoadTexObj(&auStack_e0, GX_TEXMAP0);
|
||||
#else
|
||||
GXInitTexObjLOD(&tmp_tex1, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE,
|
||||
GX_ANISO_1);
|
||||
#endif
|
||||
GXLoadTexObj(&tmp_tex2, GX_TEXMAP0);
|
||||
|
||||
// Upsample 1/8 buffer back up to 1/4 buffer.
|
||||
GXSetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_OR);
|
||||
GXPixModeSync();
|
||||
GXInvalidateTexAll();
|
||||
mDoGph_drawFilterQuad(1, 1);
|
||||
GXSetTexCopySrc(0, 0, FB_WIDTH / 4, FB_HEIGHT / 4);
|
||||
GXSetTexCopyDst(FB_WIDTH / 4, FB_HEIGHT / 4, GX_TF_RGBA8, GX_FALSE);
|
||||
|
||||
#if TARGET_PC
|
||||
tmp_tex2.reset();
|
||||
#endif
|
||||
|
||||
// Now that we've upsampled and filtered our final bloom, copy 1/4 buffer back to zBufferTex.
|
||||
GXSetTexCopySrc(0, 0, width / 4, height / 4);
|
||||
GXSetTexCopyDst(width / 4, height / 4, GX_TF_RGBA8, GX_FALSE);
|
||||
GXCopyTex(zBufferTex, GX_FALSE);
|
||||
GXInitTexObj(&auStack_e0, m_buffer, FB_WIDTH / 2, FB_HEIGHT / 2, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP,
|
||||
|
||||
// Copy back m_buffer to screen.
|
||||
GXInitTexObj(&tmp_tex2, m_buffer, width / 2, height / 2, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP,
|
||||
GX_FALSE);
|
||||
GXInitTexObjLOD(&auStack_e0, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE,
|
||||
GXInitTexObjLOD(&tmp_tex2, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE,
|
||||
GX_ANISO_1);
|
||||
GXLoadTexObj(&auStack_e0, GX_TEXMAP0);
|
||||
GXLoadTexObj(&tmp_tex2, GX_TEXMAP0);
|
||||
GXSetNumTexGens(1);
|
||||
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, 0x3c);
|
||||
GXSetNumTevStages(1);
|
||||
@@ -1297,7 +1334,9 @@ void mDoGph_gInf_c::bloom_c::draw() {
|
||||
GX_TEVPREV);
|
||||
GXSetBlendMode(GX_BM_NONE, GX_BL_ONE, GX_BL_ONE, GX_LO_OR);
|
||||
mDoGph_drawFilterQuad(2, 2);
|
||||
GXLoadTexObj(&auStack_c0, GX_TEXMAP0);
|
||||
|
||||
// Now blend our bloom into the real FB.
|
||||
GXLoadTexObj(&tmp_tex1, GX_TEXMAP0);
|
||||
GXSetTevColor(GX_TEVREG0, mBlendColor);
|
||||
GXSetNumTevStages(1);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
|
||||
@@ -1618,8 +1657,13 @@ int mDoGph_Painter() {
|
||||
view_port_class new_port;
|
||||
new_port.x_orig = 0.0f;
|
||||
new_port.y_orig = 0.0f;
|
||||
#if TARGET_PC
|
||||
new_port.width = mDoGph_gInf_c::getWidth();
|
||||
new_port.height = mDoGph_gInf_c::getHeight();
|
||||
#else
|
||||
new_port.width = FB_WIDTH;
|
||||
new_port.height = FB_HEIGHT;
|
||||
#endif
|
||||
new_port.near_z = view_port->near_z;
|
||||
new_port.far_z = view_port->far_z;
|
||||
new_port.scissor = view_port->scissor;
|
||||
@@ -1913,8 +1957,12 @@ int mDoGph_Painter() {
|
||||
retry_captue_frame(&camera_p->view, view_port,
|
||||
dComIfGp_getCameraZoomForcus(camera_id));
|
||||
}
|
||||
|
||||
|
||||
#if TARGET_PC
|
||||
GXSetViewport(0.0f, 0.0f, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight(), 0.0f, 1.0f);
|
||||
#else
|
||||
GXSetViewport(0.0f, 0.0f, FB_WIDTH, FB_HEIGHT, 0.0f, 1.0f);
|
||||
#endif
|
||||
|
||||
Mtx m2;
|
||||
Mtx44 m;
|
||||
@@ -2147,7 +2195,7 @@ int mDoGph_Painter() {
|
||||
#endif
|
||||
|
||||
#if TARGET_PC
|
||||
imgui_main(&auroraInfo);
|
||||
dusk::g_imguiConsole.draw();
|
||||
#endif
|
||||
|
||||
mDoGph_gInf_c::endRender();
|
||||
|
||||
@@ -10,8 +10,11 @@
|
||||
#include "d/d_com_inf_game.h"
|
||||
#include <types.h>
|
||||
|
||||
u32 mDoLib_setResTimgObj(ResTIMG const* i_img, GXTexObj* o_texObj, u32 tlut_name,
|
||||
u32 mDoLib_setResTimgObj(ResTIMG const* i_img, TGXTexObj* o_texObj, u32 tlut_name,
|
||||
GXTlutObj* o_tlutObj) {
|
||||
#ifdef TARGET_PC
|
||||
o_texObj->reset();
|
||||
#endif
|
||||
if (i_img->indexTexture) {
|
||||
JUT_ASSERT(44, o_tlutObj != NULL);
|
||||
GXInitTlutObj(o_tlutObj, (void*)((u8*)i_img + i_img->paletteOffset),
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "SSystem/SComponent/c_API.h"
|
||||
#include "dusk/dusk.h"
|
||||
#include "dusk/logging.h"
|
||||
#include "dusk/time.h"
|
||||
|
||||
#include <aurora/aurora.h>
|
||||
#include <aurora/event.h>
|
||||
@@ -102,6 +103,10 @@ s32 LOAD_COPYDATE(void*) {
|
||||
AuroraInfo auroraInfo;
|
||||
|
||||
void main01(void) {
|
||||
#if TARGET_PC
|
||||
Limiter frameLimiter{};
|
||||
#endif
|
||||
|
||||
OS_REPORT("\x1b[m");
|
||||
GXSetColorUpdate(GX_ENABLE);
|
||||
// 1. Setup
|
||||
@@ -162,8 +167,6 @@ void main01(void) {
|
||||
static u32 frame = 0;
|
||||
frame++;
|
||||
|
||||
|
||||
|
||||
// Game Inputs
|
||||
mDoCPd_c::read();
|
||||
|
||||
@@ -175,12 +178,12 @@ void main01(void) {
|
||||
|
||||
mDoAud_Execute();
|
||||
|
||||
#if TARGET_PC
|
||||
frameLimiter.Sleep(DUSK_FRAME_PERIOD);
|
||||
#endif
|
||||
|
||||
//aurora_end_frame();
|
||||
|
||||
// Limiter
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(16));
|
||||
|
||||
} while (true);
|
||||
|
||||
exit:;
|
||||
|
||||
Reference in New Issue
Block a user