-
Notifications
You must be signed in to change notification settings - Fork 64
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
freezing issue when SD card is full on wii u #118
Comments
Thanks for the bug report! It doesn't check indeed, and it probably should. This likely requires system specific APIs to check remaining free space prior to downloading/extracting. This check should happen in libget around the Package:: downloadZip method, where it should return I'm definitely interested in adding this kind of check and eventually reporting a good human-readable error message as well. |
Looking to contribute for the first time, is this still an issue and am I free to implement this if I'm able to? Thank you! |
Absolutely! |
I should preface this by saying that I'm new to Nintendo homebrew development, so I apologize for any trouble I might cause while discussing proposed changes or if I ask any dumb questions. I wrote a draft for the relevant changes to be made to Package.cpp after checking if // check if there is enough free space to download this package
int space_needed = (this.getDownloadSize() + this.getExtractedSize()) / 1000;
int space_available = get_remaining_disk_space(tmp_path.data());
if (space_needed > space_available) {
printf("--> ERROR: Space needed to %s is %d KB, only %d KB of disk space remaining\n", this->pkg_name.c_str(), space_needed, space_available);
return false;
}
// returns remaining disk space
int get_remaining_disk_space(path) {
#if defined(WIN32)
// handle Win32 case
#endif
#if defined(SWITCH)
// handle Nintendo Switch case
#endif
#if defined(_3DS)
// handle Nintendo 3DS case
#endif
#if defined(_WII)
// handle Wii case
#endif
// handle default case
} I just needed to make sure my approach for how to handle the different cases is in the right direction (any feedback on the aforementioned functions is also appreciated). For the case of the 3DS, I read the libctru documentation and came up with this rough scheme of getting the remaining disk space:
Would this more or less be what we're trying to do? Am I missing some implications that this implementation might have or am I using the wrong functions? Any feedback is appreciated. |
Yep, that looks like the right approach. I thought about mentioning those platform-specific variables in my last comment too. That's the current paradigm used throughout the codebase for platform-specific code. They are: In the default (aka unimplemented) case, a really large number (or a negative number, checked for positivity?) could be returned. And then piecewise the methods for each platform would be added to this method for calculating space remaining. For the context of hb-appstore and its concerns, we only really need to check the total size remaining on the SD card, and not worry too much about the path of the downloaded/extracted content. Libget at this time only operates from wherever the SD card path is, which is defined in |
Got it on the SD card part, I think I did see some libctru functions that would let me get the SD card path too which I can then use to open the relevant archive and get the remaining space using the other filesystem functions in fs.h, so I might be able to use that if I don't find something that does it all in one go.
Just to clarify, do you mean I should format the |
Yep, the way you have it with the ifdefs is good. What I meant by piecewise is just that we don't necessarily need to have every single platform solved at the same time. |
Sounds good! I just finished writing code to check SD card space for Switch, Wii U, 3DS, Wii, and Windows 32-bit (didn't write any for Mac since I don't have a Mac to test), a good amount of which I got from other homebrew apps (cited in my comments). I've verified that all the standalone code works for each platform and made the necessary changes to libget, but I have not properly tested that the changes I made to libget work. How could I go about testing it if I need to? Should I just try to make a test for it under tests/, build hb-appstore with my modified libget and test it out that way, or something else?
I'm not sure this has to do with my modifications, though, since I commented them out and the same thing happens. This might be more relevant:
Thank you! |
platform: Wii U
it seems when attempting to update an app (specifically inkay) with a full sd card, store gets stuck on the downloading popup, beeps at full volume and is stuck in this state until force shutting down the console. does the app store check in any capacity for free space before downloading updates? sorry for the largely non technical description, i haven't filed a bug report before
The text was updated successfully, but these errors were encountered: