示例#1
0
Cvirtual_binary shp_file_write(const byte* s, int cx, int cy, int c_images)
{
    Cvirtual_binary d;
    const byte* r = s;
    byte* w = d.write_start(sizeof(t_shp_ts_header) + (sizeof(t_shp_ts_image_header) + cx * cy) * c_images);
    t_shp_header& header = *reinterpret_cast<t_shp_header*>(w);
    header.c_images = c_images;
    header.unknown1 = 0;
    header.unknown2 = 0;
    header.cx = cx;
    header.cy = cy;
    header.unknown3 = 0;
    w += sizeof(t_shp_header);
    int* index = reinterpret_cast<int*>(w);
    w += 8 * (c_images + 2);
    for (int i = 0; i < c_images; i++)
    {
        *index++ = 0x80000000 | w - d.data();
        *index++ = 0;
        w += encode80(r, w, cx * cy);
        r += cx * cy;
    }
    *index++ = w - d.data();
    *index++ = 0;
    *index++ = 0;
    *index++ = 0;
    d.size(w - d.data());
    return d;
}
示例#2
0
int cps_file_write(const byte* s, byte* d, const t_palet_entry* palet)
{
	byte* w = d;
	t_cps_header& header = *reinterpret_cast<t_cps_header*>(w);
	header.unknown = 4;
	header.image_size = 320 * 200;
	header.zero = 0;
	header.palet_size = palet ? sizeof(t_palet) : 0;
	w += sizeof(t_cps_header);
	if (palet)
	{
		memcpy(w, palet, sizeof(t_palet));
		w += sizeof(t_palet);
	}
	w += encode80(s, w, 320 * 200);
	header.size = w - d - 2;
	return w - d;
}