Reset cutscene facing destination with original camera rotation handoff

This commit is contained in:
UnixNight committed 2026-11-05 15:44:25 -05:00
1 parent 7818cc8d64
commit dae13ace73
24 files changed
+2864 -9

No files matched your search

@@ -0,0 +1,56 @@
/* Original copied CAM/MCA orientation suffixes and real Euler/facing leaves.
Synthetic controlled owner, forced-ready global facing gate, no activation,
game entrypoint, body, renderer, gadget cleanup or input execution. */
#define main unused_grappler_main
#include "grappler_scalar_probe.c"
#undef main
typedef struct { float x,y,z,w; } Vec4;
static uintptr_t table[0x440/4];
#define VEC(o) (*(Vec4*)(object+(o)))
static void fix(uint32_t start,uint32_t end){
const uint32_t targets[]={0x5099e4,0x48d914,0x48e5b0,0x48e5c0,0x48e5c4,0x4afcf0,0x4afd38};
for(uint32_t a=start;a+4<=end;a++){
uint32_t v;memcpy(&v,AT(a),4);
for(unsigned i=0;i<sizeof(targets)/4;i++)if(v==targets[i]){v=(uintptr_t)AT(v);memcpy(AT(a),&v,4);a+=3;break;}
}
}
static void*entry(uint32_t start,uint32_t end){
unsigned char*code=VirtualAlloc(NULL,128,MEM_COMMIT|MEM_RESERVE,PAGE_EXECUTE_READWRITE);require(code!=NULL,"wrapper allocation");unsigned char*p=code;
emit_byte(&p,0x53);emit_byte(&p,0x55);emit_byte(&p,0x56);emit_byte(&p,0x57);
emit_byte(&p,0x81);emit_byte(&p,0xec);word(&p,0x80);
emit_byte(&p,0x31);emit_byte(&p,0xdb); /*ebx=0, as activation block*/
jump(p,AT(start));p+=5;unsigned char*finish=p;
emit_byte(&p,0x81);emit_byte(&p,0xc4);word(&p,0x80);
emit_byte(&p,0x5f);emit_byte(&p,0x5e);emit_byte(&p,0x5d);emit_byte(&p,0x5b);emit_byte(&p,0xc3);
jump(AT(end),finish);return code;
}
static void vec(Vec4 v){printf("[%.9g,%.9g,%.9g,%.9g]",v.x,v.y,v.z,v.w);}
static void snapshot(void){
printf("{\"current\":");vec(VEC(0x224));printf(",\"target\":");vec(VEC(0x274));printf(",\"dirty\":%u}",object[10]);
}
static void one(const char*kind,void(*run)(void),int index,Vec4 current,Vec4 target,int dirty){
memset(object,0xa5,sizeof(object));*(void**)object=table;object[5]=1;object[10]=dirty;
VEC(0x224)=current;VEC(0x274)=target;*(void**)AT(0x5099e4)=object;
unsigned char expected[sizeof(object)];memcpy(expected,object,sizeof(object));
Vec4 flat={0,current.y,0,current.w};memcpy(expected+0x224,&flat,sizeof(flat));memcpy(expected+0x274,&flat,sizeof(flat));
printf("ROTATION {\"kind\":\"%s\",\"case\":%d,\"before\":",kind,index);snapshot();
run();require(memcmp(object,expected,sizeof(object))==0,"suffix exact object write set including dirty preservation");
printf(",\"prepared\":");snapshot();
((void(TC*)(void*,float))AT(0x43a420))(object,1.f/60);
printf(",\"after_facing\":");snapshot();
for(int tick=1;tick<30;tick++)((void(TC*)(void*,float))AT(0x43a420))(object,1.f/60);
printf(",\"after_30\":");snapshot();puts("}");
require(VEC(0x224).x==0&&VEC(0x224).z==0,"remains upright through facing");
require(VEC(0x274).y==current.y&&VEC(0x274).w==current.w,"destination follows current heading and W");
}
int main(void){
setbuf(stdout,NULL);map_source();
fix(0x416671,0x4166eb);fix(0x431518,0x431590);fix(0x43a420,0x43a5cd);fix(0x472480,0x472570);
const unsigned char ready[]={0xb0,1,0xc3};memcpy(AT(0x475ca0),ready,3);
table[0x328/4]=(uintptr_t)AT(0x4723f0);table[0x32c/4]=(uintptr_t)AT(0x472450);table[0x334/4]=(uintptr_t)AT(0x458f90);
void(*cam)(void)=entry(0x416671,0x4166eb);void(*mca)(void)=entry(0x431518,0x431590);
const Vec4 currents[]={{15,155,25,1},{323.858f,293.333f,349.214f,7},{-40,0,-25,3},{10,359,342.11f,9},{0,360,0,11}};
const Vec4 targets[]={{-40,151,-25,101},{10,291,-5,102},{23,315,12,103},{20,1,40,104},{10,0,10,105}};
for(int k=0;k<2;k++)for(int i=0;i<5;i++)for(int dirty=0;dirty<2;dirty++)one(k?"MCA":"CAM",k?mca:cam,i*2+dirty,currents[i],targets[i],dirty);
puts("JIMMY_CUTSCENE_ROTATION_COMPLETE");return 0;
}