Difference between revisions of "FF7/PSX/Sound/Opcodes/0xb4"

From QhimmWiki
Jump to navigation Jump to search
Qhimm>G
 
Qhimm>G
 
Line 3: Line 3:
Has 3 8-bit parameters.
Has 3 8-bit parameters.


First parameter writes to channel structure at 0x80096608 offset 0x72, in structure parameter is 16-bit wide.


If second parameter is 0x00, it is set to 0x0100 (seems it's some kind of default value). Then this parameter writes to channel structure offset 0x76, in structure parameter is also 16-bit wide.
=== Source ===


Third parameter writes to channel structure at 0x80096608 offset 0x7a, in structure parameter is also 16-bit wide.
// p[x] - parameter x (x counting from 0)


Later there is some mathematics, to be continued... :)
// ch[x] - main channel structure at offset x
 
static const uint32_t b4_table[] =
 
{
    0x8004a044, 0x8004a05c, 0x8004a068, 0x8004a07c,
    0x8004a088, 0x8004a09c, 0x8004a0a8, 0x8004a1e8,
    0x8004a314, 0x8004a39c, 0x8004a23c, 0x8004a2e4,
    0x8004a3c4, 0x8004a39c, 0x8004a314, 0x8004a39c,
    0x00000000, 0x00000000, 0x00000000, 0x00000000,
    0x0000030c, 0x00000000, 0x00000000, 0x00000000,
    0x80138250, 0x00000001, 0x80034420, 0x8003447c,
    0x800344c0, 0x800345bc, 0x80034600, 0x800346f8,
    0x80034754, 0x80034428, 0x80035744, 0x80035430,
    0x80034420, 0x800347b4, 0x800347f8, 0x800348f4,
    0x80034974, 0x80034420, 0x80034444, 0x80034430,
    0x80034420, 0x80034a58, 0x80034a90, 0x00000000,
    0x00000000, 0x00000000, 0x00000000, 0x00000000,
    0x00000000, 0x00000000, 0x00000000, 0x00000000,
    0x00000000, 0x00000000, 0x00000000, 0x00000000,
    0xc000c000, 0xc000c000, 0xc000c000, 0xc000c000,
    0xc000c000, 0xc000c000, 0xc000c000, 0xc000c000,
    0xc000c000, 0xc000c000, 0xc000c000, 0xc000c000
};
 
void OpcodeB4(uint8_t *ch, uint8_t *p)
 
{
    ch[0x18] = p[2] < 0x48 ? b4_table[p[2]] : 0x00;
 
    ch[0x38] |= 1;
 
    if(ch[0x54])
    {
        ch[0x72] = 0x00;
 
        if(p[0])
            ch[0x7E] = p[0] << 8;
    }
    else
        ch[0x72] = p[0];
 
    ch[0x74] = ch[0x72];
 
    ch[0x76] = p[1] ? p[1] : 0x100;
 
    ch[0x78] = 0x01;
 
    ch[0x7A] = p[2];
 
    ch[0x7C] = (((ch[0x7e] & 0x7F00) >> 8) *
        (ch[0x7e] & 0x8000 ? ch[0x30] :
        ((ch[0x30] * 15) / 256))) >> 7;
}

Latest revision as of 17:24, 29 September 2007

0xB4 (Unknown Yet)

Has 3 8-bit parameters.


Source

// p[x] - parameter x (x counting from 0)

// ch[x] - main channel structure at offset x

static const uint32_t b4_table[] =

{

   0x8004a044, 0x8004a05c, 0x8004a068, 0x8004a07c,
   0x8004a088, 0x8004a09c, 0x8004a0a8, 0x8004a1e8,
   0x8004a314, 0x8004a39c, 0x8004a23c, 0x8004a2e4,
   0x8004a3c4, 0x8004a39c, 0x8004a314, 0x8004a39c,
   0x00000000, 0x00000000, 0x00000000, 0x00000000,
   0x0000030c, 0x00000000, 0x00000000, 0x00000000,
   0x80138250, 0x00000001, 0x80034420, 0x8003447c,
   0x800344c0, 0x800345bc, 0x80034600, 0x800346f8,
   0x80034754, 0x80034428, 0x80035744, 0x80035430,
   0x80034420, 0x800347b4, 0x800347f8, 0x800348f4,
   0x80034974, 0x80034420, 0x80034444, 0x80034430,
   0x80034420, 0x80034a58, 0x80034a90, 0x00000000,
   0x00000000, 0x00000000, 0x00000000, 0x00000000,
   0x00000000, 0x00000000, 0x00000000, 0x00000000,
   0x00000000, 0x00000000, 0x00000000, 0x00000000,
   0xc000c000, 0xc000c000, 0xc000c000, 0xc000c000,
   0xc000c000, 0xc000c000, 0xc000c000, 0xc000c000,
   0xc000c000, 0xc000c000, 0xc000c000, 0xc000c000

};

void OpcodeB4(uint8_t *ch, uint8_t *p)

{

   ch[0x18] = p[2] < 0x48 ? b4_table[p[2]] : 0x00;
   ch[0x38] |= 1;
   if(ch[0x54])
   {
       ch[0x72] = 0x00;
       if(p[0])
           ch[0x7E] = p[0] << 8;
   }
   else
       ch[0x72] = p[0];
   ch[0x74] = ch[0x72];
   ch[0x76] = p[1] ? p[1] : 0x100;
   ch[0x78] = 0x01;
   ch[0x7A] = p[2];
   ch[0x7C] = (((ch[0x7e] & 0x7F00) >> 8) *
       (ch[0x7e] & 0x8000 ? ch[0x30] :
       ((ch[0x30] * 15) / 256))) >> 7;

}