- 👍 Modern language with really good WebAssembly support
- 👍 Great ecosystem where most crates work perfectly fine in WebAssembly
- 👍 Easy project setup
- 👎 Ownership and borrowing make things a little harder
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
struct Lexer<'a> { | |
input: &'a str, | |
total_len: usize, | |
} | |
impl<'a> Lexer<'a> { | |
fn new(input: &'a str) -> Self { | |
Self { | |
input, | |
total_len: input.len(), |
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
[package] | |
name = "liveplit-one-auto-splitter-server" | |
version = "0.1.0" | |
edition = "2021" | |
[dependencies] | |
livesplit-auto-splitting = { path = "P:\\livesplit-core\\crates\\livesplit-auto-splitting" } | |
tokio-tungstenite = "0.21.0" | |
tokio = { version = "1.37.0", features = ["macros", "rt", "sync"] } | |
futures-util = "0.3.30" |
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
use std::{ | |
marker::PhantomData, | |
mem, | |
ops::{Deref, DerefMut}, | |
ptr::{self, NonNull}, | |
}; | |
use bytemuck::{AnyBitPattern, Zeroable}; | |
mod utils; |
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
#![no_std] | |
use asr::{ | |
future::{next_tick, retry}, | |
signature::Signature, | |
timer, Process, | |
}; | |
asr::panic_handler!(); |
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
package asr | |
import "time" | |
type TimerState = uint32 | |
type ProcessId = uint64 | |
type Address = uint64 | |
func decodeString(text string) (*byte, uint) { | |
return decodeSlice(([]byte)(text)) |
We can't use std's Instant as it's insufficiently specified. It neither guarantees "real time" nor does it guarantee measuring "uptime" (the time the OS has been awake rather than suspended), meaning that you can't actually rely on it in practice. In livesplit-core we definitely want real time rather than uptime. Various operating systems are problematic:
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
#include "asr/asr_helpers.h" | |
#include "asr/mini_libc.h" | |
ProcessId process = 0; | |
Address unity = 0; | |
uint8_t old_run_active = 0; | |
uint8_t old_timer_paused = 0; | |
typedef struct { |
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
/** | |
* Sets the tick rate of the runtime. This influences the amount of times the | |
* `update` function is called per second. | |
*/ | |
declare function setTickRate(ticksPerSecond: number): void; | |
/** Prints a log message for debugging purposes. */ | |
declare function printMessage(message: unknown): void; | |
declare type Address = BigInt; |
NewerOlder