Add hack to not leave cards mounted
This commit is contained in:
@@ -234,7 +234,6 @@ void GameState::PlayersFinalized()
|
|||||||
|
|
||||||
MEMCARDMAN->LockCards( true );
|
MEMCARDMAN->LockCards( true );
|
||||||
|
|
||||||
|
|
||||||
// apply saved default modifiers if any
|
// apply saved default modifiers if any
|
||||||
FOREACH_HumanPlayer( pn )
|
FOREACH_HumanPlayer( pn )
|
||||||
{
|
{
|
||||||
@@ -270,6 +269,9 @@ void GameState::PlayersFinalized()
|
|||||||
if( !IsHumanPlayer(pn) )
|
if( !IsHumanPlayer(pn) )
|
||||||
ApplyModifiers( pn, DEFAULT_CPU_MODIFIERS );
|
ApplyModifiers( pn, DEFAULT_CPU_MODIFIERS );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( PREFSMAN->m_bMemoryCardsMountOnlyWhenNecessary )
|
||||||
|
MEMCARDMAN->UnmountAllCards();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This data is added to each player profile, and to the machine profile per-player. */
|
/* This data is added to each player profile, and to the machine profile per-player. */
|
||||||
@@ -342,6 +344,9 @@ void GameState::EndGame()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if( PREFSMAN->m_bMemoryCardsMountOnlyWhenNecessary )
|
||||||
|
MEMCARDMAN->MountAllCards();
|
||||||
|
|
||||||
|
|
||||||
BOOKKEEPER->WriteToDisk();
|
BOOKKEEPER->WriteToDisk();
|
||||||
PROFILEMAN->SaveAllProfiles();
|
PROFILEMAN->SaveAllProfiles();
|
||||||
|
|||||||
@@ -233,6 +233,29 @@ void MemoryCardManager::MountAllCards()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MemoryCardManager::UnmountAllCards()
|
||||||
|
{
|
||||||
|
FOREACH_PlayerNumber( p )
|
||||||
|
{
|
||||||
|
if( m_Device[p].IsBlank() ) // they don't have an assigned card
|
||||||
|
continue;
|
||||||
|
|
||||||
|
m_pDriver->Unmount(&m_Device[p], MEM_CARD_MOUNT_POINT[p]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MemoryCardManager::MountCard( PlayerNumber pn )
|
||||||
|
{
|
||||||
|
ASSERT( !m_Device[pn].IsBlank() );
|
||||||
|
m_pDriver->MountAndTestWrite(&m_Device[pn], MEM_CARD_MOUNT_POINT[pn]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MemoryCardManager::UnmountCard( PlayerNumber pn )
|
||||||
|
{
|
||||||
|
ASSERT( !m_Device[pn].IsBlank() );
|
||||||
|
m_pDriver->Unmount(&m_Device[pn], MEM_CARD_MOUNT_POINT[pn]);
|
||||||
|
}
|
||||||
|
|
||||||
void MemoryCardManager::FlushAndReset()
|
void MemoryCardManager::FlushAndReset()
|
||||||
{
|
{
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ public:
|
|||||||
|
|
||||||
void LockCards( bool bLock ); // prevent removing or changing of memory cards
|
void LockCards( bool bLock ); // prevent removing or changing of memory cards
|
||||||
void MountAllCards();
|
void MountAllCards();
|
||||||
|
void UnmountAllCards();
|
||||||
|
void MountCard( PlayerNumber pn );
|
||||||
|
void UnmountCard( PlayerNumber pn );
|
||||||
|
|
||||||
void PauseMountingThread(); // call this before reading or writing to memory card
|
void PauseMountingThread(); // call this before reading or writing to memory card
|
||||||
void UnPauseMountingThread(); // call this when done reading or writing to memory card
|
void UnPauseMountingThread(); // call this when done reading or writing to memory card
|
||||||
|
|||||||
@@ -311,6 +311,7 @@ void PrefsManager::Init()
|
|||||||
m_iMemoryCardUsbPort[p] = -1;
|
m_iMemoryCardUsbPort[p] = -1;
|
||||||
m_iMemoryCardUsbLevel[p] = -1;
|
m_iMemoryCardUsbLevel[p] = -1;
|
||||||
}
|
}
|
||||||
|
m_bMemoryCardsMountOnlyWhenNecessary = false;
|
||||||
|
|
||||||
m_sMemoryCardProfileSubdir = PRODUCT_NAME;
|
m_sMemoryCardProfileSubdir = PRODUCT_NAME;
|
||||||
m_iProductID = 1;
|
m_iProductID = 1;
|
||||||
@@ -547,6 +548,7 @@ void PrefsManager::ReadPrefsFromFile( CString sIni )
|
|||||||
ini.GetValue( "Options", ssprintf("MemoryCardUsbPortP%d",p+1), m_iMemoryCardUsbPort[p] );
|
ini.GetValue( "Options", ssprintf("MemoryCardUsbPortP%d",p+1), m_iMemoryCardUsbPort[p] );
|
||||||
ini.GetValue( "Options", ssprintf("MemoryCardUsbLevelP%d",p+1), m_iMemoryCardUsbLevel[p] );
|
ini.GetValue( "Options", ssprintf("MemoryCardUsbLevelP%d",p+1), m_iMemoryCardUsbLevel[p] );
|
||||||
}
|
}
|
||||||
|
ini.GetValue( "Options", "MemoryCardsMountOnlyWhenNecessary", m_bMemoryCardsMountOnlyWhenNecessary );
|
||||||
|
|
||||||
ini.GetValue( "Options", "CenterImageTranslateX", m_iCenterImageTranslateX );
|
ini.GetValue( "Options", "CenterImageTranslateX", m_iCenterImageTranslateX );
|
||||||
ini.GetValue( "Options", "CenterImageTranslateY", m_iCenterImageTranslateY );
|
ini.GetValue( "Options", "CenterImageTranslateY", m_iCenterImageTranslateY );
|
||||||
@@ -777,6 +779,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() const
|
|||||||
ini.SetValue( "Options", ssprintf("MemoryCardUsbPortP%d",p+1), m_iMemoryCardUsbPort[p] );
|
ini.SetValue( "Options", ssprintf("MemoryCardUsbPortP%d",p+1), m_iMemoryCardUsbPort[p] );
|
||||||
ini.SetValue( "Options", ssprintf("MemoryCardUsbLevelP%d",p+1), m_iMemoryCardUsbLevel[p] );
|
ini.SetValue( "Options", ssprintf("MemoryCardUsbLevelP%d",p+1), m_iMemoryCardUsbLevel[p] );
|
||||||
}
|
}
|
||||||
|
ini.SetValue( "Options", "MemoryCardsMountOnlyWhenNecessary", m_bMemoryCardsMountOnlyWhenNecessary );
|
||||||
|
|
||||||
ini.SetValue( "Options", "CenterImageTranslateX", m_iCenterImageTranslateX );
|
ini.SetValue( "Options", "CenterImageTranslateX", m_iCenterImageTranslateX );
|
||||||
ini.SetValue( "Options", "CenterImageTranslateY", m_iCenterImageTranslateY );
|
ini.SetValue( "Options", "CenterImageTranslateY", m_iCenterImageTranslateY );
|
||||||
|
|||||||
@@ -189,6 +189,7 @@ public:
|
|||||||
int m_iMemoryCardUsbBus[NUM_PLAYERS]; // look for this bus when assigning cards. -1 = match any
|
int m_iMemoryCardUsbBus[NUM_PLAYERS]; // look for this bus when assigning cards. -1 = match any
|
||||||
int m_iMemoryCardUsbPort[NUM_PLAYERS]; // look for this port when assigning cards. -1 = match any
|
int m_iMemoryCardUsbPort[NUM_PLAYERS]; // look for this port when assigning cards. -1 = match any
|
||||||
int m_iMemoryCardUsbLevel[NUM_PLAYERS]; // look for this level when assigning cards. -1 = match any
|
int m_iMemoryCardUsbLevel[NUM_PLAYERS]; // look for this level when assigning cards. -1 = match any
|
||||||
|
bool m_bMemoryCardsMountOnlyWhenNecessary;
|
||||||
int m_iCenterImageTranslateX;
|
int m_iCenterImageTranslateX;
|
||||||
int m_iCenterImageTranslateY;
|
int m_iCenterImageTranslateY;
|
||||||
float m_fCenterImageScaleX;
|
float m_fCenterImageScaleX;
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include "StepMania.h"
|
#include "StepMania.h"
|
||||||
#include "CryptManager.h"
|
#include "CryptManager.h"
|
||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
|
#include "MemoryCardManager.h"
|
||||||
|
|
||||||
const int NUM_SCORE_DIGITS = 9;
|
const int NUM_SCORE_DIGITS = 9;
|
||||||
|
|
||||||
@@ -1352,12 +1353,18 @@ void ScreenEvaluation::Input( const DeviceInput& DeviceI, const InputEventType t
|
|||||||
if( !m_bSavedScreenshot[pn] && // only allow one screenshot
|
if( !m_bSavedScreenshot[pn] && // only allow one screenshot
|
||||||
PROFILEMAN->IsUsingProfile(pn) )
|
PROFILEMAN->IsUsingProfile(pn) )
|
||||||
{
|
{
|
||||||
|
if( PREFSMAN->m_bMemoryCardsMountOnlyWhenNecessary )
|
||||||
|
MEMCARDMAN->MountCard( pn );
|
||||||
|
|
||||||
Profile* pProfile = PROFILEMAN->GetProfile(pn);
|
Profile* pProfile = PROFILEMAN->GetProfile(pn);
|
||||||
CString sDir = PROFILEMAN->GetProfileDir((ProfileSlot)pn) + "Screenshots/";
|
CString sDir = PROFILEMAN->GetProfileDir((ProfileSlot)pn) + "Screenshots/";
|
||||||
int iScreenshotIndex = pProfile->GetNextScreenshotIndex();
|
int iScreenshotIndex = pProfile->GetNextScreenshotIndex();
|
||||||
CString sFileName = SaveScreenshot( sDir, true, true, iScreenshotIndex );
|
CString sFileName = SaveScreenshot( sDir, true, true, iScreenshotIndex );
|
||||||
CString sPath = sDir+sFileName;
|
CString sPath = sDir+sFileName;
|
||||||
|
|
||||||
|
if( PREFSMAN->m_bMemoryCardsMountOnlyWhenNecessary )
|
||||||
|
MEMCARDMAN->UnmountCard( pn );
|
||||||
|
|
||||||
if( !sFileName.empty() )
|
if( !sFileName.empty() )
|
||||||
{
|
{
|
||||||
Screenshot screenshot;
|
Screenshot screenshot;
|
||||||
|
|||||||
Reference in New Issue
Block a user