Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <string>
- #include <iostream>
- using namespace std;
- using namespace System;
- using namespace System::Drawing;
- typedef struct pixel_t {
- unsigned char r, g, b;
- } pixel_t;
- #define COSE 9
- int sizes[COSE][2] = {
- {64, 768},
- {64, 128},
- {256, 32},
- {256, 32},
- {256, 32},
- {256, 32},
- {256, 64},
- {256, 96},
- {800, 600},
- };
- typedef struct roba_t {
- char unk1[4];
- int size;
- char unk2[71];
- int dsize;
- pixel_t* cose[COSE];
- struct roba_t() {
- cout << "Robo?" << endl;
- for (int i = 0; i < COSE; ++i) {
- this->cose[i] = new pixel_t[sizes[i][0] * sizes[i][1]];
- }
- cout << "Robo!" << cose[0]<< endl;
- }
- } roba_t;
- roba_t* readFile(string fname) {
- roba_t* ret = new roba_t;
- ifstream f;
- const char* fc = fname.c_str();
- f.open(fc, ios::binary);
- f.read(ret->unk1, 4);
- f.read((char*)&ret->size, 4);
- cout << "Data size: " << ret->size << endl;
- f.read(ret->unk2, 72);
- cout << ret->cose[0] << endl;
- f.read((char*)ret->cose[0], sizes[0][0] * sizes[0][1] * 3);
- cout << "OK" << endl;
- f.read((char*)ret->cose[1], sizes[1][0] * sizes[1][1] * 3);
- f.seekg(1, ios::cur);
- f.read((char*)ret->cose[2], sizes[2][0] * sizes[2][1] * 3);
- f.seekg(67, ios::cur);
- f.read((char*)ret->cose[3], sizes[3][0] * sizes[3][1] * 3);
- f.read((char*)ret->cose[4], sizes[4][0] * sizes[4][1] * 3);
- f.read((char*)ret->cose[5], sizes[5][0] * sizes[5][1] * 3);
- f.read((char*)ret->cose[6], sizes[6][0] * sizes[6][1] * 3);
- f.read((char*)ret->cose[7], sizes[7][0] * sizes[7][1] * 3);
- f.seekg(128 * 6 + 108 * 3, ios::cur);
- for (int i = 0; i < sizes[8][1]; ++i) {
- f.read((char*)&ret->cose[8][i*sizes[8][0]], sizes[8][0] * 3);
- f.seekg(5, ios::cur);
- }
- return ret;
- }
- void printabitta(System::String ^fname, pixel_t* data, int w, int h) {
- cout << "Printabitto " << endl;
- Bitmap b(w, h);
- for (int i = 0; i < h; ++i) {
- for (int j = 0; j < w; ++j) {
- pixel_t* p = &data[i*w + j];
- b.SetPixel(j, h-i-1, Color::FromArgb(p->r, p->g, p->b));
- }
- }
- b.Save(fname);
- }
- int main(int argc, char* argv[]) {
- roba_t* r = readFile("D:\\Desktop\\Disney Interactive\\Toy Story 2\\data\\gfx\\bonus.ngn");
- for (int i = 0; i < COSE; ++i) {
- printabitta("roba" + System::Convert::ToString(i+1) + ".bmp", r->cose[i], sizes[i][0], sizes[i][1]);
- }
- char c;
- cin >> c;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement