From 447fd8b29057e8dcc223507e6b7d6bc448c6f7d8 Mon Sep 17 00:00:00 2001 From: AloXado320 <38191089+AloXado320@users.noreply.github.com> Date: Thu, 26 Sep 2024 23:26:01 -0500 Subject: [PATCH] Fix rainbow text font + update decomp (#102) * Update menus.c (#634) * Update common_data.yml (#635) * Renames for screenId and other changes (#636) * screenId renames * Rename surface map to collision mesh (#637) * Rename some stack vars (#638) * Fix syntax error (#639) * Rename some stack vars * Update collision.c * Collision Documentation (#640) * Collision related renames * update doxygen (#649) * change bool (#644) Co-authored-by: MegaMech * Update (#642) * Delete trig_tables_bss.c (#650) * fix typo audio (#656) * fix typo src actor (#657) Co-authored-by: MegaMech * fix typo include (#658) Co-authored-by: MegaMech * fix course (#659) Co-authored-by: MegaMech * fix typo debug (#660) Co-authored-by: MegaMech * fix typo data (#661) Co-authored-by: MegaMech * replace number with const (#665) * fix typo buffers (#655) * fix typo buffers * tweak ld file * rename to sMemoryPool * add a warning --------- Co-authored-by: MegaMech * fix typo src (#654) * fix typo src * fix non matcing * Update code_80091750.c --------- Co-authored-by: MegaMech * fix typo racing (#653) * fix typo racing * get it match * replace G_LINE3D to G_QUAD --------- Co-authored-by: MegaMech * fix typo src (#652) Co-authored-by: MegaMech * fix ending typo (#651) * Action more info when it doesn't match and fix first diff (#662) * Update linux-compile.yml * fix first-diff * Update first-diff.py --------- Co-authored-by: MegaMech * document texture of kart (#663) * document texture of kart * change screenPlayerId to screenId * some documentation around object * Revert "some documentation around object" This reverts commit cbb39078e036bf2a417bed67359e910213acab28. * more rename --------- Co-authored-by: MegaMech * Make evaluate_collision_players_palm_tree better (#667) This matches just the same as before, but using those two casts instead of shifts seems more likely to be accurate to the original source code Signed-off-by: Gabriel Ravier * add fedora instruciton (#666) Co-authored-by: MegaMech * start documenting animation (#668) * start documenting animation * Update course_data.c * change comment * update libultra asm (#648) * update libultra asm * fix gcc __osThreadTail --------- Co-authored-by: MegaMech * Document Vehicles (#641) * start doc collision * fix merge * finish rename fonction related to vehicle * document around waypoint of vehicle * make some modification * make some change and rename one * copy_ to oldPos * doc smoke ferry and train * some rename * fix some renaming * precise index * rename a funciton * simplify waypoint_vehicles * change some name * change some name * rename move_to_point_direction * fix some conflict * Update code_80005FD0.c * Update code_80005FD0.h --------- Co-authored-by: MegaMech * Label a save info loop (#645) * save info * more gcc progress * fix a value and do a rename (#669) * update clang and add action (#664) * update clang and add action * try clang on course folder only * forget two file * Update course_displaylists.inc.c * forget few other file * Update course_vertices.inc.c * format all code while get it match * second pass * format other dir * disable clang format on bad ido code * fix some tabulation * revert format on tool dir * Update clang-format.yml * ignore gbi.h * add some read me instruction * fix error * format and fixing error * Update README.md --------- Co-authored-by: MegaMech * Update linkonly_generator.py (#670) * some rename for torch (#588) * rename gBombKartSpawns, and fix cup ID * Update doxygen_syms.md * rename for gCourseIndexInCup and his constant * rename to gCupSelectedCourseIndex * forget a change in constant * fix compilation issue * Update Dockerfile to latest Ubuntu LTS + fixed missing cmake (#674) * Fix color font matrix function (#676) * Fix label variables used in menus (#675) * Fix label variables used in menus * split D_800F2BDC and clang format menu.c --------- Co-authored-by: coco875 * Fix some libultra struct types (#677) * Uintptr (#671) * Update render_courses.c * Update math_util.c * Update math_util.c * Update math_util.h * Update render_courses.c * Clang suggest (#678) * add clang suggestion * Update clang-format-suggest.yml * Update clang-format-suggest.yml * simplify * switch to ubuntu * Update clang-format-suggest.yml * update ubuntu --------- Co-authored-by: MegaMech * Clang pr (#679) * Create clang-pr.yml * Update clang-pr.yml * Update osCreateMesgQueue.c * Update osCreateMesgQueue.c * Update clang-pr.yml * Update clang-pr.yml * Update clang-format.yml * clang format (#680) Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com> * some rename in ceremony (#647) * rename ceremony * apply some suggestion * some rename --------- Co-authored-by: MegaMech * clang format (#681) Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com> * Rename Object Timing Related Code (#673) * start making models extraction with blender * finishing extract model * Update fast64 * extract course * Update fast64 * Update fast64 * simplify import of course_displaylists and course_textures and remplace adress with texture * Update fast64 * change data format and simplify the thread queue * move in a blender folder * remove fast64 * re add fast64 * add model_extract and fast64_blender in makefile * multithread with make file split the models into multiple json and add course segment * Update fast64 * remove old model_extract * remove the error when he don't find blender * start rename around course section * rename around object * update submodule fast64 * fix compilation issue and add some model to extract * Update fast64 * remove fast64 * re add fast64 * update submodule * fix compilation issue * add other collision gfx and prepare reorganise file * re arrange json * Create README.MD * Update README.MD * Update README.MD * update fast64 * rename to initiate_next_state * Revert "Merge branch '3d-objects' into general-object" This reverts commit f5347b38cc75af4d10ee3726dc1524c1c71d6849, reversing changes made to a353c4d954fb5b50c8b48fe3f9d67c95ccaab299. * revert the revert... * revert 3d-models PR * finish some revert * Update code_80005FD0.c * fix code_80091750.c * Update code_80091750.c * rename isTimerRunning to isTimerActive and set_object_timer_running to set_object_timer_state * rename to initialize_next_state * rename to object_next_state --------- Co-authored-by: MegaMech * extract models with blender (#577) * start making models extraction with blender * finishing extract model * Update fast64 * extract course * Update fast64 * Update fast64 * simplify import of course_displaylists and course_textures and remplace adress with texture * Update fast64 * change data format and simplify the thread queue * move in a blender folder * remove fast64 * re add fast64 * add model_extract and fast64_blender in makefile * multithread with make file split the models into multiple json and add course segment * Update fast64 * remove old model_extract * remove the error when he don't find blender * start rename around course section * update submodule fast64 * fix compilation issue and add some model to extract * Update fast64 * remove fast64 * re add fast64 * update submodule * fix compilation issue * add other collision gfx and prepare reorganise file * re arrange json * Create README.MD * Update README.MD * Update README.MD * update fast64 --------- Co-authored-by: MegaMech * Update clang-pr.yml (#683) * Update clang-pr.yml * Update clang-pr.yml * Update clang-pr.yml --------- Co-authored-by: MegaMech * clang format (#682) Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com> Co-authored-by: MegaMech * Match func_800A66A8 (#686) * Update code_80091750.c * Delete asm/non_matchings/code_80091750/func_800A66A8.s * Update code_80091750.c * Update code_80091750.c * Update code_80091750.c * Clang Format (#687) * Clang Format * Update code_80091750.c --------- Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com> Co-authored-by: MegaMech * Fix color text array and function (#689) * Fix color text array and function * seg2 header * Fix rainbow text font --------- Signed-off-by: Gabriel Ravier Co-authored-by: MegaMech Co-authored-by: coco875 <59367621+coco875@users.noreply.github.com> Co-authored-by: Gabriel Ravier Co-authored-by: MisterSheeple <27652712+MisterSheeple@users.noreply.github.com> Co-authored-by: coco875 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com> --- src/code_80091750.c | 64 ++++------- yamls/us/data_segment2.yml | 211 ++++++++++++++++++++----------------- 2 files changed, 133 insertions(+), 142 deletions(-) diff --git a/src/code_80091750.c b/src/code_80091750.c index 430d446aa..6190642be 100644 --- a/src/code_80091750.c +++ b/src/code_80091750.c @@ -938,6 +938,13 @@ s32 D_800E84A0[] = { 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, }; +Vtx* D_800E84C0[] = { + D_02007BB8, + D_02007CD8, + D_02007DF8, +}; + +#ifndef AVOID_UB Gfx* D_800E84CC[] = { D_02007838, D_02007858, D_02007878, D_02007898, D_020078B8, D_020078D8, D_020078F8, D_02007918, }; @@ -949,6 +956,7 @@ Gfx* D_800E84EC[] = { Gfx* D_800E850C[] = { D_02007A38, D_02007A58, D_02007A78, D_02007A98, D_02007AB8, D_02007AD8, D_02007AF8, D_02007B18, }; +#endif s8 D_800E852C = 1; @@ -1349,7 +1357,6 @@ void func_80092258(void) { } } -//! @bug vtx overflow from idx + 36 in this func void func_80092290(s32 arg0, s32* arg1, s32* arg2) { s32 temp_v1; s32 i; @@ -1362,16 +1369,6 @@ void func_80092290(s32 arg0, s32* arg1, s32* arg2) { s32 a, b, c, d; Vtx* vtx; - Vtx* v1 = (Vtx*) LOAD_ASSET(D_02007BB8); - // Vtx *v2 = (Vtx *) LOAD_ASSET(D_02007CD8); - // Vtx *v3 = (Vtx *) LOAD_ASSET(D_02007DF8); - - Vtx* D_800E84C0[] = { - &v1[0], - &v1[18], - &v1[36], - }; - if ((arg0 < 4) || (arg0 >= 6)) { return; } @@ -1385,21 +1382,10 @@ void func_80092290(s32 arg0, s32* arg1, s32* arg2) { } for (i = 0; i < 3; i++) { - if (i == 0) { - vtx = (Vtx*) &v1[0]; - } else if (i == 1) { - vtx = (Vtx*) &v1[18]; - } else if (i == 2) { - vtx = (Vtx*) &v1[36]; - } - // vtx = (Vtx *) segmented_to_virtual_dupe_2(&v1[0]); + vtx = (Vtx*) LOAD_ASSET(D_800E84C0[i]); temp_v1 = (*arg1 * 2) + 2; - //! @bug vtx array overflow temp fix - if ((vtx + temp_v1) >= 54) { - return; - } temp_t6 = (vtx + temp_v1)->v.cn[0] * (256 - *arg2); temp_t9 = (vtx + temp_v1)->v.cn[1] * (256 - *arg2); temp_t7 = (vtx + temp_v1)->v.cn[2] * (256 - *arg2); @@ -1411,10 +1397,10 @@ void func_80092290(s32 arg0, s32* arg1, s32* arg2) { c = ((vtx + temp_v1)->v.cn[2] * *arg2); d = ((vtx + temp_v1)->v.cn[3] * *arg2); - //! @bug vtx array overflow temp fix - if ((vtx + idx) >= 54) { - return; - } + (vtx + idx)->v.cn[0] = (temp_t6 + a) / 256; + (vtx + idx)->v.cn[1] = (temp_t9 + b) / 256; + (vtx + idx)->v.cn[2] = (temp_t7 + c) / 256; + (vtx + idx)->v.cn[3] = (temp_t8_2 + d) / 256; (vtx + idx + 1)->v.cn[0] = (temp_t6 + a) / 256; (vtx + idx + 1)->v.cn[1] = (temp_t9 + b) / 256; @@ -2530,9 +2516,6 @@ Gfx* draw_flash_select_case_fast(Gfx* displayListHead, s32 ulx, s32 uly, s32 lrx Gfx* func_800959F8(Gfx* displayListHead, Vtx* arg1) { s32 index; - Vtx* a_D_02007BB8 = (Vtx*) LOAD_ASSET(D_02007BB8); - // Vtx *a_D_02007CD8 = (Vtx *) LOAD_ASSET(D_02007CD8); - // Vtx *a_D_02007DF8 = (Vtx *) LOAD_ASSET(D_02007DF8); if ((s32) gTextColor < TEXT_BLUE_GREEN_RED_CYCLE_1) { index = gTextColor; @@ -2540,13 +2523,10 @@ Gfx* func_800959F8(Gfx* displayListHead, Vtx* arg1) { index = ((gTextColor * 2) + ((s32) gGlobalTimer % 2)) - 4; } #ifdef AVOID_UB - if (arg1 == D_02007BB8) { - gSPDisplayList(displayListHead++, D_800E84CC[index]); - } else if (arg1 == &D_02007BB8[18]) { - gSPDisplayList(displayListHead++, D_800E84EC[index]); - } else if (arg1 == &D_02007BB8[36]) { - gSPDisplayList(displayListHead++, D_800E850C[index]); - } + arg1 = LOAD_ASSET(arg1); + gSPVertex(displayListHead++, arg1, 2, 0); + gSPVertex(displayListHead++, &arg1[(index + 1) * 2], 2, 2); + gSPDisplayList(displayListHead++, common_rectangle_display); #else if (arg1 == D_02007BB8) { gSPDisplayList(displayListHead++, D_800E84CC[index]); @@ -2639,10 +2619,6 @@ Gfx* func_80095BD0(Gfx* displayListHead, u8* arg1, f32 arg2, f32 arg3, u32 arg4, Vtx* var_a1; Mtx* sp28; - Vtx* a_D_02007BB8 = (Vtx*) LOAD_ASSET(D_02007BB8); - // Vtx *a_D_02007CD8 = (Vtx *) LOAD_ASSET(D_02007CD8); - // Vtx *a_D_02007DF8 = (Vtx *) LOAD_ASSET(D_02007DF8); - // A match is a match, but why are goto's required here? if (gMatrixEffectCount >= 0x2F7) { goto func_80095BD0_label1; @@ -2664,16 +2640,16 @@ func_80095BD0_label2: G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); switch (arg4) { default: - var_a1 = &D_02007BB8[18]; + var_a1 = D_02007CD8; break; case 16: - var_a1 = &D_02007BB8[18]; + var_a1 = D_02007CD8; break; case 26: var_a1 = D_02007BB8; break; case 30: - var_a1 = &D_02007BB8[36]; + var_a1 = D_02007DF8; break; } diff --git a/yamls/us/data_segment2.yml b/yamls/us/data_segment2.yml index c17f16979..7c78589c6 100644 --- a/yamls/us/data_segment2.yml +++ b/yamls/us/data_segment2.yml @@ -62,112 +62,127 @@ D_02007818: symbol: D_02007818 type: Gfx offset: 0x7818 -D_02007838: - symbol: D_02007838 - type: Gfx - offset: 0x7838 -D_02007858: - symbol: D_02007858 - type: Gfx - offset: 0x7858 -D_02007878: - symbol: D_02007878 - type: Gfx - offset: 0x7878 -D_02007898: - symbol: D_02007898 - type: Gfx - offset: 0x7898 -D_020078B8: - symbol: D_020078B8 - type: Gfx - offset: 0x78B8 -D_020078D8: - symbol: D_020078D8 - type: Gfx - offset: 0x78D8 -D_020078F8: - symbol: D_020078F8 - type: Gfx - offset: 0x78F8 -D_02007918: - symbol: D_02007918 - type: Gfx - offset: 0x7918 -D_02007938: - symbol: D_02007938 - type: Gfx - offset: 0x7938 -D_02007958: - symbol: D_02007958 - type: Gfx - offset: 0x7958 -D_02007978: - symbol: D_02007978 - type: Gfx - offset: 0x7978 -D_02007998: - symbol: D_02007998 - type: Gfx - offset: 0x7998 -D_020079B8: - symbol: D_020079B8 - type: Gfx - offset: 0x79B8 -D_020079D8: - symbol: D_020079D8 - type: Gfx - offset: 0x79D8 -D_020079F8: - symbol: D_020079F8 - type: Gfx - offset: 0x79F8 -D_02007A18: - symbol: D_02007A18 - type: Gfx - offset: 0x7A18 -D_02007A38: - symbol: D_02007A38 - type: Gfx - offset: 0x7A38 -D_02007A58: - symbol: D_02007A58 - type: Gfx - offset: 0x7A58 -D_02007A78: - symbol: D_02007A78 - type: Gfx - offset: 0x7A78 -D_02007A98: - symbol: D_02007A98 - type: Gfx - offset: 0x7A98 -D_02007AB8: - symbol: D_02007AB8 - type: Gfx - offset: 0x7AB8 -D_02007AD8: - symbol: D_02007AD8 - type: Gfx - offset: 0x7AD8 -D_02007AF8: - symbol: D_02007AF8 - type: Gfx - offset: 0x7AF8 -D_02007B18: - symbol: D_02007B18 - type: Gfx - offset: 0x7B18 +#D_02007838: +# symbol: D_02007838 +# type: Gfx +# offset: 0x7838 +#D_02007858: +# symbol: D_02007858 +# type: Gfx +# offset: 0x7858 +#D_02007878: +# symbol: D_02007878 +# type: Gfx +# offset: 0x7878 +#D_02007898: +# symbol: D_02007898 +# type: Gfx +# offset: 0x7898 +#D_020078B8: +# symbol: D_020078B8 +# type: Gfx +# offset: 0x78B8 +#D_020078D8: +# symbol: D_020078D8 +# type: Gfx +# offset: 0x78D8 +#D_020078F8: +# symbol: D_020078F8 +# type: Gfx +# offset: 0x78F8 +#D_02007918: +# symbol: D_02007918 +# type: Gfx +# offset: 0x7918 +#D_02007938: +# symbol: D_02007938 +# type: Gfx +# offset: 0x7938 +#D_02007958: +# symbol: D_02007958 +# type: Gfx +# offset: 0x7958 +#D_02007978: +# symbol: D_02007978 +# type: Gfx +# offset: 0x7978 +#D_02007998: +# symbol: D_02007998 +# type: Gfx +# offset: 0x7998 +#D_020079B8: +# symbol: D_020079B8 +# type: Gfx +# offset: 0x79B8 +#D_020079D8: +# symbol: D_020079D8 +# type: Gfx +# offset: 0x79D8 +#D_020079F8: +# symbol: D_020079F8 +# type: Gfx +# offset: 0x79F8 +#D_02007A18: +# symbol: D_02007A18 +# type: Gfx +# offset: 0x7A18 +#D_02007A38: +# symbol: D_02007A38 +# type: Gfx +# offset: 0x7A38 +#D_02007A58: +# symbol: D_02007A58 +# type: Gfx +# offset: 0x7A58 +#D_02007A78: +# symbol: D_02007A78 +# type: Gfx +# offset: 0x7A78 +#D_02007A98: +# symbol: D_02007A98 +# type: Gfx +# offset: 0x7A98 +#D_02007AB8: +# symbol: D_02007AB8 +# type: Gfx +# offset: 0x7AB8 +#D_02007AD8: +# symbol: D_02007AD8 +# type: Gfx +# offset: 0x7AD8 +#D_02007AF8: +# symbol: D_02007AF8 +# type: Gfx +# offset: 0x7AF8 +#D_02007B18: +# symbol: D_02007B18 +# type: Gfx +# offset: 0x7B18 D_02007B38: # unused symbol: D_02007B38 type: vtx offset: 0x7B38 - count: 8 + count: 4 +D_02007B78: # unused + symbol: D_02007B78 + type: vtx + offset: 0x7B78 + count: 4 D_02007BB8: symbol: D_02007BB8 type: vtx offset: 0x7BB8 - count: 52 + count: 18 +D_02007CD8: + symbol: D_02007CD8 + type: vtx + offset: 0x7CD8 + count: 18 +D_02007DF8: + symbol: D_02007DF8 + type: vtx + offset: 0x7DF8 + count: 18 D_02007F18: symbol: D_02007F18 type: gfx