nx_gltf_pose_fixture_emit_t316.nx source
↩ module page · 43 lines · 1463 B
1import "nx_syscalls.nx"
2const FX_PACKET_WORDS:i64=81
3const FX_REF_WORDS:i64=36
4const FX_MODE:i64=0x1a4
5
6func fx_identity(a:*i64,off:i64,val:i64)->i64{
7 var i:i64=0
8 while i<16{a[off+i]=0;i=i+1}
9 a[off]=val;a[off+5]=val;a[off+10]=val;a[off+15]=val
10 return 0
11}
12func fx_write(path:*u8,data:*i64,words:i64)->i64{
13 let fd:i64=sys_openat_wr(path,FX_MODE)
14 if fd<0{return fd}
15 let n:i64=sys_write(fd,data as *u8,words*8)
16 sys_close(fd)
17 if n!=words*8{return -1}
18 return 0
19}
20func main(argc:i64,argv:*i64)->i64{
21 let p:*i64=sys_mmap(FX_PACKET_WORDS*8) as *i64
22 var i:i64=0
23 while i<FX_PACKET_WORDS{p[i]=0;i=i+1}
24 p[0]=0x47504131;p[1]=1;p[2]=FX_PACKET_WORDS;p[3]=1;p[4]=1;p[5]=1;p[6]=100;p[7]=1048576;p[8]=1073741824
25 p[9]=20;p[10]=21;p[11]=31;p[12]=47;p[13]=48;p[14]=49;p[15]=65;p[16]=73;p[19]=0
26 p[20]=0-1
27 p[27]=1073741824;p[28]=1073741824;p[29]=1073741824;p[30]=1073741824
28 fx_identity(p,31,1048576)
29 p[47]=0;p[48]=0
30 fx_identity(p,49,1048576)
31 p[65]=0;p[66]=1;p[67]=0;p[68]=2;p[69]=73;p[70]=75;p[71]=3;p[72]=0
32 p[73]=0;p[74]=100
33 let rc1:i64=fx_write("knowledge/fixtures/gltf_pose_packet_t316_v1.bin",p,FX_PACKET_WORDS)
34 if rc1!=0{return 3}
35 let r:*i64=sys_mmap(FX_REF_WORDS*8) as *i64
36 i=0
37 while i<FX_REF_WORDS{r[i]=0;i=i+1}
38 r[0]=2;r[1]=1;r[2]=0;fx_identity(r,3,1073741824);r[19]=50;fx_identity(r,20,1073741824)
39 r[18]=1048576;r[35]=1048576
40 let rc2:i64=fx_write("knowledge/fixtures/gltf_pose_reference_t316_v1.bin",r,FX_REF_WORDS)
41 if rc2!=0{return 4}
42 return 0
43}