Permalink
Browse files

VBA prepped, uses static MFC, now requires Multibyte MFC extension to…

… build

Other test stuff
  • Loading branch information...
1 parent 1c2ea02 commit 8ac0871e2bbfa9c374fc2f4483ce58cb4eb6c9e1 Scott Davies committed Apr 8, 2015
@@ -20,6 +20,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v120_xp</PlatformToolset>
+ <UseOfMfc>Static</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<PlatformToolset>v120_xp</PlatformToolset>
@@ -68,7 +69,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>../../../DXSDK_March09_x86;../../../RA_Integration;../../src;../../fex;$(ProjectDir)\..\..\dependencies\libpng;$(ProjectDir)\..\..\dependencies\msvc;$(ProjectDir)\..\..\dependencies\SFML\include;$(ProjectDir)\..\..\dependencies\SubWCRev;$(ProjectDir)\..\..\dependencies\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>../../../DXSDK_March09_x86;../../src;../../fex;../../RA_Integration;../../../RA_Integration;$(ProjectDir)\..\..\dependencies\libpng;$(ProjectDir)\..\..\dependencies\msvc;$(ProjectDir)\..\..\dependencies\SFML\include;$(ProjectDir)\..\..\dependencies\SubWCRev;$(ProjectDir)\..\..\dependencies\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;DEV_VERSION;BKPT_SUPPORT;GBA_LOGGING;MMX;ASM;_CRT_SECURE_NO_WARNINGS;HAS_FILE_EXTRACTOR;NO_OAL;NO_XAUDIO2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
@@ -115,7 +116,7 @@
</Midl>
<ClCompile>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
- <AdditionalIncludeDirectories>../../DXSDK_March09_x86;../../src;../../fex;../../RA_Integration;$(ProjectDir)\..\..\dependencies\libpng;$(ProjectDir)\..\..\dependencies\msvc;$(ProjectDir)\..\..\dependencies\SFML\include;$(ProjectDir)\..\..\dependencies\SubWCRev;$(ProjectDir)\..\..\dependencies\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>../../DXSDK_March09_x86;../../src;../../fex;../../RA_Integration;../../../RA_Integration;$(ProjectDir)\..\..\dependencies\libpng;$(ProjectDir)\..\..\dependencies\msvc;$(ProjectDir)\..\..\dependencies\SFML\include;$(ProjectDir)\..\..\dependencies\SubWCRev;$(ProjectDir)\..\..\dependencies\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;GBA_LOGGING;OEMRESOURCE;MMX;ASM;FINAL_VERSION;BKPT_SUPPORT;_CRT_SECURE_NO_DEPRECATE;HAS_FILE_EXTRACTOR;NO_OAL;NO_XAUDIO2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
@@ -1,6 +1,3 @@
-
-#define CLIENT_VERSION RAVBA_VERSION
-
// Return whether a game has been loaded. Should return FALSE if
// no ROM is loaded, or a ROM has been unloaded.
extern bool GameIsActive();
@@ -46,6 +46,7 @@
// ##RA
#include "RA_Implementation.h"
#include "RA_Interface.h"
+#include "BuildVer.h"
extern void Pixelate(u8*,u32,u8*,u8*,u32,int,int);
extern void Pixelate32(u8*,u32,u8*,u8*,u32,int,int);
@@ -526,7 +527,7 @@ BOOL VBA::InitInstance()
// ##RA
HINSTANCE hInst = AfxGetInstanceHandle();
- RA_Init( ( (MainWnd*)m_pMainWnd )->GetSafeHwnd(), RA_VisualboyAdvance, CLIENT_VERSION );
+ RA_Init( ( (MainWnd*)m_pMainWnd )->GetSafeHwnd(), RA_VisualboyAdvance, RAVBA_VERSION );
RA_InitShared();
RA_RebuildMenu();
RA_AttemptLogin( true );
@@ -190,9 +190,9 @@ BOOL AchievementOverlay::GoBack()
BOOL AchievementOverlay::Update( ControllerInput* pInput, float fDelta, BOOL bFullScreen, BOOL bPaused )
{
const int nAchCount = (const int)( g_pActiveAchievements->NumAchievements() );
- const int nNumFriends = (const int)( RAUsers::LocalUser.NumFriends() );
+ const int nNumFriends = (const int)( RAUsers::LocalUser().NumFriends() );
const int nNumLBs = (const int)( g_LeaderboardManager.Count() );
- //const int nMsgCount = (const int)( RAUsers::LocalUser.MessageCount() );
+ //const int nMsgCount = (const int)( RAUsers::LocalUser().MessageCount() );
const int nMsgCount = 0;
int* pnScrollOffset = const_cast<int*>( GetActiveScrollOffset() ); // Dirty!
int* pnSelectedItem = const_cast<int*>( GetActiveSelectedItem() );
@@ -386,7 +386,7 @@ BOOL AchievementOverlay::Update( ControllerInput* pInput, float fDelta, BOOL bFu
break;
case OP_MESSAGE_VIEWER:
{
- //RAMessage Msg = RAUsers::LocalUser.GetMessage( m_nMessagesSelectedItem );
+ //RAMessage Msg = RAUsers::LocalUser().GetMessage( m_nMessagesSelectedItem );
break;
}
@@ -669,7 +669,7 @@ void AchievementOverlay::DrawFriendsPage( HDC hDC, int nDX, int nDY, const RECT&
unsigned int nOffset = m_nFriendsScrollOffset;
- const unsigned int nNumFriends = RAUsers::LocalUser.NumFriends();
+ const unsigned int nNumFriends = RAUsers::LocalUser().NumFriends();
for( unsigned int i = 0; i < nFriendsToDraw; ++i )
{
@@ -681,7 +681,7 @@ void AchievementOverlay::DrawFriendsPage( HDC hDC, int nDX, int nDY, const RECT&
if( (i+nOffset) < nNumFriends )
{
- RAUser* pFriend = RAUsers::LocalUser.GetFriendByIter( (i+nOffset) );
+ RAUser* pFriend = RAUsers::LocalUser().GetFriendByIter( (i+nOffset) );
if( pFriend == NULL )
continue;
@@ -1143,7 +1143,7 @@ void AchievementOverlay::DrawLeaderboardExaminePage( HDC hDC, int nDX, int nDY,
void AchievementOverlay::Render( HDC hDC, RECT* rcDest ) const
{
// Rendering:
- if( !RAUsers::LocalUser.IsLoggedIn() )
+ if( !RAUsers::LocalUser().IsLoggedIn() )
return; // Not available!
const COLORREF nPrevTextColor = GetTextColor( hDC );
@@ -1220,7 +1220,7 @@ void AchievementOverlay::Render( HDC hDC, RECT* rcDest ) const
if( rcTarget.right > 360 )
{
DrawUserFrame(
- hDC, &RAUsers::LocalUser,
+ hDC, &RAUsers::LocalUser(),
( nDX+(rcTarget.right - nMinUserFrameWidth) )-4,
4+nBorder,
nMinUserFrameWidth,
@@ -1676,8 +1676,8 @@ void AchievementExamine::Initialize( const Achievement* pAch )
m_LastModifiedDate = _TimeStampToString( pAch->ModifiedDate() );
PostArgs args;
- args[ 'u' ] = RAUsers::LocalUser.Username();
- args[ 't' ] = RAUsers::LocalUser.Token();
+ args[ 'u' ] = RAUsers::LocalUser().Username();
+ args[ 't' ] = RAUsers::LocalUser().Token();
args[ 'a' ] = std::to_string( m_pSelectedAchievement->ID() );
args[ 'f' ] = true; // Friends only?
RAWeb::CreateThreadedHTTPRequest( RequestAchievementInfo, args );
@@ -39,30 +39,28 @@ AchievementPopup::AchievementPopup() :
void AchievementPopup::PlayAudio()
{
- if( MessagesPresent() )
- PlaySound( MSG_SOUND[ ActiveMessage().Type() ], NULL, SND_FILENAME|SND_ASYNC );
+ PlaySound( MSG_SOUND[ ActiveMessage().Type() ], NULL, SND_FILENAME|SND_ASYNC );
}
void AchievementPopup::AddMessage( const MessagePopup& msg )
{
+ PlayAudio();
m_vMessages.push( msg );
}
void AchievementPopup::Update( ControllerInput input, float fDelta, bool bFullScreen, bool bPaused )
{
if( bPaused )
fDelta = 0.0f;
-
fDelta = RAClamp<float>( fDelta, 0.0f, 0.3f ); // Limit this!
-
if( m_vMessages.size() > 0 )
- m_fTimer += fDelta;
-
- if( ( m_vMessages.size() > 0 ) && ( m_fTimer >= FINISH_AT ) )
{
- m_vMessages.pop();
- PlayAudio();
- m_fTimer = 0.0f;
+ m_fTimer += fDelta;
+ if( m_fTimer >= FINISH_AT )
+ {
+ m_vMessages.pop();
+ m_fTimer = 0.0f;
+ }
}
}
@@ -174,6 +172,6 @@ void AchievementPopup::Render( HDC hDC, RECT& rcDest )
void AchievementPopup::Clear()
{
- while( m_vMessages.size() > 0 )
+ while( !m_vMessages.empty() )
m_vMessages.pop();
}
@@ -1,11 +1,9 @@
#pragma once
-#include <WTypes.h>
-#include "RA_AchievementOverlay.h"
-#include <queue>
+#include "RA_Defs.h"
+#include "RA_Interface.h"
// Graphic to display an obtained achievement
-
enum PopupMessageType
{
PopupLogin,
@@ -9,6 +9,8 @@
#include "RA_RichPresence.h"
#include "RA_md5factory.h"
+#include <io.h> // _access()
+
AchievementSet* CoreAchievements = nullptr;
AchievementSet* UnofficialAchievements = nullptr;
AchievementSet* LocalAchievements = nullptr;
@@ -56,6 +58,7 @@ BOOL AchievementSet::DeletePatchFile( AchievementSetType nSet, GameID nGameID )
// Remove the text file
SetCurrentDirectory( g_sHomeDir.c_str() );
+
if( _access( sFilename.c_str(), 06 ) != -1 ) // 06= Read/write permission
{
if( remove( sFilename.c_str() ) == -1 )
@@ -198,7 +201,7 @@ void AchievementSet::Test()
if( nOffset < NumAchievements() )
g_AchievementsDialog.ReloadLBXData( nOffset );
- if( RAUsers::LocalUser.IsLoggedIn() )
+ if( RAUsers::LocalUser().IsLoggedIn() )
{
const std::string sPoints = std::to_string( ach.Points() );
@@ -237,11 +240,11 @@ void AchievementSet::Test()
else
{
char sValidation[50];
- g_fnDoValidation( sValidation, RAUsers::LocalUser.Username().c_str(), RAUsers::LocalUser.Token().c_str(), ach.ID() );
+ g_fnDoValidation( sValidation, RAUsers::LocalUser().Username().c_str(), RAUsers::LocalUser().Token().c_str(), ach.ID() );
PostArgs args;
- args['u'] = RAUsers::LocalUser.Username();
- args['t'] = RAUsers::LocalUser.Token();
+ args['u'] = RAUsers::LocalUser().Username();
+ args['t'] = RAUsers::LocalUser().Token();
args['a'] = std::to_string( ach.ID() );
args['v'] = sValidation;
args['h'] = std::to_string( static_cast<int>( g_bHardcoreModeActive ) );
@@ -330,8 +333,8 @@ BOOL AchievementSet::FetchFromWebBlocking( GameID nGameID )
{
// Can't open file: attempt to find it on SQL server!
PostArgs args;
- args['u'] = RAUsers::LocalUser.Username();
- args['t'] = RAUsers::LocalUser.Token();
+ args['u'] = RAUsers::LocalUser().Username();
+ args['t'] = RAUsers::LocalUser().Token();
args['g'] = std::to_string( nGameID );
args['h'] = g_bHardcoreModeActive ? "1" : "0";
//args['f'] = std::to_string( GetFlagsFromType( m_nSetType ) );
@@ -506,12 +509,12 @@ BOOL AchievementSet::LoadFromFile( GameID nGameID )
for( size_t i = 0; i < CoreAchievements->NumAchievements(); ++i )
nTotalPoints += CoreAchievements->GetAchievement( i ).Points();
- if( RAUsers::LocalUser.IsLoggedIn() )
+ if( RAUsers::LocalUser().IsLoggedIn() )
{
// Loaded OK: post a request for unlocks
PostArgs args;
- args['u'] = RAUsers::LocalUser.Username();
- args['t'] = RAUsers::LocalUser.Token();
+ args['u'] = RAUsers::LocalUser().Username();
+ args['t'] = RAUsers::LocalUser().Token();
args['g'] = std::to_string( nGameID );
args['h'] = g_bHardcoreModeActive ? "1" : "0";
@@ -535,7 +538,7 @@ BOOL AchievementSet::LoadFromFile( GameID nGameID )
void AchievementSet::SaveProgress( const char* sSaveStateFilename )
{
- if( !RAUsers::LocalUser.IsLoggedIn() )
+ if( !RAUsers::LocalUser().IsLoggedIn() )
return;
if( sSaveStateFilename == NULL )
@@ -583,7 +586,7 @@ void AchievementSet::SaveProgress( const char* sSaveStateFilename )
// Generate a slightly different key to md5ify:
char sCheevoProgressMangled[4096];
sprintf_s( sCheevoProgressMangled, 4096, "%s%s%s%d",
- RAUsers::LocalUser.Username().c_str(), cheevoProgressString, RAUsers::LocalUser.Username().c_str(), pAch->ID() );
+ RAUsers::LocalUser().Username().c_str(), cheevoProgressString, RAUsers::LocalUser().Username().c_str(), pAch->ID() );
std::string sMD5Progress = RAGenerateMD5( std::string( sCheevoProgressMangled ) );
std::string sMD5Achievement = RAGenerateMD5( pAch->CreateMemString() );
@@ -617,7 +620,7 @@ void AchievementSet::LoadProgress( const char* sLoadStateFilename )
char cheevoMD5TestMangled[4096];
int nMemStringLen = 0;
- if( !RAUsers::LocalUser.IsLoggedIn() )
+ if( !RAUsers::LocalUser().IsLoggedIn() )
return;
if( sLoadStateFilename == NULL )
@@ -673,7 +676,7 @@ void AchievementSet::LoadProgress( const char* sLoadStateFilename )
// Regenerate the md5 and see if it sticks:
sprintf_s( cheevoMD5TestMangled, 4096, "%s%s%s%d",
- RAUsers::LocalUser.Username().c_str(), cheevoProgressString, RAUsers::LocalUser.Username().c_str(), nID );
+ RAUsers::LocalUser().Username().c_str(), cheevoProgressString, RAUsers::LocalUser().Username().c_str(), nID );
std::string sRecalculatedProgressMD5 = RAGenerateMD5( cheevoMD5TestMangled );
@@ -89,11 +89,11 @@ void CodeNotes::Add( const ByteAddress& nAddr, const std::string& sAuthor, const
else
m_CodeNotes.at( nAddr ).SetNote( sNote );
- if( RAUsers::LocalUser.IsLoggedIn() )
+ if( RAUsers::LocalUser().IsLoggedIn() )
{
PostArgs args;
- args['u'] = RAUsers::LocalUser.Username();
- args['t'] = RAUsers::LocalUser.Token();
+ args['u'] = RAUsers::LocalUser().Username();
+ args['t'] = RAUsers::LocalUser().Token();
args['g'] = std::to_string( g_pActiveAchievements->GetGameID() );
args['m'] = std::to_string( nAddr );
args['n'] = sNote;
@@ -121,11 +121,11 @@ BOOL CodeNotes::Remove( const ByteAddress& nAddr )
m_CodeNotes.erase( nAddr );
- if( RAUsers::LocalUser.IsLoggedIn() )
+ if( RAUsers::LocalUser().IsLoggedIn() )
{
PostArgs args;
- args['u'] = RAUsers::LocalUser.Username();
- args['t'] = RAUsers::LocalUser.Token();
+ args['u'] = RAUsers::LocalUser().Username();
+ args['t'] = RAUsers::LocalUser().Token();
args['g'] = std::to_string( g_pActiveAchievements->GetGameID() );
args['m'] = std::to_string( nAddr );
args['n'] = "";
Oops, something went wrong.

0 comments on commit 8ac0871

Please sign in to comment.