mirror of
https://github.com/zeldaret/tww.git
synced 2026-06-06 19:41:31 -04:00
f_pc_manager, f_ap_game work
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
#ifndef JMATRIGONOMETRIC_H
|
||||
#define JMATRIGONOMETRIC_H
|
||||
|
||||
#include "dolphin/types.h"
|
||||
#include "MSL_C/utility.h"
|
||||
|
||||
struct TSinCosTable {
|
||||
std::pair<f32, f32> table[0x2000];
|
||||
|
||||
f32 sinShort(s16 v) const { return table[static_cast<u16>(v) >> 3].first; }
|
||||
f32 cosShort(s16 v) const { return table[static_cast<u16>(v) >> 3].second; }
|
||||
|
||||
inline f32 sinLap(f32 v) {
|
||||
if (v < 0.0f) {
|
||||
return -table[(u16)(-8192.0f * v) & 0x1fff].first;
|
||||
}
|
||||
return table[(u16)(8192.0f * v) & 0x1fff].first;
|
||||
}
|
||||
|
||||
inline f32 sinDegree(f32 degree) {
|
||||
if (degree < 0.0f) {
|
||||
return -table[(u16)(-22.755556106567383f * degree) & 0x1fffU].first;
|
||||
}
|
||||
return table[(u16)(22.755556106567383f * degree) & 0x1fffU].first;
|
||||
}
|
||||
|
||||
inline f32 cosDegree(f32 degree) {
|
||||
if (degree < 0.0f) {
|
||||
degree = -degree;
|
||||
}
|
||||
return table[(u16)(22.755556106567383f * degree) & 0x1fffU].second;
|
||||
}
|
||||
};
|
||||
|
||||
struct TAtanTable {
|
||||
f32 table[1025];
|
||||
u8 pad[0x1C];
|
||||
};
|
||||
|
||||
struct TAsinAcosTable {
|
||||
f32 table[1025];
|
||||
u8 pad[0x1C];
|
||||
};
|
||||
|
||||
namespace JMath {
|
||||
extern TSinCosTable sincosTable_;
|
||||
extern TAtanTable atanTable_;
|
||||
extern TAsinAcosTable asinAcosTable_;
|
||||
}; // namespace JMath
|
||||
|
||||
inline f32 JMASCosShort(s16 v) {
|
||||
return JMath::sincosTable_.cosShort(v);
|
||||
}
|
||||
inline f32 JMASinShort(s16 v) {
|
||||
return JMath::sincosTable_.sinShort(v);
|
||||
}
|
||||
|
||||
inline f32 JMASCos(s16 v) {
|
||||
return JMASCosShort(v);
|
||||
}
|
||||
inline f32 JMASSin(s16 v) {
|
||||
return JMASinShort(v);
|
||||
}
|
||||
|
||||
inline f32 JMASinLap(f32 v) {
|
||||
return JMath::sincosTable_.sinLap(v);
|
||||
}
|
||||
|
||||
inline f32 JMASinDegree(f32 degree) {
|
||||
return JMath::sincosTable_.sinDegree(degree);
|
||||
}
|
||||
|
||||
inline f32 JMACosDegree(f32 degree) {
|
||||
return JMath::sincosTable_.cosDegree(degree);
|
||||
}
|
||||
|
||||
#endif /* JMATRIGONOMETRIC_H */
|
||||
@@ -0,0 +1,120 @@
|
||||
#ifndef JMATH_H
|
||||
#define JMATH_H
|
||||
|
||||
#include "dolphin/mtx/mtx.h"
|
||||
|
||||
void JMAMTXApplyScale(const Mtx, Mtx, f32, f32, f32);
|
||||
void JMAEulerToQuat(s16 param_0, s16 param_1, s16 param_2, Quaternion* param_3);
|
||||
|
||||
inline f32 JMAFastReciprocal(f32 value) {
|
||||
return __fres(value);
|
||||
}
|
||||
|
||||
inline float __frsqrtes(register double f) {
|
||||
register float out;
|
||||
// clang-format off
|
||||
asm {
|
||||
frsqrte out, f
|
||||
}
|
||||
// clang-format on
|
||||
return out;
|
||||
}
|
||||
|
||||
inline f32 JMAFastSqrt(register f32 input) {
|
||||
if (input > 0.0f) {
|
||||
register f32 out;
|
||||
asm {
|
||||
frsqrte out, input
|
||||
}
|
||||
return out * input;
|
||||
} else {
|
||||
return input;
|
||||
}
|
||||
}
|
||||
|
||||
namespace JMath {
|
||||
|
||||
inline f32 fastReciprocal(f32 value) {
|
||||
return JMAFastReciprocal(value);
|
||||
}
|
||||
|
||||
inline void gekko_ps_copy3(register void* dst, register const void* src) {
|
||||
register f32 src0;
|
||||
register f32 src1;
|
||||
asm {
|
||||
psq_l src0, 0(src), 0, 0
|
||||
lfs src1, 8(src)
|
||||
psq_st src0, 0(dst), 0, 0
|
||||
stfs src1, 8(dst)
|
||||
};
|
||||
}
|
||||
|
||||
inline void gekko_ps_copy6(register void* dst, register const void* src) {
|
||||
register f32 src0;
|
||||
register f32 src1;
|
||||
register f32 src2;
|
||||
asm {
|
||||
psq_l src0, 0(src), 0, 0
|
||||
psq_l src1, 8(src), 0, 0
|
||||
psq_l src2, 16(src), 0, 0
|
||||
psq_st src0, 0(dst), 0, 0
|
||||
psq_st src1, 8(dst), 0, 0
|
||||
psq_st src2, 16(dst), 0, 0
|
||||
};
|
||||
}
|
||||
|
||||
inline void gekko_ps_copy12(register void* dst, register const void* src) {
|
||||
register f32 src0;
|
||||
register f32 src1;
|
||||
register f32 src2;
|
||||
register f32 src3;
|
||||
register f32 src4;
|
||||
register f32 src5;
|
||||
asm {
|
||||
psq_l src0, 0(src), 0, 0
|
||||
psq_l src1, 8(src), 0, 0
|
||||
psq_l src2, 16(src), 0, 0
|
||||
psq_l src3, 24(src), 0, 0
|
||||
psq_l src4, 32(src), 0, 0
|
||||
psq_l src5, 40(src), 0, 0
|
||||
psq_st src0, 0(dst), 0, 0
|
||||
psq_st src1, 8(dst), 0, 0
|
||||
psq_st src2, 16(dst), 0, 0
|
||||
psq_st src3, 24(dst), 0, 0
|
||||
psq_st src4, 32(dst), 0, 0
|
||||
psq_st src5, 40(dst), 0, 0
|
||||
};
|
||||
}
|
||||
|
||||
inline void gekko_ps_copy16(register void* dst, register const void* src) {
|
||||
register f32 src0;
|
||||
register f32 src1;
|
||||
register f32 src2;
|
||||
register f32 src3;
|
||||
register f32 src4;
|
||||
register f32 src5;
|
||||
register f32 src6;
|
||||
register f32 src7;
|
||||
asm {
|
||||
psq_l src0, 0(src), 0, 0
|
||||
psq_l src1, 8(src), 0, 0
|
||||
psq_l src2, 16(src), 0, 0
|
||||
psq_l src3, 24(src), 0, 0
|
||||
psq_l src4, 32(src), 0, 0
|
||||
psq_l src5, 40(src), 0, 0
|
||||
psq_l src6, 48(src), 0, 0
|
||||
psq_l src7, 56(src), 0, 0
|
||||
psq_st src0, 0(dst), 0, 0
|
||||
psq_st src1, 8(dst), 0, 0
|
||||
psq_st src2, 16(dst), 0, 0
|
||||
psq_st src3, 24(dst), 0, 0
|
||||
psq_st src4, 32(dst), 0, 0
|
||||
psq_st src5, 40(dst), 0, 0
|
||||
psq_st src6, 48(dst), 0, 0
|
||||
psq_st src7, 56(dst), 0, 0
|
||||
};
|
||||
}
|
||||
|
||||
}; // namespace JMath
|
||||
|
||||
#endif /* JMATH_H */
|
||||
@@ -0,0 +1,35 @@
|
||||
#ifndef RANDOM_H
|
||||
#define RANDOM_H
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
namespace JMath {
|
||||
struct TRandom_fast_ {
|
||||
u32 value;
|
||||
|
||||
TRandom_fast_(u32 value);
|
||||
u32 get(void) {
|
||||
value = (value * 0x19660d) + 0x3c6ef35f;
|
||||
return value;
|
||||
}
|
||||
|
||||
u32 get_bit32(void) { return this->get(); }
|
||||
|
||||
// due to the float constant, having this function inlined adds that float to data,
|
||||
// making it not match
|
||||
float get_ufloat_1(void) {
|
||||
// !@bug UB: in C++ it's not legal to read from an union member other
|
||||
// than the last one that was written to.
|
||||
union {
|
||||
f32 f;
|
||||
u32 s;
|
||||
} out;
|
||||
out.s = (this->get() >> 9) | 0x3f800000;
|
||||
return out.f - 1;
|
||||
}
|
||||
|
||||
void setSeed(u32 seed) { value = seed; }
|
||||
};
|
||||
} // namespace JMath
|
||||
|
||||
#endif /* RANDOM_H */
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef F_AP_GAME_H
|
||||
#define F_AP_GAME_H
|
||||
|
||||
#include "JSystem/JUtility/TColor.h"
|
||||
|
||||
void fapGm_After();
|
||||
void fapGm_Create();
|
||||
void fapGm_Execute();
|
||||
|
||||
class fapGm_HIO_c {
|
||||
public:
|
||||
/* 80018944 */ fapGm_HIO_c();
|
||||
/* 80018AE0 */ virtual ~fapGm_HIO_c();
|
||||
|
||||
u32 pad[0x58];
|
||||
}; // Size: 0x40
|
||||
|
||||
extern fapGm_HIO_c g_HIO;
|
||||
|
||||
#endif /* F_AP_GAME_H */
|
||||
@@ -35,7 +35,7 @@ void fpcCtRq_ToCreateQ(create_request* pReq);
|
||||
BOOL fpcCtRq_Delete(create_request* pReq);
|
||||
BOOL fpcCtRq_Cancel(create_request* pReq);
|
||||
s32 fpcCtRq_IsDoing(create_request* pReq);
|
||||
void fpcCtRq_Handler(void);
|
||||
s32 fpcCtRq_Handler(void);
|
||||
create_request* fpcCtRq_Create(layer_class* pLayer, u32 size,
|
||||
create_request_method_class* pCtRqMtd);
|
||||
|
||||
|
||||
@@ -9,6 +9,6 @@ typedef struct base_process_class base_process_class;
|
||||
BOOL fpcCt_IsCreatingByID(unsigned int id);
|
||||
s32 fpcCt_IsDoing(base_process_class* pProc);
|
||||
BOOL fpcCt_Abort(base_process_class* pProc);
|
||||
void fpcCt_Handler(void);
|
||||
s32 fpcCt_Handler(void);
|
||||
|
||||
#endif
|
||||
|
||||
+18
-4
@@ -4,6 +4,12 @@
|
||||
//
|
||||
|
||||
#include "f_ap/f_ap_game.h"
|
||||
#include "f_op/f_op_scene_mng.h"
|
||||
#include "f_op/f_op_overlap_mng.h"
|
||||
#include "f_op/f_op_camera_mng.h"
|
||||
#include "f_op/f_op_draw_tag.h"
|
||||
#include "f_pc/f_pc_manager.h"
|
||||
#include "SSystem/SComponent/c_counter.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
/* 8002306C-800231BC .text __ct__11fapGm_HIO_cFv */
|
||||
@@ -13,20 +19,28 @@ fapGm_HIO_c::fapGm_HIO_c() {
|
||||
|
||||
/* 800231BC-800231E4 .text fapGm_After__Fv */
|
||||
void fapGm_After() {
|
||||
/* Nonmatching */
|
||||
fopScnM_Management();
|
||||
fopOvlpM_Management();
|
||||
fopCamM_Management();
|
||||
}
|
||||
|
||||
/* 800231E4-80023218 .text fapGm_Execute__Fv */
|
||||
void fapGm_Execute() {
|
||||
/* Nonmatching */
|
||||
fpcM_Management(0, fapGm_After);
|
||||
cCt_Counter(0);
|
||||
}
|
||||
|
||||
/* 80023218-80023288 .text fapGm_Create__Fv */
|
||||
void fapGm_Create() {
|
||||
/* Nonmatching */
|
||||
fpcM_Init();
|
||||
fopScnM_Init();
|
||||
fopOvlpM_Init();
|
||||
fopCamM_Init();
|
||||
fopDwTg_CreateQueue();
|
||||
fopScnM_CreateReq(5, 0x7FFF, 0, 0);
|
||||
// HIO
|
||||
}
|
||||
|
||||
/* 80023288-800232D0 .text __dt__11fapGm_HIO_cFv */
|
||||
fapGm_HIO_c::~fapGm_HIO_c() {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
@@ -108,8 +108,8 @@ BOOL fpcCtRq_Do(create_request* i_request) {
|
||||
}
|
||||
|
||||
/* 8003CFC4-8003CFF0 .text fpcCtRq_Handler__Fv */
|
||||
void fpcCtRq_Handler() {
|
||||
fpcCtIt_Method((fpcCtIt_MethodFunc)fpcCtRq_Do, NULL);
|
||||
s32 fpcCtRq_Handler() {
|
||||
return fpcCtIt_Method((fpcCtIt_MethodFunc)fpcCtRq_Do, NULL);
|
||||
}
|
||||
|
||||
/* 8003CFF0-8003D078 .text fpcCtRq_Create__FP11layer_classUlP27create_request_method_class */
|
||||
|
||||
@@ -23,6 +23,6 @@ BOOL fpcCt_Abort(base_process_class* i_proc) {
|
||||
}
|
||||
|
||||
/* 8003D150-8003D170 .text fpcCt_Handler__Fv */
|
||||
void fpcCt_Handler() {
|
||||
fpcCtRq_Handler();
|
||||
s32 fpcCt_Handler() {
|
||||
return fpcCtRq_Handler();
|
||||
}
|
||||
|
||||
@@ -11,6 +11,12 @@
|
||||
#include "f_pc/f_pc_layer_iter.h"
|
||||
#include "f_pc/f_pc_line.h"
|
||||
#include "f_pc/f_pc_pause.h"
|
||||
#include "f_pc/f_pc_priority.h"
|
||||
#include "dolphin/dvd/DVD.h"
|
||||
#include "m_Do/m_Do_Reset.h"
|
||||
#include "SSystem/SComponent/c_lib.h"
|
||||
#include "SSystem/SComponent/c_API_graphic.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
|
||||
/* 8003E318-8003E338 .text fpcM_Draw__FPv */
|
||||
void fpcM_Draw(void* i_proc) {
|
||||
@@ -43,18 +49,55 @@ void messageSet(unsigned long) {
|
||||
}
|
||||
|
||||
/* 8003E9F0-8003EBD4 .text drawDvdCondition__Fl */
|
||||
void drawDvdCondition(long) {
|
||||
void drawDvdCondition(long status) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 8003EBD4-8003EC84 .text checkDvdCondition__Fv */
|
||||
void checkDvdCondition() {
|
||||
/* Nonmatching */
|
||||
static int checkDvdCondition() {
|
||||
static int l_dvdError = 0;
|
||||
|
||||
int status = DVDGetDriveStatus();
|
||||
if (status != 0 && status != 1)
|
||||
l_dvdError = 1;
|
||||
|
||||
if (l_dvdError != 0) {
|
||||
if (status == 0) {
|
||||
l_dvdError = 0;
|
||||
} else if (mDoRst::isReset()) {
|
||||
mDoRst::offReset();
|
||||
mDoRst_reset(1, 0x80000000, 0);
|
||||
} else {
|
||||
drawDvdCondition(status);
|
||||
}
|
||||
}
|
||||
|
||||
return l_dvdError;
|
||||
}
|
||||
|
||||
/* 8003EC84-8003ED90 .text fpcM_Management__FPFv_vPFv_v */
|
||||
void fpcM_Management(void (*)(void), void (*)(void)) {
|
||||
/* Nonmatching */
|
||||
void fpcM_Management(fpcM_ManagementFunc callBack1, fpcM_ManagementFunc callBack2) {
|
||||
MtxInit();
|
||||
|
||||
if (checkDvdCondition())
|
||||
return;
|
||||
|
||||
cAPIGph_Painter();
|
||||
fpcDt_Handler();
|
||||
if (!fpcPi_Handler())
|
||||
JUT_ASSERT("f_pc_manager.cpp", 548, 0);
|
||||
|
||||
if (!fpcCt_Handler())
|
||||
JUT_ASSERT("f_pc_manager.cpp", 552, 0);
|
||||
|
||||
if (callBack1 != NULL)
|
||||
callBack1();
|
||||
|
||||
fpcEx_Handler((fpcLnIt_QueueFunc)fpcM_Execute);
|
||||
fpcDw_Handler((fpcDw_HandlerFuncFunc)fpcM_DrawIterater, (fpcDw_HandlerFunc)fpcM_Draw);
|
||||
|
||||
if (callBack2 != NULL)
|
||||
callBack2();
|
||||
}
|
||||
|
||||
/* 8003ED90-8003EDCC .text fpcM_Init__Fv */
|
||||
|
||||
Reference in New Issue
Block a user