mirror of
https://github.com/demostf/cutter.git
synced 2026-06-03 11:54:08 +02:00
wip
This commit is contained in:
parent
df7394a816
commit
1be42764ad
9 changed files with 7252 additions and 44 deletions
|
|
@ -1,11 +1,36 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Hello wasm-pack!</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>This page contains webassembly and javascript content, please enable javascript in your browser.</noscript>
|
||||
<script src="./bootstrap.js"></script>
|
||||
</body>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>POV demo camera unlocker</title>
|
||||
<style>
|
||||
input[disabled] {
|
||||
opacity: 0.5;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>This page contains webassembly and javascript content, please enable javascript in your browser.</noscript>
|
||||
<script src="./bootstrap.js"></script>
|
||||
<h1>POV demo camera unlocker</h1>
|
||||
|
||||
Unlocks the camera in POV demos to allow the same controls as when viewing STV demos.
|
||||
|
||||
<p>Select a demo file below to begin processing, once processed the file will be presented as download</p>
|
||||
<p>Processing demo files can take a while</p>
|
||||
<form>
|
||||
<input type="number" id="start" value="30000">
|
||||
<input type="number" id="end" value="50000">
|
||||
<input type="file" id="file">
|
||||
</form>
|
||||
|
||||
<p>
|
||||
Note:
|
||||
</p>
|
||||
<ul>
|
||||
<li>The demo still being recorded as POV demo means that only data around the recording player is in the demo file, players not near the recorder will behave weirdly</li>
|
||||
<li>When the player respawns the freecam camera will be moved</li>
|
||||
<li>The resulting demo might not work or crash tf2 on playback in rare cases</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
33
www/index.js
33
www/index.js
|
|
@ -1,3 +1,32 @@
|
|||
import * as wasm from "hello-wasm-pack";
|
||||
import {cut} from "democutter";
|
||||
|
||||
wasm.greet();
|
||||
|
||||
let fileSelect = document.getElementById('file');
|
||||
let startInput = document.getElementById('start');
|
||||
let endInput = document.getElementById('end');
|
||||
fileSelect.addEventListener('change', (event) => {
|
||||
let start = parseInt(startInput.value);
|
||||
let end = parseInt(endInput.value);
|
||||
console.log(start, end);
|
||||
fileSelect.disabled = true;
|
||||
let reader = new FileReader();
|
||||
reader.readAsArrayBuffer(fileSelect.files[0]);
|
||||
reader.addEventListener('load', () => {
|
||||
console.log(reader.result);
|
||||
let result = cut(new Uint8Array(reader.result), start, end);
|
||||
fileSelect.disabled = false;
|
||||
save(result, "cut.dem");
|
||||
});
|
||||
});
|
||||
|
||||
function save(data, fileName) {
|
||||
let a = document.createElement("a");
|
||||
document.body.appendChild(a);
|
||||
a.style = "display: none";
|
||||
let blob = new Blob([data], {type: "octet/stream"});
|
||||
let url = window.URL.createObjectURL(blob);
|
||||
a.href = url;
|
||||
a.download = fileName;
|
||||
a.click();
|
||||
window.URL.revokeObjectURL(url);
|
||||
}
|
||||
|
|
|
|||
6978
www/package-lock.json
generated
6978
www/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -26,8 +26,10 @@
|
|||
"url": "https://github.com/rustwasm/create-wasm-app/issues"
|
||||
},
|
||||
"homepage": "https://github.com/rustwasm/create-wasm-app#readme",
|
||||
"dependencies": {
|
||||
"democutter": "file:../pkg"
|
||||
},
|
||||
"devDependencies": {
|
||||
"hello-wasm-pack": "^0.1.0",
|
||||
"webpack": "^4.29.3",
|
||||
"webpack-cli": "^3.1.0",
|
||||
"webpack-dev-server": "^3.1.5",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue