This commit is contained in:
TakaRikka
2026-01-05 13:46:27 -08:00
4117 changed files with 39584 additions and 27156 deletions
+1 -1
View File
@@ -8,7 +8,7 @@
#include "JSystem/JUtility/JUTTexture.h"
#include "d/d_com_inf_game.h"
#include "d/d_save.h"
#include <stdio.h>
#include <stdio>
#if VERSION == VERSION_GCN_JPN
#define HEADER_TITLE "ゼルダの伝説 トワイライトプリンセス"
+115 -14
View File
@@ -4,14 +4,20 @@
*/
#include "m_Do/m_Do_audio.h"
#include "JSystem/JKernel/JKRExpHeap.h"
#include "JSystem/JKernel/JKRMemArchive.h"
#include "JSystem/JKernel/JKRSolidHeap.h"
#include "JSystem/JUtility/JUTConsole.h"
#include "Z2AudioLib/Z2AudioCS.h"
#include "d/d_com_inf_game.h"
#include "d/d_debug_viewer.h"
#include "m_Do/m_Do_Reset.h"
#include "m_Do/m_Do_dvd_thread.h"
/* 80450BB8 0001+00 data_80450BB8 None */
/* 80450BB9 0001+00 data_80450BB9 None */
/* 80450BBA 0002+00 data_80450BBA None */
#if PLATFORM_WII || PLATFORM_SHIELD
#include <revolution/sc.h>
#endif
bool mDoAud_zelAudio_c::mInitFlag;
bool mDoAud_zelAudio_c::mResetFlag;
@@ -30,32 +36,88 @@ static mDoDvdThd_toMainRam_c* l_affCommand;
static mDoDvdThd_mountXArchive_c* l_arcCommand;
static mDoDvdThd_mountArchive_c* l_CSarcCommand;
#if DEBUG
static void dummy() {
OSReport("mDoAud_Create():Initial of Audio system \n");
}
#endif
static void mDoAud_Create() {
if (l_affCommand == NULL) {
#if DEBUG
if (!mDoRst::getLogoScnFlag()) {
return;
}
#endif
l_affCommand = mDoDvdThd_toMainRam_c::create("/Audiores/Z2Sound.baa", 2, NULL);
if (l_affCommand == NULL) {
return;
}
#if DEBUG
JUTReportConsole("mDoAud_Create loading Z2Sound.baa \n");
#endif
}
if (l_arcCommand == NULL) {
#if DEBUG
if (!mDoRst::getLogoScnFlag()) {
return;
}
#endif
l_arcCommand = mDoDvdThd_mountXArchive_c::create("/Audiores/Seqs/Z2SoundSeqs.arc", 0,
JKRArchive::MOUNT_DVD, NULL);
if (l_arcCommand == NULL) {
return;
}
#if DEBUG
JUTReportConsole_f("mDoAud_Create loading Z2SoundSeqs.arc\n");
#endif
}
#if PLATFORM_WII || PLATFORM_SHIELD
if (l_CSarcCommand == NULL) {
#if DEBUG
if (!mDoRst::getLogoScnFlag()) {
return;
}
#endif
if (l_affCommand->sync() && l_arcCommand->sync()) {
l_CSarcCommand = mDoDvdThd_mountArchive_c::create("/Audiores/Z2CSRes.arc", 0, JKRHeap::getRootHeap2());
if (l_CSarcCommand == NULL) {
return;
}
#if DEBUG
JUTReportConsole_f("mDoAud_Create loading Z2CSRes.arc\n");
#endif
}
#endif
if (
l_affCommand->sync()
#if PLATFORM_WII || PLATFORM_SHIELD
&& l_CSarcCommand->sync()
#endif
&& l_arcCommand->sync()
) {
#if DEBUG
JUTReportConsole("mDoAud_Create sync ok.\n");
#endif
if (g_mDoAud_audioHeap != NULL) {
s32 groupID = JKRHeap::sCurrentHeap->changeGroupID(5);
g_mDoAud_zelAudio
.init(g_mDoAud_audioHeap, 0xA00000, l_affCommand->getMemAddress(),
l_arcCommand->getArchive());
JKRHeap::sCurrentHeap->changeGroupID(groupID);
g_mDoAud_audioHeap->adjustSize();
s32 groupID = JKRGetCurrentHeap()->changeGroupID(5);
#if PLATFORM_GCN
const int audioMemSize = 0xA00000;
#else
const int audioMemSize = 0xB00000;
#endif
g_mDoAud_zelAudio.init(g_mDoAud_audioHeap, audioMemSize, l_affCommand->getMemAddress(), l_arcCommand->getArchive());
#if PLATFORM_WII || PLATFORM_SHIELD
Z2AudioCS::init(mDoExt_getGameHeap(), l_CSarcCommand->getArchive(), 15, 1);
#endif
JKRGetCurrentHeap()->changeGroupID(groupID);
s32 r28 = g_mDoAud_audioHeap->adjustSize();
} else {
// "Cannot initialize audio due to heap allocation failure\n"
OSReport_Error("ヒープ確保失敗につきオーディオ初期化できません\n");
@@ -63,16 +125,31 @@ static void mDoAud_Create() {
(g_mDoAud_zelAudio)
.setEventBit(dComIfGs_getPEventBit());
#if DEBUG
JUTReportConsole("mDoAud_Create g_mDoAud_zelAudio.reset before \n");
#endif
(g_mDoAud_zelAudio).reset();
#if DEBUG
JUTReportConsole("mDoAud_Create g_mDoAud_zelAudio.reset after\n");
#endif
u32 soundMode = OSGetSoundMode();
Z2AudioMgr::getInterface()->setOutputMode(soundMode);
JKRHeap::free(l_affCommand->getMemAddress(), NULL);
#if PLATFORM_GCN
mDoAud_setOutputMode(OSGetSoundMode());
#else
mDoAud_setOutputMode(SCGetSoundMode());
#endif
JKRFree(l_affCommand->getMemAddress());
l_affCommand->destroy();
l_arcCommand->destroy();
#if PLATFORM_WII || PLATFORM_SHIELD
l_CSarcCommand->destroy();
mDoAud_loadStaticWaves();
#endif
mDoAud_zelAudio_c::onInitFlag();
mDoDvdThd::SyncWidthSound = true;
#if DEBUG
JUTReportConsole("mDoAud_Create done!\n");
#endif
}
}
@@ -82,7 +159,31 @@ void mDoAud_Execute() {
mDoAud_Create();
}
} else {
#if DEBUG
static const char* l_outputModeName[3] = {"MONO", "STEREO", "DOLBY"};
static const u32 l_outputMode[3] = {0, 1, 2};
if (mDoCPd_c::getHoldL(0)) {
if (mDoCPd_c::getTrigLeft(0)) {
if (g_mDoAud_zelAudio.getMode() == 0) {
g_mDoAud_zelAudio.setMode(2);
} else {
g_mDoAud_zelAudio.setMode(g_mDoAud_zelAudio.getMode() - 1);
}
} else if (mDoCPd_c::getTrigRight(0)) {
if (g_mDoAud_zelAudio.getMode() >= 2) {
g_mDoAud_zelAudio.setMode(0);
} else {
g_mDoAud_zelAudio.setMode(g_mDoAud_zelAudio.getMode() + 1);
}
}
g_mDoAud_zelAudio.setOutputMode(l_outputMode[g_mDoAud_zelAudio.getMode()]);
}
dDbVw_Report(20, 30, "%s", l_outputModeName[g_mDoAud_zelAudio.getMode()]);
#endif
g_mDoAud_zelAudio.gframeProcess();
#if DEBUG
Z2AudioCS::update();
#endif
}
}
+34 -17
View File
@@ -4,7 +4,9 @@
*/
#include "m_Do/m_Do_controller_pad.h"
#include "JSystem/JAWExtSystem/JAWExtSystem.h"
#include "SSystem/SComponent/c_lib.h"
#include "d/d_com_inf_game.h"
#include "f_ap/f_ap_game.h"
#include "m_Do/m_Do_Reset.h"
#include "m_Do/m_Do_main.h"
@@ -12,14 +14,14 @@
JUTGamePad* mDoCPd_c::m_gamePad[4];
interface_of_controller_pad mDoCPd_c::m_cpadInfo[4];
interface_of_controller_pad mDoCPd_c::m_debugCpadInfo[4];
void mDoCPd_c::create() {
#if PLATFORM_GCN || PLATFORM_SHIELD
JUTGamePad* pad = new JUTGamePad(JUTGamePad::EPort1);
m_gamePad[0] = pad;
m_gamePad[0] = new JUTGamePad(JUTGamePad::EPort1);
#endif
if (mDoMain::developmentMode != 0) {
if (DEBUG || mDoMain::developmentMode != 0) {
#if PLATFORM_WII
m_gamePad[0] = new JUTGamePad(JUTGamePad::EPort1);
#endif
@@ -47,10 +49,8 @@ void mDoCPd_c::create() {
interface_of_controller_pad* cpad = &m_cpadInfo[0];
for (int i = 0; i < 4; i++) {
cpad->mTrigLockL = false;
cpad->mHoldLockL = false;
cpad->mTrigLockR = false;
cpad->mHoldLockR = false;
cpad->mHoldLockL = cpad->mTrigLockL = false;
cpad->mHoldLockR = cpad->mTrigLockR = false;
cpad++;
}
}
@@ -59,15 +59,27 @@ void mDoCPd_c::read() {
JUTGamePad::read();
if (!mDoRst::isReset() && mDoRst::is3ButtonReset()) {
JUTGamePad* pad = JUTGamePad::getGamePad(mDoRst::get3ButtonResetPort());
if (!pad->isPushing3ButtonReset()) {
if (!JUTGamePad::getGamePad(mDoRst::get3ButtonResetPort())->isPushing3ButtonReset()) {
mDoRst::off3ButtonReset();
}
}
#if DEBUG
if (m_gamePad[3]) {
JAWExtSystem::padProc(*m_gamePad[3]);
}
#endif
JUTGamePad** pad = m_gamePad;
interface_of_controller_pad* interface = m_cpadInfo;
#if DEBUG
interface_of_controller_pad* interface2 = m_debugCpadInfo;
if (dComIfG_isDebugMode()) {
interface_of_controller_pad* tmp = interface;
interface = interface2;
interface2 = tmp;
}
#endif
for (u32 i = 0; i < 4; i++) {
if (*pad == NULL) {
@@ -76,9 +88,14 @@ void mDoCPd_c::read() {
convert(interface, *pad);
LRlockCheck(interface);
}
#if DEBUG
cLib_memSet(interface2, 0, sizeof(interface_of_controller_pad));
#endif
pad++;
interface++;
#if DEBUG
interface2++;
#endif
}
}
@@ -103,26 +120,26 @@ void mDoCPd_c::convert(interface_of_controller_pad* pInterface, JUTGamePad* pPad
}
void mDoCPd_c::LRlockCheck(interface_of_controller_pad* interface) {
f32 trig_left = interface->mTriggerLeft;
f32 trigger = interface->mTriggerLeft;
interface->mTrigLockL = false;
interface->mTrigLockR = false;
if (trig_left > fapGmHIO_getLROnValue()) {
if (trigger > fapGmHIO_getLROnValue()) {
if (interface->mHoldLockL != true) {
interface->mTrigLockL = true;
}
interface->mHoldLockL = true;
} else if (trig_left < fapGmHIO_getLROffValue()) {
} else if (trigger < fapGmHIO_getLROffValue()) {
interface->mHoldLockL = false;
}
f32 trig_right = interface->mTriggerRight;
if (trig_right > fapGmHIO_getLROnValue()) {
trigger = interface->mTriggerRight;
if (trigger > fapGmHIO_getLROnValue()) {
if (interface->mHoldLockR != true) {
interface->mTrigLockR = true;
}
interface->mHoldLockR = true;
} else if (trig_right < fapGmHIO_getLROffValue()) {
} else if (trigger < fapGmHIO_getLROffValue()) {
interface->mHoldLockR = false;
}
}
+570 -229
View File
File diff suppressed because it is too large Load Diff
+215 -81
View File
@@ -7,6 +7,7 @@
#include "JSystem/J2DGraph/J2DOrthoGraph.h"
#include "JSystem/J2DGraph/J2DPrint.h"
#include "JSystem/JAWExtSystem/JAWExtSystem.h"
#include "JSystem/JFramework/JFWSystem.h"
#include "JSystem/JParticle/JPADrawInfo.h"
#include "JSystem/JUtility/JUTConsole.h"
@@ -17,6 +18,8 @@
#include "d/actor/d_a_player.h"
#include "d/d_com_inf_game.h"
#include "d/d_menu_collect.h"
#include "d/d_jcam_editor.h"
#include "d/d_jpreviewer.h"
#include <dolphin/base/PPCArch.h>
#include "f_ap/f_ap_game.h"
#include "f_op/f_op_camera_mng.h"
@@ -266,10 +269,6 @@ GXColor mDoGph_gInf_c::mBackColor = {0, 0, 0, 0};
GXColor mDoGph_gInf_c::mFadeColor = {0, 0, 0, 0};
/* 80450BE4 0001+00 data_80450BE4 None */
/* 80450BE5 0001+00 data_80450BE5 None */
/* 80450BE6 0001+00 mFade__13mDoGph_gInf_c None */
/* 80450BE7 0001+00 data_80450BE7 None */
u8 mDoGph_gInf_c::mBlureFlag;
u8 mDoGph_gInf_c::mBlureRate;
@@ -388,6 +387,12 @@ mDoGph_gInf_c::bloom_c mDoGph_gInf_c::m_bloom;
Mtx mDoGph_gInf_c::mBlureMtx;
#if DEBUG
cXyz mDoGph_gInf_c::csr_c::m_nowEffPos(0.0f, 0.0f, 0.0f);
cXyz mDoGph_gInf_c::csr_c::m_oldEffPos(0.0f, 0.0f, 0.0f);
cXyz mDoGph_gInf_c::csr_c::m_oldOldEffPos(0.0f, 0.0f, 0.0f);
#endif
void mDoGph_gInf_c::onBlure(const Mtx m) {
mBlureFlag = true;
setBlureMtx(m);
@@ -577,81 +582,85 @@ u8 mDoGph_gInf_c::isWide() {
}
void mDoGph_gInf_c::setWideZoomProjection(Mtx44& m) {
if (isWideZoom()) {
f32 sp20 = m[0][0];
f32 sp1C = m[0][2];
f32 sp18 = m[1][1];
f32 sp14 = m[1][2];
f32 sp10 = m[2][2];
f32 spC = m[2][3];
f32 temp_f31 = spC / (sp10 - 1.0f);
f32 sp8 = spC / sp10;
f32 temp_f30 = ((temp_f31 * (1.0f + sp14)) / sp18);
f32 temp_f29 = ((temp_f31 * (sp14 - 1.0f)) / sp18);
f32 temp_f28 = ((temp_f31 * (sp1C - 1.0f)) / sp20);
f32 temp_f27 = ((temp_f31 * (1.0f + sp1C)) / sp20);
temp_f30 *= getInvScale();
temp_f29 *= getInvScale();
temp_f28 *= getInvScale();
temp_f27 *= getInvScale();
m[0][0] = (2.0f * temp_f31) / (temp_f27 - temp_f28);
m[0][1] = 0.0f;
m[0][2] = (temp_f27 + temp_f28) / (temp_f27 - temp_f28);
m[0][3] = 0.0f;
m[1][0] = 0.0f;
m[1][1] = (2.0f * temp_f31) / (temp_f30 - temp_f29);
m[1][2] = (temp_f30 + temp_f29) / (temp_f30 - temp_f29);
m[1][3] = 0.0f;
m[2][0] = 0.0f;
m[2][1] = 0.0f;
m[2][2] = -temp_f31 / (sp8 - temp_f31);
m[2][3] = -(sp8 * temp_f31) / (sp8 - temp_f31);
m[3][0] = 0.0f;
m[3][1] = 0.0f;
m[3][2] = -1.0f;
m[3][3] = 0.0f;
if (!isWideZoom()) {
return;
}
f32 sp20 = m[0][0];
f32 sp1C = m[0][2];
f32 sp18 = m[1][1];
f32 sp14 = m[1][2];
f32 sp10 = m[2][2];
f32 spC = m[2][3];
f32 temp_f31 = spC / (sp10 - 1.0f);
f32 sp8 = spC / sp10;
f32 temp_f30 = ((temp_f31 * (1.0f + sp14)) / sp18);
f32 temp_f29 = ((temp_f31 * (sp14 - 1.0f)) / sp18);
f32 temp_f28 = ((temp_f31 * (sp1C - 1.0f)) / sp20);
f32 temp_f27 = ((temp_f31 * (1.0f + sp1C)) / sp20);
temp_f30 *= getInvScale();
temp_f29 *= getInvScale();
temp_f28 *= getInvScale();
temp_f27 *= getInvScale();
m[0][0] = (2.0f * temp_f31) / (temp_f27 - temp_f28);
m[0][1] = 0.0f;
m[0][2] = (temp_f27 + temp_f28) / (temp_f27 - temp_f28);
m[0][3] = 0.0f;
m[1][0] = 0.0f;
m[1][1] = (2.0f * temp_f31) / (temp_f30 - temp_f29);
m[1][2] = (temp_f30 + temp_f29) / (temp_f30 - temp_f29);
m[1][3] = 0.0f;
m[2][0] = 0.0f;
m[2][1] = 0.0f;
m[2][2] = -temp_f31 / (sp8 - temp_f31);
m[2][3] = -(sp8 * temp_f31) / (sp8 - temp_f31);
m[3][0] = 0.0f;
m[3][1] = 0.0f;
m[3][2] = -1.0f;
m[3][3] = 0.0f;
}
void mDoGph_gInf_c::setWideZoomLightProjection(Mtx& m) {
if (isWideZoom()) {
f32 temp_f27 = m[0][0];
f32 temp_f26 = m[0][2];
f32 temp_f25 = m[1][1];
f32 temp_f24 = m[1][2];
f32 temp_f31 = (1.0f + temp_f24) / temp_f25;
f32 temp_f30 = (temp_f24 - 1.0f) / temp_f25;
f32 temp_f29 = (temp_f26 - 1.0f) / temp_f27;
f32 temp_f28 = (1.0f + temp_f26) / temp_f27;
temp_f31 *= getInvScale();
temp_f30 *= getInvScale();
temp_f29 *= getInvScale();
temp_f28 *= getInvScale();
m[0][0] = 2.0f / (temp_f28 - temp_f29);
m[0][1] = 0.0f;
m[0][2] = (temp_f28 + temp_f29) / (temp_f28 - temp_f29);
m[0][3] = 0.0f;
m[1][0] = 0.0f;
m[1][1] = 2.0f / (temp_f31 - temp_f30);
m[1][2] = (temp_f31 + temp_f30) / (temp_f31 - temp_f30);
m[1][3] = 0.0f;
m[2][0] = 0.0f;
m[2][1] = 0.0f;
m[2][2] = -1.0f;
m[2][3] = 0.0f;
if (!isWideZoom()) {
return;
}
f32 temp_f27 = m[0][0];
f32 temp_f26 = m[0][2];
f32 temp_f25 = m[1][1];
f32 temp_f24 = m[1][2];
f32 temp_f31 = (1.0f + temp_f24) / temp_f25;
f32 temp_f30 = (temp_f24 - 1.0f) / temp_f25;
f32 temp_f29 = (temp_f26 - 1.0f) / temp_f27;
f32 temp_f28 = (1.0f + temp_f26) / temp_f27;
temp_f31 *= getInvScale();
temp_f30 *= getInvScale();
temp_f29 *= getInvScale();
temp_f28 *= getInvScale();
m[0][0] = 2.0f / (temp_f28 - temp_f29);
m[0][1] = 0.0f;
m[0][2] = (temp_f28 + temp_f29) / (temp_f28 - temp_f29);
m[0][3] = 0.0f;
m[1][0] = 0.0f;
m[1][1] = 2.0f / (temp_f31 - temp_f30);
m[1][2] = (temp_f31 + temp_f30) / (temp_f31 - temp_f30);
m[1][3] = 0.0f;
m[2][0] = 0.0f;
m[2][1] = 0.0f;
m[2][2] = -1.0f;
m[2][3] = 0.0f;
}
#endif
@@ -1006,7 +1015,7 @@ static void drawDepth2(view_class* param_0, view_port_class* param_1, int param_
}
static void trimming(view_class* param_0, view_port_class* param_1) {
(void)param_0;
UNUSED(param_0);
s16 y_orig = (int)param_1->y_orig & ~7;
s16 y_orig_pos = y_orig < 0 ? 0 : y_orig;
@@ -1275,8 +1284,8 @@ void mDoGph_gInf_c::bloom_c::draw() {
}
static void retry_captue_frame(view_class* param_0, view_port_class* param_1, int param_2) {
(void)param_0;
(void)param_2;
UNUSED(param_0);
UNUSED(param_2);
s16 x_orig = (int)param_1->x_orig & 0xFFFFFFF8;
s16 y_orig = (int)param_1->y_orig & 0xFFFFFFF8;
@@ -1364,8 +1373,54 @@ static void setLight() {
GXLoadLightObjImm(&obj, GX_LIGHT0);
}
#if DEBUG
static void captureScreenSetProjection(Mtx44& m) {
// DEBUG NONMATCHING
if (fapGm_HIO_c::isCaptureScreen()) {
f32 local_88[7];
GXGetProjectionv(local_88);
if (int(local_88[0]) == 0) {
m[0][0] = local_88[1];
m[0][1] = 0.0f;
m[0][2] = local_88[2];
m[0][3] = 0.0f;
m[1][0] = 0.0f;
m[1][1] = local_88[3];
m[1][2] = local_88[4];
m[1][3] = 0.0f;
m[2][0] = 0.0f;
m[2][1] = 0.0f;
m[2][2] = local_88[5];
m[2][3] = local_88[6];
m[3][0] = 0.0f;
m[3][1] = 0.0f;
m[3][2] = -1.0f;
m[3][3] = 0.0f;
CPerspDivider divider(m, fapGm_HIO_c::getCaptureScreenDivH(), fapGm_HIO_c::getCaptureScreenDivV());
divider.divide(m, fapGm_HIO_c::getCaptureScreenNumH(), fapGm_HIO_c::getCaptureScreenNumV());
GXSetProjection(m, GX_PERSPECTIVE);
} else {
m[0][0] = local_88[1];
m[0][1] = 0.0f;
m[0][2] = 0.0f;
m[0][3] = local_88[2];
m[1][0] = 0.0f;
m[1][1] = local_88[3];
m[1][2] = 0.0f;
m[1][3] = local_88[4];
m[2][0] = 0.0f;
m[2][1] = 0.0f;
m[2][2] = local_88[5];
m[2][3] = local_88[6];
m[3][0] = 0.0f;
m[3][1] = 0.0f;
m[3][2] = 0.0f;
m[3][3] = 1.0f;
COrthoDivider divider(m, fapGm_HIO_c::getCaptureScreenDivH(), fapGm_HIO_c::getCaptureScreenDivV());
divider.divide(m, fapGm_HIO_c::getCaptureScreenNumH(), fapGm_HIO_c::getCaptureScreenNumV());
GXSetProjection(m, GX_ORTHOGRAPHIC);
}
}
}
static void captureScreenSetPort() {
@@ -1374,12 +1429,70 @@ static void captureScreenSetPort() {
}
static void captureScreenSetScissor(scissor_class* scissor) {
// DEBUG NONMATCHING
if (fapGm_HIO_c::isCaptureScreen()) {
scissor->x_orig *= fapGm_HIO_c::getCaptureScreenDivH();
scissor->y_orig *= fapGm_HIO_c::getCaptureScreenDivV();
scissor->width *= fapGm_HIO_c::getCaptureScreenDivH();
scissor->height *= fapGm_HIO_c::getCaptureScreenDivV();
f32 f29 = fapGm_HIO_c::getCaptureScreenNumH() * 640;
f32 f27 = (fapGm_HIO_c::getCaptureScreenNumH() + 1) * 640;
f32 f28 = fapGm_HIO_c::getCaptureScreenNumV() * 456;
f32 f26 = (fapGm_HIO_c::getCaptureScreenNumV() + 1) * 456;
f32 f31 = scissor->x_orig + scissor->width;
if (f31 < f29) {
f31 = 0.0f;
} else if (f31 > f27) {
f31 = 640.0f;
} else {
f31 -= f29;
}
if (scissor->x_orig < f29) {
scissor->x_orig = 0.0f;
} else if (scissor->x_orig > f27) {
scissor->x_orig = 640.0f;
} else {
scissor->x_orig -= f29;
}
scissor->width = f31 - scissor->x_orig;
f32 f30 = scissor->y_orig + scissor->height;
if (f30 < f28) {
f30 = 0.0f;
} else if (f30 > f26) {
f30 = 456.0f;
} else {
f30 -= f28;
}
if (scissor->y_orig < f28) {
scissor->y_orig = 0.0f;
} else if (scissor->y_orig > f26) {
scissor->y_orig = 456.0f;
} else {
scissor->y_orig -= f28;
}
scissor->height = f30 - scissor->y_orig;
}
}
static void captureScreenPerspDrawInfo(JPADrawInfo&) {
// DEBUG NONMATCHING
static void captureScreenPerspDrawInfo(JPADrawInfo& info) {
if (fapGm_HIO_c::isCaptureScreen()) {
Mtx44 m;
info.getPrjMtx(m);
m[0][0] *= 2.0f;
m[0][2] = 0.0f;
m[1][1] *= -2.0f;
m[1][2] = 0.0f;
m[2][3] = -2.0f;
CPerspDivider divider(m, fapGm_HIO_c::getCaptureScreenDivH(), fapGm_HIO_c::getCaptureScreenDivV());
divider.divide(m, fapGm_HIO_c::getCaptureScreenNumH(), fapGm_HIO_c::getCaptureScreenNumV());
m[0][0] *= 0.5f;
m[0][2] = m[0][2] * 0.5f - 0.5f;
m[1][1] *= -0.5f;
m[1][2] = m[1][2] * -0.5f - 0.5f;
m[2][3] = 0.0f;
info.setPrjMtx(m);
}
}
#endif
static void drawItem3D() {
Mtx item_mtx;
@@ -1614,6 +1727,15 @@ int mDoGph_Painter() {
j3dSys.reinitGX();
GXSetClipMode(GX_CLIP_ENABLE);
#if DEBUG
if (dJcame_c::get()) {
dJcame_c::get()->show3D(camera_p->viewMtx);
}
if (dJprev_c::get()) {
dJprev_c::get()->show3D(camera_p->viewMtx);
}
#endif
if (!dComIfGp_isPauseFlag()) {
#if DEBUG
fapGm_HIO_c::startCpuTimer();
@@ -1945,6 +2067,11 @@ int mDoGph_Painter() {
dComIfGp_particle_draw2Dfore(&draw_info3);
}
#if DEBUG
j3dSys.setViewMtx(m5);
dComIfGd_drawListCursor();
#endif
if (strcmp(dComIfGp_getStartStageName(), "F_SP127") == 0 || (mDoGph_gInf_c::isFade() & 0x80) != 0)
{
mDoGph_gInf_c::calcFade();
@@ -1955,8 +2082,15 @@ int mDoGph_Painter() {
}
#if DEBUG
if (dJcame_c::get()) {
dJcame_c::get()->show2D();
}
if (dJprev_c::get()) {
dJprev_c::get()->show2D();
}
// "drawing up to 2D-fore particle (Rendering)"
fapGm_HIO_c::stopCpuTimer("2D前(?)パーティクル描画まで(レンダリング)");
JAWExtSystem::draw();
#endif
mDoGph_gInf_c::endRender();
+171 -38
View File
@@ -28,6 +28,33 @@
#include "m_Do/m_Do_main.h"
#include "DynamicLink.h"
#if !PLATFORM_GCN
#include "revolution/sc.h"
#include "revolution/wpad.h"
#endif
#if PLATFORM_GCN
#define MAP_FILE_PLATFORM ""
#define MAP_FOLDER_PLATFORM "/Final"
#elif PLATFORM_WII
#define MAP_FILE_PLATFORM "R"
#define MAP_FOLDER_PLATFORM "/Rfinal"
#else
#define MAP_FILE_PLATFORM "R"
#define MAP_FOLDER_PLATFORM "/RVL"
#endif
#if DEBUG
#define MAP_FILE_SUFFIX "D"
#define MAP_FOLDER_MODE "/Debug"
#else
#define MAP_FILE_SUFFIX "F"
#define MAP_FOLDER_MODE "/Release"
#endif
#define MAP_FOLDER "/map" MAP_FOLDER_PLATFORM MAP_FOLDER_MODE
#define MAP_FILE "/" MAP_FILE_PLATFORM "framework" MAP_FILE_SUFFIX ".map"
#if DEBUG
u8 mDoMch::mDebugFill = true;
u8 mDoMch::mDebugFillNotUse = 0xDD;
@@ -292,13 +319,16 @@ static const char* myGetHeapTypeByString(JKRHeap* p_heap) {
case 0:
return "(Null)";
default:
u32 tmpType = heapType;
char* typeStr = (char*)&tmpType;
union {
char c[4];
u32 word;
} typeStr;
typeStr.word = heapType;
tmpString[0] = typeStr[0];
tmpString[1] = typeStr[1];
tmpString[2] = typeStr[2];
tmpString[3] = typeStr[3];
tmpString[0] = typeStr.c[0];
tmpString[1] = typeStr.c[1];
tmpString[2] = typeStr.c[2];
tmpString[3] = typeStr.c[3];
tmpString[4] = 0;
return tmpString;
}
@@ -319,13 +349,16 @@ static void myMemoryErrorRoutine(void* p_heap, u32 size, int alignment) {
size, size, alignment, p_heap);
}
u32 heapType = heap->getHeapType();
u8* tmpString = (u8*)&heapType;
union {
u8 c[4];
u32 word;
} heapType;
heapType.word = heap->getHeapType();
if (notSolidHeap) {
OSReport_Error(
"FreeSize=%08x TotalFreeSize=%08x HeapType=%08x(%c%c%c%c) HeapSize=%08x %s\n",
heap->getFreeSize(), heap->getTotalFreeSize(), heapType, tmpString[0], tmpString[1],
tmpString[2], tmpString[3], heap->getHeapSize(), myGetHeapTypeByString(heap));
heap->getFreeSize(), heap->getTotalFreeSize(), heapType.word, heapType.c[0], heapType.c[1],
heapType.c[2], heapType.c[3], heap->getHeapSize(), myGetHeapTypeByString(heap));
}
if (heapErrors == 0) {
@@ -350,18 +383,26 @@ static void myMemoryErrorRoutine(void* p_heap, u32 size, int alignment) {
void myHeapCheckRecursive(JKRHeap* p_heap) {
if (!p_heap->check()) {
const char* type = myGetHeapTypeByString(p_heap);
OSReport_Error("error in %08x(%s)\n", p_heap, type);
OSReport_Error("error in %08x(%s)\n", p_heap, myGetHeapTypeByString(p_heap));
}
JSUTree<JKRHeap>* heapTree = &p_heap->getHeapTree();
for (JSUTree<JKRHeap>* i = heapTree->getFirstChild(); i != NULL; i = i->getNextChild()) {
for (JSUTree<JKRHeap>* i = p_heap->getHeapTree().getFirstChild(); i != NULL; i = i->getNextChild()) {
myHeapCheckRecursive(i->getObject());
}
}
void mDoMch_HeapCheckAll() {
myHeapCheckRecursive(JKRHeap::sRootHeap);
myHeapCheckRecursive(JKRGetRootHeap());
#if PLATFORM_WII || PLATFORM_SHIELD
myHeapCheckRecursive(JKRGetRootHeap2());
#endif
#if DEBUG
DummyCheckHeap_check();
#endif
}
void mDoMch_HeapFreeFillAll() {
myHeapCheckRecursive(JKRGetRootHeap());
}
static int developKeyCheck(u32 btnTrig, u32 btnHold) {
@@ -396,18 +437,73 @@ static int developKeyCheck(u32 btnTrig, u32 btnHold) {
}
BOOL mDoMch_IsProgressiveMode() {
return OSGetProgressiveMode() == true;
#if PLATFORM_GCN
bool result = OSGetProgressiveMode() == true;
#else
bool result = SCGetProgressiveMode() == true;
#endif
return result;
}
bool exceptionReadPad(u32* p_btnTrig, u32* p_btnHold) {
return JUTException::getManager()->readPad(p_btnTrig, p_btnHold);
#if !PLATFORM_GCN
void exceptionNNGCReadPad(u32* p_btnTrig, u32* p_btnHold) {
static u32 l_cnvButton[10][2] = {
WPAD_BUTTON_MINUS, 0x40,
WPAD_BUTTON_PLUS, 0x20,
WPAD_BUTTON_HOME, 0x10,
WPAD_BUTTON_UP, 0x8,
WPAD_BUTTON_DOWN, 0x4,
WPAD_BUTTON_LEFT, 0x1,
WPAD_BUTTON_RIGHT, 0x2,
WPAD_BUTTON_1, 0x100,
WPAD_BUTTON_2, 0x200,
WPAD_BUTTON_A, 0x1000,
};
static u32 l_oldButton;
WPADStatus status;
WPADRead(0, &status);
*p_btnHold = 0;
u32* r29 = l_cnvButton[0];
for (u32 i = 0; i < 10; i++) {
if (status.button & r29[0]) {
*p_btnHold |= r29[1];
}
r29 += 2;
}
*p_btnTrig = *p_btnHold & (*p_btnHold ^ l_oldButton);
l_oldButton = *p_btnHold;
}
#endif
void exceptionReadPad(u32* p_btnTrig, u32* p_btnHold) {
#if PLATFORM_GCN
JUTException::getManager()->readPad(p_btnTrig, p_btnHold);
#else
exceptionNNGCReadPad(p_btnTrig, p_btnHold);
#endif
}
void forever() {
while (true) {}
}
#if !PLATFORM_GCN
void exceptionShutdown() {
mDoRst_reset(2, 0, 0);
//OSShutdownSystem();
forever();
}
#endif
void exceptionRestart() {
mDoRst_reset(0, 0, 0);
#if PLATFORM_GCN
OSResetSystem(0, 0, 0);
do {
} while (true);
#else
//OSRestart(0);
#endif
while (true) {}
}
void myExceptionCallback(u16, OSContext*, u32, u32) {
@@ -429,9 +525,10 @@ void myExceptionCallback(u16, OSContext*, u32, u32) {
} else {
manager->setTraceSuppress(0x80);
if (mDoMain::developmentMode == 0) {
#if PLATFORM_GCN
JUTGamePad pad(JUTGamePad::EPort1);
manager->setGamePad(&pad);
#endif
if (manager != NULL) {
OSEnableInterrupts();
// "Accepting Key input\n"
@@ -440,16 +537,29 @@ void myExceptionCallback(u16, OSContext*, u32, u32) {
exceptionReadPad(&btnTrig, &btnHold);
developKeyCheck(btnTrig, btnHold);
JUTException::waitTime(30);
#if PLATFORM_GCN
if (JUTGamePad::C3ButtonReset::sResetOccurred) {
exceptionRestart();
}
#else
if (mDoRst::isShutdown()) {
exceptionShutdown();
}
if (OSGetResetButtonState()) {
// lbl_8074C385 = 1;
} else {
#if !DEBUG
exceptionRestart();
#endif
}
#endif
}
// "JUTAssertion is visible\n"
OSReport("JUTAssertionを可視化しました\n");
JUTAssertion::setVisible(true);
JUTDbPrint::getManager()->setVisible(true);
JFWSystem::getSystemConsole()->setOutput(JUTConsole::OUTPUT_OSREPORT |
JUTConsole::OUTPUT_CONSOLE);
JUTConsole* console = JFWSystem::getSystemConsole();
console->setOutput(JUTConsole::OUTPUT_OSREPORT | JUTConsole::OUTPUT_CONSOLE);
} else {
PPCHalt();
}
@@ -459,7 +569,7 @@ void myExceptionCallback(u16, OSContext*, u32, u32) {
JUTException::waitTime(3000);
}
}
DVDChangeDir("/map/Final/Release");
DVDChangeDir(MAP_FOLDER);
JUTDestroyVideoManager();
GXSetDrawDoneCallback(NULL);
VISetBlack(0);
@@ -476,10 +586,14 @@ static void fault_callback_scroll(u16, OSContext* p_context, u32, u32) {
*(u32*)(srr0 - 0x8), *(u32*)(srr0 - 0x4), *(u32*)srr0);
}
#if PLATFORM_GCN
JUTGamePad pad(JUTGamePad::EPort1);
manager->setGamePad(&pad);
BOOL padDisabled = manager->isEnablePad() == false;
#else
bool padDisabled = false;
#endif
if (!padDisabled) {
exConsole->print("PUSH START BUTTON TO ADDITIONAL INFOMATION\n");
exConsole->print("--------------------------------------\n");
@@ -491,10 +605,11 @@ static void fault_callback_scroll(u16, OSContext* p_context, u32, u32) {
while (true) {
u32 btnHold, btnTrig;
exceptionReadPad(&btnTrig, &btnHold);
#if PLATFORM_GCN
if (JUTGamePad::C3ButtonReset::sResetOccurred) {
OSResetSystem(1, 0, 0);
}
#endif
bool waitRetrace = false;
if (btnTrig == PAD_BUTTON_START) {
@@ -504,13 +619,14 @@ static void fault_callback_scroll(u16, OSContext* p_context, u32, u32) {
if (btnTrig == PAD_TRIGGER_Z) {
JUTConsole* sysConsole = JFWSystem::getSystemConsole();
if (JUTConsoleManager::getManager()->getDirectConsole() != sysConsole) {
JUTConsole* directConsole = JUTConsoleManager::getManager()->getDirectConsole();
if (directConsole != sysConsole) {
exConsole = sysConsole;
exConsole->setFontSize(8.0f, 6.0f);
exConsole->setPosition(8, 32);
exConsole->setHeight(23);
exConsole->setVisible(true);
exConsole->setOutput(JUTConsole::OUTPUT_CONSOLE | JUTConsole::OUTPUT_OSREPORT);
sysConsole->setFontSize(8.0f, 6.0f);
sysConsole->setPosition(8, 32);
sysConsole->setHeight(23);
sysConsole->setVisible(true);
sysConsole->setOutput(JUTConsole::OUTPUT_CONSOLE | JUTConsole::OUTPUT_OSREPORT);
} else {
exConsole = JUTException::getConsole();
}
@@ -531,13 +647,13 @@ static void fault_callback_scroll(u16, OSContext* p_context, u32, u32) {
if (btnHold == PAD_BUTTON_UP) {
exConsole->scroll(holdUpCount < 3 ? -1 : (holdUpCount < 5 ? -2 : (holdUpCount < 7 ? -4 : -8)));
waitRetrace = true;
holdDownCount = 0;
holdUpCount++;
holdDownCount = 0;
} else if (btnHold == PAD_BUTTON_DOWN) {
exConsole->scroll(holdDownCount < 3 ? 1 : (holdDownCount < 5 ? 2 : (holdDownCount < 7 ? 4 : 8)));
waitRetrace = true;
holdUpCount = 0;
holdDownCount++;
holdUpCount = 0;
} else {
holdUpCount = 0;
holdDownCount = 0;
@@ -597,6 +713,27 @@ void my_SysPrintHeap(char const* message, void* start, u32 size) {
end, size / 1024);
}
#if DEBUG
u8 myWarningCount[115];
void myGXVerifyCallback(GXWarningLevel param_1, u32 param_2, const char* param_3) {
if (param_2 < ARRAY_SIZE(myWarningCount)) {
if (myWarningCount[param_2] >= 255) {
return;
}
if (myWarningCount[param_2] == 0) {
static const char* color[] = {"\x1b[34m", "\x1b[41;37m", "\x1b[43;30m", "\x1b[33m"};
OSReport("%sGX L%1d, Warning %03d: %s\n\x1b[m", color[param_1], param_1, param_2, param_3);
JUTReportConsole_f("GX L%1d, Warning %03d: %s\n", param_1, param_2, param_3);
}
myWarningCount[param_2]++;
} else {
OSReport_Warning("GX L%1d, Warning %03d: %s\n", param_1, param_2, param_3);
JUTReportConsole_f("GX L%1d, Warning %03d: %s\n", param_1, param_2, param_3);
}
}
#endif
int mDoMch_Create() {
if (mDoMain::developmentMode == 0 || !(OSGetConsoleType() & 0x10000000)) {
OSReportDisable();
@@ -813,11 +950,7 @@ int mDoMch_Create() {
sysConsole->setOutput(JUTConsole::OUTPUT_CONSOLE | JUTConsole::OUTPUT_OSREPORT);
sysConsole->setPosition(16, 42);
#if DEBUG
JUTException::setMapFile("/map/RVL/Debug/RframeworkD.map");
#else
JUTException::appendMapFile("/map/Final/Release/frameworkF.map");
#endif
JUTException::setMapFile(MAP_FOLDER MAP_FILE);
JUTException::setPreUserCallback(myExceptionCallback);
JUTException::setPostUserCallback(fault_callback_scroll);
+24 -16
View File
@@ -33,7 +33,7 @@
#include "m_Do/m_Do_printf.h"
#include "m_Do/m_Do_ext2.h"
#include "SSystem/SComponent/c_counter.h"
#include <cstring.h>
#include <string>
#if PLATFORM_WII || PLATFORM_SHIELD
#include <revolution/sc.h>
@@ -195,14 +195,12 @@ OSTime mDoMain::sPowerOnTime;
OSTime mDoMain::sHungUpTime;
/* 80450B18 0001+00 data_80450B18 None */
static u8 mDisplayHeapSize;
#if DEBUG
static u8 mReportDisable;
#endif
/* 80450B19 0001+00 data_80450B19 None */
static u8 mSelectHeapBar;
#if DEBUG
@@ -210,7 +208,6 @@ static u8 mVisibleHeapBar;
static u8 mPrintFrameLine;
#endif
/* 80450B1A 0002+00 data_80450B1A None */
static u8 mCheckHeap;
#if DEBUG
@@ -663,6 +660,22 @@ static void debug() {
}
}
// linker generated symbols
extern u8 _f_text[];
extern u8 _e_text[];
extern u8 _f_ctors[];
extern u8 _e_ctors[];
extern u8 _f_dtors[];
extern u8 _e_dtors[];
extern u8 _f_rodata[];
extern u8 _e_rodata[];
#if VERSION == VERSION_SHIELD_DEBUG
const int audioHeapSize = 0x169000;
#else
const int audioHeapSize = 0x14D800;
#endif
void main01(void) {
OS_REPORT("\x1b[m");
@@ -670,11 +683,10 @@ void main01(void) {
mDoMch_Create();
#if DEBUG
// not sure how this works. appears to be getting .text, .ctors, .dtors, and .rodata areas
FixedMemoryCheck::easyCreate((void*)0x80006880, (s32)0x628F40);
FixedMemoryCheck::easyCreate((void*)0x8062F7C0, (s32)0x224);
FixedMemoryCheck::easyCreate((void*)0x8062FA00, (s32)0xc);
FixedMemoryCheck::easyCreate((void*)0x8062FA20, (s32)0x30568);
FixedMemoryCheck* local_20 = FixedMemoryCheck::easyCreate(_f_text, intptr_t(_e_text - _f_text));
FixedMemoryCheck* local_24 = FixedMemoryCheck::easyCreate(_f_ctors, intptr_t(_e_ctors - _f_ctors));
FixedMemoryCheck* local_28 = FixedMemoryCheck::easyCreate(_f_dtors, intptr_t(_e_dtors - _f_dtors));
FixedMemoryCheck* local_2c = FixedMemoryCheck::easyCreate(_f_rodata, intptr_t(_e_rodata - _f_rodata));
#endif
// setup FrameBuffer and ZBuffer, init display lists
@@ -700,7 +712,8 @@ void main01(void) {
mDoExt_setCurrentHeap(sp10);
var_r28->dump_sort();
OSReport("\x1b[36mHOSTIOヒープ残り %u Bytes\n\x1b[m", var_r28->getTotalFreeSize());
s32 local_34 = var_r28->getTotalFreeSize();
OSReport("\x1b[36mHOSTIOヒープ残り %u Bytes\n\x1b[m", local_34);
#endif
JUTConsole* console = JFWSystem::getSystemConsole();
@@ -721,11 +734,6 @@ void main01(void) {
mDisplayHeapSize = 0;
cDyl_InitAsync(); // init RELs
#if VERSION == VERSION_SHIELD_DEBUG
const int audioHeapSize = 0x169000;
#else
const int audioHeapSize = 0x14D800;
#endif
g_mDoAud_audioHeap = JKRCreateSolidHeap(audioHeapSize, JKRGetCurrentHeap(), false);
do {
@@ -867,7 +875,7 @@ void parse_args(int argc, const char* argv[]) {
static u8 mainThreadStack[32768];
static OSThread mainThread;
OSThread mainThread;
void game_main(int argc, const char* argv[]) {
OSThread* current_thread = OSGetCurrentThread();
+1 -1
View File
@@ -23,7 +23,7 @@ static mDoMtx_stack_c mDoMtx_stack;
static mDoMtx_quatStack_c mDoMtx_quatStack;
extern Mtx g_mDoMtx_identity = {
Mtx g_mDoMtx_identity = {
{1.0f, 0.0f, 0.0f, 0.0f},
{0.0f, 1.0f, 0.0f, 0.0f},
{0.0f, 0.0f, 1.0f, 0.0f},
+1 -1
View File
@@ -4,7 +4,7 @@
*/
#include "m_Do/m_Do_printf.h"
#include "stdio.h"
#include <stdio>
#include <dolphin/base/PPCArch.h>
#include "m_Do/m_Do_ext.h"