46 lines
2.5 KiB
C
46 lines
2.5 KiB
C
/* Original OMT compute_hxform only. Execute in an isolated copied install;
|
|
synthetic element/parent and zero dynamic offset, no renderer/game entrypoint. */
|
|
#include <windows.h>
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#define TC __attribute__((thiscall))
|
|
typedef void (TC *compute_fn)(void*,void*,void*);
|
|
static unsigned char element[512];static uintptr_t table[128];static compute_fn matrix;
|
|
static void TC offset(void*self,float*x,float*y,float*z){(void)self;*x=*y=*z=0;}
|
|
static void require(int ok,const char*label){if(!ok){fprintf(stderr,"FAIL %s\n",label);exit(2);}}
|
|
static void one(compute_fn compute,const char*name,int ax,int ay,int az,float px,float py,float pz){
|
|
float parent[15]={1,0,0,0,0,1,0,0,0,0,1,0,0,0,0},out[15];
|
|
memset(element,0,sizeof(element));*(void**)element=table;
|
|
*(float*)(element+0x44)=px;*(float*)(element+0x48)=py;*(float*)(element+0x4c)=pz;
|
|
*(int16_t*)(element+0x50)=ax;*(int16_t*)(element+0x52)=ay;*(int16_t*)(element+0x54)=az;
|
|
for(int i=0;i<15;i++)out[i]=-999;
|
|
compute(element,parent,out);
|
|
printf("MODEL %s in=%d,%d,%d,%.9g,%.9g,%.9g out=",name,ax,ay,az,px,py,pz);
|
|
for(int i=0;i<15;i++)printf("%s%.9g",i?",":"",out[i]);puts("");
|
|
float model[17];for(int i=0;i<17;i++)model[i]=-999;matrix(element,out,model);
|
|
printf("MATRIX %s out=",name);for(int i=0;i<16;i++)printf("%s%.9g",i?",":"",model[i]);printf(",%d\n",*(int*)(model+16));
|
|
}
|
|
int main(void){
|
|
setbuf(stdout,NULL);HMODULE h=LoadLibraryA("Z:\\work\\game\\OMT2.dll");require(h!=NULL,"copied OMT load");
|
|
compute_fn f=(compute_fn)GetProcAddress(h,"?compute_hxform@OMediaElement@@UAEXAAVOMediaRenderHTransform@@0@Z");require(f!=NULL,"export");
|
|
matrix=(compute_fn)GetProcAddress(h,"?compute_model_matrix@OMediaElement@@UAEXAAVOMediaRenderHTransform@@AAVOMediaMatrix_4x4@@@Z");require(matrix!=NULL,"model export");
|
|
table[0x7c/4]=(uintptr_t)offset;
|
|
one(f,"upright",0,0,0,100,75.9f,-200);
|
|
one(f,"pitch90",4096,0,0,100,75.9f,-200);
|
|
one(f,"yaw90",0,4096,0,100,75.9f,-200);
|
|
one(f,"roll90",0,0,4096,100,75.9f,-200);
|
|
one(f,"air_forward",14564,2048,15702,100,500,-200);
|
|
one(f,"air_brake",455,2048,682,100,500,-200);
|
|
one(f,"full_axes",1365,2503,910,-123.5f,811.25f,70.125f);
|
|
one(f,"negative_units",-1820,-2048,-682,-123.5f,811.25f,70.125f);
|
|
one(f,"seam",16383,16383,16383,0,0,0);
|
|
one(f,"canonical360",16384,16384,16384,0,0,0);
|
|
one(f,"halfturn",8192,8192,8192,0,0,0);
|
|
one(f,"tiny",1,2,3,0,0,0);
|
|
one(f,"zero_root",14564,2048,15702,0,0,0);
|
|
one(f,"other_root",14564,2048,15702,1000,1011.25f,-2500);
|
|
puts("JIMMY_MODEL_BRIDGE_COMPLETE");return 0;
|
|
}
|