Skip to content

Commit

Permalink
fix binding of cheat code
Browse files Browse the repository at this point in the history
  • Loading branch information
duchuule committed Jul 6, 2015
1 parent 1b1cb36 commit f0d33af
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 19 deletions.
50 changes: 43 additions & 7 deletions CheatData.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,52 @@
#ifndef CHEATDATA_H_
#define CHEATDATA_H_
#pragma once

namespace VBA10
{
//[Windows::UI::Xaml::Data::BindableAttribute]
[Windows::UI::Xaml::Data::BindableAttribute]
public ref class CheatData sealed
{
public:
property Platform::String ^CheatCode;
property Platform::String ^Description;
property bool Enabled;
property Platform::String^ CheatCode
{
Platform::String^ get()
{
return _cheatcode;
}
void set(Platform::String^ value)
{
_cheatcode = value;
}
}

property Platform::String^ Description
{
Platform::String^ get()
{
return _description;
}
void set(Platform::String^ value)
{
_description = value;
}
}

property bool Enabled
{
bool get()
{
return _enabled;
}
void set(bool value)
{
_enabled = value;
}
}

private:
Platform::String ^ _cheatcode;
Platform::String ^ _description;
bool _enabled;

};
}

#endif
13 changes: 9 additions & 4 deletions CheatPane.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,15 @@
<ColumnDefinition Width="84" />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal">
<CheckBox Name="enableCheatBox" IsChecked="{Binding Enabled}" Margin="0,0,15,0" Checked="enableCheatBox_Checked" Unchecked="enableCheatBox_Checked" />
<StackPanel Grid.Column="0" Orientation="Vertical" HorizontalAlignment="Left">
<TextBlock Foreground="White" Text="{Binding CheatCode}" Width="auto" Height="auto" FontSize="26"/>
<TextBlock Foreground="White" Text="{Binding Description}" Width="auto" Height="auto" FontSize="14" />
<CheckBox Name="enableCheatBox"
IsChecked="{Binding Enabled}"
Margin="0,0,15,0"
Checked="enableCheatBox_Checked"
Unchecked="enableCheatBox_Checked" />
<StackPanel Grid.Column="0" Orientation="Vertical"
HorizontalAlignment="Left">
<TextBlock Text="{Binding CheatCode}" FontSize="26"/>
<TextBlock Text="{Binding Description}" FontSize="14" />
</StackPanel>
</StackPanel>
<Button Grid.Column="1"
Expand Down
7 changes: 5 additions & 2 deletions CheatPane.xaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ void CheatPane::RefreshCheatList(void)
{
this->cheatList->ItemsSource = nullptr;
this->cheatList->ItemsSource = this->cheatCodes;
//cvsAllCheats->Source = this->cheatCodes;
}


Expand Down Expand Up @@ -249,8 +250,7 @@ Vector<Platform::String ^>^ CheatPane::GetCodes(Platform::String ^codeText)
bool continuedFromLast = false;
stringstream ss;

if (continuedFromLast == false) //reset the string builder if not continued from last time
ss.str(""); //clear the stringstream


for (int i = 0; i < codeParts.size(); i++)
{
Expand All @@ -259,6 +259,9 @@ Vector<Platform::String ^>^ CheatPane::GetCodes(Platform::String ^codeText)
replaceAll(line, "\t", "");
replaceAll(line, "-", "");

if (continuedFromLast == false) //reset the string builder if not continued from last time
ss.str(""); //clear the stringstream

if (line.size() == 6)
{
ss << line.substr(0, 3);
Expand Down
6 changes: 0 additions & 6 deletions SelectROMPane.xaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,6 @@ SelectROMPane::SelectROMPane()
int index = 0;
for (int i = 1; i < App::ROMDB->AllROMDBEntries->Size; i++)
{
#if _DEBUG
int64 test = App::ROMDB->AllROMDBEntries->GetAt(i)->LastPlayed.UniversalTime;
Platform::String ^message = test + "\n";
wstring wstr(message->Begin(), message->End());
OutputDebugStringW(wstr.c_str());
#endif

if (App::ROMDB->AllROMDBEntries->GetAt(i)->LastPlayed.UniversalTime > App::ROMDB->AllROMDBEntries->GetAt(index)->LastPlayed.UniversalTime)
index = i;
Expand Down

0 comments on commit f0d33af

Please sign in to comment.