Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support no_std use cases by using alloc #223

Closed
26 tasks done
CryZe opened this issue Jul 29, 2019 · 6 comments · Fixed by #536
Closed
26 tasks done

Support no_std use cases by using alloc #223

CryZe opened this issue Jul 29, 2019 · 6 comments · Fixed by #536
Labels
enhancement An improvement for livesplit-core. feature A new user visible feature for livesplit-core. priority: high This is a high priority issue.

Comments

@CryZe
Copy link
Collaborator

CryZe commented Jul 29, 2019

We long term want to support compilation of livesplit-core with just core + alloc. You'd provide your own time source as some global handler but other than that everything should mostly just work as we already see with wasm32-unknown-unknown. However most crates that we depend on probably don't support this yet, so that's probably going to be a lot of Pull Requests.

Update

All the crates we need are sufficiently patched on forked branches. We just need to do a bunch of PRs now. Here's the super fancy results, with LiveSplit One being rendered within the world of Wind Waker:

https://twitter.com/CryZe107/status/1158444993549414401

Status

Basic Support

Required

Polyfilled (not required, but would be good to get rid of the polyfill)

Optional

  • byteorder - Some IO.
  • image - Too much IO.
  • livesplit-hotkey - We don't really need it, but we can easily provide an empty hotkey implementation.
  • livesplit-title-abbreviations
  • parking_lot - Not really needed on no_std, does too many OS things.
  • quick-xml - Too much IO.
  • serde_json - Too much IO, but there is a PR: No_std support serde-rs/json#516
  • utf-8 - Uses IO.

Rendering

Software Rendering

@CryZe CryZe added enhancement An improvement for livesplit-core. feature A new user visible feature for livesplit-core. labels Jul 29, 2019
@CryZe
Copy link
Collaborator Author

CryZe commented Jul 31, 2019

It seems that std::io is causing massive problems, where all our parsing, saving, serializing and co. is just not within the bounds of core and alloc. It easily could be as there barely is a reason you can't do IO without an operating system, but it's currently std only due to OS specific error codes. There is a fork called core-io, but that's going to be a ton of PRs. However there is the possibility of simply not doing any parsing, saving and serializing on no_std until then. Other problems include HashMap, Hotkeys, timing and paths, but all of these can easily be replaced (BTreeMap, mocked Hotkeys, timing handler, and a wrapper around String / &str).

Images are probably also going to be problematic, but other than for rendering, image shrinking and parsing, we don't actually need to interpret them.

@hallcristobal
Copy link
Contributor

Speaking in terms of a no_std implementation, I see no real reason to have file IO directly. At most I could see implementing support for Parsing and Serializing but leave it to the developer implementing the no_std library to handle any IO needs. This would require a custom built BufReader, BufRead, Seek (possibly others) implementations which might be outside the scope of this crate though. Having livesplit-core omit this functionality until that can be safely, and correctly, implemented seems like a viable path to go down for now.

@CryZe
Copy link
Collaborator Author

CryZe commented Jul 31, 2019

Well yeah it wouldn't be File IO, it would just be the IO traits, such as Read, Write, Seek, BufRead that we can't use as they are in std only. And all our dependencies use them too, so that's a pain to fix in the ecosystem without no clear solution other than possibly using the fork, but that's super hacky too.

@CryZe CryZe added the work in progress Someone is working on this. label Aug 8, 2019
@CryZe CryZe added the blocked Progress is blocked and can't progress. label Oct 30, 2019
@CryZe
Copy link
Collaborator Author

CryZe commented Nov 17, 2019

All required crates are released now, so we can merge basic support in.

@CryZe CryZe removed the blocked Progress is blocked and can't progress. label Nov 17, 2019
CryZe added a commit to CryZe/livesplit-core that referenced this issue Nov 19, 2019
This implements initial support for no_std. Modules such as parsing,
saving and rendering are disabled and timing has to be manually provided
by registering a global handler. The rendering module is on its way to
no_std support as well, but not all Pull Requests to the necessary
dependencies are done yet.

See LiveSplit#223 for more information.
CryZe added a commit to CryZe/livesplit-core that referenced this issue Nov 19, 2019
This implements initial support for no_std. Modules such as parsing,
saving and rendering are disabled and timing has to be manually provided
by registering a global handler. The rendering module is on its way to
no_std support as well, but not all Pull Requests to the necessary
dependencies are done yet.

See LiveSplit#223 for more information.
CryZe added a commit to CryZe/livesplit-core that referenced this issue Nov 19, 2019
This implements initial support for no_std. Modules such as parsing,
saving and rendering are disabled and timing has to be manually provided
by registering a global handler. The rendering module is on its way to
no_std support as well, but not all Pull Requests to the necessary
dependencies are done yet.

See LiveSplit#223 for more information.
CryZe added a commit to CryZe/livesplit-core that referenced this issue Nov 19, 2019
This implements initial support for no_std. Modules such as parsing,
saving and rendering are disabled and timing has to be manually provided
by registering a global handler. The rendering module is on its way to
no_std support as well, but not all Pull Requests to the necessary
dependencies are done yet.

See LiveSplit#223 for more information.
CryZe added a commit to CryZe/livesplit-core that referenced this issue Nov 19, 2019
This implements initial support for no_std. Modules such as parsing,
saving and rendering are disabled and timing has to be manually provided
by registering a global handler. The rendering module is on its way to
no_std support as well, but not all Pull Requests to the necessary
dependencies are done yet.

See LiveSplit#223 for more information.
CryZe added a commit to CryZe/livesplit-core that referenced this issue Nov 19, 2019
This implements initial support for no_std. Modules such as parsing,
saving and rendering are disabled and timing has to be manually provided
by registering a global handler. The rendering module is on its way to
no_std support as well, but not all Pull Requests to the necessary
dependencies are done yet.

See LiveSplit#223 for more information.
CryZe added a commit to CryZe/livesplit-core that referenced this issue Nov 19, 2019
This implements initial support for no_std. Modules such as parsing,
saving and rendering are disabled and timing has to be manually provided
by registering a global handler. The rendering module is on its way to
no_std support as well, but not all Pull Requests to the necessary
dependencies are done yet.

See LiveSplit#223 for more information.
CryZe added a commit to CryZe/livesplit-core that referenced this issue Nov 19, 2019
This implements initial support for no_std. Modules such as parsing,
saving and rendering are disabled and timing has to be manually provided
by registering a global handler. The rendering module is on its way to
no_std support as well, but not all Pull Requests to the necessary
dependencies are done yet.

See LiveSplit#223 for more information.
@CryZe CryZe added the priority: high This is a high priority issue. label Dec 18, 2019
@CryZe
Copy link
Collaborator Author

CryZe commented Feb 7, 2021

So a ton changed in our renderer recently and we have fairly different dependencies now. rusttype is gone, lyon is gone and instead we have ttf-parser, tiny-skia and rustybuzz as dependencies now. ttf-parser is already no_std compatible, rustybuzz turned out to be trivial, so I just opened a PR. I'll have to look into tiny-skia as well, but I believe we can probably close this soon.

@CryZe CryZe added the blocked Progress is blocked and can't progress. label Nov 7, 2021
@CryZe
Copy link
Collaborator Author

CryZe commented Dec 26, 2021

This is blocked on proper optional feature propagation support in cargo, which is reasonably close to stabilizing.

@CryZe CryZe removed the blocked Progress is blocked and can't progress. label May 22, 2022
@CryZe CryZe closed this as completed in #536 Jun 4, 2022
@CryZe CryZe removed the work in progress Someone is working on this. label Jun 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement for livesplit-core. feature A new user visible feature for livesplit-core. priority: high This is a high priority issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants