コード例 #1
0
ファイル: xgmcom.c プロジェクト: feli7254/SGDK
static XGMCommand* XGMCommand_createPSGCommand(List* commands, int* offset)
{
    const int size = min(16, commands->size - *offset);
    unsigned char* data = malloc(size + 1);
    int i, off;

    data[0] = XGM_PSG | (size - 1);

    off = 1;
    for (i = 0; i < size; i++)
        data[off++] = VGMCommand_getPSGValue(getFromList(commands, i + *offset));

    // remove elements we have done
    *offset += size;

    return XGMCommand_create(data, size + 1);
}
コード例 #2
0
ファイル: xgmcom.c プロジェクト: luciano2000/SGDK
static XGMCommand* XGMCommand_createPSGCommand(LList** pcommands)
{
    LList* curCom = *pcommands;
    const int size = min(16, getSizeLList(curCom));
    unsigned char* data = malloc(size + 1);
    int i, off;

    data[0] = XGM_PSG | (size - 1);

    off = 1;
    for (i = 0; i < size; i++)
    {
        data[off++] = VGMCommand_getPSGValue(curCom->element);
        curCom = curCom->next;
    }

    // update list pointer to remove elements we have done
    *pcommands = curCom;

    return XGMCommand_create(data, size + 1);
}