-
Notifications
You must be signed in to change notification settings - Fork 18
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
Implement ac:u
and ac:i
services (Wi-Fi info) + example
#140
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks reasonable to me! Couple clippy lints that could use fixing and a few comments about error handling / enum types but mostly fine I think
also, will add that 2 days ago libctru 2.3.0 released, adding the 2 methods needed for this. |
fixed a few of the issues, will now investigate the bindings, as that's the main issue apart from the |
aa611c4
to
66c884d
Compare
never mind, i got the enum issue sorted out. All that remains now is the libctru version bump for the also cleaned up the history a bit, now all commits build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the long wait on a review! The new changes look good to me, but I think you have a few leftover comments that aren't relevant anymore, and you probably need to merge in the latest master
since a couple things (in particular use_panic_handler()
) have changed recently. If you have a chance to clean up some of those bits then I think this should be good to merge!
will do right now! |
time to rebase this |
perfect! the unit tests failing have nothing to do with this PR afaik, so it all works now! |
Seems like, once this and #156 get merged, all 3DS networking functionality besides Download Play is done - that'll be neat to see! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, @rust3ds/active if anyone else would like to have a look I'll wait a little but I think this is ready to merge!
CI may be completely broken due to rust3ds/actions#16 but the linter passed at least so I think we can merge and fix up any test issues that might show up once that's resolved
what other parts of libctru/3ds services are missing? i may just try implementing other stuff too |
I think at this point it's mostly less important stuff like |
|
||
/// Load the selected network slot, if present. | ||
/// | ||
/// Note: this method requires `ac:i` access |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this access given by the normal Ac::new()
implementation, or should the user do something more to gain it? Reimplementing IPS calls isn't exactly a straightforward process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the rosalina loader (e.g. the default) already gives all the arm11 permissions, but if using the hax2 loader, these permissions are missing unless ran from mset. can probably remove this, only thing is it may fail in the Citra CI because of permissions, although i haven't checked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think normally Citra grants basically all permissions since it's just emulated, although it's possible some methods are just unimplemented / stubs, I don't think permissions are usually denied.
// we don't really need space for the terminator | ||
let mut vec = vec![0u8; len as usize]; | ||
ResultCode(ctru_sys::ACU_GetSSID(vec.as_mut_ptr()))?; | ||
Ok(String::from_utf8(vec)?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than returning the String
's error, it might be wiser to check for Ac::get_wifi_status()
and return an error based on that. We could try to do that in every case needed, such as proxy getters. Otherwise, we could write a custom ac::Error
to hold those errors.
I'd like to avoid implementing Error::Utf8
.
ctru-rs/src/error.rs
Outdated
@@ -96,6 +96,8 @@ pub enum Error { | |||
}, | |||
/// An error that doesn't fit into the other categories. | |||
Other(String), | |||
/// UTF-8 buffer to [String] conversion error | |||
Utf8(std::string::FromUtf8Error), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refer to my other comment about this.
/// # } | ||
/// ``` | ||
#[doc(alias = "acWaitInternetConnection")] | ||
pub fn wait_internet_connection(&self) -> crate::Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function completely locks the thread until a connection is established, without a timeout. It's a bit... radical. We should probably suggest users to implement their own connection checks.
uhh good news. i tested around the 3dbrew has very little information on this, and i was only able to confirm these:
I also was able to get in a few occasions the values
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM other than fixing linter. CI should be up and working now again!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR is done, but I really can't merge without these last few changes 🙏
oh, i completely forgot this was still open, will update asap |
i don't know how this didn't work before, but it now does, i guess
okay, one small issue: how do we deal with errors related to UTF-8 now? i checked and you can still run into those while being connected (e.g. a proxy username not being valid UTF-8, set from a homebrew app), so the so do we create a custom AC error instead of propagating |
Yeah, that should be a good choice. |
also, since we know the contents of the buffer are invalid text, we could still return the buffer as a and problem: the functions can return both |
Implements the
ac
service, bothac:u
(user) andac:i
methods (intended for mset).Did this because i needed some of these methods for an app
Methods implemented:
wait_internet_connection
(returns immediately for some reason independently of network connection, have to investigate)get_wifi_status
get_wifi_security
get_wifi_ssid
get_proxy_enabled
get_proxy_port
get_proxy_username
get_proxy_password
load_network_slot
(ac:i
)ACU_SetAllowApType
ACU_SetNetworkArea
ACU_SetRequestEulaVersion
ACU_CreateDefaultConfig
ACU_ConnectAsync
,ACU_GetLastErrorCode
andACU_GetLastDetailErrorCode
(all at once)ACI_GetNetworkWirelessEssidSecurity
(screenshot didnt work)