mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
UWP fixes after Gemini code review...
This commit is contained in:
1 parent
9a7346b10e
commit
29092677ce
3 files changed
+35
-12
No files matched your search
+4
-2
@@ -282,8 +282,10 @@ void App::OnSuspending(const IInspectable& sender, const SuspendingEventArgs& ar
|
||||
auto app = this;
|
||||
|
||||
std::thread([app, deferral]() {
|
||||
g_Config.Save("App::OnSuspending");
|
||||
app->m_deviceResources->Trim();
|
||||
try {
|
||||
g_Config.Save("App::OnSuspending");
|
||||
app->m_deviceResources->Trim();
|
||||
} catch (...) {}
|
||||
deferral.Complete();
|
||||
}).detach();
|
||||
}
|
||||
|
||||
+15
-3
@@ -328,8 +328,14 @@ bool IsMobile() {
|
||||
}
|
||||
|
||||
void GetVersionInfo(uint32_t& major, uint32_t& minor, uint32_t& build, uint32_t& revision) {
|
||||
major = minor = build = revision = 0;
|
||||
winrt::hstring deviceFamilyVersion = winrt::Windows::System::Profile::AnalyticsInfo::VersionInfo().DeviceFamilyVersion();
|
||||
uint64_t version = std::stoull(std::wstring(deviceFamilyVersion));
|
||||
uint64_t version = 0;
|
||||
try {
|
||||
version = std::stoull(std::wstring(deviceFamilyVersion));
|
||||
} catch (...) {
|
||||
return;
|
||||
}
|
||||
|
||||
major = static_cast<uint32_t>((version & 0xFFFF000000000000L) >> 48);
|
||||
minor = static_cast<uint32_t>((version & 0x0000FFFF00000000L) >> 32);
|
||||
@@ -432,6 +438,7 @@ int64_t System_GetPropertyInt(SystemProperty prop) {
|
||||
if (corewindow) {
|
||||
return (int)corewindow.Bounds().Width;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
case SYSPROP_DISPLAY_YRES:
|
||||
{
|
||||
@@ -439,6 +446,7 @@ int64_t System_GetPropertyInt(SystemProperty prop) {
|
||||
if (corewindow) {
|
||||
return (int)corewindow.Bounds().Height;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
default:
|
||||
return -1;
|
||||
@@ -651,8 +659,12 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
|
||||
}
|
||||
|
||||
void System_LaunchUrl(LaunchUrlType urlType, std::string_view url) {
|
||||
auto uri = winrt::Windows::Foundation::Uri(ToHString(url));
|
||||
winrt::Windows::System::Launcher::LaunchUriAsync(uri);
|
||||
try {
|
||||
auto uri = winrt::Windows::Foundation::Uri(ToHString(url));
|
||||
winrt::Windows::System::Launcher::LaunchUriAsync(uri);
|
||||
} catch (const winrt::hresult_error &e) {
|
||||
ERROR_LOG(Log::System, "System_LaunchUrl: invalid URI: %s", winrt::to_string(e.message()).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void System_Vibrate(int length_ms) {
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
#include "Common/Audio/AudioBackend.h"
|
||||
#include "XAudioSoundStream.h"
|
||||
|
||||
const size_t BUFSIZE = 32 * 1024;
|
||||
|
||||
class XAudioBackend : public AudioBackend {
|
||||
public:
|
||||
XAudioBackend();
|
||||
@@ -45,7 +43,7 @@ private:
|
||||
|
||||
WAVEFORMATEX format_;
|
||||
|
||||
int sampleRate_ = 44100;
|
||||
int sampleRate_ = 48000;
|
||||
int periodFrames_ = 0;
|
||||
|
||||
enum {
|
||||
@@ -62,9 +60,6 @@ private:
|
||||
std::atomic<bool> running_{};
|
||||
};
|
||||
|
||||
// TODO: Get rid of this
|
||||
static XAudioBackend *g_dsound;
|
||||
|
||||
XAudioBackend::XAudioBackend() {
|
||||
format_.wFormatTag = WAVE_FORMAT_IEEE_FLOAT;
|
||||
format_.nChannels = channels;
|
||||
@@ -85,10 +80,18 @@ void XAudioBackend::Stop() {
|
||||
thread_.join();
|
||||
}
|
||||
|
||||
if (sourceVoice_) {
|
||||
sourceVoice_->Stop(0, XAUDIO2_COMMIT_NOW);
|
||||
sourceVoice_->DestroyVoice();
|
||||
sourceVoice_ = nullptr;
|
||||
}
|
||||
if (masterVoice_) {
|
||||
masterVoice_->DestroyVoice();
|
||||
masterVoice_ = nullptr;
|
||||
}
|
||||
if (xaudioDevice) {
|
||||
xaudioDevice->Release();
|
||||
xaudioDevice = nullptr;
|
||||
sourceVoice_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,6 +117,8 @@ bool XAudioBackend::InitOutputDevice(std::string_view uniqueId, LatencyMode late
|
||||
}
|
||||
|
||||
if FAILED(xaudioDevice->CreateSourceVoice(&sourceVoice_, &format_, 0, 1.0, nullptr, nullptr, nullptr)) {
|
||||
masterVoice_->DestroyVoice();
|
||||
masterVoice_ = nullptr;
|
||||
xaudioDevice->Release();
|
||||
xaudioDevice = nullptr;
|
||||
return false;
|
||||
@@ -124,6 +129,10 @@ bool XAudioBackend::InitOutputDevice(std::string_view uniqueId, LatencyMode late
|
||||
cursor_ = 0;
|
||||
|
||||
if FAILED(sourceVoice_->Start(0, XAUDIO2_COMMIT_NOW)) {
|
||||
sourceVoice_->DestroyVoice();
|
||||
sourceVoice_ = nullptr;
|
||||
masterVoice_->DestroyVoice();
|
||||
masterVoice_ = nullptr;
|
||||
xaudioDevice->Release();
|
||||
xaudioDevice = nullptr;
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user