├── .gitignore ├── .vscode └── settings.json ├── Combine.html ├── LICENSE ├── README.md ├── ajax.html ├── ajax.js ├── ajax_browser.php ├── ajax_combine.php ├── ajax_icondata.php ├── browser.html ├── dc ├── basic.css ├── basic.php ├── create_page.php ├── create_user.php ├── download.php ├── dump.php ├── hidden.php ├── icondata.php ├── index.php ├── login.php ├── logout.php ├── rename.php ├── template │ ├── _basic_body.html │ ├── _basic_empty.html │ ├── _basic_end.html │ ├── _basic_start.html │ ├── _footer.html │ └── _header.html ├── uploadDC-alt.php ├── uploadDC.php ├── uploader.php └── vmu_links.php ├── gallery_item.htm ├── img ├── bar.png ├── computer.png ├── dchomesmall.png ├── dreamcast.png ├── header_.png ├── header_home.png ├── header_login.png ├── header_uploader.png ├── logo.png └── welcome.png ├── index-pc.html ├── index.html ├── page.css ├── pso.php ├── save-uploads └── delete_me ├── tbs_class.php ├── upload.js ├── upload └── delete_me ├── users └── delete_me ├── util.php ├── vmi_format.php ├── vms_icondata.php └── vmuexplorer.exe /.gitignore: -------------------------------------------------------------------------------- 1 | server 2 | Junk/ 3 | *.vms 4 | *.txt 5 | upload -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | } -------------------------------------------------------------------------------- /Combine.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Icondata Tool 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |

Dreamcast VMU Icondata Creator

17 |
18 |
19 | Icon Creator 20 |   21 | Combine 2 seperate icons 22 |   23 | Image Gallery 24 |
25 |
26 |
27 |
28 |
29 | 30 |
31 | 32 | 33 |
34 | 35 |
36 | 37 | 38 |
39 | 40 |
41 |
42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2018 NeoDC/HaydenK. 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | 9 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VMU Icon generator: 2 | NeoDC, 2017. 3 | 4 | License: 5 | Respect and dont steal. 6 | 7 | This tool will enable you to take a 32x32 image and 8 | then transform it into a suitable format to use on a VMU 9 | 10 | Little to no error checking is done, no safety is implied. 11 | NeoDC is not responsible for anything that happens with this. 12 | 13 | Requirements: 14 | Webserver+PHP (min 5.2.17.17 i guess, thats what i use) 15 | access to files, upload functionality isnt present at this time 16 | Web Browser 17 | 18 | How to use: 19 | STEP 1 - Create the ICONDATA.VMS 20 | browse to color_extract.php (working title) 21 | - Ignore errors most likely 22 | - Configure the page: with arguments POST/GET 23 | - img=king.png (the image to work from, must be 32x32) 24 | - invert=1/0 (should the B&W icon be inverted) OPTIONAL 25 | - threshold=0-FF (threshold for visible pixel in B&W image) OPTIONAL 26 | - Ex: color_extract.php?img=flower.png&threshold=55&invert=1 27 | 28 | The page will show you: 29 | - The palette it generated (up to 16 colors) 30 | - The B&W icon it generated 31 | - Your original image 32 | 33 | Congrats! ICONDATA.VMS has now been created! 34 | - Verify the create image with vms_icondata.php 35 | - This will read your newly created file and display how the dreamcast will 36 | 37 | STEP 2 - Create a valid ICONDATA.VMI file (for vmu tools, planetweb browser, etc...) 38 | browser to vmi_format.php (working title) 39 | - Page will be blank (its ok!) 40 | - use commands to get stuff done 41 | - Commands: 42 | - cmd=NONE (nothing) 43 | - cmd=createVMI (write .VMI with optional parameters) 44 | - desc=Game_Save (the description for the file, up to 32 characters) OPTIONAL 45 | - cpy=NeoDC (copyright holder, up to 32 characters) OPTIONAL 46 | - name=SONIC (filename to write) 47 | - Ex: vmi_format.php?cmd=writeVMI_ICON&desc=TESTING&cpy=VIETNAM&name=SONIC 48 | - cmd=writeVMI_ICON (write ICONDATA.VMI with optional parameters) 49 | - desc=Game_Save (the description for the file, up to 32 characters) OPTIONAL 50 | - cpy=NeoDC (copyright holder, up to 32 characters) OPTIONAL 51 | - Ex: vmi_format.php?cmd=writeVMI_ICON&desc=TESTING&cpy=VIETNAM 52 | - cmd=readVMI (read and display information about a .VMI) 53 | - name=SONIC (filename to read, becomes [NAME].VMI) 54 | - Ex: vmi_format.php?cmd=readVMI&name=SONIC 55 | 56 | CONGRATS! 57 | You are now able to use your .VMI and .VMS whereever you would like -------------------------------------------------------------------------------- /ajax.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 |

9 | Select File: 10 | 11 | 12 |

13 |
14 |
15 |
16 |
17 | 18 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /ajax.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 NeoDC/HaydenK. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | 8 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 9 | 10 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 11 | */ 12 | //Project Lives at: https://github.com/mrneo240/NeoDC-Icondata-Tool 13 | 14 | var slider = document.getElementById("myRange"); 15 | var palette = document.getElementById("palette"); 16 | var bwPreview = document.getElementById("bwPreview"); 17 | var ImgPreview = document.getElementById("ImgPreview"); 18 | var save = document.getElementById("save"); 19 | var preview = document.getElementById("previews"); 20 | 21 | var uploadedName = ""; 22 | var rawName = ""; 23 | 24 | slider.oninput = function () { 25 | updateBWImgHTML(); 26 | } 27 | 28 | function createAjaxRequestObject() { 29 | var xmlhttp; 30 | 31 | if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari 32 | xmlhttp = new XMLHttpRequest(); 33 | } else { // code for IE6, IE5 34 | xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 35 | } 36 | 37 | // Create the object 38 | return xmlhttp; 39 | } 40 | function encodeURI(parameters) { 41 | var parameterString = ""; 42 | var isFirst = true; 43 | for (var index in parameters) { 44 | if (!isFirst) { 45 | parameterString += "&"; 46 | } 47 | parameterString += encodeURIComponent(index) + "=" + encodeURIComponent(parameters[index]); 48 | isFirst = false; 49 | } 50 | return parameterString; 51 | } 52 | function AjaxPost(ajaxURL, parameters, onComplete) { 53 | var http3 = createAjaxRequestObject(); 54 | 55 | http3.onreadystatechange = function () { 56 | if (http3.readyState == 4) { 57 | if (http3.status == 200) { 58 | if (onComplete) { 59 | onComplete(http3.responseText); 60 | } 61 | } 62 | } 63 | }; 64 | 65 | // Create parameter string 66 | /*var parameterString = ""; 67 | var isFirst = true; 68 | for (var index in parameters) { 69 | if (!isFirst) { 70 | parameterString += "&"; 71 | } 72 | parameterString += encodeURIComponent(index) + "=" + encodeURIComponent(parameters[index]); 73 | isFirst = false; 74 | }*/ 75 | 76 | // Make request 77 | http3.open("POST", ajaxURL, true); 78 | http3.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 79 | http3.send(encodeURI(parameters)); 80 | } 81 | 82 | function showGallery() { 83 | function updateBWImg(response) { 84 | preview.innerHTML = response; 85 | } 86 | var imgParams = { 87 | "cmd": "getAll" 88 | }; 89 | AjaxPost("ajax_browser.php", imgParams, updateBWImg); 90 | 91 | } 92 | 93 | function updateBWImgHTML() { 94 | var myNode = document.getElementById("save"); 95 | while (myNode.firstChild) { 96 | myNode.removeChild(myNode.firstChild); 97 | } 98 | 99 | function updateBWImg(response) { 100 | bwPreview.innerHTML = response; 101 | } 102 | var imgParams = { 103 | "cmd": "getBWPreview", 104 | "threshold": slider.value, 105 | "img": window.uploadedName, 106 | "invert": document.getElementById("myCheck").checked ? "1" : "0", 107 | "dither": document.getElementById("myDither").checked ? "1" : "0" 108 | }; 109 | AjaxPost("ajax_icondata.php", imgParams, updateBWImg); 110 | 111 | } 112 | 113 | function saveVMU() { 114 | function completedAJAX(response) { 115 | save.innerHTML = response; 116 | } 117 | var parameters = { 118 | "cmd": "saveVMU", 119 | "threshold": slider.value, 120 | "img": window.uploadedName, 121 | "invert": document.getElementById("myCheck").checked ? "1" : "0", 122 | "dither": document.getElementById("myDither").checked ? "1" : "0", 123 | "folder": window.rawName 124 | }; 125 | 126 | //display and save. 127 | //AjaxPost("ajax_icondata.php", parameters, completedAJAX); 128 | 129 | //download as zip 130 | window.open("ajax_icondata.php?" + encodeURI(parameters)); 131 | } 132 | 133 | function combineVMU() { 134 | function completedAJAX(response) { 135 | save.innerHTML = response; 136 | } 137 | var parameters = { 138 | "cmd": "getCombined", 139 | "bw": document.getElementById("bw").value, 140 | "color": document.getElementById("color").value 141 | }; 142 | 143 | //display and save. 144 | //AjaxPost("ajax_icondata.php", parameters, completedAJAX); 145 | 146 | //download as zip 147 | window.open("ajax_combine.php?" + encodeURI(parameters)); 148 | } 149 | 150 | 151 | function setupBasics() { 152 | 153 | function updatePalette(response) { 154 | palette.innerHTML = response; 155 | } 156 | var imgParams = { 157 | "cmd": "getPalette", 158 | "threshold": slider.value, 159 | "img": window.uploadedName, 160 | "invert": document.getElementById("myCheck").checked ? "1" : "0", 161 | "dither": document.getElementById("myDither").checked ? "1" : "0" 162 | }; 163 | AjaxPost("ajax_icondata.php", imgParams, updatePalette); 164 | 165 | 166 | function updateImg(response) { 167 | ImgPreview.innerHTML = response; 168 | } 169 | var imgParams = { 170 | "cmd": "getImgPreview", 171 | "threshold": slider.value, 172 | "img": window.uploadedName, 173 | "invert": document.getElementById("myCheck").checked ? "1" : "0", 174 | "dither": document.getElementById("myDither").checked ? "1" : "0" 175 | }; 176 | AjaxPost("ajax_icondata.php", imgParams, updateImg); 177 | 178 | updateBWImgHTML(); 179 | } -------------------------------------------------------------------------------- /ajax_browser.php: -------------------------------------------------------------------------------- 1 |

Palette:


"; 49 | for ($i = 1; $i <= 16; $i++) { 50 | $b = $array[$i] & 0x0F; //low nibble 51 | $g = ($array[$i] & 0xF0) >> 4; //high nibble 52 | $r = ($array[$i] & 0xF00) >> 8; //higher nibble 53 | $a = ($array[$i] & 0xF000) >> 12; //highest nibble 54 | $b = ($b * 16) + $b; 55 | $r = ($r * 16) + $r; 56 | $a = ($a * 16) + $a; 57 | $g = ($g * 16) + $g; 58 | //printf("
".($i-1)."
\n",$r,$g,$b); 59 | $vms_palette[$i - 1] = imagecolorallocate($vms_image_Color, $r, $g, $b); 60 | } 61 | //echo '
'; 62 | $x = $y = 0; 63 | for ($y = 0; $y < 32; $y++) { 64 | $rowDataRaw = fread($fp, 16); 65 | $array = unpack("C16", $rowDataRaw); 66 | for ($x = 1; $x <= 16; $x++) { 67 | $col1 = $array[$x] & 0x0F; //low nibble 68 | $col2 = ($array[$x] & 0xF0) >> 4; //high nibble 69 | imagesetpixel($vms_image_Color, ($x - 1) * 2, $y, $vms_palette[$col2]); 70 | imagesetpixel($vms_image_Color, ($x - 1) * 2 + 1, $y, $vms_palette[$col1]); 71 | } 72 | } 73 | fclose($fp); 74 | } 75 | 76 | function getColorIcon($hash) 77 | { 78 | global $vms_image_Color, $background; 79 | $file = './upload/' . $hash . '/icon.png'; 80 | if (!file_exists('.//upload//' . $hash)) { 81 | outputJSON('An error occurred reading img.'); 82 | } 83 | 84 | //is icon already made? 85 | if (!is_file($file)) { 86 | setupBasic($hash); 87 | //output and capture to file 88 | ob_start(); 89 | imagepng($vms_image_Color); 90 | $image_data_Color = ob_get_contents(); 91 | ob_end_clean(); 92 | //Save our content to the file. 93 | imagecolordeallocate($vms_image_Color, $background); 94 | imagedestroy($vms_image_Color); 95 | file_put_contents($file, $image_data_Color); 96 | } 97 | return 'color image'; 98 | } 99 | function getBWIcon($hash) 100 | { 101 | global $vms_image, $background; 102 | $file = './upload/' . $hash . '/icon_bw.png'; 103 | if (!file_exists('.//upload//' . $hash)) { 104 | outputJSON('An error occurred reading img.'); 105 | } 106 | 107 | //is icon already made? 108 | //if(!is_file($file)){ 109 | setupBasic($hash); 110 | //output and capture to file 111 | ob_start(); 112 | imagepng($vms_image); 113 | $image_data = ob_get_contents(); 114 | ob_end_clean(); 115 | //Save our content to the file. 116 | imagedestroy($vms_image); 117 | file_put_contents($file, $image_data); 118 | //} 119 | return 'color image'; 120 | } 121 | 122 | function getIconBW() 123 | { 124 | $hash = "."; 125 | if (isset($_REQUEST['hash'])) {$hash = $_REQUEST['hash'];} 126 | echo getBWIcon($hash); 127 | } 128 | 129 | function getIconColor() 130 | { 131 | $hash = "."; 132 | if (isset($_REQUEST['hash'])) {$hash = $_REQUEST['hash'];} 133 | echo getColorIcon($hash); 134 | } 135 | function getAllImages($prefix = ".") 136 | { 137 | include_once('tbs_class.php'); 138 | $folders = array(); 139 | $TBS = new clsTinyButStrong; 140 | $TBS->VarRef['prefix'] = $prefix; 141 | $TBS->LoadTemplate('gallery_item.htm'); 142 | $dir = new DirectoryIterator($prefix.'/upload'); 143 | $index = 0; 144 | foreach ($dir as $fileinfo) { 145 | if ($fileinfo->isDir() && !$fileinfo->isDot()) { 146 | array_push($folders, array('txt' => $fileinfo->getFilename())); 147 | } 148 | } 149 | $TBS->MergeBlock('bx',$folders); 150 | $TBS->Show(TBS_OUTPUT); 151 | } 152 | 153 | // Report all PHP errors (see changelog) 154 | error_reporting(E_ALL); 155 | header("Content-Type: text/html"); 156 | $command = "NONE"; 157 | if (isset($_REQUEST['cmd'])) {$command = $_REQUEST['cmd'];} 158 | switch ($command) { 159 | case "NONE": 160 | break; 161 | case "getIcon": 162 | getIconColor(); 163 | break; 164 | case "getIconBW": 165 | getIconBW(); 166 | break; 167 | case "getAll": 168 | getAllImages(); 169 | default: 170 | break; 171 | } 172 | -------------------------------------------------------------------------------- /ajax_combine.php: -------------------------------------------------------------------------------- 1 | > 16) & 0xFF; 105 | $g = ($rgb >> 8) & 0xFF; 106 | $b = $rgb & 0xFF; 107 | $gray = ($r * 0.299 + $g * 0.587 + $b * 0.114); 108 | $threshold = 0x66; 109 | if (isset($_REQUEST['threshold'])) {$threshold = ($_REQUEST['threshold']) * 0x11;} 110 | if ($gray < $threshold) { 111 | imagesetpixel($im, $x, $y, 0xFFFFFF); 112 | $data_string .= "1"; 113 | } else { 114 | imagesetpixel($im, $x, $y, 0x000000); 115 | $data_string .= "0"; 116 | } 117 | $image_binary[$y] = $data_string; 118 | } 119 | } 120 | $invert = 1; 121 | if (isset($_REQUEST['invert'])) {$invert = $_REQUEST['invert'];} 122 | if ($invert) { 123 | imagefilter($im, IMG_FILTER_NEGATE); 124 | } 125 | } 126 | 127 | function compareColors($colorA, $colorB) 128 | { 129 | return abs(hexdec(substr($colorA, 0, 2)) - hexdec(substr($colorB, 0, 2))) + 130 | abs(hexdec(substr($colorA, 2, 2)) - hexdec(substr($colorB, 2, 2))) + 131 | abs(hexdec(substr($colorA, 4, 2)) - hexdec(substr($colorB, 4, 2))); 132 | } 133 | function findColorMatch($colorInput, $palette) 134 | { 135 | global $selectedColor; 136 | $deviation = PHP_INT_MAX; 137 | foreach ($palette as $color) { 138 | $curDev = compareColors($colorInput, $color); 139 | if ($curDev < $deviation) { 140 | $deviation = $curDev; 141 | $selectedColor = $color; 142 | } 143 | } 144 | return array_search($selectedColor, $palette); 145 | } 146 | 147 | function safeAccess($_x, $_y, $val) 148 | { 149 | global $img_arr; 150 | if ($_x < 32 && $_x >= 0) { 151 | if ($_y < 32 && $_y >= 0) { 152 | $img_arr[$_x][$_y] += $val; 153 | } 154 | } 155 | } 156 | function doDither($input, &$output) 157 | { 158 | global $img_arr, $image_binary, $image_string; 159 | $output = imagecreatetruecolor(imagesx($input), imagesy($input)); 160 | $img_arr = array(); 161 | for ($y = imagesy($input); $y--;) { 162 | for ($x = 0; $x < imagesx($input); $x++) { 163 | $rgb = imagecolorat($input, $x, $y); 164 | $r = ($rgb >> 16) & 0xFF; 165 | $g = ($rgb >> 8) & 0xFF; 166 | $b = $rgb & 0xFF; 167 | $gray = ($r * 0.299 + $g * 0.587 + $b * 0.114); 168 | $color = imagecolorallocate($output, $gray, $gray, $gray); 169 | $img_arr[$x][$y] = $color; 170 | imagesetpixel($output, $x, $y, $color); 171 | } 172 | } 173 | imagefilter($output, IMG_FILTER_NEGATE); 174 | $white = imagecolorallocate($output, 0xff, 0xff, 0xff); 175 | $black = imagecolorallocate($output, 0, 0, 0); 176 | $threshold = 0.5; 177 | if (isset($_REQUEST['threshold'])) {$threshold = ($_REQUEST['threshold']) / 30;} 178 | 179 | for ($y = 0; $y < 32; $y++) { 180 | for ($x = 0; $x < 32; $x++) { 181 | $old = $img_arr[$x][$y]; 182 | if ($old < 0xffffff * ($threshold)) { 183 | $new = 0x000000; 184 | imagesetpixel($output, $x, $y, $white); 185 | } else { 186 | $new = 0xffffff; 187 | } 188 | $quant_error = $old - $new; 189 | $error_diffusion = (1 / 8) * $quant_error; 190 | safeAccess($x + 1, $y, $error_diffusion); 191 | safeAccess($x + 2, $y, $error_diffusion); 192 | safeAccess($x - 1, $y + 1, $error_diffusion); 193 | safeAccess($x, $y + 1, $error_diffusion); 194 | safeAccess($x + 1, $y + 1, $error_diffusion); 195 | safeAccess($x, $y + 2, $error_diffusion); 196 | } 197 | } 198 | 199 | $threshold = 0x66; 200 | if (isset($_REQUEST['threshold'])) {$threshold = ($_REQUEST['threshold'] - 1) * 0x11;} 201 | 202 | for ($y = 0; $y < 32; $y++) { 203 | $data_string = ""; 204 | for ($x = 0; $x < 32; $x++) { 205 | $rgb = imagecolorat($output, $x, $y); 206 | $gray = $rgb & 0xFF; 207 | if ($gray < 0xff - $threshold) { 208 | imagesetpixel($output, $x, $y, $black); 209 | $data_string .= "0"; 210 | 211 | } else { 212 | imagesetpixel($output, $x, $y, $white); 213 | $data_string .= "1"; 214 | } 215 | } 216 | $image_binary[$y] = $data_string; 217 | } 218 | 219 | $invert = 1; 220 | if (isset($_REQUEST['invert'])) {$invert = $_REQUEST['invert'];} 221 | if ($invert) { 222 | imagefilter($output, IMG_FILTER_NEGATE); 223 | } 224 | 225 | } 226 | 227 | function setupBasic() 228 | { 229 | global $imageBW, $image_data, $image_data_2, $img, $image_binary, $image, $img_tmp, $image_color, $palette, $palette_Raw, $output; 230 | $img = 'watermelon.png'; 231 | if (isset($_REQUEST['img'])) {$img = $_REQUEST['img'];} 232 | $image = @imagecreatefromstring(file_get_contents($img)); 233 | $img_tmp = imagecreatetruecolor(32, 32); 234 | imagecopyresampled($img_tmp, $image, 0, 0, 0, 0, 32, 32, imagesx($image), imagesy($image)); 235 | $image = $img_tmp; 236 | ob_start(); 237 | imagepng($image); 238 | $image_color = ob_get_contents(); 239 | ob_end_clean(); 240 | $imageBW = @imagecreatefromstring(file_get_contents($img)); 241 | $img_tmp = imagecreatetruecolor(32, 32); 242 | imagecopyresampled($img_tmp, $image, 0, 0, 0, 0, 32, 32, imagesx($image), imagesy($image)); 243 | 244 | $imageBW = $img_tmp; 245 | $dither = 1; 246 | if (isset($_REQUEST['dither'])) {$dither = $_REQUEST['dither'];} 247 | if ($dither) { 248 | doDither($img_tmp, $imageBW); 249 | } 250 | $detect_levels = 2; 251 | if (isset($_REQUEST['levels'])) {$detect_levels = $_REQUEST['levels'];} 252 | detectColors($img, 16, $detect_levels, $palette, $palette_Raw); 253 | if (!$dither) { 254 | image2BW($imageBW); 255 | } 256 | ob_start(); 257 | imagepng($imageBW); 258 | $image_data = ob_get_contents(); 259 | ob_end_clean(); 260 | } 261 | 262 | $palette = array(); 263 | $imageBW = 0; 264 | $img = ""; 265 | function getPalette() 266 | { 267 | global $palette; 268 | setupBasic(); 269 | 270 | foreach ($palette as $color) { 271 | echo '

#' . $color . '

'; 272 | } 273 | } 274 | 275 | function getBWPreview() 276 | { 277 | global $palette, $imageBW, $image_data, $image_data_2, $img_tmp; 278 | 279 | setupBasic(); 280 | //Output the stuff 281 | echo 'Red dot'; 283 | } 284 | function getImgPreview() 285 | { 286 | global $img, $image_color; 287 | 288 | setupBasic(); 289 | echo ''; 290 | echo 'Red dot'; 292 | } 293 | 294 | function saveVMU() 295 | { 296 | $folder = "."; 297 | if (isset($_REQUEST['folder'])) {$folder = $_REQUEST['folder'];} 298 | global $img, $image_binary, $palette, $palette_Raw, $image; 299 | setupBasic(); 300 | 301 | //Write ICONDATA.VMS 302 | //$folder = sha1_file($_FILES['SelectedFile']['tmp_name']); 303 | if (!file_exists('.//upload//' . $folder)) { 304 | mkdir('.//upload//' . $folder); 305 | } 306 | $fp = fopen('.//upload//' . $folder . '//' . 'ICONDATA.VMS', 'w'); 307 | //write name 308 | fwrite($fp, str_pad(substr($img, 0, 16), 16, " ", STR_PAD_RIGHT)); 309 | //Write Header 310 | fwrite($fp, pack("H*", "20000000A00000000000000000000000")); 311 | //write b&w icon 312 | for ($x = 0; $x < 32; $x++) { 313 | $data = str_pad(dechex(bindec($image_binary[$x])), 8, "0", STR_PAD_LEFT); 314 | $data2 = pack("H*", $data); 315 | fwrite($fp, $data2); 316 | } 317 | //Write Color Palette 318 | $fPAL = fopen('.//upload//' . $folder . '//' . 'PALLETTE.BIN', 'w'); 319 | for ($x = 0; $x < 16; $x++) { 320 | fwrite($fp, pack("H*", (isset($palette_Raw[$x])) ? $palette_Raw[$x] : "0000")); 321 | fwrite($fPAL, pack("H*", (isset($palette_Raw[$x])) ? $palette_Raw[$x] : "0000")); 322 | } 323 | fclose($fPAL); 324 | $fPAL = fopen('.//upload//' . $folder . '//' . 'IMAGE.BIN', 'w'); 325 | for ($y = 0; $y < 32; $y++) { 326 | for ($x = 0; $x < 16; $x++) { 327 | $temp = ""; 328 | //nibble high; 329 | $rgb = imagecolorat($image, $x * 2, $y); 330 | $r = ($rgb >> 16) & 0xFF; 331 | $g = ($rgb >> 8) & 0xFF; 332 | $b = $rgb & 0xFF; 333 | $color_rgb = sprintf('%02X%02X%02X', $r, $g, $b); 334 | $match = findColorMatch($color_rgb, $palette); 335 | $temp .= (string) dechex($match); 336 | //nibble low; 337 | $rgb = imagecolorat($image, ($x * 2) + 1, $y); 338 | $r = ($rgb >> 16) & 0xFF; 339 | $g = ($rgb >> 8) & 0xFF; 340 | $b = $rgb & 0xFF; 341 | $color_rgb = sprintf('%02X%02X%02X', $r, $g, $b); 342 | $match = findColorMatch($color_rgb, $palette); 343 | $temp .= (string) dechex($match); 344 | fwrite($fp, pack("H*", $temp)); 345 | fwrite($fPAL, pack("H*", $temp)); 346 | } 347 | 348 | } 349 | fclose($fPAL); 350 | //pad out i guess 351 | for ($y = 0; $y < 320; $y++) { 352 | fwrite($fp, pack("H*", "1A")); 353 | } 354 | //Done Finally! 355 | fclose($fp); 356 | //echo '

Icon written Successfully!

'; 357 | writeVMI_ICON($folder); 358 | } 359 | 360 | function uploadImg() 361 | { 362 | 363 | // Check for errors 364 | if ($_FILES['SelectedFile']['error'] > 0) { 365 | outputJSON('An error ocurred when uploading.'); 366 | } 367 | 368 | if (!getimagesize($_FILES['SelectedFile']['tmp_name'])) { 369 | outputJSON('Please ensure you are uploading an image.'); 370 | } 371 | 372 | /*// DO NOT TRUST $_FILES['upfile']['mime'] VALUE !! 373 | // Check MIME Type by yourself. 374 | $finfo = new finfo(FILEINFO_MIME_TYPE); 375 | if (false === $ext = array_search( 376 | $finfo->file($_FILES['SelectedFile']['tmp_name']), 377 | array( 378 | 'jpg' => 'image/jpeg', 379 | 'png' => 'image/png', 380 | 'gif' => 'image/gif', 381 | ), 382 | true 383 | )) { 384 | throw new RuntimeException('Invalid file format.'); 385 | } 386 | */ 387 | $ext = "tmp"; 388 | $fileSHA1 = sha1_file($_FILES['SelectedFile']['tmp_name']); 389 | 390 | // Check filesize 391 | if ($_FILES['SelectedFile']['size'] > 1000000) { 392 | outputJSON('File uploaded exceeds maximum upload size, 1MB'); 393 | } 394 | 395 | // You should name it uniquely. 396 | // DO NOT USE $_FILES['upfile']['name'] WITHOUT ANY VALIDATION !! 397 | // On this example, obtain safe unique name from its binary data. 398 | if (!move_uploaded_file( 399 | $_FILES['SelectedFile']['tmp_name'], 400 | $filename = sprintf('./upload/%s.%s', 401 | $fileSHA1, 402 | $ext 403 | ) 404 | )) { 405 | throw new RuntimeException('Failed to move uploaded file.'); 406 | } 407 | 408 | //Check if image is bmp, or otherwise and then convert to png 409 | $tmpImg = imagecreatefrombmp($filename); 410 | if (!$tmpImg) { 411 | $tmpImg = @imagecreatefromstring(file_get_contents($filename)); 412 | } 413 | 414 | unlink($filename); 415 | $filename = sprintf('./upload/%s.png', $fileSHA1); 416 | imagepng($tmpImg, $filename); 417 | 418 | // Success! 419 | outputJSON($filename, 'success'); 420 | } 421 | 422 | // Report all PHP errors (see changelog) 423 | error_reporting(E_ALL); 424 | $command = "NONE"; 425 | if (isset($_REQUEST['cmd'])) {$command = $_REQUEST['cmd'];} 426 | switch ($command) { 427 | case "NONE": 428 | break; 429 | case "getPalette": 430 | getPalette(); 431 | break; 432 | case "getBWPreview": 433 | getBWPreview(); 434 | break; 435 | case "getImgPreview": 436 | getImgPreview(); 437 | break; 438 | case "saveVMU": 439 | saveVMU(); 440 | break; 441 | case "uploadImg": 442 | uploadImg(); 443 | default: 444 | break; 445 | } 446 | -------------------------------------------------------------------------------- /browser.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Icondata Tool 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |

Dreamcast VMU Icondata Creator

16 |
17 |
18 | Icon Creator 19 |   20 | Combine 2 seperate icons 21 |   22 | Image Gallery 23 |
24 |
25 |
26 |
27 |
28 |

User Created VMU Images

29 |
30 |
31 |
32 |
33 |
34 | 35 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /dc/basic.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #6AD4D0; 3 | margin-top:0 !important; 4 | padding-top:0 !important; 5 | min-width:800px !important; 6 | color: #474747; 7 | } 8 | 9 | #mainTable { 10 | background-color: #DDE0E0; 11 | } 12 | 13 | #topTable { 14 | background-color: #c7c7c7; 15 | } 16 | 17 | p { 18 | color: #474747; 19 | } 20 | 21 | table, th, td { 22 | border-style: none; 23 | } -------------------------------------------------------------------------------- /dc/basic.php: -------------------------------------------------------------------------------- 1 | LoadTemplate('template/_header.html'); 6 | $TBS->Show(TBS_OUTPUT); 7 | $TBS->LoadTemplate('template/_basic_start.html'); 8 | $TBS->Show(TBS_OUTPUT); 9 | ?> 10 |
11 | 12 | 13 | 36 | 58 | 59 |
14 | 15 | 16 | 19 | 20 | 21 |
17 | Create New User 18 |
22 |
23 | 24 | 25 | 32 | 33 |
26 |
27 | Username:
Password:
29 | 30 |
31 |
34 |
35 |
37 | 38 | 39 | 42 | 43 | 44 |
40 | Login 41 |
45 |
46 | 47 | 48 | 54 | 55 |
49 |
50 | Username:
Password:
51 | 52 |
53 |
56 |
57 |
60 |
61 | LoadTemplate('template/_basic_end.html'); 63 | $TBS->Show(TBS_OUTPUT); 64 | $TBS->LoadTemplate('template/_footer.html'); 65 | $TBS->Show(TBS_OUTPUT); 66 | ?> -------------------------------------------------------------------------------- /dc/create_user.php: -------------------------------------------------------------------------------- 1 | LoadTemplate('template/_header.html'); 5 | $TBS->Show(TBS_OUTPUT); 6 | 7 | if (!isset($_POST['uname']) || !isset($_POST['pass'])) { 8 | echo "

Please enter a username and password!

"; 9 | } else { 10 | $uname = _c($_POST['uname']); 11 | $pass = _c($_POST['pass']); 12 | $ourFileName = "../users/" . $uname . "_pass.txt"; 13 | $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); 14 | fwrite($ourFileHandle, $pass); 15 | fclose($ourFileHandle); 16 | $html_output = "

User [" . $uname . "] Created Successfully!

"; 17 | $TBS->LoadTemplate('template/_basic_empty.html'); 18 | $TBS->Show(TBS_OUTPUT); 19 | $_SESSION['user'] = _c($uname); 20 | $_SESSION['logged'] = 1; 21 | if (!is_dir('../save-uploads/' . $uname)) { 22 | mkdir('../save-uploads/' . $uname); 23 | } 24 | } 25 | $TBS->LoadTemplate('template/_footer.html'); 26 | $TBS->Show(TBS_OUTPUT); 27 | -------------------------------------------------------------------------------- /dc/download.php: -------------------------------------------------------------------------------- 1 | LoadTemplate('template/_header.html'); 5 | $TBS->Show(TBS_OUTPUT); 6 | $TBS->LoadTemplate('template/_basic_start.html'); 7 | $TBS->Show(TBS_OUTPUT); 8 | ?> 9 |
10 |
11 | 12 | 13 | 16 | 17 | 18 | 32 | 33 |
14 | VMU Downloads 15 |
19 |
20 | isDot()) { 24 | if (stristr($fileinfo->getFilename(), "VMI")) { 25 | print(''); 26 | } 27 | } 28 | } 29 | ?> 30 |
'.$fileinfo->getFilename().'
31 |
34 |
35 |
36 | LoadTemplate('template/_basic_end.html'); 38 | $TBS->Show(TBS_OUTPUT); 39 | $TBS->LoadTemplate('template/_footer.html'); 40 | $TBS->Show(TBS_OUTPUT); 41 | ?> -------------------------------------------------------------------------------- /dc/dump.php: -------------------------------------------------------------------------------- 1 | not found:".$data[$i]; 19 | } 20 | } 21 | return $decoded; 22 | } 23 | 24 | function getVms($body) { 25 | $vms = base64_decode(decode($body)); 26 | /*$vms = ''; 27 | $body = decode($body); 28 | /*for ($i=0; $i < ceil(strlen($body)/512); $i++) { 29 | $vms .= base64_decode(substr($body,$i*512,512)); 30 | }*/ 31 | return $vms; 32 | } 33 | 34 | $saveData = substr(substr($Buffer,strpos($Buffer, "&tm=")),19); 35 | $decoded = getVms($saveData); 36 | 37 | $filename = substr($Buffer,strpos($Buffer, "=")+1,+strpos($Buffer, "&")-strpos($Buffer, "=")-1); 38 | $filename = uniqueFilename($filename.'.VMS', false); 39 | 40 | $fp2 = fopen($filename, "wb"); 41 | fwrite($fp2, $decoded); 42 | fclose($fp2); 43 | $vmiDescription = array('Checksum' => '0000', //dont touch 44 | 'Description' => "NeoDC VMU Uploader", //up to 32 characters 45 | 'Copyright'=> "NeoDC 2018"); //up to 32 characters 46 | 47 | createVMI($vmiDescription,substr($filename,0,-4),"Checking"); 48 | 49 | ?> -------------------------------------------------------------------------------- /dc/hidden.php: -------------------------------------------------------------------------------- 1 | LoadTemplate('template/_header.html'); 6 | $TBS->Show(TBS_OUTPUT); 7 | $TBS->LoadTemplate('template/_basic_start.html'); 8 | $TBS->Show(TBS_OUTPUT); 9 | 10 | if ((isset($_SESSION['logged'])) and ($_SESSION['logged'] == 1)) { 11 | echo "

" . $_SESSION['user'] . "'s Profile and secret area.

"; 12 | } else { 13 | //Below alerts the user if they aren't logged in. It also makes the window go back. 14 | echo "\n"; 15 | } 16 | ?> 17 |
18 |
19 | 20 | 21 | 24 | 25 | 26 | 46 | 47 |
22 | VMU Downloads 23 |
27 |
28 | isDot()) { 37 | if (stristr($fileinfo->getFilename(), "VMI")) { 38 | print(''); 39 | } 40 | } 41 | } 42 | } 43 | ?> 44 |
getFilename().'">'.$fileinfo->getFilename().'
45 |
48 |
49 |
50 | LoadTemplate('template/_basic_end.html'); 52 | $TBS->Show(TBS_OUTPUT); 53 | $TBS->LoadTemplate('template/_footer.html'); 54 | $TBS->Show(TBS_OUTPUT); 55 | ?> -------------------------------------------------------------------------------- /dc/icondata.php: -------------------------------------------------------------------------------- 1 | LoadTemplate('template/_header.html'); 6 | $TBS->Show(TBS_OUTPUT); 7 | $TBS->LoadTemplate('template/_basic_start.html'); 8 | $TBS->Show(TBS_OUTPUT); 9 | ?> 10 |
11 | 16 |
17 |
18 | LoadTemplate('template/_basic_end.html'); 20 | $TBS->Show(TBS_OUTPUT); 21 | $TBS->LoadTemplate('template/_footer.html'); 22 | $TBS->Show(TBS_OUTPUT); 23 | ?> -------------------------------------------------------------------------------- /dc/index.php: -------------------------------------------------------------------------------- 1 | LoadTemplate('template/_header.html'); 6 | $TBS->Show(TBS_OUTPUT); 7 | 8 | echo ' 9 | 10 | 11 | 36 | 37 | 38 |
12 | 13 | 14 | 18 | 20 | 21 | 22 | 30 | 31 | 32 | 33 | 34 |
15 |

17 |
23 |

This website is best experienced on XDP, Planetweb, Dream Passport, or 24 | Dream Key

25 | 26 |

blah

27 | 28 |

blah

29 |
35 |
'; 39 | $TBS->LoadTemplate('template/_footer.html'); 40 | $TBS->Show(TBS_OUTPUT); -------------------------------------------------------------------------------- /dc/login.php: -------------------------------------------------------------------------------- 1 | '0000', //dont touch 6 | 'Description' => "NeoDC VMU Uploader", //up to 32 characters 7 | 'Copyright'=> "NeoDC 2018"); //up to 32 characters 8 | 9 | $dir = new DirectoryIterator(dirname(__FILE__)); 10 | foreach ($dir as $fileinfo) { 11 | if (!$fileinfo->isDot()) { 12 | if (stristr($fileinfo->getFilename(), "VMS")) { 13 | createVMI($vmiDescription, substr($fileinfo->getFilename(), 0, -4), "Checking"); 14 | } 15 | if (stristr($fileinfo->getFilename(), "VMI")) { 16 | //print(''.$fileinfo->getFilename().'
'); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /dc/template/_basic_body.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 31 | 32 | 33 |
5 | 6 | 7 | 11 | 13 | 14 | 15 | 25 | 26 | 27 | 28 | 29 |
8 |

10 |
16 |

This website is best experienced on XDP, Planetweb, Dream Passport, or 17 | Dream Key

18 | 19 |

Dreampipe is a portal for Dreamcast Websites, Leaderboards, and VMU 20 | content

21 | 22 |

You can access Dreampipe in many Dreamcast games with internet 23 | browsing

24 |
30 |
-------------------------------------------------------------------------------- /dc/template/_basic_empty.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 15 |
5 | 6 | 7 | 10 | 11 |
8 | [onshow.html_output;htmlconv=no] 9 |
12 |
-------------------------------------------------------------------------------- /dc/template/_basic_end.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /dc/template/_basic_start.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 |
8 | -------------------------------------------------------------------------------- /dc/template/_footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 15 | 16 |
7 | 8 | 9 | 10 | 11 | 12 | 13 |

Website Design: © DREAMPIPE.NET 2018 | Website Coding/Assets: ©HaydenKow 2019
14 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /dc/template/_header.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HaydenKow/NeoDC Dreamcast 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 34 | 35 | 36 | 37 | 38 | 39 | 55 | 56 | 57 | 58 | 59 | 60 |
15 | 16 | 17 | 18 | 19 | 30 | 31 | 32 |
 20 | 21 | 22 | 23 | 26 | 27 | 28 |
24 | 25 |
29 |
33 |
40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 51 | 52 | 53 |
HomeUploaderVMU LinksSaves DLIcondataProfile[var._SESSION.logged;noerr;if [val]!=1;then 'Login 50 | ';else 'Logout ']
54 |
-------------------------------------------------------------------------------- /dc/uploadDC-alt.php: -------------------------------------------------------------------------------- 1 | LoadTemplate('template/_header.html'); 8 | $TBS->Show(TBS_OUTPUT); 9 | $TBS->LoadTemplate('template/_basic_start.html'); 10 | $TBS->Show(TBS_OUTPUT); 11 | ?> 12 |
13 | 14 | 15 | 18 | 19 | 20 | 112 | 113 |
16 | VMU Upload Status 17 |

21 | 22 | 23 | 106 | 107 | 108 | 109 | 110 |
24 | 1) { 51 | $ret = file_put_contents($target_file, $_POST['upfile']); 52 | file_put_contents($logname, $_POST['upfile']); 53 | handleUpload('default'); 54 | unlink($target_file); 55 | } else { 56 | echo "Sorry, there was an error uploading your file."; 57 | } 58 | 59 | function handleUpload($filename) 60 | { 61 | global $target_dir; 62 | $handle = fopen($target_dir . $filename, "rb"); 63 | $Buffer = fread($handle, filesize($target_dir . $filename)); 64 | fclose($handle); 65 | 66 | $saveData = substr(substr($Buffer, strpos($Buffer, "&tm=")), 19); 67 | $decoded = getVms($saveData); 68 | 69 | $vmuFilename = substr($Buffer, strpos($Buffer, "=") + 1, +strpos($Buffer, "&") - strpos($Buffer, "=") - 1); 70 | $filename = uniqueFilename($target_dir . $vmuFilename . '.VMS', false); 71 | 72 | print(substr($filename, 0, -4) . '.VMS Created and ready for download
'); 73 | $fp2 = fopen($target_dir . $filename, "wb"); 74 | fwrite($fp2, $decoded); 75 | fclose($fp2); 76 | $vmiDescription = array('Checksum' => '0000', //dont touch 77 | 'Description' => "NeoDC VMU Uploader", //up to 32 characters 78 | 'Copyright' => "NeoDC 2018", 79 | 'vmuFilename' => $vmuFilename); //up to 32 characters 80 | 81 | createVMI($vmiDescription, substr($filename, 0, -4), $target_dir); 82 | } 83 | 84 | function decode($data) 85 | { 86 | $enc_chars = 'AZOLYNdnETmP6ci3Sze9IyXBhDgfQq7l5batM4rpKJj8CusxRF+k2V0wUGo1vWH/='; 87 | $dec_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; 88 | $decoded = ''; 89 | for ($i = 0; $i < strlen($data); $i++) { 90 | if (strpos($enc_chars, $data[$i]) !== false) { 91 | $decoded .= $dec_chars[strpos($enc_chars, $data[$i])]; 92 | } else { 93 | $decoded .= $data[$i]; //echo "
not found:".$data[$i]; 94 | } 95 | } 96 | return $decoded; 97 | } 98 | 99 | function getVms($body) 100 | { 101 | $vms = base64_decode(decode($body)); 102 | return $vms; 103 | } 104 | ?> 105 |
Back to Uploader
111 |
114 |
115 | LoadTemplate('template/_basic_end.html'); 117 | $TBS->Show(TBS_OUTPUT); 118 | $TBS->LoadTemplate('template/_footer.html'); 119 | $TBS->Show(TBS_OUTPUT); 120 | ?> -------------------------------------------------------------------------------- /dc/uploadDC.php: -------------------------------------------------------------------------------- 1 | LoadTemplate('template/_header.html'); 8 | $TBS->Show(TBS_OUTPUT); 9 | $TBS->LoadTemplate('template/_basic_start.html'); 10 | $TBS->Show(TBS_OUTPUT); 11 | ?> 12 |
13 | 14 | 15 | 18 | 19 | 20 | 115 | 116 |
16 | VMU Upload Status 17 |

21 | 22 | 23 | 109 | 110 | 111 | 112 | 113 |
24 | 25 | 1) { 52 | $ret = file_put_contents($target_file, $_POST['upfile']); 53 | file_put_contents($logname, $_POST['upfile']); 54 | handleUpload('default'); 55 | unlink($target_file); 56 | } else { 57 | echo "Sorry, there was an error uploading your file."; 58 | } 59 | 60 | function handleUpload($filename) 61 | { 62 | global $target_dir; 63 | $handle = fopen($target_dir . $filename, "rb"); 64 | $Buffer = fread($handle, filesize($target_dir . $filename)); 65 | fclose($handle); 66 | 67 | $saveData = substr(substr($Buffer, strpos($Buffer, "&tm=")), 19); 68 | $decoded = getVms($saveData); 69 | 70 | $vmuFilename = substr($Buffer, strpos($Buffer, "=") + 1, +strpos($Buffer, "&") - strpos($Buffer, "=") - 1); 71 | $filename = uniqueFilename($target_dir . $vmuFilename . '.VMS', false); 72 | 73 | print(substr($filename, 0, -4) . '.VMS Created and ready for download
'); 74 | $fp2 = fopen($target_dir . $filename, "wb"); 75 | fwrite($fp2, $decoded); 76 | fclose($fp2); 77 | $vmiDescription = array('Checksum' => '0000', //dont touch 78 | 'Description' => "NeoDC VMU Uploader", //up to 32 characters 79 | 'Copyright' => "NeoDC 2018", 80 | 'vmuFilename' => $vmuFilename); //up to 32 characters 81 | 82 | createVMI($vmiDescription, substr($filename, 0, -4), $target_dir); 83 | } 84 | 85 | function decode($data) 86 | { 87 | $enc_chars = 'AZOLYNdnETmP6ci3Sze9IyXBhDgfQq7l5batM4rpKJj8CusxRF+k2V0wUGo1vWH/='; 88 | $dec_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; 89 | $decoded = ''; 90 | for ($i = 0; $i < strlen($data); $i++) { 91 | if (strpos($enc_chars, $data[$i]) !== false) { 92 | $decoded .= $dec_chars[strpos($enc_chars, $data[$i])]; 93 | } else { 94 | $decoded .= $data[$i]; //echo "
not found:".$data[$i]; 95 | } 96 | } 97 | return $decoded; 98 | } 99 | 100 | function getVms($body) 101 | { 102 | $vms = base64_decode(decode($body)); 103 | return $vms; 104 | } 105 | ?> 106 | 107 | 108 |
Back to Uploader
114 |
117 |
118 | LoadTemplate('template/_basic_end.html'); 120 | $TBS->Show(TBS_OUTPUT); 121 | $TBS->LoadTemplate('template/_footer.html'); 122 | $TBS->Show(TBS_OUTPUT); 123 | ?> -------------------------------------------------------------------------------- /dc/uploader.php: -------------------------------------------------------------------------------- 1 | LoadTemplate('template/_header.html'); 6 | $TBS->Show(TBS_OUTPUT); 7 | $TBS->LoadTemplate('template/_basic_start.html'); 8 | $TBS->Show(TBS_OUTPUT); 9 | ?> 10 |
11 | 12 | 13 | 43 | 73 | 74 | 75 | 76 |
14 | 15 | 16 | 19 | 20 | 21 | 40 | 41 |
17 | PlanetWeb 2.X/3.0 VMU Uploader 18 |

22 | 23 | 24 | 25 | 26 | 27 | 28 | > 32 | 33 | 34 | 35 | 36 | 37 | 38 |
File to upload:
Private Upload?
39 |
42 |
44 | 45 | 46 | 49 | 50 | 51 | 70 | 71 |
47 | DreamKey 2.0 & Other VMU Uploader 48 |

52 | 53 | 54 | 55 | 56 | 57 | 58 | > 62 | 63 | 64 | 65 | 66 | 67 | 68 |
File to upload:
Private Upload?
69 |
72 |
77 |
78 |
79 | LoadTemplate('template/_basic_end.html'); 81 | $TBS->Show(TBS_OUTPUT); 82 | $TBS->LoadTemplate('template/_footer.html'); 83 | $TBS->Show(TBS_OUTPUT); 84 | ?> -------------------------------------------------------------------------------- /dc/vmu_links.php: -------------------------------------------------------------------------------- 1 | LoadTemplate('template/_header.html'); 5 | $TBS->Show(TBS_OUTPUT); 6 | $TBS->LoadTemplate('template/_basic_start.html'); 7 | $TBS->Show(TBS_OUTPUT); 8 | ?> 9 |
10 | 11 | 12 | 15 | 16 | 17 |
13 | VMU Downloads 14 |

18 | 19 | 20 | 35 | 36 |
21 | DEMORA_0.VMI
DOA2DA_0.VMI
DRAGON_0.VMI
23 | MARINE_0.VMI
OOGA___0.VMI
POD_ML_0.VMI
25 | RUSH20_0.VMI
RUSH20_1.VMI
S.ARCA_0.VMI
27 | S.ARCA_1.VMI
SCOOTE_0.VMI
SONIC2_0.VMI
29 | SONIC2_1.VMI
SONIC2_2.VMI
SONICA_0.VMI
31 | SONICA_1.VMI
SPACER_0.VMI
SPRT_J_0.VMI
33 | TOKYOB_0.VMI
VIRTUA_0.VMI
34 |
37 |
38 |
39 |
40 | LoadTemplate('template/_basic_end.html'); 42 | $TBS->Show(TBS_OUTPUT); 43 | $TBS->LoadTemplate('template/_footer.html'); 44 | $TBS->Show(TBS_OUTPUT); 45 | ?> -------------------------------------------------------------------------------- /gallery_item.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 35 | 51 | 67 | 68 | 69 | 70 |
[bx;block=tr;serial] 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
color imagebw image
Full zip extras
18 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
color imagebw image
Full zip extras
34 |
36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 |
color imagebw image
Full zip extras
50 |
52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 |
color imagebw image
Full zip extras
66 |
[bx_0;block=td]  
-------------------------------------------------------------------------------- /img/bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrneo240/NeoDC-Icondata-Tool/42c2c66028c14cbee9e3e946dd8584ec9388a7a8/img/bar.png -------------------------------------------------------------------------------- /img/computer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrneo240/NeoDC-Icondata-Tool/42c2c66028c14cbee9e3e946dd8584ec9388a7a8/img/computer.png -------------------------------------------------------------------------------- /img/dchomesmall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrneo240/NeoDC-Icondata-Tool/42c2c66028c14cbee9e3e946dd8584ec9388a7a8/img/dchomesmall.png -------------------------------------------------------------------------------- /img/dreamcast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrneo240/NeoDC-Icondata-Tool/42c2c66028c14cbee9e3e946dd8584ec9388a7a8/img/dreamcast.png -------------------------------------------------------------------------------- /img/header_.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrneo240/NeoDC-Icondata-Tool/42c2c66028c14cbee9e3e946dd8584ec9388a7a8/img/header_.png -------------------------------------------------------------------------------- /img/header_home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrneo240/NeoDC-Icondata-Tool/42c2c66028c14cbee9e3e946dd8584ec9388a7a8/img/header_home.png -------------------------------------------------------------------------------- /img/header_login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrneo240/NeoDC-Icondata-Tool/42c2c66028c14cbee9e3e946dd8584ec9388a7a8/img/header_login.png -------------------------------------------------------------------------------- /img/header_uploader.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrneo240/NeoDC-Icondata-Tool/42c2c66028c14cbee9e3e946dd8584ec9388a7a8/img/header_uploader.png -------------------------------------------------------------------------------- /img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrneo240/NeoDC-Icondata-Tool/42c2c66028c14cbee9e3e946dd8584ec9388a7a8/img/logo.png -------------------------------------------------------------------------------- /img/welcome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrneo240/NeoDC-Icondata-Tool/42c2c66028c14cbee9e3e946dd8584ec9388a7a8/img/welcome.png -------------------------------------------------------------------------------- /index-pc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Icondata Tool 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |
17 |

Dreamcast VMU Icondata Creator

18 |
19 |
20 | Icon Creator 21 |   22 | Combine 2 seperate icons 23 |   24 | Image Gallery 25 |
26 |
27 |
28 |
29 |
30 |
31 |

32 |

Select File:

33 | 34 | 35 |

36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | 88 |
89 | 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | HaydenKow/NeoDC Dreamcast 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 36 | 37 | 38 |
16 | 17 | 18 | 22 | 23 | 24 | 27 | 30 | 31 | 32 | 33 | 34 |
19 |

20 |

Please Choose your Experience:

21 |
25 | 26 | 28 | 29 |
35 |
39 | 40 | 41 | 42 | 43 | 52 | 53 |
44 | 45 | 46 | 47 | 48 | 49 | 50 |

Website Design: © DREAMPIPE.NET 2018 | Website Coding/Assets: ©HaydenKow 2019
51 |
54 | 55 | 56 | -------------------------------------------------------------------------------- /page.css: -------------------------------------------------------------------------------- 1 | /* default styles for body */ 2 | html {box-sizing: border-box;} 3 | .wrapper { 4 | display: -webkit-flex; 5 | display: flex; 6 | flex-flow: column wrap; 7 | min-height: 100vh; 8 | } 9 | 10 | div#vmu img { 11 | padding-right: 1em; 12 | } 13 | .topBarBottom { 14 | display: flex; 15 | } 16 | 17 | .topBar { 18 | padding-bottom: 1em; 19 | } 20 | 21 | .topBarBottom h2 { 22 | vertical-align: middle; 23 | margin: 0.5em 0 0em 0; 24 | padding: 0.5em 0em 1em 0.1em; 25 | text-transform: uppercase; 26 | color: #212121; 27 | font-style: bold; 28 | font-family: 'Josefin Sans', sans-serif; 29 | text-shadow: 2px 3px 0 rgba(0,0,0,0.16); 30 | text-align:center; 31 | font-size: 28px; 32 | flex: 1; 33 | } 34 | .topBarBottom a { 35 | color: #212121; 36 | font-family: 'Josefin Sans', sans-serif; 37 | text-shadow: 2px 3px 0 rgba(0,0,0,0.16); 38 | text-align: center; 39 | font-size: 18px; 40 | flex: 1; 41 | } 42 | main { 43 | margin: 0 auto; 44 | width: 80%; 45 | } 46 | a { 47 | font-family: "Roboto"; 48 | font-size: 14px; 49 | color: #212121; 50 | font-weight: 600; 51 | } 52 | 53 | body { 54 | background-color: #ECECEC; 55 | font-family: "Roboto"; 56 | font-size: 14px; 57 | color: #212121; 58 | margin: auto; 59 | } 60 | .select { 61 | background-color: #BBDEFB; 62 | padding: 0.5em; 63 | } 64 | .container { 65 | background-color: #BBDEFB; 66 | position: relative; 67 | cursor: pointer; 68 | font-size: 22px; 69 | height: 25px; 70 | width: 25px; 71 | -webkit-user-select: none; 72 | -moz-user-select: none; 73 | -ms-user-select: none; 74 | user-select: none; 75 | } 76 | 77 | .slidecontainer { 78 | width: 100%; /* Width of the outside container */ 79 | } 80 | 81 | /* The slider itself */ 82 | .slider { 83 | -webkit-appearance: none; /* Override default CSS styles */ 84 | appearance: none; 85 | width: 100%; /* Full-width */ 86 | height: 48px; /* Specified height */ 87 | background: #d3d3d3; /* Grey background */ 88 | outline: none; /* Remove outline */ 89 | opacity: 0.7; /* Set transparency (for mouse-over effects on hover) */ 90 | -webkit-transition: .2s; /* 0.2 seconds transition on hover */ 91 | transition: opacity .2s; 92 | } 93 | 94 | /* Mouse-over effects */ 95 | .slider:hover { 96 | opacity: 1; /* Fully shown on mouse-over */ 97 | } 98 | 99 | /* The slider handle (use -webkit- (Chrome, Opera, Safari, Edge) and -moz- (Firefox) to override default look) */ 100 | .slider::-webkit-slider-thumb { 101 | -webkit-appearance: none; /* Override default look */ 102 | appearance: none; 103 | width: 48px; /* Set a specific slider handle width */ 104 | height: 48px; /* Slider handle height */ 105 | background: #4CAF50; /* Green background */ 106 | cursor: pointer; /* Cursor on hover */ 107 | border-radius: 4px; 108 | } 109 | 110 | .slider::-moz-range-thumb { 111 | width: 48px; /* Set a specific slider handle width */ 112 | height: 48px; /* Slider handle height */ 113 | background: #4CAF50; /* Green background */ 114 | cursor: pointer; /* Cursor on hover */ 115 | } 116 | 117 | * Hide the browser's default checkbox */ 118 | .container input { 119 | position: absolute; 120 | opacity: 0; 121 | cursor: pointer; 122 | } 123 | 124 | /* Create a custom checkbox */ 125 | .checkmark { 126 | position: absolute; 127 | top: 0; 128 | left: 0; 129 | height: 48px; 130 | width: 48px; 131 | background-color: #eee; 132 | border-style: solid; 133 | } 134 | 135 | /* On mouse-over, add a grey background color */ 136 | .container:hover input ~ .checkmark { 137 | background-color: #ccc; 138 | } 139 | 140 | /* When the checkbox is checked, add a blue background */ 141 | .container input:checked ~ .checkmark { 142 | background-color: #2196F3; 143 | } 144 | 145 | /* Create the checkmark/indicator (hidden when not checked) */ 146 | .checkmark:after { 147 | content: ""; 148 | position: absolute; 149 | display: none; 150 | } 151 | 152 | /* Show the checkmark when checked */ 153 | .container input:checked ~ .checkmark:after { 154 | display: block; 155 | } 156 | 157 | /* Style the checkmark/indicator */ 158 | .container .checkmark:after { 159 | left: 16px; 160 | top: 6px; 161 | width: 12px; 162 | height: 24px; 163 | border: solid white; 164 | border-width: 0 4px 4px 0; 165 | -webkit-transform: rotate(45deg); 166 | -ms-transform: rotate(45deg); 167 | transform: rotate(45deg); 168 | } 169 | 170 | .button { 171 | background-color: #BBDEFB; 172 | padding: 8px 32px; 173 | margin: 0.5em auto; 174 | text-align: center; 175 | border: 2px solid #BBDEFB; 176 | border-radius: 4px; 177 | font-family: "Roboto"; 178 | font-size: 22px; 179 | font-weight: bold; 180 | cursor: pointer; 181 | } 182 | 183 | .button:hover { 184 | background-color: transparent; 185 | } 186 | 187 | .v { 188 | border-left: 3px solid #ababab; 189 | margin-right: 1.5em; 190 | } 191 | 192 | /* form styling */ 193 | label { 194 | margin: 4px; 195 | font-size: 18px; 196 | font-weight: bold; 197 | line-height: 1.4; 198 | } 199 | input { 200 | box-sizing: border-box; 201 | border-radius: 4px; 202 | font-size: 16px; 203 | padding: 12px; 204 | border: none; 205 | } 206 | 207 | textarea { 208 | width: 100%; 209 | height: 140px; 210 | padding: 12px; 211 | box-sizing: border-box; 212 | border: 2px solid #BBDEFB; 213 | border-radius: 4px; 214 | resize: none; 215 | font-family: "Roboto"; 216 | font-size: 14px; 217 | color: #212121; 218 | } 219 | 220 | #Previews img,#Previews div { 221 | display:inline; 222 | } 223 | 224 | #palette > div { 225 | width:60px;height:48px;float:left;display:table-row; 226 | } 227 | #palette > div > div { 228 | font-weight:bold;display:table-cell;vertical-align:middle; 229 | } 230 | #palette p { 231 | -webkit-text-stroke: 0.1px white; 232 | } 233 | 234 | #icondata table, th, td { 235 | border-style: none; 236 | } -------------------------------------------------------------------------------- /pso.php: -------------------------------------------------------------------------------- 1 | ImgWidth * $this->ImgHeight; 21 | private $SS_FileLen = 99360; 22 | 23 | private $Buffer; 24 | 25 | private $image; 26 | 27 | public function __construct() 28 | { 29 | $this->SS_ImageLen = $this->ImgWidth * $this->ImgHeight; 30 | $this->Buffer = ""; 31 | } 32 | 33 | public function readFile($filename){ 34 | $handle = fopen($filename, "rb"); 35 | $this->Buffer = fread($handle, filesize($filename)); 36 | fclose($handle); 37 | $this->swapEndian(); 38 | $this->parse(); 39 | } 40 | 41 | private function swapEndian(){ 42 | /*for($i=0; $i<$SS_FileLen/4; $i++){ 43 | ($a,$b,$c,$d) = unpack("CCCC",substr($Buffer,$SS_ImageTop+$i*4,4)); 44 | //substr($buf,$i*4,4) = pack("CCCC",$d,$c,$b,$a); //Only needed for DCI because byteswapped 45 | substr($buf,$i*4,4) = pack("CCCC",$a,$b,$c,$d); 46 | }*/ 47 | } 48 | 49 | private function parse(){ 50 | $this->image = imagecreatetruecolor($this->ImgWidth, $this->ImgHeight); 51 | $background = imagecolorallocate($this->image, 0, 0, 0); 52 | 53 | $header_format = 54 | 'C1lo/' . 55 | 'C1hi'; 56 | 57 | for($y=0; $y<$this->ImgHeight; $y++){ 58 | for($x=0; $x<$this->ImgWidth; $x++){ 59 | //$bytes = unpack("CC",substr($buf,$this->SS_ImageTop+($x+$y*$this->ImgWidth)*2,2)); //for DCI only 60 | $bytes = unpack ($header_format, substr($this->Buffer,$this->SS_ImageTop+(($x+$y*$this->ImgWidth)*2),2)); 61 | 62 | $pal = ($bytes['hi']<<8)+$bytes['lo']; 63 | $r = ($pal>>8) & 0xf8; if ($r){$r += 0x7;} 64 | $g = ($pal>>3) & 0xfc; if ($g){$g += 0x3;} 65 | $b = ($pal<<3) & 0xf8; if ($b){$b += 0x7;} 66 | 67 | $color = imagecolorallocate($this->image, $r,$g,$b); 68 | imagesetpixel($this->image,$x,$y,$color); 69 | } 70 | } 71 | } 72 | public function display(){ 73 | ob_start(); 74 | imagepng($this->image); 75 | $image_data = ob_get_contents(); 76 | ob_end_clean(); 77 | echo 'color image'; 79 | imagedestroy($this->image); 80 | } 81 | } 82 | 83 | $foo = new PSOImage; 84 | 85 | $foo->readFile("PSO_____.VMS"); 86 | $foo->display(); 87 | 88 | 89 | ?> -------------------------------------------------------------------------------- /save-uploads/delete_me: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrneo240/NeoDC-Icondata-Tool/42c2c66028c14cbee9e3e946dd8584ec9388a7a8/save-uploads/delete_me -------------------------------------------------------------------------------- /upload.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 NeoDC/HaydenK. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | 8 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 9 | 10 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 11 | */ 12 | //Project Lives at: https://github.com/mrneo240/NeoDC-Icondata-Tool 13 | 14 | var _submit = document.getElementById('_submit'), 15 | _file = document.getElementById('_file'), 16 | _progress = document.getElementById('_progress'); 17 | 18 | var upload = function () { 19 | 20 | if (_file.files.length === 0) { 21 | return; 22 | } 23 | 24 | var data = new FormData(); 25 | data.append('SelectedFile', _file.files[0]); 26 | 27 | var request = new XMLHttpRequest(); 28 | request.onreadystatechange = function () { 29 | if (request.readyState == 4) { 30 | try { 31 | var resp = JSON.parse(request.response); 32 | } catch (e) { 33 | var resp = { 34 | status: 'error', 35 | data: 'Unknown error occurred: [' + request.responseText + ']' 36 | }; 37 | } 38 | document.getElementById("status").innerHTML = '

' + resp.status + '

'; 39 | if (resp.status == 'success') { 40 | window.uploadedName = resp.data; 41 | window.rawName = resp.data.split('\\').pop().split('/').pop().split('.')[0]; 42 | document.getElementById("vmu").style.visibility = "visible"; 43 | window.setupBasics(); 44 | } 45 | } 46 | }; 47 | 48 | request.upload.addEventListener('progress', function (e) { 49 | _progress.style.width = Math.ceil(e.loaded / e.total) * 100 + '%'; 50 | }, false); 51 | 52 | request.open('POST', 'ajax_icondata.php?cmd=uploadImg'); 53 | request.send(data); 54 | } 55 | 56 | _submit.addEventListener('click', upload); -------------------------------------------------------------------------------- /upload/delete_me: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrneo240/NeoDC-Icondata-Tool/42c2c66028c14cbee9e3e946dd8584ec9388a7a8/upload/delete_me -------------------------------------------------------------------------------- /users/delete_me: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrneo240/NeoDC-Icondata-Tool/42c2c66028c14cbee9e3e946dd8584ec9388a7a8/users/delete_me -------------------------------------------------------------------------------- /util.php: -------------------------------------------------------------------------------- 1 | $msg, 21 | 'status' => $status, 22 | ))); 23 | } 24 | 25 | function createZipAndDownload($folder) 26 | { 27 | $file_names = array('ICONDATA.VMI', 'ICONDATA.VMS'); 28 | $zip = new ZipArchive(); 29 | //create the file and throw the error if unsuccessful 30 | if ($zip->open('.//upload//' . $folder . '//tmp.zip', ZIPARCHIVE::CREATE) !== true) { 31 | exit("cannot open <$archive_file_name>\n"); 32 | } 33 | //add each files of $file_name array to archive 34 | foreach ($file_names as $files) { 35 | $zip->addFile('.//upload//' . $folder . '//' . $files, $files); 36 | } 37 | $zip->close(); 38 | 39 | //also zip up vmu image stuff 40 | $file_names = array('PALLETTE.BIN', 'IMAGE.BIN'); 41 | $zip = new ZipArchive(); 42 | //create the file and throw the error if unsuccessful 43 | if ($zip->open('.//upload//' . $folder . '//vmu.zip', ZIPARCHIVE::CREATE) !== true) { 44 | exit("cannot open <$archive_file_name>\n"); 45 | } 46 | //add each files of $file_name array to archive 47 | foreach ($file_names as $files) { 48 | $zip->addFile('.//upload//' . $folder . '//' . $files, $files); 49 | } 50 | $zip->close(); 51 | //then send the headers to force download the zip file 52 | header("Content-type: application/zip"); 53 | header("Content-Disposition: attachment; filename=ICONDATA.ZIP"); 54 | header("Pragma: no-cache"); 55 | header("Expires: 0"); 56 | readfile('.//upload//' . $folder . '//tmp.zip'); 57 | exit; 58 | } 59 | 60 | function formatFilename($filename, $length = 8) 61 | { 62 | return str_pad(strtoupper(substr($filename, 0, $length)), $length, "_"); 63 | } 64 | 65 | function uniqueFilename($filename, $rename = true) 66 | { 67 | $foldername = dirname($filename) . '//'; 68 | $filenameOrig = $filename = basename($filename); 69 | $index = 0; 70 | while (is_file($foldername . formatFilename($filename, 6) . '_' . $index . '.VMS')) { 71 | $index++; 72 | } 73 | $filename = formatFilename($filename, 6) . '_' . $index . '.VMS'; 74 | if ($rename) {rename($filenameOrig, $filename);} 75 | return $filename; 76 | } 77 | 78 | function bigdecbin($dec, $doublewords = 1) 79 | { 80 | $erg = ""; 81 | do { 82 | $rest = $dec % 2147483648; 83 | if ($rest < 0) { 84 | $rest += 2147483648; 85 | } 86 | 87 | $erg = str_pad(decbin($rest), 31, "0", STR_PAD_LEFT) . $erg; 88 | $dec = ($dec - $rest) / 2147483648; 89 | } while (($dec > 0) && (!($dec < 1))); 90 | 91 | return str_pad($erg, $doublewords * 31, "0", STR_PAD_LEFT); 92 | } 93 | 94 | function ConvertBMP2GD($src, $dest = false) 95 | { 96 | if (!($src_f = fopen($src, "rb"))) { 97 | return false; 98 | } 99 | if (!($dest_f = fopen($dest, "wb"))) { 100 | return false; 101 | } 102 | $header = unpack("vtype/Vsize/v2reserved/Voffset", fread($src_f, 103 | 14)); 104 | $info = unpack("Vsize/Vwidth/Vheight/vplanes/vbits/Vcompression/Vimagesize/Vxres/Vyres/Vncolor/Vimportant", 105 | fread($src_f, 40)); 106 | 107 | extract($info); 108 | extract($header); 109 | 110 | if ($type != 0x4D42) { // signature "BM" 111 | return false; 112 | } 113 | 114 | $palette_size = $offset - 54; 115 | $ncolor = $palette_size / 4; 116 | $gd_header = ""; 117 | // true-color vs. palette 118 | $gd_header .= ($palette_size == 0) ? "\xFF\xFE" : "\xFF\xFF"; 119 | $gd_header .= pack("n2", $width, $height); 120 | $gd_header .= ($palette_size == 0) ? "\x01" : "\x00"; 121 | if ($palette_size) { 122 | $gd_header .= pack("n", $ncolor); 123 | } 124 | // no transparency 125 | $gd_header .= "\xFF\xFF\xFF\xFF"; 126 | 127 | fwrite($dest_f, $gd_header); 128 | 129 | if ($palette_size) { 130 | $palette = fread($src_f, $palette_size); 131 | $gd_palette = ""; 132 | $j = 0; 133 | while ($j < $palette_size) { 134 | $b = $palette{$j++}; 135 | $g = $palette{$j++}; 136 | $r = $palette{$j++}; 137 | $a = $palette{$j++}; 138 | $gd_palette .= "$r$g$b$a"; 139 | } 140 | $gd_palette .= str_repeat("\x00\x00\x00\x00", 256 - $ncolor); 141 | fwrite($dest_f, $gd_palette); 142 | } 143 | 144 | $scan_line_size = (($bits * $width) + 7) >> 3; 145 | $scan_line_align = ($scan_line_size & 0x03) ? 4 - ($scan_line_size & 146 | 0x03) : 0; 147 | 148 | for ($i = 0, $l = $height - 1; $i < $height; $i++, $l--) { 149 | // BMP stores scan lines starting from bottom 150 | fseek($src_f, $offset + (($scan_line_size + $scan_line_align) * 151 | $l)); 152 | $scan_line = fread($src_f, $scan_line_size); 153 | if ($bits == 24) { 154 | $gd_scan_line = ""; 155 | $j = 0; 156 | while ($j < $scan_line_size) { 157 | $b = $scan_line{$j++}; 158 | $g = $scan_line{$j++}; 159 | $r = $scan_line{$j++}; 160 | $gd_scan_line .= "\x00$r$g$b"; 161 | } 162 | } else if ($bits == 8) { 163 | $gd_scan_line = $scan_line; 164 | } else if ($bits == 4) { 165 | $gd_scan_line = ""; 166 | $j = 0; 167 | while ($j < $scan_line_size) { 168 | $byte = ord($scan_line{$j++}); 169 | $p1 = chr($byte >> 4); 170 | $p2 = chr($byte & 0x0F); 171 | $gd_scan_line .= "$p1$p2"; 172 | } 173 | $gd_scan_line = substr($gd_scan_line, 0, $width); 174 | } else if ($bits == 1) { 175 | $gd_scan_line = ""; 176 | $j = 0; 177 | while ($j < $scan_line_size) { 178 | $byte = ord($scan_line{$j++}); 179 | $p1 = chr((int) (($byte & 0x80) != 0)); 180 | $p2 = chr((int) (($byte & 0x40) != 0)); 181 | $p3 = chr((int) (($byte & 0x20) != 0)); 182 | $p4 = chr((int) (($byte & 0x10) != 0)); 183 | $p5 = chr((int) (($byte & 0x08) != 0)); 184 | $p6 = chr((int) (($byte & 0x04) != 0)); 185 | $p7 = chr((int) (($byte & 0x02) != 0)); 186 | $p8 = chr((int) (($byte & 0x01) != 0)); 187 | $gd_scan_line .= "$p1$p2$p3$p4$p5$p6$p7$p8"; 188 | } 189 | $gd_scan_line = substr($gd_scan_line, 0, $width); 190 | } 191 | 192 | fwrite($dest_f, $gd_scan_line); 193 | } 194 | fclose($src_f); 195 | fclose($dest_f); 196 | return true; 197 | } 198 | 199 | function imagecreatefrombmp($filename) 200 | { 201 | $tmp_name = tempnam("/tmp", "GD"); 202 | if (ConvertBMP2GD($filename, $tmp_name)) { 203 | $img = imagecreatefromgd($tmp_name); 204 | unlink($tmp_name); 205 | return $img; 206 | } 207 | return false; 208 | } 209 | -------------------------------------------------------------------------------- /vmi_format.php: -------------------------------------------------------------------------------- 1 | '0000', //dont touch 201 | 'Description' => $desc, //up to 32 characters 202 | 'Copyright'=> $cpy, 203 | 'vmuFilename'=> $vmu); //up to 32 characters 204 | //Generate a .VMI for the file "SONIC.VMS" 205 | createVMI($vmiDescription, $name); 206 | echo $name.'.VMI Written successfully
'; 207 | } 208 | 209 | function writeVMI_ICON($folder){ 210 | $desc = 'TEST'; 211 | if (isset($_REQUEST['desc'])) { $desc = $_REQUEST['desc'];} 212 | $cpy = 'NeoDC'; 213 | if (isset($_REQUEST['cpy'])) { $cpy = $_REQUEST['cpy'];} 214 | 215 | //Create a VMI like this, the second argument is the VMS filename(max length 8) 216 | //make sure the vms exists, rename after generation if nessecary to match the VMI 217 | $vmiDescription = array('Checksum' => '0000', //dont touch 218 | 'Description' => $desc, //up to 32 characters 219 | 'Copyright'=> $cpy); //up to 32 characters 220 | //Generate an ICONDATA.VMI file 221 | createVMI_ICON($vmiDescription,"ICONDATA", $folder); 222 | //echo './/upload//'.$folder.'//

ICONDATA.VMI Written successfully

'; 223 | //print_r($vmiDescription); 224 | 225 | createZipAndDownload($folder); 226 | } 227 | ?> -------------------------------------------------------------------------------- /vms_icondata.php: -------------------------------------------------------------------------------- 1 | '; 36 | for ($x = -1; $x < 32; $x++) { 37 | if (substr($lineData, $x, 1) == "1") { 38 | imagesetpixel($vms_image, $x + 1, $y, $black); 39 | } 40 | } 41 | } 42 | 43 | //printf('name:%s image:%d color:%d',$vms_name,$offsetImage[1],$offsetImageColor[1]); 44 | fseek($fp, $offsetImageColor[1]); 45 | $r = $g = $b = $a = 0xF; 46 | $paletteData = fread($fp, 32); 47 | $array = unpack("v16", $paletteData); 48 | $vms_palette = array(); 49 | echo "

Palette:


"; 50 | for ($i = 1; $i <= 16; $i++) { 51 | $b = $array[$i] & 0x0F; //low nibble 52 | $g = ($array[$i] & 0xF0) >> 4; //high nibble 53 | $r = ($array[$i] & 0xF00) >> 8; //higher nibble 54 | $a = ($array[$i] & 0xF000) >> 12; //highest nibble 55 | $b = ($b * 16) + $b; 56 | $r = ($r * 16) + $r; 57 | $a = ($a * 16) + $a; 58 | $g = ($g * 16) + $g; 59 | printf("
" . ($i - 1) . "
\n", $r, $g, $b); 60 | $vms_palette[$i - 1] = imagecolorallocate($vms_image_Color, $r, $g, $b); 61 | } 62 | echo '
'; 63 | $x = $y = 0; 64 | for ($y = 0; $y < 32; $y++) { 65 | $rowDataRaw = fread($fp, 16); 66 | $array = unpack("C16", $rowDataRaw); 67 | for ($x = 1; $x <= 16; $x++) { 68 | $col1 = $array[$x] & 0x0F; //low nibble 69 | $col2 = ($array[$x] & 0xF0) >> 4; //high nibble 70 | imagesetpixel($vms_image_Color, ($x - 1) * 2, $y, $vms_palette[$col2]); 71 | imagesetpixel($vms_image_Color, ($x - 1) * 2 + 1, $y, $vms_palette[$col1]); 72 | } 73 | } 74 | 75 | //header( "Content-type: image/png" ); 76 | ob_start(); 77 | imagepng($vms_image); 78 | $image_data = ob_get_contents(); 79 | ob_end_clean(); 80 | ob_start(); 81 | imagepng($vms_image_Color); 82 | $image_data_Color = ob_get_contents(); 83 | ob_end_clean(); 84 | echo 'bw image 86 | color image'; 88 | 89 | imagecolordeallocate($vms_image_Color, $background); 90 | imagedestroy($vms_image_Color); 91 | imagedestroy($vms_image); 92 | 93 | fclose($fp); 94 | -------------------------------------------------------------------------------- /vmuexplorer.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrneo240/NeoDC-Icondata-Tool/42c2c66028c14cbee9e3e946dd8584ec9388a7a8/vmuexplorer.exe --------------------------------------------------------------------------------