aboutsummaryrefslogtreecommitdiff
path: root/devtools
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-06-28 09:32:16 +0200
committerThierry Crozat2019-07-28 15:09:14 +0100
commit8f7b10a5dec7f3f7ca2d422e24d682ea6551fce3 (patch)
treee942d5b0fff3b1e0ebc122f1570a2e1c45e3571e /devtools
parentfbf6a912cbc66b205ee85f32891e36029e386e10 (diff)
downloadscummvm-rg350-8f7b10a5dec7f3f7ca2d422e24d682ea6551fce3.tar.gz
scummvm-rg350-8f7b10a5dec7f3f7ca2d422e24d682ea6551fce3.tar.bz2
scummvm-rg350-8f7b10a5dec7f3f7ca2d422e24d682ea6551fce3.zip
SUPERNOVA: Add tool to create image datafiles.
Diffstat (limited to 'devtools')
-rw-r--r--devtools/create_supernova2/create_image/015/clickfield_info115
-rw-r--r--devtools/create_supernova2/create_image/015/free_tile.xcfbin0 -> 1567 bytes
-rw-r--r--devtools/create_supernova2/create_image/015/image0.bmpbin0 -> 45306 bytes
-rw-r--r--devtools/create_supernova2/create_image/015/image1.bmpbin0 -> 1314 bytes
-rw-r--r--devtools/create_supernova2/create_image/015/image10.bmpbin0 -> 1314 bytes
-rw-r--r--devtools/create_supernova2/create_image/015/image11.bmpbin0 -> 1314 bytes
-rw-r--r--devtools/create_supernova2/create_image/015/image12.bmpbin0 -> 1314 bytes
-rw-r--r--devtools/create_supernova2/create_image/015/image13.bmpbin0 -> 1314 bytes
-rw-r--r--devtools/create_supernova2/create_image/015/image14.bmpbin0 -> 1314 bytes
-rw-r--r--devtools/create_supernova2/create_image/015/image15.bmpbin0 -> 1314 bytes
-rw-r--r--devtools/create_supernova2/create_image/015/image16.bmpbin0 -> 1314 bytes
-rw-r--r--devtools/create_supernova2/create_image/015/image17.bmpbin0 -> 20298 bytes
-rw-r--r--devtools/create_supernova2/create_image/015/image18.bmpbin0 -> 15282 bytes
-rw-r--r--devtools/create_supernova2/create_image/015/image19.bmpbin0 -> 7074 bytes
-rw-r--r--devtools/create_supernova2/create_image/015/image2.bmpbin0 -> 1314 bytes
-rw-r--r--devtools/create_supernova2/create_image/015/image3.bmpbin0 -> 1314 bytes
-rw-r--r--devtools/create_supernova2/create_image/015/image4.bmpbin0 -> 1314 bytes
-rw-r--r--devtools/create_supernova2/create_image/015/image5.bmpbin0 -> 1314 bytes
-rw-r--r--devtools/create_supernova2/create_image/015/image6.bmpbin0 -> 1314 bytes
-rw-r--r--devtools/create_supernova2/create_image/015/image7.bmpbin0 -> 1314 bytes
-rw-r--r--devtools/create_supernova2/create_image/015/image8.bmpbin0 -> 1314 bytes
-rw-r--r--devtools/create_supernova2/create_image/015/image9.bmpbin0 -> 1314 bytes
-rw-r--r--devtools/create_supernova2/create_image/015/palette77
-rw-r--r--devtools/create_supernova2/create_image/015/section_info161
-rw-r--r--devtools/create_supernova2/create_image/README87
-rw-r--r--devtools/create_supernova2/create_image/create_image.cpp178
-rwxr-xr-xdevtools/create_supernova2/create_image/create_ms2_data.015.sh3
-rw-r--r--devtools/create_supernova2/create_image/module.mk10
-rw-r--r--devtools/create_supernova2/module.mk3
29 files changed, 634 insertions, 0 deletions
diff --git a/devtools/create_supernova2/create_image/015/clickfield_info b/devtools/create_supernova2/create_image/015/clickfield_info
new file mode 100644
index 0000000000..14d95f6c83
--- /dev/null
+++ b/devtools/create_supernova2/create_image/015/clickfield_info
@@ -0,0 +1,115 @@
+19
+
+123
+134
+49
+63
+0
+
+135
+146
+49
+63
+0
+
+147
+158
+49
+63
+0
+
+159
+170
+49
+63
+0
+
+171
+182
+49
+63
+0
+
+183
+194
+49
+63
+0
+
+123
+134
+64
+77
+0
+
+135
+146
+64
+77
+0
+
+147
+158
+64
+77
+0
+
+159
+170
+64
+77
+0
+
+171
+182
+64
+77
+0
+
+183
+194
+64
+77
+0
+
+135
+146
+78
+91
+0
+
+147
+158
+78
+91
+0
+
+159
+170
+78
+91
+0
+
+171
+182
+78
+91
+0
+
+84
+235
+7
+131
+0
+
+0
+24
+0
+137
+0
+
+295
+319
+0
+137
+0
diff --git a/devtools/create_supernova2/create_image/015/free_tile.xcf b/devtools/create_supernova2/create_image/015/free_tile.xcf
new file mode 100644
index 0000000000..cae63117a5
--- /dev/null
+++ b/devtools/create_supernova2/create_image/015/free_tile.xcf
Binary files differ
diff --git a/devtools/create_supernova2/create_image/015/image0.bmp b/devtools/create_supernova2/create_image/015/image0.bmp
new file mode 100644
index 0000000000..dbe9d249c2
--- /dev/null
+++ b/devtools/create_supernova2/create_image/015/image0.bmp
Binary files differ
diff --git a/devtools/create_supernova2/create_image/015/image1.bmp b/devtools/create_supernova2/create_image/015/image1.bmp
new file mode 100644
index 0000000000..afee16bff8
--- /dev/null
+++ b/devtools/create_supernova2/create_image/015/image1.bmp
Binary files differ
diff --git a/devtools/create_supernova2/create_image/015/image10.bmp b/devtools/create_supernova2/create_image/015/image10.bmp
new file mode 100644
index 0000000000..b7bd16f5ee
--- /dev/null
+++ b/devtools/create_supernova2/create_image/015/image10.bmp
Binary files differ
diff --git a/devtools/create_supernova2/create_image/015/image11.bmp b/devtools/create_supernova2/create_image/015/image11.bmp
new file mode 100644
index 0000000000..7bc12dc3e5
--- /dev/null
+++ b/devtools/create_supernova2/create_image/015/image11.bmp
Binary files differ
diff --git a/devtools/create_supernova2/create_image/015/image12.bmp b/devtools/create_supernova2/create_image/015/image12.bmp
new file mode 100644
index 0000000000..27c3822321
--- /dev/null
+++ b/devtools/create_supernova2/create_image/015/image12.bmp
Binary files differ
diff --git a/devtools/create_supernova2/create_image/015/image13.bmp b/devtools/create_supernova2/create_image/015/image13.bmp
new file mode 100644
index 0000000000..4757b8c98b
--- /dev/null
+++ b/devtools/create_supernova2/create_image/015/image13.bmp
Binary files differ
diff --git a/devtools/create_supernova2/create_image/015/image14.bmp b/devtools/create_supernova2/create_image/015/image14.bmp
new file mode 100644
index 0000000000..1f4ac7f2d1
--- /dev/null
+++ b/devtools/create_supernova2/create_image/015/image14.bmp
Binary files differ
diff --git a/devtools/create_supernova2/create_image/015/image15.bmp b/devtools/create_supernova2/create_image/015/image15.bmp
new file mode 100644
index 0000000000..784f3a175f
--- /dev/null
+++ b/devtools/create_supernova2/create_image/015/image15.bmp
Binary files differ
diff --git a/devtools/create_supernova2/create_image/015/image16.bmp b/devtools/create_supernova2/create_image/015/image16.bmp
new file mode 100644
index 0000000000..1f4ac7f2d1
--- /dev/null
+++ b/devtools/create_supernova2/create_image/015/image16.bmp
Binary files differ
diff --git a/devtools/create_supernova2/create_image/015/image17.bmp b/devtools/create_supernova2/create_image/015/image17.bmp
new file mode 100644
index 0000000000..01a0a9539a
--- /dev/null
+++ b/devtools/create_supernova2/create_image/015/image17.bmp
Binary files differ
diff --git a/devtools/create_supernova2/create_image/015/image18.bmp b/devtools/create_supernova2/create_image/015/image18.bmp
new file mode 100644
index 0000000000..6989ef9e94
--- /dev/null
+++ b/devtools/create_supernova2/create_image/015/image18.bmp
Binary files differ
diff --git a/devtools/create_supernova2/create_image/015/image19.bmp b/devtools/create_supernova2/create_image/015/image19.bmp
new file mode 100644
index 0000000000..f5a5afdde7
--- /dev/null
+++ b/devtools/create_supernova2/create_image/015/image19.bmp
Binary files differ
diff --git a/devtools/create_supernova2/create_image/015/image2.bmp b/devtools/create_supernova2/create_image/015/image2.bmp
new file mode 100644
index 0000000000..b7bd16f5ee
--- /dev/null
+++ b/devtools/create_supernova2/create_image/015/image2.bmp
Binary files differ
diff --git a/devtools/create_supernova2/create_image/015/image3.bmp b/devtools/create_supernova2/create_image/015/image3.bmp
new file mode 100644
index 0000000000..2d646d9e5c
--- /dev/null
+++ b/devtools/create_supernova2/create_image/015/image3.bmp
Binary files differ
diff --git a/devtools/create_supernova2/create_image/015/image4.bmp b/devtools/create_supernova2/create_image/015/image4.bmp
new file mode 100644
index 0000000000..77493cb6e2
--- /dev/null
+++ b/devtools/create_supernova2/create_image/015/image4.bmp
Binary files differ
diff --git a/devtools/create_supernova2/create_image/015/image5.bmp b/devtools/create_supernova2/create_image/015/image5.bmp
new file mode 100644
index 0000000000..784f3a175f
--- /dev/null
+++ b/devtools/create_supernova2/create_image/015/image5.bmp
Binary files differ
diff --git a/devtools/create_supernova2/create_image/015/image6.bmp b/devtools/create_supernova2/create_image/015/image6.bmp
new file mode 100644
index 0000000000..1f4ac7f2d1
--- /dev/null
+++ b/devtools/create_supernova2/create_image/015/image6.bmp
Binary files differ
diff --git a/devtools/create_supernova2/create_image/015/image7.bmp b/devtools/create_supernova2/create_image/015/image7.bmp
new file mode 100644
index 0000000000..77493cb6e2
--- /dev/null
+++ b/devtools/create_supernova2/create_image/015/image7.bmp
Binary files differ
diff --git a/devtools/create_supernova2/create_image/015/image8.bmp b/devtools/create_supernova2/create_image/015/image8.bmp
new file mode 100644
index 0000000000..e8047cbed4
--- /dev/null
+++ b/devtools/create_supernova2/create_image/015/image8.bmp
Binary files differ
diff --git a/devtools/create_supernova2/create_image/015/image9.bmp b/devtools/create_supernova2/create_image/015/image9.bmp
new file mode 100644
index 0000000000..693573601b
--- /dev/null
+++ b/devtools/create_supernova2/create_image/015/image9.bmp
Binary files differ
diff --git a/devtools/create_supernova2/create_image/015/palette b/devtools/create_supernova2/create_image/015/palette
new file mode 100644
index 0000000000..1829779e19
--- /dev/null
+++ b/devtools/create_supernova2/create_image/015/palette
@@ -0,0 +1,77 @@
+76
+50 50 50
+0 0 0
+28 25 20
+15 13 11
+55 34 21
+57 38 20
+58 38 21
+24 21 17
+49 10 10
+26 23 19
+53 38 17
+22 19 16
+20 18 14
+20 20 20
+56 38 19
+34 29 9
+36 36 36
+40 40 40
+63 39 24
+51 38 16
+50 37 15
+54 38 18
+34 31 25
+47 37 14
+43 36 11
+46 37 13
+44 36 12
+49 37 14
+49 10 10
+30 27 22
+19 7 3
+34 29 9
+40 10 8
+27 9 5
+42 36 11
+34 34 34
+40 37 30
+44 10 9
+23 8 4
+23 21 17
+30 27 24
+31 9 6
+36 10 7
+35 31 28
+45 43 39
+38 35 28
+31 28 23
+43 43 43
+32 28 26
+37 34 27
+32 29 24
+34 31 25
+35 32 26
+18 16 13
+43 41 37
+40 36 30
+44 40 33
+42 38 32
+19 17 14
+38 35 29
+36 33 27
+36 32 29
+21 19 16
+34 31 26
+46 42 35
+29 26 21
+42 39 35
+23 21 17
+29 26 21
+31 28 23
+33 29 24
+27 24 20
+25 22 18
+40 38 34
+37 34 31
+39 36 32
diff --git a/devtools/create_supernova2/create_image/015/section_info b/devtools/create_supernova2/create_image/015/section_info
new file mode 100644
index 0000000000..2000012c11
--- /dev/null
+++ b/devtools/create_supernova2/create_image/015/section_info
@@ -0,0 +1,161 @@
+20
+
+0
+319
+0
+137
+0
+0
+0
+
+123
+134
+49
+62
+0
+44160
+0
+
+135
+146
+49
+62
+0
+44328
+0
+
+147
+158
+49
+62
+0
+44496
+0
+
+159
+170
+49
+62
+0
+44664
+0
+
+171
+182
+49
+62
+0
+44832
+0
+
+183
+194
+49
+62
+0
+45000
+0
+
+123
+134
+63
+76
+0
+45168
+0
+
+135
+146
+63
+76
+0
+45336
+0
+
+147
+158
+63
+76
+0
+45504
+0
+
+159
+170
+63
+76
+0
+45672
+0
+
+171
+182
+63
+76
+0
+45840
+0
+
+183
+194
+63
+76
+0
+46008
+0
+
+135
+146
+77
+90
+0
+46176
+0
+
+147
+158
+77
+90
+0
+46344
+0
+
+159
+170
+77
+90
+0
+46512
+0
+
+171
+182
+77
+90
+0
+46680
+0
+
+84
+235
+6
+131
+0
+46848
+0
+
+84
+235
+39
+131
+0
+464
+1
+
+84
+235
+93
+131
+0
+14600
+1
diff --git a/devtools/create_supernova2/create_image/README b/devtools/create_supernova2/create_image/README
new file mode 100644
index 0000000000..80c898f8bf
--- /dev/null
+++ b/devtools/create_supernova2/create_image/README
@@ -0,0 +1,87 @@
+This tool can be used to generate Mission Supernova 2 datafiles containing images
+and might be able to do the same even for Mission Supernova 1.
+
+The tool is not foolproof and a lot of checks are missing (since it's just a tool),
+so it could easily generate nonsense without any warning if for example command line
+arguments aren't as expected.
+
+To use this tool create a folder named as the number of the datafile you want to
+create, it should be 3 characters long, add required numbers of zeros to the begining
+of the name (015 for ms2_data.015).
+
+Inside this folder should be:
+
+--clickfield_info, this contains info about clickfields. On the first row should be a
+number saying how many clickfields there are and on the following rows are
+descripitons of individual clickfields in this order (x1, x2, y1, y2, next),
+for example:
+ 2
+
+ 123
+ 134
+ 49
+ 63
+ 0
+
+ 135
+ 146
+ 49
+ 63
+ 0
+
+This would be the contents of a file describing 2 clickfields.
+
+--section_info similar to the clickfield_info. Contains info about sections. On the
+first row should be a number saying how many sections there are and on the following
+rows are descripitons of individual sections in this order
+(x1, x2, y1, y2, next, addressLow, addressHigh), for example:
+ 2
+
+ 0
+ 319
+ 0
+ 137
+ 0
+ 0
+ 0
+
+ 123
+ 134
+ 49
+ 62
+ 0
+ 44160
+ 0
+
+This would be the contents of a file describing 2 sections
+
+--palette Contains info about palette. On the first row should be a number saying
+how many colors there are and on the following rows are the individual RGB values of
+colors (don't forget, that the engine shifts each color by 2 places to the left
+(brightening the image), so the palette basicaly has to be shifted by 2 to the right
+to get the right colors). For example:
+3
+50 50 50
+0 0 0
+28 25 20
+
+This would be the contents of a file containing palette with 3 colors.
+
+--image#.bmp For each section, there has to be image#.bmp, replace the '#' by the
+number of section this image belongs to. The image has to use indexes to the palette
+for storing the color of each pixel (Image -> Mode -> Indexed... in gimp).
+
+
+Running the tool
+The tool needs 3 comand line arguments when running it:
+-- Prefix of the file to be created (use "ms2_data" to create "ms2_data.###")
+-- Number of the file to be created and also the number of a folder to read all the
+files from (use "15" to create prefix.015)
+-- Number of bytes to skip in each .bmp file. At the begining of each .bmp file is
+a header with information about the file and after that is stored the palette. This
+tool doesn't need these, so this number says how many bytes to skip to get to the pixel
+data. For example: use 1146 to generate ms2_data.015 from the files included.
+
+Be aware, this tool does only basic checks of comandline arguments and no checks of
+the input files (only their presence).
+
diff --git a/devtools/create_supernova2/create_image/create_image.cpp b/devtools/create_supernova2/create_image/create_image.cpp
new file mode 100644
index 0000000000..9600f0cd33
--- /dev/null
+++ b/devtools/create_supernova2/create_image/create_image.cpp
@@ -0,0 +1,178 @@
+#include <fstream>
+#include <iostream>
+#include <sstream>
+#include <cstring>
+#include <iomanip>
+#include <cstdlib>
+
+std::string filenumber;
+
+int writePalette(std::ofstream &output) {
+ std::string filename = filenumber + "/palette";
+ std::ifstream palette(filename.c_str());
+ if (!palette.is_open()) {
+ std::cerr << "Couldn't open palette file";
+ return 1;
+ }
+ int input;
+ do {
+ palette >> input;
+ if (palette.eof())
+ break;
+ output << (char) input;
+ } while(true);
+ palette.close();
+ return 0;
+}
+
+int writeSections(std::ofstream &output) {
+ std::string filename = filenumber + "/section_info";
+ std::ifstream sectionInfo(filename.c_str());
+ if (!sectionInfo.is_open()) {
+ std::cerr << "Couldn't open section_info file";
+ return 0;
+ }
+ int numSections;
+ sectionInfo >> numSections;
+ output << (char) numSections;
+
+ int input;
+ char *input_byte = (char *) &input;
+ for(int i = 0; i < numSections; i++) {
+ //x1
+ sectionInfo >> input;
+ output << (char)input_byte[0];
+ output << (char)input_byte[1];
+ //x2
+ sectionInfo >> input;
+ output << (char)input_byte[0];
+ output << (char)input_byte[1];
+ //y1
+ sectionInfo >> input;
+ output << (char)input;
+ //y2
+ sectionInfo >> input;
+ output << (char)input;
+ //next
+ sectionInfo >> input;
+ output << (char)input;
+ //addressLow
+ sectionInfo >> input;
+ output << (char)input_byte[0];
+ output << (char)input_byte[1];
+ //addressHigh
+ sectionInfo >> input;
+ output << (char)input;
+ }
+ sectionInfo.close();
+ return numSections;
+}
+
+int writeClickFields(std::ofstream &output) {
+ std::string filename = filenumber + "/clickfield_info";
+ std::ifstream clickFieldInfo(filename.c_str());
+ if (!clickFieldInfo.is_open()) {
+ std::cerr << "Couldn't open clickfield_info file";
+ return 1;
+ }
+ int numClickFields;
+ clickFieldInfo >> numClickFields;
+ output << (char) numClickFields;
+
+ int input;
+ char *input_byte = (char *) &input;
+ for(int i = 0; i < numClickFields; i++) {
+ //x1
+ clickFieldInfo >> input;
+ output << (char)input_byte[0];
+ output << (char)input_byte[1];
+ //x2
+ clickFieldInfo >> input;
+ output << (char)input_byte[0];
+ output << (char)input_byte[1];
+ //y1
+ clickFieldInfo >> input;
+ output << (char)input;
+ //y2
+ clickFieldInfo >> input;
+ output << (char)input;
+ //next
+ clickFieldInfo >> input;
+ output << (char)input;
+ }
+ clickFieldInfo.close();
+ return 0;
+}
+
+int writePixelData(std::ofstream &output, int imageNum, int skip) {
+ std::ostringstream fileName;
+ fileName << filenumber << "/image" << imageNum << ".bmp";
+ std::ifstream image(fileName.str().c_str(), std::ios::binary);
+ if (!image.is_open()) {
+ std::cerr << "Couldn't open " << fileName.str() << " file";
+ return 1;
+ }
+
+ image.seekg(0, image.end);
+ int length = image.tellg();
+ length -= skip;
+ image.seekg(skip, image.beg);
+ char *buf = new char[length];
+ image.read(buf, length);
+ output.write(buf, length);
+ delete buf;
+ return 0;
+}
+
+void printHelp() {
+ std::cout << "create_image output-prefix file-number bytes-skip" << std::endl << std::endl;
+ std::cout << " output-prefix: String the created file should begin with" << std::endl;
+ std::cout << " file-number: Number of the created file and also name of source folder" << std::endl;
+ std::cout << " bytes-skip: How many bytes to to skip in each .bmp file" << std::endl;
+ std::cout << std::endl << "EXAMPLE:" << std::endl
+ << "create_image ms2_data 15 1146" << std::endl
+ << " creates ms2_data.015 assuming there are the right files inside 015 folder" << std::endl;
+}
+
+int main(int argc, char *argv[]) {
+ if (argc == 2 && !strcmp(argv[1], "--help")) {
+ printHelp();
+ return 0;
+ }
+ if (argc != 4 ) {
+ printHelp();
+ return 1;
+ }
+ std::ostringstream oss;
+ oss << std::setfill('0') << std::setw(3) << argv[2];
+ filenumber = oss.str();
+ char *ptr;
+ int bytesSkip = strtol(argv[3], &ptr, 10);
+ std::string oFileName = argv[1];
+ oFileName += "." + filenumber;
+ std::ofstream output(oFileName.c_str(), std::ios::binary);
+ if (!output.is_open()) {
+ std::cerr << "Couldn't open output file";
+ return 1;
+ }
+ // size
+ // don't know how to determine that yet
+ output << (char) 0x40;
+ output << (char) 0x70;
+ output << (char) 0x01;
+ output << (char) 0x00;
+ if (writePalette(output))
+ return 1;
+ int numImages = writeSections(output);
+ if (numImages == 0)
+ return 1;
+ if (writeClickFields(output))
+ return 1;
+ // we don't compress the images, so set to 0
+ output << (char) 0; //numRepeat
+ output << (char) 0; //numZw
+ for (int i = 0; i < numImages; i++)
+ writePixelData(output, i, bytesSkip);
+ output.close();
+ return 0;
+}
diff --git a/devtools/create_supernova2/create_image/create_ms2_data.015.sh b/devtools/create_supernova2/create_image/create_ms2_data.015.sh
new file mode 100755
index 0000000000..883cff6046
--- /dev/null
+++ b/devtools/create_supernova2/create_image/create_ms2_data.015.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+./create_image ms2_data 15 1146
diff --git a/devtools/create_supernova2/create_image/module.mk b/devtools/create_supernova2/create_image/module.mk
new file mode 100644
index 0000000000..cb99dfed41
--- /dev/null
+++ b/devtools/create_supernova2/create_image/module.mk
@@ -0,0 +1,10 @@
+MODULE := devtools/create_supernova2/create_image
+
+MODULE_OBJS := create_image.o
+
+# Set the name of the executable
+TOOL_EXECUTABLE := create_image
+
+# Include common rules
+include $(srcdir)/rules.mk
+
diff --git a/devtools/create_supernova2/module.mk b/devtools/create_supernova2/module.mk
index f157fdee57..9c3d671d77 100644
--- a/devtools/create_supernova2/module.mk
+++ b/devtools/create_supernova2/module.mk
@@ -10,3 +10,6 @@ TOOL_EXECUTABLE := create_supernova2
# Include common rules
include $(srcdir)/rules.mk
+
+include $(srcdir)/devtools/create_supernova2/create_image/module.mk
+.PHONY: $(srcdir)/devtools/create_supernova2/create_image/module.mk