Skip to content

Commit

Permalink
Display Error Message in Filemanager
Browse files Browse the repository at this point in the history
  • Loading branch information
tobid7 committed May 2, 2024
1 parent 2293d5f commit b9be105
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 3 additions & 1 deletion source/bcstm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ bool D7::BCSTM::LoadFile(const std::string &path) {
info_offset = 0;
data_offset = 0;
active_channels = 0;
err_msg = "None";

Stop();
file.open(path, std::ios::in | std::ios::binary);
Expand Down Expand Up @@ -169,6 +170,8 @@ void D7::BCSTM::Pause() {
}

void D7::BCSTM::Stop() {
if (file)
file.close();
is_loaded = false;
if (!is_streaming)
return;
Expand All @@ -177,7 +180,6 @@ void D7::BCSTM::Stop() {
ndspChnWaveBufClear(channel[i]);
active_channels &= ~(1 << channel[i]);
}
file.close();
}

void D7::BCSTM::stream() {
Expand Down
10 changes: 5 additions & 5 deletions source/scenes/Filemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ void Filemanager::Draw(void) const {
UI7::Label("Current: " + std::to_string(player.GetCurrent()));
UI7::Label("Total: " + std::to_string(player.GetTotal()));
UI7::Label("Channels: " + std::to_string(player.GetChannelCount()));
UI7::Label("Error: " + player.GetErrorMessage());
UI7::SetCursorPos(R7Vec2(5, 215));
UI7::Progressbar((float)player.GetCurrent() / (float)player.GetTotal());
UI7::RestoreCursor();
Expand Down Expand Up @@ -64,12 +65,11 @@ void Filemanager::Logic() {
if (RenderD7::NameIsEndingWith(this->dircontent[this->dirsel].name,
{"bcstm"})) {
playing = false;
player.Stop();
player.LoadFile(this->dircontent[this->dirsel].path);

player.Play();
if(player.LoadFile(this->dircontent[this->dirsel].path)) {
player.Play();
playing = true;
}
now_playing = this->dircontent[this->dirsel].name;
playing = true;
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions source/scenes/Titles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ void Titles::Logic() {
RenderD7::Scene::Back();
}
if (hidKeysDown() & KEY_A) {
romfsUnmount("title");
romfs_is_mount = false;
if (romfs_is_mount) {
romfsUnmount("title");
romfs_is_mount = false;
}
Result mntres = romfsMountFromTitle(
D7MC::TitleManager::sdtitles[selection]->id(),
D7MC::TitleManager::sdtitles[selection]->mediatype(), "title");
Expand Down

0 comments on commit b9be105

Please sign in to comment.