better memory card assignment logic, add memory card icons, more memory card sounds

This commit is contained in:
Chris Danford
2003-12-19 04:52:07 +00:00
parent 9643bb5c92
commit d0a6176e13
23 changed files with 288 additions and 131 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

+68 -5
View File
@@ -58,6 +58,7 @@ Choice8=screen,ScreenTest
Name8=SANDBOX
TimerSeconds=-1 // none
StyleIcon=0
MemoryCardIcons=0
LogoHomeOnCommand=x,320;y,240;zoomy,0;sleep,0.5;bounceend,0.5;zoomy,1;glowshift;effectperiod,2.5;effectcolor1,1,1,1,0.1;effectcolor2,1,1,1,0.3
LogoOnCommand=x,320;y,240;zoomy,0;sleep,0.5;bounceend,0.5;zoomy,1;glowshift;effectperiod,2.5;effectcolor1,1,1,1,0.1;effectcolor2,1,1,1,0.3
VersionOnCommand=horizalign,right;x,620;y,20;diffuse,0.6,0.6,0.6,1;zoom,0.5;shadowlength,2
@@ -92,6 +93,7 @@ JoinMessageP2X=520
JoinMessageP2Y=336
TimerSeconds=40
StyleIcon=1
MemoryCardIcons=1
NextScreen=ScreenSelectGroup
SilentWait=1
BounceJoinMessage=1
@@ -107,6 +109,7 @@ Choice4=Style,double;name,double
Choice5=Style,solo;name,solo
TimerSeconds=40
StyleIcon=1
MemoryCardIcons=1
NextScreen1=ScreenSelectDifficulty
NextScreen2=ScreenSelectDifficulty
NextScreen3=ScreenSelectDifficulty
@@ -175,6 +178,7 @@ PictureOffCommand=linear,0.5;diffusealpha,0;glow,1,1,1,0
[ScreenSelectStyle5th]
TimerSeconds=40
StyleIcon=1
MemoryCardIcons=1
NextScreen=ScreenSelectDifficulty
PadX1=70
PadY1=300
@@ -226,6 +230,7 @@ GuideX=320
GuideY=374
TimerSeconds=30
StyleIcon=1
MemoryCardIcons=1
NextScreen=ScreenSelectGroup
ScrollingListX=320
ScrollingListY=250
@@ -250,6 +255,7 @@ CharacterIconP2OffCommand=linear,0.3;diffusealpha,0;sleep,10
[ScreenStyleSplash]
NextScreen=ScreenSelectGroup
StyleIcon=0
MemoryCardIcons=0
TimerSeconds=0
[ScreenSelectDifficulty]
@@ -265,6 +271,7 @@ Choice8=PlayMode,rave;name,rave
NumChoicesOnPage1=4
TimerSeconds=40
StyleIcon=1
MemoryCardIcons=1
NextScreen1=ScreenSelectGroup
NextScreen2=ScreenSelectGroup
NextScreen3=ScreenSelectGroup
@@ -484,6 +491,7 @@ SleepAfterChoiceSeconds=0.3
SleepAfterTweenOffSeconds=0.8
TimerSeconds=60
StyleIcon=1
MemoryCardIcons=1
[ScreenSelectGroup]
FrameX=180
@@ -519,6 +527,7 @@ MusicListOffCommand=
SleepAfterTweenOffSeconds=0.8
TimerSeconds=40
StyleIcon=1
MemoryCardIcons=1
NextScreen=ScreenInstructions
[GroupList]
@@ -554,6 +563,7 @@ NextScreenBattle=ScreenSelectCharacter
NextScreenRave=ScreenSelectCharacter
TimerSeconds=15
StyleIcon=1
MemoryCardIcons=1
[ScreenSelectMusic]
DefaultSort=GROUP
@@ -717,6 +727,7 @@ CourseContentsShowCommand=
CourseContentsHideCommand=
TimerSeconds=60
StyleIcon=1
MemoryCardIcons=1
SampleMusicDelay=0.25
PrevScreenArcade=ScreenTitleMenu
PrevScreenNonstop=ScreenTitleMenu
@@ -808,6 +819,7 @@ NextOptionsScreenBattle=ScreenPlayerOptions
NextOptionsScreenRave=ScreenRaveOptions
TimerSeconds=60
StyleIcon=0
MemoryCardIcons=0
[ScreenSelectCourse]
ExplanationX=132
@@ -833,6 +845,7 @@ ScoreP2Y=286
ScoreZoom=0.8
TimerSeconds=60
StyleIcon=1
MemoryCardIcons=1
[ScreenStage]
NextScreen=ScreenGameplay
@@ -1474,6 +1487,7 @@ ShowComboArea=0
ShowFullCombo=0
TimerSeconds=15
StyleIcon=1
MemoryCardIcons=1
FailedSoundTime=0
PassedSoundTime=0
NumSequenceSounds=0
@@ -1509,6 +1523,7 @@ ShowComboArea=0
ShowFullCombo=0
TimerSeconds=30
StyleIcon=1
MemoryCardIcons=1
[ScreenEvaluationNonstop]
NextScreen=ScreenNameEntry
@@ -1541,6 +1556,7 @@ ShowComboArea=0
ShowFullCombo=0
TimerSeconds=30
StyleIcon=1
MemoryCardIcons=1
[ScreenEvaluationOni]
NextScreen=ScreenNameEntry
@@ -1573,6 +1589,7 @@ ShowComboArea=0
ShowFullCombo=0
TimerSeconds=30
StyleIcon=1
MemoryCardIcons=1
[ScreenEvaluationEndless]
NextScreen=ScreenNameEntry
@@ -1605,6 +1622,7 @@ ShowComboArea=0
ShowFullCombo=0
TimerSeconds=30
StyleIcon=1
MemoryCardIcons=1
[ScreenEvaluationBattle]
@@ -1638,6 +1656,7 @@ ShowComboArea=0
ShowFullCombo=0
TimerSeconds=15
StyleIcon=1
MemoryCardIcons=1
FailedSoundTime=0
PassedSoundTime=0
NumSequenceSounds=0
@@ -1673,6 +1692,7 @@ ShowComboArea=0
ShowFullCombo=0
TimerSeconds=15
StyleIcon=1
MemoryCardIcons=1
FailedSoundTime=0
PassedSoundTime=0
NumSequenceSounds=0
@@ -1687,18 +1707,21 @@ NextScreen=ScreenRanking
ExplanationX=320
ExplanationY=410
StyleIcon=0
MemoryCardIcons=0
TimerSeconds=0
[ScreenJukeboxMenu]
ExplanationX=320
ExplanationY=410
StyleIcon=0
MemoryCardIcons=0
TimerSeconds=0
[ScreenEditCoursesMenu]
ExplanationX=320
ExplanationY=410
StyleIcon=0
MemoryCardIcons=0
TimerSeconds=0
[ScreenSystemLayer]
@@ -1813,15 +1836,33 @@ StopMusicOnNext=0
KeepAliveType=0 // 0 for MAX, 1 for 5th
[MenuElements]
HeaderOnCommand=x,320;y,22;addx,640;spring,0.5;addx,-640
HeaderX=320
HeaderY=22
HeaderOnCommand=addx,640;spring,0.5;addx,-640
HeaderOffCommand=bouncebegin,0.5;addx,640;
FooterOnCommand=x,320;y,464
FooterX=320
FooterY=464
FooterOnCommand=
FooterOffCommand=
HelpOnCommand=x,320;y,456;zoom,0.5;zoomy,0;linear,0.5;zoomy,0.5
HelpX=320
HelpY=456
HelpOnCommand=zoom,0.5;zoomy,0;linear,0.5;zoomy,0.5
HelpOffCommand=linear,0.5;zoomy,0
StyleIconOnCommand=x,440;y,26;addx,640;spring,0.5;addx,-640
StyleIconX=440
StyleIconY=26
StyleIconOnCommand=addx,640;spring,0.5;addx,-640
StyleIconOffCommand=bouncebegin,0.5;addx,640;
TimerOnCommand=x,590;y,22;addx,640;spring,0.5;addx,-640
MemoryCardDisplayP1X=460
MemoryCardDisplayP1Y=20
MemoryCardDisplayP1OnCommand=addx,640;spring,0.5;addx,-640
MemoryCardDisplayP1OffCommand=bouncebegin,0.5;addx,640;
MemoryCardDisplayP2X=480
MemoryCardDisplayP2Y=20
MemoryCardDisplayP2OnCommand=addx,640;spring,0.5;addx,-640
MemoryCardDisplayP2OffCommand=bouncebegin,0.5;addx,640;
TimerX=590
TimerY=22
TimerOnCommand=addx,640;spring,0.5;addx,-640
TimerOffCommand=bouncebegin,0.5;addx,640;
[MenuTimer]
@@ -1877,18 +1918,22 @@ OddLineIn=addx,640;decelerate,0.5;addx,-640;
EvenLineOut=stoptweening;accelerate,0.3;addx,-640;
OddLineOut=stoptweening;accelerate,0.3;addx,640;
StyleIcon=0
MemoryCardIcons=0
TimerSeconds=0
[ScreenCenterImage]
StyleIcon=0
MemoryCardIcons=0
TimerSeconds=0
[ScreenTestInput]
StyleIcon=0
MemoryCardIcons=0
TimerSeconds=0
[ScreenBookkeeping]
StyleIcon=0
MemoryCardIcons=0
TimerSeconds=0
[HoldGhostArrow]
@@ -2200,9 +2245,11 @@ AttackDurationSeconds=10
[ScreenSelectMaster]
TimerSeconds=20
StyleIcon=1
MemoryCardIcons=1
[ScreenInputOptions]
StyleIcon=0
MemoryCardIcons=0
TimerSeconds=0
PrevScreen=ScreenOptionsMenu@ScreenOptionsMaster
NextScreen=ScreenOptionsMenu@ScreenOptionsMaster
@@ -2217,6 +2264,7 @@ Line6=conf,WheelSpeed
[ScreenCoinOptions]
StyleIcon=0
MemoryCardIcons=0
TimerSeconds=0
PrevScreen=ScreenOptionsMenu@ScreenOptionsMaster
NextScreen=ScreenOptionsMenu@ScreenOptionsMaster
@@ -2229,6 +2277,7 @@ Line4=conf,Premium
[ScreenMachineOptions]
StyleIcon=0
MemoryCardIcons=0
TimerSeconds=0
PrevScreen=ScreenOptionsMenu@ScreenOptionsMaster
NextScreen=ScreenOptionsMenu@ScreenOptionsMaster
@@ -2247,6 +2296,7 @@ Line10=conf,ShowNameEntry
[ScreenGraphicOptions]
StyleIcon=0
MemoryCardIcons=0
TimerSeconds=0
PrevScreen=ScreenOptionsMenu@ScreenOptionsMaster
NextScreen=ScreenOptionsMenu@ScreenOptionsMaster
@@ -2267,6 +2317,7 @@ Line12=conf,ShowBanners
[ScreenGameplayOptions]
StyleIcon=0
MemoryCardIcons=0
TimerSeconds=0
PrevScreen=ScreenOptionsMenu@ScreenOptionsMaster
NextScreen=ScreenOptionsMenu@ScreenOptionsMaster
@@ -2282,6 +2333,7 @@ Line7=conf,UnlockSystem
[ScreenBackgroundOptions]
StyleIcon=0
MemoryCardIcons=0
TimerSeconds=0
PrevScreen=ScreenOptionsMenu@ScreenOptionsMaster
NextScreen=ScreenOptionsMenu@ScreenOptionsMaster
@@ -2296,6 +2348,7 @@ Line6=conf,RandomBackgrounds
[ScreenAppearanceOptions]
StyleIcon=0
MemoryCardIcons=0
TimerSeconds=0
@@ -2320,6 +2373,7 @@ Line14=conf,Lyrics
[ScreenAutogenOptions]
StyleIcon=0
MemoryCardIcons=0
TimerSeconds=0
PrevScreen=ScreenOptionsMenu@ScreenOptionsMaster
NextScreen=ScreenOptionsMenu@ScreenOptionsMaster
@@ -2337,6 +2391,7 @@ Rename=
CardDirPlayer1=
CardDirPlayer2=
StyleIcon=0
MemoryCardIcons=0
TimerSeconds=0
[ScreenUnlock]
@@ -2599,6 +2654,7 @@ TextColor5=1.0,1,1.0,1
[ScreenSoundOptions]
StyleIcon=0
MemoryCardIcons=0
TimerSeconds=0
PrevScreen=ScreenOptionsMenu@ScreenOptionsMaster
@@ -2667,6 +2723,7 @@ FakeBeatsPerSec=2.5
TimerSeconds=24
MaxRankingNameLength=4
StyleIcon=1
MemoryCardIcons=1
[EditMenu]
Arrows1X=190
@@ -2747,6 +2804,7 @@ Row8Y=360
[ScreenOptionsMenu]
StyleIcon=0
MemoryCardIcons=1
TimerSeconds=0
# "Rows" sets the number of rows; this field is required.
@@ -2836,6 +2894,7 @@ TipY=0
[ScreenSelectGame]
StyleIcon=0
MemoryCardIcons=0
TimerSeconds=0
PrevScreen=ScreenTitleMenu
NextScreen=ScreenTitleMenu
@@ -2859,6 +2918,7 @@ NextScreenBattle=ScreenSongOptions
NextScreenRave=ScreenSongOptions
TimerSeconds=30
StyleIcon=0
MemoryCardIcons=0
PrevScreen=
NextScreen=
@@ -2886,6 +2946,7 @@ PrevScreen=ScreenSelectMusic
NextScreen=ScreenStage
TimerSeconds=30
StyleIcon=0
MemoryCardIcons=0
OptionMenuFlags=rows,5
@@ -2911,6 +2972,7 @@ NextScreenRave=ScreenStage
Game=Change the current game type with this option.
TimerSeconds=30
StyleIcon=0
MemoryCardIcons=0
PrevScreen=ScreenOptionsMenu@ScreenOptionsMaster
NextScreen=ScreenOptionsMenu@ScreenOptionsMaster
@@ -2992,6 +3054,7 @@ IconsP2OffCommand=sleep,0.2;bouncebegin,0.5;addx,400
SleepAfterTweenOffSeconds=0.8
TimerSeconds=40
StyleIcon=1
MemoryCardIcons=1
PrevScreenArcade=ScreenTitleMenu
PrevScreenNonstop=ScreenTitleMenu
PrevScreenOni=ScreenTitleMenu
+13
View File
@@ -164,3 +164,16 @@ CString TapNoteScoreToString( TapNoteScore tns )
default: ASSERT(0); return ""; // invalid Difficulty
}
}
CString MemoryCardStateToString( MemoryCardState mcs )
{
switch( mcs )
{
case MEMORY_CARD_STATE_READY: return "ready";
case MEMORY_CARD_STATE_TOO_LATE: return "late";
case MEMORY_CARD_STATE_WRITE_ERROR: return "error";
case MEMORY_CARD_STATE_NO_CARD: return "none";
default: ASSERT(0); return "";
}
}
+12
View File
@@ -195,6 +195,18 @@ enum MemoryCard
NUM_MEMORY_CARDS
};
enum MemoryCardState
{
MEMORY_CARD_STATE_READY,
MEMORY_CARD_STATE_TOO_LATE,
MEMORY_CARD_STATE_WRITE_ERROR,
MEMORY_CARD_STATE_NO_CARD,
NUM_MEMORY_CARD_STATES,
MEMORY_CARD_STATE_INVALID,
};
CString MemoryCardStateToString( MemoryCardState mcs );
//
// Ranking stuff
+2
View File
@@ -35,6 +35,7 @@
#include "RageFile.h"
#include "Bookkeeper.h"
#include <time.h>
#include "MemoryCardManager.h"
#define DEFAULT_MODIFIERS THEME->GetMetric( "Common","DefaultModifiers" )
@@ -148,6 +149,7 @@ void GameState::Reset()
PROFILEMAN->SaveProfile( (PlayerNumber)p );
PROFILEMAN->UnloadProfile( (PlayerNumber)p );
}
MEMCARDMAN->LockCards( false );
LIGHTSMAN->SetLightMode( LIGHTMODE_ATTRACT );
+1 -1
View File
@@ -152,7 +152,7 @@ CourseEntryDisplay.cpp CourseEntryDisplay.h DifficultyDisplay.cpp DifficultyDisp
DifficultyMeter.cpp DifficultyMeter.h DifficultyRating.cpp DifficultyRating.h EditCoursesMenu.cpp EditCoursesMenu.h \
EditMenu.cpp EditMenu.h FadingBanner.cpp FadingBanner.h GradeDisplay.cpp GradeDisplay.h GraphDisplay.cpp GraphDisplay.h \
GrooveGraph.cpp GrooveGraph.h GrooveRadar.cpp GrooveRadar.h GroupList.cpp GroupList.h HelpDisplay.cpp HelpDisplay.h \
JukeboxMenu.cpp JukeboxMenu.h MenuElements.cpp MenuElements.h MenuTimer.cpp MenuTimer.h ModeSwitcher.cpp ModeSwitcher.h \
JukeboxMenu.cpp JukeboxMenu.h MemoryCardDisplay.cpp MemoryCardDisplay.h MenuElements.cpp MenuElements.h MenuTimer.cpp MenuTimer.h ModeSwitcher.cpp ModeSwitcher.h \
MusicBannerWheel.cpp MusicBannerWheel.h MusicList.cpp MusicList.h MusicSortDisplay.cpp MusicSortDisplay.h \
MusicWheel.cpp MusicWheel.h MusicWheelItem.cpp MusicWheelItem.h OptionIcon.cpp OptionIcon.h OptionIconRow.cpp OptionIconRow.h \
OptionsCursor.cpp OptionsCursor.h PaneDisplay.cpp PaneDisplay.h ScrollBar.cpp ScrollBar.h ScrollingList.cpp ScrollingList.h \
+88 -82
View File
@@ -28,14 +28,17 @@ MemoryCardManager::MemoryCardManager()
m_bCardsLocked = false;
for( int p=0; p<NUM_PLAYERS; p++ )
{
m_bTooLate[NUM_PLAYERS] = false;
m_bWriteError[NUM_PLAYERS] = false;
m_bTooLate[p] = false;
m_bWriteError[p] = false;
}
m_pDriver->GetStorageDevices( m_vStorageDevices );
ReassignCards();
m_soundConnect.Load( THEME->GetPathToS("MemoryCardManager connect") );
m_soundReady.Load( THEME->GetPathToS("MemoryCardManager ready") );
m_soundError.Load( THEME->GetPathToS("MemoryCardManager error") );
m_soundTooLate.Load( THEME->GetPathToS("MemoryCardManager too late") );
m_soundDisconnect.Load( THEME->GetPathToS("MemoryCardManager disconnect") );
AssignUnassignedCards();
}
MemoryCardManager::~MemoryCardManager()
@@ -77,47 +80,33 @@ void MemoryCardManager::Update( float fDelta )
}
}
if( m_bCardsLocked ) // Cards are locked and play has begun.
// unassign cards that were disconnected
for( int p=0; p<NUM_PLAYERS; p++ )
{
// Don't re-assign devices
if( m_Device[p].IsBlank() ) // not assigned a card
continue;
// play disconnect sound if locked card was removed
for( int p=0; p<NUM_PLAYERS; p++ )
if( find(vDisconnects.begin(),vDisconnects.end(),m_Device[p]) != vDisconnects.end() ) // assigned card was disconnected
{
if( !m_Device[p].IsBlank() ) // card is in use
{
if( find(vOld.begin(),vOld.end(),m_Device[p]) != vOld.end() ) // match
{
m_Device[p].MakeBlank();
m_soundDisconnect.Play();
}
}
m_Device[p].MakeBlank();
m_soundDisconnect.Play();
}
}
else // cards aren't locked.
{
// play sound for connects or disconnects
if( !vConnects.empty() )
m_soundConnect.Play();
if( !vDisconnects.empty() )
m_soundDisconnect.Play();
ReassignCards();
}
AssignUnassignedCards();
}
}
MemoryCardManager::CardState MemoryCardManager::GetCardState( PlayerNumber pn )
MemoryCardState MemoryCardManager::GetCardState( PlayerNumber pn )
{
if( m_Device[pn].IsBlank() )
return no_card;
return MEMORY_CARD_STATE_NO_CARD;
else if( m_bTooLate[pn] )
return too_late;
return MEMORY_CARD_STATE_TOO_LATE;
else if( m_bWriteError[pn] )
return write_error;
return MEMORY_CARD_STATE_WRITE_ERROR;
else
return ready;
return MEMORY_CARD_STATE_READY;
}
CString MemoryCardManager::GetOsMountDir( PlayerNumber pn )
@@ -130,74 +119,91 @@ CString MemoryCardManager::GetOsMountDir( PlayerNumber pn )
void MemoryCardManager::LockCards( bool bLock )
{
if( bLock == m_bCardsLocked )
return; // redundant
m_bCardsLocked = bLock;
if( bLock )
if( !bLock )
{
// try mounting
// clear too late flag
for( int p=0; p<NUM_PLAYERS; p++ )
{
if( !m_Device[p].IsBlank() )
m_bWriteError[p] = m_pDriver->MountAndTestWrite( &m_Device[p] );
}
}
else
{
// clear error flags
for( int p=0; p<NUM_PLAYERS; p++ )
{
m_bTooLate[p] = false;
m_bWriteError[p] = false;
}
ReassignCards();
AssignUnassignedCards();
}
}
void MemoryCardManager::ReassignCards()
void MemoryCardManager::AssignUnassignedCards()
{
// Do re-assigning: choose a storage device for each player
vector<UsbStorageDevice> vDevices = m_vStorageDevices; // copy
for( int p=0; p<NUM_PLAYERS; p++ )
// make a list of unassigned
vector<UsbStorageDevice> vUnassignedDevices = m_vStorageDevices; // copy
// remove cards that are already assigned
{
m_Device[p].MakeBlank();
unsigned i;
// search for card dir match
if( !PREFSMAN->m_sMemoryCardDir[p].empty() )
for( int p=0; p<NUM_PLAYERS; p++ )
{
for( i=0; i<vDevices.size(); i++ )
if( m_Device[p].IsBlank() ) // card not assigned to this player
continue;
vector<UsbStorageDevice>::iterator it = find(vUnassignedDevices.begin(),vUnassignedDevices.end(),m_Device[p]);
ASSERT( it != vUnassignedDevices.end() ) // the assigned card better be connected!
vUnassignedDevices.erase( it );
}
}
// try to assign each device to a player
{
for( int p=0; p<NUM_PLAYERS; p++ )
{
if( !m_Device[p].IsBlank() ) // they already have an assigned card
continue; // skip
unsigned i;
// search for card dir match
if( !PREFSMAN->m_sMemoryCardDir[p].empty() )
{
UsbStorageDevice &usd = vDevices[i];
if( usd.sOsMountDir.CompareNoCase(PREFSMAN->m_sMemoryCardDir[p]) == 0 ) // match
goto match;
for( i=0; i<vUnassignedDevices.size(); i++ )
{
UsbStorageDevice &usd = vUnassignedDevices[i];
if( usd.sOsMountDir.CompareNoCase(PREFSMAN->m_sMemoryCardDir[p]) == 0 ) // match
goto match;
}
}
}
// search for USB bus match
for( i=0; i<vDevices.size(); i++ )
{
UsbStorageDevice &usd = vDevices[i];
if( PREFSMAN->m_iMemoryCardUsbBus[p] != -1 &&
PREFSMAN->m_iMemoryCardUsbBus[p] != usd.iBus )
continue; // not a match
// search for USB bus match
for( i=0; i<vUnassignedDevices.size(); i++ )
{
UsbStorageDevice &usd = vUnassignedDevices[i];
if( PREFSMAN->m_iMemoryCardUsbPort[p] != -1 &&
PREFSMAN->m_iMemoryCardUsbPort[p] != usd.iPortOnHub )
continue; // not a match
if( PREFSMAN->m_iMemoryCardUsbBus[p] != -1 &&
PREFSMAN->m_iMemoryCardUsbBus[p] != usd.iBus )
continue; // not a match
goto match;
}
LOG->Trace( "Player %d memory card: none", p+1 );
continue; // no matches
if( PREFSMAN->m_iMemoryCardUsbPort[p] != -1 &&
PREFSMAN->m_iMemoryCardUsbPort[p] != usd.iPortOnHub )
continue; // not a match
goto match;
}
LOG->Trace( "Player %d memory card: none", p+1 );
continue; // no matches
match:
m_Device[p] = vDevices[i]; // save a copy
LOG->Trace( "Player %d memory card: '%s'", p+1, m_Device[p].sOsMountDir.c_str() );
vDevices.erase( vDevices.begin()+i ); // remove the device so we don't match it for another player
m_Device[p] = vUnassignedDevices[i]; // save a copy
LOG->Trace( "Player %d memory card: '%s'", p+1, m_Device[p].sOsMountDir.c_str() );
vUnassignedDevices.erase( vUnassignedDevices.begin()+i ); // remove the device so we don't match it for another player
m_bTooLate[p] = m_bCardsLocked;
m_bWriteError[p] = false;
if( !m_bCardsLocked )
if( !m_pDriver->MountAndTestWrite(&m_Device[p]) )
m_bWriteError[p] = true;
// play sound
if( m_bWriteError[p] )
m_soundError.Play();
else if( m_bTooLate[p] )
m_soundTooLate.Play();
else
m_soundReady.Play();
}
}
}
+6 -5
View File
@@ -10,6 +10,7 @@
Chris Danford
-----------------------------------------------------------------------------
*/
#include "GameConstantsAndTypes.h" // for MemoryCardState
#include "PlayerNumber.h"
#include "RageSound.h"
#include "arch/MemoryCard/MemoryCardDriver.h"
@@ -22,16 +23,14 @@ public:
void Update( float fDelta );
enum CardState { ready, too_late, write_error, no_card };
CardState GetCardState( PlayerNumber pn );
MemoryCardState GetCardState( PlayerNumber pn );
CString GetOsMountDir( PlayerNumber pn ); // only valid when ready
void LockCards( bool bLock ); // prevent removing or changing of memory cards
protected:
void ReassignCards(); // do our best to assign a Device to each player
void AssignUnassignedCards(); // do our best to assign a Device to each player
MemoryCardDriver *m_pDriver;
@@ -42,7 +41,9 @@ protected:
bool m_bWriteError[NUM_PLAYERS]; // couldn't write to the card
UsbStorageDevice m_Device[NUM_PLAYERS]; // device in the memory card slot, NULL if none
RageSound m_soundConnect;
RageSound m_soundReady;
RageSound m_soundError;
RageSound m_soundTooLate;
RageSound m_soundDisconnect;
};
+22
View File
@@ -25,6 +25,7 @@
#define TIMER_SECONDS THEME->GetMetricI(m_sName,"TimerSeconds")
#define STYLE_ICON THEME->GetMetricB(m_sName,"StyleIcon")
#define MEMORY_CARD_ICONS THEME->GetMetricB(m_sName,"MemoryCardIcons")
MenuElements::MenuElements()
@@ -52,6 +53,7 @@ void MenuElements::Load( CString sClassName )
m_autoHeader.Load( THEME->GetPathToG(m_sName+" header") );
m_autoHeader->SetName("Header");
UtilSetXY( m_autoHeader, "MenuElements" );
UtilOnCommand( m_autoHeader, "MenuElements" );
this->AddChild( m_autoHeader );
@@ -61,14 +63,28 @@ void MenuElements::Load( CString sClassName )
m_sprStyleIcon.SetName( "StyleIcon" );
m_sprStyleIcon.Load( THEME->GetPathToG(sIconFileName) );
m_sprStyleIcon.StopAnimating();
UtilSetXY( m_sprStyleIcon, "MenuElements" );
UtilOnCommand( m_sprStyleIcon, "MenuElements" );
this->AddChild( &m_sprStyleIcon );
}
if( MEMORY_CARD_ICONS )
{
for( int p=0; p<NUM_PLAYERS; p++ )
{
m_MemoryCardDisplay[p].Load( (PlayerNumber)p );
m_MemoryCardDisplay[p].SetName( ssprintf("MemoryCardDisplayP%d",p+1) );
UtilSetXY( m_MemoryCardDisplay[p], "MenuElements" );
UtilOnCommand( m_MemoryCardDisplay[p], "MenuElements" );
this->AddChild( &m_MemoryCardDisplay[p] );
}
}
m_bTimerEnabled = (TIMER_SECONDS != -1);
if( m_bTimerEnabled )
{
m_MenuTimer->SetName( "Timer" );
UtilSetXY( m_MenuTimer, "MenuElements" );
UtilOnCommand( m_MenuTimer, "MenuElements" );
if( TIMER_SECONDS > 0 && PREFSMAN->m_bMenuTimer && !GAMESTATE->m_bEditing )
m_MenuTimer->SetSeconds( TIMER_SECONDS );
@@ -79,11 +95,13 @@ void MenuElements::Load( CString sClassName )
m_autoFooter.Load( THEME->GetPathToG(m_sName+" footer") );
m_autoFooter->SetName("Footer");
UtilSetXY( m_autoFooter, "MenuElements" );
UtilOnCommand( m_autoFooter, "MenuElements" );
this->AddChild( m_autoFooter );
m_textHelp->SetName( "HelpDisplay", "Help" );
m_textHelp->Load();
UtilSetXY( m_textHelp, "MenuElements" );
UtilOnCommand( m_textHelp, "MenuElements" );
CStringArray asHelpTips;
split( THEME->GetMetric(m_sName,"HelpText"), "\n", asHelpTips );
@@ -122,6 +140,8 @@ void MenuElements::StartTransitioning( ScreenMessage smSendWhenDone )
UtilOffCommand( m_autoHeader, "MenuElements" );
UtilOffCommand( m_sprStyleIcon, "MenuElements" );
for( int p=0; p<NUM_PLAYERS; p++ )
UtilOffCommand( m_MemoryCardDisplay[p], "MenuElements" );
UtilOffCommand( m_autoFooter, "MenuElements" );
UtilOffCommand( m_textHelp, "MenuElements" );
@@ -164,6 +184,8 @@ void MenuElements::DrawTopLayer()
m_autoHeader->Draw();
m_sprStyleIcon.Draw();
for( int p=0; p<NUM_PLAYERS; p++ )
m_MemoryCardDisplay[p].Draw();
if( m_bTimerEnabled )
m_MenuTimer->Draw();
m_autoFooter->Draw();
+2
View File
@@ -18,6 +18,7 @@
#include "BGAnimation.h"
#include "ActorUtil.h"
#include "RageSound.h"
#include "MemoryCardDisplay.h"
class MenuTimer;
class HelpDisplay;
@@ -47,6 +48,7 @@ public: // let owner tinker with these objects
AutoActor m_autoHeader;
Sprite m_sprStyleIcon;
MemoryCardDisplay m_MemoryCardDisplay[NUM_PLAYERS];
MenuTimer *m_MenuTimer;
AutoActor m_autoFooter;
HelpDisplay *m_textHelp;
+2
View File
@@ -12,6 +12,7 @@
#include "SongManager.h"
#include "PrefsManager.h"
#include "arch/ArchHooks/ArchHooks.h"
#include "MemoryCardManager.h"
void ModeChoice::Init()
{
@@ -288,6 +289,7 @@ void ModeChoice::Apply( PlayerNumber pn ) const
if( m_style != STYLE_INVALID )
{
PROFILEMAN->LoadFirstAvailableProfile( pn );
MEMCARDMAN->LockCards( true );
}
}
+59 -32
View File
@@ -1,5 +1,5 @@
# Microsoft Developer Studio Project File - Name="StepMania" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# Microsoft Developer Studio Generated Build File, Format Version 60000
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
@@ -65,7 +65,7 @@ IntDir=.\../Debug6
TargetDir=\stepmania\stepmania\Program
TargetName=StepMania-debug
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
# End Special Build Tool
@@ -82,24 +82,28 @@ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
XBCP=xbecopy.exe
# ADD BASE XBCP /NOLOGO
# ADD XBCP /NOLOGO
XBE=imagebld.exe
# ADD BASE XBE /nologo /stack:0x10000 /debug
# ADD XBE /nologo /stack:0x10000 /debug /out:"../default.xbe"
LINK32=link.exe
# ADD BASE LINK32 xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /incremental:no /debug /machine:I386 /subsystem:xbox /fixed:no /TMP
# ADD LINK32 xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /incremental:no /debug /machine:I386 /nodefaultlib:"libcd" /nodefaultlib:"libcmt" /out:"../StepManiaXbox-debug.exe" /subsystem:xbox /fixed:no /TMP
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
CPP=cl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_XBOX" /D "_DEBUG" /YX /FD /G6 /Ztmp /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /I "SDL_sound-1.0.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /D "OGG_ONLY" /YX /FD /G6 /Ztmp /c
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /incremental:no /debug /machine:I386 /subsystem:xbox /fixed:no /TMP
# ADD LINK32 xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /incremental:no /debug /machine:I386 /nodefaultlib:"libcd" /nodefaultlib:"libcmt" /out:"../StepManiaXbox-debug.exe" /subsystem:xbox /fixed:no /TMP
XBE=imagebld.exe
# ADD BASE XBE /nologo /stack:0x10000 /debug
# ADD XBE /nologo /stack:0x10000 /debug /out:"../default.xbe"
XBCP=xbecopy.exe
# ADD BASE XBCP /NOLOGO
# ADD XBCP /NOLOGO
# Begin Special Build Tool
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \
/Fo$(IntDir)\
IntDir=.\Debug
TargetDir=\stepmania\stepmania
TargetName=default
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \
/Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
# End Special Build Tool
@@ -139,7 +143,7 @@ IntDir=.\../Release6
TargetDir=\stepmania\stepmania\Program
TargetName=StepMania
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
# End Special Build Tool
@@ -157,27 +161,31 @@ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania
# PROP Intermediate_Dir "StepMania___Xbox_Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
XBCP=xbecopy.exe
# ADD BASE XBCP /NOLOGO
# ADD XBCP /NOLOGO
XBE=imagebld.exe
# ADD BASE XBE /nologo /stack:0x10000 /debug
# ADD XBE /nologo /testid:"123456" /stack:0x10000 /debug /out:"../default.xbe"
CPP=cl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /Fr /YX"global.h" /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /I "SDL_sound-1.0.0" /D "WIN32" /D "_XBOX" /D "NDEBUG" /YX"global.h" /FD /c
# SUBTRACT CPP /Fr
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 $(intdir)\verstub.obj xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:IX86 /nodefaultlib:"libcmtd.lib" /out:"../StepMania-debug.exe"
# SUBTRACT BASE LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
# ADD LINK32 $(intdir)\verstub.obj xapilib.lib d3d8.lib d3dx8.lib xgraphics.lib dsound.lib dmusic.lib xnet.lib xboxkrnl.lib libcmt.lib /nologo /incremental:no /pdb:"../release6xbox/StepMania.pdb" /machine:I386 /nodefaultlib:"libc" /nodefaultlib:"libcmtd" /out:"../StepManiaXbox.exe" /subsystem:xbox /fixed:no /TMP /OPT:REF
# SUBTRACT LINK32 /pdb:none /map /debug
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
CPP=cl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /Fr /YX"global.h" /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /I "SDL_sound-1.0.0" /D "WIN32" /D "_XBOX" /D "NDEBUG" /YX"global.h" /FD /c
# SUBTRACT CPP /Fr
XBE=imagebld.exe
# ADD BASE XBE /nologo /stack:0x10000 /debug
# ADD XBE /nologo /testid:"123456" /stack:0x10000 /debug /out:"../default.xbe"
XBCP=xbecopy.exe
# ADD BASE XBCP /NOLOGO
# ADD XBCP /NOLOGO
# Begin Special Build Tool
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \
/Fo$(IntDir)\
IntDir=.\StepMania___Xbox_Release
TargetDir=\stepmania\stepmania
TargetName=default
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \
/Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
# End Special Build Tool
@@ -4018,6 +4026,25 @@ SOURCE=.\JukeboxMenu.h
# End Source File
# Begin Source File
SOURCE=.\MemoryCardDisplay.cpp
!IF "$(CFG)" == "StepMania - Win32 Debug"
!ELSEIF "$(CFG)" == "StepMania - Xbox Debug"
!ELSEIF "$(CFG)" == "StepMania - Win32 Release"
!ELSEIF "$(CFG)" == "StepMania - Xbox Release"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\MemoryCardDisplay.h
# End Source File
# Begin Source File
SOURCE=.\MenuElements.cpp
!IF "$(CFG)" == "StepMania - Win32 Debug"
+6
View File
@@ -1231,6 +1231,12 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File
RelativePath="JukeboxMenu.h">
</File>
<File
RelativePath="MemoryCardDisplay.cpp">
</File>
<File
RelativePath="MemoryCardDisplay.h">
</File>
<File
RelativePath="MenuElements.cpp">
</File>
@@ -12,6 +12,8 @@ struct UsbStorageDevice
iDeviceOnBus = -1;
iPortOnHub = -1;
iUsbStorageIndex = -1;
sSerial = "";
sOsMountDir = "";
};
int iBus;
int iDeviceOnBus;
@@ -51,7 +51,7 @@ void MemoryCardDriver_Windows::GetStorageDevices( vector<UsbStorageDevice>& vDev
bool MemoryCardDriver_Windows::MountAndTestWrite( UsbStorageDevice* pDevice )
{
if( !pDevice->sOsMountDir.empty() )
if( pDevice->sOsMountDir.empty() )
return false;
// TODO: Use RageFileDirect here to detect ready state?
@@ -74,12 +74,11 @@ bool MemoryCardDriver_Windows::MountAndTestWrite( UsbStorageDevice* pDevice )
// Try to write a file.
// TODO: Can we use RageFile for this?
CString sFile = pDevice->sOsMountDir;
sFile += "temp";
int fd = open( sFile, _O_WRONLY|_O_CREAT|_O_TRUNC );
if( fd == -1 )
CString sFile = pDevice->sOsMountDir + "temp";
FILE* fp = fopen( sFile, "w" );
if( fp == NULL )
return false;
close( fd );
fclose( fp );
remove( sFile );
return true;