From 50f18a3480f3ae97c992d3d14c01365d7f615ee5 Mon Sep 17 00:00:00 2001 From: Duc Le Date: Mon, 3 Aug 2015 13:36:25 +0000 Subject: [PATCH] clean up code: move App.xaml.h out of pch.h --- App.xaml.cpp | 5 +- App.xaml.h | 5 + CheatPane.xaml.h | 2 + Common/DeviceResources.cpp | 6 +- Converter.h | 2 +- Definitions.h | 60 +++++ DirectXPage.xaml.cpp | 2 +- EmulatorSettings.h | 15 ++ ImportPage.xaml | 12 +- ImportPage.xaml.cpp | 23 ++ ImportPage.xaml.h | 1 + SelectFilePane.xaml.h | 1 + SelectROMPane.xaml.cpp | 5 +- SelectROMPane.xaml.h | 59 +---- VBA10.vcxproj | 9 + VBA10.vcxproj.filters | 2 + live_connect.h | 502 +++++++++++++++++++++++++++++++++++++ packages.config | 4 + pch.h | 5 +- 19 files changed, 654 insertions(+), 66 deletions(-) create mode 100644 live_connect.h create mode 100644 packages.config diff --git a/App.xaml.cpp b/App.xaml.cpp index dedf049..fb743f7 100644 --- a/App.xaml.cpp +++ b/App.xaml.cpp @@ -4,8 +4,10 @@ // #include "pch.h" +#include "App.xaml.h" #include "DirectXPage.xaml.h" #include "EmulatorSettings.h" +#include "live_connect.h" using namespace VBA10; @@ -26,7 +28,7 @@ using namespace Windows::UI::Xaml::Navigation; using namespace Windows::UI::ViewManagement; ROMDatabase^ VBA10::App::ROMDB = nullptr; - +//web::live::live_client* LiveClient = nullptr; /// /// Initializes the singleton application object. This is the first line of authored code @@ -40,6 +42,7 @@ App::App() Resuming += ref new EventHandler(this, &App::OnResuming); ROMDB = ref new ROMDatabase(); + //LiveClient = new web::live::live_client(); } /// diff --git a/App.xaml.h b/App.xaml.h index d5b9d69..77981c0 100644 --- a/App.xaml.h +++ b/App.xaml.h @@ -9,6 +9,7 @@ #include "DirectXPage.xaml.h" #include "Database\ROMDatabase.h" #include "EmulatorSettings.h" +#include "live_connect.h" namespace VBA10 { @@ -23,6 +24,9 @@ namespace VBA10 internal: static ROMDatabase^ ROMDB; + static live::live_client* LiveClient; + + private: @@ -31,5 +35,6 @@ namespace VBA10 DirectXPage^ m_directXPage; + }; } diff --git a/CheatPane.xaml.h b/CheatPane.xaml.h index 89af441..7778484 100644 --- a/CheatPane.xaml.h +++ b/CheatPane.xaml.h @@ -8,6 +8,8 @@ #include "CheatPane.g.h" #include "CheatData.h" +using namespace Platform::Collections; + namespace VBA10 { [Windows::Foundation::Metadata::WebHostHidden] diff --git a/Common/DeviceResources.cpp b/Common/DeviceResources.cpp index cd71c13..8d9c280 100644 --- a/Common/DeviceResources.cpp +++ b/Common/DeviceResources.cpp @@ -2,6 +2,8 @@ #include "DeviceResources.h" #include "DirectXHelper.h" #include +#include + using namespace D2D1; using namespace DirectX; @@ -220,8 +222,8 @@ void DX::DeviceResources::CreateWindowSizeDependentResources() m_outputSize.Height = m_logicalSize.Height * m_compositionScaleY; // Prevent zero size DirectX content from being created. - m_outputSize.Width = max(m_outputSize.Width, 1); - m_outputSize.Height = max(m_outputSize.Height, 1); + m_outputSize.Width = std::max(m_outputSize.Width, 1.0f); + m_outputSize.Height = std::max(m_outputSize.Height, 1.0f); // The width and height of the swap chain must be based on the window's // natively-oriented width and height. If the window is not in the native diff --git a/Converter.h b/Converter.h index f690e77..00b079f 100644 --- a/Converter.h +++ b/Converter.h @@ -1,5 +1,5 @@ #pragma once -#include "pch.h" + #include //IMPORTANT NOTE: need to include this header file in both the .h and .cpp of an xaml page diff --git a/Definitions.h b/Definitions.h index 5f8aad2..b4f5351 100644 --- a/Definitions.h +++ b/Definitions.h @@ -1,3 +1,63 @@ #pragma once #define DEFAULT_SNAPSHOT L"Assets/no_snapshot.png" + +using namespace Windows::Storage; + +namespace VBA10 +{ + public delegate void ROMSelectedDelegate(StorageFile ^file, StorageFolder ^folder); + + [Windows::UI::Xaml::Data::BindableAttribute] + public ref class StorageFolderModel sealed + { + private: + public: + property StorageFolder ^Folder; + + property Platform::String ^Name + { + Platform::String ^get() + { + return this->Folder->DisplayName; + } + } + + property Platform::String ^Path + { + Platform::String ^get() + { + return this->Folder->Path; + } + } + + StorageFolderModel(StorageFolder ^folder); + }; + + [Windows::UI::Xaml::Data::BindableAttribute] + public ref class StorageFileModel sealed + { + private: + public: + property StorageFile ^File; + property StorageFolder ^Folder; + + property Platform::String ^Name + { + Platform::String ^get() + { + return this->File->Name; + } + } + + property Platform::String ^Path + { + Platform::String ^get() + { + return this->Folder->Path; + } + } + + StorageFileModel(StorageFile ^file, StorageFolder ^folder); + }; +} \ No newline at end of file diff --git a/DirectXPage.xaml.cpp b/DirectXPage.xaml.cpp index d34222b..3147c9c 100644 --- a/DirectXPage.xaml.cpp +++ b/DirectXPage.xaml.cpp @@ -12,7 +12,7 @@ #include "Database\ROMDatabase.h" #include "Definitions.h" #include "stringhelper.h" - +#include "App.xaml.h" #include "NavMenuItem.h" #include "NavMenuListView.h" diff --git a/EmulatorSettings.h b/EmulatorSettings.h index 81e9950..6bb04dd 100644 --- a/EmulatorSettings.h +++ b/EmulatorSettings.h @@ -119,6 +119,19 @@ namespace VBA10 } } + //keep track of whether the user successfully signed in before or not (so that we tried to silently resign in) + property bool SignedIn + { + bool get() + { + return GetValueOrDefault(SignedInKey, SignedInDefault); + } + void set(bool value) + { + AddOrUpdateValue(SignedInKey, value); + } + } + #pragma region Button positions @@ -556,6 +569,7 @@ namespace VBA10 Platform::String^ TurboFrameSkipKey = "TurboFrameSkipKey"; Platform::String^ EnableTurboKey = "EnableTurboKey"; Platform::String^ FullScreenKey = "FullScreenKey"; + Platform::String^ SignedInKey = "SignedInKey"; #pragma region button positions Platform::String^ PadLeftPKey = "PadLeftPKey"; @@ -605,6 +619,7 @@ namespace VBA10 const int TurboFrameSkipDefault = 2; const bool EnableTurboDefault = false; const bool FullScreenDefault = false; + const bool SignedInDefault = false; #pragma region button positions (in cm based on 6x10cm phone) diff --git a/ImportPage.xaml b/ImportPage.xaml index 9b0c651..b85c3be 100644 --- a/ImportPage.xaml +++ b/ImportPage.xaml @@ -6,7 +6,8 @@ xmlns:ctl="using:VBA10.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - mc:Ignorable="d"> + mc:Ignorable="d" + Loaded="Page_Loaded"> @@ -66,10 +67,15 @@ + +