Пример #1
0
int32_t AssetManager::ReadEncInt32(Stream *ci_s)
{
    int numberRead;
    ReadEncArray(&numberRead, 4, 1, ci_s);
#if defined(AGS_BIG_ENDIAN)
    AGS::Common::BitByteOperations::SwapBytesInt32(numberRead);
#endif
    return numberRead;
}
Пример #2
0
int32_t MFLUtil::ReadEncInt32(Stream *in, int &rand_val)
{
    int val;
    ReadEncArray(&val, sizeof(int32_t), 1, in, rand_val);
#if defined(AGS_BIG_ENDIAN)
    AGS::Common::BitByteOperations::SwapBytesInt32(val);
#endif
    return val;
}
Пример #3
0
AssetError AssetManager::ReadAssetLibV21(MultiFileLib * mfl, Stream *ci_s, int libver)
{
    // init randomizer
    int randSeed = ci_s->ReadInt32();
    _InitPseudoRand(randSeed + _encryptionRandSeed);
    // number of clib parts
    mfl->num_data_files = ReadEncInt32(ci_s);
    // filenames for all clib parts
    for (int i = 0; i < mfl->num_data_files; i++)
    {
        ReadEncString(mfl->data_filenames[i], 50, ci_s);
    }
    // number of files in clib
    mfl->num_files = ReadEncInt32(ci_s);
    if (mfl->num_files > MAX_FILES)
    {
        return kAssetErrLibAssetCount; // too many files in clib, return error code
    }

    // read information on clib contents
    for (int i = 0; i < mfl->num_files; i++)
    {
        ReadEncString(mfl->filenames[i], 100, ci_s);
    }

    for (int i = 0; i < mfl->num_files; i++)
    {
        mfl->offset[i] = ReadEncInt32(ci_s);
    }

    for (int i = 0; i < mfl->num_files; i++)
    {
        mfl->length[i] = ReadEncInt32(ci_s);
    }

    ReadEncArray(&mfl->file_datafile[0], 1, mfl->num_files, ci_s);
    return kAssetNoError;
}