Skip to content

Commit

Permalink
Changes:
Browse files Browse the repository at this point in the history
- Latest RenderD7
- Update Languae strings
  • Loading branch information
tobid7 committed May 24, 2024
1 parent 4dc8d58 commit 443f702
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 77 deletions.
34 changes: 1 addition & 33 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,7 @@ jobs:
git config --global user.email "tobid7@outlook.de"
git config --global user.name "Tobi-D7"
git clone --depth 1 https://${{ secrets.TOKEN }}@github.com/NPI-D7/nightlys.git
echo hi
cd nightlys
sudo chmod +x nightlytool
echo running
./nightlytool management/BCSTM-Player.ini BCSTM-Player NPI-D7 nightlys v$CURRENT_DATE $COMMIT_HASH "\\$COMMIT_SUBJECT\\$COMMIT_MESSAGE\\\\" 0 "$AUTHOR_NAME"
echo creating dirs
ls -R
mkdir -p builds/BCSTM-Player/
cd builds/BCSTM-Player/
qrencode -o BCSTM-Player.png https://github.com/NPI-D7/nightlys/raw/v$CURRENT_DATE/builds/BCSTM-Player/BCSTM-Player.cia
Expand All @@ -134,30 +128,4 @@ jobs:
CONTENT_TYPE="Content-Type: application/7z-x-compressed"
UPLOAD_URL="https://uploads.github.com/repos/NPI-D7/nightlys/releases/$ID/assets?name=$(basename $file)"
curl -XPOST -H "$AUTH_HEADER" -H "$CONTENT_LENGTH" -H "$CONTENT_TYPE" --upload-file "$file" "$UPLOAD_URL"
done
# lol
send_webhook:
runs-on: ubuntu-latest
needs: [publish_build, build]
name: Send Discord webhook
if: ${{ !startsWith(github.ref, 'refs/pull') }}
env:
CURRENT_DATE: ${{ needs.publish_build.outputs.current_date }}
AUTHOR_NAME: ${{ needs.build.outputs.author_name }}
COMMITTER_NAME: ${{ needs.build.outputs.committer_name }}
COMMIT_SUBJECT: ${{ needs.build.outputs.commit_subject }}
COMMIT_MESSAGE: ${{ needs.build.outputs.commit_message }}
steps:
- name: Send success webhook
if: ${{ success() }}
run: |
curl -o send.sh https://raw.githubusercontent.com/NPI-D7/discord-webhooks/master/send-ghactions.sh
chmod +x send.sh
export IMAGE=https://raw.githubusercontent.com/NPI-D7/nigtlys/v$CURRENT_DATE/builds/BCSTM-Player/BCSTM-Player.png
./send.sh success ${{ secrets.WEBHOOK_URL }}
- name: Send failure webhook
if: ${{ failure() }}
run: |
curl -o send.sh https://raw.githubusercontent.com/NPI-D7/discord-webhooks/master/send-ghactions.sh
chmod +x send.sh
./send.sh failure ${{ secrets.WEBHOOK_URL }}
done
2 changes: 1 addition & 1 deletion RenderD7
Submodule RenderD7 updated from 6d7781 to fae31a
6 changes: 5 additions & 1 deletion romfs/lang/de/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
"UPDATER": "Updater: ",
"AUTOSEARCHUPDATE": "Suche Automatisch nach Updates",
"USENIGHTLY": "Nutze Nightly Version",
"CHECK": "Überprüfen"
"CHECK": "Überprüfen",
"UPDATE": "Update: ",
"DOWNLOAD": "Herunterladen",
"UPDFAILED": "Update fehlgeschlagen!",
"UPDDONE": "Fertig, App neu starten\num abzuschließen!"
}
}
6 changes: 5 additions & 1 deletion romfs/lang/en/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
"UPDATER": "Updater: ",
"AUTOSEARCHUPDATE": "Auto Check for Update",
"USENIGHTLY": "Use Nightly Version",
"CHECK": "Check"
"CHECK": "Check",
"UPDATE": "Update: ",
"DOWNLOAD": "Download",
"UPDFAILED": "Update failed!",
"UPDDONE": "Done, restart app\nto apply changes!"
}
}
4 changes: 3 additions & 1 deletion source/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ std::string Clock() {
return std::format("{}:{:02}:{:02}", ts->tm_hour, ts->tm_min, ts->tm_sec);
}
void CheckForUpdate(bool is_auto) {
// Dont create infinite tasks
if (checking_for_update) return;
RenderD7::Tasks::Create([&]() {
if (checking_for_update) return;
checking_for_update = true;
update_info = Update();
update_info.nightly = config.GetBool("use_nightly");
Expand Down Expand Up @@ -69,6 +70,7 @@ void CheckForUpdate(bool is_auto) {
checking_for_update = false;
return;
}
checking_for_update = false;
});
}
} // namespace BP
99 changes: 59 additions & 40 deletions source/scenes/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ void Settings::Draw(void) const {
if (lang_sel + 1 > (int)languages.size()) {
lang_sel = 0;
}
RD7::Lang::Load(languages[lang_sel]);
config.Set("lang", languages[lang_sel]);
lang_reload = true;
}
}
UI7::Label(RD7::Lang::Get("APPEARANCE"));
Expand All @@ -85,49 +84,64 @@ void Settings::Draw(void) const {
update_info.version.substr(1).compare(V_STRING) < 0) {
UI7::Label("Already Up to date!");
} else {
UI7::Label("Update: " + update_info.version);
UI7::Label("Info/Changelog: \n" + update_info.text);
if (UI7::Button("Download")) {
RenderD7::Tasks::Create([&]() {
downloading = true;
std::string fname = "BCSTM-Player.";
fname += hb_mode ? "3dsx" : "cia";
if (update_info.nightly) {
auto ret = RD7::Net::Download2File(
"https://raw.githubusercontent.com/NPI-D7/nightlys/master/"
"builds/BCSTM-Player/" +
fname,
hb_mode ? thiz_path : "sdmc:/BCSTM-Player.cia");
if (ret) {
RD7::PushMessage(RD7::Lang::Get("UPDATER"),
"Update Failed!\n" +
std::to_string(RD7::Net::ErrorCode(ret)) +
"/" +
std::to_string(RD7::Net::StatusCode(ret)));
}
} else {
auto ret = RD7::Net::GitDownloadRelease(
"https://github.com/NPI-D7/BCSTM-Player", fname,
hb_mode ? thiz_path : "sdmc:/BCSTM-Player.cia");
if (ret) {
RD7::PushMessage(RD7::Lang::Get("UPDATER"),
"Update Failed!\n" +
std::to_string(RD7::Net::ErrorCode(ret)) +
"/" +
std::to_string(RD7::Net::StatusCode(ret)));
UI7::Label(RD7::Lang::Get("UPDATE") + update_info.version);
UI7::Label(RD7::Lang::Get("INFO") + ":\n" + update_info.text);
if (!downloading) {
if (UI7::Button(RD7::Lang::Get("DOWNLOAD"))) {
RenderD7::Tasks::Create([&]() {
downloading = true;
std::string fname = "BCSTM-Player.";
fname += hb_mode ? "3dsx" : "cia";
if (update_info.nightly) {
auto ret = RD7::Net::Download2File(
"https://raw.githubusercontent.com/NPI-D7/nightlys/master/"
"builds/BCSTM-Player/" +
fname,
hb_mode ? thiz_path : "sdmc:/BCSTM-Player.cia");
if (ret) {
RD7::PushMessage(
RD7::Lang::Get("UPDATER"),
RD7::Lang::Get("UPDFAILED") + "\n" +
std::to_string(RD7::Net::ErrorCode(ret)) + "/" +
std::to_string(RD7::Net::StatusCode(ret)));
}
if (!hb_mode) {
Result r =
RenderD7::InstallCia("sdmc:/BCSTM-Player.cia", true);
if (R_FAILED(r)) {
RenderD7::ResultDecoder rd;
rd.Load(r);
rd.WriteLog();
RD7::PushMessage(RD7::Lang::Get("UPDATER"),
RD7::Lang::Get("UPDFAILED") + "\n" +
"Unable to install Cia!");
}
}

} else {
auto ret = RD7::Net::GitDownloadRelease(
"https://github.com/NPI-D7/BCSTM-Player", fname,
hb_mode ? thiz_path : "sdmc:/BCSTM-Player.cia");
if (ret) {
RD7::PushMessage(
RD7::Lang::Get("UPDATER"),
RD7::Lang::Get("UPDFAILED") + "\n" +
std::to_string(RD7::Net::ErrorCode(ret)) + "/" +
std::to_string(RD7::Net::StatusCode(ret)));
}
}
}
RD7::PushMessage(RD7::Lang::Get("UPDATER"),
"Done, Restart to\nApply Changes!");
downloading = false;
});
RD7::PushMessage(RD7::Lang::Get("UPDATER"),
RD7::Lang::Get("UPDDONE"));
downloading = false;
});
}
}
}
}
if (downloading) {
UI7::Label(
"Download: " + RD7::FormatBytes(RD7::Net::GetProgressCurrent()) +
"/" + RD7::FormatBytes(RD7::Net::GetProgressTotal()));
UI7::Label(RD7::Lang::Get("DOWNLOAD") + ": " +
RD7::FormatBytes(RD7::Net::GetProgressCurrent()) + "/" +
RD7::FormatBytes(RD7::Net::GetProgressTotal()));
UI7::Progressbar((float)RD7::Net::GetProgressCurrent() /
(float)RD7::Net::GetProgressTotal());
}
Expand Down Expand Up @@ -171,6 +185,11 @@ void Settings::Logic() {
RD7::ThemeDefault();
}
}
if (lang_reload) {
RD7::Lang::Load(languages[lang_sel]);
config.Set("lang", languages[lang_sel]);
lang_reload = false;
}
if (hidKeysDown() & KEY_B) {
config.Save();
RD7::Scene::Back();
Expand Down
1 change: 1 addition & 0 deletions source/scenes/Settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ class Settings : public RD7::Scene {
mutable bool downloading = false;
mutable bool use_nightly = false;
mutable bool search_updates = false;
mutable bool lang_reload = false;
};
} // namespace BP

0 comments on commit 443f702

Please sign in to comment.