Skip to content

Commit

Permalink
fix ad loading in background
Browse files Browse the repository at this point in the history
  • Loading branch information
duchuule committed Sep 1, 2015
1 parent 1fc931b commit 7b3ba97
Show file tree
Hide file tree
Showing 16 changed files with 259 additions and 36 deletions.
13 changes: 13 additions & 0 deletions BlankPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Page
x:Class="VBA10.BlankPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:VBA10"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

</Grid>
</Page>
27 changes: 27 additions & 0 deletions BlankPage.xaml.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// BlankPage.xaml.cpp
// Implementation of the BlankPage class
//

#include "pch.h"
#include "BlankPage.xaml.h"

using namespace VBA10;

using namespace Platform;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Controls::Primitives;
using namespace Windows::UI::Xaml::Data;
using namespace Windows::UI::Xaml::Input;
using namespace Windows::UI::Xaml::Media;
using namespace Windows::UI::Xaml::Navigation;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238

BlankPage::BlankPage()
{
InitializeComponent();
}
21 changes: 21 additions & 0 deletions BlankPage.xaml.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// BlankPage.xaml.h
// Declaration of the BlankPage class
//

#pragma once

#include "BlankPage.g.h"

namespace VBA10
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
[Windows::Foundation::Metadata::WebHostHidden]
public ref class BlankPage sealed
{
public:
BlankPage();
};
}
10 changes: 6 additions & 4 deletions DirectXPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@
Background="Transparent"
>
<SplitView.Pane >
<RelativePanel >
<!-- A custom ListView to display the items in the pane. The automation Name is set in the ContainerContentChanging event. -->
<RelativePanel >
<!-- A custom ListView to display the items in the pane. The automation Name is set in the ContainerContentChanging event. -->
<controls:NavMenuListView x:Name="NavMenuList"
IsTabStop="False"
Margin="0,48,0,0"
Expand All @@ -87,7 +87,9 @@
ItemTemplate="{StaticResource NavMenuItemTemplate}"
ItemInvoked="NavMenuList_ItemInvoked">
<!--<controls:NavMenuListView.Header>
--><!-- Using this custom back navigation button until the system-provided back button is enabled. --><!--
-->
<!-- Using this custom back navigation button until the system-provided back button is enabled. -->
<!--
<Button x:Name="BackButton"
TabIndex="2"
Style="{StaticResource NavigationBackButtonStyle}"
Expand Down Expand Up @@ -131,7 +133,7 @@
AutomationProperties.Name="Menu"
ToolTipService.ToolTip="Menu"
/>
<!---->
<!---->


</SwapChainPanel>
Expand Down
18 changes: 14 additions & 4 deletions DirectXPage.xaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "stringhelper.h"
#include "App.xaml.h"


#include "NavMenuItem.h"
#include "NavMenuListView.h"
#include "SelectROMPane.xaml.h"
Expand All @@ -23,6 +24,7 @@
#include "ExportPage.xaml.h"
#include "ImportPage.xaml.h"
#include "PurchasePage.xaml.h"
#include "BlankPage.xaml.h"



Expand Down Expand Up @@ -572,9 +574,14 @@ void DirectXPage::TogglePaneButton_UnChecked(Platform::Object^ sender, Windows::
//disable AppFrame so that it does not receive input accidentally
AppFrame->IsEnabled = false;

//navigate to a blank page to avoid ad control reload
AppFrame->Navigate(TypeName(BlankPage::typeid));

//change the size of app frame to zero to hide content
AppFrame->Width = 0.0f;



//unselect item
//NavMenuList->SetSelectedItem(nullptr);

Expand Down Expand Up @@ -1059,9 +1066,12 @@ void DirectXPage::ImportRomFromFile(FileActivatedEventArgs^ args)


}, task_continuation_context::use_current());
}





}
void DirectXPage::EditButtonLayout()
{
this->m_main->emulator->EnterButtonEditMode();
CloseMenu();

}
2 changes: 1 addition & 1 deletion DirectXPage.xaml.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace VBA10
void LoadState();
void Reset();
void SelectSaveState(int slot);

void EditButtonLayout();


//from AppShell
Expand Down
16 changes: 16 additions & 0 deletions Emulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,4 +455,20 @@ namespace VBA10
}
}, task_continuation_context::use_current());
}


void EmulatorGame::EnterButtonEditMode()
{
this->virtualInput->EnterEditMode();
}

bool EmulatorGame::IsButtonEditMode()
{
return this->virtualInput->IsEditMode();
}

void EmulatorGame::LeaveButtonEditMode(bool accept)
{
this->virtualInput->LeaveEditMode(accept);
}
}
5 changes: 4 additions & 1 deletion Emulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ namespace VBA10

task<bool> RestoreHidConfig();

void EnterButtonEditMode();
bool IsButtonEditMode();
void LeaveButtonEditMode(bool accept);

private:
static EmulatorGame *instance;

Expand Down Expand Up @@ -98,7 +102,6 @@ namespace VBA10
void DeInitSound(void);
void FlipBuffers(void *buffer, size_t rowPitch);



};
}
Expand Down
10 changes: 7 additions & 3 deletions EmulatorRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,12 +422,12 @@ namespace VBA10
this->MeasureTime();
}*/

if(!emulator->IsPaused())
{
if (!emulator->IsPaused())
{
this->elapsedTime += timeDelta;

this->lastElapsed = timeDelta;

systemFrameSkip = 0;

turboSkip = EmulatorSettings::Current->TurboFrameSkip;
Expand Down Expand Up @@ -459,6 +459,10 @@ namespace VBA10
this->Autosave();


this->emulator->Update(timeDelta);
}
else if (this->emulator->IsButtonEditMode())
{
this->emulator->Update(timeDelta);
}
this->FPSCounter();
Expand Down
15 changes: 12 additions & 3 deletions SettingsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,20 @@
VerticalAlignment="Top"
SelectedIndex="1"
SelectionChanged="dpadComboBox_SelectionChanged_1"
Header="D-Pad Style">
Header="D-Pad Style"
Margin =" 0, 0, 0, 12">
<ComboBoxItem>8-way</ComboBoxItem>
<ComboBoxItem>fixed analogue stick</ComboBoxItem>
<ComboBoxItem>dynamic analogue stick</ComboBoxItem>
</ComboBox>

<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<Button x:Name="editButonLayoutBtn"
Content="Edit button layout"
HorizontalAlignment="Stretch"
Click="editButonLayoutBtn_Click"
Margin =" 0, 0, 0, 12"/>

<StackPanel Orientation="Horizontal" >
<TextBlock Name="deadzoneLabel2" >Deadzone (analogue stick):</TextBlock>
<TextBlock Name="deadzoneLabel" Text="10.0" />
</StackPanel>
Expand All @@ -139,7 +146,7 @@
Name="deadzoneSlider"
ValueChanged="deadzoneSlider_ValueChanged_1"
/>


<StackPanel Orientation="Horizontal" >
<TextBlock >Virtual Joystick Scale:</TextBlock>
Expand Down Expand Up @@ -171,6 +178,8 @@
ValueChanged="controllerOpacitySlider_ValueChanged_1"
/>



<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" FontSize="16"
Text="Key Bindings"
VerticalAlignment="Top"/>
Expand Down
9 changes: 8 additions & 1 deletion SettingsPage.xaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ void SettingsPage::touchToggle_Toggled(Platform::Object^ sender, Windows::UI::Xa
EnableTouchControls(this->touchToggle->IsOn);
}
this->controllerScaleSlider->IsEnabled = this->touchToggle->IsOn;
this->buttonScaleSlider->IsEnabled = this->touchToggle->IsOn;
this->controllerOpacitySlider->IsEnabled = this->touchToggle->IsOn;
this->deadzoneSlider->IsEnabled = this->touchToggle->IsOn;
this->dpadComboBox->IsEnabled = this->touchToggle->IsOn;
Expand Down Expand Up @@ -529,7 +530,10 @@ void SettingsPage::deadzoneSlider_ValueChanged_1(Platform::Object^ sender, Windo
}
}


void SettingsPage::editButonLayoutBtn_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
DirectXPage::Current->EditButtonLayout();
}

//###########VIDEO SETTINGS

Expand Down Expand Up @@ -691,3 +695,6 @@ void SettingsPage::cboTheme_SelectionChanged(Platform::Object^ sender, Windows::
}
}
}



1 change: 1 addition & 0 deletions SettingsPage.xaml.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,6 @@ namespace VBA10
void OnCancelled(Platform::Object ^sender, Platform::Object ^args);
void OnCompleted(Platform::Object ^sender, Platform::Object ^args);
void cboTheme_SelectionChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e);
void editButonLayoutBtn_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
};
}
9 changes: 9 additions & 0 deletions VBA10.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,9 @@
<ClInclude Include="AdControl.xaml.h">
<DependentUpon>AdControl.xaml</DependentUpon>
</ClInclude>
<ClInclude Include="BlankPage.xaml.h">
<DependentUpon>BlankPage.xaml</DependentUpon>
</ClInclude>
<ClInclude Include="CheatPane.xaml.h">
<DependentUpon>CheatPane.xaml</DependentUpon>
</ClInclude>
Expand Down Expand Up @@ -487,6 +490,9 @@
<ClCompile Include="AdControl.xaml.cpp">
<DependentUpon>AdControl.xaml</DependentUpon>
</ClCompile>
<ClCompile Include="BlankPage.xaml.cpp">
<DependentUpon>BlankPage.xaml</DependentUpon>
</ClCompile>
<ClCompile Include="CheatPane.xaml.cpp">
<DependentUpon>CheatPane.xaml</DependentUpon>
</ClCompile>
Expand Down Expand Up @@ -1193,6 +1199,9 @@
<Page Include="AdControl.xaml">
<SubType>Designer</SubType>
</Page>
<Page Include="BlankPage.xaml">
<SubType>Designer</SubType>
</Page>
<Page Include="CheatPane.xaml" />
<Page Include="ExportPage.xaml">
<SubType>Designer</SubType>
Expand Down
1 change: 1 addition & 0 deletions VBA10.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@
<Page Include="FileBrowserPane.xaml" />
<Page Include="SelectFilesPane.xaml" />
<Page Include="HIDGamepadConfig.xaml" />
<Page Include="BlankPage.xaml" />
</ItemGroup>
<ItemGroup>
<FxCompile Include="SpriteBatch_PS.hlsl">
Expand Down
Loading

0 comments on commit 7b3ba97

Please sign in to comment.