XeNTaX Forum Index
Forum MultiEx Commander Tools Tools Home
It is currently Thu Oct 19, 2017 3:45 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Mafia 3 vertex restore from shader code
PostPosted: Mon Apr 17, 2017 9:20 am 
Offline
advanced

Joined: Wed Nov 28, 2012 11:55 am
Posts: 77
Has thanked: 0 time
Have thanks: 64 times

Hi.

In mafia3 game vertexes are packed to bytes, not floats as usally.
Can somebody identify pack algotithm and convert bytes to floats?

Code:
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue Format   Used
// -------------------- ----- ------ -------- -------- ------ ------
// POSITION                 0   xyzw        0     NONE   uint   xyzw
// TANGENT                  0   xyzw        1     NONE   uint   xy 
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue Format   Used
// -------------------- ----- ------ -------- -------- ------ ------
// SV_Position              0   xyzw        0      POS  float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[4], immediateIndexed
dcl_constantbuffer cb1[31], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xy
dcl_output_siv o0.xyzw, position
dcl_temps 3


utof r0.xy, v1.xyxx                             r0.xyyy = (float)v1.xyxx

ge r0.w, r0.y, l(128.000000)                    if (r0.y >= 128.0){r0.w=0xFFFFFFFF} else {r0.w=0x0000000}

movc r0.w, r0.w, l(-128.000000), l(-0.000000)   if (r0.w){r0.w = -128.0} else {r0.w = -0.0}

add r0.z, r0.w, r0.y                            r0.z = r0.w + r0.y


mul r0.yw, cb0[0].wwww, l(0.000000, 1.000000, 0.000000, 256.000000)  r0.yw = (cb0[0].wwww, * l(0.000000, 1.000000, 0.000000, 256.000000))


dp2 r1.z, r0.xzxx, r0.ywyy                     r1.zzzz = (r0.x * r0.y) + (r0.z * r0.w)


utof r2.xyzw, v0.xyzw                          r2.xyzw = (float)v0.xyzw
dp2 r1.x, r2.xyxx, r0.ywyy                     r1.xxxx = (r2.x*r0.y) + (r2.y*r0.w)
dp2 r1.y, r2.zwzz, r0.ywyy                     r1.yyyy = (r2.z*r0.y) + (r2.w*r0.w)
add r0.xyz, r1.xyzx, cb0[0].xyzx               r0.xyz = r1.xyzx + cb0[0].xyzx


// Multiplication to MVP matrix??

mov r0.w, l(1.000000)                          r0.w = 1.0
dp4 r1.x, cb0[1].xyzw, r0.xyzw                 r1.xxxx = cb0[1]*r0
dp4 r1.y, cb0[2].xyzw, r0.xyzw                 r1.yyyy = cb0[2]*r0
dp4 r1.z, cb0[3].xyzw, r0.xyzw                 r1.zzzz = cb0[3]*r0
mov r1.w, l(1.000000)                          r1.wwww = 1.0
dp4 o0.x, cb1[27].xyzw, r1.xyzw                oO.xxxx = cb[27]*r1
dp4 o0.y, cb1[28].xyzw, r1.xyzw                oO.yyyy = cb[28]*r1
dp4 o0.z, cb1[29].xyzw, r1.xyzw                oO.zzzz = cb[29]*r1
dp4 o0.w, cb1[30].xyzw, r1.xyzw                oO.wwww = cb[30]*r1
ret
// Approximately 0 instruction slots used


You can make the ads go away by registering




_________________
Have a question about NinjaRipper? Ask on forum, not PM.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group