Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion tools/game_sites.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@
# and the two loads of an actor's link in the check of one of its flags by name (1.9.0 0x700120c760; #766)
Site('stale_actor_flag', 'code', 'f942ba68 52864261 72b85581 f9404500 94000000/fc000000 36000000/fff8001f 52800020 a9424ff4', 0),
Site('stale_actor_flag2', 'code', 'f942ba68 528120a1 72a6b2c1 f9404500 94000000/fc000000 2a000288 37000008/fff8001f f942ba68', 0),
# AI message send to an actor link whose actor may be null (1.9.0 0x7000bbb670; #1130)
Site('stale_actor_ai_msg', 'code', 'f942f834 3900501f f9400415 b4000015/ff00001f aa0003f6 2a0203f3 f84106c8 f9400908 d63f0100 f94002a8 aa0003e3 12000264 aa1503e0 aa1403e1 f9400905', 0),
# the physics step's solver microsteps (tools/patches.py _solver_steps): the delta frame times 6
Site('phys_solver_steps', 'code', '1e231002 1e3c1004 f9401a68 1e2c1009 1e220822 f9400108 1e202048 f9400514', 4),
# Havok's deactivation at the console's pace (tools/patches.py _phys_tick, _phys_motion_tick): the world step's
Expand Down Expand Up @@ -610,7 +612,8 @@
('lookat_update',), # (the free camera: without it Home does nothing)
('gyro_scene_actor',),
('surf_contact', 'surf_boost_remove', 'surf_jump_request'),
('stale_actor_helper', 'stale_actor_kind', 'stale_actor_target', 'stale_actor_flag', 'stale_actor_flag2'),
('stale_actor_helper', 'stale_actor_kind', 'stale_actor_target', 'stale_actor_flag', 'stale_actor_flag2',
'stale_actor_ai_msg'),
('quick_menu_capture_alpha',),
('cjk_font_size', 'cjk_font_bin', 'cjk_font_quad'),
('kf_angle',),
Expand Down Expand Up @@ -821,6 +824,7 @@
'stale_actor_target': 0x7000dea400,
'stale_actor_flag': 0x700120c780,
'stale_actor_flag2': 0x700120c7f0,
'stale_actor_ai_msg': 0x7000bbb670,
'phys_solver_steps': 0x700156f930,
'demo_move_arrive': 0x7000c711dc,
'rail_point_radius': 0x7000c89d4c,
Expand Down
10 changes: 10 additions & 0 deletions tools/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,15 @@ def _stale_target_exit(gen, a):
raise AssertionError('stale target: no cbnz x19 above %#x' % a)


def _stale_actor_ai_msg(gen, a):
assert _word(gen, a) == 0xf942f834, hex(_word(gen, a)) # ldr x20, [x1, #0x5f0]
w = _word(gen, a + 0xc)
assert w & 0xff00001f == 0xb4000015, hex(w) # cbz x21, <ret_false>
ret_false = (a + 0xc) + sext((w >> 5) & 0x7ffff, 19) * 4
return ('{ if (!c->x[1]) { ST8(c->x[0] + 0x14, 0); goto L_%x; } '
'c->x[20] = LD64(c->x[1] + 0x5f0); }' % ret_false)


def _surf_jump_request(gen, a):
w = _word(gen, a)
assert w & 0xfff8001f == 0x36000000 # tbz w0, #0, <no jump>
Expand Down Expand Up @@ -1549,6 +1558,7 @@ def _camera_leave(gen, a):
'stale_actor_target': _stale_actor_target,
'stale_actor_flag': _stale_actor_flag,
'stale_actor_flag2': _stale_actor_flag,
'stale_actor_ai_msg': _stale_actor_ai_msg,
'phys_solver_steps': _solver_steps,
'kf_angle': _kf_angle,
'demo_move_arrive': _demo_move_arrive,
Expand Down
Loading