Permalink
Browse files

temp

  • Loading branch information...
1 parent 650228c commit d6dd2e3b109175e8f288f207f048adb580ae6742 @RetroAchievements committed Apr 11, 2015
View
@@ -254,3 +254,5 @@
/RAVBA-M/project/vs2012_mfc/Diffs.txt
/RAVBA-M/project/vs2012_mfc/LiveTag.txt
/RAVBA-M/src/BuildVer.h
+/bizhawk/output/N64/SaveRAM/*.SaveRAM
+/bizhawk/output/N64/SaveRAM/*.bak
@@ -51,24 +51,24 @@ char* DataStreamAsString( DataStream& stream )
std::string Narrow( const wchar_t* wstr )
{
- static std::wstring_convert< std::codecvt_utf8< wchar_t >, wchar_t > converter;
+ std::wstring_convert< std::codecvt_utf8< wchar_t >, wchar_t > converter;
return converter.to_bytes( wstr );
}
std::string Narrow( const std::wstring& wstr )
{
- static std::wstring_convert< std::codecvt_utf8< wchar_t >, wchar_t > converter;
+ std::wstring_convert< std::codecvt_utf8< wchar_t >, wchar_t > converter;
return converter.to_bytes( wstr );
}
std::wstring Widen( const char* str )
{
- static std::wstring_convert< std::codecvt_utf8< wchar_t >, wchar_t > converter;
+ std::wstring_convert< std::codecvt_utf8< wchar_t >, wchar_t > converter;
return converter.from_bytes( str );
}
std::wstring Widen( const std::string& str )
{
- static std::wstring_convert< std::codecvt_utf8< wchar_t >, wchar_t > converter;
+ std::wstring_convert< std::codecvt_utf8< wchar_t >, wchar_t > converter;
return converter.from_bytes( str );
}
@@ -613,9 +613,9 @@ BOOL CreateIPE( int nItem, int nSubItem )
// }
/*CB_ERRSPACE*/
- ComboBox_AddString( g_hIPEEdit, "Mem" );
- ComboBox_AddString( g_hIPEEdit, "Delta" );
- ComboBox_AddString( g_hIPEEdit, "Value" );
+ ComboBox_AddString( g_hIPEEdit, Widen("Mem").c_str() );
+ ComboBox_AddString( g_hIPEEdit, Widen("Delta").c_str() );
+ ComboBox_AddString( g_hIPEEdit, Widen("Value").c_str() );
int nSel;
if( strcmp( g_AchievementEditorDialog.LbxDataAt( nItem, nSubItem ), "Mem" ) == 0 )
@@ -668,7 +668,7 @@ BOOL CreateIPE( int nItem, int nSubItem )
for( size_t i = 0; i < NumComparisonVariableSizeTypes; ++i )
{
- ComboBox_AddString( g_hIPEEdit, COMPARISONVARIABLESIZE_STR[ i ] );
+ ComboBox_AddString( g_hIPEEdit, Widen( COMPARISONVARIABLESIZE_STR[ i ] ).c_str() );
if( strcmp( g_AchievementEditorDialog.LbxDataAt( nItem, nSubItem ), COMPARISONVARIABLESIZE_STR[i] ) == 0 )
ComboBox_SetCurSel( g_hIPEEdit, i );
@@ -707,7 +707,7 @@ BOOL CreateIPE( int nItem, int nSubItem )
for( size_t i = 0; i < NumComparisonTypes; ++i )
{
- ComboBox_AddString( g_hIPEEdit, COMPARISONVARIABLETYPE_STR[ i ] );
+ ComboBox_AddString( g_hIPEEdit, Widen( COMPARISONVARIABLETYPE_STR[ i ] ).c_str() );
if( strcmp( g_AchievementEditorDialog.LbxDataAt( nItem, nSubItem ), COMPARISONVARIABLETYPE_STR[ i ] ) == 0 )
ComboBox_SetCurSel( g_hIPEEdit, i );
@@ -1823,13 +1823,13 @@ void BadgeNames::OnNewBadgeNames( const Document& data )
for( unsigned int i = nLowerLimit; i < nUpperLimit; ++i )
{
sprintf_s( buffer, 256, "%05d", i );
- ComboBox_AddString( m_hDestComboBox, buffer );
+ ComboBox_AddString( m_hDestComboBox, Widen( buffer ).c_str() );
}
}
void BadgeNames::AddNewBadgeName( const char* pStr, bool bAndSelect )
{
- int nSel = ComboBox_AddString( m_hDestComboBox, pStr );
+ int nSel = ComboBox_AddString( m_hDestComboBox, Widen( pStr ).c_str() );
if( bAndSelect )
{
@@ -214,7 +214,8 @@ void Dlg_GameLibrary::SetupColumns( HWND hList )
{
col.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_FMT;
col.cchTextMax = 255;
- col.pszText = const_cast<LPWSTR>( Widen( COL_TITLE[ i ] ).c_str() );
+ std::wstring sCol = Widen( COL_TITLE[ i ] ).c_str();
+ col.pszText = const_cast<LPWSTR>( sCol.c_str() );
col.cx = COL_SIZE[ i ];
col.iSubItem = i;
@@ -28,64 +28,64 @@ INT_PTR Dlg_GameTitle::GameTitleProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARA
{
case WM_INITDIALOG:
{
- const HWND hKnownGamesCbo = GetDlgItem( hDlg, IDC_RA_KNOWNGAMES );
- std::string sGameTitleTidy = Dlg_GameTitle::CleanRomName( g_GameTitleDialog.m_sEstimatedGameTitle );
- SetDlgItemText( hDlg, IDC_RA_GAMETITLE, Widen( sGameTitleTidy ).c_str() );
-
- // Load in the checksum
- SetDlgItemText( hDlg, IDC_RA_CHECKSUM, Widen( g_GameTitleDialog.m_sMD5 ).c_str() );
-
- // Populate the dropdown
- // ***Do blocking fetch of all game titles.***
- int nSel = ComboBox_AddString( hKnownGamesCbo, "<New Title>" );
- ComboBox_SetCurSel( hKnownGamesCbo, nSel );
-
- PostArgs args;
- args[ 'c' ] = std::to_string( g_ConsoleID );
-
- Document doc;
- if( RAWeb::DoBlockingRequest( RequestGamesList, args, doc ) )
- {
- const Value& Data = doc[ "Response" ];
-
- // For all data responses to this request, populate our m_aGameTitles map
- {
- Value::ConstMemberIterator iter = Data.MemberBegin();
- while( iter != Data.MemberEnd() )
- {
- if( iter->name.IsNull() || iter->value.IsNull() )
- {
- iter++;
- continue;
- }
-
- const GameID nGameID = std::strtoul( iter->name.GetString(), nullptr, 10 ); // Keys cannot be anything but strings
- const std::string& sTitle = iter->value.GetString();
- m_aGameTitles[ sTitle ] = nGameID;
-
- iter++;
- }
- }
-
- {
- std::map<std::string, GameID>::const_iterator iter = m_aGameTitles.begin();
- while( iter != m_aGameTitles.end() )
- {
- const std::string& sTitle = iter->first;
-
- nSel = ComboBox_AddString( hKnownGamesCbo, sTitle.c_str() );
-
- // Attempt to find this game and select it by default: case insensitive comparison
- if( sGameTitleTidy.compare( sTitle ) == 0 )
- ComboBox_SetCurSel( hKnownGamesCbo, nSel );
-
- iter++;
- }
-
- }
- }
-
- return TRUE;
+ const HWND hKnownGamesCbo = GetDlgItem( hDlg, IDC_RA_KNOWNGAMES );
+ std::string sGameTitleTidy = Dlg_GameTitle::CleanRomName( g_GameTitleDialog.m_sEstimatedGameTitle );
+ SetDlgItemText( hDlg, IDC_RA_GAMETITLE, Widen( sGameTitleTidy ).c_str() );
+
+ // Load in the checksum
+ SetDlgItemText( hDlg, IDC_RA_CHECKSUM, Widen( g_GameTitleDialog.m_sMD5 ).c_str() );
+
+ // Populate the dropdown
+ // ***Do blocking fetch of all game titles.***
+ int nSel = ComboBox_AddString( hKnownGamesCbo, Widen( "<New Title>" ).c_str() );
+ ComboBox_SetCurSel( hKnownGamesCbo, nSel );
+
+ PostArgs args;
+ args[ 'c' ] = std::to_string( g_ConsoleID );
+
+ Document doc;
+ if( RAWeb::DoBlockingRequest( RequestGamesList, args, doc ) )
+ {
+ const Value& Data = doc[ "Response" ];
+
+ // For all data responses to this request, populate our m_aGameTitles map
+ {
+ Value::ConstMemberIterator iter = Data.MemberBegin();
+ while( iter != Data.MemberEnd() )
+ {
+ if( iter->name.IsNull() || iter->value.IsNull() )
+ {
+ iter++;
+ continue;
+ }
+
+ const GameID nGameID = std::strtoul( iter->name.GetString(), nullptr, 10 ); // Keys cannot be anything but strings
+ const std::string& sTitle = iter->value.GetString();
+ m_aGameTitles[ sTitle ] = nGameID;
+
+ iter++;
+ }
+ }
+
+ {
+ std::map<std::string, GameID>::const_iterator iter = m_aGameTitles.begin();
+ while( iter != m_aGameTitles.end() )
+ {
+ const std::string& sTitle = iter->first;
+
+ nSel = ComboBox_AddString( hKnownGamesCbo, Widen( sTitle ).c_str() );
+
+ // Attempt to find this game and select it by default: case insensitive comparison
+ if( sGameTitleTidy.compare( sTitle ) == 0 )
+ ComboBox_SetCurSel( hKnownGamesCbo, nSel );
+
+ iter++;
+ }
+
+ }
+ }
+
+ return TRUE;
}
break;
@@ -341,7 +341,11 @@ void WriteBufferToFile( const char* sFile, const char* sBuffer, int nBytes )
}
else
{
+#ifdef UNICODE
MessageBox( nullptr, _T( "Problems writing file!" ), Widen( sFile ).c_str(), MB_OK );
+#else
+ MessageBox( nullptr, _T( "Problems writing file!" ), sFile, MB_OK );
+#endif
}
}
@@ -393,7 +397,13 @@ const char* CCONV _RA_InstallIntegration()
{
char buffer[ 1024 ];
sprintf_s( buffer, 1024, "LoadLibrary failed: %d : %s\n", ::GetLastError(), GetLastErrorAsString().c_str() );
+
+#ifdef UNICODE
MessageBox( nullptr, Widen( buffer ).c_str(), _T( "Sorry!" ), MB_OK );
+#else
+ MessageBox( nullptr, buffer, _T( "Sorry!" ), MB_OK );
+#endif
+
return "0.000";
}
@@ -4,6 +4,7 @@
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
+using System.Windows.Forms;
namespace RAInterface
{
@@ -155,4 +156,5 @@ public RAHttpRequest(WebRequest type, PostArgs args)
Args = new FormUrlEncodedContent(args);
}
}
-}
+
+}
@@ -124,3 +124,48 @@ public static void Update()
}
}
+
+//public static class RAWebInterface
+//{
+// // Dirty args!
+// public static void PerformLogin(string user, string pass)
+// {
+// // ##RA test code:
+
+// using (var client = new HttpClient())
+// {
+// const string BaseURL = "http://retroachievements.org/";
+// const string LoginPage = "requestlogin.php";
+// const string ActivityPage = "requestpostactivity.php";
+
+// string userName = "qwe";
+// string pass2 = "qwe"; // Yuck. Plaintext?!?
+
+// var values = new List<KeyValuePair<string, string>>();
+
+// values.Clear();
+// values.Add(new KeyValuePair<string, string>("u", userName));
+// values.Add(new KeyValuePair<string, string>("p", pass2));
+
+// System.Threading.Tasks.Task<HttpResponseMessage> response = client.PostAsync(BaseURL + LoginPage, new FormUrlEncodedContent(values));
+// response.Wait();
+// var responseString = response.Result.Content.ReadAsStringAsync();
+// MessageBox.Show("Login result: " + responseString.Result);
+// if (responseString.Result.Substring(0, 3) == "OK:")
+// {
+// string userToken = responseString.Result.Substring(3, 16);
+
+// values.Clear();
+// values.Add(new KeyValuePair<string, string>("u", userName));
+// values.Add(new KeyValuePair<string, string>("t", userToken));
+// values.Add(new KeyValuePair<string, string>("a", "3")); // activity type (3=playing)
+// values.Add(new KeyValuePair<string, string>("m", "30")); // game ID ( 1 = Sonic (Mega Drive), 30 = Jet Force Gemini (N64) )
+
+// response = client.PostAsync(BaseURL + ActivityPage, new FormUrlEncodedContent(values));
+// response.Wait();
+// responseString = response.Result.Content.ReadAsStringAsync();
+// MessageBox.Show("Post Activity result: " + responseString.Result);
+// }
+// }
+// }
+//}
@@ -1,49 +0,0 @@
-using System;
-using System.Net.Http;
-
-public static class RAWebInterface
-{
- // Dirty args!
- public static void PerformLogin( string user, string pass )
- {
- // ##RA test code:
-
- using (var client = new HttpClient())
- {
- const string BaseURL = "http://retroachievements.org/";
- const string LoginPage = "requestlogin.php";
- const string ActivityPage = "requestpostactivity.php";
-
- string userName = "qwe";
- string pass = "qwe"; // Yuck. Plaintext?!?
-
- var values = new List<KeyValuePair<string, string>>();
-
- values.Clear();
- values.Add(new KeyValuePair<string, string>("u", userName));
- values.Add(new KeyValuePair<string, string>("p", pass));
-
- System.Threading.Tasks.Task<HttpResponseMessage> response = client.PostAsync(BaseURL + LoginPage, new FormUrlEncodedContent(values));
- response.Wait();
- var responseString = response.Result.Content.ReadAsStringAsync();
- MessageBox.Show("Login result: " + responseString.Result);
- if (responseString.Result.Substring(0, 3) == "OK:")
- {
- string userToken = responseString.Result.Substring(3, 16);
-
- values.Clear();
- values.Add(new KeyValuePair<string, string>("u", userName));
- values.Add(new KeyValuePair<string, string>("t", userToken));
- values.Add(new KeyValuePair<string, string>("a", "3")); // activity type (3=playing)
- values.Add(new KeyValuePair<string, string>("m", "30")); // game ID ( 1 = Sonic (Mega Drive), 30 = Jet Force Gemini (N64) )
-
- response = client.PostAsync(BaseURL + ActivityPage, new FormUrlEncodedContent(values));
- response.Wait();
- responseString = response.Result.Content.ReadAsStringAsync();
- MessageBox.Show("Post Activity result: " + responseString.Result);
- }
- }
- }
-
-
-}

0 comments on commit d6dd2e3

Please sign in to comment.