-
Notifications
You must be signed in to change notification settings - Fork 2
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
Android support #10
Android support #10
Conversation
Thanks! I remember trying to run an android build of the mod and it crashed on startup. I will try your changes soon. (Assuming this PR is ready) Also, it seems |
there is one problem. i just need to figure out how to make the Android specific directory if it doesn't exist. I've tried a few different ways of doing it but they've all just crashed the game :( |
@FlafyDev it's ready for merging, i solved pretty much the only problem lol |
Ok, thanks!
|
i can probably just do that lol |
also, I reverted the |
@FlafyDev I fixed the code looking bad, lemme make an android friendly version of the newer |
@FlafyDev Should be good to merge now, everything is cleaned up and formatted, and the |
- Uses a different dir for NONGs on Android - Makes the dir if it doesn't already exist - Update `setSong` to be Android friendly - Uncomment android build commands for actions - (OBSELETE/REDACTED) Update `.clang-format` for better code readability - (OBSELETE/REDACTED) Format ALL `cpp/hpp` files based on new `.clang-format`
it is done |
There seem to be a lot of unnecessary changes(like the Rust like types). And some formatting issues. I reverted these back. Is it correct that these are all the necessary changes for android support? diff --git a/.github/workflows/multi-platform.yml b/.github/workflows/multi-platform.yml
index 01d6d83..d6172ef 100644
--- a/.github/workflows/multi-platform.yml
+++ b/.github/workflows/multi-platform.yml
@@ -18,13 +18,13 @@ jobs:
# - name: macOS
# os: macos-latest
- # - name: Android32
- # os: ubuntu-latest
- # target: Android32
- #
- # - name: Android64
- # os: ubuntu-latest
- # target: Android64
+ - name: Android32
+ os: ubuntu-latest
+ target: Android32
+
+ - name: Android64
+ os: ubuntu-latest
+ target: Android64
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
diff --git a/mod.json b/mod.json
index df955d3..df9ecb5 100644
--- a/mod.json
+++ b/mod.json
@@ -1,6 +1,9 @@
{
"geode": "2.0.0-beta.27",
- "gd": "2.204",
+ "gd": {
+ "win": "2.204",
+ "android": "2.205"
+ },
"version": "v0.0.3",
"id": "flafy.autonong",
"name": "Auto Nong",
diff --git a/src/ui/an_song_cell.cpp b/src/ui/an_song_cell.cpp
index b3e9dfa..eed58f9 100644
--- a/src/ui/an_song_cell.cpp
+++ b/src/ui/an_song_cell.cpp
@@ -143,21 +143,29 @@ void ANSongCell::setSong() {
}
fs::path ANSongCell::getFileDownloadPath(bool create) {
+#ifdef GEODE_IS_ANDROID
+ std::string baseDir = "/storage/emulated/0/nongs";
+ if (!fs::exists(baseDir)) {
+ fs::create_directories(baseDir);
+ }
+#else
+ std::string baseDir = Mod::get()->getSaveDir().string();
+#endif
+
if (typeid(*m_anSong) == typeid(ANYTSong)) {
const ANYTSong *ytSong = static_cast<ANYTSong *>(m_anSong);
const std::string videoId = ytSong->m_ytId;
if (create) {
- fs::create_directory(fmt::format("{}\\youtube", Mod::get()->getSaveDir().string()));
+ fs::create_directories(fmt::format("{}/youtube", baseDir));
}
- return fmt::format("{}\\youtube\\{}.mp3", Mod::get()->getSaveDir().string(), videoId);
+ return fmt::format("{}/youtube/{}.mp3", baseDir, videoId);
}
if (typeid(*m_anSong) == typeid(ANHostSong)) {
const ANHostSong *hostSong = static_cast<ANHostSong *>(m_anSong);
if (create) {
- fs::create_directory(fmt::format("{}\\host", Mod::get()->getSaveDir().string()));
+ fs::create_directories(fmt::format("{}/host", baseDir));
}
- return fmt::format("{}\\host\\{}.mp3", Mod::get()->getSaveDir().string(),
- urlToFilename(hostSong->m_url));
+ return fmt::format("{}/host/{}.mp3", baseDir, urlToFilename(hostSong->m_url));
}
return "";
} Also, I tested your version but I'm crashing on startup when trying to decompress the indexes. Are you not crashing there? I used an index that doesn't require decompression and managed to get in. I opened the auto nong menu and got another crash. This time there was a crashlog and after reading it it seems to crash on
Are you not experiencing any of these crashes? |
yes, in the action, uncommenting the thingies makes the github actions build for android. also, the changes in the paths make it android compatible since android paths use forward slashes, and |
I don't know how you had permission to write in std::string baseDir = Mod::get()->getSaveDir().string(); for Android as well made it work for me. There is still the issue with the decompression, though. Not sure how to solve it. But everything else seem to work on both Android and Windows :D |
@FlafyDev try setting the nong for a song with that, it won't work. also, you have to give the geode launcher filesystem perms in the app settings lol |
Setting the song through auto-nong still works. This is also what jukebox does |
oh nevermind, it's not due to the decompression step. But these work for me: https://cdn.jsdelivr.net/gh/FlafyDev/auto-nong-indexes@dist/official.json.gz these crash the game: https://raw.githubusercontent.com/FlafyDev/auto-nong-indexes/dist/sfh-rooot.json.gz It's probably something in the contents of the file |
Figured it out. for some reason it takes time for my android device to decompress the entire json, but the code still continues... for smaller json files like I'll make a 1 second loop that checks if the string is empty. |
No description provided.