-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Serial: Silence a lot of debug logging
- Loading branch information
0 parents
commit b09594c
Showing
16 changed files
with
17,787 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,249 @@ | ||
var textDecoder = new TextDecoder(); | ||
var gameCanvas = document.getElementById('canvas'); | ||
var context = gameCanvas.getContext('2d'); | ||
context.fillStyle = '#000'; | ||
context.fillRect(0, 0, gameCanvas.width, gameCanvas.height); | ||
context.fillStyle = '#dc8'; | ||
context.textAlign = 'center'; | ||
context.font = '32px monospace'; | ||
context.fillText( | ||
':: LOAFING ::', | ||
(gameCanvas.width / 2), | ||
(gameCanvas.height / 2) + 8, | ||
); | ||
gameCanvas.addEventListener('wheel', function (event) { | ||
// I will never care about using scroll events in engine, | ||
// so prevent SDL's scroll handling from trapping scroll, | ||
// which prevents a user's ability to scroll the page. | ||
event.stopImmediatePropagation(); | ||
}); | ||
|
||
var loadedDataMap = {}; | ||
var createdPaths = {}; | ||
var mkdirp = function (_pathSplit) { | ||
var pathSplit = _pathSplit.slice(); | ||
var joined = pathSplit.join('/'); | ||
var parent = ''; | ||
while (pathSplit.length) { | ||
var item = pathSplit.shift(); | ||
if (!createdPaths[joined]) { | ||
FS.createPath( | ||
parent || '/', | ||
item, | ||
true, | ||
true | ||
); | ||
parent += '/' + item; | ||
createdPaths[parent] = true; | ||
} | ||
} | ||
}; | ||
var setDataToPathInVirtualFS = function (path, uintArray) { | ||
var pathSplit = path.split('/'); | ||
var fileName = pathSplit.pop(); | ||
var parent = '/' + pathSplit.join('/'); | ||
mkdirp(pathSplit); | ||
FS.createDataFile( | ||
parent, | ||
fileName, | ||
uintArray, | ||
true, | ||
false | ||
); | ||
}; | ||
var addLoadedFilePathToVirtualFS = function (path) { | ||
setDataToPathInVirtualFS( | ||
path, | ||
loadedDataMap[path], | ||
) | ||
}; | ||
var enableSaveFilePersistence = function () { | ||
var saveFilePath = 'MAGE/save_games'; | ||
var split = saveFilePath.split('/'); | ||
mkdirp(split); | ||
FS.mount( | ||
window.IDBFS, | ||
{}, | ||
saveFilePath | ||
); | ||
return new Promise(function (resolve, reject) { | ||
FS.syncfs(true, function (err) { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
console.log('IDBFS state applied to Virtual Filesystem'); | ||
resolve(); | ||
} | ||
}); | ||
}); | ||
}; | ||
var emscriptenReadyResolve; | ||
var emscriptenReadyPromise = new Promise(function (resolve, reject) { | ||
emscriptenReadyResolve = function (err) { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
console.log('Emscripten reports `RuntimeInitialized`, game ready to launch'); | ||
resolve(); | ||
} | ||
}; | ||
}); | ||
var Module = { | ||
canvas: gameCanvas, // compensates for emscripten startup weirdness - IMPORTANT | ||
noInitialRun: true, // because preInit isn't promise based, need to start manually | ||
onRuntimeInitialized: emscriptenReadyResolve, | ||
print: createOutputFunction('stdout'), // handles output strings from stdout | ||
printErr: createOutputFunction('stderr'),// handles output strings from stderr | ||
preInit: function() { | ||
installStdInReplacement(FS); | ||
Object.keys(loadedDataMap).forEach(addLoadedFilePathToVirtualFS); | ||
Promise.all([ | ||
enableSaveFilePersistence(), | ||
emscriptenReadyPromise, | ||
]) | ||
.then(function () { | ||
// Starts the WebAssembly main loop in the most normal way possible, | ||
// considering that we're disabling it via `noInitialRun` above. | ||
Module.callMain(); | ||
}); | ||
}, | ||
// May look unused, but is actually called by C code | ||
persistSaveFiles: function () { | ||
FS.syncfs(false, function (err) { | ||
if (err) { | ||
throw err; | ||
} else { | ||
console.log('Save files persisted to IndexedDB, probably.'); | ||
} | ||
}); | ||
}, | ||
}; | ||
|
||
var getModificationHeaders = function (response) { | ||
return response.headers.get('last-modified'); | ||
}; | ||
|
||
var fetchBinaryDataFromPath = function (path) { | ||
var headersPromise = fetch(path, { | ||
method: 'HEAD' | ||
}).then(getModificationHeaders); | ||
var localAssetAndRemoteHeadPromises = Promise.all([ | ||
localforage.getItem(path), | ||
headersPromise, | ||
]); | ||
return localAssetAndRemoteHeadPromises.then(function (results) { | ||
var localResult = (results[0] || {data: null}); | ||
var serverLastModified = results[1]; | ||
var result = localResult.data; | ||
var localDataIsEmpty = result === null; | ||
var modificationMismatch = localResult.lastModified !== serverLastModified; | ||
if ( | ||
localDataIsEmpty | ||
|| modificationMismatch | ||
) { | ||
result = fetch(path).then(function (response) { | ||
return response.arrayBuffer().then(function (arrayBuffer) { | ||
return localforage.setItem(path, { | ||
lastModified: getModificationHeaders(response), | ||
data: arrayBuffer, | ||
}).then(function () { | ||
return arrayBuffer; | ||
}); | ||
}); | ||
}); | ||
} | ||
return result; | ||
}) | ||
.then(function (arrayBuffer) { | ||
return loadedDataMap[path] = new Uint8Array(arrayBuffer); | ||
}); | ||
}; | ||
|
||
var filesToPreload = [ | ||
'MAGE/desktop_assets/window_frame.png', | ||
'MAGE/desktop_assets/window_frame-keyboard.png', | ||
'MAGE/desktop_assets/window_frame-led.png', | ||
'MAGE/game.dat', | ||
]; | ||
|
||
var fileLoadPromises = filesToPreload.map(fetchBinaryDataFromPath); | ||
|
||
Promise.all(fileLoadPromises) | ||
.then(function(resolvedFiles) { | ||
console.log('resolvedFiles', resolvedFiles); | ||
var scriptElement = document.createElement('script'); | ||
scriptElement.src = './bm_badge.js'; | ||
document.body.appendChild(scriptElement); | ||
}); | ||
|
||
var handleFileDropIntoPage = function(event) { | ||
event.preventDefault(); | ||
if (event.type === 'drop') { | ||
var itemList = Array.prototype.slice.call(event.dataTransfer.items); | ||
var item = itemList[0]; | ||
var file = item.getAsFile(); | ||
console.log('handleFileDropIntoPage', event, file); | ||
file.arrayBuffer().then(function (arrayBuffer) { | ||
var uint8Array = new Uint8Array(arrayBuffer); | ||
var headerStringUint8Array = uint8Array.slice(0, 8); | ||
var headerText = textDecoder.decode(headerStringUint8Array); | ||
if (headerText !== 'MAGEGAME') { | ||
alert('The file you dragged is not a valid `MAGEGAME` data file!'); | ||
} else { | ||
var headerCrc32Uint8Array = uint8Array.slice(8, 12); | ||
var headerCrc32String = ( | ||
'0x' | ||
+ Array.from(headerCrc32Uint8Array) | ||
.map((value)=>value.toString(16)) | ||
.join('') | ||
); | ||
var headerLengthUint32Array = new Uint32Array(uint8Array.slice(12, 16)); | ||
var path = 'Dragged'; | ||
var gameHeaderLabel = [ | ||
'Source: ' + path, | ||
'CRC32: ' + headerCrc32String, | ||
'Length: ' + headerLengthUint32Array[0], | ||
].join(' | '); | ||
console.log('handleFileDropIntoPage:gameHeaderLabel'); | ||
console.log(gameHeaderLabel); | ||
// don't persist this until we add GUI to allow users to delete bad ROMs | ||
FS.unlink('MAGE/game.dat'); | ||
setDataToPathInVirtualFS( | ||
'MAGE/game.dat', | ||
uint8Array, | ||
); | ||
Module.ccall( | ||
'EngineTriggerRomReload', | ||
undefined, | ||
undefined, | ||
undefined, | ||
{ | ||
async: true | ||
} | ||
); | ||
} | ||
}); | ||
} | ||
}; | ||
|
||
// weirdly, if you don't preventDefault on dragover & dragenter, | ||
// your drop handler will never fire??? | ||
document.body.addEventListener('dragover', handleFileDropIntoPage); | ||
document.body.addEventListener('dragenter', handleFileDropIntoPage); | ||
document.body.addEventListener('drop', handleFileDropIntoPage); | ||
|
||
var consoleToggler = document.getElementById('toggle-console'); | ||
var consoleHolder = document.getElementById('console-holder'); | ||
var hideConsoleStyle = consoleHolder.style.cssText; | ||
var toggleConsole = function () { | ||
consoleHolder.style = consoleHolder.style.cssText === '' | ||
? hideConsoleStyle | ||
: ''; | ||
} | ||
var handleKeydown = function (keydownEvent) { | ||
if (keydownEvent.key === '`') { | ||
toggleConsole() | ||
} | ||
}; | ||
window.addEventListener('keydown', handleKeydown); | ||
consoleToggler.addEventListener('click', toggleConsole); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
var terminalFrame = document.getElementById('terminal_iframe'); | ||
|
||
var stdinMessage = ''; | ||
var commandComplete = false; | ||
// Why one charCode at a time? | ||
// That's the only way Emscripten allows a stdin replacement. | ||
var stdin = function () { | ||
var result = null; | ||
if (stdinMessage.length) { | ||
var split = stdinMessage.split(''); | ||
var char = split.shift(); | ||
stdinMessage = split.join(''); | ||
result = char.charCodeAt(0); | ||
if (!split.length && !commandComplete) { | ||
stdinMessage = '\n'; | ||
commandComplete = true; | ||
} else { | ||
commandComplete = false; | ||
} | ||
} | ||
return result; | ||
}; | ||
var installStdInReplacement = function (FS) { | ||
// use our stdin replacement because the default is idiotically window.alert | ||
FS.init(stdin); | ||
}; | ||
var enterCommand = function (command) { | ||
stdinMessage = command; | ||
}; | ||
|
||
// pass messages to stdin, but triggered from a child frame: | ||
// Why in a frame? Because SDL event handlers capture ALL INPUT | ||
// on the page and prevent text entry into simple form inputs. | ||
// So break out of that garbage and restore normal form behavior | ||
// into a context it can't possibly break: a child frame. | ||
window.addEventListener('message', function (messageEvent) { | ||
enterCommand(messageEvent.data); | ||
}); | ||
|
||
// Emscripten generates a bunch of non-actionable noise which | ||
// should be passed through to browser console log/warn, | ||
// and NOT POLLUTING stdout/stderr!!! Filter that garbage! | ||
var emscriptenLogNoiseIndicators = [ | ||
'Incorrect response MIME type', | ||
'ArrayBuffer instantiation', | ||
'Calling stub', | ||
'emscripten_', | ||
] | ||
var detectEmscriptenNoise = function (message) { | ||
return emscriptenLogNoiseIndicators.every(function (noiseIndicator) { | ||
return !message.includes(noiseIndicator); | ||
}); | ||
}; | ||
|
||
// emulate stdout/stderr, passing messages to a child frame: | ||
// to allow the ability to use normal keyboard/focus interaction | ||
// inside of the terminal frame, because that would normally be | ||
// ruined by the overly aggressive SDL input event handling. | ||
var consoleSourceKey = { | ||
stdin: 'log', | ||
stderr: 'warn', | ||
}; | ||
var honk = function () { | ||
console.log("Honk!"); | ||
var snd = new Audio("data:audio/mpeg;base64,SUQzBAAAAAACPVRYWFgAAAAYAAADVFNTAExvZ2ljIFBybyBYIDEwLjQuNgBUWFhYAAAAZQAAA2lUdW5OT1JNACAwMDAwMDdBMCAwMDAwMDdBMSAwMDAwMEYzMCAwMDAwMEYzNCAwMDAwMDA4MiAwMDAwMDA4MiAwMDAwNDY0MSAwMDAwNDZDRCAwMDAwMDA5QyAwMDAwMDA5QwBUWFhYAAAAfwAAA2lUdW5TTVBCACAwMDAwMDAwMCAwMDAwMDIxMCAwMDAwMDhERiAwMDAwMDAwMDAwMDAyQjExIDAwMDAwMDAwIDAwMDAwODJBIDAwMDAwMDAwIDAwMDAwMDAwIDAwMDAwMDAwIDAwMDAwMDAwIDAwMDAwMDAwIDAwMDAwMDAwAFRTU0UAAAAPAAADTGF2ZjU3LjgzLjEwMAAAAAAAAAAAAAAA//tQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASW5mbwAAAA8AAAANAAAWCQAcHBwcHBwcLy8vLy8vLy9CQkJCQkJCQlVVVVVVVVVoaGhoaGhoaHt7e3t7e3t7jo6Ojo6OjqGhoaGhoaGhtLS0tLS0tLTHx8fHx8fH2tra2tra2trt7e3t7e3t7f////////8AAAAATGF2YzU3LjEwAAAAAAAAAAAAAAAAJAJAAAAAAAAAFgm0XT12AAAAAAAAAAAAAAAAAAAAAP/7kGQAAwMyZjmAYBsCLMAH3AQjAAnNSwEBBHXJMQAgVBCNuxFd+u5n13ypom4cWSbu7nohBwNzQkz+E7oiO7wnAAAGBu55u5k5/oW+m7ohdAxb7vCrgZo59/9ERFAxbx0EUOLNz3c8nhJoT/X04VDgYuuHFoTu9c//y9EIOBi65yhz6nQ4v/qR0fauIiI8y0px6i7yEnL4PrfegQOW/t1vo/id9/f1Ok5Py7/lHH5fJ/+qt/t/kwCBAG0q95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gItZmhBIKaK6N+K7/N/8fmhBOJoKaFBRVjEFN6C1TEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVQ=="); | ||
snd.play(); | ||
} | ||
window.honk = honk; | ||
var createOutputFunction = function (source) { | ||
return function (message) { | ||
// console.log(output); | ||
if (detectEmscriptenNoise(message)) { | ||
terminalFrame.contentWindow.postMessage( | ||
{ | ||
source: source, | ||
value: message | ||
}, | ||
window.origin, | ||
) | ||
if (message.includes("\u0007")) { | ||
honk(); | ||
} | ||
} else { | ||
console[consoleSourceKey[source]](message); | ||
} | ||
} | ||
}; | ||
|
||
// because clicking on the canvas itself gets preventDefault'd | ||
// by the SDL click handlers, and that stops that the parent | ||
// window from getting a focus event follow-through, so call it | ||
// manually here, so player can resume playing game by clicking | ||
// on the canvas after typing in the terminal. :facepalm: | ||
var focusParentWindowOnCanvasInteraction = function () { | ||
window.focus(); | ||
}; | ||
window.addEventListener('mousedown', focusParentWindowOnCanvasInteraction); | ||
window.addEventListener('touchstart', focusParentWindowOnCanvasInteraction); |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.