Implement Baseball aiming, pooled projectiles and VR07 targets

This commit is contained in:
UnixNight committed 2026-11-02 22:54:19 -05:00
1 parent 50fcb87d90
commit d6ca417e9e
50 files changed
+3149 -32

No files matched your search

+187
View File
@@ -0,0 +1,187 @@
#!/usr/bin/env python3
"""Identity-guarded Baseball evidence and bounded arithmetic projections.
No original code executes. The yaw-only launch projection uses continuous host
trig; source full-Euler table quantization remains a separate precision boundary.
"""
from __future__ import annotations
import argparse
from dataclasses import dataclass, replace
import hashlib
import json
import math
from pathlib import Path
import struct
from checkpoint_script_state import EXE_SHA256, find_case, read_va
from pe_inspect import PE
BODIES = (
('constructor', 0x40fc50, 0x40fe67, 'f539ae6099b61f9f1f7007cd185f211b3165dc484cf502c80eb4b5dfc1c2ef0b'),
('pool', 0x422609, 0x4226a3, '8324ec8b6bd8d9ce6c65782611781d2a5e990e8f73359fd0403e6795ba1a9771'),
('primary', 0x426566, 0x4268b4, 'be39a4022aaaf35b9e629597bd04a50e957dcdbe8c8e64fd6ca91e7060b66565'),
('equip', 0x4296f8, 0x4297dd, '2c530179e91a377e31e9bc169c25332bf3821cec614e927d3d5bc51871d69d10'),
('cleanup', 0x42871d, 0x4287ac, '7fdcf6718f6a53a5136240894dbd8c9f840968afbf7c5e10f2d2f766da48a3dd'),
('launch', 0x429a30, 0x429c03, 'fb35366b25c4a6b1503a8028aeb354d8bbfc8d32f60a850a2fde109913e34a53'),
('ball_callbacks', 0x40fee0, 0x410020, '0b0a8ca521c8f92583a57586af945860bb21042240b72b8bc57ff13e061ac45c'),
('jimmy_contact', 0x423014, 0x423080, '997533ba4cd830f11af35b19aa926ebc52a5fce2ee394a7da2c0b82410d9b4d3'),
('aim_input', 0x438bc0, 0x438cd0, '329acdc727d4d68fcc7d2cc85dcfe408f6e18700574af891d889673a780ec7d5'),
('support_order', 0x47bb10, 0x47bba7, '7f34edef3fad0a511d8af4ff8add816d9169b8407b05f1093683969ee4a21669'),
('wall_reflection', 0x472750, 0x472970, 'cae4ae6987680cb97264a918efc33e5bdd25f3b419096d201fc948130bc52315'),
('defaults', 0x46fd90, 0x46fe49, 'c04ff2c68b8b2ce5cbee48675a54e73f85dcf3014c9b9efd93a42213c75792ab'),
('aim_art', 0x402084, 0x402107, '4a839c828fe971f0629796f8dfe5523e695a448bd5812768a74f3976071b561e'),
('stop_sound', 0x429a00, 0x429a25, '09501f7e7ec80126459cd211ad9520f65c66d1ca4c6e644781a05137d620c3fd'),
('energy_gate', 0x4269d0, 0x426a69, '0a97a24b016fa6743b518cd6ebadce5966a717b84e4ca0bdfa583bcdc65d16b5'),
)
VTABLES = (
(0x4a3bdc, 0x174, 0x428d50), (0x4a3bdc, 0x178, 0x427ff0),
(0x4a3bdc, 0x180, 0x429a30), (0x4a3bdc, 0x148, 0x429a00),
(0x4a3bdc, 0x170, 0x437740), (0x49141c, 0x370, 0x40ff50),
(0x49141c, 0x374, 0x40fee0), (0x49141c, 0x378, 0x472750),
(0x49141c, 0x37c, 0x40ff80), (0x49141c, 0x3c4, 0x40ff40),
(0x49141c, 0x40c, 0x410000), (0x49141c, 0x288, 0x471cc0),
(0x49141c, 0x2c4, 0x471f40),
)
CONSTANTS = ((0x49195c, 'f', -0.6499999761581421),
(0x49fabc, 'f', 0.02222222276031971),
(0x4a311c, 'f', 1800.), (0x49d5c8, 'f', 45.),
(0x48d404, 'f', 30.), (0x4a3e40, 'd', 4.3),
(0x4a3130, 'd', 100.), (0x495324, 'f', 20.))
def collect(original: Path | str):
pe = PE(find_case(Path(original), 'Neutron.exe'))
digest = hashlib.sha256(pe.data).hexdigest()
if digest != EXE_SHA256:
raise ValueError('Unexpected original EXE identity')
bodies = []
for name, start, end, expected in BODIES:
actual = hashlib.sha256(read_va(pe, start, end-start)).hexdigest()
if actual != expected:
raise ValueError(f'Changed source span {name}')
bodies.append(dict(name=name, va=hex(start), file_offset=hex(pe.offset(start-pe.base)),
length=end-start, sha256=actual))
for table, slot, target in VTABLES:
if struct.unpack('<I', read_va(pe, table+slot, 4))[0] != target:
raise ValueError(f'Changed virtual {table:x}+{slot:x}')
for va, fmt, value in CONSTANTS:
if struct.unpack('<'+fmt, read_va(pe, va, struct.calcsize(fmt)))[0] != value:
raise ValueError(f'Changed constant {va:x}')
# These are dispatcher table entries, not guessed gadget enumeration labels.
if struct.unpack('<I', read_va(pe, 0x4298e8+7*4, 4))[0] != 0x4296f8:
raise ValueError('Changed item6 equip target')
if struct.unpack('<I', read_va(pe, 0x428844+6*4, 4))[0] != 0x42871d:
raise ValueError('Changed raw6 cleanup target')
font_table = read_va(pe, 0x4f4ed8, 768)
if hashlib.sha256(font_table).hexdigest() != '910bef1d7aca6f1aa328ba9f671831bdbbda19b419fb0c693117cb096d542226':
raise ValueError('Changed source gameplay font table')
digits = [struct.unpack_from('<h', font_table, 5*128+(ord(c)-32)*2)[0] for c in '0123456789']
if digits != [118,127,120,121,122,123,124,125,126,119] or struct.unpack_from('<h', font_table, 5*128)[0] != -1:
raise ValueError('Changed TIME digit/null-space binding')
return dict(sha256=digest, bodies=bodies,
vtables=[dict(table=hex(t), slot=hex(s), target=hex(v)) for t,s,v in VTABLES],
constants=[dict(va=hex(a), value=v) for a,_,v in CONSTANTS],
pool_size=20, ball_canvas=2, ball_size=25, radius=15,
factor=1, wall_damping=f32(.46), floor_friction=f32(.46),
authored_property24=f32(3.2),
landing_impulse_scale=f32(-.65), throw_energy=-1, throw_sound=10,
aim_font=dict(table_va='0x4f4ed8', table_file_offset=hex(pe.offset(0x4f4ed8-pe.base)),
set=5, digits=digits, null_space=True, digit_dimensions=[16,16]),
aim_canvas=253, aim_position=[315,100], practice='vr07.gam')
def f32(value):
return struct.unpack('<f', struct.pack('<f', value))[0]
def finite(*values):
if not all(math.isfinite(v) for v in values):
raise ValueError('Finite inputs required')
@dataclass(frozen=True)
class Aim:
pending: bool = False
saved_pitch: float = 0.
def aim_hold(state: Aim, current_pitch: float, *, mode=6, supported=True,
energy=1., exempt=False, busy=False, modal=False):
"""42668F..4268AF after outer input/primary gates; no timing integration.
First hold arms without capturing a new pitch. Existing pending state is
preserved by rejects. Airborne raw6 follows other primary behavior.
"""
finite(current_pitch, energy, state.saved_pitch)
if busy or modal or mode == 0 or (energy <= 0 and not exempt):
return state
if mode != 6 or not supported:
return state
if not state.pending:
return replace(state, pending=True)
return replace(state, saved_pitch=f32(max(0., min(45., current_pitch))))
def release(state: Aim, *, primary=False):
"""426585..4265F9; intentionally no mode/energy test after pending check."""
if primary or not state.pending:
return state, None
return replace(state, pending=False), dict(pitch=state.saved_pitch, sound=10, energy=-1.)
def cleanup(state: Aim):
"""Raw6 cleanup does not write pending1E26 or savedPitch1E28."""
return state
def aim_label(saved_pitch):
"""426754..426792 screen text arguments, computed BEFORE new pitch capture."""
finite(saved_pitch)
return 286, int((45.-saved_pitch)*4.3+100.), int(saved_pitch)
def next_slot(index: int, *, exists=True):
if not 0 <= index < 20:
raise ValueError('Pool index must be0..19')
return (index+1) % 20 if exists else index
def launch_yaw_only(root, yaw, saved_pitch):
"""429A30 upright actor subset, no original trig-table precision claim.
Full source uses local-point384(0,80,50), then local-vector38C(0,
float32(pitch*float32(1/45)),1), quick-normalize, multiply1800.
"""
finite(*root, yaw, saved_pitch)
if len(root) != 3 or not 0 <= saved_pitch <= 45:
raise ValueError('Three-vector root and bounded pitch required')
angle = math.radians(yaw)
s, c = math.sin(angle), math.cos(angle)
slope = f32(saved_pitch*f32(1/45))
scale = 1800/math.sqrt(1+slope*slope)
return ((root[0]-50*s, root[1]+80, root[2]+50*c),
(-s*scale, slope*scale, c*scale))
def landing_impulse(velocity):
"""40FF80 writes impulse288, BEFORE support47BB74 clears velocityY."""
finite(*velocity)
x,y,z = velocity
return f32(x), f32(y*f32(-.65)), f32(z)
if __name__ == '__main__':
cli=argparse.ArgumentParser(description=__doc__)
cli.add_argument('original', type=Path)
cli.add_argument('--output', type=Path)
args=cli.parse_args()
result=json.dumps(collect(args.original), indent=2)+'\n'
if args.output:
original=args.original.resolve()
if args.output.resolve().is_relative_to(original):
cli.error('Write generated evidence outside the original directory')
args.output.parent.mkdir(parents=True, exist_ok=True)
args.output.write_text(result)
else:
print(result, end='')