From eb6f8e953e82284a710eb566de69302f780d5e57 Mon Sep 17 00:00:00 2001 From: Eein Date: Sun, 2 Apr 2023 20:23:47 -0700 Subject: [PATCH] add some readme notes and os check --- Cargo.lock | 14 +++++++------- Cargo.toml | 2 +- README.md | 5 +++++ src/lib.rs | 12 ++++++++++-- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 67033ec..9d8f9d7 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,14 +2,20 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + [[package]] name = "asr" version = "0.1.0" source = "git+https://github.com/CryZe/asr#4949bad1925169ce2382ff6378e56e6ece02b0c8" dependencies = [ + "arrayvec", "bytemuck", "itoa", - "memchr", "time", ] @@ -82,12 +88,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - [[package]] name = "num_threads" version = "0.1.6" diff --git a/Cargo.toml b/Cargo.toml index f6f7cd2..e9c1bb3 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -asr = { git = "https://github.com/CryZe/asr", features = ["integer-vars", "signature"] } +asr = { git = "https://github.com/CryZe/asr", features = ["integer-vars", "strings"] } bitflags = "1.3.2" bytemuck = "1.12.1" spinning_top = "0.2.3" diff --git a/README.md b/README.md index d26b957..71b7085 100755 --- a/README.md +++ b/README.md @@ -1,8 +1,13 @@ # Octopath Traveler 2 WASM Autosplitter +A Windows and Linux autosplitter for Octopath Traveler 2 + +(May work on mac if someone asks for it) + # TODO: ## Install +Since this autosplitter is in prerelease, you'll need to download the following file and add an autosplitter component to your splits and add this file. WASM files should not be supported in mainline livesplit. https://github.com/Eein/octopath-traveler-2-autosplitter-wasm/releases/latest/download/octopath_traveler_2_autosplitter_wasm.wasm diff --git a/src/lib.rs b/src/lib.rs index 9a6aa06..e4af0a5 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,13 +2,15 @@ use spinning_top::{const_spinlock, Spinlock}; use std::collections::HashSet; use std::fmt::{Display, Formatter, Result}; +use std::env; use bytemuck::Pod; use asr::{ timer::{self, TimerState}, watcher::Pair, - Address, Process + Address, Process, + get_os }; // mod data; @@ -128,7 +130,13 @@ pub struct Splits(HashSet); pub extern "C" fn update() { let mut state = STATE.lock(); if state.game.is_none() { - match Process::attach("Octopath_Traveler2") { + let os = get_os().unwrap(); + let process_for_os = match os.as_str() { + "windows" => "Octopath_Traveler2", + "linux" => "Octopath_Travel", + _ => "Octopath_Traveler2" + }; + match Process::attach(process_for_os) { Some(process) => { match process.get_module_address("Octopath_Traveler2-Win64-Shipping.exe") { Ok(Address(module)) => {