-
Notifications
You must be signed in to change notification settings - Fork 1
HTTPS via minreq
There are a few hurdles to clear before you can use minreq on the 3DS.
Firstly, make sure you've installed the latest Homebrew Menu from devkitPro.
You can find this in the Universal Updater (https://db.universal-team.net/3ds/3ds-hbmenu)
Create a basic Rust 3DS binary crate, who's main should look like this:
fn main() {
//IMPORTANT: If you drop Soc, you can't use the network!
let mut soc = ctru::prelude::Soc::new().expect("failed to get SOC");
let _ = soc.redirect_to_3dslink(true, true);
println!("stdout Hello World!");
eprintln!("stderr Hello World!");
}
Open the 3DS' Homebrew Menu, Press Y, then use the IP address in the following command to run the crate:
cargo 3ds run --address <IP ADDRESS> --server
You should get the outputs, and the program should exit.
If you're using a Workspace, modify the Workspace's Cargo.toml
, otherwise, modify your crate's Cargo.toml
:
[patch.crates-io]
ring = { git = "https://github.com/briansmith/ring" }
[profile.dev.package.ring]
opt-level = 1
[profile.release.package.ring]
opt-level = 1
Then, in your crate's Cargo.toml
:
[dependencies]
minreq = {version = "*", default-features = false, features = ["https-rustls"]}
You'll also want this environment variable:
export CFLAGS_armv6k_nintendo_3ds="-march=armv6k -mfloat-abi=hard -finline-limit=100000"
Then, in your crate's main
:
fn main() {
//IMPORTANT: If you drop Soc, you can't use the network!
let mut soc = ctru::prelude::Soc::new().expect("failed to get SOC");
let _ = soc.redirect_to_3dslink(true, true);
let resp = minreq::get("https://wttr.in/").send().expect("Minreq Error");
let resp_str = resp.as_str().expect("Couldn't convert resp to str");
println!("Response:");
println!("{}",resp_str);
}
Run the crate as before.
After running the crate, you should get an error about an assertion failing in some standard library rust file.
If your terminal supports it, you should be able to ctrl+click
(or perhaps cmd+click
on mac) on the file path where the assertion is to open it up in your code editor of choice, and it should bring you to the assertion that caused the error.
- Comment out that assertion.
-
IMPORTANT: do
cargo clean
. - Then run the crate as before.
If you're trying to use the ureq crate instead of minreq, set the timeout to None (Untested).
If you still get problems, try other URLs.
If you dropped the Soc, or never constructed it in the first place, that's the issue. You can't use the network without Soc existing.
If you still get problems after that, then I don't know how to help you.