unoffical wafrn mirror wafrn.net
atproto social-network activitypub
at angular21 305 lines 12 kB view raw
1<!doctype html> 2<html> 3 <head> 4 <meta charset="utf-8" /> 5 <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> 6 <style> 7 body { 8 width: 100%; 9 height: 100%; 10 margin-top: 0; 11 margin-left: 0px; 12 background: rgba(0, 0, 0, 0); 13 } 14 progress { 15 -webkit-appearance: none; 16 -moz-appearance: none; 17 appearance: none; 18 position: absolute; 19 width: 250px; 20 height: 50px; 21 } 22 #canvas { 23 image-rendering: pixelated; 24 width: 100%; 25 } 26 #container { 27 display: flex; 28 height: 100%; 29 justify-content: center; 30 align-items: center; 31 } 32 </style> 33 </head> 34 <body> 35 <div id="container"> 36 <progress hidden id="progress" max="100" value="0"></progress 37 ><canvas height="600" id="canvas" oncontextmenu="event.preventDefault()" width="800"></canvas> 38 </div> 39 <button id="fullscreenBtn">Go Fullscreen</button> 40 <script> 41 var progressElement = document.getElementById('progress'), 42 Module = { 43 print: (...e) => { 44 var t = e.join(' ') 45 console.log(t) 46 }, 47 canvas: document.getElementById('canvas'), 48 setStatus: (e) => { 49 if ( 50 (Module.setStatus.last || (Module.setStatus.last = { time: Date.now(), text: '' }), 51 e !== Module.setStatus.last.text) 52 ) { 53 var t = e.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/), 54 s = Date.now() 55 ;(t && s - Module.setStatus.last.time < 30) || 56 ((Module.setStatus.last.time = s), 57 (Module.setStatus.last.text = e), 58 t 59 ? ((e = t[1]), 60 (progressElement.value = 100 * parseInt(t[2])), 61 (progressElement.max = 100 * parseInt(t[4])), 62 (progressElement.hidden = !1)) 63 : ((progressElement.value = null), (progressElement.max = null), (progressElement.hidden = !0))) 64 } 65 } 66 } 67 document.getElementById('fullscreenBtn').addEventListener('click', function () { 68 var e = document.getElementById('canvas') 69 e.requestFullscreen 70 ? e.requestFullscreen() 71 : e.mozRequestFullScreen 72 ? e.mozRequestFullScreen() 73 : e.webkitRequestFullscreen 74 ? e.webkitRequestFullscreen() 75 : e.msRequestFullscreen && e.msRequestFullscreen() 76 }) 77 </script> 78 <script async src="dosbox.js"></script> 79 </body> 80</html> 81<script type="text/javascript"> 82 var Module = typeof Module != 'undefined' ? Module : {} 83 84 if (!Module.expectedDataFileDownloads) { 85 Module.expectedDataFileDownloads = 0 86 } 87 88 Module.expectedDataFileDownloads++ 89 ;(() => { 90 // Do not attempt to redownload the virtual filesystem data when in a pthread or a Wasm Worker context. 91 var isPthread = typeof ENVIRONMENT_IS_PTHREAD != 'undefined' && ENVIRONMENT_IS_PTHREAD 92 var isWasmWorker = typeof ENVIRONMENT_IS_WASM_WORKER != 'undefined' && ENVIRONMENT_IS_WASM_WORKER 93 if (isPthread || isWasmWorker) return 94 function loadPackage(metadata) { 95 var PACKAGE_PATH = '' 96 if (typeof window === 'object') { 97 PACKAGE_PATH = window['encodeURIComponent']( 98 window.location.pathname.toString().substring(0, window.location.pathname.toString().lastIndexOf('/')) + '/' 99 ) 100 } else if (typeof process === 'undefined' && typeof location !== 'undefined') { 101 // web worker 102 PACKAGE_PATH = encodeURIComponent( 103 location.pathname.toString().substring(0, location.pathname.toString().lastIndexOf('/')) + '/' 104 ) 105 } 106 var PACKAGE_NAME = '/home/leonie/Documents/projects/Sharkey/em-dosbox/src/doom.data' 107 var REMOTE_PACKAGE_BASE = 'doom.data' 108 if (typeof Module['locateFilePackage'] === 'function' && !Module['locateFile']) { 109 Module['locateFile'] = Module['locateFilePackage'] 110 err( 111 'warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)' 112 ) 113 } 114 var REMOTE_PACKAGE_NAME = Module['locateFile'] 115 ? Module['locateFile'](REMOTE_PACKAGE_BASE, '') 116 : REMOTE_PACKAGE_BASE 117 var REMOTE_PACKAGE_SIZE = metadata['remote_package_size'] 118 119 function fetchRemotePackage(packageName, packageSize, callback, errback) { 120 if ( 121 typeof process === 'object' && 122 typeof process.versions === 'object' && 123 typeof process.versions.node === 'string' 124 ) { 125 require('fs').readFile(packageName, function (err, contents) { 126 if (err) { 127 errback(err) 128 } else { 129 callback(contents.buffer) 130 } 131 }) 132 return 133 } 134 var xhr = new XMLHttpRequest() 135 xhr.open('GET', packageName, true) 136 xhr.responseType = 'arraybuffer' 137 xhr.onprogress = function (event) { 138 var url = packageName 139 var size = packageSize 140 if (event.total) size = event.total 141 if (event.loaded) { 142 if (!xhr.addedTotal) { 143 xhr.addedTotal = true 144 if (!Module.dataFileDownloads) Module.dataFileDownloads = {} 145 Module.dataFileDownloads[url] = { 146 loaded: event.loaded, 147 total: size 148 } 149 } else { 150 Module.dataFileDownloads[url].loaded = event.loaded 151 } 152 var total = 0 153 var loaded = 0 154 var num = 0 155 for (var download in Module.dataFileDownloads) { 156 var data = Module.dataFileDownloads[download] 157 total += data.total 158 loaded += data.loaded 159 num++ 160 } 161 total = Math.ceil((total * Module.expectedDataFileDownloads) / num) 162 Module['setStatus']?.(`Downloading data... (${loaded}/${total})`) 163 } else if (!Module.dataFileDownloads) { 164 Module['setStatus']?.('Downloading data...') 165 } 166 } 167 xhr.onerror = function (event) { 168 throw new Error('NetworkError for: ' + packageName) 169 } 170 xhr.onload = function (event) { 171 if (xhr.status == 200 || xhr.status == 304 || xhr.status == 206 || (xhr.status == 0 && xhr.response)) { 172 // file URLs can return 0 173 var packageData = xhr.response 174 callback(packageData) 175 } else { 176 throw new Error(xhr.statusText + ' : ' + xhr.responseURL) 177 } 178 } 179 xhr.send(null) 180 } 181 182 function handleError(error) { 183 console.error('package error:', error) 184 } 185 186 var fetchedCallback = null 187 var fetched = Module['getPreloadedPackage'] 188 ? Module['getPreloadedPackage'](REMOTE_PACKAGE_NAME, REMOTE_PACKAGE_SIZE) 189 : null 190 191 if (!fetched) 192 fetchRemotePackage( 193 REMOTE_PACKAGE_NAME, 194 REMOTE_PACKAGE_SIZE, 195 function (data) { 196 if (fetchedCallback) { 197 fetchedCallback(data) 198 fetchedCallback = null 199 } else { 200 fetched = data 201 } 202 }, 203 handleError 204 ) 205 206 function runWithFS(Module) { 207 function assert(check, msg) { 208 if (!check) throw msg + new Error().stack 209 } 210 211 /** @constructor */ 212 function DataRequest(start, end, audio) { 213 this.start = start 214 this.end = end 215 this.audio = audio 216 } 217 DataRequest.prototype = { 218 requests: {}, 219 open: function (mode, name) { 220 this.name = name 221 this.requests[name] = this 222 Module['addRunDependency'](`fp ${this.name}`) 223 }, 224 send: function () {}, 225 onload: function () { 226 var byteArray = this.byteArray.subarray(this.start, this.end) 227 this.finish(byteArray) 228 }, 229 finish: function (byteArray) { 230 var that = this 231 // canOwn this data in the filesystem, it is a slide into the heap that will never change 232 Module['FS_createDataFile'](this.name, null, byteArray, true, true, true) 233 Module['removeRunDependency'](`fp ${that.name}`) 234 this.requests[this.name] = null 235 } 236 } 237 238 var files = metadata['files'] 239 for (var i = 0; i < files.length; ++i) { 240 new DataRequest(files[i]['start'], files[i]['end'], files[i]['audio'] || 0).open('GET', files[i]['filename']) 241 } 242 243 function processPackageData(arrayBuffer) { 244 assert(arrayBuffer, 'Loading data file failed.') 245 assert(arrayBuffer.constructor.name === ArrayBuffer.name, 'bad input to processPackageData') 246 var byteArray = new Uint8Array(arrayBuffer) 247 var curr 248 // Reuse the bytearray from the XHR as the source for file reads. 249 DataRequest.prototype.byteArray = byteArray 250 var files = metadata['files'] 251 for (var i = 0; i < files.length; ++i) { 252 DataRequest.prototype.requests[files[i].filename].onload() 253 } 254 Module['removeRunDependency']('datafile_/home/leonie/Documents/projects/Sharkey/em-dosbox/src/doom.data') 255 } 256 Module['addRunDependency']('datafile_/home/leonie/Documents/projects/Sharkey/em-dosbox/src/doom.data') 257 258 if (!Module.preloadResults) Module.preloadResults = {} 259 260 Module.preloadResults[PACKAGE_NAME] = { fromCache: false } 261 if (fetched) { 262 processPackageData(fetched) 263 fetched = null 264 } else { 265 fetchedCallback = processPackageData 266 } 267 } 268 if (Module['calledRun']) { 269 runWithFS(Module) 270 } else { 271 if (!Module['preRun']) Module['preRun'] = [] 272 Module['preRun'].push(runWithFS) // FS is not initialized yet, wait for it 273 } 274 } 275 loadPackage({ 276 files: [ 277 { filename: '/DEFAULT.CFG', start: 0, end: 769 }, 278 { filename: '/DM.DOC', start: 769, end: 7166 }, 279 { filename: '/DM.EXE', start: 7166, end: 40806 }, 280 { filename: '/DMFAQ66A.TXT', start: 40806, end: 161007 }, 281 { filename: '/DMFAQ66B.TXT', start: 161007, end: 301601 }, 282 { filename: '/DMFAQ66C.TXT', start: 301601, end: 378499 }, 283 { filename: '/DMFAQ66D.TXT', start: 378499, end: 413071 }, 284 { filename: '/DOOM.EXE', start: 413071, end: 1122976 }, 285 { filename: '/DOOM1.WAD', start: 1122976, end: 5318996 }, 286 { filename: '/DWANGO.DOC', start: 5318996, end: 5329619 }, 287 { filename: '/DWANGO.EXE', start: 5329619, end: 5394640 }, 288 { filename: '/DWANGO.STR', start: 5394640, end: 5397176 }, 289 { filename: '/HELPME.TXT', start: 5397176, end: 5401866 }, 290 { filename: '/IPXSETUP.EXE', start: 5401866, end: 5419917 }, 291 { filename: '/MODEM.CFG', start: 5419917, end: 5419984 }, 292 { filename: '/MODEM.NUM', start: 5419984, end: 5420051 }, 293 { filename: '/MODEM.STR', start: 5420051, end: 5423456 }, 294 { filename: '/ORDER.FRM', start: 5423456, end: 5428073 }, 295 { filename: '/README.TXT', start: 5428073, end: 5449704 }, 296 { filename: '/SERSETUP.EXE', start: 5449704, end: 5469961 }, 297 { filename: '/SETUP.EXE', start: 5469961, end: 5515845 }, 298 { filename: '/file_id.diz', start: 5515845, end: 5516024 } 299 ], 300 remote_package_size: 5516024 301 }) 302 })() 303 304 Module['arguments'] = ['./DOOM.EXE'] 305</script>