From 5ffa01306ce8edf505667d0fe28fbab5a02ed023 Mon Sep 17 00:00:00 2001 From: Prakxo Date: Fri, 24 Feb 2023 12:21:05 +0000 Subject: [PATCH] fix slices order, match some gu funcs --- common.py | 1 + config/dol_slices.yml | 62 +++++++++++++++-------------- config/rel_slices.yml | 23 ++++++----- include/libultra/gu.h | 28 +++++++++++++ include/libultra/u64types.h | 4 ++ include/{_mem.h => string.h} | 0 src/{libultra => libu64}/gfxprint.c | 0 src/libultra/gu/scale.c | 7 ++++ src/libultra/gu/translate.c | 7 ++++ src/libultra/ultra.c | 2 +- 10 files changed, 92 insertions(+), 42 deletions(-) create mode 100644 include/libultra/gu.h rename include/{_mem.h => string.h} (100%) rename src/{libultra => libu64}/gfxprint.c (100%) create mode 100644 src/libultra/gu/scale.c create mode 100644 src/libultra/gu/translate.c diff --git a/common.py b/common.py index cbe130aa..f3fcda14 100644 --- a/common.py +++ b/common.py @@ -296,6 +296,7 @@ def load_from_yaml(path: str, default=None): CFLAGS = [ "-O4", + "-char unsigned", ] CPLFLAGS =[ "-lang=c++", diff --git a/config/dol_slices.yml b/config/dol_slices.yml index 93070dbd..2d68f6b2 100644 --- a/config/dol_slices.yml +++ b/config/dol_slices.yml @@ -1,25 +1,38 @@ -#libultra/gfxprint/gfxprint_locate.c: -# .text: [0x8005B1EC, 0x8005B210] -#libultra/gfxprint/gfxprint_locate8x8.c: -# .text: [0x8005B210, 0x8005B238] +jaudio_NES/dummyprobe.c: + .text: [0x800083f8, 0x80008400] +#jaudio_NES/verysimple.c: +# .text: [0x80008400, 0x80008480] +# .sdata: [0x80217b80, 0x80217b88] libforest/ReconfigBATs.c: .text: [0x8005adac, 0x8005aed4] +#libu64/gfxprint.c: specify ranges later libc64/aprintf.c: .text: [0x8005cbdc, 0x8005cc14] -libultra/xldtob.c: - .text: [0x8005e918, 0x8005f2a0] - .rodata: [0x800ab110, 0x800ab158] - .sdata: [0x80217df8, 0x80217e08] - .sdata2: [0x80219210, 0x80219230] -libultra/xlitob.c: - .text: [0x8005f2a0, 0x8005f4cc] - .data: [0x800ddb60, 0x800ddb88] -libultra/xprintf.c: - .text: [0x8005f4cc, 0x8005ff74] - .rodata: [0x800ab158, 0x800ab170] - .data: [0x800ddb88, 0x800ddd20] - .sdata: [0x80217e08, 0x80217e10] - .sdata2: [0x80219230, 0x80219238] +#libultra/ultra.c: won't link +# .text: [0x8005d01c, 0x8005d15c] +# .bss: [0x80206f60, 0x80206fa0] +#libultra/gu/scale.c: +# .text: [0x8005e7d4, 0x8005e860] +# .sdata2: [0x80219208, 0x80219210] +#libultra/gu/translate.c: +# .text: [0x8005e8ac, 0x8005e918] +libultra/gu/sins.c: + .text: [0x8005e860, 0x8005e8ac] + .data: [0x800dd360, 0x800ddb60] +#libultra/xldtob.c: +# .text: [0x8005e918, 0x8005f2a0] +# .rodata: [0x800ab110, 0x800ab158] +# .sdata: [0x80217df8, 0x80217e08] +# .sdata2: [0x80219210, 0x80219230] +#libultra/xlitob.c: +# .text: [0x8005f2a0, 0x8005f4cc] +# .data: [0x800ddb60, 0x800ddb88] +#libultra/xprintf.c: +# .text: [0x8005f4cc, 0x8005ff74] +# .rodata: [0x800ab158, 0x800ab170] +# .data: [0x800ddb88, 0x800ddd20] +# .sdata: [0x80217e08, 0x80217e10] +# .sdata2: [0x80219230, 0x80219238] JSystem/JKernel/JKRHeap.cpp: .text: [0x80063748, 0x80064028] .data: [0x800ddf20, 0x800ddf98] @@ -47,20 +60,9 @@ dolphin/os/OSRestoreInterrupts.c: MSL_C/rand.c: .text: [0x8009f46c, 0x8009f494] .sdata: [0x80218260, 0x80218268] -#libultra/ultra.c: won't link -# .text: [0x8005d01c, 0x8005d15c] -# .bss: [0x80206f60, 0x80206fa0] -libultra/gu/sins.c: - .text: [0x8005e860, 0x8005e8ac] - .data: [0x800dd360, 0x800ddb60] dolphin/odenotstub/odenotstub.c: .text: [0x800a9770, 0x800a9780] dolphin/amcstubs/AmcExi2Stubs.c: .text: [0x800a8cc0, 0x800a8cf0] dolphin/gx/GXStubs.c: - .text: [0x800998d4, 0x800998d8] -jaudio_NES/dummyprobe.c: - .text: [0x800083f8, 0x80008400] -#jaudio_NES/verysimple.c: -# .text: [0x80008400, 0x80008480] -# .sdata: [0x80217b80, 0x80217b88] \ No newline at end of file + .text: [0x800998d4, 0x800998d8] \ No newline at end of file diff --git a/config/rel_slices.yml b/config/rel_slices.yml index bbeecd51..490d256a 100644 --- a/config/rel_slices.yml +++ b/config/rel_slices.yml @@ -1,5 +1,7 @@ -# ac_aprilfool_control/aPC_actor_dt.c: common_data is pure bs, - # .text: [0x805153f0, 0x8051542C] +sys_vimgr.c: + .text: [0x803703F8, 0x80370418] +m_room_type/mRmTp_FtrItemNo2FtrIdx.c: + .text: [0x803E7878, 0x803E78BC] #zurumode/zerucheck_init.c: # .text: [0x8040eb38, 0x8040EB50] #zurumode/zerucheck_key_check.c: @@ -10,16 +12,15 @@ # .text: [0x8040ef58, 0x8040efc4] # .bss: [0x812f9670, 0x812f9680] #zurumode/zurumode_update.c: - #.text: [0x8040EDA8, 0x8040ee74] -m_random_field/mRF_MakePerfectBit.c: - .text: [0x8050B1AC, 0x8050B1D4] -m_random_field/mRF_GetRandomStepMode.c: - .text: [0x8050B284, 0x8050B2C0] -m_room_type/mRmTp_FtrItemNo2FtrIdx.c: - .text: [0x803E7878, 0x803E78BC] + #.text: [0x8040EDA8, 0x8040ee74] # zurumode/zurumode.c: # .text: [0x8040eb38, 0x8040f008] # .bss: [0x812f9670, 0x812f9680] # .data: [0x8065F9F0, 0x8065FA20] -sys_vimgr.c: - .text: [0x803703F8, 0x80370418] \ No newline at end of file +m_random_field/mRF_MakePerfectBit.c: + .text: [0x8050B1AC, 0x8050B1D4] +m_random_field/mRF_GetRandomStepMode.c: + .text: [0x8050B284, 0x8050B2C0] +# ac_aprilfool_control/aPC_actor_dt.c: common_data is pure bs, + # .text: [0x805153f0, 0x8051542C] + diff --git a/include/libultra/gu.h b/include/libultra/gu.h new file mode 100644 index 00000000..bc6ae164 --- /dev/null +++ b/include/libultra/gu.h @@ -0,0 +1,28 @@ +#ifndef GU_H +#define GU_H +#include "types.h" +#include "libultra/u64types.h" + + +inline void guTranslateF(float m[4][4], float x, float y, float z){ + guMtxIdentF(m); + m[3][0] = x; + m[3][1] = y; + m[3][2] = z; +} + +inline void guScaleF(float mf[4][4], float x, float y, float z) { + guMtxIdentF(mf); + mf[0][0] = x; + mf[1][1] = y; + mf[2][2] = z; + mf[3][3] = 1.0; +} + +void guMtxF2L(float mf[4][4], Mtx *m); +void guMtxIdentF(float mf[4][4]); +void guTranslate(Mtx *m, float x, float y, float z); +void guScale(Mtx *m, float x, float y, float z); + + +#endif \ No newline at end of file diff --git a/include/libultra/u64types.h b/include/libultra/u64types.h index 9cfe459c..a4a8d9d6 100644 --- a/include/libultra/u64types.h +++ b/include/libultra/u64types.h @@ -15,4 +15,8 @@ typedef union { rgba8888_t c; } rgba8888; +typedef struct { + float m[4][4]; +} Mtx; + #endif diff --git a/include/_mem.h b/include/string.h similarity index 100% rename from include/_mem.h rename to include/string.h diff --git a/src/libultra/gfxprint.c b/src/libu64/gfxprint.c similarity index 100% rename from src/libultra/gfxprint.c rename to src/libu64/gfxprint.c diff --git a/src/libultra/gu/scale.c b/src/libultra/gu/scale.c new file mode 100644 index 00000000..d185a0f1 --- /dev/null +++ b/src/libultra/gu/scale.c @@ -0,0 +1,7 @@ +#include "libultra/gu.h" + +void guScale(Mtx *m, float x, float y, float z) { + float mf[4][4]; + guScaleF(mf, x, y, z); + guMtxF2L(mf, m); +} \ No newline at end of file diff --git a/src/libultra/gu/translate.c b/src/libultra/gu/translate.c new file mode 100644 index 00000000..6cb637f1 --- /dev/null +++ b/src/libultra/gu/translate.c @@ -0,0 +1,7 @@ +#include "libultra/gu.h" + +void guTranslate(Mtx *m, float x, float y, float z) { + float mf[4][4]; + guTranslateF(mf, x, y, z); + guMtxF2L(mf, m); +} diff --git a/src/libultra/ultra.c b/src/libultra/ultra.c index d580556a..0a9b9ae1 100644 --- a/src/libultra/ultra.c +++ b/src/libultra/ultra.c @@ -1,5 +1,5 @@ #include "libultra/libultra.h" -#include "_mem.h" +#include #include "dolphin/os.h" #include "dolphin/os/OSTime.h"