/* Original-DLL conversion probe. Run only against an isolated COPIED install. * API: collision_mode2_probe.exe [ASE\jimstop.ase] [object_mode=2] [animation_mode=2] * Reads source bytes, converts into in-memory OMT objects/database, prints bounded * geometry/frame-offset summaries. Never writes original asset files. */ #include #include #include #include #include #include #define OMT_THISCALL __attribute__((thiscall)) typedef void *(OMT_THISCALL *ctor0)(void *); typedef void *(OMT_THISCALL *dbctor)(void *, void *); typedef void (OMT_THISCALL *writefn)(void *, void *, unsigned); typedef void (OMT_THISCALL *seekfn)(void *, unsigned, short); typedef void *(OMT_THISCALL *converterctor)(void *, void *, void *); typedef void (OMT_THISCALL *convertfn)(void *); typedef void *(__cdecl *builderfn)(void); typedef void (__cdecl *registerfn)(unsigned, builderfn, long); typedef void *(OMT_THISCALL *getfn)(void *, unsigned, long); typedef float (OMT_THISCALL *magnitudefn)(const void *); static FARPROC required(HMODULE h, const char *name) { FARPROC p=GetProcAddress(h,name); if(!p){fprintf(stderr,"Missing export: %s\n",name);exit(2);} return p; } static void dump_vectors(const char *label, float *begin, float *end) { intptr_t bytes=(intptr_t)end-(intptr_t)begin; if(bytes==0){printf("%s VERTICES 0 (animation-only base may be empty)\n",label);return;} if(!begin || bytes<=0 || bytes%16 || bytes>16000000){ fprintf(stderr,"Unexpected %s vectors: %p..%p (%ld bytes)\n",label,begin,end,(long)bytes);exit(3); } float lo[3]={FLT_MAX,FLT_MAX,FLT_MAX},hi[3]={-FLT_MAX,-FLT_MAX,-FLT_MAX}; for(float *p=begin;phi[i])hi[i]=p[i]; } printf("%s VERTICES %ld\n",label,(long)bytes/16); printf("%s MIN %.9g %.9g %.9g MAX %.9g %.9g %.9g\n",label,lo[0],lo[1],lo[2],hi[0],hi[1],hi[2]); for(int i=0;i<3 && begin+i*41?argv[1]:"ASE\\jimstop.ase"; int object_mode=argc>2?atoi(argv[2]):2,animation_mode=argc>3?atoi(argv[3]):2; if(object_mode<0 || object_mode>2 || animation_mode<0 || animation_mode>3)return 2; FILE *f=fopen(input,"rb");if(!f){perror(input);return 2;} fseek(f,0,SEEK_END);long length=ftell(f);rewind(f); if(length<=0 || length>64000000){fclose(f);return 2;} char *data=malloc(length);if(!data || fread(data,1,length,f)!=(size_t)length){fclose(f);return 2;}fclose(f); HMODULE h=LoadLibraryA("Z:\\work\\game\\OMT2.dll"); if(!h){fprintf(stderr,"LoadLibrary OMT error %lu\n",GetLastError());return 2;} printf("PROBE MODES object=%d animation=%d input=%s\n",object_mode,animation_mode,input); magnitudefn magnitude=(magnitudefn)required(h,"?quick_magnitude@OMedia3DVector@@QBEMXZ"); float vectors[][4]={{0,0,0,0},{10,0,0,0},{3,4,0,0},{-4,0,-3,0},{1,1,1,0}, {500,100,300,0},{.25f,.125f,.75f,0},{1.2345f,678.125f,-90.75f,0}}; for(unsigned i=0;i4096){fputs("Invalid related morph IDs\n",stderr);return 3;} printf("MORPH_DEFINITIONS %ld\n",(long)id_bytes/4); for(long *id=ids;id16384){fputs("Invalid sequence table\n",stderr);return 3;} printf("MORPH_ID %ld SEQUENCES %ld\n",*id,(long)sequence_bytes/4); for(unsigned char **sequence=sequences;sequence4096){fputs("Invalid frame count\n",stderr);return 3;} printf("SEQUENCE_%ld FRAMES %u\n",(long)(sequence-sequences),frame_count); while(node!=sentinel && frame_index