Files
pepe_port/datos/convert.cpp

35 lines
693 B
C++

#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
FILE *f = fopen("graf.mif", "rb");
fseek(f, 0, SEEK_END);
int size = ftell(f);
fseek(f, 0, SEEK_SET);
unsigned char *buffer = (unsigned char*)malloc(size);
fread(buffer, size, 1, f);
fclose(f);
unsigned char *p = buffer;
int num_img = *p++;
p += num_img*8;
for (int i=0; i<num_img; ++i)
{
p += 64000;
for (int j=0; j<768; ++j)
{
unsigned char color = *p;
*p = color << 2;
p++;
}
}
f = fopen("graf.mif", "wb");
fwrite(buffer, size, 1, f);
fclose(f);
free(buffer);
return 0;
}