SanguinettiMods Posted October 5, 2011 Share Posted October 5, 2011 Anybody and all who might have information on how these work and can be modified. Can you please help me? DA XX XX YY BB ZZ ZZ ZZ XX XX = Something, usually 38 00 YY = Something, usually 03 BB = Bank, 0D ZZ ZZ ZZ = Starting offset of data, Perhaps, but relative to what? Link to comment Share on other sites More sharing options...
0 spinout Posted October 5, 2011 Share Posted October 5, 2011 Let's give gbi.h a look... ... #define G_MTX 0xda ... /* * G_MTX: parameter flags */ #ifdef F3DEX_GBI_2 # define G_MTX_MODELVIEW 0x00 /* matrix types */ # define G_MTX_PROJECTION 0x04 # define G_MTX_MUL 0x00 /* concat or load */ # define G_MTX_LOAD 0x02 # define G_MTX_NOPUSH 0x00 /* push or not */ # define G_MTX_PUSH 0x01 #else /* F3DEX_GBI_2 */ ... #define gDma2p(pkt, c, adrs, len, idx, ofs) \ { \ Gfx *_g = (Gfx *)(pkt); \ _g->words.w0 = (_SHIFTL((c),24,8)|_SHIFTL(((len)-1)/8,19,5)| \ _SHIFTL((ofs)/8,8,8)|_SHIFTL((idx),0,8)); \ _g->words.w1 = (unsigned int)(adrs); \ } ... #ifdef F3DEX_GBI_2 # define gSPMatrix(pkt, m, p) \ gDma2p((pkt),G_MTX,(m),sizeof(Mtx),(p)^G_MTX_PUSH,0) http://naesten.dyndns.org:8080/psyq/man/gsp/gSPMatrix.html Link to comment Share on other sites More sharing options...
0 SanguinettiMods Posted October 5, 2011 Author Share Posted October 5, 2011 Thanks, spinout, But I'm not sure how I can put that type of information to use. Could you explain it to me? Link to comment Share on other sites More sharing options...
0 spinout Posted October 5, 2011 Share Posted October 5, 2011 The pointer (don't reference it as bbxxxxxx! just xxxxxxxx! this nasty habit will come to bite you in the ass some day) is a pointer to a matrix. Matrices are very powerful - they can perform translation, rotation, and scaling all in a 4x4 data set, as described in the document I linked to. Internally, OoT uses matrices all over the main display list to correctly scale the map, and position and animate objects. In some cases, however, the actor will set up a matrix in a special segment - above segment 8 - and it is to be used to translate vertices, a well known example being the "cloth" that connects link's limbs. tbh I don't completely understand it myself. Link to comment Share on other sites More sharing options...
0 SanguinettiMods Posted October 5, 2011 Author Share Posted October 5, 2011 The main reason I want to know about them, I'm working on a play As Saria. I wanted to know what data the DA command pointed to, so I can port that data to Link. Saria's Shoulders are broken, and her thighs are broken. http://imagebin.org/176987 Link to comment Share on other sites More sharing options...
0 spinout Posted October 5, 2011 Share Posted October 5, 2011 You're not going to like this answer. I went on a wild goose chase in RAM, and here's what I got for the display list that renders Saria: The "format" of the 0xDB06 commands is: 0xDB0600xx zzzzzzzz x is segment * 4 z is the RAM address of that segment I reference them as 0xDB06 because 0xDB is used for many purposes, but it is only used for setting segments when it is 0xDB06. And a note on this perculiar matrix format: aaaabbbb ccccdddd eeeeffff gggghhhh iiiijjjj kkkkllll mmmmnnnn oooopppp AAAABBBB CCCCDDDD EEEEFFFF GGGGHHHH IIIIJJJJ KKKKLLLL MMMMNNNN OOOOPPPP lowercase are the portion of the number before the decimal point, uppercase/65536 is the portion of the number after the decimal point both are signed. Rows/columns: a = [1,1] b = [1,2] c = [1,3] d = [1,4] e = [2,1] .. h = [2,4] i = [3,1] .. l = [3,4] m = [4,1] .. p = [4,4] ex: [row 1, column 1] = a + (signed short)A/0x10000 The matrix components are as follows: Now, the bad news: This matrix is generated and modified each frame. You can't have it be static in an object file. Link to comment Share on other sites More sharing options...
0 SanguinettiMods Posted October 5, 2011 Author Share Posted October 5, 2011 I wasn't going to try and have it static. I can't just simply port the data? I suppose I'll have to try another method, then. But what's wrong with the thigh DLists? Link to comment Share on other sites More sharing options...
0 spinout Posted October 5, 2011 Share Posted October 5, 2011 If you weren't planning on having it static, what were you planning? Static means - in this case - in the object file. That matrix is usually dynamic - generated each frame. You can't "port" data that is computed each frame. Link to comment Share on other sites More sharing options...
0 SanguinettiMods Posted October 6, 2011 Author Share Posted October 6, 2011 Is there any way to make the data that is computed be the same as Saria's? Link to comment Share on other sites More sharing options...
0 spinout Posted October 6, 2011 Share Posted October 6, 2011 Use Saria's hierarchy + animations + the logic from Saria's actor that sets it all up. Edit: with that matrix set to 0s, saria looks like this: Link to comment Share on other sites More sharing options...
0 SanguinettiMods Posted October 16, 2011 Author Share Posted October 16, 2011 Would Z64tree help at all? Link to comment Share on other sites More sharing options...
0 SoulofDeity Posted September 25, 2012 Share Posted September 25, 2012 I figured this out and noticed this was never actually answered, so I'm gonna post it here: DA Set Matrix Format: [DA ss 00 tt bb oo oo oo] ss - ((size_of_matrix_in_bytes - 1)/4) << 3 bb - bank matrix is stored in oo - offset of matrix tt - instruction/matrix type MODELVIEW = 0x01 PROJECTION = 0x05 LOAD = 0x03 PUSH = 0x00 The matrix itself is always 4x4 in size and composed of half-floats (16-bit floats) Link to comment Share on other sites More sharing options...
0 DeathBasket Posted September 27, 2012 Share Posted September 27, 2012 The matrix components are as follows: I know I am probably going to run in to this sooner or later when/if I start on custom objects, so I may as well ask while this topic is still alive. I have no problem working with matrices from a mathematical perspective but I really don't understand how these are being used in terms of the object file/display list they are applied to. If anyone could give a proper explanation of what each component is for or point me to some more information then that would be really nice. Link to comment Share on other sites More sharing options...
0 SoulofDeity Posted September 28, 2012 Share Posted September 28, 2012 I know I am probably going to run in to this sooner or later when/if I start on custom objects, so I may as well ask while this topic is still alive. I have no problem working with matrices from a mathematical perspective but I really don't understand how these are being used in terms of the object file/display list they are applied to. If anyone could give a proper explanation of what each component is for or point me to some more information then that would be really nice. They're DA instructions are used for multi-matrix transforms, (allowing vertices to be affected by more than 1 transformation matrix), which fills the joints between 2 display lists. Link to comment Share on other sites More sharing options...
Question
SanguinettiModsAnybody and all who might have information on how these work and can be modified. Can you please help me?
DA XX XX YY BB ZZ ZZ ZZ
XX XX = Something, usually 38 00
YY = Something, usually 03
BB = Bank, 0D
ZZ ZZ ZZ = Starting offset of data, Perhaps, but relative to what?
Link to comment
Share on other sites
13 answers to this question
Recommended Posts