Make a Val with rust.
Build a https://www.val.town/ val with rust. This is an example of how to compile a rust file to wasm and use it as a val.
Requires rust, wasm-pack and deno.
- Put your code in
val.rs. - Build it.
Build a https://www.val.town/ val with rust. This is an example of how to compile a rust file to wasm and use it as a val.
Requires rust, wasm-pack and deno.
val.rs.| org 0 ; We use "org 0" so Relative Virtual Addresses (RVAs) are easy. | |
| ; This means that when we want an absolute Virtual Address we have | |
| ; to add IMAGE_BASE to the RVA (or whatever the base of that section is) | |
| IMAGE_BASE equ 0x400000 | |
| SECT_ALIGN equ 0x200 | |
| FILE_ALIGN equ 0x200 | |
| msdos_header: | |
| .magic db 'MZ' |
| #!/usr/bin/bash | |
| Clock(){ | |
| TIME=$(date "+%H:%M:%S") | |
| echo -e -n " \uf017 ${TIME}" | |
| } | |
| Cal() { | |
| DATE=$(date +"%Y/%m/%d [%a]") |
| // preprocessor macro - basically copies tree.h and puts | |
| // the contents where the include goes | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include "tree.h" | |
| int print_tree_hello() { |
| module Demo where | |
| -- notice many of these don't have type signatures. | |
| -- Haskell is smart enough figure out 99% of the type signatures for you. | |
| -- any type signatures here are just to add clarity. | |
| -- number | |
| somenumber = 1 | |
| -- string |
| const fs = require("fs"); | |
| const { SlippiGame } = require("@slippi/slippi-js"); | |
| const DSMASH_MOVE_ID = 12; | |
| const SAMUS_ID = 16; | |
| const BASE_DIR = "/mnt/c/Users/ycz/Documents/Slippi/Archive"; | |
| const RECORDS_FILE = "./dsmashStarts.json"; | |
| let loadedRecords; | |
| try { |
If you want to see how it works, see the README on the repo.
| import zstd | |
| from struct import pack as pk, unpack as up | |
| import subprocess as sp | |
| # Quick and dirty Spelunky 2 asset extraction, author SciresM. | |
| # Assets are protected by a weird chacha20 variant. | |
| # The developers made an unfortunate set of typos that | |
| # significantly weakens the asset crypto... | |
| def rotate_left(a, b): |
| #!/usr/bin/awk -f | |
| function line(x1, y1, x2, y2) { | |
| printf(" <line x1='%d' y1='%d' x2='%d' y2='%d'/>\n", | |
| x1, y1 + rand() * 5, x2, y2 + rand() * 10) | |
| } | |
| function path(d) { | |
| printf(" <path d='%s'/>\n", d) | |
| } |