2

So I have something like:

                     *************************************************************
                     * SYS_DRAW_BATCH_RUNS_DATA::Set(matrix4 const*, RECTF con  ..
                     *************************************************************
                     undefined  __thiscall  SYS_DRAW_BATCH_RUNS_DATA_Set (void 
     undefined         r3:1           <RETURN>
     void *            r3:4 (auto)    this
     matrix4 *         r4:4           param_1
     RECTF *           r5:4           param_2
     SYS_DRAW_QUALI    r6:4           param_3
     SYS_DRAW_RUN *    r7:4           param_4
     uint              r8:4           param_5
     SYS_DRAW_MATER    r9:4           param_6
     uint              r10:4          param_7
     astruct_952       Stack[0x38]:32 param_8                                 XREF[1,7]:   00175b18 (R) , 
                                                                                           00175b1c (R) , 
                                                                                           00175b20 (R) , 
                                                                                           00175b24 (R) , 
                                                                                           00175b28 (R) , 
                                                                                           00175b2c (R) , 
                                                                                           00175b30 (R) , 
                                                                                           00175b34 (R)   
     uint              Stack[0x58]:4  param_9
     uint              Stack[0x5c]:4  param_10
     SYS_D3D_IB_BAS    Stack[0x60]:4  param_11
     SYS_D3D_VB_BAS    Stack[0x64]:4  param_12
     FuncDef30 *       Stack[0x68]:4  param_13
     void *            Stack[0x6c]:4  param_14
     SYS_DRAW_BUFFE    Stack[0x70]:4  param_15
     undefined4        Stack[0x8]:4   local_res8                              XREF[2]:     00175b10 (W) , 
                                                                                           00175b84 (R)   
     undefined4        Stack[-0x3c]:4 local_3c                                XREF[2]:     00175aec (W) , 
                                                                                           00175b90 (R)   
     undefined4        Stack[-0x4c]:4 local_4c                                XREF[1]:     00175b7c (W)   
     undefined4        Stack[-0x50]:4 local_50                                XREF[1]:     00175b78 (W)   
     undefined4        Stack[-0x54]:4 local_54                                XREF[1]:     00175b74 (W)   
     undefined4        Stack[-0x58]:4 local_58                                XREF[1]:     00175b70 (W)   
     undefined4        Stack[-0x90]:4 local_90                                XREF[1]:     00175b14 (W)   
                     __ZN24SYS_DRAW_BATCH_RUNS_DATA3SetEPK7matrix4P  XREF[4]:     Entry Point (*) , 
                     SYS_DRAW_BATCH_RUNS_DATA_Set                                 DrawRoom_Rooms_FF_TSS:000fed58 (
                                                                                  DrawRoom_Meshes_FF_TSS:000ff168
                                                                                  SYS_DRAW_CHAR_BATCH_RUNS_DATA_SY
00175ae8 7c  08  02  a6    mfspr      r0,LR
00175aec be  21  ff  c4    stmw       r17 ,local_3c (r1)
00175af0 28  04  00  00    cmplwi     param_1 ,0x0
00175af4 7c  71  1b  78    or         r17 ,this ,this
00175af8 7c  b2  2b  78    or         r18 ,param_2 ,param_2
00175afc 7c  d3  33  78    or         r19 ,param_3 ,param_3
00175b00 7c  f4  3b  78    or         r20 ,param_4 ,param_4
00175b04 7d  15  43  78    or         r21 ,param_5 ,param_5
00175b08 7d  36  4b  78    or         r22 ,param_6 ,param_6
00175b0c 7d  57  53  78    or         r23 ,param_7 ,param_7
00175b10 90  01  00  08    stw        r0,local_res8 (r1)
00175b14 94  21  ff  70    stwu       r1,local_90 (r1)
00175b18 83  01  00  c8    lwz        r24 ,param_8.param_8 (r1)
00175b1c 83  21  00  cc    lwz        r25 ,param_8.param_9 (r1)
00175b20 83  41  00  d0    lwz        r26 ,param_8.param_10 (r1)
00175b24 83  61  00  d4    lwz        r27 ,param_8.param_11 (r1)
00175b28 83  81  00  d8    lwz        r28 ,param_8.param_12 (r1)
00175b2c 83  a1  00  dc    lwz        r29 ,param_8.param_13 (r1)
00175b30 83  c1  00  e0    lwz        r30 ,param_8.param_14 (r1)
00175b34 83  e1  00  e4    lwz        r31 ,param_8.param_15 (r1)
00175b38 41  82  00  0c    beq        LAB_00175b44
00175b3c 38  71  00  40    addi       this ,r17 ,0x40
00175b40 4b  ff  39  39    bl         matrix4_assignment                               undefined matrix4_assignment(voi
                     LAB_00175b44                                    XREF[1]:     00175b38 (j)   
00175b44 92  51  00  80    stw        r18 ,0x80 (r17 )
00175b48 7e  23  8b  78    or         this ,r17 ,r17
00175b4c 7e  64  9b  78    or         param_1 ,r19 ,r19
00175b50 7e  c5  b3  78    or         param_2 ,r22 ,r22
00175b54 92  91  00  84    stw        r20 ,0x84 (r17 )
00175b58 7e  e6  bb  78    or         param_3 ,r23 ,r23
00175b5c 7f  07  c3  78    or         param_4 ,r24 ,r24
00175b60 7f  28  cb  78    or         param_5 ,r25 ,r25
00175b64 92  b1  00  88    stw        r21 ,0x88 (r17 )
00175b68 7f  49  d3  78    or         param_6 ,r26 ,r26
00175b6c 7f  6a  db  78    or         param_7 ,r27 ,r27
00175b70 93  81  00  38    stw        r28 ,local_58 (r1)
00175b74 93  a1  00  3c    stw        r29 ,local_54 (r1)
00175b78 93  c1  00  40    stw        r30 ,local_50 (r1)
00175b7c 93  e1  00  44    stw        r31 ,local_4c (r1)
00175b80 48  00  00  19    bl         SYS_DRAW_BATCH_DATA_Set                          undefined SYS_DRAW_BATCH_DATA_Se
00175b84 80  01  00  98    lwz        r0,local_res8 (r1)
00175b88 38  21  00  90    addi       r1,r1,0x90
00175b8c 7c  08  03  a6    mtspr      LR,r0
00175b90 ba  21  ff  c4    lmw        r17 ,local_3c (r1)
00175b94 4e  80  00  20    blr

Which decompiles to:

/* SYS_DRAW_BATCH_RUNS_DATA::Set(matrix4 const*, RECTF const*, SYS_DRAW_QUALITY, SYS_DRAW_RUN
   const*, unsigned int, SYS_DRAW_MATERIAL_POOL const*, unsigned int, unsigned int, unsigned int,
   unsigned int, SYS_D3D_IB_BASE*, SYS_D3D_VB_BASE*, void (*)(SYS_D3D_DEVICE*, SYS_DRAW_BATCH
   const&, SYS_DRAW_BATCH_RUN const&, void const*, unsigned short*), void*, SYS_DRAW_BUFFER_DEVICE* )
    */

void __thiscall
SYS_DRAW_BATCH_RUNS_DATA_Set
          (void *this,matrix4 *param_1,RECTF *param_2,SYS_DRAW_QUALITY param_3,SYS_DRAW_RUN *param _4
          ,uint param_5,SYS_DRAW_MATERIAL_POOL *param_6,uint param_7,astruct_952 param_8,
          uint param_9,uint param_10,SYS_D3D_IB_BASE *param_11,SYS_D3D_VB_BASE *param_12,
          FuncDef30 *param_13,void *param_14,SYS_DRAW_BUFFER_DEVICE *param_15)

{
  FuncDef31 *in_stack_ffffffb8;
  void *in_stack_ffffffbc;
  SYS_DRAW_BUFFER_DEVICE *in_stack_ffffffc0;
  
  if (param_1 != (matrix4 *)0x0) {
    matrix4_assignment((void *)((int)this + 0x40),param_1);
  }
  *(RECTF **)((int)this + 0x80) = param_2;
  *(SYS_DRAW_RUN **)((int)this + 0x84) = param_4;
  *(uint *)((int)this + 0x88) = param_5;
  SYS_DRAW_BATCH_DATA_Set
            (this,param_3,param_6,param_7,param_8.param_8,param_8.param_9,param_8.param_10,
             param_8.param_11,SUB3216(param_8,0),in_stack_ffffffb8,in_stack_ffffffbc,
             in_stack_ffffffc0);
  return;
}

Now obviously something is wrong here but I don't understand what - first of all SUB321 expands in export to like:

CONCAT284(CONCAT244(CONCAT204(CONCAT164(CONCAT124(CONCAT84(CONCAT44(param_8.param_8, param_5),param_6), param_8.param_9),param_8.param_10), param_8.param_11),param_8.param_12),param_8.param_13)

And second of all those in_stack_ shouldn't be there for sure.

Any ideas what could be the issue and how can I fix it?

I'm running a Mach-O G2 Big Endian Altivec binary.

Thanks in advance.

1
  • Param 8 looks suspicious, did you maybe mean to pass a pointer or it's actually the struct?
    – mumbel
    Aug 9, 2022 at 5:03

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.