mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-28 16:53:40 +01:00
UWP: Fix audio sample rate, savestates, memory leak.
This commit is contained in:
1 parent
ff2b6b3fca
commit
d58ee6670e
6 files changed
+17
-13
No files matched your search
+11
-6
@@ -129,6 +129,7 @@ inline static bool CanIgnoreView(const MemoryView &view) {
|
||||
;
|
||||
#endif
|
||||
|
||||
#if !PPSSPP_PLATFORM(UWP)
|
||||
static bool Memory_TryBase(u32 flags) {
|
||||
// OK, we know where to find free space. Now grab it!
|
||||
// We just mimic the popular BAT setup.
|
||||
@@ -152,10 +153,7 @@ static bool Memory_TryBase(u32 flags) {
|
||||
if (view.flags & MV_MIRROR_PREVIOUS) {
|
||||
position = last_position;
|
||||
}
|
||||
#if PPSSPP_PLATFORM(UWP)
|
||||
// For both 32-bit and 64-bit, we need to use address masking.
|
||||
*(view.out_ptr) = (u8*)VirtualAllocFromApp(base + (view.virtual_address & MEMVIEW32_MASK), view.size, MEM_COMMIT, PAGE_READWRITE);
|
||||
#elif PPSSPP_ARCH(64BIT)
|
||||
#if PPSSPP_ARCH(64BIT)
|
||||
*view.out_ptr = (u8*)g_arena.CreateView(
|
||||
position, view.size, base + view.virtual_address);
|
||||
if (!*view.out_ptr) {
|
||||
@@ -180,7 +178,6 @@ static bool Memory_TryBase(u32 flags) {
|
||||
}
|
||||
|
||||
return true;
|
||||
#if !PPSSPP_PLATFORM(UWP)
|
||||
bail:
|
||||
// Argh! ERROR! Free what we grabbed so far so we can try again.
|
||||
for (int j = 0; j <= i; j++) {
|
||||
@@ -195,14 +192,18 @@ bail:
|
||||
}
|
||||
}
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
bool MemoryMap_Setup(u32 flags) {
|
||||
#if PPSSPP_PLATFORM(UWP)
|
||||
// We just grab all 256MB.
|
||||
// We should be able to avoid COMMIT-ing here, TODO.
|
||||
base = (u8*)VirtualAllocFromApp(0, 0x10000000, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
|
||||
for (int i = 0; i < num_views; i++) {
|
||||
const MemoryView &view = views[i];
|
||||
(*view.out_ptr) = (uint8_t *)base + (views[i].virtual_address & Memory::MEMVIEW32_MASK);
|
||||
}
|
||||
return true;
|
||||
#else
|
||||
// Figure out how much memory we need to allocate in total.
|
||||
@@ -265,6 +266,10 @@ void MemoryMap_Shutdown(u32 flags) {
|
||||
*views[i].out_ptr = nullptr;
|
||||
}
|
||||
g_arena.ReleaseSpace();
|
||||
|
||||
#if PPSSPP_PLATFORM(UWP)
|
||||
VirtualFree(base, 0, MEM_RELEASE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Init() {
|
||||
|
||||
+1
-1
@@ -636,7 +636,7 @@ void NativeInitGraphics(GraphicsContext *graphicsContext) {
|
||||
#ifdef _WIN32
|
||||
winAudioBackend = CreateAudioBackend((AudioBackendType)g_Config.iAudioBackend);
|
||||
#if PPSSPP_PLATFORM(UWP)
|
||||
// TODO UWP
|
||||
winAudioBackend->Init(0, &Win32Mix, 44100);
|
||||
#else
|
||||
winAudioBackend->Init(MainWindow::GetHWND(), &Win32Mix, 44100);
|
||||
#endif
|
||||
|
||||
@@ -137,6 +137,7 @@
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>../..;../../ext/native;../../ext/snappy;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NOMINMAX;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@@ -166,6 +167,7 @@
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>../..;../../ext/native;../../ext/snappy;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NOMINMAX;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@@ -195,6 +197,7 @@
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>../..;../../ext/native;../../ext/snappy;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NOMINMAX;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
||||
@@ -279,7 +279,6 @@
|
||||
<ClInclude Include="..\..\ext\native\thin3d\thin3d.h" />
|
||||
<ClInclude Include="..\..\ext\native\thread\executor.h" />
|
||||
<ClInclude Include="..\..\ext\native\thread\prioritizedworkqueue.h" />
|
||||
<ClInclude Include="..\..\ext\native\thread\thread.h" />
|
||||
<ClInclude Include="..\..\ext\native\thread\threadpool.h" />
|
||||
<ClInclude Include="..\..\ext\native\thread\threadutil.h" />
|
||||
<ClInclude Include="..\..\ext\native\ui\screen.h" />
|
||||
|
||||
@@ -515,9 +515,6 @@
|
||||
<ClInclude Include="..\..\ext\native\thread\prioritizedworkqueue.h">
|
||||
<Filter>thread</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\ext\native\thread\thread.h">
|
||||
<Filter>thread</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\ext\native\thread\threadpool.h">
|
||||
<Filter>thread</Filter>
|
||||
</ClInclude>
|
||||
|
||||
@@ -35,7 +35,7 @@ using namespace Concurrency;
|
||||
|
||||
// UGLY!
|
||||
PPSSPP_UWPMain *g_main;
|
||||
|
||||
extern WindowsAudioBackend *winAudioBackend;
|
||||
// TODO: Use Microsoft::WRL::ComPtr<> for D3D11 objects?
|
||||
// TODO: See https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/WindowsAudioSession for WASAPI with UWP
|
||||
// TODO: Low latency input: https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/LowLatencyInput/cpp
|
||||
@@ -284,7 +284,7 @@ std::string System_GetProperty(SystemProperty prop) {
|
||||
int System_GetPropertyInt(SystemProperty prop) {
|
||||
switch (prop) {
|
||||
case SYSPROP_AUDIO_SAMPLE_RATE:
|
||||
return 48000; //winAudioBackend ? winAudioBackend->GetSampleRate() : -1;
|
||||
return winAudioBackend ? winAudioBackend->GetSampleRate() : -1;
|
||||
case SYSPROP_DISPLAY_REFRESH_RATE:
|
||||
return 60000;
|
||||
case SYSPROP_DEVICE_TYPE:
|
||||
|
||||
Reference in new issue
Block a user