From 7d4e4c0b34a613dd3c0220475ae4e448197522c1 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sat, 12 Mar 2011 23:17:12 +0100 Subject: initial commit. now I can start playing with stuff! --- oldStuff/3dlib/tpl_ext.S | 88 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 oldStuff/3dlib/tpl_ext.S (limited to 'oldStuff/3dlib/tpl_ext.S') diff --git a/oldStuff/3dlib/tpl_ext.S b/oldStuff/3dlib/tpl_ext.S new file mode 100644 index 0000000..9bfa71b --- /dev/null +++ b/oldStuff/3dlib/tpl_ext.S @@ -0,0 +1,88 @@ +# fuck nintendo + +.text + +#ifndef __MWERKS__ +.set r0,0; .set r1,1; .set r2,2; .set r3,3; .set r4,4 +.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9 +.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14 +.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19 +.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24 +.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29 +.set r30,30; .set r31,31; .set f0,0; .set f2,2; .set f3,3 +.set f1,1 +#endif + +.set sp, 1 +.extern GXInitTexObj +.extern GXInitTexObjLOD + +.globl TPLGetGXTexObjFromPalette +TPLGetGXTexObjFromPalette: +.set var_28, -0x28 +.set var_20, -0x20 +.set var_C, -0xC +.set var_8, -8 +.set var_4, -4 +.set arg_4, 4 +stwu sp, -0x30(sp) +mflr r0 +stw r0, 0x30+arg_4(sp) +stw r31, 0x30+var_4(sp) +stw r30, 0x30+var_8(sp) +stw r29, 0x30+var_C(sp) +mr r29, r4 +lwz r6, 4(r3) +lwz r30, 8(r3) +mr r3, r29 +divwu r0, r5, r6 +mullw r0, r0, r6 +subf r0, r0, r5 +slwi r31, r0, 3 +lwzx r9, r30, r31 +lbz r6, 0x21(r9) +lbz r0, 0x22(r9) +lwz r4, 8(r9) +subf r5, r6, r0 +subf r0, r0, r6 +or r0, r5, r0 +lhz r5, 2(r9) +lhz r6, 0(r9) +srwi r10, r0, 31 +lwz r7, 4(r9) +lwz r8, 0xC(r9) +lwz r9, 0x10(r9) +bl GXInitTexObj +lwzx r7, r30, r31 +lis r5, 0x4330 +stw r5, 0x30+var_28(sp) +mr r3, r29 +lbz r4, 0x21(r7) +li r6, 0 +lbz r0, 0x22(r7) +li r8, 0 +stw r4, 0x30+var_28+4(sp) +lfd f0, 0x30+var_28(sp) +stw r5, 0x30+var_20(sp) +lis r5, blah@h +ori r5, r5, blah@l +lfd f2, 0(r5) +fsubs f1, f0, f2 +lwz r4, 0x14(r7) +stw r0, 0x30+var_20+4(sp) +lwz r5, 0x18(r7) +lfd f0, 0x30+var_20(sp) +lfs f3, 0x1C(r7) +fsubs f2, f0, f2 +lbz r7, 0x20(r7) +bl GXInitTexObjLOD +lwz r0, 0x30+arg_4(sp) +lwz r31, 0x30+var_4(sp) +lwz r30, 0x30+var_8(sp) +lwz r29, 0x30+var_C(sp) +mtlr r0 +addi sp, sp, 0x30 +blr + +blah: +.long 0x43300000,0x00000000 -- cgit v1.2.3