diff options
Diffstat (limited to 'devtools/create_supernova/create_image')
33 files changed, 1077 insertions, 0 deletions
diff --git a/devtools/create_supernova/create_image/015/clickfield_info b/devtools/create_supernova/create_image/015/clickfield_info new file mode 100644 index 0000000000..14d95f6c83 --- /dev/null +++ b/devtools/create_supernova/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_supernova/create_image/015/free_tile.xcf b/devtools/create_supernova/create_image/015/free_tile.xcf Binary files differnew file mode 100644 index 0000000000..cae63117a5 --- /dev/null +++ b/devtools/create_supernova/create_image/015/free_tile.xcf diff --git a/devtools/create_supernova/create_image/015/image0.bmp b/devtools/create_supernova/create_image/015/image0.bmp Binary files differnew file mode 100644 index 0000000000..dbe9d249c2 --- /dev/null +++ b/devtools/create_supernova/create_image/015/image0.bmp diff --git a/devtools/create_supernova/create_image/015/image1.bmp b/devtools/create_supernova/create_image/015/image1.bmp Binary files differnew file mode 100644 index 0000000000..afee16bff8 --- /dev/null +++ b/devtools/create_supernova/create_image/015/image1.bmp diff --git a/devtools/create_supernova/create_image/015/image10.bmp b/devtools/create_supernova/create_image/015/image10.bmp Binary files differnew file mode 100644 index 0000000000..b7bd16f5ee --- /dev/null +++ b/devtools/create_supernova/create_image/015/image10.bmp diff --git a/devtools/create_supernova/create_image/015/image11.bmp b/devtools/create_supernova/create_image/015/image11.bmp Binary files differnew file mode 100644 index 0000000000..7bc12dc3e5 --- /dev/null +++ b/devtools/create_supernova/create_image/015/image11.bmp diff --git a/devtools/create_supernova/create_image/015/image12.bmp b/devtools/create_supernova/create_image/015/image12.bmp Binary files differnew file mode 100644 index 0000000000..27c3822321 --- /dev/null +++ b/devtools/create_supernova/create_image/015/image12.bmp diff --git a/devtools/create_supernova/create_image/015/image13.bmp b/devtools/create_supernova/create_image/015/image13.bmp Binary files differnew file mode 100644 index 0000000000..4757b8c98b --- /dev/null +++ b/devtools/create_supernova/create_image/015/image13.bmp diff --git a/devtools/create_supernova/create_image/015/image14.bmp b/devtools/create_supernova/create_image/015/image14.bmp Binary files differnew file mode 100644 index 0000000000..1f4ac7f2d1 --- /dev/null +++ b/devtools/create_supernova/create_image/015/image14.bmp diff --git a/devtools/create_supernova/create_image/015/image15.bmp b/devtools/create_supernova/create_image/015/image15.bmp Binary files differnew file mode 100644 index 0000000000..784f3a175f --- /dev/null +++ b/devtools/create_supernova/create_image/015/image15.bmp diff --git a/devtools/create_supernova/create_image/015/image16.bmp b/devtools/create_supernova/create_image/015/image16.bmp Binary files differnew file mode 100644 index 0000000000..1f4ac7f2d1 --- /dev/null +++ b/devtools/create_supernova/create_image/015/image16.bmp diff --git a/devtools/create_supernova/create_image/015/image17.bmp b/devtools/create_supernova/create_image/015/image17.bmp Binary files differnew file mode 100644 index 0000000000..01a0a9539a --- /dev/null +++ b/devtools/create_supernova/create_image/015/image17.bmp diff --git a/devtools/create_supernova/create_image/015/image18.bmp b/devtools/create_supernova/create_image/015/image18.bmp Binary files differnew file mode 100644 index 0000000000..6989ef9e94 --- /dev/null +++ b/devtools/create_supernova/create_image/015/image18.bmp diff --git a/devtools/create_supernova/create_image/015/image19.bmp b/devtools/create_supernova/create_image/015/image19.bmp Binary files differnew file mode 100644 index 0000000000..f5a5afdde7 --- /dev/null +++ b/devtools/create_supernova/create_image/015/image19.bmp diff --git a/devtools/create_supernova/create_image/015/image2.bmp b/devtools/create_supernova/create_image/015/image2.bmp Binary files differnew file mode 100644 index 0000000000..b7bd16f5ee --- /dev/null +++ b/devtools/create_supernova/create_image/015/image2.bmp diff --git a/devtools/create_supernova/create_image/015/image3.bmp b/devtools/create_supernova/create_image/015/image3.bmp Binary files differnew file mode 100644 index 0000000000..2d646d9e5c --- /dev/null +++ b/devtools/create_supernova/create_image/015/image3.bmp diff --git a/devtools/create_supernova/create_image/015/image4.bmp b/devtools/create_supernova/create_image/015/image4.bmp Binary files differnew file mode 100644 index 0000000000..77493cb6e2 --- /dev/null +++ b/devtools/create_supernova/create_image/015/image4.bmp diff --git a/devtools/create_supernova/create_image/015/image5.bmp b/devtools/create_supernova/create_image/015/image5.bmp Binary files differnew file mode 100644 index 0000000000..784f3a175f --- /dev/null +++ b/devtools/create_supernova/create_image/015/image5.bmp diff --git a/devtools/create_supernova/create_image/015/image6.bmp b/devtools/create_supernova/create_image/015/image6.bmp Binary files differnew file mode 100644 index 0000000000..1f4ac7f2d1 --- /dev/null +++ b/devtools/create_supernova/create_image/015/image6.bmp diff --git a/devtools/create_supernova/create_image/015/image7.bmp b/devtools/create_supernova/create_image/015/image7.bmp Binary files differnew file mode 100644 index 0000000000..77493cb6e2 --- /dev/null +++ b/devtools/create_supernova/create_image/015/image7.bmp diff --git a/devtools/create_supernova/create_image/015/image8.bmp b/devtools/create_supernova/create_image/015/image8.bmp Binary files differnew file mode 100644 index 0000000000..e8047cbed4 --- /dev/null +++ b/devtools/create_supernova/create_image/015/image8.bmp diff --git a/devtools/create_supernova/create_image/015/image9.bmp b/devtools/create_supernova/create_image/015/image9.bmp Binary files differnew file mode 100644 index 0000000000..693573601b --- /dev/null +++ b/devtools/create_supernova/create_image/015/image9.bmp diff --git a/devtools/create_supernova/create_image/015/palette b/devtools/create_supernova/create_image/015/palette new file mode 100644 index 0000000000..075b385ddb --- /dev/null +++ b/devtools/create_supernova/create_image/015/palette @@ -0,0 +1,241 @@ +239 + +0 0 0 +5 5 5 +8 8 8 +11 11 11 +14 14 14 +17 17 17 +20 20 20 +24 24 24 +28 28 28 +32 32 32 +36 36 36 +40 40 40 +45 45 45 +50 50 50 +56 56 56 +63 63 63 +0 0 63 +16 0 63 +31 0 63 +47 0 63 +63 0 63 +63 0 47 +63 0 31 +63 0 16 +63 0 0 +63 16 0 +63 31 0 +63 47 0 +63 63 0 +47 63 0 +31 63 0 +16 63 0 +0 63 0 +0 63 16 +0 63 31 +0 63 47 +0 63 63 +0 47 63 +0 31 63 +0 16 63 +31 31 63 +39 31 63 +47 31 63 +55 31 63 +63 31 63 +63 31 55 +63 31 47 +63 31 39 +63 31 31 +63 39 31 +63 47 31 +63 55 31 +63 63 31 +55 63 31 +47 63 31 +39 63 31 +31 63 31 +31 63 39 +31 63 47 +31 63 55 +31 63 63 +31 55 63 +31 47 63 +31 39 63 +45 45 63 +49 45 63 +54 45 63 +58 45 63 +63 45 63 +63 45 58 +63 45 54 +63 45 49 +63 45 45 +63 49 45 +63 54 45 +63 58 45 +63 63 45 +58 63 45 +54 63 45 +49 63 45 +45 63 45 +45 63 49 +45 63 54 +45 63 58 +45 63 63 +45 58 63 +45 54 63 +45 49 63 +0 0 28 +7 0 28 +14 0 28 +21 0 28 +28 0 28 +28 0 21 +28 0 14 +28 0 7 +28 0 0 +28 7 0 +28 14 0 +28 21 0 +28 28 0 +21 28 0 +14 28 0 +7 28 0 +0 28 0 +0 28 7 +0 28 14 +0 28 21 +0 28 28 +0 21 28 +0 14 28 +0 7 28 +14 14 28 +17 14 28 +21 14 28 +24 14 28 +28 14 28 +28 14 24 +28 14 21 +28 14 17 +28 14 14 +28 17 14 +28 21 14 +28 24 14 +28 28 14 +24 28 14 +21 28 14 +17 28 14 +14 28 14 +14 28 17 +14 28 21 +14 28 24 +14 28 28 +14 24 28 +14 21 28 +14 17 28 +20 20 28 +22 20 28 +24 20 28 +26 20 28 +28 20 28 +28 20 26 +28 20 24 +28 20 22 +28 20 20 +28 22 20 +28 24 20 +28 26 20 +28 28 20 +26 28 20 +24 28 20 +22 28 20 +20 28 20 +20 28 22 +20 28 24 +20 28 26 +20 28 28 +20 26 28 +20 24 28 +20 22 28 +0 0 16 +4 0 16 +8 0 16 +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_supernova/create_image/015/section_info b/devtools/create_supernova/create_image/015/section_info new file mode 100644 index 0000000000..2000012c11 --- /dev/null +++ b/devtools/create_supernova/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_supernova/create_image/028/clickfield_info b/devtools/create_supernova/create_image/028/clickfield_info new file mode 100644 index 0000000000..620726975b --- /dev/null +++ b/devtools/create_supernova/create_image/028/clickfield_info @@ -0,0 +1,7 @@ +1 + +0 +319 +0 +199 +0 diff --git a/devtools/create_supernova/create_image/028/image0.bmp b/devtools/create_supernova/create_image/028/image0.bmp Binary files differnew file mode 100644 index 0000000000..9333191bc3 --- /dev/null +++ b/devtools/create_supernova/create_image/028/image0.bmp diff --git a/devtools/create_supernova/create_image/028/palette b/devtools/create_supernova/create_image/028/palette new file mode 100644 index 0000000000..bb77e05946 --- /dev/null +++ b/devtools/create_supernova/create_image/028/palette @@ -0,0 +1,241 @@ +239 + +0 0 0 +10 10 10 +10 10 10 +11 11 11 +11 11 11 +12 12 12 +13 13 13 +13 13 13 +13 13 13 +13 13 13 +14 14 14 +14 14 14 +14 14 14 +15 15 15 +15 15 15 +15 15 15 +15 15 15 +16 16 16 +16 16 16 +16 16 16 +16 16 16 +17 17 17 +17 17 17 +17 17 17 +17 17 17 +18 18 18 +18 18 18 +18 18 18 +18 18 18 +19 19 19 +19 19 19 +19 19 19 +19 19 19 +20 20 20 +20 20 20 +20 20 20 +20 20 20 +21 21 21 +21 21 21 +21 21 21 +21 21 21 +22 22 22 +22 22 22 +22 22 22 +22 22 22 +23 23 23 +23 23 23 +23 23 23 +23 23 23 +24 24 24 +24 24 24 +24 24 24 +24 24 24 +25 25 25 +25 25 25 +25 25 25 +25 25 25 +26 26 26 +26 26 26 +26 26 26 +26 26 26 +27 27 27 +27 27 27 +27 27 27 +27 27 27 +28 28 28 +28 28 28 +28 28 28 +28 28 28 +29 29 29 +29 29 29 +29 29 29 +29 29 29 +30 30 30 +30 30 30 +30 30 30 +30 30 30 +31 31 31 +31 31 31 +31 31 31 +31 31 31 +32 32 32 +32 32 32 +32 32 32 +32 32 32 +33 33 33 +33 33 33 +33 33 33 +33 33 33 +34 34 34 +34 34 34 +34 34 34 +34 34 34 +35 35 35 +35 35 35 +35 35 35 +35 35 35 +36 36 36 +36 36 36 +36 36 36 +36 36 36 +37 37 37 +37 37 37 +37 37 37 +37 37 37 +38 38 38 +38 38 38 +38 38 38 +38 38 38 +39 39 39 +39 39 39 +39 39 39 +39 39 39 +40 40 40 +40 40 40 +40 40 40 +40 40 40 +41 41 41 +41 41 41 +41 41 41 +41 41 41 +42 42 42 +42 42 42 +42 42 42 +42 42 42 +43 43 43 +43 43 43 +43 43 43 +43 43 43 +44 44 44 +44 44 44 +44 44 44 +44 44 44 +45 45 45 +45 45 45 +45 45 45 +45 45 45 +46 46 46 +46 46 46 +46 46 46 +46 46 46 +47 47 47 +47 47 47 +47 47 47 +47 47 47 +48 48 48 +48 48 48 +48 48 48 +48 48 48 +49 49 49 +49 49 49 +49 49 49 +49 49 49 +50 50 50 +50 50 50 +50 50 50 +50 50 50 +51 51 51 +51 51 51 +51 51 51 +51 51 51 +52 52 52 +52 52 52 +52 52 52 +52 52 52 +53 53 53 +53 53 53 +53 53 53 +53 53 53 +54 54 54 +54 54 54 +54 54 54 +54 54 54 +55 55 55 +55 55 55 +55 55 55 +55 55 55 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/devtools/create_supernova/create_image/028/section_info b/devtools/create_supernova/create_image/028/section_info new file mode 100644 index 0000000000..5ced3d303f --- /dev/null +++ b/devtools/create_supernova/create_image/028/section_info @@ -0,0 +1,9 @@ +1 + +0 +319 +0 +199 +0 +0 +0 diff --git a/devtools/create_supernova/create_image/README b/devtools/create_supernova/create_image/README new file mode 100644 index 0000000000..80c898f8bf --- /dev/null +++ b/devtools/create_supernova/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_supernova/create_image/create_image.cpp b/devtools/create_supernova/create_image/create_image.cpp new file mode 100644 index 0000000000..1bf1e24f7c --- /dev/null +++ b/devtools/create_supernova/create_image/create_image.cpp @@ -0,0 +1,202 @@ +#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" << std::endl; + 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" << std::endl; + 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" << std::endl; + 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" << std::endl; + return 0; + } + + 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 length; +} + +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" << std::endl; + return 1; + } + // size + // just a place holder, will be filled later + 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 + int totalLength = 0; + int oldLength = 0; + for (int i = 0; i < numImages; i++) { + totalLength += writePixelData(output, i, bytesSkip); + if (oldLength == totalLength) { + std::cerr << "Error while reading the image number: " << i << std::endl; + return 1; + } + oldLength = totalLength; + } + + //reversing the size computation inside the engine + totalLength += 15; + totalLength /= 16; + totalLength -= 0x70; + int i = (totalLength & 0xf000) >> 12; + int j = totalLength << 4; + char *i_p = (char *) &i; + char *j_p = (char *) &j; + + //writing the size + output.seekp(0); + output << j_p[0]; + output << j_p[1]; + output << i_p[0]; + output << i_p[1]; + output.close(); + return 0; +} diff --git a/devtools/create_supernova/create_image/create_ms2_data.015.sh b/devtools/create_supernova/create_image/create_ms2_data.015.sh new file mode 100755 index 0000000000..883cff6046 --- /dev/null +++ b/devtools/create_supernova/create_image/create_ms2_data.015.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +./create_image ms2_data 15 1146 diff --git a/devtools/create_supernova/create_image/create_ms2_data.028.sh b/devtools/create_supernova/create_image/create_ms2_data.028.sh new file mode 100755 index 0000000000..66fda85204 --- /dev/null +++ b/devtools/create_supernova/create_image/create_ms2_data.028.sh @@ -0,0 +1 @@ +./create_image ms2_data 28 829 diff --git a/devtools/create_supernova/create_image/module.mk b/devtools/create_supernova/create_image/module.mk new file mode 100644 index 0000000000..547b6dde18 --- /dev/null +++ b/devtools/create_supernova/create_image/module.mk @@ -0,0 +1,10 @@ +MODULE := devtools/create_supernova/create_image + +MODULE_OBJS := create_image.o + +# Set the name of the executable +TOOL_EXECUTABLE := create_image + +# Include common rules +include $(srcdir)/rules.mk + |