diff --git a/source/bcstm.cpp b/source/bcstm.cpp index 2ab3f9d..aeda689 100644 --- a/source/bcstm.cpp +++ b/source/bcstm.cpp @@ -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); @@ -169,6 +170,8 @@ void D7::BCSTM::Pause() { } void D7::BCSTM::Stop() { + if (file) + file.close(); is_loaded = false; if (!is_streaming) return; @@ -177,7 +180,6 @@ void D7::BCSTM::Stop() { ndspChnWaveBufClear(channel[i]); active_channels &= ~(1 << channel[i]); } - file.close(); } void D7::BCSTM::stream() { diff --git a/source/scenes/Filemanager.cpp b/source/scenes/Filemanager.cpp index ec0322e..1e8ddea 100644 --- a/source/scenes/Filemanager.cpp +++ b/source/scenes/Filemanager.cpp @@ -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(); @@ -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; } } } diff --git a/source/scenes/Titles.cpp b/source/scenes/Titles.cpp index 86254c1..15b1d44 100644 --- a/source/scenes/Titles.cpp +++ b/source/scenes/Titles.cpp @@ -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");