Skip to content

Commit

Permalink
v1.1
Browse files Browse the repository at this point in the history
support new cleo library Version: 2.0.1//Date: Apr 2021
  • Loading branch information
XMDS committed Aug 5, 2021
1 parent ac052d5 commit 3c2af71
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 31 deletions.
Binary file modified source/0DD2FixAsm_call.csa
Binary file not shown.
13 changes: 13 additions & 0 deletions source/0DD2FixAsm_call.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,20 @@ gosub @Int_Operations_func
9@ += 1 //Because it is a thumb instruction, the address is +1
0DD2: context_call_func 9@
0DD4: 0@ = context_get_reg 0
0@ -= 2
0DD8: 2@ = read_mem_addr 0@ size 2 add_ib 0
if
2@ == 0xFFFF
jf @NewCleoVersion
0@ += 2
0@ -= 0xDBA //get 0DD2 addr {BL asm_call}
jump @W_hook_0DD2

:NewCleoVersion //Version: 2.0.1//Date: Apr 2021
0@ += 2
0@ += 0x27C6 //get 0DD2 addr {BL asm_call}

:W_hook_0DD2
3@ = 0
gosub @new_asm_call
gosub @bl
Expand Down
Binary file modified source/Test script/draw_shadow.csa
Binary file not shown.
136 changes: 105 additions & 31 deletions source/Test script/draw_shadow.txt
Original file line number Diff line number Diff line change
@@ -1,45 +1,119 @@
{$CLEO .csa}
0000:
0DD0: 36@ = get_label_addr @_ZN8CShadows23StoreShadowToBeRenderedEhP7CVectorffffshhh
0DD1: 36@ = get_func_addr_by_cstr_name 36@
const
SCP = $PLAYER_ACTOR
ShadowTextureType = 3
FrontX = 1.0
FrontY = 0.0
SideX = 0.0
SideY = -1.0
Intensity = 255
R = 255
G = 0
B = 255
end

int v
int StoreShadowToBeRendered
int CVector
int memmove
int a
int c
int d
float x
float y
float z
float gz

0DD6: v = get_game_version
if
v == 13 //SA1.08
then
0DD0: memmove = get_label_addr @memmove
0DD1: memmove = get_func_addr_by_cstr_name memmove
end

if
v == 17 //SA2.00
then
//0DD0: memmove = get_label_addr @__aeabi_memmove
//0DD1: memmove = get_func_addr_by_cstr_name memmove
0DD7: memmove = get_image_base
memmove += 0x0019DEE4
end

:Fix
0DD0: a = get_label_addr @coords
0DD0: c = get_label_addr @coords
0DD0: d = get_label_addr @coords
//addr+4-��addr%4��
a /= 4
a *= 4
c -= a
if
c <> 0
jf @DrawShadow
0DD0: CVector = get_label_addr @coords
CVector += 4
CVector -= c
//void *memmove( void* dest, const void* src, size_t count );
0DD3: context_set_reg 2 value 12 //size
0DD3: context_set_reg 1 value d //src
0DD3: context_set_reg 0 value CVector //dest
0DD2: context_call_func memmove

//StoreShadowToBeRendered(unsigned char shadowTextureType, CVector* posn, float frontX, float frontY, float sideX, float sideY, short intensity, unsigned char red, unsigned char green, unsigned char blue)
0DD0: StoreShadowToBeRendered = get_label_addr @_ZN8CShadows23StoreShadowToBeRenderedEhP7CVectorffffshhh
0DD1: StoreShadowToBeRendered = get_func_addr_by_cstr_name StoreShadowToBeRendered

:1
:DrawShadow
wait 0
if
0256: player $PLAYER_CHAR defined
jf @1
00A0: store_actor $PLAYER_ACTOR position_to 1@ 2@ 3@
02CE: 5@ = ground_z_at 1@ 2@ 3@
5@ += 0.03
0DD0: 30@ = get_label_addr @coords
0DD9: write_mem_addr 30@ value 1@ size 4 add_ib 0 protect 1
30@ += 4
0DD9: write_mem_addr 30@ value 2@ size 4 add_ib 0 protect 1
30@ += 4
0DD9: write_mem_addr 30@ value 5@ size 4 add_ib 0 protect 1
30@ -= 8
0DD3: context_set_reg 9 value 255 //B
0DD3: context_set_reg 8 value 0 //G
0DD3: context_set_reg 7 value 255 //R
0DD3: context_set_reg 6 value 200 //intensity
0DD3: context_set_reg 5 value -1.0 //sideY
0DD3: context_set_reg 4 value 0.0 //sideX
0DD3: context_set_reg 3 value 0.0 //frontY
0DD3: context_set_reg 2 value 1.0 //frontX
0DD3: context_set_reg 1 value 30@ //CVector* posn
0DD3: context_set_reg 0 value 3 //shadowTextureType
0DD2: context_call_func 36@
jump @1
player.IsPlaying(0)
jf @DrawShadow
char.GetCoordinates(SCP, x, y, z)
World.GetGroundZFor3DCoord(gz, x, y, z)
gz += 0.03
Memory.Write(CVector, x, 4, 0, 1)
CVector += 4
Memory.Write(CVector, y, 4, 0, 1)
CVector += 4
Memory.Write(CVector, gz, 4, 0, 1)
CVector -= 8
0DD3: context_set_reg 9 value B
0DD3: context_set_reg 8 value G
0DD3: context_set_reg 7 value R
0DD3: context_set_reg 6 value Intensity
0DD3: context_set_reg 5 value SideY
0DD3: context_set_reg 4 value SideX
0DD3: context_set_reg 3 value FrontY
0DD3: context_set_reg 2 value FrontX
0DD3: context_set_reg 1 value CVector
0DD3: context_set_reg 0 value ShadowTextureType
0DD2: context_call_func StoreShadowToBeRendered
jump @DrawShadow

:coords
:memmove
hex
00 00 00 00 //x
00 00 00 00 //y
00 00 00 00 //z
"memmove" 00
end

/*
:__aeabi_memmove
hex
"__aeabi_memmove" 00
end
*/

:_ZN8CShadows23StoreShadowToBeRenderedEhP7CVectorffffshhh
hex
"_ZN8CShadows23StoreShadowToBeRenderedEhP7CVectorffffshhh" 00
end

:coords
hex
00 00 00 00 //x
00 00 00 00 //y
00 00 00 00 //z
00 00 00 //+3 byte
end

0 comments on commit 3c2af71

Please sign in to comment.