Stop frame record on some stuff. (#225)

* Disabled recording frame interpolation on result print text.

* Added check_if_recording() function to prevent cases of it recording while at 30FPS

* Seemingly disabled kart minimap icons for frame interpolation.

* Attempt to mitigate rare crash with printing text(unverified if this actually helps)

---------

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>
This commit is contained in:
sitton76
2025-06-19 17:37:30 -05:00
committed by GitHub
parent 3f9f89ed41
commit 65620eb797
4 changed files with 105 additions and 24 deletions
+44
View File
@@ -1836,6 +1836,14 @@ void print_text0(s32 column, s32 row, char* text, s32 tracking, f32 scaleX, f32
s32 stringWidth = 0;
s32 glyphIndex;
if (text == NULL) {
// @port if invalid text is loaded it will skip rendering it.
return;
}
// @port Skip Interpolation, if interpolated later remove this tag
FrameInterpolation_ShouldInterpolateFrame(false);
gSPDisplayList(gDisplayListHead++, D_020077A8);
if (*text != 0) {
do {
@@ -1861,6 +1869,9 @@ void print_text0(s32 column, s32 row, char* text, s32 tracking, f32 scaleX, f32
} while (*text != 0);
}
gSPDisplayList(gDisplayListHead++, D_020077D8);
// @port Resume Interpolation, if interpolated later remove this tag
FrameInterpolation_ShouldInterpolateFrame(true);
}
// Time trials
@@ -1868,6 +1879,14 @@ void print_text0_wide_right(s32 column, s32 row, char* text, s32 tracking, f32 s
s32 stringWidth = 0;
s32 glyphIndex;
if (text == NULL) {
// @port if invalid text is loaded it will skip rendering it.
return;
}
// @port Skip Interpolation, if interpolated later remove this tag
FrameInterpolation_ShouldInterpolateFrame(false);
gSPDisplayList(gDisplayListHead++, D_020077A8);
if (*text != 0) {
do {
@@ -1893,6 +1912,9 @@ void print_text0_wide_right(s32 column, s32 row, char* text, s32 tracking, f32 s
} while (*text != 0);
}
gSPDisplayList(gDisplayListHead++, D_020077D8);
// @port Resume Interpolation, if interpolated later remove this tag
FrameInterpolation_ShouldInterpolateFrame(true);
}
void print_text_mode_1(s32 column, s32 row, char* text, s32 tracking, f32 scaleX, f32 scaleY) {
@@ -1918,6 +1940,14 @@ void print_text1(s32 column, s32 row, char* text, s32 tracking, f32 scaleX, f32
s32 glyphIndex;
s32 sp60;
if (text == NULL) {
// @port if invalid text is loaded it will skip rendering it.
return;
}
// @port Skip Interpolation, if interpolated later remove this tag
FrameInterpolation_ShouldInterpolateFrame(false);
while (*temp_string != 0) {
glyphIndex = char_to_glyph_index(temp_string);
if (glyphIndex >= 0) {
@@ -1977,6 +2007,9 @@ void print_text1(s32 column, s32 row, char* text, s32 tracking, f32 scaleX, f32
}
}
gSPDisplayList(gDisplayListHead++, D_020077D8);
// @port Resume Interpolation, if interpolated later remove this tag
FrameInterpolation_ShouldInterpolateFrame(true);
}
void print_text1_left(s32 column, s32 row, char* text, s32 tracking, f32 scaleX, f32 scaleY) {
@@ -2000,6 +2033,14 @@ void print_text2(s32 column, s32 row, char* text, s32 tracking, f32 scaleX, f32
s32 characterWidth;
s32 glyphIndex;
if (text == NULL) {
// @port if invalid text is loaded it will skip rendering it.
return;
}
// @port Skip Interpolation, if interpolated later remove this tag
FrameInterpolation_ShouldInterpolateFrame(false);
gSPDisplayList(gDisplayListHead++, D_020077A8);
if (*text != 0) {
do {
@@ -2031,6 +2072,9 @@ void print_text2(s32 column, s32 row, char* text, s32 tracking, f32 scaleX, f32
}
gSPDisplayList(gDisplayListHead++, D_020077D8);
// @port Resume Interpolation, if interpolated later remove this tag
FrameInterpolation_ShouldInterpolateFrame(true);
}
void func_800939C8(s32 column, s32 row, char* text, s32 tracking, f32 scaleX, f32 scaleY) {
+52 -24
View File
@@ -618,6 +618,10 @@ void FrameInterpolation_ShouldInterpolateFrame(bool shouldInterpolate) {
is_recording = shouldInterpolate;
}
bool check_if_recording() {
return (is_recording && GameEngine::GetInterpolationFPS() != 30);
}
void FrameInterpolation_StartRecord(void) {
previous_recording = move(current_recording);
current_recording = {};
@@ -640,8 +644,9 @@ void FrameInterpolation_StopRecord(void) {
}
void FrameInterpolation_RecordOpenChild(const void* a, uintptr_t b) {
if (!is_recording)
if (!check_if_recording()) {
return;
}
label key = { a, b };
auto& m = current_path.back()->children[key];
append(Op::OpenChild).open_child = { key, m.size() };
@@ -649,8 +654,9 @@ void FrameInterpolation_RecordOpenChild(const void* a, uintptr_t b) {
}
void FrameInterpolation_RecordCloseChild(void) {
if (!is_recording)
if (!check_if_recording()) {
return;
}
// append(Op::CloseChild);
if (has_inv_actor_mtx && current_path.size() == inv_actor_mtx_path_index) {
has_inv_actor_mtx = false;
@@ -667,46 +673,53 @@ int FrameInterpolation_GetCameraEpoch(void) {
}
void FrameInterpolation_Record_SetTextMatrix(Mat4* matrix, f32 x, f32 y, f32 arg3, f32 arg4) {
if (!is_recording)
if (!check_if_recording()) {
return;
}
append(Op::SetTextMatrix).matrix_text = {matrix, x, y, arg3, arg4};
}
void FrameInterpolation_RecordActorPosRotMatrix(void) {
if (!is_recording)
if (!check_if_recording()) {
return;
}
next_is_actor_pos_rot_matrix = true;
}
void FrameInterpolation_RecordMatrixPush(Mat4* matrix) {
if (!is_recording)
if (!check_if_recording()) {
return;
}
append(Op::MatrixPush).matrix_ptr = { (Mat4**) matrix };
}
void FrameInterpolation_RecordMarker(const char* file, int line) {
if (!is_recording)
if (!check_if_recording()) {
return;
}
append(Op::Marker).marker = { file, line };
}
void FrameInterpolation_RecordMatrixPop(Mat4* matrix) {
if (!is_recording)
if (!check_if_recording()) {
return;
}
append(Op::MatrixPop).matrix_ptr = { (Mat4**) matrix };
}
void FrameInterpolation_RecordMatrixPut(MtxF* src) {
if (!is_recording)
if (!check_if_recording()) {
return;
}
// append(Op::MatrixPut).matrix_put = { matrix, *src };
}
void FrameInterpolation_RecordMatrixMult(Mat4* matrix, MtxF* mf, u8 mode) {
if (!is_recording)
if (!check_if_recording()) {
return;
}
append(Op::MatrixMult).matrix_mult = { matrix, *mf, mode };
}
@@ -717,45 +730,52 @@ void FrameInterpolation_ApplyMatrixTransformations(Mat4* matrix, FVector pos, IR
}
void FrameInterpolation_RecordMatrixTranslate(Mat4* matrix, Vec3f b) {
if (!is_recording)
if (!check_if_recording()) {
return;
}
append(Op::MatrixTranslate).matrix_translate = { matrix, *((Vec3fInterp*) &b) };
}
void FrameInterpolation_RecordMatrixScale(Mat4* matrix, f32 scale) {
if (!is_recording)
if (!check_if_recording()) {
return;
}
append(Op::MatrixScale).matrix_scale = { matrix, scale };
}
void FrameInterpolation_RecordMatrixMultVec3fNoTranslate(Mat4* matrix, Vec3f src, Vec3f dest) {
if (!is_recording)
if (!check_if_recording()) {
return;
}
// append(Op::MatrixMultVec3fNoTranslate).matrix_vec_no_translate = { matrix, src, dest };
}
void FrameInterpolation_RecordSetTransformMatrix(Mat4* dest, Vec3f orientationVector, Vec3f positionVector, u16 rotationAngle,
f32 scaleFactor) {
if (!is_recording)
if (!check_if_recording()) {
return;
}
append(Op::SetTransformMatrix).set_transform_matrix_data = { dest, {orientationVector[0], orientationVector[1], orientationVector[2]}, { positionVector[0], positionVector[1], positionVector[2] }, rotationAngle, scaleFactor};
}
void FrameInterpolation_RecordTranslateRotate(Mat4* dest, Vec3f pos, Vec3s rotation) {
if (!is_recording) { return; }
if (!check_if_recording()) { return; }
append(Op::SetTranslateRotate).set_translate_rotate_data = { dest, {pos[0], pos[1], pos[2]}, { rotation[0], rotation[1], rotation[2] }};
}
void FrameInterpolation_RecordSetMatrixTransformation(Mat4* dest, Vec3f location, Vec3su rotation, f32 scale) {
if (!is_recording)
if (!check_if_recording()) {
return;
}
append(Op::SetMatrixTransformation).set_matrix_transformation_data = { dest, {location[0], location[1], location[2]}, { rotation[0], rotation[1], rotation[2] }, scale};
}
void FrameInterpolation_RecordCalculateOrientationMatrix(Mat3* dest, f32 x, f32 y, f32 z, s16 rot) {
if (!is_recording) return;
if (!check_if_recording()) {
return;
}
// append(Op::SetMatrixTransformation).set_calculate_orientation_matrix_data = { dest, x, y, z, rot};
}
@@ -763,38 +783,44 @@ void FrameInterpolation_RecordCalculateOrientationMatrix(Mat3* dest, f32 x, f32
// Make a template for deref
void FrameInterpolation_RecordMatrixPosRotXYZ(Mat4* out, Vec3f pos, Vec3s orientation) {
if (!is_recording)
if (!check_if_recording()) {
return;
}
append(Op::MatrixPosRotXYZ).matrix_pos_rot_xyz = { out, *((Vec3fInterp*) &pos), *((Vec3sInterp*) &orientation) };
}
void FrameInterpolation_RecordMatrixPosRotScaleXY(Mat4* matrix, s32 x, s32 y, u16 angle, f32 scale) {
if (!is_recording)
if (!check_if_recording()) {
return;
}
append(Op::SetMatrixPosRotScaleXY).matrix_pos_rot_scale_xy = { matrix, x, y, angle, scale };
}
void FrameInterpolation_RecordMatrixMultVec3f(Mat4* matrix, Vec3f src, Vec3f dest) {
if (!is_recording)
if (!check_if_recording()) {
return;
}
// append(Op::MatrixMultVec3f).matrix_vec_translate = { matrix, src, dest };
}
void FrameInterpolation_RecordMatrixRotate1Coord(Mat4* matrix, u32 coord, s16 value) {
if (!is_recording)
if (!check_if_recording()) {
return;
}
append(Op::MatrixRotate1Coord).matrix_rotate_1_coord = { matrix, coord, value };
}
void FrameInterpolation_RecordMatrixMtxFToMtx(MtxF* src, Mtx* dest) {
if (!is_recording)
if (!check_if_recording()) {
return;
}
append(Op::MatrixMtxFToMtx).matrix_mtxf_to_mtx = { *src, dest };
}
void FrameInterpolation_RecordMatrixToMtx(Mtx* dest, char* file, s32 line) {
if (!is_recording)
if (!check_if_recording()) {
return;
}
auto& d = append(Op::MatrixToMtx).matrix_to_mtx = { dest };
if (has_inv_actor_mtx) {
d.has_adjusted = true;
@@ -805,14 +831,16 @@ void FrameInterpolation_RecordMatrixToMtx(Mtx* dest, char* file, s32 line) {
}
void FrameInterpolation_RecordMatrixRotateAxis(f32 angle, Vec3f* axis, u8 mode) {
if (!is_recording)
if (!check_if_recording()) {
return;
}
// append(Op::MatrixRotateAxis).matrix_rotate_axis = { angle, axis, mode };
}
void FrameInterpolation_RecordSkinMatrixMtxFToMtx(MtxF* src, Mtx* dest) {
if (!is_recording)
if (!check_if_recording()) {
return;
}
FrameInterpolation_RecordMatrixMtxFToMtx(src, dest);
}
@@ -25,6 +25,8 @@ extern "C" {
void FrameInterpolation_ShouldInterpolateFrame(bool shouldInterpolate);
bool check_if_recording();
void FrameInterpolation_StartRecord(void);
void FrameInterpolation_StopRecord(void);
+7
View File
@@ -2778,6 +2778,9 @@ void func_8004F168(s32 arg0, s32 playerId, s32 characterId) {
s32 center = 0;
Player* player = &gPlayerOne[playerId];
// @port Skip Interpolation, if interpolated later remove this tag
FrameInterpolation_ShouldInterpolateFrame(false);
if (player->type & (1 << 15)) {
thing0 = player->pos[0] * CM_GetProps()->Minimap.PlayerScaleFactor; // gMinimapPlayerScale;
thing1 = player->pos[2] * CM_GetProps()->Minimap.PlayerScaleFactor; // gMinimapPlayerScale;
@@ -2822,6 +2825,10 @@ void func_8004F168(s32 arg0, s32 playerId, s32 characterId) {
}
}
}
// @port Resume Interpolation, if interpolated later remove this tag
FrameInterpolation_ShouldInterpolateFrame(true);
}
#undef EXPLICIT_AND
#else