More work on UWP upbring

This commit is contained in:
Henrik Rydgard 2017-02-26 15:40:53 +01:00 committed by Henrik Rydgård
parent 227942bce7
commit dfc0b32733
7 changed files with 117 additions and 16 deletions

View File

@ -73,11 +73,11 @@ void App::SetWindow(CoreWindow^ window) {
DisplayInformation::DisplayContentsInvalidated +=
ref new TypedEventHandler<DisplayInformation^, Object^>(this, &App::OnDisplayContentsInvalidated);
window->KeyDown += ref new TypedEventHandler<DisplayInformation, Object^>(this, &App::OnKeyDown);
// window->KeyDown += ref new TypedEventHandler<DisplayInformation, Object^>(this, &App::OnKeyDown);
m_deviceResources->SetWindow(window);
}
// Initializes scene resources, or loads a previously saved app state.
void App::Load(Platform::String^ entryPoint) {
if (m_main == nullptr) {

View File

@ -19,10 +19,14 @@
using namespace UWP;
using namespace Windows::Foundation;
using namespace Windows::Storage;
using namespace Windows::System::Threading;
using namespace Concurrency;
namespace UWP {
// 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
// Loads and initializes application assets when the application is loaded.
PPSSPP_UWPMain::PPSSPP_UWPMain(const std::shared_ptr<DX::DeviceResources>& deviceResources) :
@ -31,6 +35,8 @@ PPSSPP_UWPMain::PPSSPP_UWPMain(const std::shared_ptr<DX::DeviceResources>& devic
// Register to be notified if the Device is lost or recreated
m_deviceResources->RegisterDeviceNotify(this);
// create_task(KnownFolders::GetFolderForUserAsync(nullptr, KnownFolderId::RemovableDevices)).then([this](StorageFolder ^));
// TODO: Change the timer settings if you want something other than the default variable timestep mode.
// e.g. for 60 FPS fixed timestep update logic, call:
/*
@ -90,9 +96,12 @@ PPSSPP_UWPMain::PPSSPP_UWPMain(const std::shared_ptr<DX::DeviceResources>& devic
NativeInit(1, argv, "", "", "", false);
NativeInitGraphics(m_graphicsContext.get());
NativeResized();
m_graphicsContext->GetDrawContext()->HandleEvent(Draw::Event::GOT_BACKBUFFER);
}
PPSSPP_UWPMain::~PPSSPP_UWPMain() {
m_graphicsContext->GetDrawContext()->HandleEvent(Draw::Event::LOST_BACKBUFFER);
NativeShutdownGraphics();
NativeShutdown();
@ -120,6 +129,7 @@ bool PPSSPP_UWPMain::Render() {
// Reset the viewport to target the whole screen.
auto viewport = m_deviceResources->GetScreenViewport();
m_deviceResources->GetBackBufferRenderTargetView()
pixel_xres = viewport.Width;
pixel_yres = viewport.Height;
@ -131,7 +141,6 @@ bool PPSSPP_UWPMain::Render() {
dp_xres = pixel_xres * g_dpi_scale;
dp_yres = pixel_yres * g_dpi_scale;
/*
context->RSSetViewports(1, &viewport);
// Reset render targets to the screen.
@ -141,7 +150,6 @@ bool PPSSPP_UWPMain::Render() {
// Clear the back buffer and depth stencil view.
context->ClearRenderTargetView(m_deviceResources->GetBackBufferRenderTargetView(), DirectX::Colors::CornflowerBlue);
context->ClearDepthStencilView(m_deviceResources->GetDepthStencilView(), D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0);
*/
NativeRender(m_graphicsContext.get());
return true;
}
@ -155,6 +163,7 @@ void PPSSPP_UWPMain::OnDeviceLost() {
void PPSSPP_UWPMain::OnDeviceRestored()
{
CreateWindowSizeDependentResources();
}
UWPGraphicsContext::UWPGraphicsContext(std::shared_ptr<DX::DeviceResources> resources) {
@ -169,6 +178,8 @@ void UWPGraphicsContext::SwapInterval(int interval) {
}
} // namespace UWP
std::string System_GetProperty(SystemProperty prop) {
static bool hasCheckedGPUDriverVersion = false;
switch (prop) {

View File

@ -20,15 +20,15 @@
</uap:DefaultTile>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
<uap:InitialRotationPreference>
<uap:Rotation Preference="portrait" />
<uap:Rotation Preference="landscape" />
<uap:Rotation Preference="portraitFlipped" />
<uap:Rotation Preference="landscapeFlipped" />
</uap:InitialRotationPreference>
</uap:VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="codeGeneration" />
<Capability Name="internetClient" />
<uap:Capability Name="removableStorage" />
<DeviceCapability Name="microphone" />
</Capabilities>
</Package>

View File

@ -189,13 +189,36 @@
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<Image Include="Assets\LockScreenLogo.scale-200.png" />
<Image Include="Assets\SplashScreen.scale-200.png" />
<Image Include="Assets\Square150x150Logo.scale-200.png" />
<Image Include="Assets\Square44x44Logo.scale-200.png" />
<Image Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Image Include="Assets\StoreLogo.png" />
<Image Include="Assets\Wide310x150Logo.scale-200.png" />
<Image Include="Assets\LockScreenLogo.scale-200.png">
<DeploymentContent>true</DeploymentContent>
</Image>
<Image Include="Assets\SplashScreen.scale-200.png">
<DeploymentContent>true</DeploymentContent>
</Image>
<Image Include="Assets\Square150x150Logo.scale-200.png">
<DeploymentContent>true</DeploymentContent>
</Image>
<Image Include="Assets\Square44x44Logo.scale-200.png">
<DeploymentContent>true</DeploymentContent>
</Image>
<Image Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png">
<DeploymentContent>true</DeploymentContent>
</Image>
<Image Include="Assets\StoreLogo.png">
<DeploymentContent>true</DeploymentContent>
</Image>
<Image Include="Assets\Wide310x150Logo.scale-200.png">
<DeploymentContent>true</DeploymentContent>
</Image>
<Image Include="Content\7z.png">
<DeploymentContent>true</DeploymentContent>
</Image>
<Image Include="Content\unknown.png">
<DeploymentContent>true</DeploymentContent>
</Image>
<Image Include="Content\zip.png">
<DeploymentContent>true</DeploymentContent>
</Image>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\ppsspp_config.h" />
@ -232,6 +255,28 @@
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
<Image Include="Content\rargray.png">
<DeploymentContent>true</DeploymentContent>
</Image>
<Image Include="Content\ui_atlas.zim">
<DeploymentContent>true</DeploymentContent>
<FileType>Document</FileType>
</Image>
<None Include="Content\compat.ini">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="Content\knownfuncs.ini">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="Content\langregion.ini">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="Content\ppge_atlas.zim">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="Content\ui_atlas_lowmem.zim">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="UWP_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
@ -263,6 +308,11 @@
<Project>{ddf90203-0aae-4f38-b589-2e9637658ce6}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Text Include="Content\gamecontrollerdb.txt">
<DeploymentContent>true</DeploymentContent>
</Text>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ImageContentTask.targets" />

View File

@ -35,6 +35,9 @@
<Image Include="Assets\Wide310x150Logo.scale-200.png">
<Filter>Assets</Filter>
</Image>
<Filter Include="Content">
<UniqueIdentifier>{ef87b390-608f-4c6d-a0ad-88963875ed11}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="App.cpp" />
@ -54,11 +57,46 @@
<Image Include="Assets\StoreLogo.png">
<Filter>Assets</Filter>
</Image>
<Image Include="Content\7z.png">
<Filter>Content</Filter>
</Image>
<Image Include="Content\rargray.png">
<Filter>Content</Filter>
</Image>
<Image Include="Content\unknown.png">
<Filter>Content</Filter>
</Image>
<Image Include="Content\zip.png">
<Filter>Content</Filter>
</Image>
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest" />
</ItemGroup>
<ItemGroup>
<None Include="UWP_TemporaryKey.pfx" />
<None Include="Content\ui_atlas.zim">
<Filter>Content</Filter>
</None>
<None Include="Content\compat.ini">
<Filter>Content</Filter>
</None>
<None Include="Content\knownfuncs.ini">
<Filter>Content</Filter>
</None>
<None Include="Content\langregion.ini">
<Filter>Content</Filter>
</None>
<None Include="Content\ppge_atlas.zim">
<Filter>Content</Filter>
</None>
<None Include="Content\ui_atlas_lowmem.zim">
<Filter>Content</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Text Include="Content\gamecontrollerdb.txt">
<Filter>Content</Filter>
</Text>
</ItemGroup>
</Project>

View File

@ -1280,6 +1280,7 @@ bool D3D11DrawContext::BlitFramebuffer(Framebuffer *srcfb, int srcX1, int srcY1,
// These functions should be self explanatory.
void D3D11DrawContext::BindFramebufferAsRenderTarget(Framebuffer *fbo) {
// TODO: deviceContext1 can actually discard. Useful on Windows Mobile.
D3D11Framebuffer *fb = (D3D11Framebuffer *)fbo;
if (curRenderTargetView_ == fb->colorRTView && curDepthStencilView_ == fb->depthStencilRTView) {
return;
@ -1336,4 +1337,4 @@ DrawContext *T3DCreateD3D11Context(ID3D11Device *device, ID3D11DeviceContext *co
return new D3D11DrawContext(device, context, device1, context1, featureLevel, hWnd);
}
} // namespace Draw
} // namespace Draw

View File

@ -1,3 +1,4 @@
#include "ppsspp_config.h"
#include "base/display.h"
#include "ui/ui.h"
#include "ui/view.h"
@ -27,7 +28,7 @@ void UIContext::Init(Draw::DrawContext *thin3d, Draw::Pipeline *uipipe, Draw::Pi
ui_pipeline_notex_ = uipipenotex;
uidrawbuffer_ = uidrawbuffer;
uidrawbufferTop_ = uidrawbufferTop;
#if defined(_WIN32) || defined(USING_QT_UI)
#if (defined(_WIN32) && !PPSSPP_PLATFORM(UWP)) || defined(USING_QT_UI)
textDrawer_ = new TextDrawer(thin3d);
#else
textDrawer_ = nullptr;