예제 #1
0
void DB2TableModel::loadDB2(DB2Header *header, QFile *f)
{
    fieldCount = header->hdr.field_count;
    recordCount = header->hdr.record_count;
    recordSize = header->hdr.record_size;
    stringTableSize = header->hdr.string_table_size;
    dataLen = recordCount * recordSize;
    dbbuild = header->build;

    QAbstractTableModel::beginResetModel();

    if (header->max_id > 0)
    {
        indices = new quint32[header->max_id - header->min_id + 1];
        f->read((char*)indices, (header->max_id - header->min_id + 1) * sizeof(quint32));

        string_lengths = new quint16[header->max_id - header->min_id + 1];
        f->read((char*)string_lengths, (header->max_id - header->min_id + 1) * sizeof(quint16));
    }

    dataTable = new quint8[dataLen];
    f->read((char*)dataTable, dataLen);

    string_block = new quint8[header->hdr.string_table_size];
    f->read((char*)string_block, header->hdr.string_table_size);

    for (int i = 0; i < fieldCount; i++)
    {
        format += (i == 0 ? "n" : "i");
    }
    fillOffsets();
    QAbstractTableModel::endResetModel();
}
예제 #2
0
void Troll::init() {
    _vm->_picture->setPictureVersion(AGIPIC_V15);
    //SetScreenPar(320, 200, (char*)ibm_fontdata);

    const int gaps[] = { 0x3A40,  0x4600,  0x4800,  0x5800,  0x5a00,  0x6a00,
                         0x6c00,  0x7400,  0x7600,  0x7c00,  0x7e00,  0x8e00,
                         0x9000,  0xa000,  0xa200,  0xb200,  0xb400,  0xc400,
                         0xc600,  0xd600,  0xd800,  0xe800,  0xea00,  0xfa00,
                         0xfc00,  0x10c00, 0x10e00, 0x11e00, 0x12000, 0x13000
                       };

    Common::File infile;
    if (!infile.open(IDA_TRO_BINNAME))
        return;

    _gameData = (byte *)malloc(0xD9C0);

    bool flip = true;
    byte *ptr = _gameData;
    int diff;

    for (int i = 0; i < ARRAYSIZE(gaps) - 1; i++) {
        diff = gaps[i + 1] - gaps[i];

        if (flip) {
            infile.seek(gaps[i]);
            infile.read(ptr, diff);
            ptr += diff;
        } else {
        }
        flip = !flip;
    }

    // One sector is off
    infile.seek(0x18470);
    infile.read(_gameData + 15632, 592);

    infile.close();

    fillOffsets();
}
예제 #3
0
void DB2TableModel::loadDBC(DBCHeader *header, QFile *f)
{
    fieldCount = header->field_count;
    recordCount = header->record_count;
    recordSize = header->record_size;
    stringTableSize = header->string_table_size;
    dataLen = recordCount * recordSize;

    QAbstractTableModel::beginResetModel();
    dataTable = new quint8[dataLen];
    f->read((char*)dataTable, dataLen);

    string_block = new quint8[header->string_table_size];
    f->read((char*)string_block, header->string_table_size);

    for (int i = 0; i < fieldCount; i++)
    {
        format += (i == 0 ? "n" : "i");
    }
    fillOffsets();
    QAbstractTableModel::endResetModel();
}
예제 #4
0
파일: tc.c 프로젝트: adobe-type-tools/afdko
/* Fill font set from PostScript font files */
static void fillSet(tcCtx g) {
    tcprivCtx h = g->ctx.tcpriv;
    int duplicate;
    int i;
    Font *last;

    /* Sort set by font name */
    qsort(h->set.array, h->set.cnt, sizeof(Font), cmpFontNames);

    /* Check for duplicate fonts */
    duplicate = 0;
    last = &h->set.array[0];
    for (i = 1; i < h->set.cnt; i++) {
        Font *curr = &h->set.array[i];
        if (strcmp(curr->FontName, last->FontName) == 0) {
            if (g->cb.message != NULL) {
                /* Report duplicate FontNames */
                char text[513];
                sprintf(text, "--- duplicate FontName: %s, files:",
                        curr->FontName);
                g->cb.message(g->cb.ctx, tcERROR, text);
                g->cb.message(g->cb.ctx, tcERROR, last->filename);
                g->cb.message(g->cb.ctx, tcERROR, curr->filename);
            }
            duplicate = 1;
        }
        last = curr;
    }
    if (duplicate) {
        if (g->cb.message != NULL) {
            g->cb.message(g->cb.ctx, tcFATAL, "aborting because of errors");
        }
        g->cb.fatal(g->cb.ctx);
    }

    /* Handle synthetic fonts */
    for (i = 0; i < h->set.cnt; i++) {
        Font *font = &h->set.array[i];

        if (font->flags & FONT_SYNTHETIC) {
            Font *base = (Font *)bsearch(font->synthetic.baseName,
                                         h->set.array, h->set.cnt,
                                         sizeof(Font), matchFontName);
            font->iEncoding = font->synthetic.iEncoding;
            if (base == NULL) {
                /* No synthetic base font; make conventional font */
                dnaFREE(font->synthetic.dict);
                font->flags &= ~FONT_SYNTHETIC;
            } else {
                /* Synthetic base found: make synthetic font */
                csFreeFont(g, font);
                dnaFREE(font->Private);
                font->Private.cnt = 0;

                /* Build new dict with SyntheticBase op first */
                font->dict.cnt = 0;
                dictSaveInt(&font->dict, base - h->set.array);
                DICTSAVEOP(font->dict, cff_SyntheticBase);

                /* Append the other synthetic ops to dict */
                COPY(dnaEXTEND(font->dict, font->synthetic.dict.cnt),
                     font->synthetic.dict.array, font->synthetic.dict.cnt);

                dnaFREE(font->synthetic.dict);
            }
            MEM_FREE(g, font->synthetic.baseName);
        }
    }

#if TC_SUBR_SUPPORT
    if (g->flags & TC_SUBRIZE) {
        subrSubrize(g, h->set.cnt, h->set.array);
    }
#endif /* TC_SUBR_SUPPORT */

    if (t13CheckAuth(g, &h->set.array[0]) && h->set.cnt != 1) {
        tcFatal(g, "authentication applied to multiple fonts");
    }

    h->size.encodings = encodingFill(g);
    h->size.charsets = charsetFill(g);
    h->size.strings = sindexSize(g);

    h->size.FDSelects = fdselectFill(g);

    fillOffsets(h);

    h->FontSet.size = h->offset.copyright +
                      ((h->copyright == NULL) ? 0 : strlen(h->copyright));
}