diff --git a/UI/PauseScreen.cpp b/UI/PauseScreen.cpp index 90c497ccb6..c8d4fc6e2e 100644 --- a/UI/PauseScreen.cpp +++ b/UI/PauseScreen.cpp @@ -140,7 +140,7 @@ public: screenshotFilename_ = SaveState::GenerateSaveSlotFilename(slot, "jpg"); PrioritizedWorkQueue *wq = g_gameInfoCache.WorkQueue(); - Add(new UI::Spacer(10)); + Add(new Spacer(5)); AsyncImageFileView *fv = Add(new AsyncImageFileView(screenshotFilename_, IS_DEFAULT, wq, new UI::LayoutParams(82 * 2, 47 * 2))); fv->SetOverlayText(StringFromFormat("%i", slot_ + 1)); @@ -159,6 +159,17 @@ public: loadStateButton_->OnClick.Handle(this, &SaveSlotView::OnLoadState); fv->OnClick.Handle(this, &SaveSlotView::OnScreenshotClick); + + std::string dateStr = SaveState::GetSlotDateAsString(slot_); + std::vector dateStrs; + SplitString(dateStr, ' ', dateStrs); + if (!dateStrs.empty() && !dateStrs[0].empty()) { + LinearLayout *strs = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(WRAP_CONTENT, WRAP_CONTENT)); + Add(strs); + for (size_t i = 0; i < dateStrs.size(); i++) { + strs->Add(new TextView(dateStrs[i], new LinearLayoutParams(0.0, G_VCENTER))); + } + } } else { fv->SetFilename(""); } diff --git a/Windows/DSoundStream.cpp b/Windows/DSoundStream.cpp index 1df6197ab4..7836b4f029 100644 --- a/Windows/DSoundStream.cpp +++ b/Windows/DSoundStream.cpp @@ -1,7 +1,7 @@ +#include "Common/CommonWindows.h" #include #include "native/thread/threadutil.h" -#include "Common/CommonWindows.h" #include "Core/Reporting.h" #include "Core/Util/AudioFormat.h" #include "Windows/W32Util/Misc.h" @@ -320,13 +320,37 @@ int WASAPIAudioBackend::RunThread() { hresult = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, /*Object is not created as the part of the aggregate */ CLSCTX_ALL, IID_IMMDeviceEnumerator, (void**)&pDeviceEnumerator); + if (FAILED(hresult)) goto bail; hresult = pDeviceEnumerator->GetDefaultAudioEndpoint(eRender, eMultimedia, &pDevice); + if (FAILED(hresult)) { + pDeviceEnumerator->Release(); + goto bail; + } + hresult = pDevice->Activate(IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&pAudioInterface); + if (FAILED(hresult)) { + pDevice->Release(); + pDeviceEnumerator->Release(); + goto bail; + } + hresult = pAudioInterface->GetMixFormat((WAVEFORMATEX**)&pDeviceFormat); hresult = pAudioInterface->Initialize(AUDCLNT_SHAREMODE_SHARED, 0, hnsBufferDuration, 0, &pDeviceFormat->Format, NULL); hresult = pAudioInterface->GetService(IID_IAudioRenderClient, (void**)&pAudioRenderClient); + if (FAILED(hresult)) { + pDevice->Release(); + pDeviceEnumerator->Release(); + pAudioInterface->Release(); + goto bail; + } hresult = pAudioInterface->GetBufferSize(&pNumBufferFrames); + if (FAILED(hresult)) { + pDevice->Release(); + pDeviceEnumerator->Release(); + pAudioInterface->Release(); + goto bail; + } sampleRate_ = pDeviceFormat->Format.nSamplesPerSec; @@ -430,6 +454,7 @@ int WASAPIAudioBackend::RunThread() { pAudioInterface->Release(); pAudioRenderClient->Release(); +bail: threadData_ = 2; CoUninitialize(); return 0;