Giter Club home page Giter Club logo

livesplit-core's Introduction

LiveSplit livesplit-core

Build Status crates.io npm docs.rs dependency status

livesplit-core is a library that provides a lot of functionality for creating a speedrun timer. It can be used directly from Rust. Additional bindings are available for the following programming languages:

  • C
  • C++
  • C#
  • Java with Java Native Access or Java Native Interface
  • Kotlin with Java Native Interface
  • Swift
  • Ruby
  • Python
  • JavaScript + TypeScript for Node.js and WebAssembly

The documentation is available here:

Projects using livesplit-core

Build Instructions

You can install Rust with the installer available on rustup.rs. Clone the repository and build the library with the following command:

cargo build --release -p livesplit-core-capi

The library will then be available as a shared and static library in the target folder. If you only want to build the library as a shared or static library, not both, you can run either one of the following commands:

# Shared Library
cargo rustc --release -p livesplit-core-capi --crate-type cdylib
# Static Library
cargo rustc --release -p livesplit-core-capi --crate-type staticlib

If you want to build the bindings for the library too, you need to go into the capi/bind_gen folder and run the following command:

cargo run

The bindings will then be available in capi/bindings.

Download

Builds for a lot of common platforms are available in the Releases.

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.

livesplit-core's People

Contributors

alexknauth avatar antymew avatar ash2x3zb9cy avatar cryze avatar dagit avatar darkrta avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar doesthisusername avatar eein avatar hallcristobal avatar hurricane996 avatar jujstme avatar just-ero avatar kadiwa4 avatar lbrndnr avatar markddr avatar mcdoll avatar michaeljberk avatar p1n3appl3 avatar partymanx avatar refragg avatar splamy avatar stevensmedia avatar thetedder avatar tmandry avatar wooferzfg avatar ynscription avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

livesplit-core's Issues

Improve Time Formatting

The fractional part is rounded, so it can sometimes show as .100, which is not what we want. So we should add a small epsilon, truncate and get rid of the .100 case.

Build error "livesplit_core_capi matched no packages"

I'm trying to build using the instructions in the README and I get this output:

$ cargo build --release -p livesplit_core_capi
error: package id specification `livesplit_core_capi` matched no packages

Version info if it helps (macOS 10.12.3):

$ cargo --version
cargo-0.17.0-dev (f9e5481 2017-03-03)
$ rustc --version
rustc 1.16.0

Uninitialized Game Time doesn't work correctly in Detailed Timer

In the Detailed Timer an uninitialized Game Time is shown as a dash on the segment timer, which is not what the original LiveSplit is doing there. I presume that's because I don't reuse any of logic of the Timer Component for the Segment Timer in livesplit-core, only the State, while the original LiveSplit uses more of it.

Bug in emscripten JS bindings

LiveSplitCore is not defined.
Looks like something changed for the typescript bindings but didn't get changed for the JS bindings.

Port Atomic Clock Synchronization Algorithm

We most likely want something less passive, but also not too intrusive. ESA wants this, so this should be implemented fairly soon. For it to be done so soon, it probably won't stay the final solution, as I want to be able to switch around all kinds of timer sources for synchronization and unit testing purposes, which the initial design probably won't entail.

Ensure proper handling of Nullable Strings in C API

Seems like we don't properly handle this in most of the language bindings.

Languages to check / fix:

Output:

  • JavaScript / TypeScript for emscripten
  • JavaScript / TypeScript for Node
  • JavaScript / TypeScript for WASM
  • C#
  • Java JNA
  • Java JNI
  • Kotlin JNI
  • Swift
  • Ruby
  • Python

Input (apparently we have no function that takes a nullable string as input atm):

  • JavaScript / TypeScript for emscripten
  • JavaScript / TypeScript for Node
  • JavaScript / TypeScript for WASM
  • C#
  • Java JNA
  • Java JNI
  • Kotlin JNI
  • Swift
  • Ruby
  • Python

Gitignore the JavaScript Library

It is way too large and causes huge diffs, which increases the size of this repository. Maybe use GitHub Releases to provide the current version of the JavaScript library.

Implement Layout Settings

With the components supporting most "logic settings" by now, we want to be able to also implement the color and font settings. This is however blocked by the Layout Settings, as that's where the default colors and fonts are specified.

Automatically cross compile to asm.js and WASM via CI

I'm not quite sure how this would work yet, as you need the emscripten compiler, and that requires you to compile LLVM which takes over an hour, so that's not a feasible solution. However the rust repository has automatic cross compilations of the standard library via CI, so we can potentially replicate what they do.

Use TimeSpans for all calculations

This allows for representing 584.554531 years while also being maximally precise.

Update: Actually this seems mostly like an issue when it comes to algorithms that use a seconds / milliseconds / nanoseconds representation. So those should potentially be rewritten to use TimeSpan instead (i.e. extend it to support those use cases). If TimeSpan can't be made to support those use cases, they should at least switch to a u64 nanoseconds representation. Summing up and averaging could theoretically be problematic in case the sum overflows the 584 years, which is unlikely but could happen.

Implement the Splits Editor

The Splits Editor should act similar to a component. So pretty much everything about it should be implemented in livesplit-core. The Splits Editor provides a state object that contains all the necessary information for visualizing it in any kind of UI.

Things to clear up: Should the Splits Editor directly modify the Run object that is in use by the timer and keep a clone in case we need to cancel our progress, or should we just modify the clone in the first place and replace the Run used by the timer once the changes are approved? The former case has a lot of issues with potential race conditions and forces us to introduces reference counting and reader writer locks in most of the code we already wrote. However it models what the original LiveSplit is doing more closely.

Implement Image Resizing

It generally doesn't make much sense too store super large images, so we re-encode them as JPEGS < 256x256 (while keeping the aspect ratio in mind).

Reuse allocations by reusing state objects.

We should reduce unnecessary allocations as much as possible. I wasn't all too sure if Cow plays well with serde, so I didn't use it until now, but I just tested it and it works to seem fine, so yeah, we should use it.

Implement a Layout Editor

Similarly to the Run Editor, the Layout Editor should also have a UI independent implementation in livesplit-core, that allows placing components, moving them around and changing their settings. The settings of each component should be available in some kind of general description of the settings. So there would be some kind of enum like this:

pub enum Setting {
    Integer { name: String, value: i32 },
    String { name: String, value: String },
    Table(...),
    List(...),
}

bytearray needs an encoding in Python 3.6.2

In the Python bindings, class Run.parse_file is doing a:

bytes = bytearray(file.read())

But it needs to pick an encoding, at least in my Python 3.6.2 just installed from python.org, such as:

bytes = bytearray(file.read(), 'utf8')

Possible segfault in urn parser

Any urn file I try and parse segfaults if it is missing the 'start_delay' key in the json.
I can't really determine if this is a bug in ls-core or from something else, I had issues with both emscripten and a basic C program.

The urn spec says that all keys are optional so not having 'start_delay' shouldn't error.

I don't have any issues loading the same file in the actual urn application.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.