VirtualBox

Ignore:
Timestamp:
May 24, 2011 3:23:48 AM (14 years ago)
Author:
vboxsync
Message:

Audio/HDA: loading V1 saved state. (xTracker/5704).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DevCodec.cpp

    r37185 r37190  
    3232#define CODECNODE_F0_PARAM_LENGTH 0x14
    3333#define CODECNODE_F02_PARAM_LENGTH 16
     34
    3435typedef struct CODECCOMMONNODE
    3536{
     
    18351836}
    18361837
    1837 int codecLoadState(CODECState *pCodecState, PSSMHANDLE pSSMHandle)
    1838 {
    1839     int rc = SSMR3GetMem (pSSMHandle, pCodecState->pNodes, sizeof(CODECNODE) * pCodecState->cTotalNodes);
     1838static DECLCALLBACK(int)codecLoadV1(PCODECState pCodecState, PSSMHANDLE pSSMHandle, size_t cbOffset)
     1839{
     1840    size_t cbRawNodesV1 = (sizeof(CODECNODE) + cbOffset) * pCodecState->cTotalNodes;
     1841    uint8_t *pu8RawNodesV1 = (uint8_t *)RTMemAlloc(cbRawNodesV1);
     1842    uint8_t *pu8NodeV1 = NULL;
     1843    int idxNode = 0;
     1844    if (!pu8RawNodesV1)
     1845        return VERR_NO_MEMORY;
     1846    int rc = SSMR3GetMem (pSSMHandle, pu8RawNodesV1, cbRawNodesV1);
     1847
     1848    if (RT_FAILURE(rc))
     1849    {
     1850        RTMemFree(pu8RawNodesV1);
     1851        AssertRCReturn(rc, rc);
     1852    }
     1853    pu8NodeV1 = &pu8RawNodesV1[0];
     1854    for (idxNode = 0; idxNode < pCodecState->cTotalNodes; ++idxNode)
     1855    {
     1856        pCodecState->pNodes[idxNode].node.id = pu8NodeV1[0];
     1857        memcpy(pCodecState->pNodes[idxNode].node.au32F00_param,
     1858               pu8NodeV1 + RT_OFFSETOF(CODECCOMMONNODE, au32F00_param),
     1859               sizeof(CODECNODE) - RT_OFFSETOF(CODECCOMMONNODE,au32F00_param));
     1860        pu8NodeV1 += sizeof(CODECNODE) + cbOffset;
     1861    }
     1862
     1863    RTMemFree(pu8RawNodesV1);
     1864    return rc;
     1865}
     1866
     1867int codecLoadState(CODECState *pCodecState, PSSMHANDLE pSSMHandle, uint32_t uVersion)
     1868{
     1869    int rc;
     1870    if (uVersion == 1)
     1871    {
     1872#if RT_ARCH_X86
     1873        if (SSMR3HandleHostBits(pSSMHandle) == 32)
     1874            rc = codecLoadV1(pCodecState, pSSMHandle, sizeof(long));
     1875        else
     1876            rc = codecLoadV1(pCodecState, pSSMHandle, sizeof(uint64_t));
     1877#else
     1878        if (SSMR3HandleHostBits(pSSMHandle) == 64)
     1879            rc = codecLoadV1(pCodecState, pSSMHandle, sizeof(long));
     1880        else
     1881            rc = codecLoadV1(pCodecState, pSSMHandle, sizeof(uint32_t));
     1882#endif
     1883    }
     1884    else
     1885        rc = SSMR3GetMem (pSSMHandle, pCodecState->pNodes, sizeof(CODECNODE) * pCodecState->cTotalNodes);
    18401886    if (codecIsDacNode(pCodecState, pCodecState->u8DacLineOut))
    18411887        codecToAudVolume(&pCodecState->pNodes[pCodecState->u8DacLineOut].dac.B_params, AUD_MIXER_VOLUME);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette